Index: arch/i386/conf/files.i386
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/conf/files.i386,v
retrieving revision 1.309
diff -u -r1.309 files.i386
--- arch/i386/conf/files.i386   15 Jun 2007 23:02:20 -0000      1.309
+++ arch/i386/conf/files.i386   21 Jun 2007 10:53:11 -0000
@@ -79,6 +79,7 @@
file   arch/i386/i386/ipkdb_glue.c     ipkdb
file   arch/i386/i386/kgdb_machdep.c   kgdb
file   arch/i386/i386/machdep.c
+file   arch/i386/i386/kopt_machdep.c
file   arch/i386/i386/identcpu.c
file   arch/i386/i386/math_emulate.c   math_emulate
file   arch/i386/i386/mem.c
@@ -159,17 +160,17 @@
include "dev/pci/files.agp"
file   arch/x86/pci/agp_machdep.c      agp
file   arch/i386/pci/pcibios.c         pcibios
-file   arch/i386/pci/pci_intr_fixup.c  pcibios & pci_intr_fixup
-file   arch/i386/pci/piix.c            pcibios & pci_intr_fixup
-file   arch/i386/pci/opti82c558.c      pcibios & pci_intr_fixup
-file   arch/i386/pci/opti82c700.c      pcibios & pci_intr_fixup
-file   arch/i386/pci/sis85c503.c       pcibios & pci_intr_fixup
-file   arch/i386/pci/via82c586.c       pcibios & pci_intr_fixup
-file   arch/i386/pci/via8231.c         pcibios & pci_intr_fixup
-file   arch/i386/pci/amd756.c          pcibios & pci_intr_fixup
-file   arch/i386/pci/ali1543.c         pcibios & pci_intr_fixup
-file   arch/i386/pci/pci_bus_fixup.c   pci_bus_fixup
-file   arch/i386/pci/pci_addr_fixup.c  pci_addr_fixup
+file   arch/i386/pci/pci_intr_fixup.c  pcibios
+file   arch/i386/pci/piix.c            pcibios
+file   arch/i386/pci/opti82c558.c      pcibios
+file   arch/i386/pci/opti82c700.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
+file   arch/i386/pci/pci_bus_fixup.c
+file   arch/i386/pci/pci_addr_fixup.c
defparam               PCI_CONF_MODE
file   arch/i386/pci/pcic_pci_machdep.c        pcic_pci

