Peter Dufaults comconsole changes.

Submitted by:	Peter Dufault
This commit is contained in:
Poul-Henning Kamp 1994-10-20 00:08:31 +00:00
parent 26b2d70e8e
commit 953ca71d9d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3728
15 changed files with 92 additions and 67 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.35 1994/10/08 06:20:52 rgrimes Exp $
* $Id: locore.s,v 1.36 1994/10/10 01:10:21 phk Exp $
*/
/*
@ -693,17 +693,20 @@ NON_GPROF_ENTRY(btext)
ret
begin: /* now running relocated at KERNBASE where the system is linked to run */
.globl _Crtat /* XXX - locore should not know about */
movl _Crtat,%eax /* variables of device drivers (pccons)! */
subl $(KERNBASE+0xA0000),%eax
movl _atdevphys,%edx /* get pte PA */
subl _KPTphys,%edx /* remove base of ptes, now have phys offset */
shll $PGSHIFT-2,%edx /* corresponding to virt offset */
addl $KERNBASE,%edx /* add virtual base */
movl %edx,_atdevbase
#if N_SC > 0
/* XXX: can't scinit relocate Crtat relative to atdevbase itself? */
.globl _Crtat /* XXX - locore should not know about */
movl _Crtat,%eax /* variables of device drivers (pccons)! */
subl $(KERNBASE+0xA0000),%eax
addl %eax,%edx
movl %edx,_Crtat
#endif
/* set up bootstrap stack - 48 bytes */
movl $_kstack+UPAGES*NBPG-4*12,%esp /* bootstrap stack end location */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.35 1994/10/08 06:20:52 rgrimes Exp $
* $Id: locore.s,v 1.36 1994/10/10 01:10:21 phk Exp $
*/
/*
@ -693,17 +693,20 @@ NON_GPROF_ENTRY(btext)
ret
begin: /* now running relocated at KERNBASE where the system is linked to run */
.globl _Crtat /* XXX - locore should not know about */
movl _Crtat,%eax /* variables of device drivers (pccons)! */
subl $(KERNBASE+0xA0000),%eax
movl _atdevphys,%edx /* get pte PA */
subl _KPTphys,%edx /* remove base of ptes, now have phys offset */
shll $PGSHIFT-2,%edx /* corresponding to virt offset */
addl $KERNBASE,%edx /* add virtual base */
movl %edx,_atdevbase
#if N_SC > 0
/* XXX: can't scinit relocate Crtat relative to atdevbase itself? */
.globl _Crtat /* XXX - locore should not know about */
movl _Crtat,%eax /* variables of device drivers (pccons)! */
subl $(KERNBASE+0xA0000),%eax
addl %eax,%edx
movl %edx,_Crtat
#endif
/* set up bootstrap stack - 48 bytes */
movl $_kstack+UPAGES*NBPG-4*12,%esp /* bootstrap stack end location */

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.76 1994/10/18 03:40:14 ache Exp $
* $Id: machdep.c,v 1.77 1994/10/19 00:05:59 wollman Exp $
*/
#include "npx.h"
@ -773,7 +773,7 @@ boot(arghowto)
PANIC_REBOOT_WAIT_TIME);
for (loop = PANIC_REBOOT_WAIT_TIME; loop > 0; --loop) {
DELAY(1000 * 1000); /* one second */
if (sgetc(1)) /* Did user type a key? */
if (cncheckc()) /* Did user type a key? */
break;
}
if (!loop)

View File

