Sat Jan 22 15:14:28 2011 UTC ()
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@


(cegger)
diff -r1.24 -r1.25 src/sys/dev/pci/chipsfb.c
diff -r1.335 -r1.336 src/sys/dev/pci/files.pci
diff -r1.26 -r1.27 src/sys/dev/pci/genfb_pci.c
diff -r1.26 -r1.27 src/sys/dev/pci/voodoofb.c
diff -r1.62 -r1.63 src/sys/dev/pci/machfb.c
diff -r1.6 -r1.7 src/sys/dev/pci/pm2fb.c
diff -r1.6 -r1.7 src/sys/dev/pci/voyagerfb.c
diff -r1.19 -r1.20 src/sys/dev/pci/r128fb.c
diff -r1.40 -r1.41 src/sys/dev/pci/radeonfb.c
diff -r1.80 -r1.81 src/sys/dev/pci/tga.c
diff -r1.17 -r1.18 src/sys/dev/pci/unichromefb.c
diff -r1.52 -r1.53 src/sys/dev/pci/vga_pci.c
diff -r1.7 -r1.8 src/sys/dev/pci/wcfb.c
diff -r0 -r1.1 src/sys/dev/pci/wsdisplay_pci.c
diff -r0 -r1.1 src/sys/dev/pci/wsdisplay_pci.h
diff -r1.93 -r1.94 src/sys/dev/wscons/wsconsio.h

cvs diff -r1.24 -r1.25 src/sys/dev/pci/chipsfb.c (expand / switch to unified diff)

--- src/sys/dev/pci/chipsfb.c 2010/12/23 21:11:37 1.24
+++ src/sys/dev/pci/chipsfb.c 2011/01/22 15:14:27 1.25
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: chipsfb.c,v 1.24 2010/12/23 21:11:37 cegger Exp $ */ 1/* $NetBSD: chipsfb.c,v 1.25 2011/01/22 15:14:27 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Michael Lorenz 4 * Copyright (c) 2006 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -21,50 +21,51 @@ @@ -21,50 +21,51 @@
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* 28/*
29 * A console driver for Chips & Technologies 65550 graphics controllers 29 * A console driver for Chips & Technologies 65550 graphics controllers
30 * tested on macppc only so far 30 * tested on macppc only so far
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.24 2010/12/23 21:11:37 cegger Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.25 2011/01/22 15:14:27 cegger Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/malloc.h> 40#include <sys/malloc.h>
41#include <sys/callout.h> 41#include <sys/callout.h>
42#include <sys/lwp.h> 42#include <sys/lwp.h>
43#include <sys/kauth.h> 43#include <sys/kauth.h>
44 44
45#include <dev/videomode/videomode.h> 45#include <dev/videomode/videomode.h>
46 46
47#include <dev/pci/pcivar.h> 47#include <dev/pci/pcivar.h>
48#include <dev/pci/pcireg.h> 48#include <dev/pci/pcireg.h>
49#include <dev/pci/pcidevs.h> 49#include <dev/pci/pcidevs.h>
50#include <dev/pci/pciio.h> 50#include <dev/pci/pciio.h>
51#include <dev/pci/chipsfbreg.h> 51#include <dev/pci/chipsfbreg.h>
52 52
53#include <dev/wscons/wsdisplayvar.h> 53#include <dev/wscons/wsdisplayvar.h>
54#include <dev/wscons/wsconsio.h> 54#include <dev/wscons/wsconsio.h>
55#include <dev/wsfont/wsfont.h> 55#include <dev/wsfont/wsfont.h>
56#include <dev/rasops/rasops.h> 56#include <dev/rasops/rasops.h>
57#include <dev/wscons/wsdisplay_vconsvar.h> 57#include <dev/wscons/wsdisplay_vconsvar.h>
 58#include <dev/pci/wsdisplay_pci.h>
58 59
59#include <dev/i2c/i2cvar.h> 60#include <dev/i2c/i2cvar.h>
60 61
61#include "opt_wsemul.h" 62#include "opt_wsemul.h"
62#include "opt_chipsfb.h" 63#include "opt_chipsfb.h"
63 64
64struct chipsfb_softc { 65struct chipsfb_softc {
65 struct device sc_dev; 66 struct device sc_dev;
66 pci_chipset_tag_t sc_pc; 67 pci_chipset_tag_t sc_pc;
67 pcitag_t sc_pcitag; 68 pcitag_t sc_pcitag;
68 69
69 bus_space_tag_t sc_memt; 70 bus_space_tag_t sc_memt;
70 bus_space_tag_t sc_iot; 71 bus_space_tag_t sc_iot;
@@ -840,26 +841,30 @@ chipsfb_ioctl(void *v, void *vs, u_long  @@ -840,26 +841,30 @@ chipsfb_ioctl(void *v, void *vs, u_long
840 return chipsfb_getcmap(sc, 841 return chipsfb_getcmap(sc,
841 (struct wsdisplay_cmap *)data); 842 (struct wsdisplay_cmap *)data);
842 843
843 case WSDISPLAYIO_PUTCMAP: 844 case WSDISPLAYIO_PUTCMAP:
844 return chipsfb_putcmap(sc, 845 return chipsfb_putcmap(sc,
845 (struct wsdisplay_cmap *)data); 846 (struct wsdisplay_cmap *)data);
846 847
847 /* PCI config read/write passthrough. */ 848 /* PCI config read/write passthrough. */
848 case PCI_IOC_CFGREAD: 849 case PCI_IOC_CFGREAD:
849 case PCI_IOC_CFGWRITE: 850 case PCI_IOC_CFGWRITE:
850 return pci_devioctl(sc->sc_pc, sc->sc_pcitag, 851 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
851 cmd, data, flag, l); 852 cmd, data, flag, l);
852 853
 854 case WSDISPLAYIO_GET_BUSID:
 855 return wsdisplayio_busid_pci(&sc->sc_dev, sc->sc_pc,
 856 sc->sc_pcitag, data);
 857
853 case WSDISPLAYIO_SMODE: { 858 case WSDISPLAYIO_SMODE: {
854 int new_mode = *(int*)data; 859 int new_mode = *(int*)data;
855 if (new_mode != sc->sc_mode) { 860 if (new_mode != sc->sc_mode) {
856 sc->sc_mode = new_mode; 861 sc->sc_mode = new_mode;
857 if(new_mode == WSDISPLAYIO_MODE_EMUL) { 862 if(new_mode == WSDISPLAYIO_MODE_EMUL) {
858 chipsfb_restore_palette(sc); 863 chipsfb_restore_palette(sc);
859 vcons_redraw_screen(ms); 864 vcons_redraw_screen(ms);
860 } 865 }
861 } 866 }
862 } 867 }
863 return 0; 868 return 0;
864 } 869 }
865 return EPASSTHROUGH; 870 return EPASSTHROUGH;

cvs diff -r1.335 -r1.336 src/sys/dev/pci/files.pci (expand / switch to unified diff)

--- src/sys/dev/pci/files.pci 2010/12/11 18:18:09 1.335
+++ src/sys/dev/pci/files.pci 2011/01/22 15:14:27 1.336
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: files.pci,v 1.335 2010/12/11 18:18:09 matt Exp $ 1# $NetBSD: files.pci,v 1.336 2011/01/22 15:14:27 cegger Exp $
2# 2#
3# Config file and device description for machine-independent PCI code. 3# Config file and device description for machine-independent PCI code.
4# Included by ports that need it. Requires that the SCSI files be 4# Included by ports that need it. Requires that the SCSI files be
5# defined first. 5# defined first.
6 6
7defflag opt_pci.h PCIVERBOSE PCI_CONFIG_DUMP PCI_NETBSD_CONFIGURE 7defflag opt_pci.h PCIVERBOSE PCI_CONFIG_DUMP PCI_NETBSD_CONFIGURE
8defparam opt_pci.h PCI_NETBSD_ENABLE_IDE 8defparam opt_pci.h PCI_NETBSD_ENABLE_IDE
9 9
10defflag opt_bktr.h BKTR_430_FX_MODE BKTR_GPIO_ACCESS BKTR_NO_MSP_RESET 10defflag opt_bktr.h BKTR_430_FX_MODE BKTR_GPIO_ACCESS BKTR_NO_MSP_RESET
11 BKTR_REVERSE_MUTE BKTR_SIS_VIA_MODE BKTR_USE_PLL 11 BKTR_REVERSE_MUTE BKTR_SIS_VIA_MODE BKTR_USE_PLL
12defparam opt_bktr.h BKTR_OVERRIDE_CARD BKTR_OVERRIDE_TUNER BKTR_OVERRIDE_DBX 12defparam opt_bktr.h BKTR_OVERRIDE_CARD BKTR_OVERRIDE_TUNER BKTR_OVERRIDE_DBX
13 BKTR_OVERRIDE_MSP BKTR_SYSTEM_DEFAULT 13 BKTR_OVERRIDE_MSP BKTR_SYSTEM_DEFAULT
14 14
@@ -18,26 +18,28 @@ defflag opt_pciide.h PCIIDE_CMD064x_DISA @@ -18,26 +18,28 @@ defflag opt_pciide.h PCIIDE_CMD064x_DISA
18device pci {[dev = -1], [function = -1]} 18device pci {[dev = -1], [function = -1]}
19attach pci at pcibus 19attach pci at pcibus
20file dev/pci/pci.c pci needs-flag 20file dev/pci/pci.c pci needs-flag
21file dev/pci/pci_map.c pci 21file dev/pci/pci_map.c pci
22file dev/pci/pci_quirks.c pci 22file dev/pci/pci_quirks.c pci
23file dev/pci/pci_subr.c pci 23file dev/pci/pci_subr.c pci
24file dev/pci/pci_usrreq.c pci 24file dev/pci/pci_usrreq.c pci
25file dev/pci/pciconf.c pci & pci_netbsd_configure 25file dev/pci/pciconf.c pci & pci_netbsd_configure
26 26
27file dev/pci/pcibusprint.c pcibus 27file dev/pci/pcibusprint.c pcibus
28 28
29file dev/pci/pci_verbose.c pci & pciverbose 29file dev/pci/pci_verbose.c pci & pciverbose
30 30
 31file dev/pci/wsdisplay_pci.c wsdisplay & pci
 32
