Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Jun 2004 21:42:34 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 54002 for review
Message-ID:  <200406020442.i524gYQa022316@repoman.freebsd.org>

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

Change 54002 by rwatson@rwatson_tislabs on 2004/06/01 21:42:06

	Integrate netperf_socket: various changes, including removal
	of midi code, ttyioctl() centralization, fixups for
	vn_closefile(), but in particular, the loop back of accept
	locking from rwatson_netperf to CVS.  This may leave
	netperf_socket in a somewhat less usable state as changes
	are merged that were made after netperf_socket was created.

Affected files ...

.. //depot/projects/netperf_socket/sys/alpha/alpha/promcons.c#3 integrate
.. //depot/projects/netperf_socket/sys/alpha/tlsb/zs_tlsb.c#3 integrate
.. //depot/projects/netperf_socket/sys/compat/ndis/kern_ndis.c#14 integrate
.. //depot/projects/netperf_socket/sys/conf/NOTES#17 integrate
.. //depot/projects/netperf_socket/sys/conf/files#23 integrate
.. //depot/projects/netperf_socket/sys/dev/aac/aac.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/ata/ata-lowlevel.c#8 integrate
.. //depot/projects/netperf_socket/sys/dev/ata/ata-queue.c#8 integrate
.. //depot/projects/netperf_socket/sys/dev/ata/atapi-cd.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/cy/cy.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/dcons/dcons.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/digi/digi.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis_pccard.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis_pci.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/nmdm/nmdm.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/ofw/ofw_console.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/rc/rc.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/rp/rp.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/si/si.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/sio/sio.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/sound/isa/emu8000.c#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/isa/gusmidi.c#3 delete
.. //depot/projects/netperf_socket/sys/dev/sound/isa/mpu.c#3 delete
.. //depot/projects/netperf_socket/sys/dev/sound/isa/opl.c#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/isa/uartsio.c#3 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/midi.c#3 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/midi.h#3 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/midibuf.c#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/midibuf.h#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/midisynth.c#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/midisynth.h#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/miditypes.h#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/sequencer.c#3 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/sequencer.h#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/timer.c#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/midi/timer.h#2 delete
.. //depot/projects/netperf_socket/sys/dev/sound/pci/csamidi.c#3 delete
.. //depot/projects/netperf_socket/sys/dev/sx/sx.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/syscons/syscons.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/syscons/sysmouse.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ubser.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ucom.c#4 integrate
.. //depot/projects/netperf_socket/sys/geom/geom_sunlabel_enc.c#2 integrate
.. //depot/projects/netperf_socket/sys/i386/acpica/madt.c#5 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/io_apic.c#3 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/legacy.c#4 integrate
.. //depot/projects/netperf_socket/sys/i386/isa/pcvt/pcvt_drv.c#3 integrate
.. //depot/projects/netperf_socket/sys/i386/pci/pci_bus.c#6 integrate
.. //depot/projects/netperf_socket/sys/ia64/ia64/ssc.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_conf.c#4 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_descrip.c#6 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_event.c#4 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_mbuf.c#2 integrate
.. //depot/projects/netperf_socket/sys/kern/tty.c#4 integrate
.. //depot/projects/netperf_socket/sys/kern/tty_pty.c#4 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_accf.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#13 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_socket2.c#11 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_syscalls.c#13 integrate
.. //depot/projects/netperf_socket/sys/kern/vfs_vnops.c#5 integrate
.. //depot/projects/netperf_socket/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c#5 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_ksocket.c#5 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_tee.c#5 integrate
.. //depot/projects/netperf_socket/sys/pc98/pc98/sio.c#7 integrate
.. //depot/projects/netperf_socket/sys/sys/conf.h#5 integrate
.. //depot/projects/netperf_socket/sys/sys/socket.h#7 integrate
.. //depot/projects/netperf_socket/sys/sys/socketvar.h#7 integrate
.. //depot/projects/netperf_socket/sys/sys/sun_disklabel.h#3 integrate
.. //depot/projects/netperf_socket/sys/sys/tty.h#3 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/alpha/alpha/promcons.c#3 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/promcons.c,v 1.36 2004/02/28 16:36:14 kensmith Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/promcons.c,v 1.37 2004/06/01 13:49:25 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -61,13 +61,11 @@
 
 static	d_open_t	promopen;
 static	d_close_t	promclose;
