Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Implement new WSDISPLAYIO_GET_BUSID ioctl.



details:   https://anonhg.NetBSD.org/src/rev/22740e3066d8
branches:  trunk
changeset: 761265:22740e3066d8
user:      cegger <cegger%NetBSD.org@localhost>
date:      Sat Jan 22 15:14:27 2011 +0000

description:
Implement new WSDISPLAYIO_GET_BUSID ioctl.
It returns the bus id and allows userland (like Xorg) to create mapping
of ttyE? and bus id. For now only PCI is implemented.

First discussed with macallan@ then public on tech-kern@ and tech-x11@

diffstat:

 sys/dev/pci/chipsfb.c       |   9 +++++-
 sys/dev/pci/files.pci       |   4 ++-
 sys/dev/pci/genfb_pci.c     |  10 ++++++-
 sys/dev/pci/machfb.c        |  16 +++++++++++--
 sys/dev/pci/pm2fb.c         |   9 +++++-
 sys/dev/pci/r128fb.c        |  12 ++++++---
 sys/dev/pci/radeonfb.c      |   9 +++++-
 sys/dev/pci/tga.c           |  10 ++++++-
 sys/dev/pci/unichromefb.c   |  10 ++++++-
 sys/dev/pci/vga_pci.c       |   9 +++++-
 sys/dev/pci/voodoofb.c      |  11 ++++++--
 sys/dev/pci/voyagerfb.c     |   9 +++++-
 sys/dev/pci/wcfb.c          |  10 ++++++-
 sys/dev/pci/wsdisplay_pci.c |  53 +++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/pci/wsdisplay_pci.h |  40 +++++++++++++++++++++++++++++++++
 sys/dev/wscons/wsconsio.h   |  24 +++++++++++++++++++-
 16 files changed, 215 insertions(+), 30 deletions(-)

diffs (truncated from 622 to 300 lines):

diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/chipsfb.c
--- a/sys/dev/pci/chipsfb.c     Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/chipsfb.c     Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chipsfb.c,v 1.24 2010/12/23 21:11:37 cegger Exp $      */
+/*     $NetBSD: chipsfb.c,v 1.25 2011/01/22 15:14:27 cegger Exp $      */
 
 /*
  * Copyright (c) 2006 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.24 2010/12/23 21:11:37 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.25 2011/01/22 15:14:27 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,6 +55,7 @@
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/pci/wsdisplay_pci.h>
 
 #include <dev/i2c/i2cvar.h>
 
@@ -850,6 +851,10 @@
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
 
+       case WSDISPLAYIO_GET_BUSID:
+               return wsdisplayio_busid_pci(&sc->sc_dev, sc->sc_pc,
+                   sc->sc_pcitag, data);
+
        case WSDISPLAYIO_SMODE: {
                int new_mode = *(int*)data;
                if (new_mode != sc->sc_mode) {
diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/files.pci     Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.335 2010/12/11 18:18:09 matt Exp $
+#      $NetBSD: files.pci,v 1.336 2011/01/22 15:14:27 cegger Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -28,6 +28,8 @@
 
 file   dev/pci/pci_verbose.c           pci & pciverbose
 
+file   dev/pci/wsdisplay_pci.c         wsdisplay & pci
+
 # Cypress 82c693 hyperCache(tm) Stand-Alone PCI Peripheral Controller
 # with USB.  This is a combo chip:
 #
diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/genfb_pci.c
--- a/sys/dev/pci/genfb_pci.c   Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/genfb_pci.c   Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfb_pci.c,v 1.26 2010/12/16 06:45:50 cegger Exp $ */
+/*     $NetBSD: genfb_pci.c,v 1.27 2011/01/22 15:14:28 cegger Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.26 2010/12/16 06:45:50 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.27 2011/01/22 15:14:28 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -46,6 +46,7 @@
 #include <dev/pci/pciio.h>
 
 #include <dev/wsfb/genfbvar.h>
+#include <dev/pci/wsdisplay_pci.h>
 
 #include <dev/pci/genfb_pcivar.h>
 
@@ -197,6 +198,11 @@
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
+
+       case WSDISPLAYIO_GET_BUSID:
+               return wsdisplayio_busid_pci(sc->sc_gen.sc_dev, sc->sc_pc,
+                   sc->sc_pcitag, data);
+
        case WSDISPLAYIO_SMODE: {
                int new_mode = *(int*)data, i;
                if (new_mode == WSDISPLAYIO_MODE_EMUL) {
diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/machfb.c
--- a/sys/dev/pci/machfb.c      Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/machfb.c      Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machfb.c,v 1.62 2010/12/16 06:45:50 cegger Exp $       */
+/*     $NetBSD: machfb.c,v 1.63 2011/01/22 15:14:28 cegger Exp $       */
 
 /*
  * Copyright (c) 2002 Bang Jun-Young
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 __KERNEL_RCSID(0, 
-       "$NetBSD: machfb.c,v 1.62 2010/12/16 06:45:50 cegger Exp $");
+       "$NetBSD: machfb.c,v 1.63 2011/01/22 15:14:28 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -65,6 +65,7 @@
 #include <dev/wscons/wsconsio.h>
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
+#include <dev/pci/wsdisplay_pci.h>
 
 #include <dev/wscons/wsdisplay_vconsvar.h>
 
@@ -1709,7 +1710,11 @@
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
-                   
+
+       case WSDISPLAYIO_GET_BUSID:
+               return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
+                   sc->sc_pcitag, data);
+
        case WSDISPLAYIO_SMODE: {
                int new_mode = *(int*)data;
                if (new_mode != sc->sc_mode) {
@@ -2007,6 +2012,11 @@
 #endif
                return ret;
                }
+
+       case WSDISPLAYIO_GET_BUSID:
+               return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
+                   sc->sc_pcitag, data);
+
        default:
 #ifdef MACHFB_DEBUG
                log(LOG_NOTICE, "machfb_fbioctl(0x%lx) (%s[%d])\n", cmd,
diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/pm2fb.c
--- a/sys/dev/pci/pm2fb.c       Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/pm2fb.c       Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pm2fb.c,v 1.6 2010/12/16 06:45:50 cegger Exp $ */
+/*     $NetBSD: pm2fb.c,v 1.7 2011/01/22 15:14:28 cegger Exp $ */
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.6 2010/12/16 06:45:50 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.7 2011/01/22 15:14:28 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,7 @@
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/pci/wsdisplay_pci.h>
 
 #include <dev/i2c/i2cvar.h>
 
