Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Nov 2002 04:25:21 -0800 (PST)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 20831 for review
Message-ID:  <200211081225.gA8CPLMO029726@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=20831

Change 20831 by jmallett@jmallett_dalek on 2002/11/08 04:25:18

	Update to latest NetBSD code.  Make it compile on FreeBSD.
	
	Submitted by:	Justin Wojdacki <jwojdacki@earthlink.net>

Affected files ...

.. //depot/projects/mips/sys/dev/arcbios/arcbios.c#3 edit
.. //depot/projects/mips/sys/dev/arcbios/arcbios.h#2 edit
.. //depot/projects/mips/sys/dev/arcbios/arcbios_tty.c#3 edit
.. //depot/projects/mips/sys/dev/arcbios/arcbiosvar.h#2 edit

Differences ...

==== //depot/projects/mips/sys/dev/arcbios/arcbios.c#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: arcbios.c,v 1.5 2001/11/13 12:53:24 lukem Exp $	*/
+/*	$NetBSD: arcbios.c,v 1.6 2002/09/06 13:23:02 gehenna Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,6 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcbios.c,v 1.5 2001/11/13 12:53:24 lukem Exp $");
 
 #include <sys/param.h>
 
@@ -56,13 +55,30 @@
 
 char arcbios_system_identifier[64 + 1];
 
-int	arcbios_cngetc(dev_t);
-void	arcbios_cnputc(dev_t, int);
+struct consdev *cn_tab;
+
+static cn_getc_t arcbios_cngetc;
+static cn_putc_t arcbios_cnputc;
 
 void	arcbios_fetch_system_identifier(struct arcbios_component *,
 	    struct arcbios_treewalk_context *);
 
-CONS_DRIVER(arcbios, NULL, NULL, NULL, arcbios_cngetc, NULL, arcbios_cnputc, NULL);
+#define CDEV_MAJOR 97
+
+struct consdev arcbios_cn = {
+	NULL /* Probe */, 
+	NULL /* Init */, 
+	NULL /* Term */,
+	arcbios_cngetc /* getc */,
+	NULL /* checkc */,
+	arcbios_cnputc /* putc */,
+	NULL /* dbctl */,
+	NULL /* tty */,
+	NODEV /* cn_dev */,
+	CN_NORMAL /* priority */ 
+};
+
+extern const struct cdevsw arcbios_cdevsw;
 
 /*
  * arcbios_init:
@@ -70,9 +86,8 @@
  *	Initialize the ARC BIOS.
  */
 int
