| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: lunafb.c,v 1.33 2014/07/18 18:17:54 tsutsui Exp $ */ | | 1 | /* $NetBSD: lunafb.c,v 1.34 2014/07/24 14:09:09 tsutsui Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Tohru Nishimura. | | 8 | * by Tohru Nishimura. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | | 32 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ |
33 | | | 33 | |
34 | __KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.33 2014/07/18 18:17:54 tsutsui Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.34 2014/07/24 14:09:09 tsutsui Exp $"); |
35 | | | 35 | |
36 | #include <sys/param.h> | | 36 | #include <sys/param.h> |
37 | #include <sys/systm.h> | | 37 | #include <sys/systm.h> |
38 | #include <sys/conf.h> | | 38 | #include <sys/conf.h> |
39 | #include <sys/device.h> | | 39 | #include <sys/device.h> |
40 | #include <sys/ioctl.h> | | 40 | #include <sys/ioctl.h> |
41 | #include <sys/kmem.h> | | 41 | #include <sys/kmem.h> |
42 | #include <sys/mman.h> | | 42 | #include <sys/mman.h> |
43 | #include <sys/proc.h> | | 43 | #include <sys/proc.h> |
44 | #include <sys/tty.h> | | 44 | #include <sys/tty.h> |
45 | #include <sys/errno.h> | | 45 | #include <sys/errno.h> |
46 | #include <sys/buf.h> | | 46 | #include <sys/buf.h> |
47 | | | 47 | |
| @@ -116,27 +116,27 @@ struct om_hwdevconfig { | | | @@ -116,27 +116,27 @@ struct om_hwdevconfig { |
116 | int dc_wid; /* width of frame buffer */ | | 116 | int dc_wid; /* width of frame buffer */ |
117 | int dc_ht; /* height of frame buffer */ | | 117 | int dc_ht; /* height of frame buffer */ |
118 | int dc_depth; /* depth, bits per pixel */ | | 118 | int dc_depth; /* depth, bits per pixel */ |
119 | int dc_rowbytes; /* bytes in a FB scan line */ | | 119 | int dc_rowbytes; /* bytes in a FB scan line */ |
120 | int dc_cmsize; /* colormap size */ | | 120 | int dc_cmsize; /* colormap size */ |
121 | struct hwcmap dc_cmap; /* software copy of colormap */ | | 121 | struct hwcmap dc_cmap; /* software copy of colormap */ |
122 | vaddr_t dc_videobase; /* base of flat frame buffer */ | | 122 | vaddr_t dc_videobase; /* base of flat frame buffer */ |
123 | struct rasops_info dc_ri; /* raster blitter variables */ | | 123 | struct rasops_info dc_ri; /* raster blitter variables */ |
124 | }; | | 124 | }; |
125 | | | 125 | |
126 | struct omfb_softc { | | 126 | struct omfb_softc { |
127 | device_t sc_dev; /* base device */ | | 127 | device_t sc_dev; /* base device */ |
128 | struct om_hwdevconfig *sc_dc; /* device configuration */ | | 128 | struct om_hwdevconfig *sc_dc; /* device configuration */ |
129 | int nscreens; | | 129 | int sc_nscreens; |
130 | }; | | 130 | }; |
131 | | | 131 | |
132 | static int omgetcmap(struct omfb_softc *, struct wsdisplay_cmap *); | | 132 | static int omgetcmap(struct omfb_softc *, struct wsdisplay_cmap *); |
133 | static int omsetcmap(struct omfb_softc *, struct wsdisplay_cmap *); | | 133 | static int omsetcmap(struct omfb_softc *, struct wsdisplay_cmap *); |
134 | | | 134 | |
135 | static struct om_hwdevconfig omfb_console_dc; | | 135 | static struct om_hwdevconfig omfb_console_dc; |
136 | static void omfb_getdevconfig(paddr_t, struct om_hwdevconfig *); | | 136 | static void omfb_getdevconfig(paddr_t, struct om_hwdevconfig *); |
137 | | | 137 | |
138 | static struct wsscreen_descr omfb_stdscreen = { | | 138 | static struct wsscreen_descr omfb_stdscreen = { |
139 | .name = "std" | | 139 | .name = "std" |
140 | }; | | 140 | }; |
141 | | | 141 | |
142 | static const struct wsscreen_descr *_omfb_scrlist[] = { | | 142 | static const struct wsscreen_descr *_omfb_scrlist[] = { |
| @@ -194,27 +194,27 @@ omfbmatch(device_t parent, cfdata_t cf, | | | @@ -194,27 +194,27 @@ omfbmatch(device_t parent, cfdata_t cf, |
194 | return 1; | | 194 | return 1; |
195 | } | | 195 | } |
196 | | | 196 | |
197 | static void | | 197 | static void |
198 | omfbattach(device_t parent, device_t self, void *args) | | 198 | omfbattach(device_t parent, device_t self, void *args) |
199 | { | | 199 | { |
200 | struct omfb_softc *sc = device_private(self); | | 200 | struct omfb_softc *sc = device_private(self); |
201 | struct wsemuldisplaydev_attach_args waa; | | 201 | struct wsemuldisplaydev_attach_args waa; |
202 | | | 202 | |
203 | sc->sc_dev = self; | | 203 | sc->sc_dev = self; |
204 | | | 204 | |
205 | if (omfb_console) { | | 205 | if (omfb_console) { |
206 | sc->sc_dc = &omfb_console_dc; | | 206 | sc->sc_dc = &omfb_console_dc; |
207 | sc->nscreens = 1; | | 207 | sc->sc_nscreens = 1; |
208 | } else { | | 208 | } else { |
209 | sc->sc_dc = kmem_zalloc(sizeof(struct om_hwdevconfig), | | 209 | sc->sc_dc = kmem_zalloc(sizeof(struct om_hwdevconfig), |
210 | KM_SLEEP); | | 210 | KM_SLEEP); |
211 | omfb_getdevconfig(OMFB_FB_WADDR, sc->sc_dc); | | 211 | omfb_getdevconfig(OMFB_FB_WADDR, sc->sc_dc); |
212 | } | | 212 | } |
213 | aprint_normal(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht, | | 213 | aprint_normal(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht, |
214 | sc->sc_dc->dc_depth); | | 214 | sc->sc_dc->dc_depth); |
215 | | | 215 | |
216 | waa.console = omfb_console; | | 216 | waa.console = omfb_console; |
217 | waa.scrdata = &omfb_screenlist; | | 217 | waa.scrdata = &omfb_screenlist; |
218 | waa.accessops = &omfb_accessops; | | 218 | waa.accessops = &omfb_accessops; |
219 | waa.accesscookie = sc; | | 219 | waa.accesscookie = sc; |
220 | | | 220 | |
| @@ -487,42 +487,42 @@ omfb_getdevconfig(paddr_t paddr, struct | | | @@ -487,42 +487,42 @@ omfb_getdevconfig(paddr_t paddr, struct |
487 | omfb_stdscreen.textops = &ri->ri_ops; | | 487 | omfb_stdscreen.textops = &ri->ri_ops; |
488 | omfb_stdscreen.capabilities = ri->ri_caps; | | 488 | omfb_stdscreen.capabilities = ri->ri_caps; |
489 | omfb_stdscreen.fontwidth = ri->ri_font->fontwidth; | | 489 | omfb_stdscreen.fontwidth = ri->ri_font->fontwidth; |
490 | omfb_stdscreen.fontheight = ri->ri_font->fontheight; | | 490 | omfb_stdscreen.fontheight = ri->ri_font->fontheight; |
491 | } | | 491 | } |
492 | | | 492 | |
493 | static int | | 493 | static int |
494 | omfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, | | 494 | omfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, |
495 | int *curxp, int *curyp, long *attrp) | | 495 | int *curxp, int *curyp, long *attrp) |
496 | { | | 496 | { |
497 | struct omfb_softc *sc = v; | | 497 | struct omfb_softc *sc = v; |
498 | struct rasops_info *ri = &sc->sc_dc->dc_ri; | | 498 | struct rasops_info *ri = &sc->sc_dc->dc_ri; |
499 | | | 499 | |
500 | if (sc->nscreens > 0) | | 500 | if (sc->sc_nscreens > 0) |
501 | return ENOMEM; | | 501 | return ENOMEM; |
502 | | | 502 | |
503 | *cookiep = ri; | | 503 | *cookiep = ri; |
504 | *curxp = 0; | | 504 | *curxp = 0; |
505 | *curyp = 0; | | 505 | *curyp = 0; |
506 | (*ri->ri_ops.allocattr)(ri, 0, 0, 0, attrp); | | 506 | (*ri->ri_ops.allocattr)(ri, 0, 0, 0, attrp); |
507 | sc->nscreens++; | | 507 | sc->sc_nscreens++; |
508 | return 0; | | 508 | return 0; |
509 | } | | 509 | } |
510 | | | 510 | |
511 | static void | | 511 | static void |
512 | omfb_free_screen(void *v, void *cookie) | | 512 | omfb_free_screen(void *v, void *cookie) |
513 | { | | 513 | { |
514 | struct omfb_softc *sc = v; | | 514 | struct omfb_softc *sc = v; |
515 | | | 515 | |
516 | if (sc->sc_dc == &omfb_console_dc) | | 516 | if (sc->sc_dc == &omfb_console_dc) |
517 | panic("omfb_free_screen: console"); | | 517 | panic("omfb_free_screen: console"); |
518 | | | 518 | |
519 | sc->nscreens--; | | 519 | sc->sc_nscreens--; |
520 | } | | 520 | } |
521 | | | 521 | |
522 | static int | | 522 | static int |
523 | omfb_show_screen(void *v, void *cookie, int waitok, | | 523 | omfb_show_screen(void *v, void *cookie, int waitok, |
524 | void (*cb)(void *, int, int), void *cbarg) | | 524 | void (*cb)(void *, int, int), void *cbarg) |
525 | { | | 525 | { |
526 | | | 526 | |
527 | return 0; | | 527 | return 0; |
528 | } | | 528 | } |