Deleted Added
full compact
vga_isa.c (43674) vga_isa.c (45720)
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 *
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 $
29 * $Id: vga_isa.c,v 1.3 1999/02/05 12:58:32 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
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__
55#if 1
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
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__
74#if 1
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
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__
138#if 1
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;
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#if !defined(VGA_NO_BIOS) && !defined(VGA_NO_MODE_CHANGE)
780 u_int32_t p;
781#endif
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... */
782
783 buf = BIOS_PADDRTOVADDR(adp->va_window);
784 v = readw(buf);
785 writew(buf, 0xA55A);
786 if (readw(buf) != 0xA55A)
787 return 1;
788 writew(buf, v);
789

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

1075 mode_map[adp->va_initial_mode] = adpstate.regs;
1076 rows_offset = 1;
1077#else /* VGA_NO_BIOS || VGA_NO_MODE_CHANGE */
1078 if (video_mode_ptr == NULL) {
1079 mode_map[adp->va_initial_mode] = adpstate.regs;
1080 rows_offset = 1;
1081 } else {
1082 /* discard the table if we are not familiar with it... */
1083 u_char *mp;
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 {
1084 map_mode_table(mode_map, video_mode_ptr, M_VGA_CG320 + 1);
1085 mp = get_mode_param(adp->va_initial_mode);
1086 if (mp != NULL)
1087 bcopy(mp, adpstate2.regs, sizeof(adpstate2.regs));
1088 switch (comp_adpregs(adpstate.regs, mp)) {
1089 case COMP_IDENTICAL:
1090 /*
1091 * OK, this parameter table looks reasonably familiar

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

1137#endif
1138 } else if (adp->va_type == KD_EGA) {
1139#if defined(VGA_NO_BIOS) || defined(VGA_NO_MODE_CHANGE)
1140 rows_offset = 1;
1141#else /* VGA_NO_BIOS || VGA_NO_MODE_CHANGE */
1142 if (video_mode_ptr == NULL) {
1143 rows_offset = 1;
1144 } else {
1145 u_char *mp;
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 ---
1146 map_mode_table(mode_map, video_mode_ptr, M_ENH_C80x25 + 1);
1147 /* XXX how can one validate the EGA table... */
1148 mp = get_mode_param(adp->va_initial_mode);
1149 if (mp != NULL) {
1150 adp->va_flags |= V_ADP_MODECHANGE;
1151#ifndef VGA_NO_FONT_LOADING
1152 adp->va_flags |= V_ADP_FONT;
1153#endif

--- 1086 unchanged lines hidden ---