code:
#	$OpenBSD: GENERIC,v 1.802 2015/07/23 00:38:06 deraadt Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
#
# For further information on hardware support for this architecture, see
# the intro(4) man page.  For further information about kernel options
# for this architecture, see the options(4) man page.  For an explanation
# of each device driver in this file see the section 4 man page for the
# device.

machine		i386
include		"../../../conf/GENERIC"
maxusers	80			# estimated number of users

option		USER_PCICONF	# user-space PCI configuration

#option		VM86		# Virtual 8086 emulation
option		KVM86		# Kernel Virtual 8086 emulation
option		USER_LDT	# user-settable LDT; see i386_set_ldt(2)
option		APERTURE	# in-kernel aperture driver for XFree86
option		MTRR		# CPU memory range attributes control

#option		KGDB		# Remote debugger support; exclusive of DDB
#option		"KGDB_DEVNAME=\"com\"",KGDBADDR=0x2f8,KGDBRATE=9600

option		COMPAT_LINUX	# binary compatibility with Linux

#option		GPT		# GPT partition table support
option		NTFS		# NTFS support
option		HIBERNATE	# Hibernate support

config		bsd	swap generic

mainbus0 at root

cpu0	at mainbus?
bios0	at mainbus0
ioapic*	at mainbus?
apm0	at bios0 flags 0x0000	# flags 0x0101 to force protocol version 1.1
acpi0	at bios?
mpbios0	at bios0
pcibios0 at bios0 flags 0x0000	# use 0x30 for a total verbose
ipmi0	at mainbus? disable	# IPMI
esm0	at mainbus? 		# Dell Embedded Server Management
amdmsr0	at mainbus?		# MSR access for AMD Geode LX CPUs with GP

pvbus0	at mainbus0		# Paravirtual device bus
vmt0	at pvbus?		# VMware Tools

acpitimer*	at acpi?
acpihpet*	at acpi?
acpiac*		at acpi?
acpibat*	at acpi?
acpibtn*	at acpi?
acpicpu*	at acpi?
acpidock*	at acpi?
acpiec*		at acpi?
acpimadt0	at acpi?
acpimcfg*	at acpi?
acpiprt*	at acpi?
acpitz*		at acpi?
acpiasus*	at acpi?
acpisony*	at acpi?
acpithinkpad*	at acpi?
acpitoshiba*	at acpi?
acpivideo*	at acpi?
acpivout*	at acpivideo?
acpipwrres*	at acpi?
aibs*		at acpi?

option		PCIVERBOSE
option		EISAVERBOSE
option		USBVERBOSE

isa0	at mainbus0
isa0	at pcib?
isa0	at amdpcib?
isa0	at tcpcib?
isa0	at ichpcib?
isa0	at piixpcib?
isa0	at gscpcib?
isa0	at glxpcib?
eisa0	at mainbus0
pci*	at mainbus0

pchb*	at pci?			# PCI-Host bridges
ppb*	at pci?			# PCI-PCI bridges
pci*	at ppb?
pci*	at pchb?
pcib*	at pci?			# PCI-ISA bridge
amdpcib* at pci?		# AMD 8111 LPC bridge
tcpcib*	at pci?			# Intel Atom E600 LPC bridge
ichpcib* at pci?		# Intel ICHx/ICHx-M LPC bridges
piixpcib* at pci?		# Intel PIIX4 PCI-ISA bridge
gscpcib* at pci?		# NS Geode SC1100 PCI-ISA bridge
gpio*	at gscpcib?
glxpcib* at pci?		# AMD CS5536 PCI-ISA bridge
gpio*	at glxpcib?
iic*	at glxpcib?
kate*	at pci?			# AMD K8 temperature sensor
km*	at pci?			# AMD K10 temperature sensor
amas*	at pci? disable		# AMD memory configuration

# power management and other environmental stuff
elansc*	at pci?			# AMD Elan SC520 System Controller
gpio*	at elansc?
geodesc* at pci?		# Geode SC1100/SCx200 IAOC
#gscpm*	at pci?			# NS Geode SC1100 SMI/ACPI module
#ichwdt* at pci?		# Intel 6300ESB ICH watchdog timer
wdt0	at pci?			# Ind Computer Source PCI-WDT50x driver
berkwdt0 at pci?		# Berkshire PCI-PC Watchdog driver
pwdog0	at pci?			# Quancom PWDOG1 watchdog timer

# National Semiconductor LM7[89] and compatible hardware monitors
lm0	at isa? port 0x290
#lm1	at isa? port 0x280
#lm2	at isa? port 0x310
nsclpcsio* at isa? port 0x2e		# NS PC87366 LPC Super I/O
nsclpcsio* at isa? port 0x4e
gpio*	at nsclpcsio?
gscsio*	at isa?	port 0x2e		# NS Geode SC1100 Super I/O
gscsio*	at isa?	port 0x15c
iic*	at gscsio?			# ACCESS.bus 1 & 2
piixpm* at pci?				# Intel PIIX power management
iic*	at piixpm?
alipm*	at pci?				# Acer Labs M7101 power management
iic*	at alipm?
ichiic*	at pci?				# Intel ICH SMBus controller
iic*	at ichiic?
viapm*	at pci?				# VIA SMBus controller
iic*	at viapm?
amdiic*	at pci?				# AMD-8111 SMBus controller
iic*	at amdiic?
nviic*	at pci?				# NVIDIA nForce2/3/4 SMBus controller
iic*	at nviic?
amdpm*	at pci?				# AMD-7xx/8111 and NForce SMBus controller
iic*	at amdpm?

it*	at isa? port 0x2e		# ITE IT8705F, IT8712F, IT8716F,
it*	at isa? port 0x4e		# IT8718F, IT8726F and SiS SiS950
					# monitors and watchdog timer

schsio*	at isa? port 0x2e		# SMSC SCH311x Super I/O
schsio*	at isa? port 0x4e
schsio*	at isa? port 0x162e
schsio*	at isa? port 0x164e

viasio*	at isa? port 0x2e flags 0x0000	# VIA VT1211 LPC Super I/O
viasio*	at isa? port 0x4e flags 0x0000
wbsio*	at isa? port 0x2e		# Winbond LPC Super I/O
wbsio*	at isa? port 0x4e
lm*	at wbsio?
uguru0	at isa? disable port 0xe0	# ABIT uGuru
fins0	at isa? port 0x4e		# Fintek F71805 Super I/O

aps0	at isa? port 0x1600		# ThinkPad Active Protection System

itherm*	at pci?				# Intel 3400 Thermal Sensor
adc*	at iic?				# Analog Devices AD7416/AD7417/7418
andl*	at iic?				# Andigilog aSC7611
adl*	at iic?				# Andigilog aSC7621
admtemp* at iic?			# Analog Devices ADM1021
admlc*	at iic?				# Analog Devices ADM1024
admcts*	at iic?				# Analog Devices ADM1026
admtm*	at iic?				# Analog Devices ADM1025
admtmp*	at iic?				# Analog Devices ADM1030
admtt*	at iic?				# Analog Devices ADM1031
adt*	at iic?				# Analog Devices ADT7460
lisa*	at iic?				# STMicroelectronics LIS331DL motion
lm*	at iic?				# National Semiconductor LM78/79
lmenv*	at iic?				# National Semiconductor LM87
lmtemp*	at iic?				# National Semiconductor LM75/LM77
lmn*	at iic?				# National Semiconductor LM93
maxds*	at iic?				# Maxim DS1631/1624/1721
maxtmp*	at iic?				# Maxim MAX6642/MAX6690
asbtm*	at iic?				# Asus ASB100
wbenv*	at iic?				# Winbond W83L784R/W83L785R/W83L785TS-L
glenv*	at iic?				# Genesys Logic GL518SM
thmc*	at iic?				# TI TMHC50 / Analog ADM1022
spdmem*	at iic?				# SPD memory eeproms
sdtemp*	at iic?				# SO-DIMM (JC-42.4) temperature
wbng*	at iic?				# Winbond W83793G
nvt*	at iic?				# Novoton W83795G

#isagpio0 at isa? port 0x78		# ISA I/O mapped as GPIO
#isagpio1 at isa? port 0x80

skgpio0 at isa? port 0x680		# Soekris net6501 GPIO and LEDs
gpio* at skgpio?

# ISA PCMCIA controllers
#option PCMCIAVERBOSE
pcic0	at isa? port 0x3e0 iomem 0xd0000 iosiz 0x10000
pcic1	at isa? port 0x3e2 iomem 0xe0000 iosiz 0x4000
pcic2	at isa? port 0x3e4 iomem 0xe0000 iosiz 0x4000
tcic0	at isa? disable port 0x240 iomem 0xd0000 iosiz 0x10000

# ISA Plug-and-Play PCMCIA controllers
#option DEBUG_ISAPNP
pcic*	at isapnp?

# PCI PCMCIA controllers
pcic*	at pci?

# PCMCIA bus support
pcmcia*	at pcic?
pcmcia* at tcic?

# CardBus bus support
cardbus*	at cardslot?
pcmcia*		at cardslot?
cbb*		at pci?
cardslot*	at cbb?

# USB Controllers
xhci*	at pci?				# eXtensible Host Controller
ehci*	at pci?				# Enhanced Host Controller
ehci*	at cardbus?			# Enhanced Host Controller
uhci*	at pci?				# Universal Host Controller (Intel)
uhci*	at cardbus?			# Universal Host Controller (Intel)
ohci*	at pci?				# Open Host Controller
ohci*	at cardbus?			# Open Host Controller

# USB bus support
usb*	at xhci?
usb*	at ehci?
usb*	at uhci?
usb*	at ohci?

# USB devices
uhub*	at usb?			# USB Hubs
uhub*	at uhub?		# USB Hubs
ualea*	at uhub?		# Araneus Alea II TRNG
umodem*	at uhub?		# USB Modems/Serial
ucom*	at umodem?
uvisor*	at uhub?		# Handspring Visor
ucom*	at uvisor?
uvscom*	at uhub?		# SUNTAC Slipper U VS-10U serial
ucom*	at uvscom?
ubsa*	at uhub?		# Belkin serial adapter
ucom*	at ubsa?
uftdi*	at uhub?		# FTDI FT8U100AX serial adapter
ucom*	at uftdi?
uplcom* at uhub?		# I/O DATA USB-RSAQ2 serial adapter
ucom*	at uplcom?
umct*	at uhub?		# MCT USB-RS232 serial adapter
ucom*	at umct?
uslcom*	at uhub?		# Silicon Laboratories CP210x serial
ucom*	at uslcom?
uark*	at uhub?		# Arkmicro ARK3116 serial
ucom*	at uark?
moscom*	at uhub?		# MosChip MCS7703 serial
ucom*	at moscom?
umcs*	at uhub?		# MosChip MCS78x0 serial
ucom*	at umcs?
uipaq*	at uhub?		# iPAQ serial adapter
ucom*	at uipaq?
umsm*	at uhub?		# Qualcomm MSM EVDO
ucom*	at umsm?
uchcom*	at uhub?		# WinChipHead CH341/340 serial
ucom*	at uchcom?
uaudio* at uhub?		# USB Audio
audio*	at uaudio?
umidi*	at uhub?		# USB MIDI
midi*	at umidi?
ulpt*	at uhub?		# USB Printers
umass*	at uhub?		# USB Mass Storage devices
ubcmtp*	at uhub?		# Broadcom USB trackpad
wsmouse* at ubcmtp? mux 0
uhidev*	at uhub?		# Human Interface Devices
ums*	at uhidev?		# USB mouse
wsmouse* at ums? mux 0
uts*	at uhub?		# USB touchscreen
wsmouse* at uts? mux 0
ukbd*	at uhidev?		# USB keyboard
wskbd*	at ukbd? mux 1
ucycom*	at uhidev?		# Cypress serial
ucom*	at ucycom?
uslhcom* at uhidev?		# Silicon Labs CP2110 USB HID UART
ucom*	at uslhcom?
uticom* at uhub?		# TI serial
ucom*	at uticom?
uhid*	at uhidev?		# USB generic HID support
upd*	at uhidev?		# USB Power Devices sensors
aue*	at uhub?		# ADMtek AN986 Pegasus Ethernet
atu*	at uhub?		# Atmel AT76c50x based 802.11b
axe*	at uhub?		# ASIX Electronics AX88172 USB Ethernet
axen*	at uhub?		# ASIX Electronics AX88179 USB Ethernet
cue*	at uhub?		# CATC USB-EL1201A based Ethernet
kue*	at uhub?		# Kawasaki KL5KUSB101B based Ethernet
smsc*	at uhub?		# SMSC LAN95xx Ethernet
cdce*	at uhub?		# CDC Ethernet
urndis*	at uhub?		# Remote NDIS Ethernet
upl*	at uhub?		# Prolific PL2301/PL2302 host-to-host `network'
ugl*	at uhub?		# Genesys Logic GL620USB-A host-to-host `network'
udav*	at uhub?		# Davicom DM9601 based Ethernet
mos*	at uhub?		# MOSCHIP MCS7730/7830 10/100 Ethernet
url*	at uhub?		# Realtek RTL8150L based adapters
wi*	at uhub?		# WaveLAN IEEE 802.11DS
udsbr*	at uhub?		# D-Link DSB-R100 radio
radio*	at udsbr?		# USB radio
uberry*	at uhub?		# Research In Motion BlackBerry
ugen*	at uhub?		# USB Generic driver
uath*	at uhub?		# Atheros AR5005UG/AR5005UX
ural*	at uhub?		# Ralink RT2500USB
rum*	at uhub?		# Ralink RT2501USB/RT2601USB
run*	at uhub?		# Ralink RT2700U/RT2800U/RT3000U
otus*	at uhub?		# Atheros AR9001U
athn*	at uhub?		# Atheros AR9002U
zyd*	at uhub?		# Zydas ZD1211
upgt*	at uhub?		# Conexant/Intersil PrismGT SoftMAC USB
urtw*	at uhub?		# Realtek 8187
rsu*	at uhub?		# Realtek RTL8188SU/RTL8191SU/RTL8192SU
urtwn*	at uhub?		# Realtek RTL8188CU/RTL8192CU
udcf*	at uhub?		# Gude Expert mouseCLOCK
umbg*	at uhub?		# Meinberg Funkuhren USB5131
uthum*	at uhidev?		# TEMPerHUM sensor
ugold*	at uhidev?		# gold TEMPer sensor
utrh*	at uhidev?		# USBRH sensor
utwitch* at uhidev?		# YUREX BBU sensor
uow*	at uhub?		# Maxim/Dallas DS2490 1-Wire adapter
uoakrh*	at uhidev?		# Toradex OAK temp and rel humidity
uoaklux* at uhidev?		# Toradex OAK LUX
uoakv*	at uhidev?		# Toradex OAK 10V sensor
onewire* at uow?
uvideo* at uhub?		# USB video
video*  at uvideo?
udl*	at uhub?		# DisplayLink USB displays
wsdisplay* at udl?

