tech-x11 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

xorg pci probing



Hi!

I have a machine with two PCI graphic cards:
1x Radeon HD 4200
1x Radeon HD 5600

Starting X fails with the error message
"Primary device is not PCI"

Per discussion with macallen@ I implemented
pci_device_is_boot_vga() in libpciaccess
which uses a new ioctl().

Attached are three patches:

xorg_ioctl.diff  which implements the new ioctl
xorg.diff        which enable the use of pci_device_is_boot_vga()
xsrc.diff        which implements pci_device_is_boot_vga()


The three patches let me start X on said machine
and I also successfully tested them where X also
starts w/o these patches.

Any comments?

Christoph

Index: sys/dev/pci/chipsfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/chipsfb.c,v
retrieving revision 1.24
diff -u -p -r1.24 chipsfb.c
--- sys/dev/pci/chipsfb.c       23 Dec 2010 21:11:37 -0000      1.24
+++ sys/dev/pci/chipsfb.c       25 Dec 2010 11:52:59 -0000
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include <dev/i2c/i2cvar.h>
 
@@ -850,6 +851,15 @@ chipsfb_ioctl(void *v, void *vs, u_long 
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
 
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(&sc->sc_dev, bus, &pci);
+               }
+
        case WSDISPLAYIO_SMODE: {
                int new_mode = *(int*)data;
                if (new_mode != sc->sc_mode) {
Index: sys/dev/pci/genfb_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/genfb_pci.c,v
retrieving revision 1.26
diff -u -p -r1.26 genfb_pci.c
--- sys/dev/pci/genfb_pci.c     16 Dec 2010 06:45:50 -0000      1.26
+++ sys/dev/pci/genfb_pci.c     25 Dec 2010 11:52:59 -0000
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,
 #include <dev/pci/pciio.h>
 
 #include <dev/wsfb/genfbvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include <dev/pci/genfb_pcivar.h>
 
@@ -197,6 +198,16 @@ pci_genfb_ioctl(void *v, void *vs, u_lon
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
+
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_gen.sc_dev, bus, &pci);
+               }
+
        case WSDISPLAYIO_SMODE: {
                int new_mode = *(int*)data, i;
                if (new_mode == WSDISPLAYIO_MODE_EMUL) {
Index: sys/dev/pci/machfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/machfb.c,v
retrieving revision 1.62
diff -u -p -r1.62 machfb.c
--- sys/dev/pci/machfb.c        16 Dec 2010 06:45:50 -0000      1.62
+++ sys/dev/pci/machfb.c        25 Dec 2010 11:53:00 -0000
@@ -65,6 +65,7 @@ __KERNEL_RCSID(0, 
 #include <dev/wscons/wsconsio.h>
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include <dev/wscons/wsdisplay_vconsvar.h>
 
@@ -1709,7 +1710,16 @@ mach64_ioctl(void *v, void *vs, u_long c
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
-                   
+
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_dev, bus, &pci);
+               }
+
        case WSDISPLAYIO_SMODE: {
                int new_mode = *(int*)data;
                if (new_mode != sc->sc_mode) {
@@ -2007,6 +2017,16 @@ machfb_fbioctl(dev_t dev, u_long cmd, vo
 #endif
                return ret;
                }
+
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_dev, bus, &pci);
+               }
+
        default:
 #ifdef MACHFB_DEBUG
                log(LOG_NOTICE, "machfb_fbioctl(0x%lx) (%s[%d])\n", cmd,
Index: sys/dev/pci/pm2fb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/pm2fb.c,v
retrieving revision 1.6
diff -u -p -r1.6 pm2fb.c
--- sys/dev/pci/pm2fb.c 16 Dec 2010 06:45:50 -0000      1.6
+++ sys/dev/pci/pm2fb.c 25 Dec 2010 11:53:00 -0000
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include <dev/i2c/i2cvar.h>
 
@@ -317,6 +318,15 @@ pm2fb_ioctl(void *v, void *vs, u_long cm
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
 
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_dev, bus, &pci);
+               }
+
        case WSDISPLAYIO_GINFO:
                if (ms == NULL)
                        return ENODEV;
Index: sys/dev/pci/r128fb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/r128fb.c,v
retrieving revision 1.18
diff -u -p -r1.18 r128fb.c
--- sys/dev/pci/r128fb.c        25 Dec 2010 03:29:08 -0000      1.18
+++ sys/dev/pci/r128fb.c        25 Dec 2010 11:53:00 -0000
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include <dev/i2c/i2cvar.h>
 
@@ -349,8 +350,17 @@ r128fb_ioctl(void *v, void *vs, u_long c
        /* PCI config read/write passthrough. */
        case PCI_IOC_CFGREAD:
        case PCI_IOC_CFGWRITE:
-               return (pci_devioctl(sc->sc_pc, sc->sc_pcitag,
-                   cmd, data, flag, l));
+               return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
+                   cmd, data, flag, l);
+
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_dev, bus, &pci);
+               }
 
        case WSDISPLAYIO_GINFO:
                if (ms == NULL)
Index: sys/dev/pci/radeonfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/radeonfb.c,v
retrieving revision 1.40
diff -u -p -r1.40 radeonfb.c
--- sys/dev/pci/radeonfb.c      16 Dec 2010 06:45:50 -0000      1.40
+++ sys/dev/pci/radeonfb.c      25 Dec 2010 11:53:00 -0000
@@ -90,6 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v
 #include <dev/videomode/videomode.h>
 #include <dev/videomode/edidvar.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include <dev/pci/pcidevs.h>
 #include <dev/pci/pcireg.h>
@@ -1096,6 +1097,15 @@ radeonfb_ioctl(void *v, void *vs,
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(sc->sc_pc, sc->sc_pt, cmd, d, flag, l);
 
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = d;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pt;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(&sc->sc_dev, bus, &pci);
+               }
+
        default:
                return EPASSTHROUGH;
        }
