Deleted Added
full compact
bcm2835_fb.c (239922) bcm2835_fb.c (243423)
1/*-
2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c 239922 2012-08-30 20:59:37Z gonzo $");
28__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c 243423 2012-11-23 04:30:54Z gonzo $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bio.h>
33#include <sys/bus.h>
34#include <sys/conf.h>
35#include <sys/endian.h>
36#include <sys/kernel.h>
37#include <sys/kthread.h>
38#include <sys/lock.h>
39#include <sys/malloc.h>
40#include <sys/module.h>
41#include <sys/mutex.h>
42#include <sys/queue.h>
43#include <sys/resource.h>
44#include <sys/rman.h>
45#include <sys/time.h>
46#include <sys/timetc.h>
47#include <sys/fbio.h>
48#include <sys/consio.h>
49
50#include <sys/kdb.h>
51
52#include <machine/bus.h>
53#include <machine/cpu.h>
54#include <machine/cpufunc.h>
55#include <machine/resource.h>
56#include <machine/frame.h>
57#include <machine/intr.h>
58
59#include <dev/fdt/fdt_common.h>
60#include <dev/ofw/ofw_bus.h>
61#include <dev/ofw/ofw_bus_subr.h>
62
63#include <dev/fb/fbreg.h>
64#include <dev/syscons/syscons.h>
65
66#include <arm/broadcom/bcm2835/bcm2835_mbox.h>
67#include <arm/broadcom/bcm2835/bcm2835_vcbus.h>
68
69#define BCMFB_FONT_HEIGHT 16
70
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bio.h>
33#include <sys/bus.h>
34#include <sys/conf.h>
35#include <sys/endian.h>
36#include <sys/kernel.h>
37#include <sys/kthread.h>
38#include <sys/lock.h>
39#include <sys/malloc.h>
40#include <sys/module.h>
41#include <sys/mutex.h>
42#include <sys/queue.h>
43#include <sys/resource.h>
44#include <sys/rman.h>
45#include <sys/time.h>
46#include <sys/timetc.h>
47#include <sys/fbio.h>
48#include <sys/consio.h>
49
50#include <sys/kdb.h>
51
52#include <machine/bus.h>
53#include <machine/cpu.h>
54#include <machine/cpufunc.h>
55#include <machine/resource.h>
56#include <machine/frame.h>
57#include <machine/intr.h>
58
59#include <dev/fdt/fdt_common.h>
60#include <dev/ofw/ofw_bus.h>
61#include <dev/ofw/ofw_bus_subr.h>
62
63#include <dev/fb/fbreg.h>
64#include <dev/syscons/syscons.h>
65
66#include <arm/broadcom/bcm2835/bcm2835_mbox.h>
67#include <arm/broadcom/bcm2835/bcm2835_vcbus.h>
68
69#define BCMFB_FONT_HEIGHT 16
70
71struct argb {
72 uint8_t a;
73 uint8_t r;
74 uint8_t g;
75 uint8_t b;
76};
77
78static struct argb bcmfb_palette[16] = {
79 {0x00, 0x00, 0x00, 0x00},
80 {0x00, 0x00, 0x00, 0xaa},
81 {0x00, 0x00, 0xaa, 0x00},
82 {0x00, 0x00, 0xaa, 0xaa},
83 {0x00, 0xaa, 0x00, 0x00},
84 {0x00, 0xaa, 0x00, 0xaa},
85 {0x00, 0xaa, 0x55, 0x00},
86 {0x00, 0xaa, 0xaa, 0xaa},
87 {0x00, 0x55, 0x55, 0x55},
88 {0x00, 0x55, 0x55, 0xff},
89 {0x00, 0x55, 0xff, 0x55},
90 {0x00, 0x55, 0xff, 0xff},
91 {0x00, 0xff, 0x55, 0x55},
92 {0x00, 0xff, 0x55, 0xff},
93 {0x00, 0xff, 0xff, 0x55},
94 {0x00, 0xff, 0xff, 0xff}
95};
96
71#define FB_WIDTH 640
72#define FB_HEIGHT 480
97#define FB_WIDTH 640
98#define FB_HEIGHT 480
99#define FB_DEPTH 24
73
74struct bcm_fb_config {
75 uint32_t xres;
76 uint32_t yres;
77 uint32_t vxres;
78 uint32_t vyres;
79 uint32_t pitch;
80 uint32_t bpp;
81 uint32_t xoffset;
82 uint32_t yoffset;
83 /* Filled by videocore */
84 uint32_t base;
85 uint32_t screen_size;
86};
87
88struct bcmsc_softc {
89 device_t dev;
90 struct cdev * cdev;
91 struct mtx mtx;
92 bus_dma_tag_t dma_tag;
93 bus_dmamap_t dma_map;
94 struct bcm_fb_config* fb_config;
95 bus_addr_t fb_config_phys;
96 struct intr_config_hook init_hook;
97
98};
99
100struct video_adapter_softc {
101 /* Videoadpater part */
102 video_adapter_t va;
103 int console;
104
105 intptr_t fb_addr;
106 unsigned int fb_size;
107
108 unsigned int height;
109 unsigned int width;
100
101struct bcm_fb_config {
102 uint32_t xres;
103 uint32_t yres;
104 uint32_t vxres;
105 uint32_t vyres;
106 uint32_t pitch;
107 uint32_t bpp;
108 uint32_t xoffset;
109 uint32_t yoffset;
110 /* Filled by videocore */
111 uint32_t base;
112 uint32_t screen_size;
113};
114
115struct bcmsc_softc {
116 device_t dev;
117 struct cdev * cdev;
118 struct mtx mtx;
119 bus_dma_tag_t dma_tag;
120 bus_dmamap_t dma_map;
121 struct bcm_fb_config* fb_config;
122 bus_addr_t fb_config_phys;
123 struct intr_config_hook init_hook;
124
125};
126
127struct video_adapter_softc {
128 /* Videoadpater part */
129 video_adapter_t va;
130 int console;
131
132 intptr_t fb_addr;
133 unsigned int fb_size;
134
135 unsigned int height;
136 unsigned int width;
137 unsigned int depth;
110 unsigned int stride;
111
112 unsigned int xmargin;
113 unsigned int ymargin;
114
115 unsigned char *font;
116 int initialized;
117};
118
119static struct bcmsc_softc *bcmsc_softc;
120static struct video_adapter_softc va_softc;
121
122#define bcm_fb_lock(_sc) mtx_lock(&(_sc)->mtx)
123#define bcm_fb_unlock(_sc) mtx_unlock(&(_sc)->mtx)
124#define bcm_fb_lock_assert(sc) mtx_assert(&(_sc)->mtx, MA_OWNED)
125
126static int bcm_fb_probe(device_t);
127static int bcm_fb_attach(device_t);
128static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err);
138 unsigned int stride;
139
140 unsigned int xmargin;
141 unsigned int ymargin;
142
143 unsigned char *font;
144 int initialized;
145};
146
147static struct bcmsc_softc *bcmsc_softc;
148static struct video_adapter_softc va_softc;
149
150#define bcm_fb_lock(_sc) mtx_lock(&(_sc)->mtx)
151#define bcm_fb_unlock(_sc) mtx_unlock(&(_sc)->mtx)
152#define bcm_fb_lock_assert(sc) mtx_assert(&(_sc)->mtx, MA_OWNED)
153
154static int bcm_fb_probe(device_t);
155static int bcm_fb_attach(device_t);
156static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err);
157static void bcmfb_update_margins(video_adapter_t *adp);
158static int bcmfb_configure(int);
129
130static void
131bcm_fb_init(void *arg)
132{
133 struct bcmsc_softc *sc = arg;
134 struct video_adapter_softc *va_sc = &va_softc;
135 int err;
136 volatile struct bcm_fb_config* fb_config = sc->fb_config;
159
160static void
161bcm_fb_init(void *arg)
162{
163 struct bcmsc_softc *sc = arg;
164 struct video_adapter_softc *va_sc = &va_softc;
165 int err;
166 volatile struct bcm_fb_config* fb_config = sc->fb_config;
167 phandle_t node;
168 pcell_t cell;
137
169
138 /* TODO: replace it with FDT stuff */
139 fb_config->xres = FB_WIDTH;
140 fb_config->yres = FB_HEIGHT;
170 node = ofw_bus_get_node(sc->dev);
171
172 fb_config->xres = 0;
173 fb_config->yres = 0;
174 fb_config->bpp = 0;
175
176 if ((OF_getprop(node, "broadcom,width", &cell, sizeof(cell))) > 0)
177 fb_config->xres = (int)fdt32_to_cpu(cell);
178 if (fb_config->xres == 0)
179 fb_config->xres = FB_WIDTH;
180
181 if ((OF_getprop(node, "broadcom,height", &cell, sizeof(cell))) > 0)
182 fb_config->yres = (uint32_t)fdt32_to_cpu(cell);
183 if (fb_config->yres == 0)
184 fb_config->yres = FB_HEIGHT;
185
186 if ((OF_getprop(node, "broadcom,depth", &cell, sizeof(cell))) > 0)
187 fb_config->bpp = (uint32_t)fdt32_to_cpu(cell);
188 if (fb_config->bpp == 0)
189 fb_config->bpp = FB_DEPTH;
190
141 fb_config->vxres = 0;
142 fb_config->vyres = 0;
143 fb_config->xoffset = 0;
144 fb_config->yoffset = 0;
191 fb_config->vxres = 0;
192 fb_config->vyres = 0;
193 fb_config->xoffset = 0;
194 fb_config->yoffset = 0;
145 fb_config->bpp = 24;
146 fb_config->base = 0;
147 fb_config->pitch = 0;
148 fb_config->screen_size = 0;
149
150 bus_dmamap_sync(sc->dma_tag, sc->dma_map,
151 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
152 bcm_mbox_write(BCM2835_MBOX_CHAN_FB, sc->fb_config_phys);
153 bcm_mbox_read(BCM2835_MBOX_CHAN_FB, &err);
154 bus_dmamap_sync(sc->dma_tag, sc->dma_map,
155 BUS_DMASYNC_POSTREAD);
156
195 fb_config->base = 0;
196 fb_config->pitch = 0;
197 fb_config->screen_size = 0;
198
199 bus_dmamap_sync(sc->dma_tag, sc->dma_map,
200 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
201 bcm_mbox_write(BCM2835_MBOX_CHAN_FB, sc->fb_config_phys);
202 bcm_mbox_read(BCM2835_MBOX_CHAN_FB, &err);
203 bus_dmamap_sync(sc->dma_tag, sc->dma_map,
204 BUS_DMASYNC_POSTREAD);
205
157 if (err == 0) {
206 if (fb_config->base != 0) {
158 device_printf(sc->dev, "%dx%d(%dx%d@%d,%d) %dbpp\n",
159 fb_config->xres, fb_config->yres,
160 fb_config->vxres, fb_config->vyres,
161 fb_config->xoffset, fb_config->yoffset,
162 fb_config->bpp);
163
164
165 device_printf(sc->dev, "pitch %d, base 0x%08x, screen_size %d\n",
166 fb_config->pitch, fb_config->base,
167 fb_config->screen_size);
168
207 device_printf(sc->dev, "%dx%d(%dx%d@%d,%d) %dbpp\n",
208 fb_config->xres, fb_config->yres,
209 fb_config->vxres, fb_config->vyres,
210 fb_config->xoffset, fb_config->yoffset,
211 fb_config->bpp);
212
213
214 device_printf(sc->dev, "pitch %d, base 0x%08x, screen_size %d\n",
215 fb_config->pitch, fb_config->base,
216 fb_config->screen_size);
217
169 if (fb_config->base) {
170 va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size);
171 va_sc->fb_size = fb_config->screen_size;
172 va_sc->stride = fb_config->pitch;
173 }
218 va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size);
219 va_sc->fb_size = fb_config->screen_size;
220 va_sc->depth = fb_config->bpp;
221 va_sc->stride = fb_config->pitch;
222
223 va_sc->width = fb_config->xres;
224 va_sc->height = fb_config->yres;
225 bcmfb_update_margins(&va_sc->va);
174 }
226 }
175 else
227 else {
176 device_printf(sc->dev, "Failed to set framebuffer info\n");
228 device_printf(sc->dev, "Failed to set framebuffer info\n");
229 return;
230 }
177
178 config_intrhook_disestablish(&sc->init_hook);
179}
180
181static int
182bcm_fb_probe(device_t dev)
183{
231
232 config_intrhook_disestablish(&sc->init_hook);
233}
234
235static int
236bcm_fb_probe(device_t dev)
237{
184 int error;
238 int error = 0;
185
186 if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb"))
187 return (ENXIO);
188
189 device_set_desc(dev, "BCM2835 framebuffer device");
190
191 error = sc_probe_unit(device_get_unit(dev),
192 device_get_flags(dev) | SC_AUTODETECT_KBD);
239
240 if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb"))
241 return (ENXIO);
242
243 device_set_desc(dev, "BCM2835 framebuffer device");
244
245 error = sc_probe_unit(device_get_unit(dev),
246 device_get_flags(dev) | SC_AUTODETECT_KBD);
193
194 if (error != 0)
195 return (error);
196
247 if (error != 0)
248 return (error);
249
250
197 return (BUS_PROBE_DEFAULT);
198}
199
200static int
201bcm_fb_attach(device_t dev)
202{
203 struct bcmsc_softc *sc = device_get_softc(dev);
204 int dma_size = sizeof(struct bcm_fb_config);
205 int err;
206
207 if (bcmsc_softc)
208 return (ENXIO);
209
210 bcmsc_softc = sc;
211
212 sc->dev = dev;
213 mtx_init(&sc->mtx, "bcm2835fb", "fb", MTX_DEF);
214
215 err = bus_dma_tag_create(
216 bus_get_dma_tag(sc->dev),
217 PAGE_SIZE, 0, /* alignment, boundary */
218 BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
219 BUS_SPACE_MAXADDR, /* highaddr */
220 NULL, NULL, /* filter, filterarg */
221 dma_size, 1, /* maxsize, nsegments */
222 dma_size, 0, /* maxsegsize, flags */
223 NULL, NULL, /* lockfunc, lockarg */
224 &sc->dma_tag);
225
226 err = bus_dmamem_alloc(sc->dma_tag, (void **)&sc->fb_config,
227 0, &sc->dma_map);
228 if (err) {
229 device_printf(dev, "cannot allocate framebuffer\n");
230 goto fail;
231 }
232
233 err = bus_dmamap_load(sc->dma_tag, sc->dma_map, sc->fb_config,
234 dma_size, bcm_fb_dmamap_cb, &sc->fb_config_phys, BUS_DMA_NOWAIT);
235
236 if (err) {
237 device_printf(dev, "cannot load DMA map\n");
238 goto fail;
239 }
240
241 err = (sc_attach_unit(device_get_unit(dev),
242 device_get_flags(dev) | SC_AUTODETECT_KBD));
243
244 if (err) {
245 device_printf(dev, "failed to attach syscons\n");
246 goto fail;
247 }
248
249 /*
250 * We have to wait until interrupts are enabled.
251 * Mailbox relies on it to get data from VideoCore
252 */
253 sc->init_hook.ich_func = bcm_fb_init;
254 sc->init_hook.ich_arg = sc;
255
256 if (config_intrhook_establish(&sc->init_hook) != 0) {
257 device_printf(dev, "failed to establish intrhook\n");
258 return (ENOMEM);
259 }
260
261 return (0);
262
263fail:
264 return (ENXIO);
265}
266
267
268static void
269bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err)
270{
271 bus_addr_t *addr;
272
273 if (err)
274 return;
275
276 addr = (bus_addr_t*)arg;
277 *addr = PHYS_TO_VCBUS(segs[0].ds_addr);
278}
279
280static device_method_t bcm_fb_methods[] = {
281 /* Device interface */
282 DEVMETHOD(device_probe, bcm_fb_probe),
283 DEVMETHOD(device_attach, bcm_fb_attach),
284
285 { 0, 0 }
286};
287
288static devclass_t bcm_fb_devclass;
289
290static driver_t bcm_fb_driver = {
291 "fb",
292 bcm_fb_methods,
293 sizeof(struct bcmsc_softc),
294};
295
251 return (BUS_PROBE_DEFAULT);
252}
253
254static int
255bcm_fb_attach(device_t dev)
256{
257 struct bcmsc_softc *sc = device_get_softc(dev);
258 int dma_size = sizeof(struct bcm_fb_config);
259 int err;
260
261 if (bcmsc_softc)
262 return (ENXIO);
263
264 bcmsc_softc = sc;
265
266 sc->dev = dev;
267 mtx_init(&sc->mtx, "bcm2835fb", "fb", MTX_DEF);
268
269 err = bus_dma_tag_create(
270 bus_get_dma_tag(sc->dev),
271 PAGE_SIZE, 0, /* alignment, boundary */
272 BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
273 BUS_SPACE_MAXADDR, /* highaddr */
274 NULL, NULL, /* filter, filterarg */
275 dma_size, 1, /* maxsize, nsegments */
276 dma_size, 0, /* maxsegsize, flags */
277 NULL, NULL, /* lockfunc, lockarg */
278 &sc->dma_tag);
279
280 err = bus_dmamem_alloc(sc->dma_tag, (void **)&sc->fb_config,
281 0, &sc->dma_map);
282 if (err) {
283 device_printf(dev, "cannot allocate framebuffer\n");
284 goto fail;
285 }
286
287 err = bus_dmamap_load(sc->dma_tag, sc->dma_map, sc->fb_config,
288 dma_size, bcm_fb_dmamap_cb, &sc->fb_config_phys, BUS_DMA_NOWAIT);
289
290 if (err) {
291 device_printf(dev, "cannot load DMA map\n");
292 goto fail;
293 }
294
295 err = (sc_attach_unit(device_get_unit(dev),
296 device_get_flags(dev) | SC_AUTODETECT_KBD));
297
298 if (err) {
299 device_printf(dev, "failed to attach syscons\n");
300 goto fail;
301 }
302
303 /*
304 * We have to wait until interrupts are enabled.
305 * Mailbox relies on it to get data from VideoCore
306 */
307 sc->init_hook.ich_func = bcm_fb_init;
308 sc->init_hook.ich_arg = sc;
309
310 if (config_intrhook_establish(&sc->init_hook) != 0) {
311 device_printf(dev, "failed to establish intrhook\n");
312 return (ENOMEM);
313 }
314
315 return (0);
316
317fail:
318 return (ENXIO);
319}
320
321
322static void
323bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err)
324{
325 bus_addr_t *addr;
326
327 if (err)
328 return;
329
330 addr = (bus_addr_t*)arg;
331 *addr = PHYS_TO_VCBUS(segs[0].ds_addr);
332}
333
334static device_method_t bcm_fb_methods[] = {
335 /* Device interface */
336 DEVMETHOD(device_probe, bcm_fb_probe),
337 DEVMETHOD(device_attach, bcm_fb_attach),
338
339 { 0, 0 }
340};
341
342static devclass_t bcm_fb_devclass;
343
344static driver_t bcm_fb_driver = {
345 "fb",
346 bcm_fb_methods,
347 sizeof(struct bcmsc_softc),
348};
349
296DRIVER_MODULE(bcm2835fb, simplebus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
350DRIVER_MODULE(bcm2835fb, fdtbus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
297
298/*
299 * Video driver routines and glue.
300 */
351
352/*
353 * Video driver routines and glue.
354 */
301static int bcmfb_configure(int);
302static vi_probe_t bcmfb_probe;
303static vi_init_t bcmfb_init;
304static vi_get_info_t bcmfb_get_info;
305static vi_query_mode_t bcmfb_query_mode;
306static vi_set_mode_t bcmfb_set_mode;
307static vi_save_font_t bcmfb_save_font;
308static vi_load_font_t bcmfb_load_font;
309static vi_show_font_t bcmfb_show_font;
310static vi_save_palette_t bcmfb_save_palette;
311static vi_load_palette_t bcmfb_load_palette;
312static vi_set_border_t bcmfb_set_border;
313static vi_save_state_t bcmfb_save_state;
314static vi_load_state_t bcmfb_load_state;
315static vi_set_win_org_t bcmfb_set_win_org;
316static vi_read_hw_cursor_t bcmfb_read_hw_cursor;
317static vi_set_hw_cursor_t bcmfb_set_hw_cursor;
318static vi_set_hw_cursor_shape_t bcmfb_set_hw_cursor_shape;
319static vi_blank_display_t bcmfb_blank_display;
320static vi_mmap_t bcmfb_mmap;
321static vi_ioctl_t bcmfb_ioctl;
322static vi_clear_t bcmfb_clear;
323static vi_fill_rect_t bcmfb_fill_rect;
324static vi_bitblt_t bcmfb_bitblt;
325static vi_diag_t bcmfb_diag;
326static vi_save_cursor_palette_t bcmfb_save_cursor_palette;
327static vi_load_cursor_palette_t bcmfb_load_cursor_palette;
328static vi_copy_t bcmfb_copy;
329static vi_putp_t bcmfb_putp;
330static vi_putc_t bcmfb_putc;
331static vi_puts_t bcmfb_puts;
332static vi_putm_t bcmfb_putm;
333
334static video_switch_t bcmfbvidsw = {
335 .probe = bcmfb_probe,
336 .init = bcmfb_init,
337 .get_info = bcmfb_get_info,
338 .query_mode = bcmfb_query_mode,
339 .set_mode = bcmfb_set_mode,
340 .save_font = bcmfb_save_font,
341 .load_font = bcmfb_load_font,
342 .show_font = bcmfb_show_font,
343 .save_palette = bcmfb_save_palette,
344 .load_palette = bcmfb_load_palette,
345 .set_border = bcmfb_set_border,
346 .save_state = bcmfb_save_state,
347 .load_state = bcmfb_load_state,
348 .set_win_org = bcmfb_set_win_org,
349 .read_hw_cursor = bcmfb_read_hw_cursor,
350 .set_hw_cursor = bcmfb_set_hw_cursor,
351 .set_hw_cursor_shape = bcmfb_set_hw_cursor_shape,
352 .blank_display = bcmfb_blank_display,
353 .mmap = bcmfb_mmap,
354 .ioctl = bcmfb_ioctl,
355 .clear = bcmfb_clear,
356 .fill_rect = bcmfb_fill_rect,
357 .bitblt = bcmfb_bitblt,
358 .diag = bcmfb_diag,
359 .save_cursor_palette = bcmfb_save_cursor_palette,
360 .load_cursor_palette = bcmfb_load_cursor_palette,
361 .copy = bcmfb_copy,
362 .putp = bcmfb_putp,
363 .putc = bcmfb_putc,
364 .puts = bcmfb_puts,
365 .putm = bcmfb_putm,
366};
367
368VIDEO_DRIVER(bcmfb, bcmfbvidsw, bcmfb_configure);
369
370extern sc_rndr_sw_t txtrndrsw;
371RENDERER(bcmfb, 0, txtrndrsw, gfb_set);
372RENDERER_MODULE(bcmfb, gfb_set);
373
374static uint16_t bcmfb_static_window[ROW*COL];
375extern u_char dflt_font_16[];
376
355static vi_probe_t bcmfb_probe;
356static vi_init_t bcmfb_init;
357static vi_get_info_t bcmfb_get_info;
358static vi_query_mode_t bcmfb_query_mode;
359static vi_set_mode_t bcmfb_set_mode;
360static vi_save_font_t bcmfb_save_font;
361static vi_load_font_t bcmfb_load_font;
362static vi_show_font_t bcmfb_show_font;
363static vi_save_palette_t bcmfb_save_palette;
364static vi_load_palette_t bcmfb_load_palette;
365static vi_set_border_t bcmfb_set_border;
366static vi_save_state_t bcmfb_save_state;
367static vi_load_state_t bcmfb_load_state;
368static vi_set_win_org_t bcmfb_set_win_org;
369static vi_read_hw_cursor_t bcmfb_read_hw_cursor;
370static vi_set_hw_cursor_t bcmfb_set_hw_cursor;
371static vi_set_hw_cursor_shape_t bcmfb_set_hw_cursor_shape;
372static vi_blank_display_t bcmfb_blank_display;
373static vi_mmap_t bcmfb_mmap;
374static vi_ioctl_t bcmfb_ioctl;
375static vi_clear_t bcmfb_clear;
376static vi_fill_rect_t bcmfb_fill_rect;
377static vi_bitblt_t bcmfb_bitblt;
378static vi_diag_t bcmfb_diag;
379static vi_save_cursor_palette_t bcmfb_save_cursor_palette;
380static vi_load_cursor_palette_t bcmfb_load_cursor_palette;
381static vi_copy_t bcmfb_copy;
382static vi_putp_t bcmfb_putp;
383static vi_putc_t bcmfb_putc;
384static vi_puts_t bcmfb_puts;
385static vi_putm_t bcmfb_putm;
386
387static video_switch_t bcmfbvidsw = {
388 .probe = bcmfb_probe,
389 .init = bcmfb_init,
390 .get_info = bcmfb_get_info,
391 .query_mode = bcmfb_query_mode,
392 .set_mode = bcmfb_set_mode,
393 .save_font = bcmfb_save_font,
394 .load_font = bcmfb_load_font,
395 .show_font = bcmfb_show_font,
396 .save_palette = bcmfb_save_palette,
397 .load_palette = bcmfb_load_palette,
398 .set_border = bcmfb_set_border,
399 .save_state = bcmfb_save_state,
400 .load_state = bcmfb_load_state,
401 .set_win_org = bcmfb_set_win_org,
402 .read_hw_cursor = bcmfb_read_hw_cursor,
403 .set_hw_cursor = bcmfb_set_hw_cursor,
404 .set_hw_cursor_shape = bcmfb_set_hw_cursor_shape,
405 .blank_display = bcmfb_blank_display,
406 .mmap = bcmfb_mmap,
407 .ioctl = bcmfb_ioctl,
408 .clear = bcmfb_clear,
409 .fill_rect = bcmfb_fill_rect,
410 .bitblt = bcmfb_bitblt,
411 .diag = bcmfb_diag,
412 .save_cursor_palette = bcmfb_save_cursor_palette,
413 .load_cursor_palette = bcmfb_load_cursor_palette,
414 .copy = bcmfb_copy,
415 .putp = bcmfb_putp,
416 .putc = bcmfb_putc,
417 .puts = bcmfb_puts,
418 .putm = bcmfb_putm,
419};
420
421VIDEO_DRIVER(bcmfb, bcmfbvidsw, bcmfb_configure);
422
423extern sc_rndr_sw_t txtrndrsw;
424RENDERER(bcmfb, 0, txtrndrsw, gfb_set);
425RENDERER_MODULE(bcmfb, gfb_set);
426
427static uint16_t bcmfb_static_window[ROW*COL];
428extern u_char dflt_font_16[];
429
430/*
431 * Update videoadapter settings after changing resolution
432 */
433static void
434bcmfb_update_margins(video_adapter_t *adp)
435{
436 struct video_adapter_softc *sc;
437 video_info_t *vi;
438
439 sc = (struct video_adapter_softc *)adp;
440 vi = &adp->va_info;
441
442 sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2;
443 sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2;
444}
445
377static int
378bcmfb_configure(int flags)
379{
446static int
447bcmfb_configure(int flags)
448{
380 struct video_adapter_softc *sc;
449 struct video_adapter_softc *va_sc;
381
450
382 sc = &va_softc;
451 va_sc = &va_softc;
452 phandle_t display, root;
453 pcell_t cell;
383
454
384 if (sc->initialized)
385 return 0;
455 if (va_sc->initialized)
456 return (0);
386
457
387 sc->height = FB_HEIGHT;
388 sc->width = FB_WIDTH;
458 va_sc->width = 0;
459 va_sc->height = 0;
389
460
390 bcmfb_init(0, &sc->va, 0);
461 /*
462 * It seems there is no way to let syscons framework know
463 * that framebuffer resolution has changed. So just try
464 * to fetch data from FDT and go with defaults if failed
465 */
466 root = OF_finddevice("/");
467 if ((root != 0) &&
468 (display = fdt_find_compatible(root, "broadcom,bcm2835-fb", 1))) {
469 if ((OF_getprop(display, "broadcom,width",
470 &cell, sizeof(cell))) > 0)
471 va_sc->width = (int)fdt32_to_cpu(cell);
391
472
392 sc->initialized = 1;
473 if ((OF_getprop(display, "broadcom,height",
474 &cell, sizeof(cell))) > 0)
475 va_sc->height = (int)fdt32_to_cpu(cell);
476 }
393
477
478 if (va_sc->width == 0)
479 va_sc->width = FB_WIDTH;
480 if (va_sc->height == 0)
481 va_sc->height = FB_HEIGHT;
482
483 bcmfb_init(0, &va_sc->va, 0);
484
485 va_sc->initialized = 1;
486
394 return (0);
395}
396
397static int
398bcmfb_probe(int unit, video_adapter_t **adp, void *arg, int flags)
399{
400
401 return (0);
402}
403
404static int
405bcmfb_init(int unit, video_adapter_t *adp, int flags)
406{
407 struct video_adapter_softc *sc;
408 video_info_t *vi;
409
410 sc = (struct video_adapter_softc *)adp;
411 vi = &adp->va_info;
412
413 vid_init_struct(adp, "bcmfb", -1, unit);
414
415 sc->font = dflt_font_16;
416 vi->vi_cheight = BCMFB_FONT_HEIGHT;
417 vi->vi_cwidth = 8;
487 return (0);
488}
489
490static int
491bcmfb_probe(int unit, video_adapter_t **adp, void *arg, int flags)
492{
493
494 return (0);
495}
496
497static int
498bcmfb_init(int unit, video_adapter_t *adp, int flags)
499{
500 struct video_adapter_softc *sc;
501 video_info_t *vi;
502
503 sc = (struct video_adapter_softc *)adp;
504 vi = &adp->va_info;
505
506 vid_init_struct(adp, "bcmfb", -1, unit);
507
508 sc->font = dflt_font_16;
509 vi->vi_cheight = BCMFB_FONT_HEIGHT;
510 vi->vi_cwidth = 8;
511
418 vi->vi_width = sc->width/8;
419 vi->vi_height = sc->height/vi->vi_cheight;
420
421 /*
422 * Clamp width/height to syscons maximums
423 */
424 if (vi->vi_width > COL)
425 vi->vi_width = COL;
426 if (vi->vi_height > ROW)
427 vi->vi_height = ROW;
428
429 sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2;
430 sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2;
431
512 vi->vi_width = sc->width/8;
513 vi->vi_height = sc->height/vi->vi_cheight;
514
515 /*
516 * Clamp width/height to syscons maximums
517 */
518 if (vi->vi_width > COL)
519 vi->vi_width = COL;
520 if (vi->vi_height > ROW)
521 vi->vi_height = ROW;
522
523 sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2;
524 sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2;
525
526
432 adp->va_window = (vm_offset_t) bcmfb_static_window;
433 adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */;
434
435 vid_register(&sc->va);
436
437 return (0);
438}
439
440static int
441bcmfb_get_info(video_adapter_t *adp, int mode, video_info_t *info)
442{
443 bcopy(&adp->va_info, info, sizeof(*info));
444 return (0);
445}
446
447static int
448bcmfb_query_mode(video_adapter_t *adp, video_info_t *info)
449{
450 return (0);
451}
452
453static int
454bcmfb_set_mode(video_adapter_t *adp, int mode)
455{
456 return (0);
457}
458
459static int
460bcmfb_save_font(video_adapter_t *adp, int page, int size, int width,
461 u_char *data, int c, int count)
462{
463 return (0);
464}
465
466static int
467bcmfb_load_font(video_adapter_t *adp, int page, int size, int width,
468 u_char *data, int c, int count)
469{
470 struct video_adapter_softc *sc = (struct video_adapter_softc *)adp;
471
472 sc->font = data;
473
474 return (0);
475}
476
477static int
478bcmfb_show_font(video_adapter_t *adp, int page)
479{
480 return (0);
481}
482
483static int
484bcmfb_save_palette(video_adapter_t *adp, u_char *palette)
485{
486 return (0);
487}
488
489static int
490bcmfb_load_palette(video_adapter_t *adp, u_char *palette)
491{
492 return (0);
493}
494
495static int
496bcmfb_set_border(video_adapter_t *adp, int border)
497{
498 return (bcmfb_blank_display(adp, border));
499}
500
501static int
502bcmfb_save_state(video_adapter_t *adp, void *p, size_t size)
503{
504 return (0);
505}
506
507static int
508bcmfb_load_state(video_adapter_t *adp, void *p)
509{
510 return (0);
511}
512
513static int
514bcmfb_set_win_org(video_adapter_t *adp, off_t offset)
515{
516 return (0);
517}
518
519static int
520bcmfb_read_hw_cursor(video_adapter_t *adp, int *col, int *row)
521{
522 *col = *row = 0;
523
524 return (0);
525}
526
527static int
528bcmfb_set_hw_cursor(video_adapter_t *adp, int col, int row)
529{
530 return (0);
531}
532
533static int
534bcmfb_set_hw_cursor_shape(video_adapter_t *adp, int base, int height,
535 int celsize, int blink)
536{
537 return (0);
538}
539
540static int
541bcmfb_blank_display(video_adapter_t *adp, int mode)
542{
543
527 adp->va_window = (vm_offset_t) bcmfb_static_window;
528 adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */;
529
530 vid_register(&sc->va);
531
532 return (0);
533}
534
535static int
536bcmfb_get_info(video_adapter_t *adp, int mode, video_info_t *info)
537{
538 bcopy(&adp->va_info, info, sizeof(*info));
539 return (0);
540}
541
542static int
543bcmfb_query_mode(video_adapter_t *adp, video_info_t *info)
544{
545 return (0);
546}
547
548static int
549bcmfb_set_mode(video_adapter_t *adp, int mode)
550{
551 return (0);
552}
553
554static int
555bcmfb_save_font(video_adapter_t *adp, int page, int size, int width,
556 u_char *data, int c, int count)
557{
558 return (0);
559}
560
561static int
562bcmfb_load_font(video_adapter_t *adp, int page, int size, int width,
563 u_char *data, int c, int count)
564{
565 struct video_adapter_softc *sc = (struct video_adapter_softc *)adp;
566
567 sc->font = data;
568
569 return (0);
570}
571
572static int
573bcmfb_show_font(video_adapter_t *adp, int page)
574{
575 return (0);
576}
577
578static int
579bcmfb_save_palette(video_adapter_t *adp, u_char *palette)
580{
581 return (0);
582}
583
584static int
585bcmfb_load_palette(video_adapter_t *adp, u_char *palette)
586{
587 return (0);
588}
589
590static int
591bcmfb_set_border(video_adapter_t *adp, int border)
592{
593 return (bcmfb_blank_display(adp, border));
594}
595
596static int
597bcmfb_save_state(video_adapter_t *adp, void *p, size_t size)
598{
599 return (0);
600}
601
602static int
603bcmfb_load_state(video_adapter_t *adp, void *p)
604{
605 return (0);
606}
607
608static int
609bcmfb_set_win_org(video_adapter_t *adp, off_t offset)
610{
611 return (0);
612}
613
614static int
615bcmfb_read_hw_cursor(video_adapter_t *adp, int *col, int *row)
616{
617 *col = *row = 0;
618
619 return (0);
620}
621
622static int
623bcmfb_set_hw_cursor(video_adapter_t *adp, int col, int row)
624{
625 return (0);
626}
627
628static int
629bcmfb_set_hw_cursor_shape(video_adapter_t *adp, int base, int height,
630 int celsize, int blink)
631{
632 return (0);
633}
634
635static int
636bcmfb_blank_display(video_adapter_t *adp, int mode)
637{
638
639 struct video_adapter_softc *sc;
640
641 sc = (struct video_adapter_softc *)adp;
642 if (sc && sc->fb_addr)
643 memset((void*)sc->fb_addr, 0, sc->fb_size);
644
544 return (0);
545}
546
547static int
548bcmfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr,
549 int prot, vm_memattr_t *memattr)
550{
551 struct video_adapter_softc *sc;
552
553 sc = (struct video_adapter_softc *)adp;
554
555 /*
556 * This might be a legacy VGA mem request: if so, just point it at the
557 * framebuffer, since it shouldn't be touched
558 */
559 if (offset < sc->stride*sc->height) {
560 *paddr = sc->fb_addr + offset;
561 return (0);
562 }
563
564 return (EINVAL);
565}
566
567static int
568bcmfb_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data)
569{
570
571 return (0);
572}
573
574static int
575bcmfb_clear(video_adapter_t *adp)
576{
577
578 return (bcmfb_blank_display(adp, 0));
579}
580
581static int
582bcmfb_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy)
583{
584
585 return (0);
586}
587
588static int
589bcmfb_bitblt(video_adapter_t *adp, ...)
590{
591
592 return (0);
593}
594
595static int
596bcmfb_diag(video_adapter_t *adp, int level)
597{
598
599 return (0);
600}
601
602static int
603bcmfb_save_cursor_palette(video_adapter_t *adp, u_char *palette)
604{
605
606 return (0);
607}
608
609static int
610bcmfb_load_cursor_palette(video_adapter_t *adp, u_char *palette)
611{
612
613 return (0);
614}
615
616static int
617bcmfb_copy(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst, int n)
618{
619
620 return (0);
621}
622
623static int
624bcmfb_putp(video_adapter_t *adp, vm_offset_t off, uint32_t p, uint32_t a,
625 int size, int bpp, int bit_ltor, int byte_ltor)
626{
627
628 return (0);
629}
630
631static int
632bcmfb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a)
633{
634 struct video_adapter_softc *sc;
635 int row;
636 int col;
637 int i, j, k;
638 uint8_t *addr;
639 u_char *p;
640 uint8_t fg, bg, color;
645 return (0);
646}
647
648static int
649bcmfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr,
650 int prot, vm_memattr_t *memattr)
651{
652 struct video_adapter_softc *sc;
653
654 sc = (struct video_adapter_softc *)adp;
655
656 /*
657 * This might be a legacy VGA mem request: if so, just point it at the
658 * framebuffer, since it shouldn't be touched
659 */
660 if (offset < sc->stride*sc->height) {
661 *paddr = sc->fb_addr + offset;
662 return (0);
663 }
664
665 return (EINVAL);
666}
667
668static int
669bcmfb_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data)
670{
671
672 return (0);
673}
674
675static int
676bcmfb_clear(video_adapter_t *adp)
677{
678
679 return (bcmfb_blank_display(adp, 0));
680}
681
682static int
683bcmfb_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy)
684{
685
686 return (0);
687}
688
689static int
690bcmfb_bitblt(video_adapter_t *adp, ...)
691{
692
693 return (0);
694}
695
696static int
697bcmfb_diag(video_adapter_t *adp, int level)
698{
699
700 return (0);
701}
702
703static int
704bcmfb_save_cursor_palette(video_adapter_t *adp, u_char *palette)
705{
706
707 return (0);
708}
709
710static int
711bcmfb_load_cursor_palette(video_adapter_t *adp, u_char *palette)
712{
713
714 return (0);
715}
716
717static int
718bcmfb_copy(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst, int n)
719{
720
721 return (0);
722}
723
724static int
725bcmfb_putp(video_adapter_t *adp, vm_offset_t off, uint32_t p, uint32_t a,
726 int size, int bpp, int bit_ltor, int byte_ltor)
727{
728
729 return (0);
730}
731
732static int
733bcmfb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a)
734{
735 struct video_adapter_softc *sc;
736 int row;
737 int col;
738 int i, j, k;
739 uint8_t *addr;
740 u_char *p;
741 uint8_t fg, bg, color;
742 uint16_t rgb;
641
642 sc = (struct video_adapter_softc *)adp;
643
644 if (sc->fb_addr == 0)
645 return (0);
646
647 row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight;
648 col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth;
649 p = sc->font + c*BCMFB_FONT_HEIGHT;
650 addr = (uint8_t *)sc->fb_addr
651 + (row + sc->ymargin)*(sc->stride)
652 + 3 * (col + sc->xmargin);
653
743
744 sc = (struct video_adapter_softc *)adp;
745
746 if (sc->fb_addr == 0)
747 return (0);
748
749 row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight;
750 col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth;
751 p = sc->font + c*BCMFB_FONT_HEIGHT;
752 addr = (uint8_t *)sc->fb_addr
753 + (row + sc->ymargin)*(sc->stride)
754 + 3 * (col + sc->xmargin);
755
654 /*
655 * FIXME: hardcoded
656 */
657 bg = 0x00;
658 fg = 0x80;
756 fg = a & 0xf ;
757 bg = (a >> 8) & 0xf;
659
660 for (i = 0; i < BCMFB_FONT_HEIGHT; i++) {
661 for (j = 0, k = 7; j < 8; j++, k--) {
662 if ((p[i] & (1 << k)) == 0)
663 color = bg;
664 else
665 color = fg;
666
758
759 for (i = 0; i < BCMFB_FONT_HEIGHT; i++) {
760 for (j = 0, k = 7; j < 8; j++, k--) {
761 if ((p[i] & (1 << k)) == 0)
762 color = bg;
763 else
764 color = fg;
765
667 addr[3*j] = color;
668 addr[3*j+1] = color;
669 addr[3*j+2] = color;
766 switch (sc->depth) {
767 case 32:
768 addr[4*j+0] = bcmfb_palette[color].r;
769 addr[4*j+1] = bcmfb_palette[color].g;
770 addr[4*j+2] = bcmfb_palette[color].b;
771 addr[4*j+3] = bcmfb_palette[color].a;
772 break;
773 case 24:
774 addr[3*j] = bcmfb_palette[color].r;
775 addr[3*j+1] = bcmfb_palette[color].g;
776 addr[3*j+2] = bcmfb_palette[color].b;
777 break;
778 case 16:
779 rgb = (bcmfb_palette[color].r >> 3) << 10;
780 rgb |= (bcmfb_palette[color].g >> 3) << 5;
781 rgb |= (bcmfb_palette[color].b >> 3);
782 addr[2*j] = (rgb >> 8) & 0xff;
783 addr[2*j + 1] = rgb & 0xff;
784 default:
785 /* Not supported yet */
786 break;
787 }
670 }
671
672 addr += (sc->stride);
673 }
674
675 return (0);
676}
677
678static int
679bcmfb_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, int len)
680{
681 int i;
682
683 for (i = 0; i < len; i++)
684 bcmfb_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8);
685
686 return (0);
687}
688
689static int
690bcmfb_putm(video_adapter_t *adp, int x, int y, uint8_t *pixel_image,
691 uint32_t pixel_mask, int size, int width)
692{
693
694 return (0);
695}
696
697/*
698 * Define a stub keyboard driver in case one hasn't been
699 * compiled into the kernel
700 */
701#include <sys/kbio.h>
702#include <dev/kbd/kbdreg.h>
703
704static int dummy_kbd_configure(int flags);
705
706keyboard_switch_t bcmdummysw;
707
708static int
709dummy_kbd_configure(int flags)
710{
711
712 return (0);
713}
714KEYBOARD_DRIVER(bcmdummy, bcmdummysw, dummy_kbd_configure);
788 }
789
790 addr += (sc->stride);
791 }
792
793 return (0);
794}
795
796static int
797bcmfb_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, int len)
798{
799 int i;
800
801 for (i = 0; i < len; i++)
802 bcmfb_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8);
803
804 return (0);
805}
806
807static int
808bcmfb_putm(video_adapter_t *adp, int x, int y, uint8_t *pixel_image,
809 uint32_t pixel_mask, int size, int width)
810{
811
812 return (0);
813}
814
815/*
816 * Define a stub keyboard driver in case one hasn't been
817 * compiled into the kernel
818 */
819#include <sys/kbio.h>
820#include <dev/kbd/kbdreg.h>
821
822static int dummy_kbd_configure(int flags);
823
824keyboard_switch_t bcmdummysw;
825
826static int
827dummy_kbd_configure(int flags)
828{
829
830 return (0);
831}
832KEYBOARD_DRIVER(bcmdummy, bcmdummysw, dummy_kbd_configure);