puc*	at pci?			# PCI "universal" communication device
com*	at cardbus?

sdhc*	at pci?			# SD Host Controller
sdmmc*	at sdhc?		# SD/MMC bus
rtsx*	at pci?			# Realtek SD Card Reader
sdmmc*	at rtsx?		# SD/MMC bus

npx0	at isa? port 0xf0 irq 13	# math coprocessor
isadma0	at isa?
isapnp0	at isa?

option	WSDISPLAY_COMPAT_USL		# VT handling
option	WSDISPLAY_COMPAT_RAWKBD		# provide raw scancodes; needed for X11
option	WSDISPLAY_DEFAULTSCREENS=6	# initial number of text consoles
option	WSDISPLAY_COMPAT_PCVT		# emulate some ioctls; needed for X11

pckbc0		at isa? flags 0x00	# PC keyboard controller
pckbd*		at pckbc?	# PC keyboard
pms*		at pckbc?	# PS/2 mouse for wsmouse
vga0		at isa?
option		X86EMU		# to POST video cards
vga*		at pci?
pcdisplay0	at isa?		# CGA, MDA, EGA, HGA
wsdisplay0	at vga? console 1
wsdisplay0	at pcdisplay? console 1
wskbd*		at pckbd? mux 1
wsmouse*	at pms? mux 0

intagp*		at vga?		# intel integrated graphics agp
aliagp*		at pchb?
amdagp*		at pchb?
intelagp*	at pchb?
sisagp*		at pchb?
viaagp*		at pchb?
#mmuagp*	at pchb?

agp*		at intagp?	# AGP bridges
agp*		at aliagp?	# AGP bridges
agp*		at amdagp?	# AGP bridges
agp*		at intelagp?	# AGP bridges
agp*		at sisagp?	# AGP bridges
agp*		at viaagp?	# AGP bridges
#agp*		at mmuagp?

inteldrm*	at vga?		# Intel i915, i945 DRM driver
drm0		at inteldrm? console 1
drm*		at inteldrm?
radeondrm*	at pci? 	# ATI Radeon DRM driver
drm0		at radeondrm? console 1
drm*		at radeondrm?
wsdisplay0	at radeondrm? console 1
wsdisplay*	at radeondrm?

#option		VESABIOSVERBOSE
#option		VESAFB		# VESA bios framebuffer support for X11
#vesabios0	at mainbus?

pcppi0		at isa?

com0	at isa? port 0x3f8 irq 4	# standard PC serial ports
com1	at isa? port 0x2f8 irq 3
com2	at isa? port 0x3e8 irq 5
com3	at isa? disable port 0x2e8 irq 9 # (conflicts with some video cards)
#com4	at isa? port 0x220 irq 4	# Fujitsu Stylistic Touchscreen
ast0	at isa? port 0x1a0 irq 5	# AST 4-port serial card
#ast1	at isa? port 0x2a0 irq 6	# 2nd AST 4-port serial card
com*	at ast?
#boca0	at isa? port 0x100 irq 5	# BOCA 8-port serial cards
#com*	at boca?
#addcom0	at isa? port 0x108 irq 5	# Addonics FlexPort
#com*	at addcom?
#rtfps0	at isa? port 0x1230 irq 10	# RT 4-port serial cards
#com*	at rtfps?
#hsq0	at isa? port 0x140 irq 10	# Hostess 4-port serial card
#com*	at hsq?
com*	at pcmcia?			# PCMCIA modems/serial ports
com*	at isapnp?
com*	at puc?
com*	at cardbus?

# option for using CD1400 handshaking for incoming data
# requires a special cable that exchanges the RTS and DTR lines
# options CY_HW_RTS
cy0	at isa? iomem 0xd4000 irq 12	# ISA cyclom serial card
cy*	at pci?				# PCI cyclom serial card
#cz*	at pci?				# Cyclades-Z multi-port serial boards

lpt0	at isa? port 0x378 irq 7	# standard PC parallel ports
lpt1	at isa? port 0x278
lpt2	at isa? port 0x3bc
lpt*	at puc?

bha0	at isa? port 0x330		# BusLogic [57]4X SCSI controllers
bha1	at isa? disable port 0x334	# BusLogic [57]4X SCSI controllers
bha2	at isa? disable
bha*	at pci?
#bha*	at eisa?		# XXX eisa still runs in isa-compat
aha0	at isa? port 0x330	# Adaptec 154[02] SCSI controllers
aha1	at isa? port 0x334	# Adaptec 154[02] SCSI controllers
aha*	at isapnp?
ahb*	at eisa?		# Adaptec 174[024] SCSI controllers
#ahc0	at isa?			# Adaptec 284x SCSI controllers
ahc*	at eisa?		# Adaptec 274x, aic7770 SCSI controllers
ahc*	at pci?			# Adaptec 2940/3940/78?? SCSI controllers
jmb*	at pci?			# JMicron JMB36x controllers
ahci*	at jmb? flags 0x0000	# flags 0x0001 to force SATA 1 (1.5Gb/s)
pciide*	at jmb?
ahci*	at pci?	flags 0x0000	# AHCI SATA controllers
				# flags 0x0001 to force SATA 1 (1.5Gb/s)
sili*	at pci?			# Silicon Image 3124/3132/3531 SATA controllers
ahd*	at pci?			# Adaptec 79?? SCSI controllers
arc*	at pci?			# Areca RAID Controllers
mpi*	at pci?			# LSI Logic Fusion MPT Message Passing Interface
mpii*	at pci?			# LSI Fusion MPT Message Passing Interface II
gdt*	at pci?			# ICP Vortex GDT RAID controllers
twe*	at pci?			# 3ware Escalade RAID controllers
#aac*	at pci?			# Adaptec FSA RAID controllers
ami*	at pci?			# AMI MegaRAID controllers
mfi*	at pci?			# LSI MegaRAID SAS controllers
mfii*	at pci?			# LSI MegaRAID SAS Fusion controllers
cac*	at pci?			# Compaq Smart ARRAY [234]* RAID controllers
cac*	at eisa?
ciss*	at pci?			# Compaq Smart ARRAY [56]* RAID controllers
iha*	at pci?			# Initio Ultra/UltraWide SCSI controllers
ips*	at pci?			# IBM ServeRAID controllers
qlw*	at pci?			# QLogic ISP SCSI
qla*	at pci?			# QLogic ISP 2[123]xx FibreChannel
qle*	at pci?			# QLogic ISP 2[45]xx FibreChannel
aic0	at isa? port 0x340 irq 11 # Adaptec 152[02] SCSI controllers
aic*	at pcmcia?		# PCMCIA based aic SCSI controllers
aic*	at isapnp?		# isapnp configured aic SCSI controllers
#esp*	at pcmcia?		# PCMCIA based NCR 53C9X SCSI
siop*	at pci?			# NCR 538XX SCSI controllers(new)
adv*	at pci?			# AdvanSys 1200A/B and ULTRA SCSI
adw*	at pci?			# AdvanSys ULTRA WIDE SCSI
pcscp*	at pci?			# AMD 53c974 PCscsi-PCI SCSI
sea0	at isa? disable iomem 0xc8000 irq 5 # Seagate ST0[12] SCSI controllers
trm*	at pci?			# Tekram DC-3x5U SCSI Controllers
uha0	at isa? port 0x330	# UltraStor [13]4f SCSI controllers
uha1	at isa? disable port 0x334 # UltraStor [13]4f SCSI controllers
uha*	at eisa?		# UltraStor 24f SCSI controllers
wds0	at isa? disable port 0x350 irq 15 drq 6	# WD7000 and TMC-7000 controllers
#wds1	at isa? port 0x358 irq 11 drq 5
vmwpvs*	at pci?			# VMware ParaVirtual SCSI

scsibus* at scsi?
sd*	at scsibus?		# SCSI disk drives
st*	at scsibus?		# SCSI tape drives
cd*	at scsibus?		# SCSI CD-ROM drives
ch*	at scsibus?		# SCSI autochangers
safte*	at scsibus?		# SCSI accessed fault-tolerant enclosures
ses*	at scsibus?		# SCSI enclosure services
uk*	at scsibus?		# unknown SCSI

mpath0	at root
emc*	at scsibus?
hds*	at scsibus?
rdac*	at scsibus?
sym*	at scsibus?

fdc0	at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
#fdc1	at isa? port 0x370
fd*	at fdc? flags 0x00

# IDE controllers
pciide* at pci? flags 0x0000

wdc0	at isa? port 0x1f0 irq 14 flags 0x00
wdc1	at isa? port 0x170 irq 15 flags 0x00
wdc*	at pcmcia?
wdc*	at isapnp?

# IDE hard drives
wd*	at wdc? flags 0x0000
wd*	at pciide? flags 0x0000

# ATAPI<->SCSI
atapiscsi* at wdc?
atapiscsi* at pciide?

# Networking devices
we0	at isa? port 0x280 iomem 0xd0000 irq 9	# WD/SMC 80x3 ethernet
we1	at isa? port 0x300 iomem 0xcc000 irq 10	#
#we2	at isa? port 0x280 iomem 0xd0000 irq 3	# WD/SMC 80x3 ethernet
we*	at isapnp?
ec0	at isa? port 0x250 iomem 0xd8000 irq 9	# 3C503 ethernet
ne0	at isa? port 0x240 irq 9		# NE[12]000 ethernet
ne1	at isa? port 0x300 irq 10		# NE[12]000 ethernet
ne2	at isa? port 0x280 irq 9		# NE[12]000 ethernet
ne*	at isapnp?				# NE[12]000 PnP ethernet
eg0	at isa? disable port 0x310 irq 5	# 3C505/Etherlink+ ethernet
el0	at isa? disable port 0x300 irq 9	# 3C501 ethernet
ep0	at isa?					# 3C509 ethernet
ep*	at isapnp?				# 3C509 PnP ethernet
ep*	at isa?					# 3C509 ethernet
ef*	at isapnp?				# 3C515 PnP ethernet
ie0	at isa? port 0x360 iomem 0xd0000 irq 7	# StarLAN and 3C507
#ie1	at isa? port 0x300 irq 10		# EtherExpress
lc0	at isa? port 0x200			# DEC EtherWorks
lc1	at isa? port 0x280			# DEC EtherWorks
le0	at isa? port 0x360 irq 15 drq 6		# IsoLan, NE2100, and DEPCA
ex0	at isa? port 0x320 irq 5		# Intel EtherExpress PRO/10
sm0	at isa? port 0x300 irq 10		# SMC 91cxx-based ethernet
ep*	at eisa?			# 3C579 ethernet
le*	at isapnp?
pcn*	at pci?				# AMD PCnet-PCI Ethernet
de*	at pci?				# DC21X4X-based ethernet
fxp*	at pci?				# EtherExpress 10/100B ethernet
fxp*	at cardbus?			# Intel PRO/100 ethernet
ne*	at pci?				# NE2000-compat ethernet
ep*	at pci?				# 3C59x ethernet
ne*	at pcmcia?			# PCMCIA based NE2000 ethernet
ep*	at pcmcia?			# PCMCIA based 3C5xx ethernet
sm*	at pcmcia?			# PCMCIA based sm ethernet
xe*	at pcmcia?			# Xircom ethernet
xl*	at pci?				# 3C9xx ethernet
xl*	at cardbus?			# 3C575/3C656 ethernet
rl*	at pci?				# Realtek 81[23]9 ethernet
rl*	at cardbus?			# Realtek 81[23]9 ethernet
mtd*	at pci?				# Myson MTD800/803/891
epic*	at pci?				# SMC EPIC/100 ethernet
tl*	at pci?				# Compaq Thunderlan ethernet
vr*	at pci?				# VIA Rhine ethernet
wb*	at pci?				# Winbond W89C840F ethernet
sf*	at pci?				# Adaptec AIC-6915 ethernet
sis*	at pci?				# SiS 900/7016 ethernet
se*	at pci?				# SiS 190/191 ethernet
ste*	at pci?				# Sundance ST201 ethernet
dc*	at pci?				# 21143, "tulip" clone ethernet
dc*	at cardbus?			# 21143, "tulip" clone ethernet
ti*	at pci?				# Alteon Tigon 1Gb ethernet
skc*	at pci?				# SysKonnect GEnesis 984x
sk*	at skc?				#  each port of above
mskc*	at pci?				# Marvell Yukon-2
msk*	at mskc?			#  each port of above
em*	at pci?				# Intel Pro/1000 ethernet
gcu*	at pci?				# Intel Pro/1000 ethernet GCU
ixgb*	at pci?				# Intel Pro/10Gb ethernet
ix*	at pci?				# Intel 82598EB 10Gb ethernet
myx*	at pci?				# Myricom Myri-10G 10Gb ethernet
oce*	at pci?				# Emulex OneConnect 10Gb ethernet
txp*	at pci?				# 3com 3CR990
nge*	at pci?				# NS DP83820/DP83821 GigE
bge*	at pci?				# Broadcom BCM57xx (aka Tigon3)
bnx*	at pci?				# Broadcom BCM5706/5708 GigE
re*	at pci?				# Realtek 8169/8169S/8110S
re*	at cardbus?			# Realtek 8169/8169S/8110S
stge*	at pci?				# Sundance TC9021 GigE
lge*	at pci?				# Level1 LXT1001 GigE
hme*	at pci?				# Sun Happy Meal
bce*	at pci?				# Broadcom BCM4401
vge*	at pci?				# VIA VT612x
nfe*	at pci?				# NVIDIA nForce Ethernet
xge*	at pci?				# Neterion Xframe-I/II 10Gb ethernet
thtc*	at pci?				# Tehuti Networks 10Gb ethernet
tht*	at thtc?
gem*	at pci?				# Sun GEM 10/100/Gigabit
cas*	at pci?				# Sun Cassini 100/Gigabit
vic*	at pci?				# VMware VMXnet virtual interface
vmx*	at pci?				# VMware VMXNET3 virtual interface
et*	at pci?				# Agere/LSI ET1310
age*	at pci?				# Attansic L1 Ethernet
alc*	at pci?				# Attansic L1C/L1D/L2C Ethernet
ale*	at pci?				# Attansic L1E Ethernet
lii*	at pci?				# Attansic L2 Ethernet
jme*	at pci?				# JMicron JMC250/JMC260 Ethernet
vte*	at pci?				# RDC R6040 Ethernet