31# Cypress 82c693 hyperCache(tm) Stand-Alone PCI Peripheral Controller 33# Cypress 82c693 hyperCache(tm) Stand-Alone PCI Peripheral Controller
32# with USB. This is a combo chip: 34# with USB. This is a combo chip:
33# 35#
34# PCI-ISA bridge 36# PCI-ISA bridge
35# PCI IDE controller 37# PCI IDE controller
36# OHCI USB controller 38# OHCI USB controller
37# 39#
38# There are some common subroutines that each function needs. 40# There are some common subroutines that each function needs.
39define cy82c693 41define cy82c693
40file dev/pci/cy82c693.c cy82c693 42file dev/pci/cy82c693.c cy82c693
41 43
42# Adaptec 3940, 2940, and aic78[5678]0 SCSI controllers 44# Adaptec 3940, 2940, and aic78[5678]0 SCSI controllers
43# device declaration in sys/conf/files 45# device declaration in sys/conf/files

cvs diff -r1.26 -r1.27 src/sys/dev/pci/genfb_pci.c (expand / switch to unified diff)

--- src/sys/dev/pci/genfb_pci.c 2010/12/16 06:45:50 1.26
+++ src/sys/dev/pci/genfb_pci.c 2011/01/22 15:14:28 1.27
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: genfb_pci.c,v 1.26 2010/12/16 06:45:50 cegger Exp $ */ 1/* $NetBSD: genfb_pci.c,v 1.27 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Michael Lorenz 4 * Copyright (c) 2007 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,45 +17,46 @@ @@ -17,45 +17,46 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.26 2010/12/16 06:45:50 cegger Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.27 2011/01/22 15:14:28 cegger Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/proc.h> 36#include <sys/proc.h>
37#include <sys/mutex.h> 37#include <sys/mutex.h>
38#include <sys/ioctl.h> 38#include <sys/ioctl.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kauth.h> 41#include <sys/kauth.h>
42 42
43#include <dev/pci/pcidevs.h> 43#include <dev/pci/pcidevs.h>
44#include <dev/pci/pcireg.h> 44#include <dev/pci/pcireg.h>
45#include <dev/pci/pcivar.h> 45#include <dev/pci/pcivar.h>
46#include <dev/pci/pciio.h> 46#include <dev/pci/pciio.h>
47 47
48#include <dev/wsfb/genfbvar.h> 48#include <dev/wsfb/genfbvar.h>
 49#include <dev/pci/wsdisplay_pci.h>
49 50
50#include <dev/pci/genfb_pcivar.h> 51#include <dev/pci/genfb_pcivar.h>
51 52
52#include "opt_wsfb.h" 53#include "opt_wsfb.h"
53#include "opt_genfb.h" 54#include "opt_genfb.h"
54 55
55#ifdef GENFB_PCI_DEBUG 56#ifdef GENFB_PCI_DEBUG
56# define DPRINTF printf 57# define DPRINTF printf
57#else 58#else
58# define DPRINTF while (0) printf 59# define DPRINTF while (0) printf
59#endif 60#endif
60 61
61static int pci_genfb_match(device_t, cfdata_t, void *); 62static int pci_genfb_match(device_t, cfdata_t, void *);
@@ -187,26 +188,31 @@ pci_genfb_ioctl(void *v, void *vs, u_lon @@ -187,26 +188,31 @@ pci_genfb_ioctl(void *v, void *vs, u_lon
187{ 188{
188 struct pci_genfb_softc *sc = v; 189 struct pci_genfb_softc *sc = v;
189 190
190 switch (cmd) { 191 switch (cmd) {
191 case WSDISPLAYIO_GTYPE: 192 case WSDISPLAYIO_GTYPE:
192 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC; 193 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
193 return 0; 194 return 0;
194 195
195 /* PCI config read/write passthrough. */ 196 /* PCI config read/write passthrough. */
196 case PCI_IOC_CFGREAD: 197 case PCI_IOC_CFGREAD:
197 case PCI_IOC_CFGWRITE: 198 case PCI_IOC_CFGWRITE:
198 return pci_devioctl(sc->sc_pc, sc->sc_pcitag, 199 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
199 cmd, data, flag, l); 200 cmd, data, flag, l);
 201
 202 case WSDISPLAYIO_GET_BUSID:
 203 return wsdisplayio_busid_pci(sc->sc_gen.sc_dev, sc->sc_pc,
 204 sc->sc_pcitag, data);
 205
200 case WSDISPLAYIO_SMODE: { 206 case WSDISPLAYIO_SMODE: {
201 int new_mode = *(int*)data, i; 207 int new_mode = *(int*)data, i;
202 if (new_mode == WSDISPLAYIO_MODE_EMUL) { 208 if (new_mode == WSDISPLAYIO_MODE_EMUL) {
203 for (i = 0; i < 9; i++) 209 for (i = 0; i < 9; i++)
204 pci_conf_write(sc->sc_pc, 210 pci_conf_write(sc->sc_pc,
205 sc->sc_pcitag, 211 sc->sc_pcitag,
206 0x10 + (i << 2), 212 0x10 + (i << 2),
207 sc->sc_bars[i]); 213 sc->sc_bars[i]);
208 } 214 }
209 } 215 }
210 return 0; 216 return 0;
211 } 217 }
212 218

cvs diff -r1.26 -r1.27 src/sys/dev/pci/voodoofb.c (expand / switch to unified diff)

--- src/sys/dev/pci/voodoofb.c 2010/12/25 11:51:21 1.26
+++ src/sys/dev/pci/voodoofb.c 2011/01/22 15:14:28 1.27
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: voodoofb.c,v 1.26 2010/12/25 11:51:21 macallan Exp $ */ 1/* $NetBSD: voodoofb.c,v 1.27 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005, 2006 Michael Lorenz 4 * Copyright (c) 2005, 2006 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/*  28/*
29 * A console driver for 3Dfx Voodoo3 graphics boards  29 * A console driver for 3Dfx Voodoo3 graphics boards
30 * Thanks to Andreas Drewke (andreas_dr@gmx.de) for his Voodoo3 driver for BeOS  30 * Thanks to Andreas Drewke (andreas_dr@gmx.de) for his Voodoo3 driver for BeOS
31 * which I used as reference / documentation 31 * which I used as reference / documentation
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.26 2010/12/25 11:51:21 macallan Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.27 2011/01/22 15:14:28 cegger Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/device.h> 40#include <sys/device.h>
41#include <sys/malloc.h> 41#include <sys/malloc.h>
42#include <sys/callout.h> 42#include <sys/callout.h>
43#include <sys/kauth.h> 43#include <sys/kauth.h>
44 44
45#if defined(macppc) || defined (sparc64) || defined(ofppc) 45#if defined(macppc) || defined (sparc64) || defined(ofppc)
46#define HAVE_OPENFIRMWARE 46#define HAVE_OPENFIRMWARE
47#endif 47#endif
48 48
@@ -54,26 +54,27 @@ __KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v @@ -54,26 +54,27 @@ __KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v
54#include <dev/videomode/videomode.h> 54#include <dev/videomode/videomode.h>
55 55
56#include <dev/pci/pcivar.h> 56#include <dev/pci/pcivar.h>
57#include <dev/pci/pcireg.h> 57#include <dev/pci/pcireg.h>
58#include <dev/pci/pcidevs.h> 58#include <dev/pci/pcidevs.h>
59#include <dev/pci/pciio.h> 59#include <dev/pci/pciio.h>
60#include <dev/pci/voodoofbreg.h> 60#include <dev/pci/voodoofbreg.h>
61 61
62#include <dev/wscons/wsdisplayvar.h> 62#include <dev/wscons/wsdisplayvar.h>
63#include <dev/wscons/wsconsio.h> 63#include <dev/wscons/wsconsio.h>
64#include <dev/wsfont/wsfont.h> 64#include <dev/wsfont/wsfont.h>
65#include <dev/rasops/rasops.h> 65#include <dev/rasops/rasops.h>
66#include <dev/wscons/wsdisplay_vconsvar.h> 66#include <dev/wscons/wsdisplay_vconsvar.h>
 67#include <dev/pci/wsdisplay_pci.h>
67 68
68#include "opt_wsemul.h" 69#include "opt_wsemul.h"
69 70
70struct voodoofb_softc { 71struct voodoofb_softc {
71 device_t sc_dev; 72 device_t sc_dev;
72 pci_chipset_tag_t sc_pc; 73 pci_chipset_tag_t sc_pc;
73 pcitag_t sc_pcitag; 74 pcitag_t sc_pcitag;
74 struct pci_attach_args sc_pa; 75 struct pci_attach_args sc_pa;
75 76
76 bus_space_tag_t sc_memt; 77 bus_space_tag_t sc_memt;
77 bus_space_tag_t sc_iot; 78 bus_space_tag_t sc_iot;
78 bus_space_handle_t sc_memh;  79 bus_space_handle_t sc_memh;
79 80
@@ -926,27 +927,31 @@ voodoofb_ioctl(void *v, void *vs, u_long @@ -926,27 +927,31 @@ voodoofb_ioctl(void *v, void *vs, u_long
926 case WSDISPLAYIO_GETCMAP: 927 case WSDISPLAYIO_GETCMAP:
927 return voodoofb_getcmap(sc, 928 return voodoofb_getcmap(sc,
928 (struct wsdisplay_cmap *)data); 929 (struct wsdisplay_cmap *)data);
929 930
930 case WSDISPLAYIO_PUTCMAP: 931 case WSDISPLAYIO_PUTCMAP:
931 return voodoofb_putcmap(sc, 932 return voodoofb_putcmap(sc,
932 (struct wsdisplay_cmap *)data); 933 (struct wsdisplay_cmap *)data);
933 934
934 /* PCI config read/write passthrough. */ 935 /* PCI config read/write passthrough. */
935 case PCI_IOC_CFGREAD: 936 case PCI_IOC_CFGREAD:
936 case PCI_IOC_CFGWRITE: 937 case PCI_IOC_CFGWRITE:
937 return pci_devioctl(sc->sc_pc, sc->sc_pcitag, 938 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
938 cmd, data, flag, l); 939 cmd, data, flag, l);
939  940
 941 case WSDISPLAYIO_GET_BUSID:
 942 return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
 943 sc->sc_pcitag, data);
 944