-static	d_ioctl_t	promioctl;
 
 static struct cdevsw prom_cdevsw = {
 	.d_version =	D_VERSION,
 	.d_open =	promopen,
 	.d_close =	promclose,
-	.d_ioctl =	promioctl,
 	.d_name =	"prom",
 	.d_flags =	D_TTY | D_NEEDGIANT,
 };
@@ -156,31 +154,6 @@
 }
  
 int
-promioctl(dev, cmd, data, flag, td)
-	dev_t dev;
-	u_long cmd;
-	caddr_t data;
-	int flag;
-	struct thread *td;
-{
-	int unit = minor(dev);
-	struct tty *tp = prom_tp;
-	int error;
-
-	if (unit != 0)
-		return ENXIO;
-
-	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
-	if (error != ENOIOCTL)
-		return error;
-	error = ttioctl(tp, cmd, data, flag);
-	if (error != ENOIOCTL)
-		return error;
-
-	return ENOTTY;
-}
-
-int
 promparam(tp, t)
 	struct tty *tp;
 	struct termios *t;

==== //depot/projects/netperf_socket/sys/alpha/tlsb/zs_tlsb.c#3 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/tlsb/zs_tlsb.c,v 1.42 2004/02/21 21:10:38 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/tlsb/zs_tlsb.c,v 1.43 2004/06/01 13:49:26 phk Exp $");
 
 #include "opt_ddb.h"
 
@@ -68,13 +68,11 @@
 
 static	d_open_t	zsopen;
 static	d_close_t	zsclose;
-static	d_ioctl_t	zsioctl;
 
 static struct cdevsw zs_cdevsw = {
 	.d_version =	D_VERSION,
 	.d_open =	zsopen,
 	.d_close =	zsclose,
-	.d_ioctl =	zsioctl,
 	.d_name =	"zs",
 	.d_flags =	D_TTY | D_NEEDGIANT,
 };
@@ -328,31 +326,6 @@
 }
  
 static int
-zsioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-{
-	struct zs_softc *sc = ZS_SOFTC(minor(dev));
-	struct tty *tp;
-	int error;
-	
-	if (sc == NULL)
-		return (ENXIO);
-
-	tp = ZS_SOFTC(minor(dev))->tp;
-
-	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
-
-	if (error != ENOIOCTL)
-		return (error);
-
-	error = ttioctl(tp, cmd, data, flag);
-
-	if (error != ENOIOCTL)
-		return (error);
-	else
-		return (ENOTTY);
-}
-
-static int
 zsparam(struct tty *tp, struct termios *t)
 {
 	return (0);

==== //depot/projects/netperf_socket/sys/compat/ndis/kern_ndis.c#14 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.53 2004/04/22 07:08:39 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.54 2004/06/01 23:24:17 wpaul Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -49,6 +49,7 @@
 #include <sys/conf.h>
 
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/kthread.h>
 #include <machine/bus.h>
 #include <machine/resource.h>

==== //depot/projects/netperf_socket/sys/conf/NOTES#17 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1226 2004/05/20 10:37:10 pjd Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1227 2004/06/01 06:22:56 tanimura Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -1801,30 +1801,6 @@
 hint.pcm.0.drq="1"
 hint.pcm.0.flags="0x0"
 
-#
-# midi: MIDI interfaces and synthesizers
-#
-
-device		midi
-
-# For non-pnp sound cards with no bridge drivers:
-hint.midi.0.at="isa"
-hint.midi.0.irq="5"
-hint.midi.0.flags="0x0"
-
-# For serial ports (this example configures port 2):
-# TODO: implement generic tty-midi interface so that we can use
-#	other uarts.
-hint.midi.0.at="isa"
-hint.midi.0.port="0x2F8"
-hint.midi.0.irq="3"
-
-#
-# seq: MIDI sequencer
-#
-
-device		seq
-
 # The bridge drivers for sound cards.  These can be separately configured
 # for providing services to the likes of new-midi.
 # When used with 'device pcm' they also provide pcm sound services.

==== //depot/projects/netperf_socket/sys/conf/files#23 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.899 2004/05/31 21:46:03 bmilekic Exp $
+# $FreeBSD: src/sys/conf/files,v 1.900 2004/06/01 06:22:57 tanimura Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -663,33 +663,22 @@
 dev/sn/if_sn_pccard.c	optional sn pccard
 dev/snp/snp.c		optional snp
 dev/sound/isa/ad1816.c	optional pcm isa
-dev/sound/isa/emu8000.c	optional midi isa
 dev/sound/isa/es1888.c	optional pcm isa
 dev/sound/isa/ess.c	optional pcm isa
 dev/sound/isa/gusc.c	optional gusc isa
 dev/sound/isa/gusc.c	optional pcm isa
-dev/sound/isa/gusmidi.c	optional midi isa
-dev/sound/isa/mpu.c	optional midi isa
 dev/sound/isa/mss.c	optional pcm isa
-dev/sound/isa/opl.c	optional midi isa
 dev/sound/isa/sb16.c	optional pcm isa
 dev/sound/isa/sb8.c	optional pcm isa
 dev/sound/isa/sbc.c	optional pcm isa
 dev/sound/isa/sbc.c	optional sbc isa
 dev/sound/isa/sndbuf_dma.c	optional pcm isa
-dev/sound/isa/uartsio.c	optional midi isa
-dev/sound/midi/midi.c	optional midi
-dev/sound/midi/midibuf.c	optional midi
-dev/sound/midi/midisynth.c	optional midi
-dev/sound/midi/sequencer.c	optional seq midi
-dev/sound/midi/timer.c	optional seq midi
 dev/sound/pci/als4000.c	optional pcm pci
 #dev/sound/pci/au88x0.c	optional pcm pci
 dev/sound/pci/cmi.c	optional pcm pci
 dev/sound/pci/cs4281.c	optional pcm pci
 dev/sound/pci/csa.c	optional csa pci
 dev/sound/pci/csa.c	optional pcm pci
-dev/sound/pci/csamidi.c	optional midi csa
 dev/sound/pci/csapcm.c	optional pcm pci
 dev/sound/pci/ds1.c	optional pcm pci
 dev/sound/pci/emu10k1.c	optional pcm pci dependency "emu10k1-alsa%diked.h"

==== //depot/projects/netperf_socket/sys/dev/aac/aac.c#5 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.91 2004/04/14 19:11:29 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.93 2004/06/01 15:50:11 scottl Exp $");
 
 /*
  * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters.
@@ -68,7 +68,6 @@
 
 /* Command Processing */
 static void	aac_timeout(struct aac_softc *sc);
-static int	aac_map_command(struct aac_command *cm);
 static void	aac_complete(void *context, int pending);
 static int	aac_bio_command(struct aac_softc *sc, struct aac_command **cmp);
 static void	aac_bio_complete(struct aac_command *cm);
@@ -654,13 +653,18 @@
 aac_startio(struct aac_softc *sc)
 {
 	struct aac_command *cm;
+	int error;
 
 	debug_called(2);
 
-	if (sc->flags & AAC_QUEUE_FRZN)
-		return;
+	for (;;) {
+		/*
+		 * This flag might be set if the card is out of resources.
+		 * Checking it here prevents an infinite loop of deferrals.
+		 */
+		if (sc->flags & AAC_QUEUE_FRZN)
+			break;
 
-	for (;;) {
 		/*
 		 * Try to get a command that's been put off for lack of 
 		 * resources
@@ -678,47 +682,30 @@
 		if (cm == NULL)
 			break;
 
+		/* don't map more than once */
+		if (cm->cm_flags & AAC_CMD_MAPPED)
+			panic("aac: command %p already mapped", cm);
+
 		/*
-		 * Try to give the command to the controller.  Any error is
-		 * catastrophic since it means that bus_dmamap_load() failed.
+		 * Set up the command to go to the controller.  If there are no
+		 * data buffers associated with the command then it can bypass
+		 * busdma.
 		 */
-		if (aac_map_command(cm) != 0)
-			panic("aac: error mapping command %p\n", cm);
-	}
-}
-
-/*
- * Deliver a command to the controller; allocate controller resources at the
- * last moment when possible.
- */
-static int
-aac_map_command(struct aac_command *cm)
-{
-	struct aac_softc *sc;
-	int error;
-
-	debug_called(2);
-
-	sc = cm->cm_sc;
-	error = 0;
-
-	/* don't map more than once */
-	if (cm->cm_flags & AAC_CMD_MAPPED)
-		panic("aac: command %p already mapped", cm);
-
-	if (cm->cm_datalen != 0) {
-		error = bus_dmamap_load(sc->aac_buffer_dmat, cm->cm_datamap,
-					cm->cm_data, cm->cm_datalen,
-					aac_map_command_sg, cm, 0);
-		if (error == EINPROGRESS) {
-			debug(1, "freezing queue\n");
-			sc->flags |= AAC_QUEUE_FRZN;
-			error = 0;
-		}
-	} else {
-		aac_map_command_sg(cm, NULL, 0, 0);
+		if (cm->cm_datalen != 0) {
+			error = bus_dmamap_load(sc->aac_buffer_dmat,
+						cm->cm_datamap, cm->cm_data,
+						cm->cm_datalen,
+						aac_map_command_sg, cm, 0);
+			if (error == EINPROGRESS) {
+				debug(1, "freezing queue\n");
+				sc->flags |= AAC_QUEUE_FRZN;
+				error = 0;
+			} else if (error != 0)
+				panic("aac_startio: unexpected error %d from "
+				      "busdma\n", error);
+		} else
+			aac_map_command_sg(cm, NULL, 0, 0);
 	}
-	return (error);
 }
 
 /*
@@ -1285,9 +1272,10 @@
 				BUS_DMASYNC_PREWRITE);
 	cm->cm_flags |= AAC_CMD_MAPPED;
 
-	/* put the FIB on the outbound queue */
+	/* Put the FIB on the outbound queue */
 	if (aac_enqueue_fib(sc, cm->cm_queue, cm) == EBUSY) {
 		aac_unmap_command(cm);
+		sc->flags |= AAC_QUEUE_FRZN;
 		aac_requeue_ready(cm);
 	}
 
@@ -1827,6 +1815,12 @@
 		goto out;
 	}
 
+	/*
+	 * To avoid a race with its completion interrupt, place this command on
+	 * the busy queue prior to advertising it to the controller.
+	 */
+	aac_enqueue_busy(cm);
+
 	/* populate queue entry */
 	(sc->aac_qentries[queue] + pi)->aq_fib_size = fib_size;
 	(sc->aac_qentries[queue] + pi)->aq_fib_addr = fib_addr;
@@ -1834,12 +1828,6 @@
 	/* update producer index */
 	sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX] = pi + 1;
 
