1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * Copyright (c) 1992-1998 S�ren Schmidt
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 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $Id: vga_isa.c,v 1.2 1999/02/05 11:52:08 yokota Exp $
30 */
31
32#include "vga.h"
33#include "opt_vga.h"
34#include "opt_fb.h"
35#include "opt_syscons.h" /* should be removed in the future, XXX */
36
37#if NVGA > 0
--- 9 unchanged lines hidden (view full) ---
47
48#include <machine/console.h>
49#include <machine/md_var.h>
50#include <machine/pc/bios.h>
51
52#include <dev/fb/fbreg.h>
53#include <dev/fb/vgareg.h>
54
55#ifndef __i386__
56#include <isa/isareg.h>
57#include <isa/isavar.h>
58#else
59#include <i386/isa/isa.h>
60#include <i386/isa/isa_device.h>
61#endif
62
63#define DRIVER_NAME "vga"
64
65/* cdev driver declaration */
66
67#define ISAVGA_UNIT(dev) minor(dev)
68#define ISAVGA_MKMINOR(unit) (unit)
69
70typedef struct isavga_softc {
71 video_adapter_t *adp;
72} isavga_softc_t;
73
74#ifndef __i386__
75
76#define ISAVGA_SOFTC(unit) \
77 ((isavga_softc_t *)devclass_get_softc(isavga_devclass, unit))
78
79devclass_t isavga_devclass;
80
81static int isavga_probe(device_t dev);
82static int isavga_attach(device_t dev);
--- 47 unchanged lines hidden (view full) ---
130 isavgaopen, isavgaclose, noread, nowrite, /* ?? */
131 isavgaioctl, nostop, nullreset, nodevtotty,
132 seltrue, nommap, NULL, DRIVER_NAME,
133 NULL, -1, nodump, nopsize,
134};
135
136#endif /* FB_INSTALL_CDEV */
137
138#ifndef __i386__
139
140static int
141isavga_probe(device_t dev)
142{
143 isavga_softc_t *sc;
144
145 device_set_desc(dev, "Generic ISA VGA");
146 sc = device_get_softc(dev);
--- 624 unchanged lines hidden (view full) ---
771}
772#endif /* VGA_NO_BIOS */
773
774static int
775verify_adapter(video_adapter_t *adp)
776{
777 vm_offset_t buf;
778 u_int16_t v;
779
780 buf = BIOS_PADDRTOVADDR(adp->va_window);
781 v = readw(buf);
782 writew(buf, 0xA55A);
783 if (readw(buf) != 0xA55A)
784 return 1;
785 writew(buf, v);
786
--- 285 unchanged lines hidden (view full) ---
1072 mode_map[adp->va_initial_mode] = adpstate.regs;
1073 rows_offset = 1;
1074#else /* VGA_NO_BIOS || VGA_NO_MODE_CHANGE */
1075 if (video_mode_ptr == NULL) {
1076 mode_map[adp->va_initial_mode] = adpstate.regs;
1077 rows_offset = 1;
1078 } else {
1079 /* discard the table if we are not familiar with it... */
1080 map_mode_table(mode_map, video_mode_ptr, M_VGA_CG320 + 1);
1081 mp = get_mode_param(adp->va_initial_mode);
1082 if (mp != NULL)
1083 bcopy(mp, adpstate2.regs, sizeof(adpstate2.regs));
1084 switch (comp_adpregs(adpstate.regs, mp)) {
1085 case COMP_IDENTICAL:
1086 /*
1087 * OK, this parameter table looks reasonably familiar
--- 45 unchanged lines hidden (view full) ---
1133#endif
1134 } else if (adp->va_type == KD_EGA) {
1135#if defined(VGA_NO_BIOS) || defined(VGA_NO_MODE_CHANGE)
1136 rows_offset = 1;
1137#else /* VGA_NO_BIOS || VGA_NO_MODE_CHANGE */
1138 if (video_mode_ptr == NULL) {
1139 rows_offset = 1;
1140 } else {
1141 map_mode_table(mode_map, video_mode_ptr, M_ENH_C80x25 + 1);
1142 /* XXX how can one validate the EGA table... */
1143 mp = get_mode_param(adp->va_initial_mode);
1144 if (mp != NULL) {
1145 adp->va_flags |= V_ADP_MODECHANGE;
1146#ifndef VGA_NO_FONT_LOADING
1147 adp->va_flags |= V_ADP_FONT;
1148#endif
--- 1086 unchanged lines hidden ---
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * Copyright (c) 1992-1998 S�ren Schmidt
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 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $Id: vga_isa.c,v 1.2 1999/02/05 11:52:08 yokota Exp $
30 */
31
32#include "vga.h"
33#include "opt_vga.h"
34#include "opt_fb.h"
35#include "opt_syscons.h" /* should be removed in the future, XXX */
36
37#if NVGA > 0
--- 9 unchanged lines hidden (view full) ---
47
48#include <machine/console.h>
49#include <machine/md_var.h>
50#include <machine/pc/bios.h>
51
52#include <dev/fb/fbreg.h>
53#include <dev/fb/vgareg.h>
54
55#ifndef __i386__
56#include <isa/isareg.h>
57#include <isa/isavar.h>
58#else
59#include <i386/isa/isa.h>
60#include <i386/isa/isa_device.h>
61#endif
62
63#define DRIVER_NAME "vga"
64
65/* cdev driver declaration */
66
67#define ISAVGA_UNIT(dev) minor(dev)
68#define ISAVGA_MKMINOR(unit) (unit)
69
70typedef struct isavga_softc {
71 video_adapter_t *adp;
72} isavga_softc_t;
73
74#ifndef __i386__
75
76#define ISAVGA_SOFTC(unit) \
77 ((isavga_softc_t *)devclass_get_softc(isavga_devclass, unit))
78
79devclass_t isavga_devclass;
80
81static int isavga_probe(device_t dev);
82static int isavga_attach(device_t dev);
--- 47 unchanged lines hidden (view full) ---
130 isavgaopen, isavgaclose, noread, nowrite, /* ?? */
131 isavgaioctl, nostop, nullreset, nodevtotty,
132 seltrue, nommap, NULL, DRIVER_NAME,
133 NULL, -1, nodump, nopsize,
134};
135
136#endif /* FB_INSTALL_CDEV */
137
138#ifndef __i386__
139
140static int
141isavga_probe(device_t dev)
142{
143 isavga_softc_t *sc;
144
145 device_set_desc(dev, "Generic ISA VGA");
146 sc = device_get_softc(dev);
--- 624 unchanged lines hidden (view full) ---
771}
772#endif /* VGA_NO_BIOS */
773
774static int
775verify_adapter(video_adapter_t *adp)
776{
777 vm_offset_t buf;
778 u_int16_t v;
779
780 buf = BIOS_PADDRTOVADDR(adp->va_window);
781 v = readw(buf);
782 writew(buf, 0xA55A);
783 if (readw(buf) != 0xA55A)
784 return 1;
785 writew(buf, v);
786
--- 285 unchanged lines hidden (view full) ---
1072 mode_map[adp->va_initial_mode] = adpstate.regs;
1073 rows_offset = 1;
1074#else /* VGA_NO_BIOS || VGA_NO_MODE_CHANGE */
1075 if (video_mode_ptr == NULL) {
1076 mode_map[adp->va_initial_mode] = adpstate.regs;
1077 rows_offset = 1;
1078 } else {
1079 /* discard the table if we are not familiar with it... */
1080 map_mode_table(mode_map, video_mode_ptr, M_VGA_CG320 + 1);
1081 mp = get_mode_param(adp->va_initial_mode);
1082 if (mp != NULL)
1083 bcopy(mp, adpstate2.regs, sizeof(adpstate2.regs));
1084 switch (comp_adpregs(adpstate.regs, mp)) {
1085 case COMP_IDENTICAL:
1086 /*
1087 * OK, this parameter table looks reasonably familiar
--- 45 unchanged lines hidden (view full) ---
1133#endif
1134 } else if (adp->va_type == KD_EGA) {
1135#if defined(VGA_NO_BIOS) || defined(VGA_NO_MODE_CHANGE)
1136 rows_offset = 1;
1137#else /* VGA_NO_BIOS || VGA_NO_MODE_CHANGE */
1138 if (video_mode_ptr == NULL) {
1139 rows_offset = 1;
1140 } else {
1141 map_mode_table(mode_map, video_mode_ptr, M_ENH_C80x25 + 1);
1142 /* XXX how can one validate the EGA table... */
1143 mp = get_mode_param(adp->va_initial_mode);
1144 if (mp != NULL) {
1145 adp->va_flags |= V_ADP_MODECHANGE;
1146#ifndef VGA_NO_FONT_LOADING
1147 adp->va_flags |= V_ADP_FONT;
1148#endif
--- 1086 unchanged lines hidden ---