@@ -317,6 +318,10 @@
                return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
                    cmd, data, flag, l);
 
+       case WSDISPLAYIO_GET_BUSID:
+               return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
+                   sc->sc_pcitag, data);
+
        case WSDISPLAYIO_GINFO:
                if (ms == NULL)
                        return ENODEV;
diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/r128fb.c
--- a/sys/dev/pci/r128fb.c      Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/r128fb.c      Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: r128fb.c,v 1.19 2011/01/06 07:43:05 macallan Exp $     */
+/*     $NetBSD: r128fb.c,v 1.20 2011/01/22 15:14:28 cegger Exp $       */
 
 /*
  * Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.19 2011/01/06 07:43:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.20 2011/01/22 15:14:28 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,7 @@
 #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/pci/wsdisplay_pci.h>
 
 #include <dev/i2c/i2cvar.h>
 
@@ -349,8 +350,11 @@
        /* 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:
+               return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc, sc->sc_pcitag, data);
 
        case WSDISPLAYIO_GINFO:
                if (ms == NULL)
diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/radeonfb.c
--- a/sys/dev/pci/radeonfb.c    Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/radeonfb.c    Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeonfb.c,v 1.40 2010/12/16 06:45:50 cegger Exp $ */
+/*     $NetBSD: radeonfb.c,v 1.41 2011/01/22 15:14:28 cegger Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.40 2010/12/16 06:45:50 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.41 2011/01/22 15:14:28 cegger Exp $");
 
 #define RADEONFB_DEFAULT_DEPTH 8
 
@@ -90,6 +90,7 @@
 #include <dev/videomode/videomode.h>
 #include <dev/videomode/edidvar.h>
 #include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/pci/wsdisplay_pci.h>
 
 #include <dev/pci/pcidevs.h>
 #include <dev/pci/pcireg.h>
@@ -1096,6 +1097,10 @@
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(sc->sc_pc, sc->sc_pt, cmd, d, flag, l);
 
+       case WSDISPLAYIO_GET_BUSID:
+               return wsdisplayio_busid_pci(&sc->sc_dev, sc->sc_pc,
+                   sc->sc_pt, d);
+
        default:
                return EPASSTHROUGH;
        }
diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/tga.c
--- a/sys/dev/pci/tga.c Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/tga.c Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tga.c,v 1.80 2010/11/13 13:52:08 uebayasi Exp $ */
+/* $NetBSD: tga.c,v 1.81 2011/01/22 15:14:28 cegger Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.80 2010/11/13 13:52:08 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.81 2011/01/22 15:14:28 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -58,6 +58,8 @@
 #include <dev/wscons/wscons_raster.h>
 #include <dev/rasops/rasops.h>
 #include <dev/wsfont/wsfont.h>
+#include <dev/pci/wsdisplay_pci.h>
+
 int    tgamatch(device_t, cfdata_t, void *);
 void   tgaattach(device_t, device_t, void *);
 int    tgaprint(void *, const char *);
@@ -594,6 +596,10 @@
        case PCI_IOC_CFGWRITE:
                return pci_devioctl(dc->dc_pc, dc->dc_pcitag,
                    cmd, data, flag, l);
+
+       case WSDISPLAYIO_GET_BUSID:
+               return wsdisplayio_busid_pci(vc->softc->sc_dev, dc->dc_pc,
+                   dc->dc_pcitag, data);
        }
        return EPASSTHROUGH;
 }
diff -r 889683e7a700 -r 22740e3066d8 sys/dev/pci/unichromefb.c
--- a/sys/dev/pci/unichromefb.c Sat Jan 22 14:51:43 2011 +0000
+++ b/sys/dev/pci/unichromefb.c Sat Jan 22 15:14:27 2011 +0000
@@ -1,4 +1,4 @@



Home | Main Index | Thread Index | Old Index