940 case WSDISPLAYIO_SMODE: { 945 case WSDISPLAYIO_SMODE: {
941 int new_mode = *(int*)data; 946 int new_mode = *(int*)data;
942 if (new_mode != sc->sc_mode) { 947 if (new_mode != sc->sc_mode) {
943 sc->sc_mode = new_mode; 948 sc->sc_mode = new_mode;
944 if (new_mode == WSDISPLAYIO_MODE_EMUL) { 949 if (new_mode == WSDISPLAYIO_MODE_EMUL) {
945 voodoofb_drm_map(sc); 950 voodoofb_drm_map(sc);
946 int i; 951 int i;
947  952
948 /* restore the palette */ 953 /* restore the palette */
949 for (i = 0; i < 256; i++) { 954 for (i = 0; i < 256; i++) {
950 voodoofb_putpalreg(sc,  955 voodoofb_putpalreg(sc,
951 i,  956 i,
952 sc->sc_cmap_red[i],  957 sc->sc_cmap_red[i],

cvs diff -r1.62 -r1.63 src/sys/dev/pci/machfb.c (expand / switch to unified diff)

--- src/sys/dev/pci/machfb.c 2010/12/16 06:45:50 1.62
+++ src/sys/dev/pci/machfb.c 2011/01/22 15:14:28 1.63
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machfb.c,v 1.62 2010/12/16 06:45:50 cegger Exp $ */ 1/* $NetBSD: machfb.c,v 1.63 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2002 Bang Jun-Young 4 * Copyright (c) 2002 Bang Jun-Young
5 * Copyright (c) 2005, 2006, 2007 Michael Lorenz 5 * Copyright (c) 2005, 2006, 2007 Michael Lorenz
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31/* 31/*
32 * Some code is derived from ATI Rage Pro and Derivatives Programmer's Guide. 32 * Some code is derived from ATI Rage Pro and Derivatives Programmer's Guide.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0,  36__KERNEL_RCSID(0,
37 "$NetBSD: machfb.c,v 1.62 2010/12/16 06:45:50 cegger Exp $"); 37 "$NetBSD: machfb.c,v 1.63 2011/01/22 15:14:28 cegger Exp $");
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kernel.h> 41#include <sys/kernel.h>
42#include <sys/device.h> 42#include <sys/device.h>
43#include <sys/malloc.h> 43#include <sys/malloc.h>
44#include <sys/callout.h> 44#include <sys/callout.h>
45#include <sys/lwp.h> 45#include <sys/lwp.h>
46#include <sys/kauth.h> 46#include <sys/kauth.h>
47 47
48#include <dev/videomode/videomode.h> 48#include <dev/videomode/videomode.h>
49#include <dev/videomode/edidvar.h> 49#include <dev/videomode/edidvar.h>
50 50
@@ -55,26 +55,27 @@ __KERNEL_RCSID(0,  @@ -55,26 +55,27 @@ __KERNEL_RCSID(0,
55#include <dev/pci/machfbreg.h> 55#include <dev/pci/machfbreg.h>
56 56
57#ifdef __sparc__ 57#ifdef __sparc__
58#include <dev/sun/fbio.h> 58#include <dev/sun/fbio.h>
59#include <dev/sun/fbvar.h> 59#include <dev/sun/fbvar.h>
60#include <sys/conf.h> 60#include <sys/conf.h>
61#else 61#else
62#include <dev/wscons/wsdisplayvar.h> 62#include <dev/wscons/wsdisplayvar.h>
63#endif 63#endif
64 64
65#include <dev/wscons/wsconsio.h> 65#include <dev/wscons/wsconsio.h>
66#include <dev/wsfont/wsfont.h> 66#include <dev/wsfont/wsfont.h>
67#include <dev/rasops/rasops.h> 67#include <dev/rasops/rasops.h>
 68#include <dev/pci/wsdisplay_pci.h>
68 69
69#include <dev/wscons/wsdisplay_vconsvar.h> 70#include <dev/wscons/wsdisplay_vconsvar.h>
70 71
71#include "opt_wsemul.h" 72#include "opt_wsemul.h"
72#include "opt_machfb.h" 73#include "opt_machfb.h"
73 74
74#define MACH64_REG_SIZE 1024 75#define MACH64_REG_SIZE 1024
75#define MACH64_REG_OFF 0x7ffc00 76#define MACH64_REG_OFF 0x7ffc00
76 77
77#define NBARS 3 /* number of Mach64 PCI BARs */ 78#define NBARS 3 /* number of Mach64 PCI BARs */
78 79
79struct vga_bar { 80struct vga_bar {
80 bus_addr_t vb_base; 81 bus_addr_t vb_base;
@@ -1699,27 +1700,31 @@ mach64_ioctl(void *v, void *vs, u_long c @@ -1699,27 +1700,31 @@ mach64_ioctl(void *v, void *vs, u_long c
1699 case WSDISPLAYIO_GETCMAP: 1700 case WSDISPLAYIO_GETCMAP:
1700 return mach64_getcmap(sc,  1701 return mach64_getcmap(sc,
1701 (struct wsdisplay_cmap *)data); 1702 (struct wsdisplay_cmap *)data);
1702 1703
1703 case WSDISPLAYIO_PUTCMAP: 1704 case WSDISPLAYIO_PUTCMAP:
1704 return mach64_putcmap(sc,  1705 return mach64_putcmap(sc,
1705 (struct wsdisplay_cmap *)data); 1706 (struct wsdisplay_cmap *)data);
1706  1707
1707 /* PCI config read/write passthrough. */ 1708 /* PCI config read/write passthrough. */
1708 case PCI_IOC_CFGREAD: 1709 case PCI_IOC_CFGREAD:
1709 case PCI_IOC_CFGWRITE: 1710 case PCI_IOC_CFGWRITE:
1710 return pci_devioctl(sc->sc_pc, sc->sc_pcitag, 1711 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
1711 cmd, data, flag, l); 1712 cmd, data, flag, l);
1712  1713
 1714 case WSDISPLAYIO_GET_BUSID:
 1715 return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
 1716 sc->sc_pcitag, data);
 1717
1713 case WSDISPLAYIO_SMODE: { 1718 case WSDISPLAYIO_SMODE: {
1714 int new_mode = *(int*)data; 1719 int new_mode = *(int*)data;
1715 if (new_mode != sc->sc_mode) { 1720 if (new_mode != sc->sc_mode) {
1716 sc->sc_mode = new_mode; 1721 sc->sc_mode = new_mode;
1717 if ((new_mode == WSDISPLAYIO_MODE_EMUL) 1722 if ((new_mode == WSDISPLAYIO_MODE_EMUL)
1718 && (ms != NULL)) 1723 && (ms != NULL))
1719 { 1724 {
1720 /* restore initial video mode */ 1725 /* restore initial video mode */
1721 mach64_init(sc); 1726 mach64_init(sc);
1722 mach64_init_engine(sc); 1727 mach64_init_engine(sc);
1723 mach64_init_lut(sc); 1728 mach64_init_lut(sc);
1724 mach64_modeswitch(sc, sc->sc_my_mode); 1729 mach64_modeswitch(sc, sc->sc_my_mode);
1725 vcons_redraw_screen(ms); 1730 vcons_redraw_screen(ms);
@@ -1997,26 +2002,31 @@ machfb_fbioctl(dev_t dev, u_long cmd, vo @@ -1997,26 +2002,31 @@ machfb_fbioctl(dev_t dev, u_long cmd, vo
1997 break; 2002 break;
1998#endif 2003#endif
1999 case PCI_IOC_CFGREAD: 2004 case PCI_IOC_CFGREAD:
2000 case PCI_IOC_CFGWRITE: { 2005 case PCI_IOC_CFGWRITE: {
2001 int ret; 2006 int ret;
2002 ret = pci_devioctl(sc->sc_pc, sc->sc_pcitag, 2007 ret = pci_devioctl(sc->sc_pc, sc->sc_pcitag,
2003 cmd, data, flags, l); 2008 cmd, data, flags, l);
2004  2009
2005#ifdef MACHFB_DEBUG 2010#ifdef MACHFB_DEBUG
2006 printf("pci_devioctl: %d\n", ret); 2011 printf("pci_devioctl: %d\n", ret);
2007#endif 2012#endif
2008 return ret; 2013 return ret;
2009 } 2014 }
 2015
 2016 case WSDISPLAYIO_GET_BUSID:
 2017 return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
 2018 sc->sc_pcitag, data);
 2019
2010 default: 2020 default:
2011#ifdef MACHFB_DEBUG 2021#ifdef MACHFB_DEBUG
2012 log(LOG_NOTICE, "machfb_fbioctl(0x%lx) (%s[%d])\n", cmd, 2022 log(LOG_NOTICE, "machfb_fbioctl(0x%lx) (%s[%d])\n", cmd,
2013 p->p_comm, p->p_pid); 2023 p->p_comm, p->p_pid);
2014#endif 2024#endif
2015 return ENOTTY; 2025 return ENOTTY;
2016 } 2026 }
2017#ifdef MACHFB_DEBUG 2027#ifdef MACHFB_DEBUG
2018 printf("machfb_fbioctl done\n"); 2028 printf("machfb_fbioctl done\n");
2019#endif 2029#endif
2020 return 0; 2030 return 0;
2021} 2031}
2022 2032

cvs diff -r1.6 -r1.7 src/sys/dev/pci/pm2fb.c (expand / switch to unified diff)

--- src/sys/dev/pci/pm2fb.c 2010/12/16 06:45:50 1.6
+++ src/sys/dev/pci/pm2fb.c 2011/01/22 15:14:28 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pm2fb.c,v 1.6 2010/12/16 06:45:50 cegger Exp $ */ 1/* $NetBSD: pm2fb.c,v 1.7 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009 Michael Lorenz 4 * Copyright (c) 2009 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -21,49 +21,50 @@ @@ -21,49 +21,50 @@
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* 28/*
29 * A console driver for Permedia 2 graphics controllers 29 * A console driver for Permedia 2 graphics controllers
30 * tested on sparc64 only so far 30 * tested on sparc64 only so far
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.6 2010/12/16 06:45:50 cegger Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.7 2011/01/22 15:14:28 cegger Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/malloc.h> 40#include <sys/malloc.h>
41#include <sys/lwp.h> 41#include <sys/lwp.h>
42#include <sys/kauth.h> 42#include <sys/kauth.h>
43 43
44#include <dev/videomode/videomode.h> 44#include <dev/videomode/videomode.h>
45 45
46#include <dev/pci/pcivar.h> 46#include <dev/pci/pcivar.h>
47#include <dev/pci/pcireg.h> 47#include <dev/pci/pcireg.h>
48#include <dev/pci/pcidevs.h> 48#include <dev/pci/pcidevs.h>
49#include <dev/pci/pciio.h> 49#include <dev/pci/pciio.h>
50#include <dev/pci/pm2reg.h> 50#include <dev/pci/pm2reg.h>
51 51
52#include <dev/wscons/wsdisplayvar.h> 52#include <dev/wscons/wsdisplayvar.h>
53#include <dev/wscons/wsconsio.h> 53#include <dev/wscons/wsconsio.h>
54#include <dev/wsfont/wsfont.h> 54#include <dev/wsfont/wsfont.h>
55#include <dev/rasops/rasops.h> 55#include <dev/rasops/rasops.h>
56#include <dev/wscons/wsdisplay_vconsvar.h> 56#include <dev/wscons/wsdisplay_vconsvar.h>
 57#include <dev/pci/wsdisplay_pci.h>
57 58
58#include <dev/i2c/i2cvar.h> 59#include <dev/i2c/i2cvar.h>
59 60
60struct pm2fb_softc { 61struct pm2fb_softc {
61 device_t sc_dev; 62 device_t sc_dev;
62 63
63 pci_chipset_tag_t sc_pc; 64 pci_chipset_tag_t sc_pc;
64 pcitag_t sc_pcitag; 65 pcitag_t sc_pcitag;
65 66
66 bus_space_tag_t sc_memt; 67 bus_space_tag_t sc_memt;
67 bus_space_tag_t sc_iot; 68 bus_space_tag_t sc_iot;
68 69
69 bus_space_handle_t sc_regh; 70 bus_space_handle_t sc_regh;
@@ -307,26 +308,30 @@ pm2fb_ioctl(void *v, void *vs, u_long cm @@ -307,26 +308,30 @@ pm2fb_ioctl(void *v, void *vs, u_long cm
307 struct vcons_screen *ms = vd->active; 308 struct vcons_screen *ms = vd->active;
308 309
309 switch (cmd) { 310 switch (cmd) {
310 case WSDISPLAYIO_GTYPE: 311 case WSDISPLAYIO_GTYPE:
311 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC; 312 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
312 return 0; 313 return 0;
313 314
314 /* PCI config read/write passthrough. */ 315 /* PCI config read/write passthrough. */
315 case PCI_IOC_CFGREAD: 316 case PCI_IOC_CFGREAD:
316 case PCI_IOC_CFGWRITE: 317 case PCI_IOC_CFGWRITE:
317 return pci_devioctl(sc->sc_pc, sc->sc_pcitag, 318 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
318 cmd, data, flag, l); 319 cmd, data, flag, l);
319 320
 321 case WSDISPLAYIO_GET_BUSID:
 322 return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
 323 sc->sc_pcitag, data);
 324
320 case WSDISPLAYIO_GINFO: 325 case WSDISPLAYIO_GINFO:
321 if (ms == NULL) 326 if (ms == NULL)
322 return ENODEV; 327 return ENODEV;
323 wdf = (void *)data; 328 wdf = (void *)data;
324 wdf->height = ms->scr_ri.ri_height; 329 wdf->height = ms->scr_ri.ri_height;
325 wdf->width = ms->scr_ri.ri_width; 330 wdf->width = ms->scr_ri.ri_width;
326 wdf->depth = ms->scr_ri.ri_depth; 331 wdf->depth = ms->scr_ri.ri_depth;
327 wdf->cmsize = 256; 332 wdf->cmsize = 256;
328 return 0; 333 return 0;
329 334
330 case WSDISPLAYIO_GETCMAP: 335 case WSDISPLAYIO_GETCMAP:
331 return pm2fb_getcmap(sc, 336 return pm2fb_getcmap(sc,
332 (struct wsdisplay_cmap *)data); 337 (struct wsdisplay_cmap *)data);

cvs diff -r1.6 -r1.7 src/sys/dev/pci/Attic/voyagerfb.c (expand / switch to unified diff)

--- src/sys/dev/pci/Attic/voyagerfb.c 2010/12/23 21:34:02 1.6
+++ src/sys/dev/pci/Attic/voyagerfb.c 2011/01/22 15:14:28 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: voyagerfb.c,v 1.6 2010/12/23 21:34:02 cegger Exp $ */ 1/* $NetBSD: voyagerfb.c,v 1.7 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009 Michael Lorenz 4 * Copyright (c) 2009 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -21,49 +21,50 @@ @@ -21,49 +21,50 @@
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* 28/*
29 * A console driver for Silicon Motion SM502 / Voyager GX graphics controllers 29 * A console driver for Silicon Motion SM502 / Voyager GX graphics controllers
30 * tested on GDIUM only so far 30 * tested on GDIUM only so far
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.6 2010/12/23 21:34:02 cegger Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.7 2011/01/22 15:14:28 cegger Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/malloc.h> 40#include <sys/malloc.h>
41#include <sys/lwp.h> 41#include <sys/lwp.h>
42#include <sys/kauth.h> 42#include <sys/kauth.h>
43 43
44#include <dev/videomode/videomode.h> 44#include <dev/videomode/videomode.h>
45 45
46#include <dev/pci/pcivar.h> 46#include <dev/pci/pcivar.h>
47#include <dev/pci/pcireg.h> 47#include <dev/pci/pcireg.h>
48#include <dev/pci/pcidevs.h> 48#include <dev/pci/pcidevs.h>
49#include <dev/pci/pciio.h> 49#include <dev/pci/pciio.h>
50#include <dev/ic/sm502reg.h> 50#include <dev/ic/sm502reg.h>
51 51
52#include <dev/wscons/wsdisplayvar.h> 52#include <dev/wscons/wsdisplayvar.h>
53#include <dev/wscons/wsconsio.h> 53#include <dev/wscons/wsconsio.h>
54#include <dev/wsfont/wsfont.h> 54#include <dev/wsfont/wsfont.h>
55#include <dev/rasops/rasops.h> 55#include <dev/rasops/rasops.h>
56#include <dev/wscons/wsdisplay_vconsvar.h> 56#include <dev/wscons/wsdisplay_vconsvar.h>
 57#include <dev/pci/wsdisplay_pci.h>
57 58
58#include <dev/i2c/i2cvar.h> 59#include <dev/i2c/i2cvar.h>
59 60
60struct voyagerfb_softc { 61struct voyagerfb_softc {
61 device_t sc_dev; 62 device_t sc_dev;
62 63
63 pci_chipset_tag_t sc_pc; 64 pci_chipset_tag_t sc_pc;
64 pcitag_t sc_pcitag; 65 pcitag_t sc_pcitag;
65 66
66 bus_space_tag_t sc_memt; 67 bus_space_tag_t sc_memt;
67 bus_space_tag_t sc_iot; 68 bus_space_tag_t sc_iot;
68 69
69 bus_space_handle_t sc_fbh; 70 bus_space_handle_t sc_fbh;
@@ -315,26 +316,30 @@ voyagerfb_ioctl(void *v, void *vs, u_lon @@ -315,26 +316,30 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
315 struct vcons_screen *ms = vd->active; 316 struct vcons_screen *ms = vd->active;
316 317
317 switch (cmd) { 318 switch (cmd) {
318 case WSDISPLAYIO_GTYPE: 319 case WSDISPLAYIO_GTYPE:
319 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC; 320 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
320 return 0; 321 return 0;
321 322
322 /* PCI config read/write passthrough. */ 323 /* PCI config read/write passthrough. */
323 case PCI_IOC_CFGREAD: 324 case PCI_IOC_CFGREAD:
324 case PCI_IOC_CFGWRITE: 325 case PCI_IOC_CFGWRITE:
325 return pci_devioctl(sc->sc_pc, sc->sc_pcitag, 326 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
326 cmd, data, flag, l); 327 cmd, data, flag, l);
327 328
 329 case WSDISPLAYIO_GET_BUSID:
 330 return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
 331 sc->sc_pcitag, data);
 332
328 case WSDISPLAYIO_GINFO: 333 case WSDISPLAYIO_GINFO:
329 if (ms == NULL) 334 if (ms == NULL)
330 return ENODEV; 335 return ENODEV;
331 wdf = (void *)data; 336 wdf = (void *)data;
332 wdf->height = ms->scr_ri.ri_height; 337 wdf->height = ms->scr_ri.ri_height;
333 wdf->width = ms->scr_ri.ri_width; 338 wdf->width = ms->scr_ri.ri_width;
334 wdf->depth = ms->scr_ri.ri_depth; 339 wdf->depth = ms->scr_ri.ri_depth;
335 wdf->cmsize = 256; 340 wdf->cmsize = 256;
336 return 0; 341 return 0;
337 342
338 case WSDISPLAYIO_GETCMAP: 343 case WSDISPLAYIO_GETCMAP:
339 return voyagerfb_getcmap(sc, 344 return voyagerfb_getcmap(sc,
340 (struct wsdisplay_cmap *)data); 345 (struct wsdisplay_cmap *)data);

cvs diff -r1.19 -r1.20 src/sys/dev/pci/r128fb.c (expand / switch to unified diff)

--- src/sys/dev/pci/r128fb.c 2011/01/06 07:43:05 1.19
+++ src/sys/dev/pci/r128fb.c 2011/01/22 15:14:28 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: r128fb.c,v 1.19 2011/01/06 07:43:05 macallan Exp $ */ 1/* $NetBSD: r128fb.c,v 1.20 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Michael Lorenz 4 * Copyright (c) 2007 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -21,49 +21,50 @@ @@ -21,49 +21,50 @@
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* 28/*
29 * A console driver for ATI Rage 128 graphics controllers 29 * A console driver for ATI Rage 128 graphics controllers
30 * tested on macppc only so far 30 * tested on macppc only so far
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.19 2011/01/06 07:43:05 macallan Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.20 2011/01/22 15:14:28 cegger Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/malloc.h> 40#include <sys/malloc.h>
41#include <sys/lwp.h> 41#include <sys/lwp.h>
42#include <sys/kauth.h> 42#include <sys/kauth.h>
43 43
44#include <dev/videomode/videomode.h> 44#include <dev/videomode/videomode.h>
45 45
46#include <dev/pci/pcivar.h> 46#include <dev/pci/pcivar.h>
47#include <dev/pci/pcireg.h> 47#include <dev/pci/pcireg.h>
48#include <dev/pci/pcidevs.h> 48#include <dev/pci/pcidevs.h>
49#include <dev/pci/pciio.h> 49#include <dev/pci/pciio.h>
50#include <dev/pci/r128fbreg.h> 50#include <dev/pci/r128fbreg.h>
51 51
52#include <dev/wscons/wsdisplayvar.h> 52#include <dev/wscons/wsdisplayvar.h>
53#include <dev/wscons/wsconsio.h> 53#include <dev/wscons/wsconsio.h>
54#include <dev/wsfont/wsfont.h> 54#include <dev/wsfont/wsfont.h>
55#include <dev/rasops/rasops.h> 55#include <dev/rasops/rasops.h>
56#include <dev/wscons/wsdisplay_vconsvar.h> 56#include <dev/wscons/wsdisplay_vconsvar.h>
 57#include <dev/pci/wsdisplay_pci.h>
57 58
58#include <dev/i2c/i2cvar.h> 59#include <dev/i2c/i2cvar.h>
59 60
60#include "opt_r128fb.h" 61#include "opt_r128fb.h"
61 62
62#ifdef R128FB_DEBUG 63#ifdef R128FB_DEBUG
63#define DPRINTF printf 64#define DPRINTF printf
64#else 65#else
65#define DPRINTF while(0) printf 66#define DPRINTF while(0) printf
66#endif 67#endif
67 68
68struct r128fb_softc { 69struct r128fb_softc {
69 device_t sc_dev; 70 device_t sc_dev;
@@ -339,28 +340,31 @@ r128fb_ioctl(void *v, void *vs, u_long c @@ -339,28 +340,31 @@ r128fb_ioctl(void *v, void *vs, u_long c
339 struct r128fb_softc *sc = vd->cookie; 340 struct r128fb_softc *sc = vd->cookie;
340 struct wsdisplay_fbinfo *wdf; 341 struct wsdisplay_fbinfo *wdf;
341 struct vcons_screen *ms = vd->active; 342 struct vcons_screen *ms = vd->active;
342 struct wsdisplay_param *param; 343 struct wsdisplay_param *param;
343 344
344 switch (cmd) { 345 switch (cmd) {
345 case WSDISPLAYIO_GTYPE: 346 case WSDISPLAYIO_GTYPE:
346 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC; 347 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
347 return 0; 348 return 0;
348 349
349 /* PCI config read/write passthrough. */ 350 /* PCI config read/write passthrough. */
350 case PCI_IOC_CFGREAD: 351 case PCI_IOC_CFGREAD:
351 case PCI_IOC_CFGWRITE: 352 case PCI_IOC_CFGWRITE:
352 return (pci_devioctl(sc->sc_pc, sc->sc_pcitag, 353 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
353 cmd, data, flag, l)); 354 cmd, data, flag, l);
 355
 356 case WSDISPLAYIO_GET_BUSID:
 357 return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc, sc->sc_pcitag, data);
354 358
355 case WSDISPLAYIO_GINFO: 359 case WSDISPLAYIO_GINFO:
356 if (ms == NULL) 360 if (ms == NULL)
357 return ENODEV; 361 return ENODEV;
358 wdf = (void *)data; 362 wdf = (void *)data;
359 wdf->height = ms->scr_ri.ri_height; 363 wdf->height = ms->scr_ri.ri_height;
360 wdf->width = ms->scr_ri.ri_width; 364 wdf->width = ms->scr_ri.ri_width;
361 wdf->depth = ms->scr_ri.ri_depth; 365 wdf->depth = ms->scr_ri.ri_depth;
362 wdf->cmsize = 256; 366 wdf->cmsize = 256;
363 return 0; 367 return 0;
364 368
365 case WSDISPLAYIO_GETCMAP: 369 case WSDISPLAYIO_GETCMAP:
366 return r128fb_getcmap(sc, 370 return r128fb_getcmap(sc,

cvs diff -r1.40 -r1.41 src/sys/dev/pci/radeonfb.c (expand / switch to unified diff)

--- src/sys/dev/pci/radeonfb.c 2010/12/16 06:45:50 1.40
+++ src/sys/dev/pci/radeonfb.c 2011/01/22 15:14:28 1.41
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: radeonfb.c,v 1.40 2010/12/16 06:45:50 cegger Exp $ */ 1/* $NetBSD: radeonfb.c,v 1.41 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Itronix Inc. 4 * Copyright (c) 2006 Itronix Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Garrett D'Amore for Itronix Inc. 7 * Written by Garrett D'Amore for Itronix Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -60,46 +60,47 @@ @@ -60,46 +60,47 @@
60 * portions of the Software. 60 * portions of the Software.
61 * 61 *
62 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 62 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
63 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 63 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
64 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 64 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
65 * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR 65 * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
66 * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 66 * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
67 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 67 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
69 * DEALINGS IN THE SOFTWARE. 69 * DEALINGS IN THE SOFTWARE.
70 */ 70 */
71 71
72#include <sys/cdefs.h> 72#include <sys/cdefs.h>
73__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.40 2010/12/16 06:45:50 cegger Exp $"); 73__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.41 2011/01/22 15:14:28 cegger Exp $");
74 74
75#define RADEONFB_DEFAULT_DEPTH 8 75#define RADEONFB_DEFAULT_DEPTH 8
76 76
77#include <sys/param.h> 77#include <sys/param.h>
78#include <sys/systm.h> 78#include <sys/systm.h>
79#include <sys/device.h> 79#include <sys/device.h>
80#include <sys/malloc.h> 80#include <sys/malloc.h>
81#include <sys/bus.h> 81#include <sys/bus.h>
82#include <sys/kernel.h> 82#include <sys/kernel.h>
83#include <sys/lwp.h> 83#include <sys/lwp.h>
84#include <sys/kauth.h> 84#include <sys/kauth.h>
85 85
86#include <dev/wscons/wsdisplayvar.h> 86#include <dev/wscons/wsdisplayvar.h>
87#include <dev/wscons/wsconsio.h> 87#include <dev/wscons/wsconsio.h>
88#include <dev/wsfont/wsfont.h> 88#include <dev/wsfont/wsfont.h>
89#include <dev/rasops/rasops.h> 89#include <dev/rasops/rasops.h>
90#include <dev/videomode/videomode.h> 90#include <dev/videomode/videomode.h>
91#include <dev/videomode/edidvar.h> 91#include <dev/videomode/edidvar.h>
92#include <dev/wscons/wsdisplay_vconsvar.h> 92#include <dev/wscons/wsdisplay_vconsvar.h>
 93#include <dev/pci/wsdisplay_pci.h>
93 94
94#include <dev/pci/pcidevs.h> 95#include <dev/pci/pcidevs.h>
95#include <dev/pci/pcireg.h> 96#include <dev/pci/pcireg.h>
96#include <dev/pci/pcivar.h> 97#include <dev/pci/pcivar.h>
97#include <dev/pci/pciio.h> 98#include <dev/pci/pciio.h>
98#include <dev/pci/radeonfbreg.h> 99#include <dev/pci/radeonfbreg.h>
99#include <dev/pci/radeonfbvar.h> 100#include <dev/pci/radeonfbvar.h>
100#include "opt_radeonfb.h" 101#include "opt_radeonfb.h"
101 102
102static int radeonfb_match(device_t, cfdata_t, void *); 103static int radeonfb_match(device_t, cfdata_t, void *);
103static void radeonfb_attach(device_t, device_t, void *); 104static void radeonfb_attach(device_t, device_t, void *);
104static int radeonfb_ioctl(void *, void *, unsigned long, void *, int, 105static int radeonfb_ioctl(void *, void *, unsigned long, void *, int,
105 struct lwp *); 106 struct lwp *);
@@ -1086,26 +1087,30 @@ radeonfb_ioctl(void *v, void *vs, @@ -1086,26 +1087,30 @@ radeonfb_ioctl(void *v, void *vs,
1086 1087
1087 case WSDISPLAYIO_SETPARAM: 1088 case WSDISPLAYIO_SETPARAM:
1088 param = (struct wsdisplay_param *)d; 1089 param = (struct wsdisplay_param *)d;
1089 if (param->param == WSDISPLAYIO_PARAM_BACKLIGHT) { 1090 if (param->param == WSDISPLAYIO_PARAM_BACKLIGHT) {
1090 return radeonfb_set_backlight(dp, param->curval); 1091 return radeonfb_set_backlight(dp, param->curval);
1091 } 1092 }
1092 return EPASSTHROUGH; 1093 return EPASSTHROUGH;
1093 1094
1094 /* PCI config read/write passthrough. */ 1095 /* PCI config read/write passthrough. */
1095 case PCI_IOC_CFGREAD: 1096 case PCI_IOC_CFGREAD:
1096 case PCI_IOC_CFGWRITE: 1097 case PCI_IOC_CFGWRITE:
1097 return pci_devioctl(sc->sc_pc, sc->sc_pt, cmd, d, flag, l); 1098 return pci_devioctl(sc->sc_pc, sc->sc_pt, cmd, d, flag, l);
1098 1099
 1100 case WSDISPLAYIO_GET_BUSID:
 1101 return wsdisplayio_busid_pci(&sc->sc_dev, sc->sc_pc,
 1102 sc->sc_pt, d);
 1103
1099 default: 1104 default:
1100 return EPASSTHROUGH; 1105 return EPASSTHROUGH;
1101 } 1106 }
1102} 1107}
1103 1108
1104paddr_t 1109paddr_t
1105radeonfb_mmap(void *v, void *vs, off_t offset, int prot) 1110radeonfb_mmap(void *v, void *vs, off_t offset, int prot)
1106{ 1111{
1107 struct vcons_data *vd; 1112 struct vcons_data *vd;
1108 struct radeonfb_display *dp; 1113 struct radeonfb_display *dp;
1109 struct radeonfb_softc *sc; 1114 struct radeonfb_softc *sc;
1110 paddr_t pa; 1115 paddr_t pa;
1111 1116

cvs diff -r1.80 -r1.81 src/sys/dev/pci/tga.c (expand / switch to unified diff)

--- src/sys/dev/pci/tga.c 2010/11/13 13:52:08 1.80
+++ src/sys/dev/pci/tga.c 2011/01/22 15:14:28 1.81
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tga.c,v 1.80 2010/11/13 13:52:08 uebayasi Exp $ */ 1/* $NetBSD: tga.c,v 1.81 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995, 1996 Carnegie-Mellon University. 4 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Author: Chris G. Demetriou 7 * Author: Chris G. Demetriou
8 * 8 *
9 * Permission to use, copy, modify and distribute this software and 9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright 10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the 11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions 12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation. 13 * thereof, and that both notices appear in supporting documentation.
14 * 14 *
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * 18 *
19 * Carnegie Mellon requests users of this software to return to 19 * Carnegie Mellon requests users of this software to return to
20 * 20 *
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science 22 * School of Computer Science
23 * Carnegie Mellon University 23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890 24 * Pittsburgh PA 15213-3890
25 * 25 *
26 * any improvements or extensions that they make and grant Carnegie the 26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes. 27 * rights to redistribute these changes.
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.80 2010/11/13 13:52:08 uebayasi Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.81 2011/01/22 15:14:28 cegger Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/systm.h> 34#include <sys/systm.h>
35#include <sys/kernel.h> 35#include <sys/kernel.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/conf.h> 37#include <sys/conf.h>
38#include <sys/malloc.h> 38#include <sys/malloc.h>
39#include <sys/buf.h> 39#include <sys/buf.h>
40#include <sys/ioctl.h> 40#include <sys/ioctl.h>
41 41
42#include <sys/bus.h> 42#include <sys/bus.h>
43#include <sys/intr.h> 43#include <sys/intr.h>
44 44
@@ -48,26 +48,28 @@ __KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.80 @@ -48,26 +48,28 @@ __KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.80
48#include <dev/pci/pciio.h> 48#include <dev/pci/pciio.h>
49#include <dev/pci/tgareg.h> 49#include <dev/pci/tgareg.h>
50#include <dev/pci/tgavar.h> 50#include <dev/pci/tgavar.h>
51#include <dev/ic/bt485reg.h> 51#include <dev/ic/bt485reg.h>
52#include <dev/ic/bt485var.h> 52#include <dev/ic/bt485var.h>
53#include <dev/ic/bt463reg.h> 53#include <dev/ic/bt463reg.h>
54#include <dev/ic/bt463var.h> 54#include <dev/ic/bt463var.h>
55#include <dev/ic/ibm561var.h> 55#include <dev/ic/ibm561var.h>
56 56
57#include <dev/wscons/wsconsio.h> 57#include <dev/wscons/wsconsio.h>
58#include <dev/wscons/wscons_raster.h> 58#include <dev/wscons/wscons_raster.h>
59#include <dev/rasops/rasops.h> 59#include <dev/rasops/rasops.h>
60#include <dev/wsfont/wsfont.h> 60#include <dev/wsfont/wsfont.h>
 61#include <dev/pci/wsdisplay_pci.h>
 62
61int tgamatch(device_t, cfdata_t, void *); 63int tgamatch(device_t, cfdata_t, void *);
62void tgaattach(device_t, device_t, void *); 64void tgaattach(device_t, device_t, void *);
63int tgaprint(void *, const char *); 65int tgaprint(void *, const char *);
64 66
65CFATTACH_DECL_NEW(tga, sizeof(struct tga_softc), 67CFATTACH_DECL_NEW(tga, sizeof(struct tga_softc),
66 tgamatch, tgaattach, NULL, NULL); 68 tgamatch, tgaattach, NULL, NULL);
67 69
68static void tga_init(bus_space_tag_t memt, pci_chipset_tag_t pc, 70static void tga_init(bus_space_tag_t memt, pci_chipset_tag_t pc,
69 pcitag_t tag, struct tga_devconfig *dc); 71 pcitag_t tag, struct tga_devconfig *dc);
70 72
71static int tga_matchcommon(bus_space_tag_t, pci_chipset_tag_t, pcitag_t); 73static int tga_matchcommon(bus_space_tag_t, pci_chipset_tag_t, pcitag_t);
72static void tga_mapaddrs(bus_space_tag_t memt, pci_chipset_tag_t pc, 74static void tga_mapaddrs(bus_space_tag_t memt, pci_chipset_tag_t pc,
73 pcitag_t, bus_size_t *pcisize, struct tga_devconfig *dc); 75 pcitag_t, bus_size_t *pcisize, struct tga_devconfig *dc);
@@ -584,26 +586,30 @@ tga_ioctl(void *v, void *vs, u_long cmd, @@ -584,26 +586,30 @@ tga_ioctl(void *v, void *vs, u_long cmd,
584 case WSDISPLAYIO_SCURSOR: 586 case WSDISPLAYIO_SCURSOR:
585 return (*dcrf->ramdac_set_cursor)(dcrc, 587 return (*dcrf->ramdac_set_cursor)(dcrc,
586 (struct wsdisplay_cursor *)data); 588 (struct wsdisplay_cursor *)data);
587 589
588 case WSDISPLAYIO_LINEBYTES: 590 case WSDISPLAYIO_LINEBYTES:
589 *(u_int *)data = dc->dc_rowbytes; 591 *(u_int *)data = dc->dc_rowbytes;
590 return 0; 592 return 0;
591  593
592 /* PCI config read/write passthrough. */ 594 /* PCI config read/write passthrough. */
593 case PCI_IOC_CFGREAD: 595 case PCI_IOC_CFGREAD:
594 case PCI_IOC_CFGWRITE: 596 case PCI_IOC_CFGWRITE:
595 return pci_devioctl(dc->dc_pc, dc->dc_pcitag, 597 return pci_devioctl(dc->dc_pc, dc->dc_pcitag,
596 cmd, data, flag, l); 598 cmd, data, flag, l);
 599
 600 case WSDISPLAYIO_GET_BUSID:
 601 return wsdisplayio_busid_pci(vc->softc->sc_dev, dc->dc_pc,
 602 dc->dc_pcitag, data);
597 } 603 }
598 return EPASSTHROUGH; 604 return EPASSTHROUGH;
599} 605}
600 606
601static int 607static int
602tga_sched_update(void *v, void (*f)(void *)) 608tga_sched_update(void *v, void (*f)(void *))
603{ 609{
604 struct tga_devconfig *dc = v; 610 struct tga_devconfig *dc = v;
605 611
606 if (dc->dc_intrenabled) { 612 if (dc->dc_intrenabled) {
607 /* 613 /*
608 * Arrange for f to be called at the next end-of-frame 614 * Arrange for f to be called at the next end-of-frame
609 * interrupt. 615 * interrupt.

cvs diff -r1.17 -r1.18 src/sys/dev/pci/unichromefb.c (expand / switch to unified diff)

--- src/sys/dev/pci/unichromefb.c 2010/12/16 06:45:50 1.17
+++ src/sys/dev/pci/unichromefb.c 2011/01/22 15:14:28 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: unichromefb.c,v 1.17 2010/12/16 06:45:50 cegger Exp $ */ 1/* $NetBSD: unichromefb.c,v 1.18 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006, 2008 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2006, 2008 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -41,45 +41,46 @@ @@ -41,45 +41,46 @@
41 * next paragraph) shall be included in all copies or substantial portions 41 * next paragraph) shall be included in all copies or substantial portions
42 * of the Software. 42 * of the Software.
43 * 43 *
44 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 44 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 45 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 46 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
47 * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 47 * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
48 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 48 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
49 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 49 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
50 * DEALINGS IN THE SOFTWARE. 50 * DEALINGS IN THE SOFTWARE.
51 */ 51 */
52 52
53#include <sys/cdefs.h> 53#include <sys/cdefs.h>
54__KERNEL_RCSID(0, "$NetBSD: unichromefb.c,v 1.17 2010/12/16 06:45:50 cegger Exp $"); 54__KERNEL_RCSID(0, "$NetBSD: unichromefb.c,v 1.18 2011/01/22 15:14:28 cegger Exp $");
55 55
56#include <sys/param.h> 56#include <sys/param.h>
57#include <sys/systm.h> 57#include <sys/systm.h>
58#include <sys/device.h> 58#include <sys/device.h>
59#include <sys/malloc.h> 59#include <sys/malloc.h>
60 60
61#include <sys/bus.h> 61#include <sys/bus.h>
62 62
63#include <dev/pci/pcivar.h> 63#include <dev/pci/pcivar.h>
64#include <dev/pci/pcireg.h> 64#include <dev/pci/pcireg.h>
65#include <dev/pci/pcidevs.h> 65#include <dev/pci/pcidevs.h>
66#include <dev/pci/pciio.h> 66#include <dev/pci/pciio.h>
67 67
68#include <dev/wscons/wsdisplayvar.h> 68#include <dev/wscons/wsdisplayvar.h>
69#include <dev/wscons/wsconsio.h> 69#include <dev/wscons/wsconsio.h>
70#include <dev/wsfont/wsfont.h> 70#include <dev/wsfont/wsfont.h>
71#include <dev/rasops/rasops.h> 71#include <dev/rasops/rasops.h>
72#include <dev/wscons/wsdisplay_vconsvar.h> 72#include <dev/wscons/wsdisplay_vconsvar.h>
 73#include <dev/pci/wsdisplay_pci.h>
73 74
74#include <dev/pci/unichromereg.h> 75#include <dev/pci/unichromereg.h>
75#include <dev/pci/unichromemode.h> 76#include <dev/pci/unichromemode.h>
76#include <dev/pci/unichromehw.h> 77#include <dev/pci/unichromehw.h>
77#include <dev/pci/unichromeconfig.h> 78#include <dev/pci/unichromeconfig.h>
78#include <dev/pci/unichromeaccel.h> 79#include <dev/pci/unichromeaccel.h>
79 80
80#include "vga.h" 81#include "vga.h"
81 82
82#if NVGA > 0 83#if NVGA > 0
83#include <dev/ic/mc6845reg.h> 84#include <dev/ic/mc6845reg.h>
84#include <dev/ic/pcdisplayvar.h> 85#include <dev/ic/pcdisplayvar.h>
85#include <dev/ic/vgareg.h> 86#include <dev/ic/vgareg.h>
@@ -468,26 +469,31 @@ unichromefb_ioctl(void *v, void *vs, u_l @@ -468,26 +469,31 @@ unichromefb_ioctl(void *v, void *vs, u_l
468 } 469 }
469 } 470 }
470 return 0; 471 return 0;
471 case WSDISPLAYIO_SSPLASH: 472 case WSDISPLAYIO_SSPLASH:
472 return ENODEV; 473 return ENODEV;
473 case WSDISPLAYIO_SPROGRESS: 474 case WSDISPLAYIO_SPROGRESS:
474 return ENODEV; 475 return ENODEV;
475 476
476 /* PCI config read/write passthrough. */ 477 /* PCI config read/write passthrough. */
477 case PCI_IOC_CFGREAD: 478 case PCI_IOC_CFGREAD:
478 case PCI_IOC_CFGWRITE: 479 case PCI_IOC_CFGWRITE:
479 return (pci_devioctl(sc->sc_pa.pa_pc, sc->sc_pa.pa_tag, 480 return (pci_devioctl(sc->sc_pa.pa_pc, sc->sc_pa.pa_tag,
480 cmd, data, flag, l)); 481 cmd, data, flag, l));
 482
 483 case WSDISPLAYIO_GET_BUSID:
 484 return wsdisplayio_busid_pci(sc->sc_dev,
 485 sc->sc_pa.pa_pc, sc->sc_pa.pa_tag, data);
 486
481 } 487 }
482 488
483 return EPASSTHROUGH; 489 return EPASSTHROUGH;
484} 490}
485 491
486static paddr_t 492static paddr_t
487unichromefb_mmap(void *v, void *vs, off_t offset, int prot) 493unichromefb_mmap(void *v, void *vs, off_t offset, int prot)
488{ 494{
489 return -1; 495 return -1;
490} 496}
491 497
492static void 498static void
493unichromefb_init_screen(void *c, struct vcons_screen *scr, int existing, 499unichromefb_init_screen(void *c, struct vcons_screen *scr, int existing,

cvs diff -r1.52 -r1.53 src/sys/dev/pci/vga_pci.c (expand / switch to unified diff)

--- src/sys/dev/pci/vga_pci.c 2010/12/16 06:45:50 1.52
+++ src/sys/dev/pci/vga_pci.c 2011/01/22 15:14:28 1.53
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vga_pci.c,v 1.52 2010/12/16 06:45:50 cegger Exp $ */ 1/* $NetBSD: vga_pci.c,v 1.53 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995, 1996 Carnegie-Mellon University. 4 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Author: Chris G. Demetriou 7 * Author: Chris G. Demetriou
8 * 8 *
9 * Permission to use, copy, modify and distribute this software and 9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright 10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the 11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions 12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation. 13 * thereof, and that both notices appear in supporting documentation.
14 * 14 *
@@ -18,49 +18,50 @@ @@ -18,49 +18,50 @@
18 * 18 *
19 * Carnegie Mellon requests users of this software to return to 19 * Carnegie Mellon requests users of this software to return to
20 * 20 *
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science 22 * School of Computer Science
23 * Carnegie Mellon University 23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890 24 * Pittsburgh PA 15213-3890
25 * 25 *
26 * any improvements or extensions that they make and grant Carnegie the 26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes. 27 * rights to redistribute these changes.
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.52 2010/12/16 06:45:50 cegger Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.53 2011/01/22 15:14:28 cegger Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/systm.h> 34#include <sys/systm.h>
35#include <sys/kernel.h> 35#include <sys/kernel.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/malloc.h> 37#include <sys/malloc.h>
38 38
39#include <dev/pci/pcireg.h> 39#include <dev/pci/pcireg.h>
40#include <dev/pci/pcivar.h> 40#include <dev/pci/pcivar.h>
41#include <dev/pci/pcidevs.h> 41#include <dev/pci/pcidevs.h>
42#include <dev/pci/pciio.h> 42#include <dev/pci/pciio.h>
43 43
44#include <dev/ic/mc6845reg.h> 44#include <dev/ic/mc6845reg.h>
45#include <dev/ic/pcdisplayvar.h> 45#include <dev/ic/pcdisplayvar.h>
46#include <dev/ic/vgareg.h> 46#include <dev/ic/vgareg.h>
47#include <dev/ic/vgavar.h> 47#include <dev/ic/vgavar.h>
48#include <dev/pci/vga_pcivar.h> 48#include <dev/pci/vga_pcivar.h>
49 49
50#include <dev/isa/isareg.h> /* For legacy VGA address ranges */ 50#include <dev/isa/isareg.h> /* For legacy VGA address ranges */
51 51
52#include <dev/wscons/wsconsio.h> 52#include <dev/wscons/wsconsio.h>
53#include <dev/wscons/wsdisplayvar.h> 53#include <dev/wscons/wsdisplayvar.h>
 54#include <dev/pci/wsdisplay_pci.h>
54 55
55#include "opt_vga.h" 56#include "opt_vga.h"
56 57
57#ifdef VGA_POST 58#ifdef VGA_POST
58# if defined(__i386__) || defined(__amd64__) 59# if defined(__i386__) || defined(__amd64__)
59# include "acpica.h" 60# include "acpica.h"
60# endif 61# endif
61#include <x86/vga_post.h> 62#include <x86/vga_post.h>
62#endif 63#endif
63 64
64#define NBARS 6 /* number of PCI BARs */ 65#define NBARS 6 /* number of PCI BARs */
65 66
66struct vga_bar { 67struct vga_bar {
@@ -303,26 +304,30 @@ vga_drm_print(void *aux, const char *pnp @@ -303,26 +304,30 @@ vga_drm_print(void *aux, const char *pnp
303static int 304static int
304vga_pci_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l) 305vga_pci_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
305{ 306{
306 struct vga_config *vc = v; 307 struct vga_config *vc = v;
307 struct vga_pci_softc *psc = (void *) vc->softc; 308 struct vga_pci_softc *psc = (void *) vc->softc;
308 309
309 switch (cmd) { 310 switch (cmd) {
310 /* PCI config read/write passthrough. */ 311 /* PCI config read/write passthrough. */
311 case PCI_IOC_CFGREAD: 312 case PCI_IOC_CFGREAD:
312 case PCI_IOC_CFGWRITE: 313 case PCI_IOC_CFGWRITE:
313 return pci_devioctl(psc->sc_pc, psc->sc_pcitag, 314 return pci_devioctl(psc->sc_pc, psc->sc_pcitag,
314 cmd, data, flag, l); 315 cmd, data, flag, l);
315 316
 317 case WSDISPLAYIO_GET_BUSID:
 318 return wsdisplayio_busid_pci(vc->softc->sc_dev,
 319 psc->sc_pc, psc->sc_pcitag, data);
 320
316 default: 321 default:
317 return EPASSTHROUGH; 322 return EPASSTHROUGH;
318 } 323 }
319} 324}
320 325
321static paddr_t 326static paddr_t
322vga_pci_mmap(void *v, off_t offset, int prot) 327vga_pci_mmap(void *v, off_t offset, int prot)
323{ 328{
324 struct vga_config *vc = v; 329 struct vga_config *vc = v;
325 struct vga_pci_softc *psc = (void *) vc->softc; 330 struct vga_pci_softc *psc = (void *) vc->softc;
326 struct vga_bar *vb; 331 struct vga_bar *vb;
327 int bar; 332 int bar;
328 333

cvs diff -r1.7 -r1.8 src/sys/dev/pci/wcfb.c (expand / switch to unified diff)

--- src/sys/dev/pci/wcfb.c 2010/12/16 06:45:51 1.7
+++ src/sys/dev/pci/wcfb.c 2011/01/22 15:14:28 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wcfb.c,v 1.7 2010/12/16 06:45:51 cegger Exp $ */ 1/* $NetBSD: wcfb.c,v 1.8 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 Michael Lorenz 4 * Copyright (c) 2010 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,51 +17,52 @@ @@ -17,51 +17,52 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.7 2010/12/16 06:45:51 cegger Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.8 2011/01/22 15:14:28 cegger Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/proc.h> 36#include <sys/proc.h>
37#include <sys/mutex.h> 37#include <sys/mutex.h>
38#include <sys/ioctl.h> 38#include <sys/ioctl.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kauth.h> 41#include <sys/kauth.h>
42#include <sys/kmem.h> 42#include <sys/kmem.h>
43 43
44#include <dev/pci/pcidevs.h> 44#include <dev/pci/pcidevs.h>
45#include <dev/pci/pcireg.h> 45#include <dev/pci/pcireg.h>
46#include <dev/pci/pcivar.h> 46#include <dev/pci/pcivar.h>
47#include <dev/pci/pciio.h> 47#include <dev/pci/pciio.h>
48#include <dev/pci/wcfbreg.h> 48#include <dev/pci/wcfbreg.h>
49 49
50#include <dev/wscons/wsdisplayvar.h> 50#include <dev/wscons/wsdisplayvar.h>
51#include <dev/wscons/wsconsio.h> 51#include <dev/wscons/wsconsio.h>
52#include <dev/wsfont/wsfont.h> 52#include <dev/wsfont/wsfont.h>
53#include <dev/rasops/rasops.h> 53#include <dev/rasops/rasops.h>
54#include <dev/wscons/wsdisplay_vconsvar.h> 54#include <dev/wscons/wsdisplay_vconsvar.h>
 55#include <dev/pci/wsdisplay_pci.h>
55 56
56#include "opt_wsfb.h" 57#include "opt_wsfb.h"
57#include "opt_wsdisplay_compat.h" 58#include "opt_wsdisplay_compat.h"
58 59
59#ifdef WCFB_DEBUG 60#ifdef WCFB_DEBUG
60# define DPRINTF printf 61# define DPRINTF printf
61#else 62#else
62# define DPRINTF while (0) printf 63# define DPRINTF while (0) printf
63#endif 64#endif
64 65
65static int wcfb_match(device_t, cfdata_t, void *); 66static int wcfb_match(device_t, cfdata_t, void *);
66static void wcfb_attach(device_t, device_t, void *); 67static void wcfb_attach(device_t, device_t, void *);
67static int wcfb_ioctl(void *, void *, u_long, void *, int, 68static int wcfb_ioctl(void *, void *, u_long, void *, int,
@@ -308,26 +309,31 @@ wcfb_ioctl(void *v, void *vs, u_long cmd @@ -308,26 +309,31 @@ wcfb_ioctl(void *v, void *vs, u_long cmd
308{ 309{
309 struct wcfb_softc *sc = v; 310 struct wcfb_softc *sc = v;
310 311
311 switch (cmd) { 312 switch (cmd) {
312 case WSDISPLAYIO_GTYPE: 313 case WSDISPLAYIO_GTYPE:
313 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC; 314 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
314 return 0; 315 return 0;
315 316
316 /* PCI config read/write passthrough. */ 317 /* PCI config read/write passthrough. */
317 case PCI_IOC_CFGREAD: 318 case PCI_IOC_CFGREAD:
318 case PCI_IOC_CFGWRITE: 319 case PCI_IOC_CFGWRITE:
319 return pci_devioctl(sc->sc_pc, sc->sc_pcitag, 320 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
320 cmd, data, flag, l); 321 cmd, data, flag, l);
 322
 323 case WSDISPLAYIO_GET_BUSID:
 324 return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
 325 sc->sc_pcitag, data);
 326
321 case WSDISPLAYIO_SMODE: { 327 case WSDISPLAYIO_SMODE: {
322 /*int new_mode = *(int*)data, i;*/ 328 /*int new_mode = *(int*)data, i;*/
323 } 329 }
324 return 0; 330 return 0;
325 } 331 }
326 332
327 return EPASSTHROUGH; 333 return EPASSTHROUGH;
328} 334}
329 335
330static paddr_t 336static paddr_t
331wcfb_mmap(void *v, void *vs, off_t offset, int prot) 337wcfb_mmap(void *v, void *vs, off_t offset, int prot)
332{ 338{
333 struct wcfb_softc *sc = v; 339 struct wcfb_softc *sc = v;

File Added: src/sys/dev/pci/wsdisplay_pci.c
/*	$NetBSD: wsdisplay_pci.c,v 1.1 2011/01/22 15:14:28 cegger Exp $ */
/*
 * Copyright (c) 2011 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: wsdisplay_pci.c,v 1.1 2011/01/22 15:14:28 cegger Exp $");

#include <sys/param.h>
#include <sys/bus.h>
#include <dev/pci/pcivar.h>
#include <dev/wscons/wsconsio.h>
#include <dev/pci/wsdisplay_pci.h>

int
wsdisplayio_busid_pci(device_t self, pci_chipset_tag_t pc,
    pcitag_t tag, void *data)
{
	struct wsdisplayio_bus_id *busid = data;

	KASSERT(device_is_a(device_parent(self), "pci"));
	busid->bus_type = WSDISPLAYIO_BUS_PCI;
	busid->ubus.pci.domain = device_unit(device_parent(self));
	pci_decompose_tag(pc, tag,
	    &busid->ubus.pci.bus, &busid->ubus.pci.device,
	    &busid->ubus.pci.function);
	return 0;
}

File Added: src/sys/dev/pci/wsdisplay_pci.h
/*	$NetBSD: wsdisplay_pci.h,v 1.1 2011/01/22 15:14:28 cegger Exp $ */
/*
 * Copyright (c) 2011 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_PCI_WSDISPLAYPCI_H_
#define _SYS_DEV_PCI_WSDISPLAYPCI_H_

#include <dev/pci/pcivar.h>
#include <sys/device_if.h>

int
wsdisplayio_busid_pci(device_t, pci_chipset_tag_t, pcitag_t, void *);

#endif /* _SYS_DEV_PCI_WSDISPLAYPCI_H_ */

cvs diff -r1.93 -r1.94 src/sys/dev/wscons/wsconsio.h (expand / switch to unified diff)

--- src/sys/dev/wscons/wsconsio.h 2010/10/02 00:52:02 1.93
+++ src/sys/dev/wscons/wsconsio.h 2011/01/22 15:14:28 1.94
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wsconsio.h,v 1.93 2010/10/02 00:52:02 macallan Exp $ */ 1/* $NetBSD: wsconsio.h,v 1.94 2011/01/22 15:14:28 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. 4 * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -532,14 +532,36 @@ struct wsmux_device { @@ -532,14 +532,36 @@ struct wsmux_device {
532#define WSMUX_REMOVE_DEVICE WSMUXIO_REMOVE_DEVICE /* XXX compat */ 532#define WSMUX_REMOVE_DEVICE WSMUXIO_REMOVE_DEVICE /* XXX compat */
533 533
534#define WSMUX_MAXDEV 32 534#define WSMUX_MAXDEV 32
535struct wsmux_device_list { 535struct wsmux_device_list {
536 int ndevices; 536 int ndevices;
537 struct wsmux_device devices[WSMUX_MAXDEV]; 537 struct wsmux_device devices[WSMUX_MAXDEV];
538}; 538};
539#define WSMUXIO_LIST_DEVICES _IOWR('W', 99, struct wsmux_device_list) 539#define WSMUXIO_LIST_DEVICES _IOWR('W', 99, struct wsmux_device_list)
540#define WSMUX_LIST_DEVICES WSMUXIO_LIST_DEVICES /* XXX compat */ 540#define WSMUX_LIST_DEVICES WSMUXIO_LIST_DEVICES /* XXX compat */
541 541
542#define WSMUXIO_INJECTEVENT _IOW('W', 100, struct wscons_event) 542#define WSMUXIO_INJECTEVENT _IOW('W', 100, struct wscons_event)
543#define WSMUX_INJECTEVENT WSMUXIO_INJECTEVENT /* XXX compat */ 543#define WSMUX_INJECTEVENT WSMUXIO_INJECTEVENT /* XXX compat */
544 544
 545/* Mapping information retrieval. */
 546struct wsdisplayio_bus_id {
 547 u_int bus_type;
 548#define WSDISPLAYIO_BUS_PCI 0
 549#define WSDISPLAYIO_BUS_SBUS 1
 550 union bus_data {
 551 struct bus_pci {
 552 uint32_t domain;
 553 uint32_t bus;
 554 uint32_t device;
 555 uint32_t function;
 556 } pci;
 557 struct bus_sbus {
 558 uint32_t fb_instance;
 559 } sbus;
 560 /* so the size doesn't change if we add more bus types */
 561 char pad[32];
 562 } ubus;
 563};
 564
 565#define WSDISPLAYIO_GET_BUSID _IOR('W', 101, struct wsdisplayio_bus_id)
 566
545#endif /* _DEV_WSCONS_WSCONSIO_H_ */ 567#endif /* _DEV_WSCONS_WSCONSIO_H_ */