Module Name: src Committed By: rkujawa Date: Tue Jan 24 00:20:45 UTC 2012
Modified Files: src/sys/arch/amiga/amiga: autoconf.c src/sys/arch/amiga/pci: p5pb.c Log Message: Add voodoofb support. Allows using 3Dfx Voodoo 3 in G-REX as a console. To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/arch/amiga/amiga/autoconf.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amiga/pci/p5pb.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/amiga/amiga/autoconf.c diff -u src/sys/arch/amiga/amiga/autoconf.c:1.108 src/sys/arch/amiga/amiga/autoconf.c:1.109 --- src/sys/arch/amiga/amiga/autoconf.c:1.108 Thu Aug 4 17:48:50 2011 +++ src/sys/arch/amiga/amiga/autoconf.c Tue Jan 24 00:20:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.108 2011/08/04 17:48:50 rkujawa Exp $ */ +/* $NetBSD: autoconf.c,v 1.109 2012/01/24 00:20:45 rkujawa Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.108 2011/08/04 17:48:50 rkujawa Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.109 2012/01/24 00:20:45 rkujawa Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -590,16 +590,22 @@ 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 CVPPC/BVPPC card. */ - if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_TI) + /* Handle the CVPPC/BVPPC card... */ + if ( ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_TI) && (PCI_PRODUCT(pa->pa_id) == - PCI_PRODUCT_TI_TVP4020) ) { + 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, @@ -618,18 +624,20 @@ device_register(device_t dev, void *aux) 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")); -#if (NGENFB > 0) 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")); } } } Index: src/sys/arch/amiga/pci/p5pb.c diff -u src/sys/arch/amiga/pci/p5pb.c:1.6 src/sys/arch/amiga/pci/p5pb.c:1.7 --- src/sys/arch/amiga/pci/p5pb.c:1.6 Thu Jan 19 00:14:08 2012 +++ src/sys/arch/amiga/pci/p5pb.c Tue Jan 24 00:20:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: p5pb.c,v 1.6 2012/01/19 00:14:08 rkujawa Exp $ */ +/* $NetBSD: p5pb.c,v 1.7 2012/01/24 00:20:45 rkujawa Exp $ */ /*- * Copyright (c) 2011, 2012 The NetBSD Foundation, Inc. @@ -117,7 +117,6 @@ p5pb_match(device_t parent, cfdata_t cf, return 0; } - static void p5pb_attach(device_t parent, device_t self, void *aux) { @@ -184,7 +183,10 @@ p5pb_attach(device_t parent, device_t se sc->apc.pc_intr_disestablish = amiga_pci_intr_disestablish; #ifdef PCI_NETBSD_CONFIGURE - p5pb_bus_reconfigure(sc); + /* Never reconfigure the bus on CVPPC/BVPPC, avoid the fb breakage. */ + if (sc->bridge_type != P5PB_BRIDGE_CVPPC) { + p5pb_bus_reconfigure(sc); + } #endif /* PCI_NETBSD_CONFIGURE */ /* Initialize the bus attachment structure. */ @@ -198,10 +200,7 @@ p5pb_attach(device_t parent, device_t se pba.pba_bus = 0; pba.pba_bridgetag = NULL; - /* If we are a CVPPC/BVPPC, set the properties needed for genfb. */ - if (sc->bridge_type == P5PB_BRIDGE_CVPPC) { - p5pb_set_props(sc); - } + p5pb_set_props(sc); config_found_ia(self, "pcibus", &pba, pcibusprint); } @@ -300,7 +299,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. + * autoconfg in device_register(). Needed for CVPPC/BVPPC and Voodoo in G-REX. */ void p5pb_set_props(struct p5pb_softc *sc) @@ -310,18 +309,27 @@ 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); - prop_dictionary_set_uint16(dict, "linebytes", P5GFX_LINEBYTES); - prop_dictionary_set_uint64(dict, "address", - kvtop((void*) sc->pci_mem_area.base)); + + /* genfb needs additional properties, like virtual, physical address */ #if (NGENFB > 0) - /* genfb needs virtual address too */ + /* 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 @@ -369,7 +377,7 @@ p5pb_pci_bus_maxdevs_cvppc(pci_chipset_t int p5pb_pci_bus_maxdevs_grex4000(pci_chipset_tag_t pc, int busno) { - /* G-REX 4000 has 4 slots. */ + /* G-REX 4000 has 4, G-REX 4000T has 3 slots? */ return 1; /* XXX: 4 not yet! */ }