# Wireless network cards
acx*	at pci?				# TI ACX100/ACX111 (802.11b/g)
acx*	at cardbus?			# TI ACX100/ACX111 (802.11b/g)
ath*	at pci?				# Atheros AR5k (802.11a/b/g)
ath*	at cardbus?			# Atheros AR5k (802.11a/b/g)
athn*	at pci?				# Atheros AR9k (802.11a/g/n)
athn*	at cardbus?			# Atheros AR9k (802.11a/g/n)
atw*	at pci?				# ADMtek ADM8211 (802.11)
atw*	at cardbus?			# ADMtek ADM8211 (802.11)
bwi*	at pci?				# Broadcom AirForce (802.11b/g)
bwi*	at cardbus?			# Broadcom AirForce (802.11b/g)
wi*	at pci?				# WaveLAN IEEE 802.11DS
wi*	at pcmcia?			# WaveLAN IEEE 802.11DS
an*	at pci?				# Aironet IEEE 802.11DS
an*	at isapnp?			# Aironet IEEE 802.11DS
an*	at pcmcia?			# Aironet IEEE 802.11DS
#cnw*	at pcmcia?			# Xircom Netwave
ipw*	at pci?				# Intel PRO/Wireless 2100
iwi*	at pci?				# Intel PRO/Wireless 2200BG/2915ABG
wpi*	at pci?				# Intel PRO/Wireless 3945ABG
iwn*	at pci?				# Intel WiFi Link 4965/5000/1000/6000
iwm*	at pci?				# Intel WiFi Link 7xxx
ral*	at pci?				# Ralink RT2500/RT2501/RT2600
ral*	at cardbus?			# Ralink RT2500/RT2501/RT2600
rtw*	at pci?				# Realtek 8180
rtw*	at cardbus?			# Realtek 8180
rtwn*	at pci?				# Realtek 8188CE/8192CE
pgt*	at pci?				# Prism54 (only full-mac varients)
pgt*	at cardbus?			# Prism54 (only full-mac varients)
malo*	at pci?				# Marvell Libertas
malo*	at cardbus?			# Marvell Libertas
malo*	at pcmcia?			# Marvell 88W8385
mbg*	at pci?				# Meinberg Funkuhren radio clocks

# Media Independent Interface (mii) drivers
exphy*	at mii?				# 3Com internal PHYs
inphy*	at mii?				# Intel 82555 PHYs
iophy*	at mii?				# Intel 82553 PHYs
icsphy*	at mii?				# ICS 1890 PHYs
lxtphy*	at mii?				# Level1 LXT970 PHYs
nsphy*	at mii?				# NS and compatible PHYs
nsphyter*	at mii?			# NS and compatible PHYs
qsphy*	at mii?				# Quality Semi QS6612 PHYs
luphy*	at mii?				# Lucent LU6612 PHY
sqphy*	at mii?				# Seeq 8x220 PHYs
tlphy*	at mii?				# ThunderLAN PHYs
rlphy* at mii?				# Realtek 8139 internal PHYs
mtdphy* at mii?				# Myson MTD972 PHYs
dcphy*	at mii?				# Digital Clone PHYs
acphy*	at mii?				# Altima AC101 PHYs
amphy*	at mii?				# AMD 79C873 PHYs
tqphy*	at mii?				# TDK 78Q212x PHYs
bmtphy*	at mii?				# Broadcom 10/100 PHYs
brgphy*	at mii?				# Broadcom Gigabit PHYs
eephy* at mii?				# Marvell 88E1000 series PHY
xmphy*	at mii?				# XaQti XMAC-II PHYs
nsgphy*	at mii?				# NS gigabit PHYs
urlphy*	at mii?				# Realtek RTL8150L internal PHY
rgephy*	at mii?				# Realtek 8169S/8110S PHY
ciphy*	at mii?				# Cicada CS8201 10/100/1000 copper PHY
gentbi*	at mii?				# Generic 1000BASE-X ten-bit PHY
etphy*	at mii?				# Agere/LSI ET1011 TruePHY
jmphy*	at mii?				# JMicron JMP202/JMP211 PHYs
atphy*	at mii?				# Attansic F1 PHYs
rdcphy*	at mii?				# RDC R6040 PHY
ipgphy*	at mii?				# IC Plus IP1000A PHYs
mlphy*	at mii?				# Micro Linear 6692 PHY
ukphy*	at mii?				# "unknown" PHYs

eap*	at pci?				# Ensoniq AudioPCI S5016
eso*	at pci?				# ESS Solo-1 PCI AudioDrive
sv*	at pci?				# S3 SonicVibes (S3 617)
neo*	at pci?				# NeoMagic 256AV/ZX
cmpci*	at pci?				# C-Media CMI8338/8738
auacer*	at pci?				# Acer Labs M5455
auglx*	at pci?				# AMD Geode CS5536 Audio
auich*	at pci? flags 0x0000		# i82801 ICH AC'97 audio
auixp*	at pci?				# ATI IXP AC'97 Audio
autri*	at pci? flags 0x0000		# Trident 4D WAVE
auvia*	at pci?				# VIA VT82C686A
azalia* at pci?				# High Definition Audio
clcs*	at pci?				# CS4280 CrystalClear audio
clct*	at pci?				# CS4281 CrystalClear audio
fms*	at pci?				# Forte Media FM801
maestro* at pci?			# ESS Maestro PCI
esa*	at pci?				# ESS Maestro3 PCI
yds*	at pci? flags 0x0000		# Yamaha YMF Audio
emu*	at pci?				# SB Live!
envy*	at pci?				# VIA Envy24 (aka ICE1712)
sb0	at isa? port 0x220 irq 5 drq 1	# SoundBlaster
sb*	at isapnp?
ess*	at isapnp?			# ESS Tech ES188[78], ES888
wss0	at isa? port 0x530 irq 10 drq 0	# Windows Sound System
wss*	at isapnp?
pas0	at isa? port 0x220 irq 7 drq 1	# ProAudio Spectrum
gus0	at isa? port 0x220 irq 7 drq 1 drq2 6	# Gravis (drq2 is record drq)
gus*	at isapnp?
ym*	at isapnp?
mpu*	at isapnp?
mpu*	at isa? port 0x300		# generic MPU, Yamaha SW60XG

# MIDI support
midi*	at sb?			# SB MPU401 port
midi*	at ym?
midi*	at mpu?
midi*	at autri?
midi*	at eap?
midi*	at envy?

spkr0	at pcppi?		# PC speaker

# Audio Support
audio*	at sb?
audio*	at gus?
audio*	at pas?
audio*	at ess?
audio*	at wss?
audio*	at ym?
audio*	at eap?
audio*	at envy?
audio*	at eso?
audio*	at sv?
audio*	at neo?
audio*	at cmpci?
audio*	at clcs?
audio*	at clct?
audio*	at auacer?
audio*	at auglx?
audio*	at auich?
audio*	at auixp?
audio*	at autri?
audio*	at auvia?
audio*	at azalia?
audio*	at fms?
audio*	at maestro?
audio*	at esa?
audio*	at yds?
audio*	at emu?

bktr0	at pci?

# FM-Radio devices
#gtp*	at pci?			# Gemtek/Guillemot Radio PCI Radio Card
#sfr0	at isa? port 0x384	# SoundForte RadioLink SF16-FMR FM Radio Card
#sf2r0	at isa? port 0x384	# SoundForte RadioLink SF16-FMR2 FM Radio Card
#az0	at isa? port 0x350	# Aztech/PackardBell FM Radio Card
#rt0	at isa? port 0x30c	# AIMS Lab Radiotrack FM Radio Card
#rt*	at isapnp?
#rtii0	at isa? port 0x30c	# AIMS Lab Radiotrack II FM Radio Card

# FM-Radio support
radio*	at bktr?
radio*	at fms?
#radio*	at gtp?
#radio*	at sfr?
#radio*	at sf2r?
#radio*	at az?
#radio*	at rt?
#radio*	at rtii?

# Joystick driver. Probe is a little strange; add only if you have one.
#joy0	at isa? port 0x201
joy*	at isapnp?

# crypto support
hifn*	at pci?			# Hi/fn 7751 crypto card
ubsec*	at pci?			# Bluesteel Networks 5xxx crypto card
safe*	at pci?			# SafeNet SafeXcel 1141/1741
glxsb*	at pci?			# AMD Geode LX series processor security block

# GPIO ``pin bus'' drivers
#gpioiic* at gpio? offset 0 mask 0x3	# I2C bus bit-banging
gpioiic* at gpio?
iic*	at gpioiic?
#gpioow* at gpio? offset 0 mask 0x1	# 1-Wire bus bit-banging
gpioow*	at gpio?
onewire* at gpioow?

# 1-Wire devices
option ONEWIREVERBOSE
owid*	at onewire?		# ID
owsbm*	at onewire?		# Smart Battery Monitor
owtemp* at onewire?		# Temperature
owctr*	at onewire?		# Counter device

pseudo-device	pctr		1
pseudo-device	nvram		1
pseudo-device	hotplug		1	# devices hot plugging

# mouse & keyboard multiplexor pseudo-devices
pseudo-device	wsmux		2

# Virtio devices
virtio*		at pci? 	# Virtio PCI device
vioblk*		at virtio?	# Virtio block device
vio*		at virtio?	# Virtio network device
viomb*		at virtio?	# Virtio memory ballooning device
viornd*		at virtio?	# Virtio entropy device
vioscsi*	at virtio?	# Virtio SCSI device


code:
#	$OpenBSD: GENERIC.MP,v 1.9 2014/09/03 07:44:33 blambert Exp $
#
#	GENERIC.MP - sample multiprocessor kernel
#

include "arch/i386/conf/GENERIC"

option		MULTIPROCESSOR	# Multiple processor support
#option		MP_LOCKDEBUG

cpu*		at mainbus?

license: unknown


code:
#	$OpenBSD: Makefile.i386,v 1.92 2015/01/13 01:12:49 deraadt Exp $

# For instructions on building kernels consult the config(8) and options(4)
# manual pages.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
# DEBUG is set to -g by config if debugging is requested (config -g).
# PROF is set to -pg by config if profiling is requested (config -p).

.include <bsd.own.mk>

SIZE?=	size
STRIP?=	strip

# source tree is located via $S relative to the compilation directory
.ifndef S
S!=	cd ../../../..; pwd
.endif

_machdir?=	$S/arch/${_mach}
_archdir?=	$S/arch/${_arch}

INCLUDES=	-nostdinc -I$S -I. -I$S/arch
CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
CWARNFLAGS=	-Werror -Wall -Wimplicit-function-declaration \
		-Wno-main -Wno-uninitialized \
		-Wframe-larger-than=2047

CMACHFLAGS=
CMACHFLAGS+=	-fno-builtin-printf -fno-builtin-snprintf \
		-fno-builtin-vsnprintf -fno-builtin-log \
		-fno-builtin-log2 -fno-builtin-malloc ${NOPIE_FLAGS}
.if ${IDENT:M-DNO_PROPOLICE}
CMACHFLAGS+=	-fno-stack-protector
.endif

COPTS?=		-O2
CFLAGS=		${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
AFLAGS=		-D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS}
LINKFLAGS=	-Ttext 0xD0200120 -e start -N --warn-common -nopie

.if ${MACHINE} == "amd64"
CFLAGS+=	-m32
AFLAGS+=	-m32
LINKFLAGS+= -melf_i386_obsd
.endif

.if ${IDENT:M-DDDB_STRUCT}
DB_STRUCTINFO=	db_structinfo.h
.else
DB_STRUCTINFO=
.endif

HOSTCC?=	${CC}
HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
HOSTED_CFLAGS=	${CFLAGS}
HOSTED_C=	${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<

NORMAL_C_NOP=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<

%OBJS

%CFILES

%SFILES

# load lines for config "xxx" will be emitted as:
# xxx: ${SYSTEM_DEP} swapxxx.o
#	${SYSTEM_LD_HEAD}
#	${SYSTEM_LD} swapxxx.o
#	${SYSTEM_LD_TAIL}
SYSTEM_HEAD=	locore.o param.o ioconf.o
SYSTEM_OBJ=	${SYSTEM_HEAD} ${OBJS}
SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
SYSTEM_LD_HEAD=	@rm -f $@
SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@

DEBUG?=
.if ${DEBUG} == "-g"
LINKFLAGS+=	-X
STRIPFLAGS=	-g -x
SYSTEM_LD_TAIL+=; \
		echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
.else
LINKFLAGS+=	-S -x
.endif

%LOAD

# cc's -MD puts the source and output paths in the dependency file;
# since those are temp files here we need to fix it up.  It also
# puts the file in /tmp, so we use -MF to put it in the current
# directory as assym.P and then generate assym.d from it with a
# good target name
assym.h: $S/kern/genassym.sh Makefile \
	 ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf
	cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \
	    sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -MF assym.P > assym.h.tmp
	sed '1s/.*/assym.h: \\/' assym.P > assym.d
	sort -u assym.h.tmp > assym.h

param.c: $S/conf/param.c
	rm -f param.c
	cp $S/conf/param.c .

param.o: param.c Makefile
	${NORMAL_C}

mcount.o: $S/lib/libkern/mcount.c Makefile
	${NORMAL_C_NOP}

ioconf.o: ioconf.c
	${NORMAL_C}

vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
	sh $S/conf/newvers.sh
	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c

clean::
	rm -f eddep *bsd *bsd.gdb tags *.[dio] [a-z]*.s \
	    [Ee]rrs linterrs assym.h ${DB_STRUCTINFO}

lint:
	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
	    ${CFILES} ioconf.c param.c | \
	    grep -v 'static function .* unused'

depend:
	@touch $@

tags:
	@echo "see $S/kern/Makefile for tags"

db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.pl
	${CC} ${CFLAGS} ${CPPFLAGS} -MT $@ -gstabs -c $S/ddb/db_structinfo.c
	objdump -g db_structinfo.o | perl $S/ddb/parse_structinfo.pl > $@
	rm -f db_structinfo.o

locore.o: ${_machdir}/${_mach}/locore.s assym.h
in_cksum.o mptramp.o kvm86call.o acpi_wakecode.o: assym.h

# The install target can be redefined by putting a
# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
MACHINE_NAME!=  uname -n
install: install-kernel-${MACHINE_NAME}
.if !target(install-kernel-${MACHINE_NAME}})
install-kernel-${MACHINE_NAME}:
	cmp -s bsd /bsd || ln -f /bsd /obsd
	cp bsd /nbsd
	mv /nbsd /bsd