Index: kern/kern_bootprops.c
===================================================================
RCS file: kern/kern_bootprops.c
diff -N kern/kern_bootprops.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ kern/kern_bootprops.c       21 Jun 2007 10:53:11 -0000
@@ -0,0 +1,207 @@
+/* $NetBSD$ */
+
+/*-
+ * Copyright (c) 2007 Jared D. McNeill <[email protected]>
+ * 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 Jared D. McNeill.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/malloc.h>
+#include <prop/proplib.h>
+
+#include <sys/bootprops.h>
+
+#define BOOTPROPS_DICT_KOPTS   "kernel-options"
+
+static prop_dictionary_t bootprops = NULL;
+static char *bootprops_plist = NULL;
+static char bootprops_empty_plist[1] = "";
+
+static prop_object_t   bootprops_get(prop_dictionary_t, const char *);
+static int             sysctl_kern_bootprops(SYSCTLFN_PROTO);
+
+SYSCTL_SETUP(sysctl_bootprops_setup, "sysctl kern.bootprops setup")
+{
+
+       sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT,
+           CTLTYPE_NODE, "kern", NULL, NULL, 0, NULL, 0,
+           CTL_KERN, CTL_EOL);
+
+       sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT,
+           CTLTYPE_STRING, "bootprops", NULL, sysctl_kern_bootprops,
+           0, NULL, 0, CTL_KERN, CTL_CREATE, CTL_EOL);
+
+}
+
+int
+sysctl_kern_bootprops(SYSCTLFN_ARGS)
+{
+       struct sysctlnode node;
+       char *plist;
+
+       if (bootprops != NULL) {
+               if (bootprops_plist != NULL)
+                       free(bootprops_plist, M_TEMP);
+
+               bootprops_plist = prop_dictionary_externalize(bootprops);
+       }
+
+       if (bootprops_plist == NULL)
+               plist = bootprops_empty_plist;
+       else
+               plist = bootprops_plist;
+
+       node = *rnode;
+       node.sysctl_data = plist;
+       node.sysctl_size = strlen(plist) + 1;
+       return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+}
+
+boolean_t
+bootprops_init(const char *data)
+{
+       prop_dictionary_t kopts;
+
+       printf("%s\n", data);
+
+       bootprops = prop_dictionary_internalize(data);
+       if (bootprops == NULL)
+               bootprops = prop_dictionary_create();
+
+       if (bootprops == NULL)
+               return false;
+
+       kopts = prop_dictionary_get(bootprops, BOOTPROPS_DICT_KOPTS);
+       if (kopts == NULL) {
+               kopts = prop_dictionary_create();
+               prop_dictionary_set(bootprops, BOOTPROPS_DICT_KOPTS, kopts);
+       }
+
+       return true;
+}
+
+prop_dictionary_t
+bootprops_get_dictionary(const char *namespace)
+{
+       prop_object_t obj;
+
+       if (bootprops == NULL)
+               return NULL;
+       if (namespace == NULL)
+               return bootprops;
+       obj = prop_dictionary_get(bootprops, namespace);
+       if (obj == NULL)
+               return NULL;
+       if (prop_object_type(obj) != PROP_TYPE_DICTIONARY)
+               return NULL;
+       return (prop_dictionary_t)obj;
+}
+
+static prop_object_t
+bootprops_get(prop_dictionary_t dict, const char *key)
+{
+
+       if (bootprops == NULL)
+               return NULL;
+       if (dict == NULL)
+               dict = bootprops;
+       return prop_dictionary_get(dict, key);
+}
+
+prop_string_t
+bootprops_get_string(prop_dictionary_t dict, const char *key)
+{
+       prop_object_t obj;
+
+       obj = bootprops_get(dict, key);
+       if (obj == NULL || prop_object_type(obj) != PROP_TYPE_STRING)
+               return NULL;
+       return (prop_string_t)obj;
+}
+
+prop_number_t
+bootprops_get_number(prop_dictionary_t dict, const char *key)
+{
+       prop_object_t obj;
+
+       obj = bootprops_get(dict, key);
+       if (obj == NULL || prop_object_type(obj) != PROP_TYPE_NUMBER)
+               return NULL;
+       return (prop_number_t)obj;
+}
+
+prop_array_t
+bootprops_get_array(prop_dictionary_t dict, const char *key)
+{
+       prop_object_t obj;
+
+       obj = bootprops_get(dict, key);
+       if (obj == NULL || prop_object_type(obj) != PROP_TYPE_ARRAY)
+               return NULL;
+       return (prop_array_t)obj;
+}
+
+prop_bool_t
+bootprops_get_bool(prop_dictionary_t dict, const char *key)
+{
+       prop_object_t obj;
+
+       obj = bootprops_get(dict, key);
+       if (obj == NULL || prop_object_type(obj) != PROP_TYPE_BOOL)
+               return NULL;
+
+       return (prop_bool_t)obj;
+}
+
+/*
+ * kernel options namespace
+ */
+boolean_t
+bootprops_kopt_true(const char *key)
+{
+       prop_dictionary_t kopts;
+       prop_bool_t val;
+
+       kopts = bootprops_get(BOOTPROPS_DEFAULT_DICTIONARY,
+           BOOTPROPS_DICT_KOPTS);
+       if (kopts == NULL)
+               return false;
+
+       val = bootprops_get_bool(kopts, key);
+       if (val == NULL)
+               return false;
+
+       return prop_bool_true(val);
+}
Index: kern/subr_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_autoconf.c,v
retrieving revision 1.117
diff -u -r1.117 subr_autoconf.c
--- kern/subr_autoconf.c        5 Mar 2007 20:32:45 -0000       1.117
+++ kern/subr_autoconf.c        21 Jun 2007 10:53:11 -0000
@@ -243,6 +243,7 @@
       config_init();

#ifdef USERCONF
+       user_autoconfig();
       if (boothowto & RB_USERCONF)
               user_config();
#endif
Index: kern/subr_userconf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_userconf.c,v
retrieving revision 1.18
diff -u -r1.18 subr_userconf.c
--- kern/subr_userconf.c        11 Dec 2005 12:24:30 -0000      1.18
+++ kern/subr_userconf.c        21 Jun 2007 10:53:12 -0000
@@ -46,9 +46,12 @@
#include <sys/time.h>

#include <dev/cons.h>
+#include <prop/proplib.h>
+#include <sys/bootprops.h>