@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: syscons.c,v 1.68 1994/10/17 22:12:06 sos Exp $
* $Id: syscons.c,v 1.69 1994/10/18 03:34:53 ache Exp $
*/
#include "sc.h"
@ -213,9 +213,9 @@ void pccnprobe(struct consdev *cp);
void pccninit(struct consdev *cp);
void pccnputc(dev_t dev, char c);
int pccngetc(dev_t dev);
int pccncheckc(dev_t dev);
void scintr(int unit);
int pcmmap(dev_t dev, int offset, int nprot);
u_int sgetc(int noblock);
int getchar(void);
static void scinit(void);
static void scput(u_char c);
@ -1184,6 +1184,12 @@ pccngetc(dev_t dev)
return(c);
}
int
pccncheckc(dev_t dev)
{
return (scgetc(1) & 0xff);
}
static void
none_saver(int test)
{
@ -2543,12 +2549,6 @@ getchar(void)
}
}
u_int
sgetc(int noblock)
{
return (scgetc(noblock) & 0xff);
}
int
pcmmap(dev_t dev, int offset, int nprot)
{

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
* $Id: cons.c,v 1.14 1994/08/30 19:36:35 davidg Exp $
* $Id: cons.c,v 1.15 1994/08/31 07:44:22 davidg Exp $
*/
@ -57,20 +57,20 @@
/* XXX - all this could be autoconfig()ed */
#include "sc.h"
#if NSC > 0
int pccnprobe(), pccninit(), pccngetc(), pccnputc();
int pccnprobe(), pccninit(), pccngetc(), pccncheckc(), pccnputc();
#endif
#include "sio.h"
#if NSIO > 0
int siocnprobe(), siocninit(), siocngetc(), siocnputc();
int siocnprobe(), siocninit(), siocngetc(), siocncheckc(), siocnputc();
#endif
struct consdev constab[] = {
#if NSC > 0
{ pccnprobe, pccninit, pccngetc, pccnputc },
{ pccnprobe, pccninit, pccngetc, pccncheckc, pccnputc },
#endif
#if NSIO > 0
{ siocnprobe, siocninit, siocngetc, siocnputc },
{ siocnprobe, siocninit, siocngetc, siocncheckc, siocnputc },
#endif
{ 0 },
};
@ -217,6 +217,14 @@ cngetc()
return ((*cn_tab->cn_getc)(cn_tab->cn_dev));
}
int
cncheckc()
{
if (cn_tab == NULL)
return (0);
return ((*cn_tab->cn_checkc)(cn_tab->cn_dev));
}
void
cnputc(c)
register int c;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
* $Id: cons.h,v 1.3 1993/11/07 17:41:33 wollman Exp $
* $Id: cons.h,v 1.5 1994/05/25 08:53:05 rgrimes Exp $
*/
#ifndef _MACHINE_CONS_H_
@ -46,6 +46,7 @@ struct consdev {
int (*cn_probe)(); /* probe hardware and fill in consdev info */
int (*cn_init)(); /* turn on as console */
int (*cn_getc)(); /* kernel getchar interface */
int (*cn_checkc)(); /* kernel "return char if available" interface */
int (*cn_putc)(); /* kernel putchar interface */
struct tty *cn_tp; /* tty structure for console device */
dev_t cn_dev; /* major/minor of device */
@ -79,6 +80,7 @@ extern int cnselect(dev_t, int, struct proc *);
/* other kernel entry points */
extern void cninit(void);
extern int cngetc(void);
extern int cncheckc(void);
extern void cnputc(int /*char*/);
extern int pg(const char *, ...);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.35 1994/10/08 06:20:52 rgrimes Exp $
* $Id: locore.s,v 1.36 1994/10/10 01:10:21 phk Exp $
*/
/*
@ -693,17 +693,20 @@ NON_GPROF_ENTRY(btext)
ret
begin: /* now running relocated at KERNBASE where the system is linked to run */
.globl _Crtat /* XXX - locore should not know about */
movl _Crtat,%eax /* variables of device drivers (pccons)! */
subl $(KERNBASE+0xA0000),%eax
movl _atdevphys,%edx /* get pte PA */
subl _KPTphys,%edx /* remove base of ptes, now have phys offset */
shll $PGSHIFT-2,%edx /* corresponding to virt offset */
addl $KERNBASE,%edx /* add virtual base */
movl %edx,_atdevbase
#if N_SC > 0
/* XXX: can't scinit relocate Crtat relative to atdevbase itself? */
.globl _Crtat /* XXX - locore should not know about */
movl _Crtat,%eax /* variables of device drivers (pccons)! */
subl $(KERNBASE+0xA0000),%eax
addl %eax,%edx
movl %edx,_Crtat
#endif
/* set up bootstrap stack - 48 bytes */
movl $_kstack+UPAGES*NBPG-4*12,%esp /* bootstrap stack end location */

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.76 1994/10/18 03:40:14 ache Exp $
* $Id: machdep.c,v 1.77 1994/10/19 00:05:59 wollman Exp $
*/
#include "npx.h"
@ -773,7 +773,7 @@ boot(arghowto)
PANIC_REBOOT_WAIT_TIME);
for (loop = PANIC_REBOOT_WAIT_TIME; loop > 0; --loop) {
DELAY(1000 * 1000); /* one second */
if (sgetc(1)) /* Did user type a key? */
if (cncheckc()) /* Did user type a key? */
break;
}
if (!loop)