.endif

# pull in the dependency information
.if !empty(DB_STRUCTINFO) && !exists(${DB_STRUCTINFO})
 ${SYSTEM_OBJ}: ${DB_STRUCTINFO}
.endif
.ifnmake clean
. for o in ${SYSTEM_OBJ} assym.h ${DB_STRUCTINFO}
.  if exists(${o:R}.d)
.   include "${o:R}.d"
.  elif exists($o)
    .PHONY: $o
.  endif
. endfor
.endif

%RULES


code:
#	$OpenBSD: RAMDISK,v 1.191 2015/07/17 22:52:28 tedu Exp $

machine		i386
maxusers	4

option		TIMEZONE=0
option		DST=0
option		SMALL_KERNEL
option		NO_PROPOLICE
option		BOOT_CONFIG

option		RAMDISK_HOOKS
option		MINIROOTSIZE=3872

option		PCIVERBOSE
option		SCSITERSE

option		FFS
option		MSDOSFS

config		bsd root on rd0a swap on rd0b and wd0b and sd0b

mainbus0	at root

acpi0		at bios?
#acpitimer*	at acpi?
#acpihpet*	at acpi?
#acpiac*	at acpi?
#acpibat*	at acpi?
#acpibtn*	at acpi?
#acpicpu*	at acpi?
acpiec*		at acpi?
acpiprt*	at acpi?
acpimadt0	at acpi?
#acpitz*	at acpi?

cpu0		at mainbus?
bios0		at mainbus0
ioapic*		at mainbus?
apm0		at bios0 flags 0x0000	# flags 0x0101 to force protocol version 1.1
mpbios0		at bios0
pcibios0	at bios0 flags 0x0000

isa0		at mainbus0
isa0		at pcib?
pci*		at mainbus0

pchb*		at pci?			# PCI-Host bridges
ppb*		at pci?			# PCI-PCI bridges
pci*		at ppb?
pci*		at pchb?
pcib*		at pci?			# PCI-ISA bridge
geodesc*	at pci?		# Geode SC1100/SCx200 IAOC

pcic0		at isa? port 0x3e0 iomem 0xd0000 iosiz 0x4000
pcic1		at isa? port 0x3e2 iomem 0xd4000 iosiz 0x4000
pcic2		at isa? port 0x3e4 iomem 0xd4000 iosiz 0x4000
pcic*		at pci?
pcmcia*		at pcic?

xhci*		at pci?
ehci*		at pci?
uhci*		at pci?
ohci*		at pci?
usb*		at xhci?
usb*		at ehci?
usb*		at uhci?
usb*		at ohci?
uhub*		at usb?
umass*		at uhub?
uhidev*		at uhub?		# Human Interface Devices
ukbd*		at uhidev?		# USB keyboard
wskbd*		at ukbd? mux 1

npx0		at isa? port 0xf0 irq 13	# math coprocessor
isadma0		at isa?

pckbc0		at isa?			# PC keyboard controller
pckbd*		at pckbc?		# PC keyboard
wskbd*		at pckbd? mux 1
vga0		at isa?
vga*		at pci?
pcdisplay0	at isa?			# CGA, MDA, EGA, HGA
wsdisplay*	at vga?
wsdisplay*	at pcdisplay?

com0		at isa? port 0x3f8 irq 4	# standard PC serial ports
com1		at isa? port 0x2f8 irq 3
com2		at isa? port 0x3e8 irq 5

scsibus*	at scsi?
sd*		at scsibus?		# SCSI disk drives
cd*		at scsibus?		# SCSI CD-ROM drives

fdc0		at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
fd*		at fdc?

pciide*		at pci? flags 0x0000
wdc0		at isa? port 0x1f0 irq 14 flags 0x00
wdc1		at isa? port 0x170 irq 15 flags 0x00
wdc*		at pcmcia?
wd*		at wdc? flags 0x0000
wd*		at pciide? flags 0x0000
atapiscsi*	at wdc?
atapiscsi*	at pciide?

#ahc0		at isa?			# Adaptec 284x SCSI controllers
#ahd*		at pci?			# Adaptec 79?? SCSI controllers
mpi*		at pci?			# LSI Logic Fusion-MPT Message Passing Interface
#ami*		at pci?			# AMI MegaRAID controllers
#mfi*		at pci?			# LSI MegaRAID SAS controllers

de*		at pci?			# DC21X4X-based ethernet cards
fxp*		at pci?			# EtherExpress 10/100B ethernet cards
ne*		at pci?			# NE2000-compat ethernet cards
ne*		at pcmcia?		# PCMCIA based NE2000 cards
rl*		at pci?			# Realtek 81[23]9 ethernet
dc*		at pci?			# 21143, "tulip" clone ethernet
em*		at pci?			# Intel Pro/1000 ethernet
re*		at pci?			# Realtek 8169/8169S/8110S
#bge*		at pci?			# Broadcom BCM570x (aka Tigon3)

inphy*		at mii?			# Intel 82555 PHYs
iophy*		at mii?			# Intel 82553 PHYs
icsphy*		at mii?			# ICS 1890 PHYs
nsphy*		at mii?			# NS and compatible PHYs
nsphyter*	at mii?			# NS and compatible PHYs
rlphy*		at mii?			# Realtek 8139 internal PHYs
mtdphy*		at mii?			# Myson MTD972 PHYs
dcphy*		at mii?			# Digital Clone PHYs
amphy*		at mii?			# AMD 79C873 PHYs
tqphy*		at mii?			# TDK 78Q212x PHYs
bmtphy*		at mii?			# Broadcom 10/100 PHYs
rgephy*		at mii?			# Realtek 8169S/8110S PHY
ukphy*		at mii?			# "unknown" PHYs

pseudo-device	loop 1
pseudo-device	bpfilter 1
pseudo-device	rd 1
pseudo-device	wsmux 2


code:
#	$OpenBSD: RAMDISK_CD,v 1.226 2015/07/17 22:52:28 tedu Exp $

machine		i386
maxusers	4

option		TIMEZONE=0
option		DST=0
option		SMALL_KERNEL
option		NO_PROPOLICE
option		BOOT_CONFIG

option		RAMDISK_HOOKS
option		MINIROOTSIZE=3872

option		PCIVERBOSE
option		SCSITERSE

option		FFS
option		FFS2
option		EXT2FS
option		NFSCLIENT
option		CD9660
option		UDF
option		MSDOSFS
option		INET6
option		CRYPTO

config		bsd root on rd0a swap on rd0b and wd0b and sd0b

mainbus0	at root

acpi0		at bios?
#acpitimer*	at acpi?
#acpihpet*	at acpi?
#acpiac*	at acpi?
#acpibat*	at acpi?
#acpibtn*	at acpi?
#acpicpu*	at acpi?
acpiec*		at acpi?
acpimadt0	at acpi?
acpiprt*	at acpi?
#acpitz*	at acpi?

mpbios0		at bios0

cpu0		at mainbus?
bios0		at mainbus0
ioapic*		at mainbus?
apm0		at bios0 flags 0x0000	# flags 0x0101 to force protocol version 1.1
pcibios0	at bios0 flags 0x0000

isa0		at mainbus0
isa0		at pcib?
eisa0		at mainbus0
pci*		at mainbus0

pchb*		at pci?			# PCI-Host bridges
ppb*		at pci?			# PCI-PCI bridges
pci*		at ppb?
pci*		at pchb?
pcib*		at pci?			# PCI-ISA bridge
geodesc*	at pci?		# Geode SC1100/SCx200 IAOC

cardbus*	at cardslot?
pcmcia*		at cardslot?
cbb*		at pci?
cardslot*	at cbb?
pcic0		at isa? port 0x3e0 iomem 0xd0000 iosiz 0x4000
pcic1		at isa? port 0x3e2 iomem 0xd4000 iosiz 0x4000
pcic2		at isa? port 0x3e4 iomem 0xd4000 iosiz 0x4000
pcic*		at pci?
pcmcia*		at pcic?

xhci*		at pci?
ehci*		at pci?
ehci*		at cardbus?
uhci*		at pci?
ohci*		at pci?
ohci*		at cardbus?
usb*		at xhci?
usb*		at ehci?
usb*		at uhci?
usb*		at ohci?

uhub*		at usb?
uhub*		at uhub?
uhidev*		at uhub?
ukbd*		at uhidev?
wskbd*		at ukbd? mux 1
umass*		at uhub?
aue*		at uhub?		# ADMtek AN986 Pegasus Ethernet
axe*		at uhub?		# ASIX Electronics AX88172 USB Ethernet
axen*		at uhub?		# ASIX Electronics AX88179 USB Ethernet
cue*		at uhub?		# CATC USB-EL1201A based Ethernet
kue*		at uhub?		# Kawasaki KL5KUSB101B based Ethernet
smsc*		at uhub?		# SMSC LAN95xx Ethernet
cdce*		at uhub?		# CDC Ethernet
udav*		at uhub?		# Davicom DM9601 based Ethernet
mos*		at uhub?		# MOSCHIP MCS7730/7830 10/100 Ethernet
url*		at uhub?		# Realtek RTL8150L based adapters
wi*		at uhub?		# WaveLAN IEEE 802.11DS
ural*		at uhub?		# Ralink RT2500
rum*		at uhub?		# Ralink RT2501USB/RT2601USB
run*		at uhub?		# Ralink RT2700U/RT2800U/RT3000U
zyd*		at uhub?		# Zydas ZD1211/ZD1211B
upgt*		at uhub?		# Conexant/Intersil PrismGT SoftMAC USB
urtw*		at uhub?		# Realtek 8187
urtwn*		at uhub?		# Realtek RTL8188CU/RTL8192CU

npx0		at isa? port 0xf0 irq 13	# math coprocessor
isadma0		at isa?
isapnp0		at isa?

pckbc0		at isa?		# PC keyboard controller
pckbd*		at pckbc?	# PC keyboard
wskbd*		at pckbd? mux 1
vga0		at isa?
vga*		at pci?
pcdisplay0	at isa?		# CGA, MDA, EGA, HGA
wsdisplay*	at vga?
wsdisplay*	at pcdisplay?

com0		at isa? port 0x3f8 irq 4	# standard PC serial ports
com1		at isa? port 0x2f8 irq 3
com2		at isa? port 0x3e8 irq 5
com*		at pcmcia?			# PCMCIA modem cards
com*		at isapnp?

bha0		at isa? port 0x330	# BusLogic [57]4X SCSI controllers
bha*		at pci?
aha0		at isa? port 0x330	# Adaptec 154[02] SCSI controllers
aha1		at isa? port 0x334	# Adaptec 154[02] SCSI controllers
aha*		at isapnp?
ahb*		at eisa?		# Adaptec 174[024] SCSI controllers
ahc*		at eisa?		# Adaptec 274x, aic7770 SCSI controllers
ahc*		at pci?			# Adaptec 2940/3940/78?? SCSI controllers
jmb*		at pci?			# JMicron JMB36x controllers
ahci*		at jmb?
pciide*		at jmb?
ahci*		at pci?			# AHCI SATA controllers
sili*		at pci?			# Silicon Image 3124/3132/3531 SATA controllers
ahd*		at pci?			# Adaptec 79?? SCSI controllers
arc*		at pci?			# Areca RAID Controllers
mpi*		at pci?			# LSI Logic Fusion-MPT Message Passing Interface
mpii*		at pci?			# LSI Fusion-MPT Message Passing Interface II
gdt*		at pci?			# ICP Vortex GDT RAID controllers
ami*		at pci?			# AMI MegaRAID controllers
mfi*		at pci?			# LSI MegaRAID SAS controllers
mfii*		at pci?			# LSI MegaRAID SAS Fusion controllers
cac*		at pci?			# Compaq Smart ARRAY [234]* RAID controllers
cac*		at eisa?
ciss*		at pci?			# Compaq Smart ARRAY [56]* RAID controllers
twe*		at pci?			# 3ware Escalade RAID controllers
ips*		at pci?			# IBM ServeRAID controllers
qlw*		at pci?			# QLogic ISP SCSI
qla*		at pci?			# QLogic ISP 2[123]xx FibreChannel
qle*		at pci?			# QLogic ISP 2[45]xx FibreChannel
aic0		at isa? port 0x340 irq 11	# Adaptec 152[02] SCSI controllers
aic*		at isapnp?
aic*		at pcmcia?		# PCMCIA based aic SCSI controllers
siop*		at pci?			# NCR 538XX SCSI controllers(new)
adv*		at pci?			# AdvanSys 1200A/B and ULTRA SCSI
adw*		at pci?			# AdvanSys ULTRA WIDE SCSI
pcscp*		at pci?			# AMD 53c974 PCscsi-PCI SCSI
uha0		at isa? port 0x330	# UltraStor [13]4f SCSI controllers
uha*		at eisa?		# UltraStor 24f SCSI controllers
vmwpvs*		at pci?			# VMware ParaVirtual SCSI
softraid0	at root

scsibus*	at scsi?
sd*		at scsibus?		# SCSI disk drives
st*		at scsibus?		# SCSI tape drives
cd*		at scsibus?		# SCSI CD-ROM drives

fdc0		at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
fd*		at fdc?

pciide*		at pci? flags 0x0000
wdc0		at isa? port 0x1f0 irq 14 flags 0x00
wdc1		at isa? port 0x170 irq 15 flags 0x00
wdc*		at pcmcia?
wdc*		at isapnp?
wd*		at wdc? flags 0x0000
wd*		at pciide? flags 0x0000
atapiscsi*	at wdc?
atapiscsi*	at pciide?

sdhc*		at pci?			# SD Host Controller
sdmmc*		at sdhc?		# SD/MMC bus
rtsx*		at pci?			# Realtek SD Card Reader
sdmmc*		at rtsx?		# SD/MMC bus