extern struct cfdata cfdata[];

+static int userconf_autoconfig = 0;
static int userconf_base = 16;                 /* Base for "large" numbers */
static int userconf_maxdev = -1;               /* # of used device slots   */
static int userconf_totdev = -1;               /* # of device slots        */
@@ -67,6 +70,10 @@

static int getsn(char *, int);

+static void userconf_bootprops_disable(const char *);
+static void userconf_bootprops_enable(const char *);
+static void userconf_bootprops_set(const char *, const char *);
+
#define UC_CHANGE 'c'
#define UC_DISABLE 'd'
#define UC_ENABLE 'e'
@@ -91,15 +98,21 @@
static void
userconf_init(void)
{
+       static int initted = 0;
       int i;
       struct cfdata *cf;

+       if (initted)
+               return;
+
       i = 0;
       for (cf = cfdata; cf->cf_name; cf++)
               i++;

       userconf_maxdev = i - 1;
       userconf_totdev = i - 1;
+
+       initted = 1;
}

static int
@@ -302,6 +315,23 @@
       return (0);
}

+static char *
+userconf_create_cmd(const char *cmd, const char *dev)
+{
+       static char uccmd[128];
+
+       if (cmd == NULL || dev == NULL || cmd[0] == '\0' || dev[0] == '\0')
+               return NULL;
+
+       memset(uccmd, 0, 128);
+       snprintf(uccmd, 127, "%s %s", cmd, dev);
+
+       if (userconf_autoconfig)
+               printf("[debug:uccmd=%s]\n", uccmd);
+
+       return uccmd;
+}
+
static int
userconf_device(char *cmd, int *len, short *unit, short *state)
{
@@ -435,7 +465,7 @@
}

static void
-userconf_disable(int devno)
+userconf_disable(char *dev, int devno)
{
       int done = 0;

@@ -456,24 +486,28 @@
                       break;
               }

-               printf("[%3d] ", devno);
-               userconf_pdevnam(devno);
+               if (!userconf_autoconfig) {
+                       printf("[%3d] ", devno);
+                       userconf_pdevnam(devno);
+               }
               if (done) {
-                       printf(" already");
+                       if (!userconf_autoconfig) printf(" already");
               } else {
                       /* XXX add cmd 'd' <devno> eoc */
                       userconf_hist_cmd('d');
                       userconf_hist_int(devno);
                       userconf_hist_eoc();
+
+                       userconf_bootprops_disable(dev);
               }
-               printf(" disabled\n");
+               if (!userconf_autoconfig) printf(" disabled\n");
       } else {
               printf("Unknown devno (max is %d)\n", userconf_maxdev);
       }
}

static void
-userconf_enable(int devno)
+userconf_enable(char *dev, int devno)
{
       int done = 0;

@@ -494,17 +528,21 @@
                       break;
               }

-               printf("[%3d] ", devno);
-               userconf_pdevnam(devno);
+               if (!userconf_autoconfig) {
+                       printf("[%3d] ", devno);
+                       userconf_pdevnam(devno);
+               }
               if (done) {
-                       printf(" already");
+                       if (!userconf_autoconfig) printf(" already");
               } else {
                       /* XXX add cmd 'e' <devno> eoc */
                       userconf_hist_cmd('d');
                       userconf_hist_int(devno);
                       userconf_hist_eoc();
+
+                       userconf_bootprops_enable(dev);
               }
-               printf(" enabled\n");
+               if (!userconf_autoconfig) printf(" enabled\n");
       } else {
               printf("Unknown devno (max is %d)\n", userconf_maxdev);
       }
@@ -615,10 +653,10 @@
                                       userconf_change(i);
                                       break;
                               case UC_ENABLE:
-                                       userconf_enable(i);
+                                       userconf_enable(dev, i);
                                       break;
                               case UC_DISABLE:
-                                       userconf_disable(i);
+                                       userconf_disable(dev, i);
                                       break;
                               case UC_FIND:
                                       userconf_pdev(i);
@@ -755,7 +793,7 @@
                       if (*c == '\0')
                               printf("Attr, DevNo or Dev expected\n");
                       else if (userconf_number(c, &a) == 0)
-                               userconf_disable(a);
+                               userconf_disable(NULL, a);
                       else if (userconf_device(c, &a, &unit, &state) == 0)
                               userconf_common_dev(c, a, unit, state, UC_DISABLE);
                       else