-arcbios_init(vaddr_t pblkva)
+arcbios_init(vm_offset_t pblkva)
 {
-	int maj;
 	struct arcbios_sysid *sid;
 
 	ARCBIOS_SPB = (struct arcbios_spb *) pblkva;
@@ -91,10 +106,7 @@
 	/* Initialize our pointer to the firmware vector. */
 	ARCBIOS = ARCBIOS_SPB->FirmwareVector;
 
-	/* Find the ARC BIOS console device major (needed by cnopen) */
-	maj = cdevsw_lookup_major(&arcbios_cdevsw);
-
-	arcbios_cn.cn_dev = makedev(maj, 0);
+	arcbios_cn.cn_dev = makedev(CDEV_MAJOR, 0);
 
 	/* Initialize the bootstrap console. */
 	cn_tab = &arcbios_cn;

==== //depot/projects/mips/sys/dev/arcbios/arcbios.h#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: arcbios.h,v 1.2 2001/07/08 23:56:03 thorpej Exp $	*/
+/*	$NetBSD: arcbios.h,v 1.3 2001/12/06 14:59:02 rafal Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.

==== //depot/projects/mips/sys/dev/arcbios/arcbios_tty.c#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: arcbios_tty.c,v 1.4 2002/03/17 19:40:54 atatat Exp $	*/
+/*	$NetBSD: arcbios_tty.c,v 1.6 2002/10/23 09:13:06 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -28,25 +28,31 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcbios_tty.c,v 1.4 2002/03/17 19:40:54 atatat Exp $");
 
 #include <sys/param.h>
+#include <sys/proc.h>
 #include <sys/user.h>
 #include <sys/uio.h> 
 #include <sys/systm.h>
 #include <sys/callout.h>
 #include <sys/kernel.h>
 #include <sys/conf.h>
-#include <sys/proc.h>
 #include <sys/tty.h>
 #include <sys/termios.h>
 
 #include <sys/cons.h>
+#include <sys/clist.h>
 
 #include <dev/arcbios/arcbios.h>
 #include <dev/arcbios/arcbiosvar.h>
 
-struct callout arcbios_tty_ch = CALLOUT_INITIALIZER;
+#define CDEV_MAJOR 97
+
+struct callout arcbios_tty_ch = { { { NULL } }, 
+				  0, 
+				  NULL, 
+				  NULL, 
+				  0 };
 
 static struct tty *arcbios_tty[1];
 
@@ -54,34 +60,34 @@
 void	arcbios_tty_poll(void *);
 int	arcbios_tty_param(struct tty *, struct termios *);
 
-dev_type_open(arcbios_ttyopen);
-dev_type_close(arcbios_ttyclose);
-dev_type_read(arcbios_ttyread);
-dev_type_write(arcbios_ttywrite);
-dev_type_ioctl(arcbios_ttyioctl);
-dev_type_stop(arcbios_ttystop);
-dev_type_tty(arcbios_ttytty);
-dev_type_poll(arcbios_ttypoll);
+d_open_t   arcbios_ttyopen;
+d_close_t  arcbios_ttyclose;
+d_read_t   arcbios_ttyread;
+d_write_t  arcbios_ttywrite;
+d_ioctl_t  arcbios_ttyioctl;
+/*
+d_poll_t   arcbios_ttypoll;
+*/
 
-const struct cdevsw arcbios_cdevsw {
-	/* open */	arcbios_ttyopen,
-	/* close */	arcbios_ttyclose,
-	/* read */	arcbios_ttyread,
-	/* write */	arcbios_ttywrite,
-	/* ioctl */	arcbios_ttyioctl,
-	/* poll */	arcbios_ttypoll,
-	/* mmap */	nommap,
-	/* strategy */	nostrategy,
-	/* name */	arcbios_driver_name,
-	/* maj */	CDEV_MAJOR,
-	/* dump */	nodump,
-	/* psize */	nopsize,
-	/* flags */	D_TTY,
-	/* kqfilter */	nokqfilter,
+/* This structure is defined in sys/conf.h */
+struct cdevsw arcbios_cdevsw = {
+	arcbios_ttyopen, 
+	arcbios_ttyclose, 
+	arcbios_ttyread, 
+	arcbios_ttywrite,
+	arcbios_ttyioctl, 
+	ttypoll,
+	nommap, 
+	nostrategy  /* Strategy */,
+	"console"   /* Name */,
+	CDEV_MAJOR  /* Major Number */,
+	nodump      /* Dump */,
+	nopsize     /* PSize */,
+	D_TTY       /* Flags */,
+	ttykqfilter /* kqueue filter */
 };
 
-int
-arcbios_ttyopen(dev_t dev, int flag, int mode, struct proc *p)
+int arcbios_ttyopen( dev_t dev, int flag, int mode, struct thread *p )
 {
 	int unit = minor(dev);
 	struct tty *tp;
@@ -93,8 +99,9 @@
 	s = spltty();
 
 	if (arcbios_tty[unit] == NULL) {
-		tp = arcbios_tty[unit] = ttymalloc();
-		tty_attach(tp);
+		tp = arcbios_tty[unit] = ttymalloc( arcbios_tty[unit] );	
+		make_dev( &arcbios_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "arccons");
+		/* sc->dev->si_tty = tp; */
 	} else
 		tp = arcbios_tty[unit];
 
@@ -112,28 +119,28 @@
 		ttsetwater(tp);
 
 		setuptimeout = 1;
-	} else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) {
+	} else if (tp->t_state & TS_XCLUDE && p->td_ucred->cr_uid != 0) {
 		splx(s);
 		return (EBUSY);
 	}
 
 	splx(s);
 
-	error = (*tp->t_linesw->l_open)(dev, tp);
+	/* t_line */
+	error = (*linesw[tp->t_line].l_open)(dev,tp);
 	if (error == 0 && setuptimeout)
 		callout_reset(&arcbios_tty_ch, 1, arcbios_tty_poll, tp);
 
 	return (error);
 }
- 
-int
-arcbios_ttyclose(dev_t dev, int flag, int mode, struct proc *p)
+
+int arcbios_ttyclose(dev_t dev, int flag, int mode, struct thread *p)
 {
 	int unit = minor(dev);
 	struct tty *tp = arcbios_tty[unit];
 
 	callout_stop(&arcbios_tty_ch);
-	(*tp->t_linesw->l_close)(tp, flag);
+	(*linesw[tp->t_line].l_close)(tp,flag);
 	ttyclose(tp);
 	return (0);
 }