we0		at isa? port 0x280 iomem 0xd0000 irq 9	# WD/SMC 80x3 ethernet series
we1		at isa? port 0x300 iomem 0xcc000 irq 10	#
we*		at isapnp?
ec0		at isa? port 0x250 iomem 0xd8000 irq 9	# 3C503 ethernet
ne0		at isa? port 0x240 irq 9	# NE[12]000 ethernet
ne1		at isa? port 0x300 irq 10	# NE[12]000 ethernet
ne2		at isa? port 0x280 irq 9	# NE[12]000 ethernet
ne*		at isapnp?			# NE[12]000 PnP ethernet
ep0		at isa?				# 3C509 ethernet
ep*		at isa?				# 3C509 ethernet
ep*		at isapnp?			# 3C509 PnP ethernet
ef*		at isapnp?			# 3C515 PnP ethernet
ie0		at isa? port 0x360 iomem 0xd0000 irq 7	# StarLAN and 3C507
le0		at isa? port 0x360 irq 15 drq 6	# IsoLan, NE2100, and DEPCA
ex0		at isa? port 0x320 irq 5	# Intel EtherExpress PRO/10
ep*		at eisa?			# 3C579 ethernet
ef*		at isapnp?			# 3C515 ethernet
le*		at isapnp?
pcn*		at pci?				# AMD PCnet-PCI Ethernet
de*		at pci?				# DC21X4X-based ethernet
fxp*		at pci?				# EtherExpress 10/100B ethernet
fxp*		at cardbus?			# Intel PRO/100 ethernet
ep*		at pci?				# 3C59x ethernet
ne*		at pci?				# NE2000-compat ethernet
ne*		at pcmcia?			# PCMCIA based NE2000 ethernet
ep*		at pcmcia?			# PCMCIA based 3C5xx ethernet
sm*		at pcmcia?			# PCMCIA based sm ethernet
xe*		at pcmcia?			# Xircom ethernet
xl*		at pci?				# 3C9xx ethernet
xl*		at cardbus?			# 3C575 ethernet
rl*		at pci?				# Realtek 81[23]9 ethernet
rl*		at cardbus?			# Realtek 81[23]9 ethernet
epic*		at pci?				# SMC EPIC/100 ethernet
tl*		at pci?				# Compaq Thunderlan ethernet
vr*		at pci?				# VIA Rhine ethernet
dc*		at pci?				# 21143, "tulip" clone ethernet
dc*		at cardbus?			# 21143, "tulip" clone ethernet
ste*		at pci?				# Sundance ST201 ethernet
sis*		at pci?				# SiS 900/7016 ethernet
se*		at pci?				# SiS 190/191 ethernet
wb*		at pci?				# Winbond W89C840F ethernet
sf*		at pci?				# Adaptec AIC-6915 ethernet
ti*		at pci?				# Alteon Tigon 1Gb ethernet
skc*		at pci?				# SysKonnect GEnesis 984x
sk*		at skc?				#  each port of above
mskc*		at pci?				# Marvell Yukon-2
msk*		at mskc?			#  each port of above
em*		at pci?				# Intel Pro/1000 ethernet
gcu*		at pci?				# Intel EP80579 auxlliary mii device
ixgb*		at pci?				# Intel Pro/10Gb ethernet
ix*		at pci?				# Intel 82598EB 10Gb ethernet
oce*		at pci?				# Emulex OneConnect 10Gb ethernet
txp*		at pci?				# 3com 3CR990
nge*		at pci?				# NS DP83820/DP83821 GigE
re*		at pci?				# Realtek 8169/8169S/8110S
re*		at cardbus?			# Realtek 8169/8169S/8110S
stge*		at pci?				# Sundance TC9021 GigE
bge*		at pci?				# Broadcom BCM57xx (aka Tigon3)
bnx*		at pci?				# Broadcom BCM5706/5708 GigE
lge*		at pci?				# Level1 LXT1001 GigE
mtd*		at pci?				# Myson MTD803
hme*		at pci?				# Sun Happy Meal
bce*		at pci?				# Broadcom BCM4401
vge*		at pci?				# VIA VT612x
nfe*		at pci?				# NVIDIA nForce Ethernet
xge*		at pci?				# Neterion Xframe-I/II 10Gb ethernet
vic*		at pci?				# VMware VMXnet virtual interface
vmx*		at pci?				# VMware VMXNET3 virtual interface
et*		at pci?				# Agere/LSI ET1310
age*		at pci?				# Attansic L1 Ethernet
alc*		at pci?				# Attansic L1C/L1D/L2C Ethernet
ale*		at pci?				# Attansic L1E Ethernet
lii*		at pci?				# Attansic L2 Ethernet
jme*		at pci?				# JMicron JMC250/JMC260 Ethernet
vte*		at pci?				# RDC R6040 Ethernet

acx*		at pci?				# TI ACX100/ACX111 (802.11b/g)
acx*		at cardbus?			# TI ACX100/ACX111 (802.11b/g)
ath*		at pci?				# Atheros AR5k (802.11a/b/g)
ath*		at cardbus?			# Atheros AR5k (802.11a/b/g)
athn*		at pci?				# Atheros AR9k (802.11a/g/n)
athn*		at cardbus?			# Atheros AR9k (802.11a/g/n)
atw*		at pci?				# ADMtek ADM8211 (802.11)
atw*		at cardbus?			# ADMtek ADM8211 (802.11)
bwi*		at pci?				# Broadcom AirForce (802.11b/g)
bwi*		at cardbus?			# Broadcom AirForce (802.11b/g)
wi*		at pci?				# WaveLAN IEEE 802.11DS
wi*		at pcmcia?			# WaveLAN IEEE 802.11DS
an*		at pcmcia?			# Aironet IEEE 802.11DS
ipw*		at pci?				# Intel PRO/Wireless 2100
iwi*		at pci?				# Intel PRO/Wireless 2200BG/2915ABG
wpi*		at pci?				# Intel PRO/Wireless 3945ABG
iwn*		at pci?				# Intel Wireless WiFi Link 4965AGN
iwm*		at pci?				# Intel WiFi Link 7xxx
ral*		at pci?				# Ralink RT2500/RT2501/RT2600
ral*		at cardbus?			# Ralink RT2500/RT2501/RT2600
rtw*		at pci?				# Realtek 8180
rtw*		at cardbus?			# Realtek 8180
rtwn*		at pci?				# Realtek 8188CE/8192CE
pgt*		at pci?				# Prism54 (only full-mac varients)
pgt*		at cardbus?			# Prism54 (only full-mac varients)
malo*		at cardbus?			# Marvell Libertas
malo*		at pcmcia?			# Marvell 88W8385

exphy*		at mii?				# 3Com internal PHYs
inphy*		at mii?				# Intel 82555 PHYs
iophy*		at mii?				# Intel 82553 PHYs
icsphy*		at mii?				# ICS 1890 PHYs
lxtphy*		at mii?				# Level1 LXT970 PHYs
nsphy*		at mii?				# NS and compatible PHYs
nsphyter*	at mii?				# NS and compatible PHYs
qsphy*		at mii?				# Quality Semi QS6612 PHYs
luphy*		at mii?				# Lucent LU6612 PHY
sqphy*		at mii?				# Seeq 8x220 PHYs
tlphy*		at mii?				# ThunderLAN PHYs
rlphy*		at mii?				# Realtek 8139 internal PHYs
mtdphy*		at mii?				# Myson MTD972 PHYs
dcphy*		at mii?				# Digital Clone PHYs
acphy*		at mii?				# Altima AC101 PHYs
amphy*		at mii?				# AMD 79C873 PHYs
tqphy*		at mii?				# TDK 78Q212x PHYs
brgphy*		at mii?				# Broadcom Gigabit PHYs
eephy*		at mii?				# Marvell 88E1000 series PHY
xmphy*		at mii?				# XaQti XMAC-II PHYs
bmtphy*		at mii?				# Broadcom 10/100 PHYs
rgephy*		at mii?				# Realtek 8169S/8110S PHY
urlphy*		at mii?				# Realtek RTL8150L internal PHY
ciphy*		at mii?				# Cicada CS8201 10/100/1000 copper PHY
etphy*		at mii?				# Agere/LSI ET1011 TruePHY
jmphy*		at mii?				# JMicron JMP202/JMP211 PHYs
ipgphy*		at mii?				# IC Plus IP1000A PHYs
atphy*		at mii?				# Attansic F1 PHYs
rdcphy*		at mii?				# RDC R6040 PHY
mlphy*		at mii?				# Micro Linear 6692 PHY
ukphy*		at mii?				# "unknown" PHYs

virtio*		at pci?				# Virtio PCI device
vioblk*		at virtio?			# Virtio block device
vio*		at virtio?			# Virtio network device
vioscsi*	at virtio?			# Virtio SCSI device

pseudo-device	loop 1
pseudo-device	vlan
pseudo-device	trunk
pseudo-device	bpfilter 1
pseudo-device	rd 1
pseudo-device	wsmux 2
pseudo-device	bio 1


code:
#	$OpenBSD: files.i386,v 1.225 2015/07/21 03:38:22 reyk Exp $
#
# new style config file for i386 architecture
#

# maxpartitions must be first item in files.${ARCH}
maxpartitions 16

maxusers 2 16 100

file	arch/i386/i386/autoconf.c
file	arch/i386/i386/bus_space.c
file	arch/i386/i386/bus_dma.c
file	arch/i386/i386/conf.c
file	arch/i386/i386/db_disasm.c	ddb
file	arch/i386/i386/db_interface.c	ddb
file	arch/i386/i386/db_memrw.c	ddb | kgdb
file	arch/i386/i386/db_trace.c	ddb
file	arch/i386/i386/disksubr.c	disk
file	arch/i386/i386/est.c		!small_kernel
file	arch/i386/i386/gdt.c
file	arch/i386/i386/in_cksum.s
file	arch/i386/i386/machdep.c
file	arch/i386/i386/hibernate_machdep.c hibernate
file	arch/i386/i386/via.c
file	arch/i386/i386/amd64errata.c	!small_kernel
file	arch/i386/i386/kgdb_machdep.c	kgdb
file	arch/i386/i386/longrun.c	!small_kernel
file	arch/i386/i386/mem.c
file	arch/i386/i386/i686_mem.c	mtrr
file	arch/i386/i386/k6_mem.c		mtrr
file 	arch/i386/i386/mtrr.c		mtrr
file	arch/i386/i386/p4tcc.c		!small_kernel
file	arch/i386/i386/pmap.c
file	arch/i386/i386/pmapae.c
file	arch/i386/i386/powernow.c	!small_kernel
file	arch/i386/i386/powernow-k7.c	!small_kernel
file	arch/i386/i386/powernow-k8.c	!small_kernel
file	arch/i386/i386/k1x-pstate.c	!small_kernel
file	arch/i386/i386/process_machdep.c
file	arch/i386/i386/sys_machdep.c
file	arch/i386/i386/trap.c
file	arch/i386/i386/vm_machdep.c
file	arch/i386/i386/softintr.c
file	arch/i386/i386/dkcsum.c		bios
file	dev/cninit.c
file	arch/i386/i386/mptramp.s	multiprocessor
file	arch/i386/i386/mp_setperf.c	multiprocessor
file	arch/i386/i386/lock_machdep.c
file	arch/i386/i386/ipifuncs.c	multiprocessor
file	arch/i386/i386/db_mp.c		multiprocessor & ddb
file	arch/i386/i386/wscons_machdep.c	wsdisplay
major	{vnd = 14}

include "dev/rasops/files.rasops"
include "dev/wsfont/files.wsfont"

#
# Media Independent Interface (mii)
#
include "dev/mii/files.mii"

#
# Machine-independent SCSI drivers
#

include "scsi/files.scsi"
major	{sd = 4}
major	{st = 5}
major	{cd = 6}
major	{rd = 17}

#
# Machine-independent ATAPI drivers
#

include "dev/atapiscsi/files.atapiscsi"
include "dev/ata/files.ata"

#
# System bus types
#

define mainbus {[apid = -1]}
device	mainbus: isabus, eisabus, pcibus, mainbus
attach	mainbus at root
file	arch/i386/i386/mainbus.c	mainbus

file   arch/i386/i386/codepatch.c

#device	mca at root {...}

#
# PCI-only drivers
# XXX MUST BE INCLUDED BEFORE files.isa, as long as files.isa attaches
# XXX devices to 'pci'.
#

include "dev/pci/files.pci"
file	arch/i386/pci/pci_machdep.c		pci
file	arch/i386/pci/pciide_machdep.c		pciide
file	arch/i386/pci/pcic_pci_machdep.c	pcic_pci
file	arch/i386/pci/vga_post.c		vga_pci & x86emu

# PCI-Host bridge chipsets
device  pchb: pcibus, agpbus
attach	pchb at pci
file	arch/i386/pci/pchb.c		pchb

# AMAS AMD memory address switch
device  amas
attach  amas at pci
file    dev/pci/amas.c			amas

# AGP bridge support. most attach at pchb
file	arch/i386/pci/agp_machdep.c	agp

# AMD Elan SC520 System Controller (PCI-Host bridge)
device	elansc: gpiobus
attach	elansc at pci
file	arch/i386/pci/elan520.c		elansc

# Geode SC1100
device	geodesc
attach	geodesc at pci
file	arch/i386/pci/geodesc.c		geodesc

# AMD Geode LX series processor security block
device	glxsb
attach	glxsb at pci
file	arch/i386/pci/glxsb.c		glxsb

# National Semiconductor Geode SC1100 SMI/ACPI module
device	gscpm
attach	gscpm at pci
file	arch/i386/pci/gscpm.c		gscpm

# AMD Geode LX series MSR access
device	amdmsr
attach	amdmsr at mainbus
file	arch/i386/i386/amdmsr.c		amdmsr	needs-flag

# PCI-ISA bridge chipsets
device	pcib: isabus
attach	pcib at pci
file	arch/i386/pci/pcib.c		pcib | ichpcib | gscpcib | glxpcib | piixpcib | amdpcib | tcpcib

# Intel ICHx/ICHx-M LPC bridges
device	ichpcib: isabus
attach	ichpcib at pci
file	arch/i386/pci/ichpcib.c		ichpcib

# Intel PIIX4 PCI-ISA bridge
device	piixpcib: isabus
attach	piixpcib at pci
file	arch/i386/pci/piixpcib.c	piixpcib

# National Semiconductor Geode SC1100 PCI-ISA bridge
device	gscpcib: isabus, gpiobus
attach	gscpcib at pci
file	arch/i386/pci/gscpcib.c		gscpcib

# AMD 8111 LPC bridge
device	amdpcib: isabus
attach	amdpcib at pci
file	dev/pci/amdpcib.c		amdpcib

# Intel Atom E600 LPC bridge
device	tcpcib: isabus
attach	tcpcib at pci
file	dev/pci/tcpcib.c		tcpcib

device	hme: ether, ifnet, mii, ifmedia
file	dev/ic/hme.c			hme
attach	hme at pci with hme_pci
file	dev/pci/if_hme_pci.c		hme_pci

#
# ISA and mixed ISA+EISA or ISA+PCI or ISA+PCMCIA drivers
#

major	{wd = 0}
major	{fd = 2}

include "dev/isa/files.isa"
file	arch/i386/isa/isa_machdep.c	isabus

# PC clock
file	arch/i386/isa/clock.c		isabus

# Numeric Processing Extension; Math Co-processor
device	npx
attach	npx at isa
file	arch/i386/isa/npx.c		npx needs-flag