@@ -765,7 +803,7 @@
                       if (*c == '\0')
                               printf("Attr, DevNo or Dev expected\n");
                       else if (userconf_number(c, &a) == 0)
-                               userconf_enable(a);
+                               userconf_enable(NULL, a);
                       else if (userconf_device(c, &a, &unit, &state) == 0)
                               userconf_common_dev(c, a, unit, state, UC_ENABLE);
                       else
@@ -805,6 +843,7 @@
}

extern void user_config(void);
+extern void user_autoconfig(void);

void
user_config(void)
@@ -823,6 +862,82 @@
       printf("Continuing...\n");
}

+void
+user_autoconfig(void)
+{
+       prop_dictionary_t uc;
+       prop_dictionary_keysym_t key;
+       prop_string_t str;
+       prop_object_iterator_t it;
+
+       userconf_init();
+
+       uc = bootprops_get_dictionary("userconf");
+       if (uc == NULL)
+               return;
+
+       printf("userconf: loading settings from boot plist\n");
+
+       it = prop_dictionary_iterator(uc);
+       if (it == NULL)
+               return;
+
+       userconf_autoconfig = 1;
+       while ((key = prop_object_iterator_next(it)) != NULL) {
+               const char *k, *v;
+
+               k = prop_dictionary_keysym_cstring_nocopy(key);
+               str = prop_dictionary_get_keysym(uc, key);
+               if (k == NULL || str == NULL)
+                       continue;
+               v = prop_string_cstring_nocopy(str);
+
+               if (strcmp(v, "disabled") == 0)
+                       userconf_parse(userconf_create_cmd("disable", k));
+               else if (strcmp(v, "enabled") == 0)
+                       userconf_parse(userconf_create_cmd("enable", k));
+       }
+       prop_object_iterator_release(it);
+       userconf_autoconfig = 0;
+
+       return;
+}
+
+static void
+userconf_bootprops_disable(const char *dev)
+{
+       userconf_bootprops_set(dev, "disabled");
+}
+
+static void
+userconf_bootprops_enable(const char *dev)
+{
+       userconf_bootprops_set(dev, "enabled");
+}
+
+static void
+userconf_bootprops_set(const char *dev, const char *state)
+{
+       prop_dictionary_t bootprops, uc;
+
+       if (userconf_autoconfig || dev == NULL || dev[0] == '\0')
+               return;
+
+       bootprops = bootprops_get_dictionary(BOOTPROPS_DEFAULT_DICTIONARY);
+       if (bootprops == NULL)
+               return;
+
+       uc = bootprops_get_dictionary("userconf");
+       if (uc == NULL) {
+               uc = prop_dictionary_create();
+               if (uc == NULL)
+                       return;
+               prop_dictionary_set(bootprops, "userconf", uc);
+       }
+
+       prop_dictionary_set(uc, dev, prop_string_create_cstring(state));
+}
+
/*
 * XXX shouldn't this be a common function?
 */
Index: sys/bootprops.h
===================================================================
RCS file: sys/bootprops.h
diff -N sys/bootprops.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sys/bootprops.h     21 Jun 2007 10:53:12 -0000
@@ -0,0 +1,68 @@
+/* $NetBSD$ */
+
+/*-
+ * Copyright (c) 2007 Jared D. McNeill <[email protected]>
+ * 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 Jared D. McNeill.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_BOOTPROPS_H
+#define _SYS_BOOTPROPS_H
+
+#include <prop/proplib.h>
+
+#define BOOTPROPS_DEFAULT_DICTIONARY   NULL
+
+/* basic bootprops functions */
+boolean_t              bootprops_init(const char *);
+prop_dictionary_t      bootprops_get_dictionary(const char *);
+prop_string_t          bootprops_get_string(prop_dictionary_t, const char *);
+prop_number_t          bootprops_get_number(prop_dictionary_t, const char *);
+prop_array_t           bootprops_get_array(prop_dictionary_t, const char *);
+prop_bool_t            bootprops_get_bool(prop_dictionary_t, const char *);
+
+/* kernel option helpers */
+boolean_t              bootprops_kopt_true(const char *);
+
+#define KOPT_DEFAULT_BOOL(k, v)                                                \
+       do {                                                            \
+               prop_dictionary_t _kopt;                                \
+               _kopt = bootprops_get_dictionary("kernel-options");     \
+               if (_kopt) {                                            \
+                       prop_object_t obj;                              \
+                       obj = prop_dictionary_get(_kopt, (k));          \
+                       if (obj == NULL) {                              \
+                               prop_dictionary_set(_kopt, (k),         \
+                               prop_bool_create((v)));                 \
+                       }                                               \
+               }                                                       \
+       } while (0)
+#define KOPT_TRUE(k)   bootprops_kopt_true((k))
+
+#endif /* !_SYS_BOOTPROPS_H */
Index: sys/userconf.h
===================================================================
RCS file: /cvsroot/src/sys/sys/userconf.h,v
retrieving revision 1.4
diff -u -r1.4 userconf.h
--- sys/userconf.h      11 Dec 2005 12:25:21 -0000      1.4
+++ sys/userconf.h      21 Jun 2007 10:53:12 -0000
@@ -37,5 +37,6 @@
#define _SYS_USERCONF_H_

