CVS commit: [netbsd-9] src/sys/dev/wsfb
Module Name:src Committed By: martin Date: Sun Jul 26 10:47:25 UTC 2020 Modified Files: src/sys/dev/wsfb [netbsd-9]: genfb.c Log Message: Pull up following revision(s) (requested by jdolecek in ticket #1025): sys/dev/wsfb/genfb.c: revision 1.73 reduce stack usage in genfb_calc_hsize() To generate a diff of this commit: cvs rdiff -u -r1.67.2.2 -r1.67.2.3 src/sys/dev/wsfb/genfb.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/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.67.2.2 src/sys/dev/wsfb/genfb.c:1.67.2.3 --- src/sys/dev/wsfb/genfb.c:1.67.2.2 Wed Apr 15 14:15:17 2020 +++ src/sys/dev/wsfb/genfb.c Sun Jul 26 10:47:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.67.2.2 2020/04/15 14:15:17 martin Exp $ */ +/* $NetBSD: genfb.c,v 1.67.2.3 2020/07/26 10:47:25 martin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67.2.2 2020/04/15 14:15:17 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67.2.3 2020/07/26 10:47:25 martin Exp $"); #include #include @@ -632,18 +632,25 @@ genfb_calc_hsize(struct genfb_softc *sc) device_t dev = sc->sc_dev; prop_dictionary_t dict = device_properties(dev); prop_data_t edid_data; - struct edid_info edid; + struct edid_info *edid; const char *edid_ptr; + int hsize; edid_data = prop_dictionary_get(dict, "EDID"); if (edid_data == NULL || prop_data_size(edid_data) < 128) return 0; + edid = kmem_alloc(sizeof(*edid), KM_SLEEP); + edid_ptr = prop_data_data_nocopy(edid_data); - if (edid_parse(__UNCONST(edid_ptr), &edid) != 0) - return 0; + if (edid_parse(__UNCONST(edid_ptr), edid) == 0) + hsize = (int)edid->edid_max_hsize * 10; + else + hsize = 0; + + kmem_free(edid, sizeof(*edid)); - return (int)edid.edid_max_hsize * 10; + return hsize; } /* Return the minimum number of character columns based on DPI */
CVS commit: [netbsd-9] src/sys/dev/wsfb
Module Name:src Committed By: martin Date: Wed Apr 15 14:15:17 UTC 2020 Modified Files: src/sys/dev/wsfb [netbsd-9]: genfb.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #835): sys/dev/wsfb/genfb.c: revision 1.72 Get genfb's address offset correctly when the value >= 4G. OK's by jmcneill. Tested on Intel BXNUC10I3FNK (Comet Lake U). To generate a diff of this commit: cvs rdiff -u -r1.67.2.1 -r1.67.2.2 src/sys/dev/wsfb/genfb.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/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.67.2.1 src/sys/dev/wsfb/genfb.c:1.67.2.2 --- src/sys/dev/wsfb/genfb.c:1.67.2.1 Thu Aug 15 12:21:27 2019 +++ src/sys/dev/wsfb/genfb.c Wed Apr 15 14:15:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.67.2.1 2019/08/15 12:21:27 martin Exp $ */ +/* $NetBSD: genfb.c,v 1.67.2.2 2020/04/15 14:15:17 martin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67.2.1 2019/08/15 12:21:27 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67.2.2 2020/04/15 14:15:17 martin Exp $"); #include #include @@ -102,7 +102,7 @@ genfb_init(struct genfb_softc *sc) { prop_dictionary_t dict; uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, br_cb, fbaddr; - uint32_t fboffset; + uint64_t fboffset; bool console; dict = device_properties(sc->sc_dev); @@ -124,13 +124,12 @@ genfb_init(struct genfb_softc *sc) return; } - /* XXX should be a 64bit value */ - if (!prop_dictionary_get_uint32(dict, "address", &fboffset)) { + if (!prop_dictionary_get_uint64(dict, "address", &fboffset)) { GPRINTF("no address property\n"); return; } - sc->sc_fboffset = fboffset; + sc->sc_fboffset = (bus_addr_t)fboffset; sc->sc_fbaddr = NULL; if (prop_dictionary_get_uint64(dict, "virtual_address", &fbaddr)) {