Wed Apr 15 14:15:17 2020 UTC ()
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).


(martin)
diff -r1.67.2.1 -r1.67.2.2 src/sys/dev/wsfb/genfb.c

cvs diff -r1.67.2.1 -r1.67.2.2 src/sys/dev/wsfb/genfb.c (expand / switch to unified diff)

--- src/sys/dev/wsfb/genfb.c 2019/08/15 12:21:27 1.67.2.1
+++ src/sys/dev/wsfb/genfb.c 2020/04/15 14:15:17 1.67.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: genfb.c,v 1.67.2.1 2019/08/15 12:21:27 martin Exp $ */ 1/* $NetBSD: genfb.c,v 1.67.2.2 2020/04/15 14:15:17 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Michael Lorenz 4 * Copyright (c) 2007 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67.2.1 2019/08/15 12:21:27 martin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67.2.2 2020/04/15 14:15:17 martin Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/proc.h> 36#include <sys/proc.h>
37#include <sys/mutex.h> 37#include <sys/mutex.h>
38#include <sys/ioctl.h> 38#include <sys/ioctl.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kmem.h> 41#include <sys/kmem.h>
42 42
43#include <dev/wscons/wsconsio.h> 43#include <dev/wscons/wsconsio.h>
@@ -92,55 +92,54 @@ static void genfb_brightness_down(device @@ -92,55 +92,54 @@ static void genfb_brightness_down(device
92 92
93extern const u_char rasops_cmap[768]; 93extern const u_char rasops_cmap[768];
94 94
95static int genfb_cnattach_called = 0; 95static int genfb_cnattach_called = 0;
96static int genfb_enabled = 1; 96static int genfb_enabled = 1;
97 97
98static struct genfb_softc *genfb_softc = NULL; 98static struct genfb_softc *genfb_softc = NULL;
99 99
100void 100void
101genfb_init(struct genfb_softc *sc) 101genfb_init(struct genfb_softc *sc)
102{ 102{
103 prop_dictionary_t dict; 103 prop_dictionary_t dict;
104 uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, br_cb, fbaddr; 104 uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, br_cb, fbaddr;
105 uint32_t fboffset; 105 uint64_t fboffset;
106 bool console; 106 bool console;
107 107
108 dict = device_properties(sc->sc_dev); 108 dict = device_properties(sc->sc_dev);
109#ifdef GENFB_DEBUG 109#ifdef GENFB_DEBUG
110 printf("%s", prop_dictionary_externalize(dict)); 110 printf("%s", prop_dictionary_externalize(dict));
111#endif 111#endif
112 prop_dictionary_get_bool(dict, "is_console", &console); 112 prop_dictionary_get_bool(dict, "is_console", &console);
113 113
114 if (!prop_dictionary_get_uint32(dict, "width", &sc->sc_width)) { 114 if (!prop_dictionary_get_uint32(dict, "width", &sc->sc_width)) {
115 GPRINTF("no width property\n"); 115 GPRINTF("no width property\n");
116 return; 116 return;
117 } 117 }
118 if (!prop_dictionary_get_uint32(dict, "height", &sc->sc_height)) { 118 if (!prop_dictionary_get_uint32(dict, "height", &sc->sc_height)) {
119 GPRINTF("no height property\n"); 119 GPRINTF("no height property\n");
120 return; 120 return;
121 } 121 }
122 if (!prop_dictionary_get_uint32(dict, "depth", &sc->sc_depth)) { 122 if (!prop_dictionary_get_uint32(dict, "depth", &sc->sc_depth)) {
123 GPRINTF("no depth property\n"); 123 GPRINTF("no depth property\n");
124 return; 124 return;
125 } 125 }
126 126
127 /* XXX should be a 64bit value */ 127 if (!prop_dictionary_get_uint64(dict, "address", &fboffset)) {
128 if (!prop_dictionary_get_uint32(dict, "address", &fboffset)) { 
129 GPRINTF("no address property\n"); 128 GPRINTF("no address property\n");
130 return; 129 return;
131 } 130 }
132 131
133 sc->sc_fboffset = fboffset; 132 sc->sc_fboffset = (bus_addr_t)fboffset;
134 133
135 sc->sc_fbaddr = NULL; 134 sc->sc_fbaddr = NULL;
136 if (prop_dictionary_get_uint64(dict, "virtual_address", &fbaddr)) { 135 if (prop_dictionary_get_uint64(dict, "virtual_address", &fbaddr)) {
137 sc->sc_fbaddr = (void *)(uintptr_t)fbaddr; 136 sc->sc_fbaddr = (void *)(uintptr_t)fbaddr;
138 } 137 }
139 138
140 sc->sc_shadowfb = NULL; 139 sc->sc_shadowfb = NULL;
141 if (!prop_dictionary_get_bool(dict, "enable_shadowfb", 140 if (!prop_dictionary_get_bool(dict, "enable_shadowfb",
142 &sc->sc_enable_shadowfb)) 141 &sc->sc_enable_shadowfb))
143#ifdef GENFB_SHADOWFB 142#ifdef GENFB_SHADOWFB
144 sc->sc_enable_shadowfb = true; 143 sc->sc_enable_shadowfb = true;
145#else 144#else
146 sc->sc_enable_shadowfb = false; 145 sc->sc_enable_shadowfb = false;