View File

@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: syscons.c,v 1.68 1994/10/17 22:12:06 sos Exp $
* $Id: syscons.c,v 1.69 1994/10/18 03:34:53 ache Exp $
*/
#include "sc.h"
@ -213,9 +213,9 @@ void pccnprobe(struct consdev *cp);
void pccninit(struct consdev *cp);
void pccnputc(dev_t dev, char c);
int pccngetc(dev_t dev);
int pccncheckc(dev_t dev);
void scintr(int unit);
int pcmmap(dev_t dev, int offset, int nprot);
u_int sgetc(int noblock);
int getchar(void);
static void scinit(void);
static void scput(u_char c);
@ -1184,6 +1184,12 @@ pccngetc(dev_t dev)
return(c);
}
int
pccncheckc(dev_t dev)
{
return (scgetc(1) & 0xff);
}
static void
none_saver(int test)
{
@ -2543,12 +2549,6 @@ getchar(void)
}
}
u_int
sgetc(int noblock)
{
return (scgetc(noblock) & 0xff);
}
int
pcmmap(dev_t dev, int offset, int nprot)
{

View File

@ -37,7 +37,7 @@ static int wdtest = 0;
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.52 1994/10/17 23:34:21 wollman Exp $
* $Id: wd.c,v 1.53 1994/10/19 00:08:07 wollman Exp $
*/
/* TODO:
@ -1572,7 +1572,7 @@ wddump(dev_t dev)
extern caddr_t CADDR1;
/* Toss any characters present prior to dump. */
while (sgetc(1))
while (cncheckc())
;
/* Check for acceptable device. */
@ -1753,7 +1753,7 @@ wddump(dev_t dev)
blknum = blknext;
/* Operator aborting dump? */
if (sgetc(1) & 0xff) /* EWS: A hack to work with syscons */
if (cncheckc())
return (EINTR);
}
return (0);

View File

