Deleted Added
full compact
gdc.c (44421) gdc.c (45783)
1/*
2 * Copyright (c) 1999 FreeBSD(98) port team.
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

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

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*
2 * Copyright (c) 1999 FreeBSD(98) port team.
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

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

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $Id: pc98gdc.c,v 1.5 1999/02/06 09:30:19 kato Exp $
28 * $Id: pc98gdc.c,v 1.6 1999/03/02 12:34:24 kato Exp $
29 */
30
31#include "gdc.h"
32#include "opt_gdc.h"
33#include "opt_fb.h"
34#include "opt_syscons.h"
35
36#if NGDC > 0

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

47#include <machine/console.h>
48#include <machine/md_var.h>
49#include <machine/pc/bios.h>
50
51#include <dev/fb/fbreg.h>
52
53#include <pc98/pc98/pc98.h>
54#include <pc98/pc98/pc98_machdep.h>
29 */
30
31#include "gdc.h"
32#include "opt_gdc.h"
33#include "opt_fb.h"
34#include "opt_syscons.h"
35
36#if NGDC > 0

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

47#include <machine/console.h>
48#include <machine/md_var.h>
49#include <machine/pc/bios.h>
50
51#include <dev/fb/fbreg.h>
52
53#include <pc98/pc98/pc98.h>
54#include <pc98/pc98/pc98_machdep.h>
55#include <isa/isavar.h>
55
56
56#include <i386/isa/isa_device.h>
57
58#define TEXT_GDC IO_GDC1 /* 0x60 */
59#define ROW 25
60#define COL 80
61
62#define DRIVER_NAME "gdc"
63
64/* cdev driver declaration */
65
66#define GDC_UNIT(dev) minor(dev)
67#define GDC_MKMINOR(unit) (unit)
68
57#define TEXT_GDC IO_GDC1 /* 0x60 */
58#define ROW 25
59#define COL 80
60
61#define DRIVER_NAME "gdc"
62
63/* cdev driver declaration */
64
65#define GDC_UNIT(dev) minor(dev)
66#define GDC_MKMINOR(unit) (unit)
67
69static int gdcprobe(struct isa_device *dev);
70static int gdc_attach(struct isa_device *dev);
68typedef struct gdc_softc {
69 video_adapter_t *adp;
70} gdc_softc_t;
71
71
72struct isa_driver gdcdriver = {
73 gdcprobe,
74 gdc_attach,
72#define GDC_SOFTC(unit) \
73 ((gdc_softc_t *)devclass_get_softc(gdc_devclass, unit))
74
75devclass_t gdc_devclass;
76
77static int gdcprobe(device_t dev);
78static int gdc_attach(device_t dev);
79
80static device_method_t gdc_methods[] = {
81 DEVMETHOD(device_probe, gdcprobe),
82 DEVMETHOD(device_attach, gdc_attach),
83 { 0, 0 }
84};
85
86static driver_t gdcdriver = {
75 DRIVER_NAME,
87 DRIVER_NAME,
76 0,
88 gdc_methods,
89 DRIVER_TYPE_TTY,
90 sizeof(gdc_softc_t),
77};
78
91};
92
79typedef struct gdc_softc {
80 video_adapter_t *adp;
81} gdc_softc_t;
93DRIVER_MODULE(gdc, isa, gdcdriver, gdc_devclass, 0, 0);
82
83static int gdc_probe_unit(int unit, gdc_softc_t *sc, int flags);
84static int gdc_attach_unit(int unit, gdc_softc_t *sc, int flags);
85
94
95static int gdc_probe_unit(int unit, gdc_softc_t *sc, int flags);
96static int gdc_attach_unit(int unit, gdc_softc_t *sc, int flags);
97
86#define GDC_SOFTC(unit) (gdc_softc[unit])
87
88static gdc_softc_t *gdc_softc[NGDC];
89
90#if FB_INSTALL_CDEV
91
92static d_open_t gdcopen;
93static d_close_t gdcclose;
94static d_read_t gdcread;
95static d_ioctl_t gdcioctl;
96
97static struct cdevsw vga_cdevsw = {
98 gdcopen, gdcclose, noread, nowrite, /* ?? */
99 gdcioctl, nostop, nullreset, nodevtotty,
100 seltrue, nommap, NULL, DRIVER_NAME,
101 NULL, -1, nodump, nopsize,
102};
103
104#endif /* FB_INSTALL_CDEV */
105
106static int
98#if FB_INSTALL_CDEV
99
100static d_open_t gdcopen;
101static d_close_t gdcclose;
102static d_read_t gdcread;
103static d_ioctl_t gdcioctl;
104
105static struct cdevsw vga_cdevsw = {
106 gdcopen, gdcclose, noread, nowrite, /* ?? */
107 gdcioctl, nostop, nullreset, nodevtotty,
108 seltrue, nommap, NULL, DRIVER_NAME,
109 NULL, -1, nodump, nopsize,
110};
111
112#endif /* FB_INSTALL_CDEV */
113
114static int
107gdcprobe(struct isa_device *dev)
115gdcprobe(device_t dev)
108{
109 gdc_softc_t *sc;
116{
117 gdc_softc_t *sc;
110 int error;
111
118
112 if (dev->id_unit >= sizeof(gdc_softc)/sizeof(gdc_softc[0]))
113 return 0;
114 sc = gdc_softc[dev->id_unit]
115 = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
116 if (sc == NULL)
117 return 0;
118
119 error = gdc_probe_unit(dev->id_unit, sc, dev->id_flags);
120 if (error) {
121 gdc_softc[dev->id_unit] = NULL;
122 free(sc, M_DEVBUF);
123 return 0;
124 }
125
126 dev->id_iobase = sc->adp->va_io_base;
127 dev->id_maddr = (caddr_t)BIOS_PADDRTOVADDR(sc->adp->va_mem_base);
128 dev->id_msize = sc->adp->va_mem_size;
129
130 return sc->adp->va_io_size;
119 device_set_desc(dev, "Generic GDC");
120 sc = device_get_softc(dev);
121 return gdc_probe_unit(device_get_unit(dev), sc, isa_get_flags(dev));
131}
132
133static int
122}
123
124static int
134gdc_attach(struct isa_device *dev)
125gdc_attach(device_t dev)
135{
136 gdc_softc_t *sc;
137
126{
127 gdc_softc_t *sc;
128
138 if (dev->id_unit >= sizeof(gdc_softc)/sizeof(gdc_softc[0]))
139 return 0;
140 sc = gdc_softc[dev->id_unit];
141 if (sc == NULL)
142 return 0;
143
144 return ((gdc_attach_unit(dev->id_unit, sc, dev->id_flags)) ? 0 : 1);
129 sc = device_get_softc(dev);
130 return gdc_attach_unit(device_get_unit(dev), sc, isa_get_flags(dev));
145}
146
147static int
148gdc_probe_unit(int unit, gdc_softc_t *sc, int flags)
149{
150 video_switch_t *sw;
151
152 bzero(sc, sizeof(*sc));

--- 769 unchanged lines hidden ---
131}
132
133static int
134gdc_probe_unit(int unit, gdc_softc_t *sc, int flags)
135{
136 video_switch_t *sw;
137
138 bzero(sc, sizeof(*sc));

--- 769 unchanged lines hidden ---