misc cleanup, better tty alloc for mfc. from osymh@gemini.oscs.montana.edu (Michael L. Hitch)
This commit is contained in:
parent
e26429a731
commit
f1e1796cf4
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mfc.c,v 1.5 1995/04/23 18:24:38 chopps Exp $ */
|
||||
/* $NetBSD: mfc.c,v 1.6 1995/07/04 18:06:40 chopps Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Michael L. Hitch
|
||||
@ -147,6 +147,7 @@ struct mfc_softc {
|
||||
#if NMFCS > 0
|
||||
struct mfcs_softc {
|
||||
struct device sc_dev;
|
||||
struct tty *sc_tty;
|
||||
struct duart_regs *sc_duart;
|
||||
struct mfc_regs *sc_regs;
|
||||
struct mfc_softc *sc_mfc;
|
||||
@ -207,7 +208,6 @@ int mfcsswflags[NMFCS];
|
||||
#define SWFLAGS(dev) (mfcsswflags[dev & 31] | (((dev) & 0x80) == 0 ? TIOCFLAG_SOFTCAR : 0))
|
||||
|
||||
struct vbl_node mfcs_vbl_node[NMFCS];
|
||||
struct tty *mfcs_tty[NMFCS];
|
||||
|
||||
#ifdef notyet
|
||||
/*
|
||||
@ -446,20 +446,22 @@ mfcsopen(dev, flag, mode, p)
|
||||
struct proc *p;
|
||||
{
|
||||
struct tty *tp;
|
||||
struct mfcs_softc *sc;
|
||||
int unit, error, s;
|
||||
|
||||
error = 0;
|
||||
unit = dev & 0x1f;
|
||||
|
||||
if (unit >= NMFCS || (mfcs_active & (1 << unit)) == 0)
|
||||
if (unit >= mfcscd.cd_ndevs || (mfcs_active & (1 << unit)) == 0)
|
||||
return (ENXIO);
|
||||
sc = mfcscd.cd_devs[unit];
|
||||
|
||||
s = spltty();
|
||||
|
||||
if (mfcs_tty[unit])
|
||||
tp = mfcs_tty[unit];
|
||||
if (sc->sc_tty)
|
||||
tp = sc->sc_tty;
|
||||
else
|
||||
tp = mfcs_tty[unit] = ttymalloc();
|
||||
tp = sc->sc_tty = ttymalloc();
|
||||
|
||||
tp->t_oproc = (void (*) (struct tty *)) mfcsstart;
|
||||
tp->t_param = mfcsparam;
|
||||
@ -550,7 +552,7 @@ mfcsclose(dev, flag, mode, p)
|
||||
|
||||
unit = dev & 31;
|
||||
|
||||
tp = mfcs_tty[unit];
|
||||
tp = sc->sc_tty;
|
||||
(*linesw[tp->t_line].l_close)(tp, flag);
|
||||
sc->sc_duart->ch_cr = 0x70; /* stop break */
|
||||
|
||||
@ -575,7 +577,7 @@ mfcsclose(dev, flag, mode, p)
|
||||
if (tp != &mfcs_cons) {
|
||||
remove_vbl_function(&mfcs_vbl_node[unit]);
|
||||
ttyfree(tp);
|
||||
mfcs_tty[unit] = (struct tty *) NULL;
|
||||
sc->sc_tty = (struct tty *) NULL;
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
@ -587,8 +589,9 @@ mfcsread(dev, uio, flag)
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
struct tty *tp;
|
||||
if ((tp = mfcs_tty[dev & 31]) == NULL)
|
||||
struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31];
|
||||
struct tty *tp = sc->sc_tty;
|
||||
if (tp == NULL)
|
||||
return(ENXIO);
|
||||
return((*linesw[tp->t_line].l_read)(tp, uio, flag));
|
||||
}
|
||||
@ -599,9 +602,10 @@ mfcswrite(dev, uio, flag)
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
struct tty *tp;
|
||||
struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31];
|
||||
struct tty *tp = sc->sc_tty;
|
||||
|
||||
if ((tp = mfcs_tty[dev & 31]) == NULL)
|
||||
if (tp == NULL)
|
||||
return(ENXIO);
|
||||
return((*linesw[tp->t_line].l_write)(tp, uio, flag));
|
||||
}
|
||||
@ -610,7 +614,9 @@ struct tty *
|
||||
mfcstty(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
return (mfcs_tty[dev & 31]);
|
||||
struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31];
|
||||
|
||||
return (sc->sc_tty);
|
||||
}
|
||||
|
||||
int
|
||||
@ -624,7 +630,7 @@ mfcsioctl(dev, cmd, data, flag, p)
|
||||
register int error;
|
||||
struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31];
|
||||
|
||||
tp = mfcs_tty[unit];
|
||||
tp = sc->sc_tty;
|
||||
if (!tp)
|
||||
return ENXIO;
|
||||
|
||||
@ -976,8 +982,8 @@ mfcintr (scc)
|
||||
}
|
||||
}
|
||||
if (istat & 0x01) { /* channel A transmit interrupt */
|
||||
tp = mfcs_tty[unit];
|
||||
sc = mfcscd.cd_devs[unit];
|
||||
tp = sc->sc_tty;
|
||||
if (sc->ptr == sc->end) {
|
||||
tp->t_state &= ~(TS_BUSY | TS_FLUSH);
|
||||
scc->imask &= ~0x01;
|
||||
@ -991,8 +997,8 @@ mfcintr (scc)
|
||||
regs->du_tba = *sc->ptr++;
|
||||
}
|
||||
if (istat & 0x10) { /* channel B transmit interrupt */
|
||||
tp = mfcs_tty[unit + 1];
|
||||
sc = mfcscd.cd_devs[unit + 1];
|
||||
tp = sc->sc_tty;
|
||||
if (sc->ptr == sc->end) {
|
||||
tp->t_state &= ~(TS_BUSY | TS_FLUSH);
|
||||
scc->imask &= ~0x10;
|
||||
@ -1017,7 +1023,7 @@ mfcsxintr(unit)
|
||||
{
|
||||
int s1, s2, ovfl;
|
||||
struct mfcs_softc *sc = mfcscd.cd_devs[unit];
|
||||
struct tty *tp = mfcs_tty[unit];
|
||||
struct tty *tp = sc->sc_tty;
|
||||
|
||||
/*
|
||||
* Make sure we're not interrupted by another
|
||||
@ -1060,11 +1066,12 @@ int
|
||||
mfcseint(unit, stat)
|
||||
int unit, stat;
|
||||
{
|
||||
struct mfcs_softc *sc = mfcscd.cd_devs[unit];
|
||||
struct tty *tp;
|
||||
u_char ch;
|
||||
int c;
|
||||
|
||||
tp = mfcs_tty[unit];
|
||||
tp = sc->sc_tty;
|
||||
ch = stat & 0xff;
|
||||
c = ch;
|
||||
|
||||
@ -1106,7 +1113,7 @@ mfcsmint(unit)
|
||||
struct mfcs_softc *sc = mfcscd.cd_devs[unit];
|
||||
u_char stat, last, istat;
|
||||
|
||||
tp = mfcs_tty[unit];
|
||||
tp = sc->sc_tty;
|
||||
if (!tp)
|
||||
return;
|
||||
|
||||
|
@ -1,3 +1,35 @@
|
||||
; $NetBSD: siop_script.ss,v 1.2 1995/07/04 18:06:43 chopps Exp $
|
||||
|
||||
;
|
||||
; Copyright (c) 1995 Michael L. Hitch
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
; 1. Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
; 3. All advertising materials mentioning features or use of this software
|
||||
; must display the following acknowledgement:
|
||||
; This product includes software developed by Michael L. Hitch.
|
||||
; 4. The name of the author may not be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
|
||||
; NCR 53c710 script
|
||||
;
|
||||
ABSOLUTE ds_Device = 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: zbus.c,v 1.4 1995/04/23 16:20:47 chopps Exp $ */
|
||||
/* $NetBSD: zbus.c,v 1.5 1995/07/04 18:06:44 chopps Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
@ -72,6 +72,7 @@ static struct aconfdata aconftab[] = {
|
||||
{ "gvpbus", 2017, 2 },
|
||||
{ "gvpbus", 2017, 11 },
|
||||
{ "giv", 2017, 32 },
|
||||
{ "gio", 2017, 255 },
|
||||
/* progressive perhiperals */
|
||||
{ "zssc", 2026, 150 },
|
||||
{ "ppia", 2026, 187 },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: disklabel.h,v 1.4 1994/10/26 02:06:07 cgd Exp $ */
|
||||
/* $NetBSD: disklabel.h,v 1.5 1995/07/04 18:06:47 chopps Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
@ -95,6 +95,7 @@ struct rdblock {
|
||||
#define RDBF_NORESELECT 0x8 /* do not use reselect */
|
||||
#define RDBF_DISKID 0x10 /* disk id is valid ?? */
|
||||
#define RDBF_CTRLID 0x20 /* ctrl id is valid ?? */
|
||||
#define RDBF_SYNC 0x40 /* drive supports SCSI synchronous mode */
|
||||
|
||||
struct ados_environ {
|
||||
u_long tabsize; /* 0: environ table size */
|
||||
|
@ -1,9 +1,19 @@
|
||||
/* $NetBSD: binpatch.c,v 1.4 1994/10/26 02:06:55 cgd Exp $ */
|
||||
/* $NetBSD: binpatch.c,v 1.5 1995/07/04 18:06:49 chopps Exp $ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <a.out.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/*
|
||||
* assume NMAGIC files are linked at 0 (for kernel)
|
||||
*/
|
||||
#undef N_TXTADDR
|
||||
#define N_TXTADDR(ex) \
|
||||
((N_GETMAGIC2(ex) == (ZMAGIC|0x10000) || N_GETMAGIC2(ex) == NMAGIC) ? \
|
||||
0 : __LDPGSZ)
|
||||
#endif
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user