Deleted Added
full compact
machfb.c (150686) machfb.c (170840)
1/*-
2 * Copyright (c) 2002 Bang Jun-Young
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

--- 41 unchanged lines hidden (view full) ---

50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * SUCH DAMAGE.
55 */
56
57#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002 Bang Jun-Young
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

--- 41 unchanged lines hidden (view full) ---

50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * SUCH DAMAGE.
55 */
56
57#include <sys/cdefs.h>
58__FBSDID("$FreeBSD: head/sys/dev/fb/machfb.c 150686 2005-09-28 14:54:07Z marius $");
58__FBSDID("$FreeBSD: head/sys/dev/fb/machfb.c 170840 2007-06-16 21:48:50Z marius $");
59
60/*
61 * Driver for ATI Mach64 graphics chips. Some code is derived from the
62 * ATI Rage Pro and Derivatives Programmer's Guide.
63 */
64
65#include <sys/param.h>
66#include <sys/systm.h>

--- 12 unchanged lines hidden (view full) ---

79#include <machine/bus_private.h>
80#include <machine/ofw_machdep.h>
81#include <machine/resource.h>
82#include <machine/sc_machdep.h>
83
84#include <sys/rman.h>
85
86#include <dev/fb/fbreg.h>
59
60/*
61 * Driver for ATI Mach64 graphics chips. Some code is derived from the
62 * ATI Rage Pro and Derivatives Programmer's Guide.
63 */
64
65#include <sys/param.h>
66#include <sys/systm.h>

--- 12 unchanged lines hidden (view full) ---

79#include <machine/bus_private.h>
80#include <machine/ofw_machdep.h>
81#include <machine/resource.h>
82#include <machine/sc_machdep.h>
83
84#include <sys/rman.h>
85
86#include <dev/fb/fbreg.h>
87#include <dev/fb/gallant12x22.h>
87#include <dev/fb/gfb.h>
88#include <dev/fb/machfbreg.h>
89#include <dev/pci/pcivar.h>
90#include <dev/pci/pcireg.h>
91#include <dev/syscons/syscons.h>
92
93/* #define MACHFB_DEBUG */
94
95#define MACHFB_DRIVER_NAME "machfb"

--- 34 unchanged lines hidden (view full) ---

130 int sc_mem_freq;
131 int sc_ramdac_freq;
132 int sc_ref_freq;
133
134 int sc_ref_div;
135 int sc_mclk_post_div;
136 int sc_mclk_fb_div;
137
88#include <dev/fb/machfbreg.h>
89#include <dev/pci/pcivar.h>
90#include <dev/pci/pcireg.h>
91#include <dev/syscons/syscons.h>
92
93/* #define MACHFB_DEBUG */
94
95#define MACHFB_DRIVER_NAME "machfb"

--- 34 unchanged lines hidden (view full) ---

130 int sc_mem_freq;
131 int sc_ramdac_freq;
132 int sc_ref_freq;
133
134 int sc_ref_div;
135 int sc_mclk_post_div;
136 int sc_mclk_fb_div;
137
138 u_char *sc_font;
138 const u_char *sc_font;
139 int sc_cbwidth;
140 vm_offset_t sc_curoff;
141
142 int sc_bg_cache;
143 int sc_fg_cache;
144 int sc_draw_cache;
145#define MACHFB_DRAW_CHAR (1 << 0)
146#define MACHFB_DRAW_FILLRECT (1 << 1)

--- 101 unchanged lines hidden (view full) ---

248 0xa8, 0x28, 0x88, 0x08, 0xa0, 0x20, 0x80, 0x00
249};
250
251static const char *machfb_memtype_names[] = {
252 "(N/A)", "DRAM", "EDO DRAM", "EDO DRAM", "SDRAM", "SGRAM", "WRAM",
253 "(unknown type)"
254};
255
139 int sc_cbwidth;
140 vm_offset_t sc_curoff;
141
142 int sc_bg_cache;
143 int sc_fg_cache;
144 int sc_draw_cache;
145#define MACHFB_DRAW_CHAR (1 << 0)
146#define MACHFB_DRAW_FILLRECT (1 << 1)

--- 101 unchanged lines hidden (view full) ---