void user_config(void);
+void user_autoconfig(void);

#endif /* !_SYS_USERCONF_H_ */
Index: arch/i386/i386/kopt_machdep.c
===================================================================
RCS file: arch/i386/i386/kopt_machdep.c
diff -N arch/i386/i386/kopt_machdep.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ arch/i386/i386/kopt_machdep.c       21 Jun 2007 10:53:12 -0000
@@ -0,0 +1,36 @@
+/* $NetBSD$ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/bootprops.h>
+
+#include "opt_pcifixup.h"
+
+/* XXX should this be auto-generated by config? */
+void   kopt_machdep_init(void);
+
+void
+kopt_machdep_init(void)
+{
+#ifdef PCI_BUS_FIXUP
+       KOPT_DEFAULT_BOOL("PCI_BUS_FIXUP", true);
+#else
+       KOPT_DEFAULT_BOOL("PCI_BUS_FIXUP", false);
+#endif
+#ifdef PCI_INTR_FIXUP
+       KOPT_DEFAULT_BOOL("PCI_INTR_FIXUP", true);
+#else
+       KOPT_DEFAULT_BOOL("PCI_INTR_FIXUP", false);
+#endif
+#ifdef PCI_ADDR_FIXUP
+       KOPT_DEFAULT_BOOL("PCI_ADDR_FIXUP", true);
+#else
+       KOPT_DEFAULT_BOOL("PCI_ADDR_FIXUP", false);
+#endif
+#ifdef PCI_INTR_FIXUP_FORCE
+       KOPT_DEFAULT_BOOL("PCI_INTR_FIXUP_FORCE", true);
+#else
+       KOPT_DEFAULT_BOOL("PCI_INTR_FIXUP_FORCE", false);
+#endif
+}
Index: arch/i386/i386/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.603
diff -u -r1.603 machdep.c
--- arch/i386/i386/machdep.c    17 May 2007 14:51:21 -0000      1.603
+++ arch/i386/i386/machdep.c    21 Jun 2007 10:53:13 -0000
@@ -206,6 +206,9 @@
#include <machine/mpbiosvar.h> /* XXX */
#endif                         /* XXX */

+#include <sys/bootprops.h>
+extern void kopt_machdep_init(void);
+
/* the following is used externally (sysctl_hw) */
char machine[] = "i386";               /* CPU "architecture" */
char machine_arch[] = "i386";          /* machine == machine_arch */
@@ -409,6 +412,7 @@
       vaddr_t minaddr, maxaddr;
       psize_t sz;
       char pbuf[9];
+       struct btinfo_bootprops *bp;

       /*
        * For console drivers that require uvm and pmap to be initialized,
@@ -493,6 +497,12 @@
       i386_proc0_tss_ldt_init();

       x86_init();
+
+       bp = lookup_bootinfo(BTINFO_BOOTPROPS);
+       if (bp != NULL) {
+               bootprops_init(bp->xml);
+               kopt_machdep_init();
+       }
}

/*
Index: arch/i386/i386/mainbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/mainbus.c,v
retrieving revision 1.71
diff -u -r1.71 mainbus.c
--- arch/i386/i386/mainbus.c    5 Mar 2007 16:51:02 -0000       1.71
+++ arch/i386/i386/mainbus.c    21 Jun 2007 10:53:13 -0000
@@ -36,6 +36,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
+#include <sys/bootprops.h>

#include <machine/bus.h>

@@ -91,13 +92,9 @@
#endif

#if NPCI > 0
-#if defined(PCI_BUS_FIXUP)
#include <arch/i386/pci/pci_bus_fixup.h>
-#if defined(PCI_ADDR_FIXUP)
#include <arch/i386/pci/pci_addr_fixup.h>
#endif
-#endif
-#endif

int    mainbus_match(struct device *, struct cfdata *, void *);
void   mainbus_attach(struct device *, struct device *, void *);
@@ -191,9 +188,7 @@
#if NACPI > 0 || defined(MPBIOS)
       int numioapics = 0;
#endif
-#if defined(PCI_BUS_FIXUP)
       int pci_maxbus = 0;
-#endif
       int mpacpi_active = 0;
       int numcpus = 0;

@@ -209,18 +204,16 @@
        * ACPI needs to be able to access PCI configuration space.
        */
       pci_mode = pci_mode_detect();
