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.
This commit is contained in:
tsutsui 2014-01-20 15:05:13 +00:00
parent d1e900e606
commit c0061b6a8b
3 changed files with 36 additions and 5 deletions

View File

@ -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 1.52 2012/07/29 18:05:39 mlelstv Exp $"
#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.

View File

@ -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, 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 *);

View File

@ -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.c,v 1.19 2012/02/06 02:14:15 matt Exp $"
#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, bus_space_tag_t memt, pci_chipset_tag_t
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);
}
}