# attribute used to represent the "keyboard controller"
# XXX should be a real device
define pckbcport {[irq = -1], [port = -1]}

# PC Mice; Logitech-style, Microsoft-style, and PS/2-style
device	lms: wsmousedev
attach	lms at isa
file	arch/i386/isa/lms.c		lms needs-flag
device	mms: wsmousedev
attach	mms at isa
file	arch/i386/isa/mms.c		mms needs-flag

include	"dev/wscons/files.wscons"
include	"dev/pckbc/files.pckbc"

# Adaptec AHA-284x VL SCSI controllers
# device declaration in sys/conf/files
attach	ahc at isa with ahc_isa
file	arch/i386/isa/ahc_isa.c		ahc_isa

# Soekris GPIO & LEDs driver
device	skgpio: gpiobus
attach	skgpio at isa
file	dev/isa/skgpio.c		skgpio

# Pentium performance counters
pseudo-device	pctr
file	arch/i386/i386/pctr.c		pctr needs-flag

pseudo-device	nvram
file	arch/i386/i386/nvram.c	nvram needs-flag

#
# EISA-only drivers
#

include "dev/eisa/files.eisa"
file	arch/i386/eisa/eisa_machdep.c	eisa

#
# ISA PnP
#

include "dev/isa/files.isapnp"
file	arch/i386/isa/isapnp_machdep.c	isapnp

# Game adapter (joystick)
device	joy
file	arch/i386/isa/joy.c		joy needs-flag
attach	joy at isa with joy_isa
file	arch/i386/isa/joy_isa.c		joy_isa
attach	joy at isapnp with joy_isapnp
file	arch/i386/isa/joy_isapnp.c	joy_isapnp

#
# Compatibility modules
#

# VM86 mode
file	arch/i386/i386/vm86.c			vm86

# VM86 in kernel
file	arch/i386/i386/kvm86.c			kvm86
file	arch/i386/i386/kvm86call.S		kvm86

# Linux binary compatibility (COMPAT_LINUX)
include "compat/linux/files.linux"
file	arch/i386/i386/linux_machdep.c		compat_linux

device	bios {}
attach	bios at mainbus
file	arch/i386/i386/bios.c		bios needs-count

device	apm
attach	apm at bios
file	arch/i386/i386/apm.c		apm needs-count
file	arch/i386/i386/apmcall.S	apm

file	arch/i386/i386/acpiapm.c

# Intel SMP specification 1.4
define	mpbios
device	mpbios
attach	mpbios at bios
file	arch/i386/i386/mpbios.c		mpbios needs-flag
file	arch/i386/i386/mpbios_intr_fixup.c	mpbios & pci

# CPUS
define	cpu {[apid = -1]}
device	cpu
attach	cpu at mainbus
file	arch/i386/i386/cpu.c		cpu

# Common APIC support routines
file	arch/i386/i386/apic.c		ioapic | lapic

# Local APIC (required for multiprocessor)
define	lapic
file	arch/i386/i386/lapic.c		lapic needs-flag

# I/O APICs
device	ioapic: mpbios, lapic
attach	ioapic at mainbus
file	arch/i386/i386/ioapic.c		ioapic needs-flag

device	pcibios
attach	pcibios at bios
file	arch/i386/pci/pcibios.c		pcibios needs-count
file	arch/i386/pci/pci_intr_fixup.c	pcibios
file	arch/i386/pci/pci_bus_fixup.c	pcibios
file	arch/i386/pci/pci_addr_fixup.c	pcibios
file	arch/i386/pci/opti82c558.c	pcibios
file	arch/i386/pci/opti82c700.c	pcibios
file	arch/i386/pci/piix.c		pcibios
file	arch/i386/pci/rccosb4.c		pcibios
file	arch/i386/pci/sis85c503.c	pcibios
file	arch/i386/pci/via82c586.c	pcibios
file	arch/i386/pci/via8231.c		pcibios
file	arch/i386/pci/amd756.c		pcibios
file	arch/i386/pci/ali1543.c		pcibios

#
# CARDBUS
#
include	"dev/cardbus/files.cardbus"
file	arch/i386/i386/rbus_machdep.c	cardbus

# XXXX pcic here because it needs to be late.  The catch: pcic needs
# to be late, so devices which attach to it are attached late.  But it
# needs to be before its isa and pci attachments.  This answer is
# non-optimal, but I don't have a better answer right now.

# PCIC pcmcia contoller
# XXX this needs to be done very late, so it's done here.  This feels
# like a kludge, but it might be for the best.

device	pcic: pcmciabus
file	dev/ic/i82365.c			pcic

# PCIC pcmcia controller on ISA bus.
attach	pcic at isa with pcic_isa
file	dev/isa/i82365_isa.c		pcic_isa

# PCIC pcmcia controller on PCI bus.
attach	pcic at pci with pcic_pci
file	dev/pci/i82365_pci.c		pcic_pci

# PCIC pcmcia controller on PnP board
attach	pcic at isapnp with pcic_isapnp
file	dev/isa/i82365_isapnp.c	pcic_isapnp

# Code common to ISA and ISAPnP attachments
file	dev/isa/i82365_isasubr.c	pcic_isa | pcic_isapnp | pcic_pci

# Databook TCIC/2 pcmcia/isa bridge
device	tcic: pcmciabus
file	dev/ic/tcic2.c			tcic
attach	tcic at isa with tcic_isa
file	dev/isa/tcic2_isa.c		tcic_isa

#
# Machine-independent PCMCIA drivers
#
include "dev/pcmcia/files.pcmcia"

#
# Machine-independent USB drivers
#
include "dev/usb/files.usb"

#
# Machine-independent I2C drivers
#
include "dev/i2c/files.i2c"

#
# Machine-independent GPIO drivers
#
include "dev/gpio/files.gpio"

#
# Machine-independent 1-Wire drivers
#
include "dev/onewire/files.onewire"

#
# Machine-independent SD/MMC drivers
#
include "dev/sdmmc/files.sdmmc"

include "dev/acpi/files.acpi"
file	arch/i386/i386/acpi_machdep.c		acpi
file	arch/i386/i386/acpi_wakecode.S		acpi & !small_kernel

#
# IPMI
#
attach	ipmi at mainbus

#
# Paravirtual device bus
#
include "dev/pv/files.pv"

# Dell Embedded Systems Management
device	esm
attach	esm at mainbus
file	arch/i386/i386/esm.c			esm needs-flag

#
# VESA
#
include "dev/vesa/files.vesa"

#include "dev/rasops/files.rasops"

# quad support is necessary for 32 bit architectures
file lib/libkern/adddi3.c
file lib/libkern/anddi3.c
file lib/libkern/ashldi3.c
file lib/libkern/ashrdi3.c
file lib/libkern/cmpdi2.c
file lib/libkern/divdi3.c
file lib/libkern/iordi3.c
file lib/libkern/lshldi3.c
file lib/libkern/lshrdi3.c
file lib/libkern/moddi3.c
file lib/libkern/muldi3.c
file lib/libkern/negdi2.c
file lib/libkern/notdi2.c
file lib/libkern/qdivrem.c
file lib/libkern/subdi3.c
file lib/libkern/ucmpdi2.c
file lib/libkern/udivdi3.c
file lib/libkern/umoddi3.c
file lib/libkern/xordi3.c


code:
/eisa_machdep.c/1.15/Sat Jan 24 15:13:55 2015//TOPENBSD_5_8_BASE
/eisa_machdep.h/1.7/Wed Dec  3 15:46:06 2008//TOPENBSD_5_8_BASE
D


code:
/*	$OpenBSD: eisa_machdep.c,v 1.15 2015/01/24 15:13:55 kettenis Exp $	*/
/*	$NetBSD: eisa_machdep.c,v 1.10.22.2 2000/06/25 19:36:58 sommerfeld Exp $	*/

/*-
 * Copyright (c) 1997 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
 * NASA Ames Research Center.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

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

/*
 * Machine-specific functions for EISA autoconfiguration.
 */

#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/device.h>

#include <machine/bus.h>
#include <machine/i8259.h>

#include <dev/isa/isavar.h>
#include <dev/eisa/eisavar.h>

/*
 * EISA doesn't have any special needs; just use the generic versions
 * of these funcions.
 */
struct bus_dma_tag eisa_bus_dma_tag = {
	NULL,			/* _cookie */
	_bus_dmamap_create,
	_bus_dmamap_destroy,
	_bus_dmamap_load,
	_bus_dmamap_load_mbuf,
	_bus_dmamap_load_uio,
	_bus_dmamap_load_raw,
	_bus_dmamap_unload,
	_bus_dmamap_sync,
	_bus_dmamem_alloc,
	_bus_dmamem_alloc_range,
	_bus_dmamem_free,
	_bus_dmamem_map,
	_bus_dmamem_unmap,
	_bus_dmamem_mmap,
};

void
eisa_attach_hook(struct device *parent, struct device *self,
    struct eisabus_attach_args *eba)
{
	/* Nothing to do */
}

int
eisa_maxslots(eisa_chipset_tag_t ec)
{
	/*
	 * Always try 16 slots.
	 */
	return (16);
}

int
eisa_intr_map(eisa_chipset_tag_t ec, u_int irq, eisa_intr_handle_t *ihp)
{
#if NIOAPIC > 0
	struct mp_intr_map *mip;
#endif

	if (irq >= ICU_LEN) {
		printf("eisa_intr_map: bad IRQ %d\n", irq);
		*ihp = -1;
		return (1);
	}
	if (irq == 2) {
		printf("eisa_intr_map: changed IRQ 2 to IRQ 9\n");
		irq = 9;
	}

#if NIOAPIC > 0
	if (mp_busses != NULL) {
		/*
		 * Assumes 1:1 mapping between PCI bus numbers and
		 * the numbers given by the MP bios.
		 * XXX Is this a valid assumption?
		 */

		for (mip = mp_busses[bus].mb_intrs; mip != NULL;
		    mip = mip->next) {
			if (mip->bus_pin == irq) {
				*ihp = mip->ioapic_ih | irq;
				return (0);
			}
		}
		if (mip == NULL)
			printf("eisa_intr_map: no MP mapping found\n");
	}
#endif

	*ihp = irq;
	return (0);
}

const char *
eisa_intr_string(eisa_chipset_tag_t ec, eisa_intr_handle_t ih)
{
	static char irqstr[64];

	if (ih == 0 || (ih & 0xff) >= ICU_LEN || ih == 2)
		panic("eisa_intr_string: bogus handle 0x%x", ih);

#if NIOAPIC > 0
	if (ih & APIC_INT_VIA_APIC) {
		snprintf(irqstr, sizeof irqstr, "apic %d int %d (irq %d)",
		    APIC_IRQ_APIC(ih), APIC_IRQ_PIN(ih), ih & 0xff);
		return (irqstr);
	}
#endif

	snprintf(irqstr, sizeof irqstr, "irq %d", ih);
	return (irqstr);

}

void *
eisa_intr_establish(eisa_chipset_tag_t ec, eisa_intr_handle_t ih, int type,
    int level, int (*func)(void *), void *arg, char *what)
{
#if NIOAPIC > 0
	if (ih != -1) {
		if (ih != -1 && (ih & APIC_INT_VIA_APIC)) {
			return (apic_intr_establish(ih, type, level, func, arg,
			    what));
		}
	}
#endif
	if (ih == 0 || ih >= ICU_LEN || ih == 2)
		panic("eisa_intr_establish: bogus handle 0x%x", ih);

	return (isa_intr_establish(NULL, ih, type, level, func, arg, what));
}

void
eisa_intr_disestablish(eisa_chipset_tag_t ec, void *cookie)
{
	return (isa_intr_disestablish(NULL, cookie));
}


code:
/*	$OpenBSD: eisa_machdep.h,v 1.7 2008/12/03 15:46:06 oga Exp $	*/
/*	$NetBSD: eisa_machdep.h,v 1.4 1997/06/06 23:12:52 thorpej Exp $	*/

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

/*
 * Machine-specific definitions for EISA autoconfiguration.
 */

/*
 * i386-specific EISA definitions.
 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
 */
#define	EISA_ID			"EISA"
#define	EISA_ID_LEN		(sizeof(EISA_ID) - 1)
#define	EISA_ID_PADDR		0xfffd9

extern struct bus_dma_tag eisa_bus_dma_tag;

#define ELCR0	0x4d0		/* eisa irq 0-7 */
#define ELCR1	0x4d1		/* eisa irq 8-15 */

/*
 * Types provided to machine-independent EISA code.
 */
typedef void *eisa_chipset_tag_t;
typedef int eisa_intr_handle_t;

/*
 * Functions provided to machine-independent EISA code.
 */
void		eisa_attach_hook(struct device *, struct device *,
		    struct eisabus_attach_args *);
int		eisa_maxslots(eisa_chipset_tag_t);
int		eisa_intr_map(eisa_chipset_tag_t, u_int,
		    eisa_intr_handle_t *);
const char	*eisa_intr_string(eisa_chipset_tag_t, eisa_intr_handle_t);
void		*eisa_intr_establish(eisa_chipset_tag_t, eisa_intr_handle_t,
		    int, int, int (*)(void *), void *, char *);
void		eisa_intr_disestablish(eisa_chipset_tag_t, void *);


