Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha Check and set "is_console" property to PCI di...



details:   https://anonhg.NetBSD.org/src/rev/9b83aa70de83
branches:  trunk
changeset: 326147:9b83aa70de83
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Jan 20 15:05:13 2014 +0000

description:
Check and set "is_console" property to PCI displays for framebuffer drivers.

Tested on DS15 with radeonfb(4) and XP1000 with vga(4)
by Naruaki Etomi in PR/48431.

diffstat:

 sys/arch/alpha/alpha/autoconf.c      |  15 +++++++++++++--
 sys/arch/alpha/include/pci_machdep.h |   3 ++-
 sys/arch/alpha/pci/pci_machdep.c     |  23 +++++++++++++++++++++--
 3 files changed, 36 insertions(+), 5 deletions(-)

diffs (105 lines):

diff -r 9310063674d8 -r 9b83aa70de83 sys/arch/alpha/alpha/autoconf.c
--- a/sys/arch/alpha/alpha/autoconf.c   Mon Jan 20 14:14:56 2014 +0000
+++ b/sys/arch/alpha/alpha/autoconf.c   Mon Jan 20 15:05:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.52 2012/07/29 18:05:39 mlelstv Exp $ */
+/* $NetBSD: autoconf.c,v 1.53 2014/01/20 15:05:13 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,9 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.52 2012/07/29 18:05:39 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.53 2014/01/20 15:05:13 tsutsui Exp $");
+
+#include "pci.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,6 +55,8 @@
 #include <sys/conf.h>
 #include <dev/cons.h>
 
+#include <dev/pci/pcivar.h>
+
 #include <machine/autoconf.h>
 #include <machine/alpha.h>
 #include <machine/cpu.h>
@@ -172,6 +176,13 @@
 void
 device_register(device_t dev, void *aux)
 {
+#if NPCI > 0
+       device_t parent = device_parent(dev);
+
+       if (parent != NULL && device_is_a(parent, "pci"))
+               device_pci_register(dev, aux);
+#endif
+
        if (bootdev_data == NULL) {
                /*
                 * There is no hope.
diff -r 9310063674d8 -r 9b83aa70de83 sys/arch/alpha/include/pci_machdep.h
--- a/sys/arch/alpha/include/pci_machdep.h      Mon Jan 20 14:14:56 2014 +0000
+++ b/sys/arch/alpha/include/pci_machdep.h      Mon Jan 20 15:05:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.15 2012/02/06 02:14:13 matt Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.16 2014/01/20 15:05:13 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -109,3 +109,4 @@
     ((c)->pc_pciide_compat_intr_establish == NULL ? NULL :             \
      (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p), \
        (ch), (f), (a)))
+void   device_pci_register(device_t, void *);
diff -r 9310063674d8 -r 9b83aa70de83 sys/arch/alpha/pci/pci_machdep.c
--- a/sys/arch/alpha/pci/pci_machdep.c  Mon Jan 20 14:14:56 2014 +0000
+++ b/sys/arch/alpha/pci/pci_machdep.c  Mon Jan 20 15:05:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.19 2012/02/06 02:14:15 matt Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.20 2014/01/20 15:05:14 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.19 2012/02/06 02:14:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.20 2014/01/20 15:05:14 tsutsui Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -59,6 +59,8 @@
 #include <dev/pci/tgavar.h>
 #endif
 
+#include <machine/rpb.h>
+
 void
 pci_display_console(bus_space_tag_t iot, bus_space_tag_t memt, pci_chipset_tag_t pc, int bus, int device, int function)
 {
@@ -101,3 +103,20 @@
                panic("pci_display_console: unconfigured device at %d/%d/%d",
                    bus, device, function);
 }
+
+void
+device_pci_register(device_t dev, void *aux)
+{
+       struct pci_attach_args *pa = aux;
+       struct ctb *ctb;
+       prop_dictionary_t dict;
+
+       /* set properties for PCI framebuffers */
+       ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
+       if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY &&
+           ctb->ctb_term_type == CTB_GRAPHICS) {
+               /* XXX should consider multiple displays? */
+               dict = device_properties(dev);
+               prop_dictionary_set_bool(dict, "is_console", true);
+       }
+}



Home | Main Index | Thread Index | Old Index