Subject: Re: cf25 pcibios (1/2)
To: eike dierks <port-i386@netbsd.org, Eike.Dierks@t-online.de>
From: Miles Nordin <carton@Ivy.NET>
List: port-i386
Date: 03/16/2004 12:13:34
To: port-i386@netbsd.org, Eike.Dierks@t-online.de (eike dierks)
Subject: Re: cf25 pcibios
MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen")
Content-Type: text/plain; charset=US-ASCII
From: Miles Nordin <carton@castrovalva.Ivy.NET>
Date: Tue, 16 Mar 2004 12:13:34 -0500
In-Reply-To: <9746A07C-7712-11D8-BF24-003065682B58@t-online.de>
 (eike dierks's message of "Tue, 16 Mar 2004 07:24:33 +0100")
Message-ID: <oqsmg8d8ap.fsf@castrovalva.Ivy.NET>
User-Agent: T-gnus/6.15.10 (based on Oort Gnus v0.10) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.4 Emacs/21.2 (alpha--netbsd) MULE/5.0 (SAKAKI)
References: <9746A07C-7712-11D8-BF24-003065682B58@t-online.de>

>>>>> "ed" == eike dierks <Eike.Dierks@t-online.de> writes:

    ed> By conicidence I'm just working on the same problem (however
    ed> trying netbsd)

Yes, I'm also using NetBSD.  I tried the others when NetBSD didn't
work, in an effort to figure out why.

I found that by merging the OpenBSD assembler calls in to NetBSD's
pcibios.c, I could turn on NetBSD's PCIBIOS_INTR_FIXUP option without
panicing the kernel.  Otherwise, on the CF-25, the kernel panics early
in bootup at the pcibios stuff.  I think I posted about that already?

Then, I found that the $PIR table returned by the CF-25 BIOS was
incorrect---one column was filled with zeroes.  so I wrote a function
that compiles a table into the kernel, and patches the $PIR table to
hardcoded values.  It turns out there are only a few reasonable values
for the table: only intA and intB are used, and only irq9, irq10,
irq11, and (maybe) irq12 are free.  so it's possible to pursue the
correct table values by trial-and-error.

However, I tried all the reasonable values, and I still can't get it
to work.

What I have not been able to try exhaustively, is using the chip in
pcic compatibility mode (PC Card only) instead of CardBus mode.  Even
with PC Cards, the two modes behave very differently.  Unfortunately,
I don't understand PCI/ISA interrupt routing very well.  I don't
understand how these ``legacy ISA'' devices get interrupt and I/O
space through a PCI bus.  so I don't really know what to try---what
interrupt should I assign to the bridge, and how can I assign more
than one ISA interrupt to a PCI device with only one interrupt pin,
u.s.w.

What happens when I use pcic compatibility mode with an ne(4) PC Card:

  pcic ... detecting irqs with mask 0x0200: none, polling for socket events

  (note the CardBus bridge is assigned IRQ9, so I asked for mask 0x0200.  
   yet it does not find irq9.  then, later when I insert the card)

  ne0: where did the card go?

What happens when I use CardBus mode:

  unlike pcic mode, I get all the CIS info and the hardware address.  but,

  'ne0: device timeout' when sending a packet,
  the packet is sent on the wire.  packets are not received.

Here are my patches so far:
-----8<-----
Index: pci/pci_intr_fixup.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/arch/i386/pci/pci_intr_fixup.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 pci_intr_fixup.c
--- pci/pci_intr_fixup.c	12 Dec 2003 11:33:05 -0000	1.1.1.5
+++ pci/pci_intr_fixup.c	29 Jan 2004 06:26:11 -0000
@@ -264,7 +264,7 @@
 		l->clink = clink;
 		l->irq = irq; /* maybe X86_PCI_INTERRUPT_LINE_NO_CONNECTION */
 	} else {
-		l->clink = link; /* only for PCIBIOSVERBOSE diagnostic */
+		l->clink = 0xff; /* only for PCIBIOSVERBOSE diagnostic */
 		l->irq = X86_PCI_INTERRUPT_LINE_NO_CONNECTION;
 	}
 
@@ -588,11 +588,11 @@
 pciintr_header_fixup(pc)
 	pci_chipset_tag_t pc;
 {
-	PCIBIOS_PRINTV(("------------------------------------------\n"));
-	PCIBIOS_PRINTV(("  device vendor product pin PIRQ IRQ stage\n"));
-	PCIBIOS_PRINTV(("------------------------------------------\n"));
+	PCIBIOS_PRINTV(("---------------------------------------------------------\n"));
+	PCIBIOS_PRINTV(("  device vendor product pin link PIRQ oldIRQ newIRQ stage\n"));
+	PCIBIOS_PRINTV(("---------------------------------------------------------\n"));
 	pci_device_foreach(pc, pcibios_max_bus, pciintr_do_header_fixup, NULL);
-	PCIBIOS_PRINTV(("------------------------------------------\n"));
+	PCIBIOS_PRINTV(("---------------------------------------------------------\n"));
 
 	return (0);
 }
@@ -631,36 +631,47 @@
 		 * Interrupt not connected; no
 		 * need to change.
 		 */
-		return;
-	}
+	        l = NULL;
+	} else
+	        l = pciintr_link_lookup(link);
 