Index: sys/dev/pci/tga.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/tga.c,v
retrieving revision 1.80
diff -u -p -r1.80 tga.c
--- sys/dev/pci/tga.c   13 Nov 2010 13:52:08 -0000      1.80
+++ sys/dev/pci/tga.c   25 Dec 2010 11:53:01 -0000
@@ -58,6 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.80
 #include <dev/wscons/wscons_raster.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wsfont/wsfont.h>
+#include <dev/wscons/wsdisplay_subr.h>
+
 int    tgamatch(device_t, cfdata_t, void *);
 void   tgaattach(device_t, device_t, void *);
 int    tgaprint(void *, const char *);
@@ -594,6 +596,15 @@ tga_ioctl(void *v, void *vs, u_long cmd,
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(dc->dc_pc, dc->dc_pcitag,
                    cmd, data, flag, l);
+
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = dc->dc_pc;
+               pci.pci_tag = dc->dc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(vc->softc->sc_dev, bus, &pci);
+               }
        }
        return EPASSTHROUGH;
 }
Index: sys/dev/pci/unichromefb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/unichromefb.c,v
retrieving revision 1.17
diff -u -p -r1.17 unichromefb.c
--- sys/dev/pci/unichromefb.c   16 Dec 2010 06:45:50 -0000      1.17
+++ sys/dev/pci/unichromefb.c   25 Dec 2010 11:53:01 -0000
@@ -70,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: unichromefb.
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include <dev/pci/unichromereg.h>
 #include <dev/pci/unichromemode.h>
@@ -478,6 +479,16 @@ unichromefb_ioctl(void *v, void *vs, u_l
        case PCI_IOC_CFGWRITE:
                return (pci_devioctl(sc->sc_pa.pa_pc, sc->sc_pa.pa_tag,
                    cmd, data, flag, l));
+
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pa.pa_pc;
+               pci.pci_tag = sc->sc_pa.pa_tag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_dev, bus, &pci);
+               }
+
        }
 
        return EPASSTHROUGH;
