Module Name: src
Committed By: rkujawa
Date: Fri Jul 13 08:47:07 UTC 2012
Modified Files:
src/sys/arch/amiga/amiga: autoconf.c
src/sys/arch/amiga/pci: p5pb.c p5pbvar.h
Log Message:
Clean up p5pb console glue a bit.
To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/amiga/amiga/autoconf.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amiga/pci/p5pb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/pci/p5pbvar.h
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/amiga/amiga/autoconf.c
diff -u src/sys/arch/amiga/amiga/autoconf.c:1.111 src/sys/arch/amiga/amiga/autoconf.c:1.112
--- src/sys/arch/amiga/amiga/autoconf.c:1.111 Tue Apr 17 09:59:03 2012
+++ src/sys/arch/amiga/amiga/autoconf.c Fri Jul 13 08:47:07 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.111 2012/04/17 09:59:03 rkujawa Exp $ */
+/* $NetBSD: autoconf.c,v 1.112 2012/07/13 08:47:07 rkujawa Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.111 2012/04/17 09:59:03 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.112 2012/07/13 08:47:07 rkujawa Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,9 +49,9 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
#ifdef DRACO
#include <amiga/amiga/drcustom.h>
#endif
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcidevs.h>
+#ifdef P5PB_CONSOLE
+#include <amiga/pci/p5pbvar.h>
+#endif /* P5PB_CONSOLE */
static void findroot(void);
void mbattach(device_t, device_t, void *);
@@ -585,63 +585,11 @@ is_a600(void)
return (0); /* Machine type not set */
}
-
void
device_register(device_t dev, void *aux)
{
- prop_dictionary_t dict, parent_dict;
- struct pci_attach_args *pa = aux;
-
- /* TODO: move this stuff into p5pb driver and call only if present. */
- if (device_parent(dev) && device_is_a(device_parent(dev), "pci")) {
-
- dict = device_properties(dev);
-
- if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY) {
-
- /* Handle the CVPPC/BVPPC card... */
- if ( ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_TI)
- && (PCI_PRODUCT(pa->pa_id) ==
- PCI_PRODUCT_TI_TVP4020) ) ||
- /* ...and 3Dfx Voodoo 3 in G-REX. */
- ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_3DFX)
- && (PCI_PRODUCT(pa->pa_id) ==
- PCI_PRODUCT_3DFX_VOODOO3) )
- ) {
-
- /*
- * PCI bridge knows the properties,
- * PCI device doesn't - let's copy
- * them.
- */
- parent_dict = device_properties(
- device_parent(device_parent(dev)));
-
- prop_dictionary_set(dict, "width",
- prop_dictionary_get(parent_dict, "width"));
-
- prop_dictionary_set(dict, "height",
- prop_dictionary_get(parent_dict, "height"));
-
- prop_dictionary_set(dict, "depth",
- prop_dictionary_get(parent_dict, "depth"));
-
-#if (NGENFB > 0)
- prop_dictionary_set(dict, "linebytes",
- prop_dictionary_get(parent_dict,
- "linebytes"));
- prop_dictionary_set(dict, "address",
- prop_dictionary_get(parent_dict,
- "address"));
- prop_dictionary_set(dict, "virtual_address",
- prop_dictionary_get(parent_dict,
- "virtual_address"));
-#endif
- prop_dictionary_set(dict, "is_console",
- prop_dictionary_get(parent_dict,
- "is_console"));
- }
- }
- }
+#ifdef P5PB_CONSOLE
+ p5pb_device_register(dev, aux);
+#endif /* P5PB_CONSOLE */
}
Index: src/sys/arch/amiga/pci/p5pb.c
diff -u src/sys/arch/amiga/pci/p5pb.c:1.10 src/sys/arch/amiga/pci/p5pb.c:1.11
--- src/sys/arch/amiga/pci/p5pb.c:1.10 Wed Jul 11 19:14:17 2012
+++ src/sys/arch/amiga/pci/p5pb.c Fri Jul 13 08:47:07 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: p5pb.c,v 1.10 2012/07/11 19:14:17 rkujawa Exp $ */
+/* $NetBSD: p5pb.c,v 1.11 2012/07/13 08:47:07 rkujawa Exp $ */
/*-
* Copyright (c) 2011, 2012 The NetBSD Foundation, Inc.
@@ -318,7 +318,7 @@ p5pb_find_resources(struct p5pb_softc *s
/*
* Set properties needed to support fb driver. These are read later during
- * autoconfg in device_register(). Needed for CVPPC/BVPPC and Voodoo in G-REX.
+ * autoconfg in device_register(). Needed for CVPPC/BVPPC.
*/
void
p5pb_set_props(struct p5pb_softc *sc)
@@ -329,26 +329,14 @@ p5pb_set_props(struct p5pb_softc *sc)
dev = sc->sc_dev;
dict = device_properties(dev);
- prop_dictionary_set_uint32(dict, "width", P5GFX_WIDTH);
- prop_dictionary_set_uint32(dict, "height", P5GFX_HEIGHT);
- prop_dictionary_set_uint8(dict, "depth", P5GFX_DEPTH);
-
/* genfb needs additional properties, like virtual, physical address */
#if (NGENFB > 0)
/* XXX: currently genfb is supported only on CVPPC/BVPPC */
- prop_dictionary_set_uint16(dict, "linebytes", P5GFX_LINEBYTES);
prop_dictionary_set_uint64(dict, "virtual_address",
sc->pci_mem_area.base);
prop_dictionary_set_uint64(dict, "address",
kvtop((void*) sc->pci_mem_area.base));
#endif
-
-#ifdef P5PB_CONSOLE
- prop_dictionary_set_bool(dict, "is_console", true);
-#else
- prop_dictionary_set_bool(dict, "is_console", false);
-#endif
-
}
pcireg_t
@@ -666,3 +654,56 @@ p5pb_conf_search(struct p5pb_softc *sc,
#endif /* P5PB_DEBUG */
+#ifdef P5PB_CONSOLE
+void
+p5pb_device_register(device_t dev, void *aux)
+{
+ prop_dictionary_t dict, parent_dict;
+ struct pci_attach_args *pa = aux;
+
+ if (device_parent(dev) && device_is_a(device_parent(dev), "pci")) {
+
+ dict = device_properties(dev);
+
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY) {
+
+ /* Handle the CVPPC/BVPPC card... */
+ if ( ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_TI)
+ && (PCI_PRODUCT(pa->pa_id) ==
+ PCI_PRODUCT_TI_TVP4020) ) ||
+ /* ...and 3Dfx Voodoo 3 in G-REX. */
+ ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_3DFX)
+ && (PCI_PRODUCT(pa->pa_id) ==
+ PCI_PRODUCT_3DFX_VOODOO3) )) {
+
+ parent_dict = device_properties(
+ device_parent(device_parent(dev)));
+
+ prop_dictionary_set_uint32(dict, "width",
+ P5GFX_WIDTH);
+
+ prop_dictionary_set_uint32(dict, "height",
+ P5GFX_HEIGHT);
+
+ prop_dictionary_set_uint32(dict, "depth",
+ P5GFX_DEPTH);
+
+#if (NGENFB > 0)
+ prop_dictionary_set_uint32(dict, "linebytes",
+ P5GFX_LINEBYTES);
+
+ prop_dictionary_set(dict, "address",
+ prop_dictionary_get(parent_dict,
+ "address"));
+ prop_dictionary_set(dict, "virtual_address",
+ prop_dictionary_get(parent_dict,
+ "virtual_address"));
+#endif
+ prop_dictionary_set_bool(dict, "is_console",
+ true);
+ }
+ }
+ }
+}
+#endif /* P5PB_CONSOLE */
+
Index: src/sys/arch/amiga/pci/p5pbvar.h
diff -u src/sys/arch/amiga/pci/p5pbvar.h:1.3 src/sys/arch/amiga/pci/p5pbvar.h:1.4
--- src/sys/arch/amiga/pci/p5pbvar.h:1.3 Thu Jan 19 00:14:08 2012
+++ src/sys/arch/amiga/pci/p5pbvar.h Fri Jul 13 08:47:07 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: p5pbvar.h,v 1.3 2012/01/19 00:14:08 rkujawa Exp $ */
+/* $NetBSD: p5pbvar.h,v 1.4 2012/07/13 08:47:07 rkujawa Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -64,4 +64,7 @@ struct p5pb_softc {
TAILQ_HEAD(, p5pb_autoconf_entry) auto_bars;
};
+void p5pb_device_register(device_t, void *);
+
#endif /* _AMIGA_P5PBVAR_H_ */
+