-	l = pciintr_link_lookup(link);
+#ifdef PCIBIOSVERBOSE
+	if (pcibiosverbose) {
+		printf("%03d:%02d:%d 0x%04x 0x%04x   %c",
+		    bus, device, function, PCI_VENDOR(id), PCI_PRODUCT(id),
+		    pin == 0 ? '-' : '@' + pin);
+	        if (l == NULL) {
+	                printf("     -    -");
+                } else {
+	                printf("  0x%02x", l->link);
+			if (l->clink == 0xff)
+				printf("    -");
+			else
+				printf(" 0x%02x", l->clink);
+		}
+		if (irq == X86_PCI_INTERRUPT_LINE_NO_CONNECTION)
+			printf("      -");
+		else
+			printf("    %3d", irq);
+		if (l == NULL) {
+			printf("      -  -    no $PIR entry\n");
+		} else {
+		        if (l->irq == X86_PCI_INTERRUPT_LINE_NO_CONNECTION)
+			    printf("      -");
+		        else
+			        printf("    %3d", l->irq);
+		        printf("  %d   ", l->fixup_stage);
+	        }
+	}
+#endif
 	if (l == NULL) {
-#ifdef PCIINTR_DEBUG
 		/*
 		 * No link map entry.
 		 * Probably pciintr_icu_getclink() or pciintr_icu_get_intr()
 		 * was failed.
 		 */
-		printf("pciintr_header_fixup: no entry for link 0x%02x "
-		       "(%d:%d:%d:%c)\n", link, bus, device, function,
-		       '@' + pin);
-#endif
 		return;
 	}
-
-#ifdef PCIBIOSVERBOSE
-	if (pcibiosverbose) {
-		printf("%03d:%02d:%d 0x%04x 0x%04x   %c  0x%02x",
-		    bus, device, function, PCI_VENDOR(id), PCI_PRODUCT(id),
-		    '@' + pin, l->clink);
-		if (l->irq == X86_PCI_INTERRUPT_LINE_NO_CONNECTION)
-			printf("   -");
-		else
-			printf(" %3d", l->irq);
-		printf("  %d   ", l->fixup_stage);
-	}
-#endif
 	
 	/*
 	 * IRQs 14 and 15 are reserved for PCI IDE interrupts; don't muck
@@ -718,6 +729,8 @@
 	bus_space_tag_t iot;
 	u_int16_t *pciirq;
 {
+	char devinfo[256];
+	int bus, device, function;
 	const struct pciintr_icu_table *piit = NULL;
 	pcitag_t icutag;
 	pcireg_t icuid;
@@ -758,7 +771,7 @@
 		if (piit == NULL)
 			piit = pciintr_icu_lookup(icuid);
 	} else {
-		int device, maxdevs = pci_bus_maxdevs(pc, 0);
+		int maxdevs = pci_bus_maxdevs(pc, 0);
 
 		/*
 		 * Search configuration space for a known interrupt
@@ -766,7 +779,7 @@
 		 */
 		for (device = 0; device < maxdevs; device++) {
 			const struct pci_quirkdata *qd;
-			int function, nfuncs;
+			int nfuncs;
 			pcireg_t bhlcr;
 
 			icutag = pci_make_tag(pc, 0, device, 0);
@@ -836,6 +849,18 @@
 		return (-1);		/* non-fatal */
 #endif
 	}
+
+	/*
+	 * disclose results of the searching and probing
+	 */
+	pci_decompose_tag(pc, icutag, &bus, &device, &function);
+	printf("PCI Interrupt Router at %03d:%02d:%01d",
+	       bus, device, function);
+	if (icuid != 0) {
+		pci_devinfo(icuid, 0, 0, devinfo);
+		printf(" (%s)", devinfo);
+	}
+	printf("\n");
 
 	/*
 	 * Initialize the PCI ICU.
Index: pci/pcibios.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/arch/i386/pci/pcibios.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 pcibios.c
--- pci/pcibios.c	12 Dec 2003 11:33:05 -0000	1.1.1.5
+++ pci/pcibios.c	3 Feb 2004 23:05:41 -0000
@@ -107,8 +107,22 @@
 int pcibios_pir_table_nentries;
 int pcibios_max_bus;
 
+/*
+ * compiled-in overrides for certain rows of $PIR table
+ */
+struct pcibios_intr_routing_override pcibios_pir_override[] = {
+	/* opacity, bus, device, pin, link, bitmap */
+	{ PCIBIOS_INTR_OVERRIDE_LINK | PCIBIOS_INTR_OVERRIDE_BITMAP, 0, 16, 1, 0x60, 0x0800},
+	{ PCIBIOS_INTR_OVERRIDE_LINK | PCIBIOS_INTR_OVERRIDE_BITMAP, 0, 16, 2, 0x61, 0x0800},
+	{ PCIBIOS_INTR_OVERRIDE_LINK | PCIBIOS_INTR_OVERRIDE_BITMAP, 0, 19, 1, 0x60, 0x0800},
+	{ PCIBIOS_INTR_OVERRIDE_LINK | PCIBIOS_INTR_OVERRIDE_BITMAP, 0, 19, 2, 0x61, 0x0800},
+	{ 0, 0, 0, 0, 0, 0 }
+};
+
 struct bios32_entry pcibios_entry;
 
