Module Name: src
Committed By: tsutsui
Date: Mon Jan 20 15:05:14 UTC 2014
Modified Files:
src/sys/arch/alpha/alpha: autoconf.c
src/sys/arch/alpha/include: pci_machdep.h
src/sys/arch/alpha/pci: pci_machdep.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/alpha/alpha/autoconf.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/include/pci_machdep.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/pci_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/alpha/alpha/autoconf.c
diff -u src/sys/arch/alpha/alpha/autoconf.c:1.52 src/sys/arch/alpha/alpha/autoconf.c:1.53
--- src/sys/arch/alpha/alpha/autoconf.c:1.52 Sun Jul 29 18:05:39 2012
+++ src/sys/arch/alpha/alpha/autoconf.c Mon Jan 20 15:05:13 2014
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
#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 @@ atoi(const char *s)
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.
Index: src/sys/arch/alpha/include/pci_machdep.h
diff -u src/sys/arch/alpha/include/pci_machdep.h:1.15 src/sys/arch/alpha/include/pci_machdep.h:1.16
--- src/sys/arch/alpha/include/pci_machdep.h:1.15 Mon Feb 6 02:14:13 2012
+++ src/sys/arch/alpha/include/pci_machdep.h Mon Jan 20 15:05:13 2014
@@ -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 @@ void pci_display_console(bus_space_tag_t
((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 *);
Index: src/sys/arch/alpha/pci/pci_machdep.c
diff -u src/sys/arch/alpha/pci/pci_machdep.c:1.19 src/sys/arch/alpha/pci/pci_machdep.c:1.20
--- src/sys/arch/alpha/pci/pci_machdep.c:1.19 Mon Feb 6 02:14:15 2012
+++ src/sys/arch/alpha/pci/pci_machdep.c Mon Jan 20 15:05:14 2014
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.
#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 @@ pci_display_console(bus_space_tag_t iot,
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);
+ }
+}