mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
Make pcvt and syscons live in the same kernel. If both are enabled, then
the first one in the config has priority. They can be switched using userconfig(). i386/i386/conf.c: Initialize the shared syscons/pcvt cdevsw entry to `nx'. Add cdevsw registration functions. Use devsw functions of the correct type if they exist. i386/i386/cons.c: Add renamed syscons entry points to constab. i386/i386/cons.h: Declare the renamed syscons entry points. i386/i386/machdep.c: Repeat console initialization after userconfig() in case the current console has become wrong. This depends on cn functions not wiring down anything important. sys/conf.h: Declare new functions. i386/isa/isa.[ch]: Add a function to decide which display driver has priority. Should be done better. i386/isa/syscons.c: Rename pccn* -> sccn*. Initialize CRTC start address in case the previous driver has moved it. i386/isa/syscons.c, i386/isa/pcvt/* Initialize the bogusly shared variable Crtat dynamically in case the stored value was changed by the previous driver. Initialize cdevsw table from a template. Don't grab the console if another display driver has priority. i386/isa/syscons.h, i386/isa/pcvt/pcvt_hdr.h: Don't externally declare now-static cdevsw functions. i386/isa/pcvt/pcvt_hdr.h: Set the sensitive hardware flag so that pcvt doesn't always have lower priority than syscons. This also fixes the "stupid" detection of the display after filling the display with text. i386/isa/pcvt/pcvt_out.c: Don't be confused the off-screen cursor offset 0xffff set by syscons. kern/subr_xxx.c: Add enough nxio/nodev/null devsw functions of the correct type for syscons and pcvt.
This commit is contained in:
parent
f2cb5630d0
commit
e7451974bb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10666
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.140 1995/09/08 03:19:47 davidg Exp $
|
||||
* $Id: machdep.c,v 1.141 1995/09/09 18:09:45 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -375,8 +375,10 @@ cpu_startup(udata)
|
||||
for (i = 1; i < ncallout; i++)
|
||||
callout[i-1].c_next = &callout[i];
|
||||
|
||||
if (boothowto & RB_CONFIG)
|
||||
if (boothowto & RB_CONFIG) {
|
||||
userconfig();
|
||||
cninit(); /* the preferred console may have changed */
|
||||
}
|
||||
|
||||
#ifdef BOUNCE_BUFFERS
|
||||
/*
|
||||
@ -1256,8 +1258,7 @@ init386(first)
|
||||
/*
|
||||
* Initialize the console before we print anything out.
|
||||
*/
|
||||
|
||||
cninit ();
|
||||
cninit();
|
||||
|
||||
/*
|
||||
* make gdt memory segments, the code segment goes up to end of the
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: isa.c,v 1.49 1995/05/13 00:09:38 jkh Exp $
|
||||
* $Id: isa.c,v 1.50 1995/05/30 08:02:35 rgrimes Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -909,6 +909,22 @@ isa_strayintr(d)
|
||||
"too many stray irq %d's; not logging any more\n", d);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the highest priority enabled display device. Since we can't
|
||||
* distinguish display devices from ttys, depend on display devices
|
||||
* being before serial ttys in the table.
|
||||
*/
|
||||
struct isa_device *
|
||||
find_display()
|
||||
{
|
||||
struct isa_device *dvp;
|
||||
|
||||
for (dvp = isa_devtab_tty; dvp->id_driver != NULL; dvp++)
|
||||
if (dvp->id_enabled)
|
||||
return (dvp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* find an ISA device in a given isa_devtab_* table, given
|
||||
* the table to search, the expected id_driver entry, and the unit number.
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.123 1995/08/08 05:14:40 dyson Exp $
|
||||
* $Id: syscons.c,v 1.124 1995/08/16 22:36:43 nate Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -47,6 +47,7 @@
|
||||
#include <sys/devconf.h>
|
||||
|
||||
#include <machine/clock.h>
|
||||
#include <machine/cons.h>
|
||||
#include <machine/console.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/frame.h>
|
||||
@ -57,7 +58,6 @@
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/timerreg.h>
|
||||
#include <i386/isa/kbdtables.h>
|
||||
#include <i386/i386/cons.h>
|
||||
#include <i386/isa/syscons.h>
|
||||
|
||||
#if !defined(MAXCONS)
|
||||
@ -132,7 +132,7 @@ int nsccons = MAXCONS+1;
|
||||
#endif
|
||||
#define MONO_BUF pa_to_va(0xB0000)
|
||||
#define CGA_BUF pa_to_va(0xB8000)
|
||||
u_short *Crtat = (u_short *)MONO_BUF;
|
||||
u_short *Crtat;
|
||||
|
||||
#define WRAPHIST(scp, pointer, offset)\
|
||||
((scp->history) + ((((pointer) - (scp->history)) + (scp->history_size)\
|
||||
@ -142,6 +142,20 @@ struct isa_driver scdriver = {
|
||||
scprobe, scattach, "sc", 1
|
||||
};
|
||||
|
||||
static d_open_t scopen;
|
||||
static d_close_t scclose;
|
||||
static d_rdwr_t scread;
|
||||
static d_rdwr_t scwrite;
|
||||
static d_ioctl_t scioctl;
|
||||
static d_ttycv_t scdevtotty;
|
||||
static d_mmap_t scmmap;
|
||||
|
||||
static struct cdevsw scdevsw = {
|
||||
scopen, scclose, scread, scwrite,
|
||||
scioctl, nullstop, noreset, scdevtotty,
|
||||
ttselect, scmmap, nostrategy,
|
||||
};
|
||||
|
||||
int
|
||||
scprobe(struct isa_device *dev)
|
||||
{
|
||||
@ -295,6 +309,9 @@ scattach(struct isa_device *dev)
|
||||
scp->r_hook.ah_order = APM_MID_ORDER;
|
||||
apm_hook_establish(APM_HOOK_RESUME , &scp->r_hook);
|
||||
#endif
|
||||
|
||||
register_cdev("sc", &scdevsw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1107,14 +1124,20 @@ scstart(struct tty *tp)
|
||||
}
|
||||
|
||||
void
|
||||
pccnprobe(struct consdev *cp)
|
||||
sccnprobe(struct consdev *cp)
|
||||
{
|
||||
struct isa_device *dvp;
|
||||
int maj;
|
||||
|
||||
/* locate the major number */
|
||||
for (maj = 0; maj < nchrdev; maj++)
|
||||
if ((void*)cdevsw[maj].d_open == (void*)scopen)
|
||||
break;
|
||||
/*
|
||||
* Take control if we are the highest priority enabled display device.
|
||||
*/
|
||||
dvp = find_display();
|
||||
maj = getmajorbyname("sc");
|
||||
if (dvp->id_driver != &scdriver || maj < 0) {
|
||||
cp->cn_pri = CN_DEAD;
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize required fields */
|
||||
cp->cn_dev = makedev(maj, MAXCONS);
|
||||
@ -1122,13 +1145,13 @@ pccnprobe(struct consdev *cp)
|
||||
}
|
||||
|
||||
void
|
||||
pccninit(struct consdev *cp)
|
||||
sccninit(struct consdev *cp)
|
||||
{
|
||||
scinit();
|
||||
}
|
||||
|
||||
void
|
||||
pccnputc(dev_t dev, int c)
|
||||
sccnputc(dev_t dev, int c)
|
||||
{
|
||||
u_char buf[1];
|
||||
scr_stat *scp = console[0];
|
||||
@ -1156,7 +1179,7 @@ pccnputc(dev_t dev, int c)
|
||||
}
|
||||
|
||||
int
|
||||
pccngetc(dev_t dev)
|
||||
sccngetc(dev_t dev)
|
||||
{
|
||||
int s = spltty(); /* block scintr while we poll */
|
||||
int c = scgetc(0);
|
||||
@ -1165,7 +1188,7 @@ pccngetc(dev_t dev)
|
||||
}
|
||||
|
||||
int
|
||||
pccncheckc(dev_t dev)
|
||||
sccncheckc(dev_t dev)
|
||||
{
|
||||
return (scgetc(1) & 0xff);
|
||||
}
|
||||
@ -1945,27 +1968,42 @@ ansi_put(scr_stat *scp, u_char *buf, int len)
|
||||
static void
|
||||
scinit(void)
|
||||
{
|
||||
u_short volatile *cp = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short), was;
|
||||
unsigned hw_cursor;
|
||||
u_short volatile *cp;
|
||||
u_short was;
|
||||
unsigned hw_cursor, startaddr;
|
||||
int i;
|
||||
|
||||
if (init_done)
|
||||
return;
|
||||
init_done = TRUE;
|
||||
/*
|
||||
* Crtat initialized to point to MONO buffer, if not present change
|
||||
* to CGA_BUF offset. ONLY add the difference since locore.s adds
|
||||
* in the remapped offset at the "right" time
|
||||
* Finish defaulting crtc variables for a mono screen. Crtat is a
|
||||
* bogus common variable so that it can be shared with pcvt, so it
|
||||
* can't be statically initialized. XXX.
|
||||
*/
|
||||
Crtat = (u_short *)MONO_BUF;
|
||||
/*
|
||||
* If CGA memory seems to work, switch to color.
|
||||
*/
|
||||
cp = (u_short *)CGA_BUF;
|
||||
was = *cp;
|
||||
*cp = (u_short) 0xA55A;
|
||||
if (*cp != 0xA55A)
|
||||
crtc_addr = MONO_BASE;
|
||||
else {
|
||||
*cp = was;
|
||||
if (*cp == 0xA55A) {
|
||||
Crtat = (u_short *)cp;
|
||||
crtc_addr = COLOR_BASE;
|
||||
Crtat = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short);
|
||||
}
|
||||
*cp = was;
|
||||
|
||||
/*
|
||||
* Ensure a zero start address. This is mainly to recover after
|
||||
* switching from pcvt using userconfig(). The registers are r/o
|
||||
* for old hardware so it's too hard to relocate the active screen
|
||||
* memory.
|
||||
*/
|
||||
outb(crtc_addr, 12);
|
||||
outb(crtc_addr + 1, 0);
|
||||
outb(crtc_addr, 13);
|
||||
outb(crtc_addr + 1, 0);
|
||||
|
||||
/* extract cursor location */
|
||||
outb(crtc_addr, 14);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.h,v 1.9 1995/05/30 08:03:15 rgrimes Exp $
|
||||
* $Id: syscons.h,v 1.10 1995/07/11 18:34:30 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
@ -168,18 +168,11 @@ typedef struct default_attr {
|
||||
/* function prototypes */
|
||||
int scprobe(struct isa_device *dev);
|
||||
int scattach(struct isa_device *dev);
|
||||
int scopen(dev_t dev, int flag, int mode, struct proc *p);
|
||||
int scclose(dev_t dev, int flag, int mode, struct proc *p);
|
||||
int scread(dev_t dev, struct uio *uio, int flag);
|
||||
int scwrite(dev_t dev, struct uio *uio, int flag);
|
||||
int scparam(struct tty *tp, struct termios *t);
|
||||
int scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p);
|
||||
void scstart(struct tty *tp);
|
||||
void scintr(int unit);
|
||||
int pcmmap(dev_t dev, int offset, int nprot);
|
||||
static void scinit(void);
|
||||
static u_int scgetc(int noblock);
|
||||
struct tty *scdevtotty(dev_t dev);
|
||||
static scr_stat *get_scr_stat(dev_t dev);
|
||||
static scr_stat *alloc_scp(void);
|
||||
static void init_scp(scr_stat *scp);
|
||||
|
@ -42,7 +42,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)conf.c 5.8 (Berkeley) 5/12/91
|
||||
* $Id: conf.c,v 1.96 1995/09/08 03:37:51 julian Exp $
|
||||
* $Id: conf.c,v 1.97 1995/09/09 18:09:43 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -63,10 +63,8 @@ d_rdwr_t rawread, rawwrite;
|
||||
#define nowrite noread
|
||||
#define noioc (d_ioctl_t *)enodev
|
||||
#define nostop (d_stop_t *)enodev
|
||||
#define noreset (d_reset_t *)enodev
|
||||
#define noselect (d_select_t *)enodev
|
||||
#define nommap (d_mmap_t *)enodev
|
||||
#define nostrat (d_strategy_t *)enodev
|
||||
#define nostrat nostrategy
|
||||
#define nodump (d_dump_t *)enodev
|
||||
#define nodevtotty (d_ttycv_t *)nullop
|
||||
|
||||
@ -83,11 +81,6 @@ d_rdwr_t rawread, rawwrite;
|
||||
#define nxmmap (d_mmap_t *)enxio
|
||||
#define nxdevtotty (d_ttycv_t *)nullop
|
||||
|
||||
#define nullopen (d_open_t *)nullop
|
||||
#define nullclose (d_close_t *)nullop
|
||||
#define nullstop (d_stop_t *)nullop
|
||||
#define nullreset (d_reset_t *)nullop
|
||||
|
||||
#define zerosize (d_psize_t *)0
|
||||
|
||||
int lkmenodev();
|
||||
@ -470,43 +463,6 @@ int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
|
||||
/* console */
|
||||
#include "machine/cons.h"
|
||||
|
||||
/* more console */
|
||||
#include "sc.h"
|
||||
#include "vt.h"
|
||||
#if NSC > 0
|
||||
# if NVT > 0 && !defined(LINT)
|
||||
# error "sc0 and vt0 are mutually exclusive"
|
||||
# endif
|
||||
d_open_t scopen;
|
||||
d_close_t scclose;
|
||||
d_rdwr_t scread, scwrite;
|
||||
d_ioctl_t scioctl;
|
||||
d_mmap_t scmmap;
|
||||
d_ttycv_t scdevtotty;
|
||||
#elif NVT > 0
|
||||
d_open_t pcopen;
|
||||
d_close_t pcclose;
|
||||
d_rdwr_t pcread, pcwrite;
|
||||
d_ioctl_t pcioctl;
|
||||
d_mmap_t pcmmap;
|
||||
d_ttycv_t pcdevtotty;
|
||||
#define scopen pcopen
|
||||
#define scclose pcclose
|
||||
#define scread pcread
|
||||
#define scwrite pcwrite
|
||||
#define scioctl pcioctl
|
||||
#define scmmap pcmmap
|
||||
#define scdevtotty pcdevtotty
|
||||
#else /* neither syscons nor pcvt, i.e. no grafx console driver */
|
||||
#define scopen nxopen
|
||||
#define scclose nxclose
|
||||
#define scread nxread
|
||||
#define scwrite nxwrite
|
||||
#define scioctl nxioctl
|
||||
#define scmmap nxmmap
|
||||
#define scdevtotty nxdevtotty
|
||||
#endif /* NSC > 0, NVT > 0 */
|
||||
|
||||
/* /dev/mem */
|
||||
d_open_t mmopen;
|
||||
d_close_t mmclose;
|
||||
@ -1166,9 +1122,9 @@ struct cdevsw cdevsw[] =
|
||||
{ spigot_open, spigot_close, spigot_read, spigot_write, /*11*/
|
||||
spigot_ioctl, nostop, nullreset, nodevtotty,/* Spigot */
|
||||
spigot_select, spigot_mmap, NULL },
|
||||
{ scopen, scclose, scread, scwrite, /*12*/
|
||||
scioctl, nullstop, nullreset, scdevtotty,/* sc */
|
||||
ttselect, scmmap, NULL },
|
||||
{ nxopen, nxclose, nxread, nxwrite, /*12*/
|
||||
nxioctl, nxstop, nxreset, nxdevtotty,/* sc, ... */
|
||||
nxselect, nxmmap, NULL },
|
||||
{ sdopen, sdclose, rawread, rawwrite, /*13*/
|
||||
sdioctl, nostop, nullreset, nodevtotty,/* sd */
|
||||
seltrue, nommap, sdstrategy },
|
||||
@ -1469,3 +1425,65 @@ chrtoblk(dev)
|
||||
}
|
||||
return (makedev(blkmaj, minor(dev)));
|
||||
}
|
||||
|
||||
int
|
||||
getmajorbyname(name)
|
||||
const char *name;
|
||||
{
|
||||
|
||||
if (strcmp(name, "sc") == 0)
|
||||
return (12);
|
||||
if (strcmp(name, "vt") == 0)
|
||||
return (12);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
static struct cdevsw *getcdevbyname __P((const char *name));
|
||||
static struct cdevsw *
|
||||
getcdevbyname(name)
|
||||
const char *name;
|
||||
{
|
||||
int maj;
|
||||
|
||||
maj = getmajorbyname(name);
|
||||
return (maj < 0 ? NULL : &cdevsw[maj]);
|
||||
}
|
||||
|
||||
int
|
||||
register_cdev(name, cdp)
|
||||
const char *name;
|
||||
const struct cdevsw *cdp;
|
||||
{
|
||||
struct cdevsw *dst_cdp;
|
||||
|
||||
dst_cdp = getcdevbyname(name);
|
||||
if (dst_cdp == NULL)
|
||||
return (ENXIO);
|
||||
if (dst_cdp->d_open != nxopen)
|
||||
return (EBUSY);
|
||||
*dst_cdp = *cdp;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static struct cdevsw nxcdevsw = {
|
||||
nxopen, nxclose, nxread, nxwrite,
|
||||
nxioctl, nxstop, nxreset, nxdevtotty,
|
||||
nxselect, nxmmap, NULL,
|
||||
};
|
||||
|
||||
int
|
||||
unregister_cdev(name, cdp)
|
||||
const char *name;
|
||||
const struct cdevsw *cdp;
|
||||
{
|
||||
struct cdevsw *dst_cdp;
|
||||
|
||||
dst_cdp = getcdevbyname(name);
|
||||
if (dst_cdp == NULL)
|
||||
return (ENXIO);
|
||||
if (dst_cdp->d_open != cdp->d_open)
|
||||
return (EBUSY);
|
||||
*dst_cdp = nxcdevsw;
|
||||
return (0);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.32 1995/09/09 18:09:44 davidg Exp $
|
||||
* $Id: cons.c,v 1.33 1995/09/10 18:57:25 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -53,7 +53,10 @@
|
||||
#include "vt.h"
|
||||
#include "sio.h"
|
||||
static struct consdev constab[] = {
|
||||
#if NSC > 0 || NVT > 0
|
||||
#if NSC > 0
|
||||
{ sccnprobe, sccninit, sccngetc, sccncheckc, sccnputc },
|
||||
#endif
|
||||
#if NVT > 0
|
||||
{ pccnprobe, pccninit, pccngetc, pccncheckc, pccnputc },
|
||||
#endif
|
||||
#if NSIO > 0
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.h,v 1.9 1995/04/24 16:43:01 bde Exp $
|
||||
* $Id: cons.h,v 1.10 1995/09/10 18:57:26 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CONS_H_
|
||||
@ -60,6 +60,12 @@ cn_getc_t pccngetc;
|
||||
cn_checkc_t pccncheckc;
|
||||
cn_putc_t pccnputc;
|
||||
|
||||
cn_probe_t sccnprobe;
|
||||
cn_init_t sccninit;
|
||||
cn_getc_t sccngetc;
|
||||
cn_checkc_t sccncheckc;
|
||||
cn_putc_t sccnputc;
|
||||
|
||||
cn_probe_t siocnprobe;
|
||||
cn_init_t siocninit;
|
||||
cn_getc_t siocngetc;
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.140 1995/09/08 03:19:47 davidg Exp $
|
||||
* $Id: machdep.c,v 1.141 1995/09/09 18:09:45 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -375,8 +375,10 @@ cpu_startup(udata)
|
||||
for (i = 1; i < ncallout; i++)
|
||||
callout[i-1].c_next = &callout[i];
|
||||
|
||||
if (boothowto & RB_CONFIG)
|
||||
if (boothowto & RB_CONFIG) {
|
||||
userconfig();
|
||||
cninit(); /* the preferred console may have changed */
|
||||
}
|
||||
|
||||
#ifdef BOUNCE_BUFFERS
|
||||
/*
|
||||
@ -1256,8 +1258,7 @@ init386(first)
|
||||
/*
|
||||
* Initialize the console before we print anything out.
|
||||
*/
|
||||
|
||||
cninit ();
|
||||
cninit();
|
||||
|
||||
/*
|
||||
* make gdt memory segments, the code segment goes up to end of the
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: isa.c,v 1.49 1995/05/13 00:09:38 jkh Exp $
|
||||
* $Id: isa.c,v 1.50 1995/05/30 08:02:35 rgrimes Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -909,6 +909,22 @@ isa_strayintr(d)
|
||||
"too many stray irq %d's; not logging any more\n", d);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the highest priority enabled display device. Since we can't
|
||||
* distinguish display devices from ttys, depend on display devices
|
||||
* being before serial ttys in the table.
|
||||
*/
|
||||
struct isa_device *
|
||||
find_display()
|
||||
{
|
||||
struct isa_device *dvp;
|
||||
|
||||
for (dvp = isa_devtab_tty; dvp->id_driver != NULL; dvp++)
|
||||
if (dvp->id_enabled)
|
||||
return (dvp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* find an ISA device in a given isa_devtab_* table, given
|
||||
* the table to search, the expected id_driver entry, and the unit number.
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91
|
||||
* $Id: isa_device.h,v 1.22 1995/05/11 02:15:55 jkh Exp $
|
||||
* $Id: isa_device.h,v 1.23 1995/05/11 07:41:52 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_ISA_DEVICE_H_
|
||||
@ -134,14 +134,15 @@ inthand_t
|
||||
IDTVEC(fastintr10), IDTVEC(fastintr11),
|
||||
IDTVEC(fastintr12), IDTVEC(fastintr13),
|
||||
IDTVEC(fastintr14), IDTVEC(fastintr15);
|
||||
struct isa_device *find_isadev __P((struct isa_device *table,
|
||||
struct isa_driver *driverp, int unit));
|
||||
inthand_t
|
||||
IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
|
||||
IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
|
||||
IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11),
|
||||
IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15);
|
||||
|
||||
struct isa_device *find_display __P((void));
|
||||
struct isa_device *find_isadev __P((struct isa_device *table,
|
||||
struct isa_driver *driverp, int unit));
|
||||
void isa_configure __P((void));
|
||||
int haveseen_isadev __P((struct isa_device *dvp, u_int checkbits));
|
||||
void isa_defaultirq __P((void));
|
||||
|
@ -105,6 +105,20 @@ static char vt_description[];
|
||||
#define VT_DESCR_LEN 40
|
||||
#endif /* PCVT_FREEBSD > 205 */
|
||||
|
||||
static d_open_t pcopen;
|
||||
static d_close_t pcclose;
|
||||
static d_rdwr_t pcread;
|
||||
static d_rdwr_t pcwrite;
|
||||
static d_ioctl_t pcioctl;
|
||||
static d_ttycv_t pcdevtotty;
|
||||
static d_mmap_t pcmmap;
|
||||
|
||||
static struct cdevsw pcdevsw = {
|
||||
pcopen, pcclose, pcread, pcwrite,
|
||||
pcioctl, nullstop, noreset, pcdevtotty,
|
||||
ttselect, pcmmap, nostrategy,
|
||||
};
|
||||
|
||||
#if PCVT_NETBSD > 100 /* NetBSD-current Feb 20 1995 */
|
||||
int
|
||||
pcprobe(struct device *parent, void *match, void *aux)
|
||||
@ -309,6 +323,8 @@ pcattach(struct isa_device *dev)
|
||||
kdc_vt[dev->id_unit].kdc_state =
|
||||
pcvt_is_console? DC_IDLE: DC_BUSY;
|
||||
vt_registerdev(dev, (char *)vga_string(vga_type));
|
||||
|
||||
register_cdev("vt", &pcdevsw);
|
||||
#endif /* PCVT_FREEBSD > 205 */
|
||||
|
||||
#if PCVT_NETBSD > 9
|
||||
@ -1086,20 +1102,17 @@ int
|
||||
#endif
|
||||
pccnprobe(struct consdev *cp)
|
||||
{
|
||||
struct isa_device *dvp;
|
||||
int maj;
|
||||
|
||||
/* locate the major number */
|
||||
|
||||
for (maj = 0; maj < nchrdev; maj++)
|
||||
{
|
||||
if ((u_int)cdevsw[maj].d_open == (u_int)pcopen)
|
||||
break;
|
||||
}
|
||||
|
||||
if (maj == nchrdev)
|
||||
{
|
||||
/* we are not in cdevsw[], give up */
|
||||
panic("pcvt is not in cdevsw[]");
|
||||
/*
|
||||
* Take control if we are the highest priority enabled display device.
|
||||
*/
|
||||
dvp = find_display();
|
||||
maj = getmajorbyname("vt");
|
||||
if (dvp->id_driver != &vtdriver || maj < 0) {
|
||||
cp->cn_pri = CN_DEAD;
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize required fields */
|
||||
|
@ -132,7 +132,7 @@
|
||||
#if PCVT_NETBSD > 9
|
||||
#include "dev/cons.h"
|
||||
#elif PCVT_FREEBSD >= 200
|
||||
#include <i386/i386/cons.h>
|
||||
#include <machine/cons.h>
|
||||
#else
|
||||
#include "i386/i386/cons.h"
|
||||
#endif
|
||||
@ -943,7 +943,7 @@ int pcprobe ( struct isa_device *dev );
|
||||
int pcattach ( struct isa_device *dev );
|
||||
|
||||
struct isa_driver vtdriver = { /* driver routines */
|
||||
pcprobe, pcattach, "vt",
|
||||
pcprobe, pcattach, "vt", 1,
|
||||
};
|
||||
|
||||
#endif /* PCVT_NETBSD > 9 */
|
||||
@ -959,7 +959,8 @@ u_char bgansitopc[] = { /* background ANSI color -> pc */
|
||||
};
|
||||
|
||||
#if !PCVT_NETBSD
|
||||
u_short *Crtat = (u_short *)MONO_BUF; /* screen start address */
|
||||
/* XXX Crtat is shared with syscons. */
|
||||
u_short *Crtat; /* screen start address */
|
||||
#if !(PCVT_FREEBSD > 110 && PCVT_FREEBSD < 200)
|
||||
struct tty *pcconsp = &pccons[0]; /* ptr to current device */
|
||||
#else /* PCVT_FREEBSD > 110 */
|
||||
@ -1210,20 +1211,11 @@ extern void bcopyb(void *from, void *to, u_int length);
|
||||
extern void fillw(U_short value, void *addr, u_int length);
|
||||
#endif
|
||||
|
||||
int pcopen ( Dev_t dev, int flag, int mode, struct proc *p );
|
||||
int pcclose ( Dev_t dev, int flag, int mode, struct proc *p );
|
||||
int pcread ( Dev_t dev, struct uio *uio, int flag );
|
||||
int pcwrite ( Dev_t dev, struct uio *uio, int flag );
|
||||
int pcioctl ( Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p );
|
||||
int pcmmap ( Dev_t dev, int offset, int nprot );
|
||||
#if PCVT_FREEBSD > 205
|
||||
struct tty *pcdevtotty ( Dev_t dev );
|
||||
#endif /* PCVT_FREEBSD > 205 */
|
||||
int pcrint ( void );
|
||||
int pcparam ( struct tty *tp, struct termios *t );
|
||||
|
||||
/*
|
||||
* In FreeBSD > 2.0.6, driver console functions are declared in i386/cons.h
|
||||
* In FreeBSD > 2.0.6, driver console functions are declared in machine/cons.h
|
||||
* and some return void, so don't declare them here.
|
||||
*/
|
||||
#if PCVT_FREEBSD <= 205
|
||||
|
@ -892,13 +892,17 @@ sput (u_char *s, U_char kernel, int len, int page)
|
||||
static void
|
||||
vt_coldinit(void)
|
||||
{
|
||||
u_short volatile *cp = Crtat + (CGA_BUF-MONO_BUF)/CHR;
|
||||
u_short volatile *cp;
|
||||
u_short was;
|
||||
int nscr, charset;
|
||||
int equipment;
|
||||
u_short *SaveCrtat = Crtat;
|
||||
u_short *SaveCrtat;
|
||||
struct video_state *svsp;
|
||||
|
||||
Crtat = (u_short *)MONO_BUF; /* XXX assume static relocation works */
|
||||
SaveCrtat = Crtat;
|
||||
cp = Crtat + (CGA_BUF-MONO_BUF)/CHR;
|
||||
|
||||
do_initialization = 0; /* reset init necessary flag */
|
||||
|
||||
/* get the equipment byte from the RTC chip */
|
||||
@ -1121,6 +1125,16 @@ vt_coldinit(void)
|
||||
outb(addr_6845, CRTC_CURSORL);
|
||||
cursorat |= inb(addr_6845+1);
|
||||
|
||||
/*
|
||||
* Reject cursors that are more than one row off a
|
||||
* 25-row screen. syscons sets the cursor offset
|
||||
* to 0xffff. The scroll up fixup fails for this
|
||||
* because the assignment to svsp->row overflows
|
||||
* and perhaps for other reasons.
|
||||
*/
|
||||
if (cursorat > 25 * svsp->maxcol)
|
||||
cursorat = 25 * svsp->maxcol;
|
||||
|
||||
svsp->cur_offset = cursorat;
|
||||
svsp->row = cursorat / svsp->maxcol;
|
||||
svsp->col = cursorat % svsp->maxcol;
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.123 1995/08/08 05:14:40 dyson Exp $
|
||||
* $Id: syscons.c,v 1.124 1995/08/16 22:36:43 nate Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -47,6 +47,7 @@
|
||||
#include <sys/devconf.h>
|
||||
|
||||
#include <machine/clock.h>
|
||||
#include <machine/cons.h>
|
||||
#include <machine/console.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/frame.h>
|
||||
@ -57,7 +58,6 @@
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/timerreg.h>
|
||||
#include <i386/isa/kbdtables.h>
|
||||
#include <i386/i386/cons.h>
|
||||
#include <i386/isa/syscons.h>
|
||||
|
||||
#if !defined(MAXCONS)
|
||||
@ -132,7 +132,7 @@ int nsccons = MAXCONS+1;
|
||||
#endif
|
||||
#define MONO_BUF pa_to_va(0xB0000)
|
||||
#define CGA_BUF pa_to_va(0xB8000)
|
||||
u_short *Crtat = (u_short *)MONO_BUF;
|
||||
u_short *Crtat;
|
||||
|
||||
#define WRAPHIST(scp, pointer, offset)\
|
||||
((scp->history) + ((((pointer) - (scp->history)) + (scp->history_size)\
|
||||
@ -142,6 +142,20 @@ struct isa_driver scdriver = {
|
||||
scprobe, scattach, "sc", 1
|
||||
};
|
||||
|
||||
static d_open_t scopen;
|
||||
static d_close_t scclose;
|
||||
static d_rdwr_t scread;
|
||||
static d_rdwr_t scwrite;
|
||||
static d_ioctl_t scioctl;
|
||||
static d_ttycv_t scdevtotty;
|
||||
static d_mmap_t scmmap;
|
||||
|
||||
static struct cdevsw scdevsw = {
|
||||
scopen, scclose, scread, scwrite,
|
||||
scioctl, nullstop, noreset, scdevtotty,
|
||||
ttselect, scmmap, nostrategy,
|
||||
};
|
||||
|
||||
int
|
||||
scprobe(struct isa_device *dev)
|
||||
{
|
||||
@ -295,6 +309,9 @@ scattach(struct isa_device *dev)
|
||||
scp->r_hook.ah_order = APM_MID_ORDER;
|
||||
apm_hook_establish(APM_HOOK_RESUME , &scp->r_hook);
|
||||
#endif
|
||||
|
||||
register_cdev("sc", &scdevsw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1107,14 +1124,20 @@ scstart(struct tty *tp)
|
||||
}
|
||||
|
||||
void
|
||||
pccnprobe(struct consdev *cp)
|
||||
sccnprobe(struct consdev *cp)
|
||||
{
|
||||
struct isa_device *dvp;
|
||||
int maj;
|
||||
|
||||
/* locate the major number */
|
||||
for (maj = 0; maj < nchrdev; maj++)
|
||||
if ((void*)cdevsw[maj].d_open == (void*)scopen)
|
||||
break;
|
||||
/*
|
||||
* Take control if we are the highest priority enabled display device.
|
||||
*/
|
||||
dvp = find_display();
|
||||
maj = getmajorbyname("sc");
|
||||
if (dvp->id_driver != &scdriver || maj < 0) {
|
||||
cp->cn_pri = CN_DEAD;
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize required fields */
|
||||
cp->cn_dev = makedev(maj, MAXCONS);
|
||||
@ -1122,13 +1145,13 @@ pccnprobe(struct consdev *cp)
|
||||
}
|
||||
|
||||
void
|
||||
pccninit(struct consdev *cp)
|
||||
sccninit(struct consdev *cp)
|
||||
{
|
||||
scinit();
|
||||
}
|
||||
|
||||
void
|
||||
pccnputc(dev_t dev, int c)
|
||||
sccnputc(dev_t dev, int c)
|
||||
{
|
||||
u_char buf[1];
|
||||
scr_stat *scp = console[0];
|
||||
@ -1156,7 +1179,7 @@ pccnputc(dev_t dev, int c)
|
||||
}
|
||||
|
||||
int
|
||||
pccngetc(dev_t dev)
|
||||
sccngetc(dev_t dev)
|
||||
{
|
||||
int s = spltty(); /* block scintr while we poll */
|
||||
int c = scgetc(0);
|
||||
@ -1165,7 +1188,7 @@ pccngetc(dev_t dev)
|
||||
}
|
||||
|
||||
int
|
||||
pccncheckc(dev_t dev)
|
||||
sccncheckc(dev_t dev)
|
||||
{
|
||||
return (scgetc(1) & 0xff);
|
||||
}
|
||||
@ -1945,27 +1968,42 @@ ansi_put(scr_stat *scp, u_char *buf, int len)
|
||||
static void
|
||||
scinit(void)
|
||||
{
|
||||
u_short volatile *cp = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short), was;
|
||||
unsigned hw_cursor;
|
||||
u_short volatile *cp;
|
||||
u_short was;
|
||||
unsigned hw_cursor, startaddr;
|
||||
int i;
|
||||
|
||||
if (init_done)
|
||||
return;
|
||||
init_done = TRUE;
|
||||
/*
|
||||
* Crtat initialized to point to MONO buffer, if not present change
|
||||
* to CGA_BUF offset. ONLY add the difference since locore.s adds
|
||||
* in the remapped offset at the "right" time
|
||||
* Finish defaulting crtc variables for a mono screen. Crtat is a
|
||||
* bogus common variable so that it can be shared with pcvt, so it
|
||||
* can't be statically initialized. XXX.
|
||||
*/
|
||||
Crtat = (u_short *)MONO_BUF;
|
||||
/*
|
||||
* If CGA memory seems to work, switch to color.
|
||||
*/
|
||||
cp = (u_short *)CGA_BUF;
|
||||
was = *cp;
|
||||
*cp = (u_short) 0xA55A;
|
||||
if (*cp != 0xA55A)
|
||||
crtc_addr = MONO_BASE;
|
||||
else {
|
||||
*cp = was;
|
||||
if (*cp == 0xA55A) {
|
||||
Crtat = (u_short *)cp;
|
||||
crtc_addr = COLOR_BASE;
|
||||
Crtat = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short);
|
||||
}
|
||||
*cp = was;
|
||||
|
||||
/*
|
||||
* Ensure a zero start address. This is mainly to recover after
|
||||
* switching from pcvt using userconfig(). The registers are r/o
|
||||
* for old hardware so it's too hard to relocate the active screen
|
||||
* memory.
|
||||
*/
|
||||
outb(crtc_addr, 12);
|
||||
outb(crtc_addr + 1, 0);
|
||||
outb(crtc_addr, 13);
|
||||
outb(crtc_addr + 1, 0);
|
||||
|
||||
/* extract cursor location */
|
||||
outb(crtc_addr, 14);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.h,v 1.9 1995/05/30 08:03:15 rgrimes Exp $
|
||||
* $Id: syscons.h,v 1.10 1995/07/11 18:34:30 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
@ -168,18 +168,11 @@ typedef struct default_attr {
|
||||
/* function prototypes */
|
||||
int scprobe(struct isa_device *dev);
|
||||
int scattach(struct isa_device *dev);
|
||||
int scopen(dev_t dev, int flag, int mode, struct proc *p);
|
||||
int scclose(dev_t dev, int flag, int mode, struct proc *p);
|
||||
int scread(dev_t dev, struct uio *uio, int flag);
|
||||
int scwrite(dev_t dev, struct uio *uio, int flag);
|
||||
int scparam(struct tty *tp, struct termios *t);
|
||||
int scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p);
|
||||
void scstart(struct tty *tp);
|
||||
void scintr(int unit);
|
||||
int pcmmap(dev_t dev, int offset, int nprot);
|
||||
static void scinit(void);
|
||||
static u_int scgetc(int noblock);
|
||||
struct tty *scdevtotty(dev_t dev);
|
||||
static scr_stat *get_scr_stat(dev_t dev);
|
||||
static scr_stat *alloc_scp(void);
|
||||
static void init_scp(scr_stat *scp);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.c,v 1.123 1995/08/08 05:14:40 dyson Exp $
|
||||
* $Id: syscons.c,v 1.124 1995/08/16 22:36:43 nate Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -47,6 +47,7 @@
|
||||
#include <sys/devconf.h>
|
||||
|
||||
#include <machine/clock.h>
|
||||
#include <machine/cons.h>
|
||||
#include <machine/console.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/frame.h>
|
||||
@ -57,7 +58,6 @@
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/timerreg.h>
|
||||
#include <i386/isa/kbdtables.h>
|
||||
#include <i386/i386/cons.h>
|
||||
#include <i386/isa/syscons.h>
|
||||
|
||||
#if !defined(MAXCONS)
|
||||
@ -132,7 +132,7 @@ int nsccons = MAXCONS+1;
|
||||
#endif
|
||||
#define MONO_BUF pa_to_va(0xB0000)
|
||||
#define CGA_BUF pa_to_va(0xB8000)
|
||||
u_short *Crtat = (u_short *)MONO_BUF;
|
||||
u_short *Crtat;
|
||||
|
||||
#define WRAPHIST(scp, pointer, offset)\
|
||||
((scp->history) + ((((pointer) - (scp->history)) + (scp->history_size)\
|
||||
@ -142,6 +142,20 @@ struct isa_driver scdriver = {
|
||||
scprobe, scattach, "sc", 1
|
||||
};
|
||||
|
||||
static d_open_t scopen;
|
||||
static d_close_t scclose;
|
||||
static d_rdwr_t scread;
|
||||
static d_rdwr_t scwrite;
|
||||
static d_ioctl_t scioctl;
|
||||
static d_ttycv_t scdevtotty;
|
||||
static d_mmap_t scmmap;
|
||||
|
||||
static struct cdevsw scdevsw = {
|
||||
scopen, scclose, scread, scwrite,
|
||||
scioctl, nullstop, noreset, scdevtotty,
|
||||
ttselect, scmmap, nostrategy,
|
||||
};
|
||||
|
||||
int
|
||||
scprobe(struct isa_device *dev)
|
||||
{
|
||||
@ -295,6 +309,9 @@ scattach(struct isa_device *dev)
|
||||
scp->r_hook.ah_order = APM_MID_ORDER;
|
||||
apm_hook_establish(APM_HOOK_RESUME , &scp->r_hook);
|
||||
#endif
|
||||
|
||||
register_cdev("sc", &scdevsw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1107,14 +1124,20 @@ scstart(struct tty *tp)
|
||||
}
|
||||
|
||||
void
|
||||
pccnprobe(struct consdev *cp)
|
||||
sccnprobe(struct consdev *cp)
|
||||
{
|
||||
struct isa_device *dvp;
|
||||
int maj;
|
||||
|
||||
/* locate the major number */
|
||||
for (maj = 0; maj < nchrdev; maj++)
|
||||
if ((void*)cdevsw[maj].d_open == (void*)scopen)
|
||||
break;
|
||||
/*
|
||||
* Take control if we are the highest priority enabled display device.
|
||||
*/
|
||||
dvp = find_display();
|
||||
maj = getmajorbyname("sc");
|
||||
if (dvp->id_driver != &scdriver || maj < 0) {
|
||||
cp->cn_pri = CN_DEAD;
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize required fields */
|
||||
cp->cn_dev = makedev(maj, MAXCONS);
|
||||
@ -1122,13 +1145,13 @@ pccnprobe(struct consdev *cp)
|
||||
}
|
||||
|
||||
void
|
||||
pccninit(struct consdev *cp)
|
||||
sccninit(struct consdev *cp)
|
||||
{
|
||||
scinit();
|
||||
}
|
||||
|
||||
void
|
||||
pccnputc(dev_t dev, int c)
|
||||
sccnputc(dev_t dev, int c)
|
||||
{
|
||||
u_char buf[1];
|
||||
scr_stat *scp = console[0];
|
||||
@ -1156,7 +1179,7 @@ pccnputc(dev_t dev, int c)
|
||||
}
|
||||
|
||||
int
|
||||
pccngetc(dev_t dev)
|
||||
sccngetc(dev_t dev)
|
||||
{
|
||||
int s = spltty(); /* block scintr while we poll */
|
||||
int c = scgetc(0);
|
||||
@ -1165,7 +1188,7 @@ pccngetc(dev_t dev)
|
||||
}
|
||||
|
||||
int
|
||||
pccncheckc(dev_t dev)
|
||||
sccncheckc(dev_t dev)
|
||||
{
|
||||
return (scgetc(1) & 0xff);
|
||||
}
|
||||
@ -1945,27 +1968,42 @@ ansi_put(scr_stat *scp, u_char *buf, int len)
|
||||
static void
|
||||
scinit(void)
|
||||
{
|
||||
u_short volatile *cp = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short), was;
|
||||
unsigned hw_cursor;
|
||||
u_short volatile *cp;
|
||||
u_short was;
|
||||
unsigned hw_cursor, startaddr;
|
||||
int i;
|
||||
|
||||
if (init_done)
|
||||
return;
|
||||
init_done = TRUE;
|
||||
/*
|
||||
* Crtat initialized to point to MONO buffer, if not present change
|
||||
* to CGA_BUF offset. ONLY add the difference since locore.s adds
|
||||
* in the remapped offset at the "right" time
|
||||
* Finish defaulting crtc variables for a mono screen. Crtat is a
|
||||
* bogus common variable so that it can be shared with pcvt, so it
|
||||
* can't be statically initialized. XXX.
|
||||
*/
|
||||
Crtat = (u_short *)MONO_BUF;
|
||||
/*
|
||||
* If CGA memory seems to work, switch to color.
|
||||
*/
|
||||
cp = (u_short *)CGA_BUF;
|
||||
was = *cp;
|
||||
*cp = (u_short) 0xA55A;
|
||||
if (*cp != 0xA55A)
|
||||
crtc_addr = MONO_BASE;
|
||||
else {
|
||||
*cp = was;
|
||||
if (*cp == 0xA55A) {
|
||||
Crtat = (u_short *)cp;
|
||||
crtc_addr = COLOR_BASE;
|
||||
Crtat = Crtat + (CGA_BUF-MONO_BUF)/sizeof(u_short);
|
||||
}
|
||||
*cp = was;
|
||||
|
||||
/*
|
||||
* Ensure a zero start address. This is mainly to recover after
|
||||
* switching from pcvt using userconfig(). The registers are r/o
|
||||
* for old hardware so it's too hard to relocate the active screen
|
||||
* memory.
|
||||
*/
|
||||
outb(crtc_addr, 12);
|
||||
outb(crtc_addr + 1, 0);
|
||||
outb(crtc_addr, 13);
|
||||
outb(crtc_addr + 1, 0);
|
||||
|
||||
/* extract cursor location */
|
||||
outb(crtc_addr, 14);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.h,v 1.9 1995/05/30 08:03:15 rgrimes Exp $
|
||||
* $Id: syscons.h,v 1.10 1995/07/11 18:34:30 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
@ -168,18 +168,11 @@ typedef struct default_attr {
|
||||
/* function prototypes */
|
||||
int scprobe(struct isa_device *dev);
|
||||
int scattach(struct isa_device *dev);
|
||||
int scopen(dev_t dev, int flag, int mode, struct proc *p);
|
||||
int scclose(dev_t dev, int flag, int mode, struct proc *p);
|
||||
int scread(dev_t dev, struct uio *uio, int flag);
|
||||
int scwrite(dev_t dev, struct uio *uio, int flag);
|
||||
int scparam(struct tty *tp, struct termios *t);
|
||||
int scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p);
|
||||
void scstart(struct tty *tp);
|
||||
void scintr(int unit);
|
||||
int pcmmap(dev_t dev, int offset, int nprot);
|
||||
static void scinit(void);
|
||||
static u_int scgetc(int noblock);
|
||||
struct tty *scdevtotty(dev_t dev);
|
||||
static scr_stat *get_scr_stat(dev_t dev);
|
||||
static scr_stat *alloc_scp(void);
|
||||
static void init_scp(scr_stat *scp);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)subr_xxx.c 8.1 (Berkeley) 6/10/93
|
||||
* $Id$
|
||||
* $Id: subr_xxx.c,v 1.3 1994/08/02 07:42:36 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -43,6 +43,8 @@
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
extern int enosys __P((void));
|
||||
|
||||
/*
|
||||
* Unsupported device function (e.g. writing to read-only device).
|
||||
*/
|
||||
@ -105,3 +107,79 @@ nullop()
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specific `no' and `null' operations.
|
||||
* XXX the general ones are bogus.
|
||||
* XXX device functions may belong elsewhere.
|
||||
*/
|
||||
|
||||
#include <sys/conf.h>
|
||||
|
||||
int
|
||||
noreset(dummy)
|
||||
int dummy;
|
||||
{
|
||||
|
||||
return (ENODEV);
|
||||
}
|
||||
|
||||
int
|
||||
nommap(dev, offset, nprot)
|
||||
dev_t dev;
|
||||
int offset;
|
||||
int nprot;
|
||||
{
|
||||
|
||||
/* Don't return ENODEV. That would allow mapping address ENODEV! */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
void
|
||||
nostrategy(bp)
|
||||
struct buf *bp;
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX this is probably bogus. Any device that uses it isn't checking the
|
||||
* minor number.
|
||||
*/
|
||||
int
|
||||
nullopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
nullclose(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
nullstop(tp, rw)
|
||||
struct tty *tp;
|
||||
int rw;
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
nullreset(foo)
|
||||
int foo;
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.32 1995/09/09 18:09:44 davidg Exp $
|
||||
* $Id: cons.c,v 1.33 1995/09/10 18:57:25 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -53,7 +53,10 @@
|
||||
#include "vt.h"
|
||||
#include "sio.h"
|
||||
static struct consdev constab[] = {
|
||||
#if NSC > 0 || NVT > 0
|
||||
#if NSC > 0
|
||||
{ sccnprobe, sccninit, sccngetc, sccncheckc, sccnputc },
|
||||
#endif
|
||||
#if NVT > 0
|
||||
{ pccnprobe, pccninit, pccngetc, pccncheckc, pccnputc },
|
||||
#endif
|
||||
#if NSIO > 0
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.3 (Berkeley) 1/21/94
|
||||
* $Id: conf.h,v 1.15 1995/05/30 08:14:14 rgrimes Exp $
|
||||
* $Id: conf.h,v 1.16 1995/09/08 19:18:02 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -138,12 +138,28 @@ struct swdevt {
|
||||
#define sw_freed sw_flags /* XXX compat */
|
||||
|
||||
#ifdef KERNEL
|
||||
extern int setdumpdev __P((dev_t));
|
||||
d_reset_t noreset;
|
||||
d_mmap_t nommap;
|
||||
d_strategy_t nostrategy;
|
||||
|
||||
d_open_t nullopen;
|
||||
d_close_t nullclose;
|
||||
d_stop_t nullstop;
|
||||
d_reset_t nullreset;
|
||||
/*
|
||||
* XXX d_strategy seems to be unused for cdevs and called without checking
|
||||
* for it being non-NULL for bdevs.
|
||||
*/
|
||||
#define nullstrategy ((d_strategy *)NULL)
|
||||
|
||||
dev_t chrtoblk __P((dev_t dev));
|
||||
int getmajorbyname __P((const char *name));
|
||||
int isdisk __P((dev_t dev, int type));
|
||||
int iskmemdev __P((dev_t dev));
|
||||
int iszerodev __P((dev_t dev));
|
||||
int register_cdev __P((const char *name, const struct cdevsw *cdp));
|
||||
int setdumpdev __P((dev_t));
|
||||
int unregister_cdev __P((const char *name, const struct cdevsw *cdp));
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_CONF_H_ */
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.h,v 1.9 1995/04/24 16:43:01 bde Exp $
|
||||
* $Id: cons.h,v 1.10 1995/09/10 18:57:26 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CONS_H_
|
||||
@ -60,6 +60,12 @@ cn_getc_t pccngetc;
|
||||
cn_checkc_t pccncheckc;
|
||||
cn_putc_t pccnputc;
|
||||
|
||||
cn_probe_t sccnprobe;
|
||||
cn_init_t sccninit;
|
||||
cn_getc_t sccngetc;
|
||||
cn_checkc_t sccncheckc;
|
||||
cn_putc_t sccnputc;
|
||||
|
||||
cn_probe_t siocnprobe;
|
||||
cn_init_t siocninit;
|
||||
cn_getc_t siocngetc;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.3 (Berkeley) 1/21/94
|
||||
* $Id: conf.h,v 1.15 1995/05/30 08:14:14 rgrimes Exp $
|
||||
* $Id: conf.h,v 1.16 1995/09/08 19:18:02 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -138,12 +138,28 @@ struct swdevt {
|
||||
#define sw_freed sw_flags /* XXX compat */
|
||||
|
||||
#ifdef KERNEL
|
||||
extern int setdumpdev __P((dev_t));
|
||||
d_reset_t noreset;
|
||||
d_mmap_t nommap;
|
||||
d_strategy_t nostrategy;
|
||||
|
||||
d_open_t nullopen;
|
||||
d_close_t nullclose;
|
||||
d_stop_t nullstop;
|
||||
d_reset_t nullreset;
|
||||
/*
|
||||
* XXX d_strategy seems to be unused for cdevs and called without checking
|
||||
* for it being non-NULL for bdevs.
|
||||
*/
|
||||
#define nullstrategy ((d_strategy *)NULL)
|
||||
|
||||
dev_t chrtoblk __P((dev_t dev));
|
||||
int getmajorbyname __P((const char *name));
|
||||
int isdisk __P((dev_t dev, int type));
|
||||
int iskmemdev __P((dev_t dev));
|
||||
int iszerodev __P((dev_t dev));
|
||||
int register_cdev __P((const char *name, const struct cdevsw *cdp));
|
||||
int setdumpdev __P((dev_t));
|
||||
int unregister_cdev __P((const char *name, const struct cdevsw *cdp));
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_CONF_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user