+void	pcibios_fudge_pir_table(struct pcibios_intr_routing *, int, struct pcibios_intr_routing_override *);
+
 void	pcibios_pir_init __P((void));
 
 int	pcibios_get_status __P((u_int32_t *, u_int32_t *, u_int32_t *,
@@ -228,9 +242,34 @@
 }
 
 void
+pcibios_fudge_pir_table(struct pcibios_intr_routing *table, int nentries, struct pcibios_intr_routing_override *override)
+{
+	struct pcibios_intr_routing *cursor;
+	int i;
+
+	for (; override->opacity != 0; override++) {
+		for (cursor = table, i = nentries; 
+		    i != 0; cursor++, i--) {
+			if (cursor->bus == override->bus && 
+			    PIR_DEVFUNC_DEVICE(cursor->device) == override->device) {
+				printf("overriding %d:%d int%c: ", override->bus, override->device, '@' + override->pin);
+				if (override->opacity & PCIBIOS_INTR_OVERRIDE_LINK) {
+					cursor->linkmap[override->pin - 1].link = override->link;
+					printf("link 0x%02x ", override->link);
+				}
+				if (override->opacity & PCIBIOS_INTR_OVERRIDE_BITMAP) {
+					cursor->linkmap[override->pin - 1].bitmap = override->bitmap;
+					printf("bitmap 0x%04x", override->bitmap);
+				}
+				printf("\n");
+			}
+		}
+	}
+}
+
+void
 pcibios_pir_init()
 {
-	char devinfo[256];
 	paddr_t pa;
 	caddr_t p;
 	unsigned char cksum;
@@ -290,20 +329,11 @@
 		memcpy(pcibios_pir_table, p + 32, tablesize - 32);
 		pcibios_pir_table_nentries = (tablesize - 32) / 16;
 
-		printf("PCI Interrupt Router at %03d:%02d:%01d",
-		    pcibios_pir_header.router_bus,
-		    PIR_DEVFUNC_DEVICE(pcibios_pir_header.router_devfunc),
-		    PIR_DEVFUNC_FUNCTION(pcibios_pir_header.router_devfunc));
-		if (pcibios_pir_header.compat_router != 0) {
-			pci_devinfo(pcibios_pir_header.compat_router, 0, 0,
-			    devinfo);
-			printf(" (%s)", devinfo);
-		}
-		printf("\n");
 		pcibios_print_exclirq();
 #ifdef PCIINTR_DEBUG
 		pcibios_print_pir_table();
 #endif
+		pcibios_fudge_pir_table(pcibios_pir_table, pcibios_pir_table_nentries, pcibios_pir_override);
 		return;
 	}
 
@@ -336,6 +366,7 @@
 #ifdef PCIINTR_DEBUG
 	pcibios_print_pir_table();
 #endif
+	pcibios_fudge_pir_table(pcibios_pir_table, pcibios_pir_table_nentries, pcibios_pir_override);
 }
 
 int
@@ -347,12 +378,28 @@
 	u_int32_t edx;
 	int rv;
 
+#if 0
 	__asm __volatile("lcall *(%%edi)				; \
 			jc 1f						; \
 			xor %%ah, %%ah					; \
 		1:"
 		: "=a" (ax), "=b" (bx), "=c" (cx), "=d" (edx)
 		: "0" (0xb101), "D" (&pcibios_entry));
+#else
+	__asm __volatile("pushl	%%es\n\t"
+			 "pushl	%%ds\n\t"
+			 "movw	4(%%edi), %%cx\n\t"
+			 "movl	%%ecx, %%ds\n\t"
+			 "lcall	%%cs:*(%%edi)\n\t"
+			 "pop	%%ds\n\t"
+			 "pop	%%es\n\t"
+			 "jc	1f\n\t"
+			 "xor	%%ah, %%ah\n"
+		    "1:"
+		: "=a" (ax), "=b" (bx), "=c" (cx), "=d" (edx)
+		: "0" (0xb101), "D" (&pcibios_entry)
+		: "cc", "memory");
+#endif
 
 	rv = pcibios_return_code(ax, "pcibios_get_status");
 	if (rv != PCIBIOS_SUCCESS)
@@ -395,6 +442,7 @@
 
 	memset(table, 0, args.size);
 
+#if 0
 	__asm __volatile("lcall *(%%esi)				; \
 			jc 1f						; \
 			xor %%ah, %%ah					; \
@@ -403,6 +451,21 @@
 		: "=a" (ax), "=b" (bx)
 		: "r" GSEL(GDATA_SEL, SEL_KPL), "0" (0xb10e), "1" (0),
 		  "D" (&args), "S" (&pcibios_entry));
+#else
+	__asm __volatile("pushl	%%es\n\t"
+			 "pushl	%%ds\n\t"
+			 "movw	4(%%esi), %%cx\n\t"
+			 "movl	%%ecx, %%ds\n\t"
+			 "lcall	%%cs:*(%%esi)\n\t"
+			 "popl	%%ds\n\t"
+			 "popl	%%es\n\t"
+			 "jc	1f\n\t"
+			 "xor	%%ah, %%ah\n"
+		    "1:\n"
+		: "=a" (ax), "=b" (bx)
+		: "0" (0xb10e), "1" (0), "D" (&args), "S" (&pcibios_entry)
+		: "%ecx", "%edx", "cc", "memory");
+#endif
 
 	rv = pcibios_return_code(ax, "pcibios_get_intr_routing");
 	if (rv != PCIBIOS_SUCCESS)