Index: sys/dev/pci/vga_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/vga_pci.c,v
retrieving revision 1.52
diff -u -p -r1.52 vga_pci.c
--- sys/dev/pci/vga_pci.c       16 Dec 2010 06:45:50 -0000      1.52
+++ sys/dev/pci/vga_pci.c       25 Dec 2010 11:53:01 -0000
@@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 
 
 #include <dev/wscons/wsconsio.h>
 #include <dev/wscons/wsdisplayvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include "opt_vga.h"
 
@@ -313,6 +314,15 @@ vga_pci_ioctl(void *v, u_long cmd, void 
                return pci_devioctl(psc->sc_pc, psc->sc_pcitag,
                    cmd, data, flag, l);
 
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = psc->sc_pc;
+               pci.pci_tag = psc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(vc->softc->sc_dev, bus, &pci);
+               }
+
        default:
                return EPASSTHROUGH;
        }
Index: sys/dev/pci/voodoofb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/voodoofb.c,v
retrieving revision 1.26
diff -u -p -r1.26 voodoofb.c
--- sys/dev/pci/voodoofb.c      25 Dec 2010 11:51:21 -0000      1.26
+++ sys/dev/pci/voodoofb.c      25 Dec 2010 11:53:01 -0000
@@ -64,6 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include "opt_wsemul.h"
 
@@ -936,7 +937,16 @@ voodoofb_ioctl(void *v, void *vs, u_long
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
-                   
+
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_dev, bus, &pci);
+               }
+
        case WSDISPLAYIO_SMODE: {
                int new_mode = *(int*)data;
                if (new_mode != sc->sc_mode) {
Index: sys/dev/pci/voyagerfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/voyagerfb.c,v
retrieving revision 1.6
diff -u -p -r1.6 voyagerfb.c
--- sys/dev/pci/voyagerfb.c     23 Dec 2010 21:34:02 -0000      1.6
+++ sys/dev/pci/voyagerfb.c     25 Dec 2010 11:53:01 -0000
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include <dev/i2c/i2cvar.h>
 
@@ -325,6 +326,15 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
 
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_dev, bus, &pci);
+               }
+
        case WSDISPLAYIO_GINFO:
                if (ms == NULL)
                        return ENODEV;
Index: sys/dev/pci/wcfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/wcfb.c,v
retrieving revision 1.7
diff -u -p -r1.7 wcfb.c
--- sys/dev/pci/wcfb.c  16 Dec 2010 06:45:51 -0000      1.7
+++ sys/dev/pci/wcfb.c  25 Dec 2010 11:53:01 -0000
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.7
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wscons/wsdisplay_subr.h>
 
 #include "opt_wsfb.h"
 #include "opt_wsdisplay_compat.h"