248 0xa8, 0x28, 0x88, 0x08, 0xa0, 0x20, 0x80, 0x00
249};
250
251static const char *machfb_memtype_names[] = {
252 "(N/A)", "DRAM", "EDO DRAM", "EDO DRAM", "SDRAM", "SGRAM", "WRAM",
253 "(unknown type)"
254};
255
256extern const struct gfb_font gallant12x22;
257
256static struct machfb_softc machfb_softc;
257static struct bus_space_tag machfb_bst_store[1];
258
259static device_probe_t machfb_pci_probe;
260static device_attach_t machfb_pci_attach;
261static device_detach_t machfb_pci_detach;
262
263static device_method_t machfb_methods[] = {

--- 318 unchanged lines hidden (view full) ---

582 if ((options = OF_finddevice("/options")) == -1)
583 return (ENXIO);
584 if (OF_getprop(options, "screen-#rows", buf, sizeof(buf)) == -1)
585 return (ENXIO);
586 vi->vi_height = strtol(buf, NULL, 10);
587 if (OF_getprop(options, "screen-#columns", buf, sizeof(buf)) == -1)
588 return (ENXIO);
589 vi->vi_width = strtol(buf, NULL, 10);
258static struct machfb_softc machfb_softc;
259static struct bus_space_tag machfb_bst_store[1];
260
261static device_probe_t machfb_pci_probe;
262static device_attach_t machfb_pci_attach;
263static device_detach_t machfb_pci_detach;
264
265static device_method_t machfb_methods[] = {

--- 318 unchanged lines hidden (view full) ---

584 if ((options = OF_finddevice("/options")) == -1)
585 return (ENXIO);
586 if (OF_getprop(options, "screen-#rows", buf, sizeof(buf)) == -1)
587 return (ENXIO);
588 vi->vi_height = strtol(buf, NULL, 10);
589 if (OF_getprop(options, "screen-#columns", buf, sizeof(buf)) == -1)
590 return (ENXIO);
591 vi->vi_width = strtol(buf, NULL, 10);
590 vi->vi_cwidth = 12;
591 vi->vi_cheight = 22;
592 vi->vi_cwidth = gallant12x22.width;
593 vi->vi_cheight = gallant12x22.height;
592 vi->vi_flags = V_INFO_COLOR;
593 vi->vi_mem_model = V_INFO_MM_OTHER;
594
594 vi->vi_flags = V_INFO_COLOR;
595 vi->vi_mem_model = V_INFO_MM_OTHER;
596
595 sc->sc_font = gallant12x22_data;
596 sc->sc_cbwidth = howmany(vi->vi_cwidth, 8); /* width in bytes */
597 sc->sc_font = gallant12x22.data;
598 sc->sc_cbwidth = howmany(vi->vi_cwidth, NBBY); /* width in bytes */
597 sc->sc_xmargin = (sc->sc_width - (vi->vi_width * vi->vi_cwidth)) / 2;
598 sc->sc_ymargin = (sc->sc_height - (vi->vi_height * vi->vi_cheight)) / 2;
599
600 if (sc->sc_chip_id != ATI_MACH64_CT &&
601 !((sc->sc_chip_id == ATI_MACH64_VT ||
602 sc->sc_chip_id == ATI_RAGE_II) &&
603 (sc->sc_chip_rev & 0x07) == 0))
604 sc->sc_flags |= MACHFB_DSP;

--- 417 unchanged lines hidden (view full) ---

1022
1023 return (ENODEV);
1024}
1025
1026static int
1027machfb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a)
1028{
1029 struct machfb_softc *sc;
599 sc->sc_xmargin = (sc->sc_width - (vi->vi_width * vi->vi_cwidth)) / 2;
600 sc->sc_ymargin = (sc->sc_height - (vi->vi_height * vi->vi_cheight)) / 2;
601
602 if (sc->sc_chip_id != ATI_MACH64_CT &&
603 !((sc->sc_chip_id == ATI_MACH64_VT ||
604 sc->sc_chip_id == ATI_RAGE_II) &&
605 (sc->sc_chip_rev & 0x07) == 0))
606 sc->sc_flags |= MACHFB_DSP;

--- 417 unchanged lines hidden (view full) ---

1024
1025 return (ENODEV);
1026}
1027
1028static int
1029machfb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a)
1030{
1031 struct machfb_softc *sc;
1030 uint8_t *p;
1032 const uint8_t *p;
1031 int i;
1032
1033 sc = (struct machfb_softc *)adp;
1034
1035 if (sc->sc_draw_cache != MACHFB_DRAW_CHAR) {
1036 wait_for_fifo(sc, 8);
1037 regw(sc, DP_WRITE_MASK, 0xff); /* XXX only good for 8 bit */
1038 regw(sc, DP_PIX_WIDTH, DST_8BPP | SRC_1BPP | HOST_1BPP);

--- 546 unchanged lines hidden ---
1033 int i;
1034
1035 sc = (struct machfb_softc *)adp;
1036
1037 if (sc->sc_draw_cache != MACHFB_DRAW_CHAR) {
1038 wait_for_fifo(sc, 8);
1039 regw(sc, DP_WRITE_MASK, 0xff); /* XXX only good for 8 bit */
1040 regw(sc, DP_PIX_WIDTH, DST_8BPP | SRC_1BPP | HOST_1BPP);

--- 546 unchanged lines hidden ---