@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: syscons.c,v 1.68 1994/10/17 22:12:06 sos Exp $
* $Id: syscons.c,v 1.69 1994/10/18 03:34:53 ache Exp $
*/
#include "sc.h"
@ -213,9 +213,9 @@ void pccnprobe(struct consdev *cp);
void pccninit(struct consdev *cp);
void pccnputc(dev_t dev, char c);
int pccngetc(dev_t dev);
int pccncheckc(dev_t dev);
void scintr(int unit);
int pcmmap(dev_t dev, int offset, int nprot);
u_int sgetc(int noblock);
int getchar(void);
static void scinit(void);
static void scput(u_char c);
@ -1184,6 +1184,12 @@ pccngetc(dev_t dev)
return(c);
}
int
pccncheckc(dev_t dev)
{
return (scgetc(1) & 0xff);
}
static void
none_saver(int test)
{
@ -2543,12 +2549,6 @@ getchar(void)
}
}
u_int
sgetc(int noblock)
{
return (scgetc(noblock) & 0xff);
}
int
pcmmap(dev_t dev, int offset, int nprot)
{

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $Id: init_main.c,v 1.12 1994/10/02 04:45:45 davidg Exp $
* $Id: init_main.c,v 1.13 1994/10/09 07:34:52 davidg Exp $
*/
#include <sys/param.h>
@ -136,11 +136,6 @@ main(framep)
*/
p = &proc0;
curproc = p;
/*
* Attempt to find console and initialize
* in case of early panic or other messages.
*/
consinit();
printf(copyright);
vm_mem_init();

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
* $Id: cons.c,v 1.14 1994/08/30 19:36:35 davidg Exp $
* $Id: cons.c,v 1.15 1994/08/31 07:44:22 davidg Exp $
*/
@ -57,20 +57,20 @@
/* XXX - all this could be autoconfig()ed */
#include "sc.h"
#if NSC > 0
int pccnprobe(), pccninit(), pccngetc(), pccnputc();
int pccnprobe(), pccninit(), pccngetc(), pccncheckc(), pccnputc();
#endif
#include "sio.h"
#if NSIO > 0
int siocnprobe(), siocninit(), siocngetc(), siocnputc();
int siocnprobe(), siocninit(), siocngetc(), siocncheckc(), siocnputc();
#endif
struct consdev constab[] = {
#if NSC > 0
{ pccnprobe, pccninit, pccngetc, pccnputc },
{ pccnprobe, pccninit, pccngetc, pccncheckc, pccnputc },
#endif
#if NSIO > 0
{ siocnprobe, siocninit, siocngetc, siocnputc },
{ siocnprobe, siocninit, siocngetc, siocncheckc, siocnputc },
#endif
{ 0 },
};
@ -217,6 +217,14 @@ cngetc()
return ((*cn_tab->cn_getc)(cn_tab->cn_dev));
}
int
cncheckc()
{
if (cn_tab == NULL)
return (0);
return ((*cn_tab->cn_checkc)(cn_tab->cn_dev));
}
void
cnputc(c)
register int c;

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
* $Id: sd.c,v 1.34 1994/10/08 22:26:40 phk Exp $
* $Id: sd.c,v 1.35 1994/10/19 00:09:45 wollman Exp $
*/
#define SPLSD splbio
@ -1020,7 +1020,8 @@ sddump(dev_t dev)
addr = (char *) 0; /* starting address */
/* toss any characters present prior to dump */
while ((c = sgetc(1)) && (c != 0x100)); /*syscons and pccons differ */
while ((c = cncheckc(1)) && (c != 0x100));
/*syscons and pccons differ */
/* size of memory to dump */
num = Maxmem;
@ -1114,7 +1115,7 @@ sddump(dev_t dev)
(int) addr += 512 * blkcnt;
/* operator aborting dump? */
if ((c = sgetc(1)) && (c != 0x100))
if ((c = cncheckc(1)) && (c != 0x100))
return (EINTR);
}
return (0);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
* $Id: cons.h,v 1.3 1993/11/07 17:41:33 wollman Exp $
* $Id: cons.h,v 1.5 1994/05/25 08:53:05 rgrimes Exp $
*/
#ifndef _MACHINE_CONS_H_
@ -46,6 +46,7 @@ struct consdev {
int (*cn_probe)(); /* probe hardware and fill in consdev info */
int (*cn_init)(); /* turn on as console */
int (*cn_getc)(); /* kernel getchar interface */
int (*cn_checkc)(); /* kernel "return char if available" interface */
int (*cn_putc)(); /* kernel putchar interface */
struct tty *cn_tp; /* tty structure for console device */
dev_t cn_dev; /* major/minor of device */
@ -79,6 +80,7 @@ extern int cnselect(dev_t, int, struct proc *);
/* other kernel entry points */
extern void cninit(void);
extern int cngetc(void);
extern int cncheckc(void);
extern void cnputc(int /*char*/);
extern int pg(const char *, ...);