Index: pci/pcibios.h
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/arch/i386/pci/pcibios.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 pcibios.h
--- pci/pcibios.h	19 Apr 2002 20:16:07 -0000	1.1.1.2
+++ pci/pcibios.h	26 Jan 2004 05:59:56 -0000
@@ -62,6 +62,20 @@
 } __attribute__((__packed__));
 
 /*
+ * compiled-in overrides for certain rows of $PIR table
+ */
+#define	PCIBIOS_INTR_OVERRIDE_LINK	(1 << 0)
+#define PCIBIOS_INTR_OVERRIDE_BITMAP	(1 << 1)
+struct pcibios_intr_routing_override {
+	int		opacity;
+	u_int8_t	bus;
+	u_int8_t	device;
+	int		pin;
+	u_int8_t	link;
+	u_int16_t	bitmap;
+};
+
+/*
  * $PIR header.  Reference:
  *
  *	http://www.microsoft.com/HWDEV/busbios/PCIIRQ.htm
-----8<-----

and here is a kernel config file for pcic compat mode.  you can
comment out the pcic lines and uncomment the cardbus lines to try the
other way:
-----8<-----
#	$NetBSD: GENERIC_LAPTOP,v 1.83 2003/11/18 21:15:46 jonathan Exp $
#	From: NetBSD: GENERIC,v 1.414 2001/07/30 19:59:05 ad Exp
#
#	GENERIC_LAPTOP -- GENERIC with cardbus and some USB devices enabled
#

include "arch/i386/conf/std.i386"

options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary

ident 		"TOUGHBOOK-$Revision: 1.1.1.5 $"

maxusers	32		# estimated number of users

# Enable the hooks used for initializing the root memory-disk.
options 	MEMORY_DISK_HOOKS
options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
options 	MEMORY_DISK_ROOT_SIZE=10000	# size of memory disk, in blocks

# CPU support.  At least one is REQUIRED.
#options 	I386_CPU
#options 	I486_CPU
options 	I586_CPU
#options 	I686_CPU

# CPU-related options.
#options 	MATH_EMULATE	# floating point emulation
options 	VM86		# virtual 8086 emulation
options 	USER_LDT	# user-settable LDT; used by WINE
# eliminate delay no-ops in I/O; recommended on all but very old machines
#options 	DUMMY_NOPS

options 	MTRR		# memory-type range register syscall support
#options 	PERFCTRS	# performance-monitoring counters support

# delay between "rebooting ..." message and hardware reset, in milliseconds
#options 	CPURESET_DELAY=2000

# This option allows you to force a serial console at the specified
# I/O address.   see console(4) for details.
#options 	CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=57600
#	you don't want the option below ON iff you are using the
#	serial console option of the new boot strap code.
#options 	CONS_OVERRIDE	# Always use above! independent of boot info

# The following options override the memory sizes passed in from the boot
# block.  Use them *only* if the boot block is unable to determine the correct
# values.  Note that the BIOS may *correctly* report less than 640k of base
# memory if the extended BIOS data area is located at the top of base memory
# (as is the case on most recent systems).
#options 	REALBASEMEM=639		# size of base memory (in KB)
#options 	REALEXTMEM=15360	# size of extended memory (in KB)

# Standard system options

#options 	INSECURE	# disable kernel security levels - X needs this

options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
options 	NTP		# NTP phase/frequency locked loop

options 	KTRACE		# system call tracing via ktrace(1)
options 	SYSTRACE	# system call vetting via systrace(1)

options 	SYSVMSG		# System V-like message queues
options 	SYSVSEM		# System V-like semaphores
#options 	SEMMNI=10	# number of semaphore identifiers
#options 	SEMMNS=60	# number of semaphores in system
#options 	SEMUME=10	# max number of undo entries per process
#options 	SEMMNU=30	# number of undo structures in system
options 	SYSVSHM		# System V-like memory sharing
#options 	SHMMAXPGS=2048	# 2048 pages is the default

options 	LKM		# loadable kernel modules

options 	USERCONF	# userconf(4) support
#options	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)

# Diagnostic/debugging support options
options 	DIAGNOSTIC	# expensive kernel consistency checks
#options 	DEBUG		# expensive debugging checks/support
#options 	KMEMSTATS	# kernel memory statistics (vmstat -m)
options 	DDB		# in-kernel debugger
options 	DDB_ONPANIC=1	# see also sysctl(8): `ddb.onpanic'
options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
#options 	KGDB		# remote debugger
#options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
makeoptions	DEBUG="-g"	# compile full symbol table

# Compatibility options
#options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI
#options 	COMPAT_09	# NetBSD 0.9
#options 	COMPAT_10	# NetBSD 1.0
#options 	COMPAT_11	# NetBSD 1.1
#options 	COMPAT_12	# NetBSD 1.2, 386BSD, and BSDI
#options 	COMPAT_13	# NetBSD 1.3, 386BSD, and BSDI
#options 	COMPAT_14	# NetBSD 1.4
#options 	COMPAT_15	# NetBSD 1.5
options 	COMPAT_16	# NetBSD 1.6
#options 	COMPAT_43	# 4.3BSD, 386BSD, and BSDI
#options 	COMPAT_386BSD_MBRPART # recognize old partition ID
#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.

#options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
#options 	COMPAT_SVR4	# binary compatibility with SVR4
#options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
#options 	COMPAT_LINUX	# binary compatibility with Linux
#options 	COMPAT_FREEBSD	# binary compatibility with FreeBSD
#options 	COMPAT_MACH	# binary compatibility with Mach binaries
#options 	EXEC_MACHO	# exec MACH-O binaries
#options 	COMPAT_PECOFF	# kernel support to run Win32 apps

# File systems
file-system 	FFS		# UFS
#file-system 	EXT2FS		# second extended file system (linux)
file-system 	LFS		# log-structured file system
file-system 	MFS		# memory file system
file-system 	NFS		# Network File System client
#file-system 	NTFS		# Windows/NT file system (experimental)
#file-system 	CD9660		# ISO 9660 + Rock Ridge file system
#file-system 	MSDOSFS		# MS-DOS file system
file-system 	FDESC		# /dev/fd
file-system 	KERNFS		# /kern
file-system 	NULLFS		# loopback file system
#file-system 	OVERLAY		# overlay file system
#file-system 	PORTAL		# portal filesystem (still experimental)
#file-system 	PROCFS		# /proc
#file-system 	UMAPFS		# NULLFS + uid and gid remapping
#file-system 	UNION		# union file system
file-system	CODA		# Coda File System; also needs vcoda (below)

# File system options
options 	QUOTA		# UFS quotas
#options 	FFS_EI		# FFS Endian Independent support
options 	SOFTDEP		# FFS soft updates support.
options 	NFSSERVER	# Network File System server
#options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
				# immutable) behave as system flags.

# Networking options
options 	GATEWAY		# packet forwarding
options 	INET		# IP + ICMP + TCP + UDP
options 	INET6		# IPV6
options 	IPSEC		# IP security
options 	IPSEC_ESP	# IP security (encryption part; define w/IPSEC)
#options 	IPSEC_DEBUG	# debug for IP security
options 	MROUTING	# IP multicast routing
#options 	NS		# XNS
#options 	NSIP		# XNS tunneling over IP
#options 	ISO,TPIP	# OSI
#options 	EON		# OSI tunneling over IP
#options 	CCITT,LLC,HDLC	# X.25
options 	NETATALK	# AppleTalk networking protocols
options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
options 	PPP_DEFLATE	# Deflate compression support for PPP
options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
options 	PFIL_HOOKS	# pfil(9) packet filter hooks
options 	IPFILTER_LOG	# ipmon(8) log support
#options	IPFILTER_DEFAULT_BLOCK	# block all packets by default
#options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG

# These options enable verbose messages for several subsystems.
# Warning, these may compile large string tables into the kernel!
options 	MIIVERBOSE	# verbose PHY autoconfig messages
options 	PCIVERBOSE	# verbose PCI device autoconfig messages
#options 	PCI_CONFIG_DUMP	# verbosely dump PCI config space
options 	PCMCIAVERBOSE	# verbose PCMCIA configuration messages
options 	SCSIVERBOSE	# human readable SCSI error messages
options 	USBVERBOSE	# verbose USB device autoconfig messages
options 	PNPBIOSVERBOSE	# verbose PnP BIOS messages
#options 	PNPBIOSDEBUG	# more fulsome PnP BIOS debugging messages

options 	NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM

#
# wscons options
#
# builtin terminal emulations
#options 	WSEMUL_SUN		# sun terminal emulation
options 	WSEMUL_VT100		# VT100 / VT220 emulation
# different kernel output - see dev/wscons/wsdisplayvar.h
options 	WS_KERNEL_FG=WSCOL_GREEN
#options 	WS_KERNEL_BG=WSCOL_BLACK
# compatibility to other console drivers
options 	WSDISPLAY_COMPAT_PCVT		# emulate some ioctls
options 	WSDISPLAY_COMPAT_SYSCONS	# emulate some ioctls
options 	WSDISPLAY_COMPAT_USL		# VT handling
options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
# see dev/pckbc/wskbdmap_mfii.c for implemented layouts
#options 	PCKBD_LAYOUT="(KB_DE | KB_NODEAD)"
# allocate a number of virtual screens at autoconfiguration time
#options 	WSDISPLAY_DEFAULTSCREENS=4
# use a large software cursor that doesn't blink
options 	PCDISPLAY_SOFTCURSOR
# modify the screen type of the console; defaults to "80x25"
#options 	VGA_CONSOLE_SCREENTYPE="\"80x24\""

# Kernel root file system and dump configuration.
config		netbsd	root on ? type ?
#config		netbsd	root on sd0a type ffs
#config		netbsd	root on ? type nfs

#
# Device configuration
#

mainbus0 at root

cpu0 at mainbus0
#ioapic* at mainbus?

apm0	at mainbus0			# Advanced power management

# Tuning for power management, see apm(4) for more details.
#options 	APM_NO_IDLE		# Don't call BIOS CPU idle function
#options 	APM_V10_ONLY		# Use only the APM 1.0 calls
#options 	APM_NO_POWEROFF		# Don't power off on halt(8)
#options 	APM_POWER_PRINT		# Print stats on the console
#options 	APM_DISABLE_INTERRUPTS=0 # Don't disable interrupts


# Basic Bus Support

# Advanced Control and Power Interface

#acpi0 		at mainbus0
#options 	ACPI_PCI_FIXUP		# PCI interrupt routing via ACPI
#options 	ACPI_ACTIVATE_DEV	# If set, activate inactive devices

# ACPI devices
#acpiacad* 	at acpi?		# ACPI AC Adapter
#acpibat* 	at acpi?		# ACPI Battery
#acpibut* 	at acpi?		# ACPI Button
#acpiec* 	at acpi?		# ACPI Embedded Controller
#acpilid* 	at acpi?		# ACPI Lid Switch
#acpitz* 	at acpi?		# ACPI Thermal Zone

# Mainboard devices
#com* 		at acpi?		# Serial communications interface
#fdc* 		at acpi?		# Floppy disk controller
#lpt* 		at acpi?		# Parallel port
#npx* 		at acpi?		# Math coprocessor
#pckbc*  	at acpi?		# PC keyboard controller
#wss* 		at acpi?		# NeoMagic 256AV in wss mode

# Sony Vaio jog dial
#spic* 		at acpi?		# Sony Programmable I/O Controller
#wsmouse* 	at spic?

# Plug-and-Play BIOS and attached devices

pnpbios*	at mainbus?

# mainboard audio chips
ess*		at pnpbios? index ?	# ESS AudioDrive
#sb*		at pnpbios? index ?	# NeoMagic 256AV in sb mode
#wss*		at pnpbios? index ?	# NeoMagic 256AV in wss mode
#ym*		at pnpbios? index ?	# OPL3-SA3

# com port
# If enabled, consider changing "com0", "com1", and "com2" under "ISA Serial
# Interfaces" to "com*", otherwise com2 will attach at pnpbios? and there
# will be no com0.  A side effect is pcmcia (and other) com? previously
# starting at com3 may attach as com1 or com2.
com*		at pnpbios? index ?	# serial ports

# parallel port
# The above "com*" comments apply, cf. "lpt0" under "ISA parallel
# "printer interfaces".
lpt*		at pnpbios? index ?	# parallel ports

pckbc*		at pnpbios? index ?	# PC keyboard/mouse controller
fdc*		at pnpbios? index ?	# floppy controller

# IDE controller on Toshiba Portege 3000 series (crippled PCI device)
#pciide*	at pnpbios? index ?

# PCI bus support
pci*	at mainbus? bus ?
pci*	at pchb? bus ?
#pci*	at ppb? bus ?

# Configure PCI using BIOS information
options 	PCIBIOS			# PCI BIOS support
options 	PCIBIOSVERBOSE		# PCI BIOS verbose info
options 	PCIBIOS_ADDR_FIXUP	# fixup PCI I/O addresses
options 	PCIBIOS_BUS_FIXUP	# fixup PCI bus numbering
options 	PCIBIOS_INTR_FIXUP	# fixup PCI interrupt routing
options 	PCIBIOS_IRQS_HINT=0x8e00 # PCI interrupts hint:  use int 9.  or 10, 11, 15.  but mostly 9.
#options 	PCIBIOS_INTR_GUESS	# see pcibios(4)
options 	PCIINTR_DEBUG		# super-verbose PCI interrupt fixup

# PCI bridges
pchb*	at pci? dev ? function ?	# PCI-Host bridges
pcib*	at pci? dev ? function ?	# PCI-ISA bridges
#ppb*	at pci? dev ? function ?	# PCI-PCI bridges
# XXX 'puc's aren't really bridges, but there's no better place for them here
#puc*	at pci? dev ? function ?	# PCI "universal" comm. cards

#agp* 	at pchb?

# ISA bus support
#isa0	at mainbus?
isa0	at pcib?

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

options PCIC_ISA_INTR_ALLOC_MASK=0x0200		# cardbus is assigned irq9
#options PCIC_ISA_ALLOC_IOBASE=0x300
#options PCIC_ISA_ALLOC_IOSIZE=0x0ff

# ISA PCMCIA controllers
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? port 0x240 iomem 0xd0000 iosiz 0x10000

#ne2	at pcmcia0 function 0

# PCI PCMCIA controllers
#pcic0	at pci? dev? function ?

# ISA Plug-and-Play bus support
#isapnp0	at isa?

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

# CardBus bridge support
#cbb*		at pci? dev ? function ?
#cardslot*	at cbb?

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

# Coprocessor Support

# Math Coprocessor support
npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor


# Console Devices

# ISA console
#pc0	at isa? port 0x60 irq 1		# pccons generic PC console driver
# Keyboard layout configuration for pccons
#options 	FRENCH_KBD
#options 	FINNISH_KBD
#options 	GERMAN_KBD
#options 	NORWEGIAN_KBD
# pccons-specific options:
#options 	XSERVER_DDB	# PF12 gets you into DDB when X is running
#options 	XSERVER		# X server support


# wscons
#pckbc*		at isa?			# pc keyboard controller
pckbd*		at pckbc?		# PC keyboard
pms*		at pckbc?		# PS/2 mouse for wsmouse
#vga0		at isa?
vga*		at pci? dev ? function ?
#pcdisplay0	at isa?			# CGA, MDA, EGA, HGA
wsdisplay*	at vga? console ?
#wsdisplay*	at pcdisplay? console ?
wskbd* 		at pckbd? console ?
wsmouse*	at pms? mux 0

pcppi0		at isa?
sysbeep0	at pcppi?

# Serial Devices

# PCI serial interfaces
#com*	at puc? port ?			# 16x50s on "universal" comm boards
#cy*	at pci? dev ? function ?	# Cyclades Cyclom-Y serial boards
#cz*	at pci? dev ? function ?	# Cyclades-Z multi-port serial boards

# ISA Plug-and-Play serial interfaces
#com*	at isapnp?			# Modems and serial boards

# PCMCIA serial interfaces
com*	at pcmcia? function ?		# Modems and serial cards

pcmcom*	at pcmcia? function ?		# PCMCIA multi-port serial cards
com*	at pcmcom? slave ?		# ...and the slave devices

# CardBus serial interfaces
#com*	at cardbus? dev ? function ?	# Modems and serial cards

# ISA serial interfaces
#options 	COM_HAYESP		# adds Hayes ESP serial board support
#com*	at isa? port 0x3f8 irq 4	# Standard PC serial ports
#com*	at isa? port 0x2f8 irq 3
#com*	at isa? port 0x3e8 irq 5
#com3	at isa? port 0x2e8 irq 9
#ast0	at isa? port 0x1a0 irq 5	# AST 4-port serial cards
#com*	at ast? slave ?
#boca0	at isa? port 0x100 irq 5	# BOCA 8-port serial cards
#boca0	at isa? port 0x100 irq 5	# BOCA 16-port serial cards (BB2016)
#boca1	at isa? port 0x140 irq 5	# this line is also needed for BB2016
#com*	at boca? slave ?
#tcom0	at isa? port 0x100 irq 7	# TC-800 8-port serial cards
#com*	at tcom? slave ?
#rtfps0	at isa? port 0x1230 irq 10	# RT 4-port serial cards
#com*	at rtfps? slave ?
#cy0	at isa? iomem 0xd4000 irq 12	# Cyclades serial cards
#addcom0 at isa? port 0x108 irq 5	# Addonics FlexPort 8S
#com*	at addcom? slave ?
#moxa0	at isa?	port 0x100 irq 5	# MOXA C168H serial card (experimental)
#com*	at moxa? slave ?


# Parallel Printer Interfaces

# ISA parallel printer interfaces
#lpt*	at isa? port 0x378 irq 7	# standard PC parallel ports
#lpt*	at isa? port 0x278
#lpt*	at isa? port 0x3bc

# Hardware monitors

# LM7[89] and compatible hardware monitors
#lm0	at isa?	port 0x290		# other common ports: 0x280, 0x310

# VIA VT82C686A hardware monitor
#viapm*	at pci? dev ? function ?
#viaenv* at viapm?


# SCSI Controllers and Devices

# PCMCIA SCSI controllers
aic*	at pcmcia? function ?		# Adaptec APA-1460 SCSI
esp*	at pcmcia? function ?		# Qlogic ESP406/FAS408 SCSI

# CardBus SCSI cards
#ahc*	at cardbus? dev ? function ?	# Adaptec ADP-1480
#adv*	at cardbus? dev ? function ?	# AdvanSys 1200[A,B], 9xx[U,UA] SCSI

# SCSI bus support
scsibus* at scsi?

# SCSI devices
sd*	at scsibus? target ? lun ?	# SCSI disk drives
st*	at scsibus? target ? lun ?	# SCSI tape drives
cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
ch*	at scsibus? target ? lun ?	# SCSI autochangers
ses*	at scsibus? target ? lun ?	# SCSI Enclosure Services devices
#ss*	at scsibus? target ? lun ?	# SCSI scanners
uk*	at scsibus? target ? lun ?	# SCSI unknown

# IDE and related devices
# PCI IDE controllers - see pciide(4) for supported hardware.
# The 0x0001 flag force the driver to use DMA, even if the driver doesn't know
# how to set up DMA modes for this chip. This may work, or may cause
# a machine hang with some controllers.
pciide* 	at pci? dev ? function ? flags 0x0000	# GENERIC pciide driver
#acardide*	at pci? dev ? function ?	# Acard IDE controllers
#aceride* 	at pci? dev ? function ?	# Acer Lab IDE controllers
#cmdide* 	at pci? dev ? function ?	# CMD tech IDE controllers
#cypide* 	at pci? dev ? function ?	# Cypress IDE controllers
#hptide* 	at pci? dev ? function ?	# Triones/HighPoint IDE controllers
#optiide* 	at pci? dev ? function ?	# Opti IDE controllers
piixide* 	at pci? dev ? function ?	# Intel IDE controllers
pdcide* 	at pci? dev ? function ?	# Promise IDE controllers
#siside* 	at pci? dev ? function ?	# SiS IDE controllers
#slide*  	at pci? dev ? function ?	# Symphony Labs IDE controllers
#viaide* 	at pci? dev ? function ?	# VIA/AMD/Nvidia IDE controllers

# ISA Plug-and-Play IDE controllers
#wdc*	at isapnp?

# PCMCIA IDE controllers
wdc*	at pcmcia? function ?

# ISA ST506, ESDI, and IDE controllers
# Use flags 0x01 if you want to try to use 32bits data I/O (the driver will
# fall back to 16bits I/O if 32bits I/O are not functional).
# Some controllers pass the initial 32bit test, but will fail later.
wdc0	at isa? port 0x1f0 irq 14 flags 0x00
wdc1	at isa? port 0x170 irq 15 flags 0x00

# ATA (IDE) bus support
atabus* at ata?

# IDE drives
# Flags are used only with controllers that support DMA operations
# and mode settings (e.g. some pciide controllers)
# The lowest order four bits (rightmost digit) of the flags define the PIO
# mode to use, the next set of four bits the DMA mode and the third set the
# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
# to use, and the last bit must be 1 for this setting to be used.
# For DMA and UDMA, 0xf (1111) means 'disable'.
# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
# (0xc=1100, 0xa=1010, 0xf=1111)
# 0x0000 means "use whatever the drive claims to support".
wd*	at atabus? drive ? flags 0x0000

# ATAPI bus support
atapibus* at atapi?

# ATAPI devices
# flags have the same meaning as for IDE drives.
cd*	at atapibus? drive ? flags 0x0000	# ATAPI CD-ROM drives
sd*	at atapibus? drive ? flags 0x0000	# ATAPI disk drives
st*	at atapibus? drive ? flags 0x0000	# ATAPI tape drives
uk*	at atapibus? drive ? flags 0x0000	# ATAPI unknown


# Miscellaneous mass storage devices

# ISA floppy
#fdc*	at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
#fdc1	at isa? port 0x370 irq ? drq ?
fd*	at fdc? drive ?			# the drives themselves
# some machines need you to do this instead of fd*
#fd0	at fdc0 drive 0

# Network Interfaces

# PCI network interfaces
#bce* 	at pci? dev ? function ?	# Broadcom 4401 10/100 Ethernet
#bge* 	at pci? dev ? function ?	# Broadcom 570x gigabit Ethernet
#ex*	at pci? dev ? function ?	# 3Com 90x[BC]
#fxp*	at pci? dev ? function ?	# Intel EtherExpress PRO 10+/100B
#ne* 	at pci? dev ? function ?	# NE2000-compatible Ethernet
#rtk* 	at pci? dev ? function ?	# Realtek 8129/8139
#tlp*	at pci? dev ? function ?	# DECchip 21x4x and clones
#wm*	at pci? dev ? function ?	# Intel 8254x gigabit

# PCMCIA network interfaces
an*	at pcmcia? function ?		# Aironet PC4500/PC4800 (802.11)
awi*	at pcmcia? function ?		# BayStack 650/660 (802.11FH/DS)
cnw*	at pcmcia? function ?		# Xircom/Netwave AirSurfer
ep*	at pcmcia? function ?		# 3Com 3c589 and 3c562 Ethernet
mbe*	at pcmcia? function ?		# MB8696x based Ethernet
ne*	at pcmcia? function ?		# NE2000-compatible Ethernet
ray*	at pcmcia? function ?		# Raytheon Raylink (802.11)
sm*	at pcmcia? function ?		# Megahertz Ethernet
wi*	at pcmcia? function ?		# Lucent/Intersil WaveLan IEEE (802.11)
xi*	at pcmcia? function ?		# Xircom CreditCard Ethernet

mhzc*	at pcmcia? function ?		# Megahertz Ethernet/Modem combo cards
com*	at mhzc?
sm*	at mhzc?

# CardBus network cards
#atw*	at cardbus? dev ? function ?	# ADMtek ADM8211 (802.11)
#ex*	at cardbus? dev ? function ?	# 3Com 3C575TX
#fxp*	at cardbus? dev ? function ?	# Intel i8255x
#rtk*	at cardbus? dev ? function ?	# Realtek 8129/8139
#tlp*	at cardbus? dev ? function ?	# DECchip 21143

# MII/PHY support
brgphy*	at mii? phy ?			# Broadcom BCM5400-family PHYs
dmphy*	at mii? phy ?			# Davicom DM9101 PHYs
exphy*	at mii? phy ?			# 3Com internal PHYs
icsphy*	at mii? phy ?			# Integrated Circuit Systems ICS189x
igphy*	at mii? phy ?			# Intel IGP01E1000
inphy*	at mii? phy ?			# Intel 82555 PHYs
iophy*	at mii? phy ?			# Intel 82553 PHYs
lxtphy*	at mii? phy ?			# Level One LXT-970 PHYs
makphy*	at mii? phy ?			# Marvell Semiconductor 88E1000 PHYs
nsphy*	at mii? phy ?			# NS83840 PHYs
nsphyter* at mii? phy ?			# NS83843 PHYs
qsphy*	at mii? phy ?			# Quality Semiconductor QS6612 PHYs
sqphy*	at mii? phy ?			# Seeq 80220/80221/80223 PHYs
tlphy*	at mii? phy ?			# ThunderLAN PHYs
tqphy*	at mii? phy ?			# TDK Semiconductor PHYs
ukphy*	at mii? phy ?			# generic unknown PHYs


# USB Controller and Devices

# PCI USB controllers
#ohci*	at pci?	dev ? function ?	# Open Host Controller
#uhci*	at pci?	dev ? function ?	# Universal Host Controller (Intel)

## CardBus USB controllers
#ohci*	at cardbus? dev ? function ?	# Open Host Controller
#ehci*	at cardbus? dev ? function ?	# Open Host Controller
#
## USB bus support
#usb*	at ohci?
##usb*	at uhci?
#usb*	at ehci?
#
# USB Hubs
#uhub*	at usb?
#uhub*	at uhub? port ? configuration ? interface ?
#
## USB HID device
#uhidev*	at uhub? port ? configuration ? interface ?
#
## USB Mice
#ums*	at uhidev? reportid ?