-	/*
-	 * To avoid a race with its completion interrupt, place this command on
-	 * the busy queue prior to advertising it to the controller.
-	 */
-	aac_enqueue_busy(cm);
-
 	/* notify the adapter if we know how */
 	if (aac_qinfo[queue].notify != 0)
 		AAC_QNOTIFY(sc, aac_qinfo[queue].notify);

==== //depot/projects/netperf_socket/sys/dev/ata/ata-lowlevel.c#8 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-lowlevel.c,v 1.36 2004/05/17 17:53:12 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-lowlevel.c,v 1.37 2004/06/01 11:34:46 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -75,6 +75,7 @@
 
     /* safetybelt for HW that went away */
     if (!request->device->param || request->device->channel->flags&ATA_HWGONE) {
+	request->retries = 0;
 	request->result = ENXIO;
 	return ATA_OP_FINISHED;
     }
@@ -531,7 +532,7 @@
     ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
     DELAY(10);
     ostat0 = ATA_IDX_INB(ch, ATA_STATUS);
-    if ((ostat0 & 0xf8) != 0xf8 && ostat0 != 0xa5) {
+    if ((ostat0 & 0xf8) != 0xf8 && ostat0 != 0xa5 && ostat0 != 0x7f) {
 	stat0 = ATA_S_BUSY;
 	mask |= 0x01;
     }
@@ -542,7 +543,7 @@
 
     /* in some setups we dont want to test for a slave */
     if (!(ch->flags & ATA_NO_SLAVE)) {
-	if ((ostat1 & 0xf8) != 0xf8 && ostat1 != 0xa5) {
+	if ((ostat1 & 0xf8) != 0xf8 && ostat1 != 0xa5 && ostat1 != 0x7f) {
 	    stat1 = ATA_S_BUSY;
 	    mask |= 0x02;
 	}

==== //depot/projects/netperf_socket/sys/dev/ata/ata-queue.c#8 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-queue.c,v 1.27 2004/04/30 16:21:34 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-queue.c,v 1.29 2004/06/01 12:26:08 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -303,7 +303,7 @@
 
     /* ATA errors */
     default:
-	if (request->status & ATA_S_ERROR) {
+	if (!request->result && request->status & ATA_S_ERROR) {
 	    if (!(request->flags & ATA_R_QUIET)) {
 		ata_prtdev(request->device,
 			   "FAILURE - %s status=%b error=%b", 
@@ -393,7 +393,8 @@
 		   "\2NO_MEDIA\1ILLEGAL_LENGTH");
 	}
 
-	if (request->error & ATA_E_MASK)
+	if ((request->u.atapi.sense_key ?
+	     request->u.atapi.sense_key : request->error) & ATA_E_MASK)
 	    request->result = EIO;
     }
 
@@ -499,7 +500,7 @@
     static char buffer[20];
 
     if (request->flags & ATA_R_ATAPI) {
-	switch (request->u.atapi.sense_cmd ?
+	switch (request->u.atapi.sense_key ?
 		request->u.atapi.sense_cmd : request->u.atapi.ccb[0]) {
 	case 0x00: return ("TEST_UNIT_READY");
 	case 0x01: return ("REZERO");

==== //depot/projects/netperf_socket/sys/dev/ata/atapi-cd.c#5 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.165 2004/03/02 14:03:43 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.166 2004/06/01 12:28:45 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -488,17 +488,18 @@
     if (!(request = ata_alloc_request()))
 	return ENOMEM;
 
-    request->device = cdp->device;
-    request->driver = cdp;
-    bcopy(ccb, request->u.atapi.ccb, 16);
-    request->flags = ATA_R_ATAPI;
-    request->timeout = 5;
-
     /* wait if drive is not finished loading the medium */
     while (timeout--) {
+	bzero(request, sizeof(struct ata_request));
+	request->device = cdp->device;
+	request->driver = cdp;
+	bcopy(ccb, request->u.atapi.ccb, 16);
+	request->flags = ATA_R_ATAPI;
+	request->timeout = 5;
 	ata_queue_request(request);
 	if (!request->error &&
-	    request->u.atapi.sense_data.sense_key == 2 &&
+	    (request->u.atapi.sense_data.sense_key == 2 ||
+	     request->u.atapi.sense_data.sense_key == 7) &&
 	    request->u.atapi.sense_data.asc == 4 &&
 	    request->u.atapi.sense_data.ascq == 1)
 	    tsleep(&timeout, PRIBIO, "acdld", hz / 2);

==== //depot/projects/netperf_socket/sys/dev/cy/cy.c#3 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cy/cy.c,v 1.145 2004/05/16 21:22:45 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cy/cy.c,v 1.146 2004/06/01 11:57:12 phk Exp $");
 
 #include "opt_compat.h"
 
@@ -795,7 +795,6 @@
 	cd_etc(com, CD1400_ETC_STOPBREAK);
 	(*linesw[tp->t_line].l_close)(tp, flag);
 	disc_optim(tp, &tp->t_termios, com);
-	comstop(tp, FREAD | FWRITE);
 	comhardclose(com);
 	ttyclose(tp);
 	siosettimeout();

==== //depot/projects/netperf_socket/sys/dev/dcons/dcons.c#4 (text+ko) ====

@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  * 
  * $Id: dcons.c,v 1.65 2003/10/24 03:24:55 simokawa Exp $
- * $FreeBSD: src/sys/dev/dcons/dcons.c,v 1.6 2004/05/30 20:08:30 phk Exp $
+ * $FreeBSD: src/sys/dev/dcons/dcons.c,v 1.9 2004/06/01 13:49:26 phk Exp $
  */
 
 #include <sys/param.h>
@@ -85,14 +85,12 @@
 
 static d_open_t		dcons_open;
 static d_close_t	dcons_close;
-static d_ioctl_t	dcons_ioctl;
 
 static struct cdevsw dcons_cdevsw = {
 #if __FreeBSD_version >= 500104
 	.d_version =	D_VERSION,
 	.d_open =	dcons_open,
 	.d_close =	dcons_close,
-	.d_ioctl =	dcons_ioctl,
 	.d_name =	"dcons",
 	.d_flags =	D_TTY | D_NEEDGIANT,
 #else
@@ -219,29 +217,6 @@
 }
 
 static int
-dcons_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct THREAD *td)
-{
-	int	unit;
-	struct	tty *tp;
-	int	error;
-
-	unit = minor(dev);
-	if (unit != 0)
-		return (ENXIO);
-
-	tp = dev->si_tty;
-	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
-	if (error != ENOIOCTL)
-		return (error);
-
-	error = ttioctl(tp, cmd, data, flag);
-	if (error != ENOIOCTL)
-		return (error);
-
-	return (ENOTTY);
-}
-
-static int
 dcons_tty_param(struct tty *tp, struct termios *t)
 {
 	tp->t_ispeed = t->c_ispeed;
@@ -586,10 +561,7 @@
 	if (tp->t_state & TS_ISOPEN) {
 		printf("dcons: still opened\n");
 		(*linesw[tp->t_line].l_close)(tp, 0);
-		tp->t_gen++;
 		ttyclose(tp);
-		ttwakeup(tp);
-		ttwwakeup(tp);
 	}
 	/* XXX
 	 * must wait until all device are closed.

==== //depot/projects/netperf_socket/sys/dev/digi/digi.c#4 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/digi/digi.c,v 1.40 2004/05/30 20:08:30 phk Exp $
+ * $FreeBSD: src/sys/dev/digi/digi.c,v 1.41 2004/06/01 11:57:12 phk Exp $
  */
 
 /*-
@@ -902,7 +902,6 @@
 	s = spltty();
 	linesw[tp->t_line].l_close(tp, flag);
 	digi_disc_optim(tp, &tp->t_termios, port);
-	digistop(tp, FREAD | FWRITE);
 	digihardclose(port);
 	ttyclose(tp);
 	if (--sc->opencnt == 0)

==== //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis_pccard.c#5 (text+ko) ====

@@ -31,12 +31,13 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pccard.c,v 1.4 2004/03/21 19:56:41 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pccard.c,v 1.5 2004/06/01 23:27:36 wpaul Exp $");
 
 #include <sys/ctype.h>
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/socket.h>
 #include <sys/queue.h>
 #include <sys/sysctl.h>

==== //depot/projects/netperf_socket/sys/dev/if_ndis/if_ndis_pci.c#6 (text+ko) ====

@@ -31,11 +31,12 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.5 2004/03/21 19:56:41 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.6 2004/06/01 23:27:36 wpaul Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/socket.h>
 #include <sys/queue.h>
 #include <sys/sysctl.h>

==== //depot/projects/netperf_socket/sys/dev/nmdm/nmdm.c#6 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/nmdm/nmdm.c,v 1.23 2004/05/30 20:08:36 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/nmdm/nmdm.c,v 1.25 2004/06/01 22:53:00 phk Exp $");
 
 /*
  * Pseudo-nulmodem driver
@@ -41,9 +41,6 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
-#include <sys/ioctl_compat.h>
-#endif
 #include <sys/proc.h>
 #include <sys/tty.h>
 #include <sys/conf.h>
@@ -54,27 +51,21 @@
 #include <sys/vnode.h>
 #include <sys/signalvar.h>
 #include <sys/malloc.h>
+#include <sys/taskqueue.h>
 
 MALLOC_DEFINE(M_NLMDM, "nullmodem", "nullmodem data structures");
 
 static void 	nmdmstart(struct tty *tp);
 static void 	nmdmstop(struct tty *tp, int rw);
-static void 	wakeup_other(struct tty *tp, int flag);
 static void 	nmdminit(dev_t dev);
 
 static d_open_t		nmdmopen;
 static d_close_t	nmdmclose;
-static d_read_t		nmdmread;
-static d_write_t	nmdmwrite;
-static d_ioctl_t	nmdmioctl;
 
 static struct cdevsw nmdm_cdevsw = {
 	.d_version =	D_VERSION,
 	.d_open =	nmdmopen,
 	.d_close =	nmdmclose,
-	.d_read =	nmdmread,
-	.d_write =	nmdmwrite,
-	.d_ioctl =	nmdmioctl,
 	.d_name =	"nmdn",
 	.d_flags =	D_TTY | D_PSEUDO | D_NEEDGIANT,
 };
@@ -85,10 +76,11 @@
 #define BFLAG		CLONE_FLAG0
 
 struct softpart {
-	struct tty	nm_tty;
+	struct tty	*nm_tty;
 	dev_t	dev;
-	int	modemsignals;	/* bits defined in sys/ttycom.h */
-	int	gotbreak;
+	int	dcd;
+	struct task		pt_task;
+	struct softpart		*other;
 };
 
 struct	nm_softc {
@@ -148,21 +140,40 @@
 }
 
 static void
-nmdm_crossover(struct nm_softc *pti,
-		struct softpart *ourpart,
-		struct softpart *otherpart);
+nmdm_task_tty(void *arg, int pending __unused)
+{
+	struct tty *tp, *otp;
+	struct softpart *sp;
+	int c;
 
-#define GETPARTS(tp, ourpart, otherpart) \
-do {	\
-	struct nm_softc *pti = tp->t_dev->si_drv1; \
-	if (tp == &pti->part1.nm_tty) { \
-		ourpart = &pti->part1; \
-		otherpart = &pti->part2; \
-	} else { \
-		ourpart = &pti->part2; \
-		otherpart = &pti->part1; \
-	}  \
-} while (0)
+	tp = arg;
+	sp = tp->t_sc;
+	otp = sp->other->nm_tty;
+	KASSERT(otp != NULL, ("NULL otp in nmdmstart"));
+	KASSERT(otp != tp, ("NULL otp == tp nmdmstart"));
+	if (sp->other->dcd) {
+		if (!(tp->t_state & TS_ISOPEN)) {
+			sp->other->dcd = 0;
+			(void)(*linesw[otp->t_line].l_modem)(otp, 0);
+		}
+	} else {
+		if (tp->t_state & TS_ISOPEN) {
+			sp->other->dcd = 1;
+			(void)(*linesw[otp->t_line].l_modem)(otp, 1);
+		}
+	}
+	if (tp->t_state & TS_TTSTOP)
+		return;
+	while (tp->t_outq.c_cc != 0) {
+		if (otp->t_state & TS_TBLOCK)
+			return;
+		c = getc(&tp->t_outq);
+		if (otp->t_state & TS_ISOPEN)
+			(*linesw[otp->t_line].l_rint)(c, otp);
+	}
+	if (tp->t_outq.c_cc == 0)
+		ttwwakeup(tp);
+}
 
 /*
  * This function creates and initializes a pair of ttys.
@@ -180,20 +191,34 @@
 
 	pt = malloc(sizeof(*pt), M_NLMDM, M_WAITOK | M_ZERO);
 	TAILQ_INSERT_TAIL(&nmdmhead, pt, pt_list);
+
 	dev1->si_drv1 = dev2->si_drv1 = pt;
 
 	pt->part1.dev = dev1;
 	pt->part2.dev = dev2;
-	dev1->si_tty = &pt->part1.nm_tty;
-	dev2->si_tty = &pt->part2.nm_tty;
-	ttyregister(&pt->part1.nm_tty);
-	ttyregister(&pt->part2.nm_tty);
-	pt->part1.nm_tty.t_oproc = nmdmstart;
-	pt->part2.nm_tty.t_oproc = nmdmstart;
-	pt->part1.nm_tty.t_stop = nmdmstop;
-	pt->part2.nm_tty.t_stop = nmdmstop;
-	pt->part2.nm_tty.t_dev = dev1;
-	pt->part1.nm_tty.t_dev = dev2;
+
+	pt->part1.nm_tty = ttymalloc(pt->part1.nm_tty);
+	pt->part1.nm_tty->t_oproc = nmdmstart;
+	pt->part1.nm_tty->t_stop = nmdmstop;
+	pt->part1.nm_tty->t_dev = dev1;
+	pt->part1.nm_tty->t_sc = &pt->part1;
+	TASK_INIT(&pt->part1.pt_task, 0, nmdm_task_tty, pt->part1.nm_tty);
+
+	pt->part2.nm_tty = ttymalloc(pt->part2.nm_tty);
+	pt->part2.nm_tty->t_oproc = nmdmstart;
+	pt->part2.nm_tty->t_stop = nmdmstop;
+	pt->part2.nm_tty->t_dev = dev2;
+	pt->part2.nm_tty->t_sc = &pt->part2;
+	TASK_INIT(&pt->part2.pt_task, 0, nmdm_task_tty, pt->part2.nm_tty);
+
+	pt->part1.other = &pt->part2;
+	pt->part2.other = &pt->part1;
+
+	dev1->si_tty = pt->part1.nm_tty;
+	dev1->si_drv1 = pt;
+
+	dev2->si_tty = pt->part2.nm_tty;
+	dev2->si_drv1 = pt;
 }
 
 /*
@@ -202,381 +227,61 @@
 static	int
 nmdmopen(dev_t dev, int flag, int devtype, struct thread *td)
 {
-	register struct tty *tp, *tp2;
+	struct tty *tp, *tp2;
 	int error;
 	struct nm_softc *pti;
-	struct	softpart *ourpart, *otherpart;
+	struct softpart *sp;
 
 	if (dev->si_drv1 == NULL)
 		nmdminit(dev);
 	pti = dev->si_drv1;
+	if (pti->pt_prison != td->td_ucred->cr_prison)
+		return (EBUSY);
 
-	if (minor(dev) & BFLAG)
-		tp = &pti->part2.nm_tty;
-	else 
-		tp = &pti->part1.nm_tty;
-	GETPARTS(tp, ourpart, otherpart);
+	tp = dev->si_tty;
+	sp = tp->t_sc;
+	tp2 = sp->other->nm_tty;
 
-	tp2 = &otherpart->nm_tty;
-	ourpart->modemsignals |= TIOCM_LE;
-
 	if ((tp->t_state & TS_ISOPEN) == 0) {
 		ttychars(tp);		/* Set up default chars */
 		tp->t_iflag = TTYDEF_IFLAG;
 		tp->t_oflag = TTYDEF_OFLAG;
 		tp->t_lflag = TTYDEF_LFLAG;
+		tp->t_lflag = 0;
 		tp->t_cflag = TTYDEF_CFLAG;
 		tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+		ttsetwater(tp); /* XXX ? */
 	} else if (tp->t_state & TS_XCLUDE && suser(td)) {
 		return (EBUSY);
-	} else if (pti->pt_prison != td->td_ucred->cr_prison) {
-		return (EBUSY);
 	}
 
-	/*
-	 * If the other side is open we have carrier
-	 */
-	if (tp2->t_state & TS_ISOPEN) {
-		(void)(*linesw[tp->t_line].l_modem)(tp, 1);
-	}
-
-	/*
-	 * And the other side gets carrier as we are now open.
-	 */
-	(void)(*linesw[tp2->t_line].l_modem)(tp2, 1);
-
-	/* External processing makes no sense here */
-	tp->t_lflag &= ~EXTPROC;
-
-	/* 
-	 * Wait here if we don't have carrier.
-	 */
-#if 0
-	while ((tp->t_state & TS_CARR_ON) == 0) {
-		if (flag & FNONBLOCK)
-			break;
-		error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
-				 "nmdopn", 0);
-		if (error)
-			return (error);
-	}
-#endif
-
-	/*
-	 * Give the line disciplin a chance to set this end up.
-	 */
 	error = (*linesw[tp->t_line].l_open)(dev, tp);
-
-	/*
-	 * Wake up the other side.
-	 * Theoretically not needed.
-	 */
-	ourpart->modemsignals |= TIOCM_DTR;
-	nmdm_crossover(pti, ourpart, otherpart);
-	if (error == 0)
-		wakeup_other(tp, FREAD|FWRITE); /* XXX */
 	return (error);
 }
 
-/*
- * Device closed again
- */
-static	int
+static int
 nmdmclose(dev_t dev, int flag, int mode, struct thread *td)
 {
-	register struct tty *tp, *tp2;
-	int err;
-	struct softpart *ourpart, *otherpart;
 
-	/*
-	 * let the other end know that the game is up
-	 */
-	tp = dev->si_tty;
-	GETPARTS(tp, ourpart, otherpart);
-	tp2 = &otherpart->nm_tty;
-	(void)(*linesw[tp2->t_line].l_modem)(tp2, 0);
-
-	/*
-	 * XXX MDMBUF makes no sense for nmdms but would inhibit the above
-	 * l_modem().  CLOCAL makes sense but isn't supported.   Special
-	 * l_modem()s that ignore carrier drop make no sense for nmdms but
-	 * may be in use because other parts of the line discipline make
-	 * sense for nmdms.  Recover by doing everything that a normal
-	 * ttymodem() would have done except for sending a SIGHUP.
-	 */
-	if (tp2->t_state & TS_ISOPEN) {
-		tp2->t_state &= ~(TS_CARR_ON | TS_CONNECTED);
-		tp2->t_state |= TS_ZOMBIE;
-		ttyflush(tp2, FREAD | FWRITE);
-	}
-
-	err = (*linesw[tp->t_line].l_close)(tp, flag);
-	ourpart->modemsignals &= ~TIOCM_DTR;
-	nmdm_crossover(dev->si_drv1, ourpart, otherpart);

>>> TRUNCATED FOR MAIL (1000 lines) <<<



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