code:
/*	$OpenBSD: acpi_machdep.c,v 1.59 2015/05/30 08:41:30 kettenis Exp $	*/
/*
 * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/memrange.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/reboot.h>
#include <sys/hibernate.h>

#include <uvm/uvm_extern.h>

#include <machine/bus.h>
#include <machine/conf.h>
#include <machine/acpiapm.h>
#include <i386/isa/isa_machdep.h>

#include <machine/cpu.h>
#include <machine/cpufunc.h>
#include <machine/cpuvar.h>
#include <machine/npx.h>

#include <dev/isa/isareg.h>
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#include <dev/acpi/acpidev.h>

#include "apm.h"
#include "isa.h"
#include "ioapic.h"
#include "lapic.h"

#if NIOAPIC > 0
#include <machine/i82093var.h>
#endif

#if NLAPIC > 0
#include <machine/apicvar.h>
#include <machine/i82489reg.h>
#include <machine/i82489var.h>
#endif

#if NAPM > 0
int haveacpibutusingapm;
#endif

extern u_char acpi_real_mode_resume[], acpi_resume_end[];

extern int acpi_savecpu(void) __returns_twice;
extern void intr_calculatemasks(void);

#define ACPI_BIOS_RSDP_WINDOW_BASE        0xe0000
#define ACPI_BIOS_RSDP_WINDOW_SIZE        0x20000

u_int8_t	*acpi_scan(struct acpi_mem_map *, paddr_t, size_t);

int
acpi_map(paddr_t pa, size_t len, struct acpi_mem_map *handle)
{
	paddr_t pgpa = trunc_page(pa);
	paddr_t endpa = round_page(pa + len);
	vaddr_t va = uvm_km_valloc(kernel_map, endpa - pgpa);

	if (va == 0)
		return (ENOMEM);

	handle->baseva = va;
	handle->va = (u_int8_t *)(va + (u_long)(pa & PGOFSET));
	handle->vsize = endpa - pgpa;
	handle->pa = pa;

	do {
		pmap_kenter_pa(va, pgpa, PROT_READ | PROT_WRITE);
		va += NBPG;
		pgpa += NBPG;
	} while (pgpa < endpa);

	return 0;
}

void
acpi_unmap(struct acpi_mem_map *handle)
{
	pmap_kremove(handle->baseva, handle->vsize);
	uvm_km_free(kernel_map, handle->baseva, handle->vsize);
}

u_int8_t *
acpi_scan(struct acpi_mem_map *handle, paddr_t pa, size_t len)
{
	size_t i;
	u_int8_t *ptr;
	struct acpi_rsdp1 *rsdp;

	if (acpi_map(pa, len, handle))
		return (NULL);
	for (ptr = handle->va, i = 0; i < len; ptr += 16, i += 16) {
		/* is there a valid signature? */
		if (memcmp(ptr, RSDP_SIG, sizeof(RSDP_SIG) - 1))
			continue;

		/* is the checksum valid? */
		if (acpi_checksum(ptr, sizeof(struct acpi_rsdp1)) != 0)
			continue;

		/* check the extended checksum as needed */
		rsdp = (struct acpi_rsdp1 *)ptr;
		if (rsdp->revision == 0)
			return (ptr);
		else if (rsdp->revision >= 2 && rsdp->revision <= 4)
			if (acpi_checksum(ptr, sizeof(struct acpi_rsdp)) == 0)
				return (ptr);
	}
	acpi_unmap(handle);

	return (NULL);
}

int
acpi_probe(struct device *parent, struct cfdata *match,
    struct bios_attach_args *ba)
{
	struct acpi_mem_map handle;
	u_int8_t *ptr;
	paddr_t ebda;
#if NAPM > 0
	extern int apm_attached;
#endif

	/*
	 * First try to find ACPI table entries in the EBDA
	 */
	if (acpi_map(0, NBPG, &handle))
		printf("acpi: failed to map BIOS data area\n");
	else {
		ebda = *(const u_int16_t *)(&handle.va[0x40e]);
		ebda <<= 4;
		acpi_unmap(&handle);

		if (ebda && ebda < IOM_BEGIN) {
			if ((ptr = acpi_scan(&handle, ebda, 1024)))
				goto havebase;
		}
	}

	/*
	 * Next try to find the ACPI table entries in the
	 * BIOS memory
	 */
	if ((ptr = acpi_scan(&handle, ACPI_BIOS_RSDP_WINDOW_BASE,
	    ACPI_BIOS_RSDP_WINDOW_SIZE)))
		goto havebase;

	return (0);

havebase:
	ba->ba_acpipbase = ptr - handle.va + handle.pa;
	acpi_unmap(&handle);
#if NAPM > 0
	if (apm_attached) {
		haveacpibutusingapm = 1;
		return (0);
	}
#endif

	return (1);
}

/*
 * Acquire the global lock.  If busy, set the pending bit.  The caller
 * will wait for notification from the BIOS that the lock is available
 * and then attempt to acquire it again.
 */
int
acpi_acquire_glk(uint32_t *lock)
{
	uint32_t	new, old;

	do {
		old = *lock;
		new = (old & ~GL_BIT_PENDING) | GL_BIT_OWNED;
		if ((old & GL_BIT_OWNED) != 0)
			new |= GL_BIT_PENDING;
	} while (atomic_cas_uint(lock, old, new) != old);

	return ((new & GL_BIT_PENDING) == 0);
}

/*
 * Release the global lock, returning whether there is a waiter pending.
 * If the BIOS set the pending bit, OSPM must notify the BIOS when it
 * releases the lock.
 */
int
acpi_release_glk(uint32_t *lock)
{
	uint32_t	new, old;

	do {
		old = *lock;
		new = old & ~(GL_BIT_PENDING | GL_BIT_OWNED);
	} while (atomic_cas_uint(lock, old, new) != old);

	return ((old & GL_BIT_PENDING) != 0);
}

void
acpi_attach_machdep(struct acpi_softc *sc)
{
	extern void (*cpuresetfn)(void);

	sc->sc_interrupt = isa_intr_establish(NULL, sc->sc_fadt->sci_int,
	    IST_LEVEL, IPL_TTY, acpi_interrupt, sc, sc->sc_dev.dv_xname);
	cpuresetfn = acpi_reset;

#ifndef SMALL_KERNEL
	acpiapm_open = acpiopen;
	acpiapm_close = acpiclose;
	acpiapm_ioctl = acpiioctl;
	acpiapm_kqfilter = acpikqfilter;

	/*
	 * Sanity check before setting up trampoline.
	 * Ensure the trampoline size is < PAGE_SIZE
	 */
	KASSERT(acpi_resume_end - acpi_real_mode_resume < PAGE_SIZE);

	bcopy(acpi_real_mode_resume, (caddr_t)ACPI_TRAMPOLINE,
	    acpi_resume_end - acpi_real_mode_resume);
#endif /* SMALL_KERNEL */
}

#ifndef SMALL_KERNEL

#if NLAPIC > 0
int	save_lapic_tpr;
#endif

void
acpi_sleep_clocks(struct acpi_softc *sc, int state)
{
	rtcstop();

#if NLAPIC > 0
	save_lapic_tpr = lapic_tpr;
	lapic_disable();
#endif
}

/*
 * Start the clocks early because AML will be executed next
 * which might do DELAY.
 */
void
acpi_resume_clocks(struct acpi_softc *sc)
{
#if NISA > 0
	isa_defaultirq();
#endif
	intr_calculatemasks();

#if NIOAPIC > 0
	ioapic_enable();
#endif

#if NLAPIC > 0
	lapic_tpr = save_lapic_tpr;
	lapic_enable();
	if (initclock_func == lapic_initclocks)
		lapic_startclock();
	lapic_set_lvt();
#endif

	i8254_startclock();
	if (initclock_func == i8254_initclocks)
		rtcstart();		/* in i8254 mode, rtc is profclock */
}

/*
 * This function may not have local variables due to a bug between
 * acpi_savecpu() and the resume path.
 */
int
acpi_sleep_cpu(struct acpi_softc *sc, int state)
{
	/* i386 does lazy pmap_activate: switch to kernel memory view */
	pmap_activate(curproc);

	/*
	 * ACPI defines two wakeup vectors. One is used for ACPI 1.0
	 * implementations - it's in the FACS table as wakeup_vector and
	 * indicates a 32-bit physical address containing real-mode wakeup
	 * code.
	 *
	 * The second wakeup vector is in the FACS table as
	 * x_wakeup_vector and indicates a 64-bit physical address
	 * containing protected-mode wakeup code.
	 */
	sc->sc_facs->wakeup_vector = (u_int32_t)ACPI_TRAMPOLINE;
	if (sc->sc_facs->length > 32 && sc->sc_facs->version >= 1)
		sc->sc_facs->x_wakeup_vector = 0;

	/* Copy the current cpu registers into a safe place for resume.
	 * acpi_savecpu actually returns twice - once in the suspend
	 * path and once in the resume path (see setjmp(3)).
	 */
	if (acpi_savecpu()) {
		/* Suspend path */
		npxsave_cpu(curcpu(), 1);
		wbinvd();

#ifdef HIBERNATE
		if (state == ACPI_STATE_S4) {
			if (hibernate_suspend()) {
				printf("%s: hibernate_suspend failed",
				    DEVNAME(sc));
				hibernate_free();
				return (ECANCELED);
			}
		}
#endif

		/* XXX
		 * Flag to disk drivers that they should "power down" the disk
		 * when we get to DVACT_POWERDOWN.
		 */
		boothowto |= RB_POWERDOWN;
		config_suspend_all(DVACT_POWERDOWN);
		boothowto &= ~RB_POWERDOWN;

		acpi_sleep_pm(sc, state);
		printf("%s: acpi_sleep_pm failed", DEVNAME(sc));
		return (ECANCELED);
	}
	/* Resume path */

	/* Reset the vectors */
	sc->sc_facs->wakeup_vector = 0;
	if (sc->sc_facs->length > 32 && sc->sc_facs->version >= 1)
		sc->sc_facs->x_wakeup_vector = 0;

	return (0);
}

void
acpi_resume_cpu(struct acpi_softc *sc)
{
	npxinit(&cpu_info_primary);

	cpu_init(&cpu_info_primary);

	/* Re-initialise memory range handling on BSP */
	if (mem_range_softc.mr_op != NULL)
		mem_range_softc.mr_op->initAP(&mem_range_softc);
}

#ifdef MULTIPROCESSOR
void
acpi_sleep_mp(void)
{
	int i;

	sched_stop_secondary_cpus();
	KASSERT(CPU_IS_PRIMARY(curcpu()));

	/*
	 * Wait for cpus to halt so we know their FPU state has been
	 * saved and their caches have been written back.
	 */
	i386_broadcast_ipi(I386_IPI_HALT);
	for (i = 0; i < ncpus; i++) {
		struct cpu_info *ci = cpu_info[i];

		if (CPU_IS_PRIMARY(ci))
			continue;
		while (ci->ci_flags & CPUF_RUNNING)
			;
	}
}

void
acpi_resume_mp(void)
{
	struct cpu_info *ci;
	struct proc *p;
	struct pcb *pcb;
	struct trapframe *tf;
	struct switchframe *sf;
	int i;

	/* XXX refactor with matching code in cpu.c */

	for (i = 0; i < MAXCPUS; i++) {
		ci = cpu_info[i];
		if (ci == NULL)
			continue;
		if (ci->ci_idle_pcb == NULL)
			continue;
		if (ci->ci_flags & (CPUF_BSP|CPUF_SP|CPUF_PRIMARY))
			continue;
		KASSERT((ci->ci_flags & CPUF_RUNNING) == 0);

		p = ci->ci_schedstate.spc_idleproc;
		pcb = &p->p_addr->u_pcb;

		tf = (struct trapframe *)pcb->pcb_tss.tss_esp0 - 1;
		sf = (struct switchframe *)tf - 1;
		sf->sf_esi = (int)sched_idle;
		sf->sf_ebx = (int)ci;
		sf->sf_eip = (int)proc_trampoline;
		pcb->pcb_esp = (int)sf;

		ci->ci_idepth = 0;
	}

	cpu_boot_secondary_processors();
	sched_start_secondary_cpus();
}
#endif /* MULTIPROCESSOR */

#endif /* ! SMALL_KERNEL */


code:
/*
 * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
 * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */
/*
 * Copyright (c) 2008 Mike Larkin <mlarkin@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#define _ACPI_WAKECODE

#include "assym.h"
#include <machine/asm.h>
#ifdef HIBERNATE
#include <machine/hibernate_var.h>
#endif /* HIBERNATE */
#include <machine/specialreg.h>
#include <machine/param.h>
#include <machine/segments.h>
#include <dev/acpi/acpivar.h>

#define _ACPI_TRMP_LABEL(a) a = . - _C_LABEL(acpi_real_mode_resume) + ACPI_TRAMPOLINE
#define _ACPI_TRMP_OFFSET(a) a = . - _C_LABEL(acpi_real_mode_resume)
#define _ACPI_RM_SEGMENT (ACPI_TRAMPOLINE >> 4)

#ifdef HIBERNATE
#define HIBERNATE_STACK_OFFSET 0x0F00
#endif

/*
 * On wakeup, we'll start executing at acpi_real_mode_resume.
 * This is based on the wakeup vector previously stored with
 * ACPI before we went to sleep. ACPI's wakeup vector is a
 * physical address - in our case, it's calculated and mapped
 * by the kernel and stuffed into a low page early in the boot
 * process.
 *
 * We wakeup in real mode, at some phys addr based on the ACPI
 * specification (cs = phys>>8, ip = phys & 0xF). For example,
 * if our phys addr is 0x13000, we'd have cs=0x1300,ip=0
 *
 * The wakeup code needs to do the following:
 *     1. Reenable the video display
 *     2. Enter 32 bit protected mode
 *     3. Reenable paging
 *     4. Restore saved CPU registers
 */

	.text
	.code16
	.align 4
	.global _C_LABEL(acpi_real_mode_resume)
	.global _C_LABEL(acpi_protected_mode_resume)
	.global _C_LABEL(acpi_resume_end)
_C_LABEL(acpi_real_mode_resume):
_ACPI_TRMP_OFFSET(acpi_s3_vector_real)
	nop
	cli
	cld

	/*
	 * Set up segment registers for real mode.
	 * We'll only be in real mode for a moment, and we don't have
	 * want real dependencies on data or stack, so we'll just use
	 * the code segment for data and stack (eg, a 64k memory space).
	 */
	movw	%cs,%ax
	movw	%ax,%ds
	movw	%ax,%es
	movw	%ax,%ss
	lidtl	clean_idt

	/*
	 * Set up stack to grow down from offset 0x0FFE.
	 * We will only be doing a few push/pops and no calls in real
	 * mode, so as long as the real mode code in the segment
	 * plus stack doesn't exceed 0x0FFE (4094) bytes, we'll be ok.
	 */
	movw	$0x0FFE,%sp

	/*
	 * Clear flags
	 */
	pushl	$0
	popfl

	/*
	 * Set up esi to point to start of current routine's CS.
	 */
	xorl    %esi,%esi
	movw    %cs,%si
	shll    $4,%esi

	/*
	 * Flush instruction prefetch queue
	 */
	jmp	1f
1:	jmp	1f
1:

	/*
	 * We're about to enter protected mode, so we need a GDT for that.
	 * Set up a temporary GDT describing 2 segments, one for code
	 * extending from 0x00000000-0xffffffff and one for data
	 * with the same range. This GDT will only be in use for a short
	 * time, until we restore the saved GDT that we had when we went
	 * to sleep (although on i386, the saved GDT will most likely
	 * represent something similar based on machine/segment.h).
	 */
	data32 addr32 lgdt	tmp_gdt

	/*
	 * Enable protected mode by setting the PE bit in CR0
	 */
	mov	%cr0,%eax
	orl	$(CR0_PE),%eax
	mov	%eax,%cr0

	/*
	 * Force CPU into protected mode
	 * by making an intersegment jump (to ourselves, just a few lines
	 * down from here. We rely on the kernel to fixup the jump
	 * target addres previously.
	 *
	 */
	ljmpl	$0x8, $acpi_protected_mode_trampoline

	.code32
	.align 16