@@ -143,7 +150,7 @@
 {
 	struct tty *tp = arcbios_tty[minor(dev)];
 
-	return ((*tp->t_linesw->l_read)(tp, uio, flag));
+	return (*linesw[tp->t_line].l_read)(tp,uio,flag);
 }
  
 int
@@ -151,28 +158,19 @@
 {
 	struct tty *tp = arcbios_tty[minor(dev)];
  
-	return ((*tp->t_linesw->l_write)(tp, uio, flag));
+	return (*linesw[tp->t_line].l_write)(tp,uio,flag);
 }
 
-int
-arcbios_ttypoll(dev_t dev, int events, struct proc *p)
-{
-	struct tty *tp = arcbios_tty[minor(dev)];
- 
-	return ((*tp->t_linesw->l_poll)(tp, events, p));
-}
- 
-int
-arcbios_ttyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+int arcbios_ttyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *p)
 {
 	int unit = minor(dev);
 	struct tty *tp = arcbios_tty[unit];
-	int error;
+	int error = 0;
 
-	error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, p);
-	if (error != EPASSTHROUGH)
+	error = (*linesw[tp->t_line].l_ioctl)(tp,cmd,data,flag,p);
+	if (error != ENOIOCTL)
 		return (error);
-	return (ttioctl(tp, cmd, data, flag, p));
+	return (ttioctl(tp, cmd, data, flag));
 }
 
 int
@@ -191,17 +189,22 @@
 	s = spltty();
 	if (tp->t_state & (TS_TTSTOP | TS_BUSY))
 		goto out;
-	if (tp->t_outq.c_cc <= tp->t_lowat) {
-		if (tp->t_state & TS_ASLEEP) {
-			tp->t_state &= ~TS_ASLEEP;
+	if (tp->t_outq.c_cc <= tp->t_ilowat) {
+		if (tp->t_state & TS_SO_OLOWAT) {
+			tp->t_state &= ~TS_SO_OLOWAT;
 			wakeup((caddr_t)&tp->t_outq);
 		}
 		selwakeup(&tp->t_wsel);
 	}
 	tp->t_state |= TS_BUSY;
 	while (tp->t_outq.c_cc != 0) {
+		struct cblock *cbp = (struct cblock *)((intptr_t)tp->t_outq.c_cf & ~CROUND);
+		int cnt;
+
+		cnt = min( (char *)(cbp + 1) - tp->t_outq.c_cf, tp->t_outq.c_cc);
+		
 		(*ARCBIOS->Write)(ARCBIOS_STDOUT, tp->t_outq.c_cf,
-		    ndqb(&tp->t_outq, 0), &count);
+		    cnt , &count);
 		ndflush(&tp->t_outq, count);
 	}
 	tp->t_state &= ~TS_BUSY;
@@ -209,18 +212,6 @@
 	splx(s);
 }
 
-void
-arcbios_ttystop(struct tty *tp, int flag)
-{
-	int s;
-
-	s = spltty();
-	if (tp->t_state & TS_BUSY)
-		if ((tp->t_state & TS_TTSTOP) == 0)
-			tp->t_state |= TS_FLUSH;
-	splx(s);
-}
-
 static int
 arcbios_tty_getchar(int *cp)
 {
@@ -248,7 +239,7 @@
 
 	while (arcbios_tty_getchar(&c)) {
 		if (tp->t_state & TS_ISOPEN)
-			l_r = (*tp->t_linesw->l_rint)(c, tp);
+			l_r = (*linesw[tp->t_line].l_rint)(c,tp);
 	}
 	callout_reset(&arcbios_tty_ch, 1, arcbios_tty_poll, tp);
 }

==== //depot/projects/mips/sys/dev/arcbios/arcbiosvar.h#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: arcbiosvar.h,v 1.2 2001/07/08 22:57:10 thorpej Exp $	*/
+/*	$NetBSD: arcbiosvar.h,v 1.3 2001/07/08 23:57:09 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
 
 extern char arcbios_system_identifier[];
 
-int	arcbios_init(vaddr_t);
+int	arcbios_init(vm_offset_t);
 
 void	arcbios_tree_walk(void (*)(struct arcbios_component *,
 	    struct arcbios_treewalk_context *), void *);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211081225.gA8CPLMO029726>