@@ -318,6 +319,16 @@ wcfb_ioctl(void *v, void *vs, u_long cmd
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
+
+       case WSDISPLAYIO_GET_BUSID: {
+               struct wsdisplayio_bus_pci pci;
+               struct wsdisplayio_bus_id *bus = data;
+               pci.pci_pc = sc->sc_pc;
+               pci.pci_tag = sc->sc_pcitag;
+               bus->bus_type = WSDISPLAYIO_BUS_PCI;
+               return wsdisplayio_busid(sc->sc_dev, bus, &pci);
+               }
+
        case WSDISPLAYIO_SMODE: {
                /*int new_mode = *(int*)data, i;*/
                }
Index: sys/dev/wscons/files.wscons
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/files.wscons,v
retrieving revision 1.41
diff -u -p -r1.41 files.wscons
--- sys/dev/wscons/files.wscons 20 Aug 2009 02:01:08 -0000      1.41
+++ sys/dev/wscons/files.wscons 25 Dec 2010 11:53:02 -0000
@@ -45,6 +45,7 @@ device        wsmouse
 attach wsmouse at wsmousedev
 
 file   dev/wscons/wsdisplay.c          wsdisplay               needs-flag
+file   dev/wscons/wsdisplay_subr.c     wsdisplay
 file   dev/wscons/wsdisplay_compat_usl.c wsdisplay & wsdisplay_compat_usl
 file   dev/wscons/wsemulconf.c         wsdisplay
 file   dev/wscons/wsemul_dumb.c        wsdisplay & !wsemul_no_dumb
Index: sys/dev/wscons/wsconsio.h
===================================================================
RCS file: /cvsroot/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.93
diff -u -p -r1.93 wsconsio.h
--- sys/dev/wscons/wsconsio.h   2 Oct 2010 00:52:02 -0000       1.93
+++ sys/dev/wscons/wsconsio.h   25 Dec 2010 11:53:02 -0000
@@ -542,4 +542,26 @@ struct wsmux_device_list {
 #define        WSMUXIO_INJECTEVENT     _IOW('W', 100, struct wscons_event)
 #define        WSMUX_INJECTEVENT       WSMUXIO_INJECTEVENT /* XXX compat */
 
+/* Mapping information retrieval. */
+struct wsdisplayio_bus_id {
+    u_int bus_type;
+#define WSDISPLAYIO_BUS_PCI    0
+#define WSDISPLAYIO_BUS_SBUS   1
+    union bus_data {
+        struct bus_pci {
+            uint32_t domain;
+            uint32_t bus;
+            uint32_t device;
+            uint32_t function;
+        } pci;
+        struct bus_sbus {
+            uint32_t fb_instance;
+        } sbus;
+        /* so the size doesn't change if we add more bus types */
+        char pad[32];
+    } ubus;
+};
+
+#define WSDISPLAYIO_GET_BUSID  _IOR('W', 101, struct wsdisplayio_bus_id)
+
 #endif /* _DEV_WSCONS_WSCONSIO_H_ */
Index: sys/dev/wscons/wsdisplay_subr.c
===================================================================
RCS file: sys/dev/wscons/wsdisplay_subr.c
diff -N sys/dev/wscons/wsdisplay_subr.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sys/dev/wscons/wsdisplay_subr.c     25 Dec 2010 11:53:02 -0000
@@ -0,0 +1,58 @@
+/*     $NetBSD: $ */
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christoph Egger.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: $");
+
+#include <sys/param.h>
+#include <dev/wscons/wsdisplay_subr.h>
+
+int
+wsdisplayio_busid(device_t self, struct wsdisplayio_bus_id *busid,
+    void *data)
+{
+       struct wsdisplayio_bus_pci *pci;
+
+       switch (busid->bus_type) {
+       case WSDISPLAYIO_BUS_PCI:
+               pci = data;
+               busid->ubus.pci.domain = device_unit(device_parent(self));
+               pci_decompose_tag(pci->pci_pc, pci->pci_tag,                    
                    &busid->ubus.pci.bus, &busid->ubus.pci.device,
+                   &busid->ubus.pci.function);
+               break;
+       case WSDISPLAYIO_BUS_SBUS:
+               return ENOTSUP;
+       default:
+               printf("Unknown bus type %d\n", busid->bus_type);
+               return EINVAL;
+       }
+
+       return 0;
+}
Index: sys/dev/wscons/wsdisplay_subr.h
===================================================================
RCS file: sys/dev/wscons/wsdisplay_subr.h
diff -N sys/dev/wscons/wsdisplay_subr.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sys/dev/wscons/wsdisplay_subr.h     25 Dec 2010 11:53:02 -0000
@@ -0,0 +1,47 @@
+/*     $NetBSD: $ */
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christoph Egger.
+ *
+ * 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.
+ */
+
+#ifndef _SYS_DEV_WSDISPLAYSUBR_H_
+#define _SYS_DEV_WSDISPLAYSUBR_H_
+
+#include <sys/bus.h>
+#include <dev/pci/pcivar.h>
+#include <sys/device_if.h>
+#include <dev/wscons/wsconsio.h>
+
+struct wsdisplayio_bus_pci {
+       pci_chipset_tag_t pci_pc;
+       pcitag_t pci_tag;
+};
+
+int
+wsdisplayio_busid(device_t self, struct wsdisplayio_bus_id *busid, void *data);
+
+#endif /* _SYS_DEV_WSDISPLAYSUBR_H_ */
Index: external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile
===================================================================
RCS file: 
/cvsroot/src/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile     29 Nov 
2010 09:34:41 -0000      1.15
+++ external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile     13 Dec 
2010 08:17:24 -0000
@@ -83,7 +83,8 @@ CPPFLAGS+=    ${X11FLAGS.EXTENSION} ${X11FL
                -D__XSERVERNAME__='"Xorg"' -D__XCONFIGFILE__='"xorg.conf"' \
                -D__VENDORDWEBSUPPORT__='"http://wiki.X.Org";' \
                -DXVENDORNAME='"The X.Org Foundation"' \
-               -DHAVE_XORG_CONFIG_H
+               -DHAVE_XORG_CONFIG_H \
+               -DHAVE_PCI_DEVICE_IS_BOOT_VGA
 
 .if ${MACHINE_ARCH} == "i386"
 CPPFLAGS+=     -DPCCONS_SUPPORT -DPCVT_SUPPORT
Index: external/mit/libpciaccess/dist/src/netbsd_pci.c
===================================================================
RCS file: /cvsroot/xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c,v
retrieving revision 1.8
diff -u -p -r1.8 netbsd_pci.c
--- external/mit/libpciaccess/dist/src/netbsd_pci.c     12 Jan 2011 19:03:50 
-0000      1.8
+++ external/mit/libpciaccess/dist/src/netbsd_pci.c     15 Jan 2011 09:12:03 
-0000
@@ -40,6 +40,7 @@
 
 
 #include <pci.h>
+#include <dev/wscons/wsconsio.h>
 
 #include "pciaccess.h"
 #include "pciaccess_private.h"
@@ -247,6 +248,37 @@ pci_device_netbsd_write(struct pci_devic
        return 0;
 }
 
+static int
+pci_device_netbsd_boot_vga(struct pci_device *dev)
+{
+       int ret;
+       struct wsdisplayio_bus_id busid;
+       int fd;
+
+       fd = open("/dev/ttyE0", O_RDONLY);
+       if (fd == -1)
+               return 0;
+
+       ret = ioctl(fd, WSDISPLAYIO_GET_BUSID, &busid);
+       close(fd);
+       if (ret == -1)
+               return 0;
+
+       if (busid.bus_type != WSDISPLAYIO_BUS_PCI)
+               return 0;
+
+       if (busid.ubus.pci.domain != dev->domain)
+               return 0;
+       if (busid.ubus.pci.bus != dev->bus)
+               return 0;
+       if (busid.ubus.pci.device != dev->dev)
+               return 0;
+       if (busid.ubus.pci.function != dev->func)
+               return 0;
+
+       return 1;
+}
+
 static void
 pci_system_netbsd_destroy(void)
 {
@@ -479,7 +511,8 @@ static const struct pci_system_methods n
        .unmap_range = pci_device_netbsd_unmap_range,
        .read = pci_device_netbsd_read,
        .write = pci_device_netbsd_write,
-       .fill_capabilities = pci_fill_capabilities_generic
+       .fill_capabilities = pci_fill_capabilities_generic,
+       .boot_vga = pci_device_netbsd_boot_vga,
 };
 
 int


Home | Main Index | Thread Index | Old Index