Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga Clean up p5pb console glue a bit.



details:   https://anonhg.NetBSD.org/src/rev/bf4e877876b2
branches:  trunk
changeset: 780151:bf4e877876b2
user:      rkujawa <rkujawa%NetBSD.org@localhost>
date:      Fri Jul 13 08:47:07 2012 +0000

description:
Clean up p5pb console glue a bit.

diffstat:

 sys/arch/amiga/amiga/autoconf.c |  68 ++++-----------------------------------
 sys/arch/amiga/pci/p5pb.c       |  69 ++++++++++++++++++++++++++++++++--------
 sys/arch/amiga/pci/p5pbvar.h    |   5 ++-
 3 files changed, 67 insertions(+), 75 deletions(-)

diffs (217 lines):

diff -r ea832b772b52 -r bf4e877876b2 sys/arch/amiga/amiga/autoconf.c
--- a/sys/arch/amiga/amiga/autoconf.c   Fri Jul 13 06:09:18 2012 +0000
+++ b/sys/arch/amiga/amiga/autoconf.c   Fri Jul 13 08:47:07 2012 +0000
@@ -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 @@
 #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 @@
        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 */
 }
 
diff -r ea832b772b52 -r bf4e877876b2 sys/arch/amiga/pci/p5pb.c
--- a/sys/arch/amiga/pci/p5pb.c Fri Jul 13 06:09:18 2012 +0000
+++ b/sys/arch/amiga/pci/p5pb.c Fri Jul 13 08:47:07 2012 +0000
@@ -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 @@
 
 /*
  * 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 @@
        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 @@
 
 #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 */
+
diff -r ea832b772b52 -r bf4e877876b2 sys/arch/amiga/pci/p5pbvar.h
--- a/sys/arch/amiga/pci/p5pbvar.h      Fri Jul 13 06:09:18 2012 +0000
+++ b/sys/arch/amiga/pci/p5pbvar.h      Fri Jul 13 08:47:07 2012 +0000
@@ -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 @@
        TAILQ_HEAD(, p5pb_autoconf_entry)       auto_bars;
 };
 
+void p5pb_device_register(device_t, void *);
+
 #endif /* _AMIGA_P5PBVAR_H_ */
+



Home | Main Index | Thread Index | Old Index