creator.c (167308) | creator.c (170840) |
---|---|
1/*- 2 * Copyright (c) 2003 Jake Burkholder. 3 * Copyright (c) 2005 - 2006 Marius Strobl <marius@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003 Jake Burkholder. 3 * Copyright (c) 2005 - 2006 Marius Strobl <marius@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/fb/creator.c 167308 2007-03-07 21:13:51Z marius $"); | 29__FBSDID("$FreeBSD: head/sys/dev/fb/creator.c 170840 2007-06-16 21:48:50Z marius $"); |
30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/bus.h> 34#include <sys/conf.h> 35#include <sys/consio.h> 36#include <sys/fbio.h> 37#include <sys/kernel.h> --- 8 unchanged lines hidden (view full) --- 46#include <machine/ofw_machdep.h> 47#include <machine/resource.h> 48#include <machine/sc_machdep.h> 49 50#include <sys/rman.h> 51 52#include <dev/fb/fbreg.h> 53#include <dev/fb/creatorreg.h> | 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/bus.h> 34#include <sys/conf.h> 35#include <sys/consio.h> 36#include <sys/fbio.h> 37#include <sys/kernel.h> --- 8 unchanged lines hidden (view full) --- 46#include <machine/ofw_machdep.h> 47#include <machine/resource.h> 48#include <machine/sc_machdep.h> 49 50#include <sys/rman.h> 51 52#include <dev/fb/fbreg.h> 53#include <dev/fb/creatorreg.h> |
54#include <dev/fb/gallant12x22.h> | 54#include <dev/fb/gfb.h> |
55#include <dev/syscons/syscons.h> 56 57#define CREATOR_DRIVER_NAME "creator" 58 59struct creator_softc { 60 video_adapter_t sc_va; /* XXX must be first */ 61 62 phandle_t sc_node; --- 5 unchanged lines hidden (view full) --- 68 bus_space_handle_t sc_bh[FFB_NREG]; 69 70 int sc_height; 71 int sc_width; 72 73 int sc_xmargin; 74 int sc_ymargin; 75 | 55#include <dev/syscons/syscons.h> 56 57#define CREATOR_DRIVER_NAME "creator" 58 59struct creator_softc { 60 video_adapter_t sc_va; /* XXX must be first */ 61 62 phandle_t sc_node; --- 5 unchanged lines hidden (view full) --- 68 bus_space_handle_t sc_bh[FFB_NREG]; 69 70 int sc_height; 71 int sc_width; 72 73 int sc_xmargin; 74 int sc_ymargin; 75 |
76 u_char *sc_font; | 76 const u_char *sc_font; |
77 78 int sc_bg_cache; 79 int sc_fg_cache; 80 int sc_fifo_cache; 81 int sc_fontinc_cache; 82 int sc_fontw_cache; 83 int sc_pmask_cache; 84 --- 63 unchanged lines hidden (view full) --- 148 { FFB_VIRT_DAC, FFB_PHYS_DAC, FFB_SIZE_DAC }, 149 { FFB_VIRT_PROM, FFB_PHYS_PROM, FFB_SIZE_PROM }, 150 { FFB_VIRT_EXP, FFB_PHYS_EXP, FFB_SIZE_EXP }, 151}; 152 153#define CREATOR_FB_MAP_SIZE \ 154 (sizeof(creator_fb_map) / sizeof(creator_fb_map[0])) 155 | 77 78 int sc_bg_cache; 79 int sc_fg_cache; 80 int sc_fifo_cache; 81 int sc_fontinc_cache; 82 int sc_fontw_cache; 83 int sc_pmask_cache; 84 --- 63 unchanged lines hidden (view full) --- 148 { FFB_VIRT_DAC, FFB_PHYS_DAC, FFB_SIZE_DAC }, 149 { FFB_VIRT_PROM, FFB_PHYS_PROM, FFB_SIZE_PROM }, 150 { FFB_VIRT_EXP, FFB_PHYS_EXP, FFB_SIZE_EXP }, 151}; 152 153#define CREATOR_FB_MAP_SIZE \ 154 (sizeof(creator_fb_map) / sizeof(creator_fb_map[0])) 155 |
156extern const struct gfb_font gallant12x22; 157 |
|
156static struct creator_softc creator_softc; 157static struct bus_space_tag creator_bst_store[FFB_FBC]; 158 159static device_probe_t creator_bus_probe; 160static device_attach_t creator_bus_attach; 161 162static device_method_t creator_bus_methods[] = { 163 DEVMETHOD(device_probe, creator_bus_probe), --- 317 unchanged lines hidden (view full) --- 481 if ((options = OF_finddevice("/options")) == -1) 482 return (ENXIO); 483 if (OF_getprop(options, "screen-#rows", buf, sizeof(buf)) == -1) 484 return (ENXIO); 485 vi->vi_height = strtol(buf, NULL, 10); 486 if (OF_getprop(options, "screen-#columns", buf, sizeof(buf)) == -1) 487 return (ENXIO); 488 vi->vi_width = strtol(buf, NULL, 10); | 158static struct creator_softc creator_softc; 159static struct bus_space_tag creator_bst_store[FFB_FBC]; 160 161static device_probe_t creator_bus_probe; 162static device_attach_t creator_bus_attach; 163 164static device_method_t creator_bus_methods[] = { 165 DEVMETHOD(device_probe, creator_bus_probe), --- 317 unchanged lines hidden (view full) --- 483 if ((options = OF_finddevice("/options")) == -1) 484 return (ENXIO); 485 if (OF_getprop(options, "screen-#rows", buf, sizeof(buf)) == -1) 486 return (ENXIO); 487 vi->vi_height = strtol(buf, NULL, 10); 488 if (OF_getprop(options, "screen-#columns", buf, sizeof(buf)) == -1) 489 return (ENXIO); 490 vi->vi_width = strtol(buf, NULL, 10); |
489 vi->vi_cwidth = 12; 490 vi->vi_cheight = 22; | 491 vi->vi_cwidth = gallant12x22.width; 492 vi->vi_cheight = gallant12x22.height; |
491 vi->vi_flags = V_INFO_COLOR; 492 vi->vi_mem_model = V_INFO_MM_OTHER; 493 | 493 vi->vi_flags = V_INFO_COLOR; 494 vi->vi_mem_model = V_INFO_MM_OTHER; 495 |
494 sc->sc_font = gallant12x22_data; | 496 sc->sc_font = gallant12x22.data; |
495 sc->sc_xmargin = (sc->sc_width - (vi->vi_width * vi->vi_cwidth)) / 2; 496 sc->sc_ymargin = (sc->sc_height - (vi->vi_height * vi->vi_cheight)) / 2; 497 498 creator_set_mode(adp, 0); 499 500 if (!(sc->sc_flags & CREATOR_AFB)) { 501 FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_DID); 502 if (((FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE) & --- 307 unchanged lines hidden (view full) --- 810 811 return (ENODEV); 812} 813 814static int 815creator_putc(video_adapter_t *adp, vm_offset_t off, u_int8_t c, u_int8_t a) 816{ 817 struct creator_softc *sc; | 497 sc->sc_xmargin = (sc->sc_width - (vi->vi_width * vi->vi_cwidth)) / 2; 498 sc->sc_ymargin = (sc->sc_height - (vi->vi_height * vi->vi_cheight)) / 2; 499 500 creator_set_mode(adp, 0); 501 502 if (!(sc->sc_flags & CREATOR_AFB)) { 503 FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_DID); 504 if (((FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE) & --- 307 unchanged lines hidden (view full) --- 812 813 return (ENODEV); 814} 815 816static int 817creator_putc(video_adapter_t *adp, vm_offset_t off, u_int8_t c, u_int8_t a) 818{ 819 struct creator_softc *sc; |
818 uint16_t *p; | 820 const uint16_t *p; |
819 int row; 820 int col; 821 int i; 822 823 sc = (struct creator_softc *)adp; 824 row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; 825 col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; | 821 int row; 822 int col; 823 int i; 824 825 sc = (struct creator_softc *)adp; 826 row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; 827 col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; |
826 p = (uint16_t *)sc->sc_font + (c * adp->va_info.vi_cheight); | 828 p = (const uint16_t *)sc->sc_font + (c * adp->va_info.vi_cheight); |
827 creator_ras_setfg(sc, creator_cmap[a & 0xf]); 828 creator_ras_setbg(sc, creator_cmap[(a >> 4) & 0xf]); 829 creator_ras_fifo_wait(sc, 1 + adp->va_info.vi_cheight); 830 FFB_WRITE(sc, FFB_FBC, FFB_FBC_FONTXY, 831 ((row + sc->sc_ymargin) << 16) | (col + sc->sc_xmargin)); 832 creator_ras_setfontw(sc, adp->va_info.vi_cwidth); 833 creator_ras_setfontinc(sc, 0x10000); 834 for (i = 0; i < adp->va_info.vi_cheight; i++) { --- 294 unchanged lines hidden --- | 829 creator_ras_setfg(sc, creator_cmap[a & 0xf]); 830 creator_ras_setbg(sc, creator_cmap[(a >> 4) & 0xf]); 831 creator_ras_fifo_wait(sc, 1 + adp->va_info.vi_cheight); 832 FFB_WRITE(sc, FFB_FBC, FFB_FBC_FONTXY, 833 ((row + sc->sc_ymargin) << 16) | (col + sc->sc_xmargin)); 834 creator_ras_setfontw(sc, adp->va_info.vi_cwidth); 835 creator_ras_setfontinc(sc, 0x10000); 836 for (i = 0; i < adp->va_info.vi_cheight; i++) { --- 294 unchanged lines hidden --- |