-#if defined(PCI_BUS_FIXUP)
-       if (pci_mode != 0) {
+       if (KOPT_TRUE("PCI_BUS_FIXUP") && pci_mode != 0) {
               pci_maxbus = pci_bus_fixup(NULL, 0);
               aprint_debug("PCI bus max, after pci_bus_fixup: %i\n", pci_maxbus);
-#if defined(PCI_ADDR_FIXUP)
-               pciaddr.extent_port = NULL;
-               pciaddr.extent_mem = NULL;
-               pci_addr_fixup(NULL, pci_maxbus);
-#endif
+               if (KOPT_TRUE("PCI_ADDR_FIXUP")) {
+                       pciaddr.extent_port = NULL;
+                       pciaddr.extent_mem = NULL;
+                       pci_addr_fixup(NULL, pci_maxbus);
+               }
       }
#endif
-#endif

#if NACPI > 0
       if (acpi_check(self, "acpibus"))
Index: arch/i386/i386/rbus_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/rbus_machdep.c,v
retrieving revision 1.21
diff -u -r1.21 rbus_machdep.c
--- arch/i386/i386/rbus_machdep.c       20 Jan 2007 14:46:21 -0000      1.21
+++ arch/i386/i386/rbus_machdep.c       21 Jun 2007 10:53:13 -0000
@@ -39,6 +39,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/extent.h>
+#include <sys/bootprops.h>

#include <uvm/uvm_extern.h>

@@ -52,9 +53,7 @@
#include <dev/isa/isavar.h>

#include <dev/pci/pcivar.h>
-#if defined(PCI_ADDR_FIXUP)
#include <arch/i386/pci/pci_addr_fixup.h>
-#endif

#ifndef RBUS_IO_BASE
#define        RBUS_IO_BASE    0x4000
@@ -137,10 +136,8 @@
       extern struct extent *iomem_ex;
       struct extent *ex = iomem_ex;

-#if defined(PCI_ADDR_FIXUP)
-       if (pciaddr.extent_mem != NULL)
+       if (KOPT_TRUE("PCI_ADDR_FIXUP") && pciaddr.extent_mem != NULL)
               ex = pciaddr.extent_mem;
-#endif

       start = ex->ex_start;

@@ -176,10 +173,8 @@
       extern struct extent *ioport_ex;
       struct extent *ex = ioport_ex;

-#if defined(PCI_ADDR_FIXUP)
-       if (pciaddr.extent_port != NULL)
+       if (KOPT_TRUE("PCI_ADDR_FIXUP") && pciaddr.extent_port != NULL)
               ex = pciaddr.extent_port;
-#endif

       start = RBUS_IO_BASE;
       size  = RBUS_IO_SIZE;
Index: arch/x86/include/bootinfo.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/include/bootinfo.h,v
retrieving revision 1.11
diff -u -r1.11 bootinfo.h
--- arch/x86/include/bootinfo.h 3 Feb 2006 11:08:24 -0000       1.11
+++ arch/x86/include/bootinfo.h 21 Jun 2007 10:53:13 -0000
@@ -42,6 +42,7 @@
#define BTINFO_SYMTAB          8
#define BTINFO_MEMMAP          9
#define        BTINFO_BOOTWEDGE        10
+#define BTINFO_BOOTPROPS       11

struct btinfo_bootpath {
       struct btinfo_common common;
@@ -74,6 +75,12 @@
       uint8_t matchhash[16];  /* MD5 hash */
} __attribute__((packed));

+struct btinfo_bootprops {
+       struct btinfo_common common;
+       uint8_t len;
+       char xml[1];
+};
+
struct btinfo_netif {
       struct btinfo_common common;
       char ifname[16];