_ACPI_TRMP_LABEL(acpi_protected_mode_trampoline)
_C_LABEL(acpi_protected_mode_resume):
	nop

	/*
	 * We're in protected mode now, without paging enabled.
	 *
	 * Set up segment selectors for protected mode.
	 * We've already set up our cs via the intersegment jump earlier,
	 * but we need to set ds,es,fs,gs,ss to all point to the
	 * 4GB flat data segment we defined earlier.
	 */
	movw	$GSEL(GDATA_SEL,SEL_KPL),%ax
	movw	%ax,%ds
	movw	%ax,%es
	movw	%ax,%gs
	movw	%ax,%ss
	movw	%ax,%fs

	/*
	 * Reset ESP based on protected mode. We can do this here
	 * because we haven't put anything on the stack via a
	 * call or push that we haven't cleaned up already.
	 */
	movl    %esi, %esp
	addl    $0x0FFE, %esp

	/*
	 * Reset our page size extension (via restoring cr4) to what
	 * it was before we suspended. If we don't do this, cr4 might
	 * contain garbage in the PSE bit, leading to pages that
	 * are incorrectly interpreted as the wrong size
	 * CR4 was added in i586, so there is
	 * an implicit assumption here that this code will execute on
	 * i586 or later.
	 */
	mov	acpi_saved_cr4,%eax
	mov	%eax,%cr4

	testl	$CR4_PAE, %eax
	jz	1f

	movl	$MSR_EFER, %ecx
	rdmsr
	orl	$EFER_NXE, %eax
	wrmsr

1:
	/*
	 * Re-enable paging, using the CR3 we stored before suspend
	 * as our new page table base location. Restore CR0 after
	 * that.
	 */
	movl	acpi_saved_cr3,%eax
	movl	%eax,%cr3
	movl	acpi_saved_cr0, %eax
	movl	%eax, %cr0

	/*
	 * Flush the prefetch queue in order to enforce usage
	 * of the new (old) page tables we just re-enabled
	 */
	jmp	1f
1:	jmp	1f
1:
	nop

	/*
	 * Restore CPU segment descriptor registers
	 */
	lgdt	acpi_saved_gdt
	lidt	acpi_saved_idt
	lldt	acpi_saved_ldt

	mov	acpi_saved_cr2,%eax
	mov	%eax,%cr2

	/*
	 * It is highly likely that the selectors we already loaded into
	 * these registers are already accurate, but we reload them
	 * again, for consistency.
	 */
	movw	acpi_saved_es,%ax
	movw	%ax,%es
	movw	acpi_saved_fs,%ax
	movw	%ax,%fs
	movw	acpi_saved_gs,%ax
	movw	%ax,%gs
	movw	acpi_saved_ss,%ax
	movw	%ax,%ss
	movw	acpi_saved_ds,%ax
	movw	%ax,%ds

	/*
	 * Shortly, we'll restore the TSS for the task that was running
	 * immediately before suspend occured. Since that task was the
	 * running task, it's TSS busy flag will have been set. We need
	 * to clear that bit (since we're effectively "restarting" the OS)
	 * in order to convince the processor that the task is no longer
	 * running (which is true, now). If we don't do this, when the
	 * OS resumes and resumes this task, it will assume we're trying
	 * to recurse into an already active task, which would cause
	 * a GP violation (and probably, a crash).
	 *
	 * We accomplish this by changing the TSS descriptor from
	 * BUSY (0x0B) to AVAILABLE (0x09). We keep the other
	 * high 4 bits intact.
	 */
	movl	acpi_saved_gdt+2,%ebx
	xorl	%ecx, %ecx
	movw	acpi_saved_tr,%cx
	leal	(%ebx,%ecx),%eax
	andb	$0xF9,5(%eax)

	ltr	acpi_saved_tr

	/*
	 * Everything is almost reset back to the way it was immediately before
	 * suspend. There are a few more registers to restore, and after
	 * that, jump back to the OS. There's still some things
	 * to do there, like re-enable interrupts, resume devices, APICs,
	 * etc.
	 */
	movl	acpi_saved_ebx, %ebx
	movl	acpi_saved_ecx, %ecx
	movl	acpi_saved_edx, %edx
	movl	acpi_saved_ebp, %ebp
	movl	acpi_saved_esi, %esi
	movl	acpi_saved_edi, %edi
	movl	acpi_saved_esp, %esp
	push	acpi_saved_fl
	popfl

	/* Poke CR3 one more time. Might not be necessary */
	movl	acpi_saved_cr3,%eax
	movl	%eax,%cr3

	/*
	 * Return to the OS. We've previously saved the resume
	 * address in acpi_saved_ret (via a call to acpi_savecpu
	 * before we went to sleep.)
	 */
	xorl  %eax, %eax
	jmp	*acpi_saved_ret

#ifdef HIBERNATE
	/*
	 * hibernate_resume_machdep drops to real mode and
	 * restarts the OS using the saved S3 resume vector
	 */
	.code32
NENTRY(hibernate_resume_machdep)
	cli
	/* Jump to the identity mapped version of ourself */
	mov	$hibernate_resume_vector_2, %eax
	jmp	*%eax
_ACPI_TRMP_LABEL(hibernate_resume_vector_2)

	/* Get out of 32 bit CS */
	lgdt	gdt_16
	ljmp	$0x8, $hibernate_resume_vector_3

_ACPI_TRMP_LABEL(hibernate_resume_vector_3)
	.code16
	movl	%cr0, %eax
	/* Disable CR0.PG - no paging */
	andl	$(~CR0_PG), %eax
	/* Disable CR0.PE - real mode */
	andl	$(~CR0_PE), %eax
	movl	%eax, %cr0

	/* Flush TLB */
	xorl	%eax, %eax
	movl	%eax, %cr3

	/* Set up real mode segment selectors */
	movw	$0x1300, %ax
	movw	%ax, %ds
	movw	%ax, %es
	movw	%ax, %fs
	movw	%ax, %gs
	movl	$0x0FFE, %esp
	lidtl	clean_idt

	/* Jump to the S3 resume vector */
	ljmp	$0x1300, $acpi_s3_vector_real

	.code32
	/* Switch to hibernate resume pagetable */
NENTRY(hibernate_activate_resume_pt_machdep)
	/* Enable large pages */
	movl	%cr4, %eax
	orl	$(CR4_PSE), %eax

	/* Disable global pages */
	andl	$(~CR4_PGE), %eax
	movl	%eax, %cr4

	/*
	 * Switch to the hibernate resume pagetable if we're running
	 * in non-PAE mode.  If we're running in PAE mode, this will
	 * switch to the PTPDEs we stashed into the hibernate resume
	 * pagetable, but continue to use the normal pagetables until we
	 * disable PAE below.
	 */
	movl	$HIBERNATE_PD_PAGE, %eax
	orl	$0xfe0, %eax
	movl	%eax, %cr3

	/* Disable PAE */
	movl	%cr4, %eax
	andl	$(~CR4_PAE), %eax
	movl	%eax, %cr4

	wbinvd
	movl	$HIBERNATE_PD_PAGE, %eax
	movl	%eax, %cr3
	jmp	1f

1:	nop
	ret

	/*
	 * Switch to the private resume-time hibernate stack
	 */
NENTRY(hibernate_switch_stack_machdep)
	movl	(%esp), %eax
	movl    %eax, HIBERNATE_STACK_PAGE + HIBERNATE_STACK_OFFSET
	movl    $(HIBERNATE_STACK_PAGE + HIBERNATE_STACK_OFFSET), %eax
	movl    %eax, %esp

	/* On our own stack from here onward */
	ret

NENTRY(hibernate_flush)
	invlpg  HIBERNATE_INFLATE_PAGE
	ret
#endif /* HIBERNATE */

	.code16
	.align 8
_ACPI_TRMP_OFFSET(tmp_gdt)
	.word	tmp_gdt_end - tmp_gdtable
	.long	tmp_gdtable

	.align 8
_ACPI_TRMP_LABEL(tmp_gdtable)
	/*
	 * null
	 */
	.word	0, 0
	.byte	0, 0, 0, 0
	/*
	 * Code
	 * Limit: 0xffffffff
	 * Base: 0x00000000
	 * Descriptor Type: Code
	 * Segment Type: CRA
	 * Present: True
	 * Priv: 0
	 * AVL: False
	 * 64-bit: False
	 * 32-bit: True
	 *
	 */
	.word	0xffff, 0
	.byte	0, 0x9f, 0xcf, 0

	/*
	 * Data
	 * Limit: 0xffffffff
	 * Base: 0x00000000
	 * Descriptor Type:
	 * Segment Type: W
	 * Present: True
	 * Priv: 0
	 * AVL: False
	 * 64-bit: False
	 * 32-bit: True
	 *
	 */
	.word	0xffff, 0
	.byte	0, 0x93, 0xcf, 0
_ACPI_TRMP_LABEL(tmp_gdt_end)

	.align 8
_ACPI_TRMP_OFFSET(clean_idt)
	.word	0xffff
	.long	0
	.word	0

	/*
	 * gdt_16 is the gdt used when returning to real mode for bios
	 * reads/writes (sets up a 16 bit segment)
	 */
	.align 8
_ACPI_TRMP_LABEL(gdt_16)
	.word   gdt_16_end - gdt_16_table
	.long   gdt_16_table

	.align 8
_ACPI_TRMP_LABEL(gdt_16_table)
	/*
	 * null
	 */
	.word   0, 0
	.byte   0, 0, 0, 0
	/*
	 * Code
	 * Limit: 0xffffffff
	 * Base: 0x00000000
	 * Descriptor Type: Code
	 * Segment Type: CRA
	 * Present: True
	 * Priv: 0
	 * AVL: False
	 * 64-bit: False
	 * 32-bit: False
	 *
	 */
	.word   0xffff, 0
	.byte   0, 0x9f, 0x8f, 0

	/*
	 * Data
	 * Limit: 0xffffffff
	 * Base: 0x00000000
	 * Descriptor Type:
	 * Segment Type: W
	 * Present: True
	 * Priv: 0
	 * AVL: False
	 * 64-bit: False
	 * 32-bit: False
	 *
	 */
	.word   0xffff, 0
	.byte   0, 0x93, 0x8f, 0

_ACPI_TRMP_LABEL(gdt_16_end)

	.align 4
_ACPI_TRMP_LABEL(acpi_saved_ebx)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_ecx)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_edx)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_ebp)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_esi)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_edi)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_esp)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_fl)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_cr0)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_cr2)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_cr3)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_cr4)
	.long 0
_ACPI_TRMP_LABEL(acpi_saved_ret)
	.long 0

	.align 16
_ACPI_TRMP_LABEL(acpi_saved_idt)
	.space 6

	.align 16
_ACPI_TRMP_LABEL(acpi_saved_gdt)
	.space 6

	.align 16
_ACPI_TRMP_LABEL(acpi_saved_ldt)
	.short 0
_ACPI_TRMP_LABEL(acpi_saved_cs)
	.short 0
_ACPI_TRMP_LABEL(acpi_saved_ds)
	.short 0
_ACPI_TRMP_LABEL(acpi_saved_es)
	.short 0
_ACPI_TRMP_LABEL(acpi_saved_fs)
	.short 0
_ACPI_TRMP_LABEL(acpi_saved_gs)
	.short 0
_ACPI_TRMP_LABEL(acpi_saved_ss)
	.short 0
_ACPI_TRMP_LABEL(acpi_saved_tr)
	.short 0

	/*
	 * End of resume code (code copied to ACPI_TRAMPOLINE)
	 */
_C_LABEL(acpi_resume_end):

	/*
	 * acpi_savecpu saves the processor's registers and flags
	 * for use during the ACPI suspend/resume process.
	 */

	.code32
NENTRY(acpi_savecpu)
	movl	(%esp), %eax
	movl	%eax, acpi_saved_ret

	movw	%cs, acpi_saved_cs
	movw	%ds, acpi_saved_ds
	movw	%es, acpi_saved_es
	movw	%fs, acpi_saved_fs
	movw	%gs, acpi_saved_gs
	movw	%ss, acpi_saved_ss

	movl	%ebx, acpi_saved_ebx
	movl	%ecx, acpi_saved_ecx
	movl	%edx, acpi_saved_edx
	movl	%ebp, acpi_saved_ebp
	movl	%esi, acpi_saved_esi
	movl	%edi, acpi_saved_edi
	movl	%esp, acpi_saved_esp

	pushfl
	popl	acpi_saved_fl

	movl	%cr0, %eax
	movl	%eax, acpi_saved_cr0
	movl	%cr2, %eax
	movl	%eax, acpi_saved_cr2
	movl	%cr3, %eax
	movl	%eax, acpi_saved_cr3
	movl	%cr4, %eax
	movl	%eax, acpi_saved_cr4

	sgdt	acpi_saved_gdt
	sidt	acpi_saved_idt
	sldt	acpi_saved_ldt
	str	acpi_saved_tr

	movl	$1, %eax
	ret


code:
/*	$OpenBSD: acpiapm.c,v 1.1 2007/11/25 15:45:17 tedu Exp $ */
/*
 * Copyright (c) 2007 Ted Unangst <tedu@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <sys/param.h>
#include <machine/conf.h>
#include <sys/event.h>

int (*acpiapm_open)(dev_t, int, int, struct proc *);
int (*acpiapm_close)(dev_t, int, int, struct proc *);
int (*acpiapm_ioctl)(dev_t, u_long, caddr_t, int, struct proc *);
int (*acpiapm_kqfilter)(dev_t, struct knote *);

int
acpiapmopen(dev_t dev, int flag, int mode, struct proc *p)
{
	if (!acpiapm_open)
		return ENODEV;
	return acpiapm_open(dev, flag, mode, p);
}

int
acpiapmclose(dev_t dev, int flag, int mode, struct proc *p)
{
	if (!acpiapm_close)
		return ENODEV;
	return acpiapm_close(dev, flag, mode, p);
}

int
acpiapmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
{
	if (!acpiapm_ioctl)
		return ENODEV;
	return acpiapm_ioctl(dev, cmd, data, flag, p);
}

int
acpiapmkqfilter(dev_t dev, struct knote *kn)
{
	if (!acpiapm_kqfilter)
		return ENODEV;
	return acpiapm_kqfilter(dev, kn);
}