1 /* $NetBSD: gdium_genfb.c,v 1.2 2009/08/06 16:37:01 matt Exp $ */
4 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
7 * Author: Chris G. Demetriou
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
30 #include <sys/cdefs.h>
31 __KERNEL_RCSID(0, "$NetBSD: gdium_genfb.c,v 1.2 2009/08/06 16:37:01 matt Exp $");
33 #include <sys/param.h>
36 #include <sys/device.h>
37 #include <sys/ioctl.h>
38 #include <sys/kernel.h>
39 #include <sys/malloc.h>
40 #include <sys/systm.h>
42 #include <machine/bus.h>
44 #include <dev/wscons/wsconsio.h>
45 #include <dev/wscons/wsdisplayvar.h>
46 #include <dev/rasops/rasops.h>
47 #include <dev/wsfont/wsfont.h>
48 #include <dev/wscons/wsdisplay_vconsvar.h>
50 #include <mips/bonito/bonitoreg.h>
51 #include <evbmips/gdium/gdiumvar.h>
52 #include <dev/pci/pcireg.h>
53 #include <dev/pci/pcivar.h>
55 #include "wsdisplay.h"
57 /* we need a wsdisplay to do anything halfway useful */
60 static struct vcons_screen gdium_console_screen
;
62 static struct wsscreen_descr gdium_stdscreen
= {
67 gdium_cnattach(struct gdium_config
*gc
)
69 struct rasops_info
* const ri
= &gdium_console_screen
.scr_ri
;
79 ri
->ri_stride
= 0x800;
81 /* read the mapping register for the frame buffer */
82 reg
= pci_conf_read(&gc
->gc_pc
, pci_make_tag(&gc
->gc_pc
, 0, 14, 0),
85 ri
->ri_bits
= (char *)MIPS_PHYS_TO_KSEG1(BONITO_PCILO_BASE
+ reg
);
86 ri
->ri_flg
= RI_CENTER
;
88 memset(ri
->ri_bits
, 0, 0x200000);
90 /* use as much of the screen as the font permits */
91 rasops_init(ri
, 30, 80);
93 rasops_reconfig(ri
, ri
->ri_height
/ ri
->ri_font
->fontheight
,
94 ri
->ri_width
/ ri
->ri_font
->fontwidth
);
96 gdium_stdscreen
.nrows
= ri
->ri_rows
;
97 gdium_stdscreen
.ncols
= ri
->ri_cols
;
98 gdium_stdscreen
.textops
= &ri
->ri_ops
;
99 gdium_stdscreen
.capabilities
= ri
->ri_caps
;
101 ri
->ri_ops
.allocattr(ri
, 0, ri
->ri_rows
- 1, 0, &defattr
);
103 wsdisplay_preattach(&gdium_stdscreen
, ri
, 0, 0, defattr
);
107 #else /* NWSDISPLAY > 0 */
109 gdium_cnattach(struct gdium_config
*gc
)