Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Apr 2002 08:15:28 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 9101 for review
Message-ID:  <200204051615.g35GFS025877@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=9101

Change 9101 by jhb@jhb_laptop on 2002/04/05 08:15:23

	IFC.

Affected files ...

... //depot/projects/smpng/sys/alpha/alpha/machdep.c#38 integrate
... //depot/projects/smpng/sys/alpha/alpha/vm_machdep.c#10 integrate
... //depot/projects/smpng/sys/alpha/osf1/osf1_misc.c#13 integrate
... //depot/projects/smpng/sys/alpha/osf1/osf1_signal.c#8 integrate
... //depot/projects/smpng/sys/conf/files#32 integrate
... //depot/projects/smpng/sys/conf/files.sparc64#14 integrate
... //depot/projects/smpng/sys/conf/options#18 integrate
... //depot/projects/smpng/sys/dev/ata/ata-all.c#17 integrate
... //depot/projects/smpng/sys/dev/ata/ata-all.h#8 integrate
... //depot/projects/smpng/sys/dev/ata/ata-disk.c#16 integrate
... //depot/projects/smpng/sys/dev/ata/ata-disk.h#8 integrate
... //depot/projects/smpng/sys/dev/ata/ata-dma.c#17 integrate
... //depot/projects/smpng/sys/dev/ata/ata-isa.c#4 integrate
... //depot/projects/smpng/sys/dev/ata/ata-pci.c#17 integrate
... //depot/projects/smpng/sys/dev/ata/atapi-all.c#11 integrate
... //depot/projects/smpng/sys/dev/ata/atapi-all.h#6 integrate
... //depot/projects/smpng/sys/dev/ata/atapi-cd.c#21 integrate
... //depot/projects/smpng/sys/dev/ata/atapi-cd.h#6 integrate
... //depot/projects/smpng/sys/dev/ata/atapi-fd.c#7 integrate
... //depot/projects/smpng/sys/dev/ata/atapi-tape.c#10 integrate
... //depot/projects/smpng/sys/dev/isp/isp.c#17 integrate
... //depot/projects/smpng/sys/dev/isp/isp_freebsd.c#12 integrate
... //depot/projects/smpng/sys/dev/isp/isp_freebsd.h#10 integrate
... //depot/projects/smpng/sys/dev/isp/isp_inline.h#5 integrate
... //depot/projects/smpng/sys/dev/isp/isp_pci.c#11 integrate
... //depot/projects/smpng/sys/dev/isp/ispmbox.h#9 integrate
... //depot/projects/smpng/sys/dev/isp/ispvar.h#13 integrate
... //depot/projects/smpng/sys/dev/mk48txx/mk48txx.c#1 branch
... //depot/projects/smpng/sys/dev/mk48txx/mk48txxreg.h#1 branch
... //depot/projects/smpng/sys/dev/wi/if_wi.c#30 integrate
... //depot/projects/smpng/sys/dev/wi/if_wi_pccard.c#3 integrate
... //depot/projects/smpng/sys/dev/wi/if_wireg.h#11 integrate
... //depot/projects/smpng/sys/dev/wi/if_wivar.h#3 integrate
... //depot/projects/smpng/sys/fs/devfs/devfs_vnops.c#13 integrate
... //depot/projects/smpng/sys/fs/msdosfs/msdosfs_vnops.c#9 integrate
... //depot/projects/smpng/sys/i386/i386/trap.c#36 integrate
... //depot/projects/smpng/sys/i386/linux/linux.h#5 integrate
... //depot/projects/smpng/sys/kern/clock_if.m#1 branch
... //depot/projects/smpng/sys/kern/kern_exec.c#32 integrate
... //depot/projects/smpng/sys/kern/subr_clock.c#1 branch
... //depot/projects/smpng/sys/kern/subr_smp.c#12 integrate
... //depot/projects/smpng/sys/sparc64/include/eeprom.h#1 branch
... //depot/projects/smpng/sys/sparc64/sparc64/clock.c#5 integrate
... //depot/projects/smpng/sys/sparc64/sparc64/eeprom.c#1 branch
... //depot/projects/smpng/sys/sparc64/sparc64/eeprom_ebus.c#1 branch
... //depot/projects/smpng/sys/sparc64/sparc64/eeprom_sbus.c#1 branch
... //depot/projects/smpng/sys/sys/ata.h#9 integrate
... //depot/projects/smpng/sys/sys/cdio.h#3 integrate
... //depot/projects/smpng/sys/sys/clock.h#1 branch
... //depot/projects/smpng/sys/sys/pcpu.h#7 integrate
... //depot/projects/smpng/sys/vm/vm_extern.h#10 integrate
... //depot/projects/smpng/sys/vm/vm_meter.c#6 integrate

Differences ...

==== //depot/projects/smpng/sys/alpha/alpha/machdep.c#38 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.173 2002/04/04 21:03:13 jhb Exp $
+ * $FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.174 2002/04/05 00:52:15 alc Exp $
  */
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1204,21 +1204,6 @@
 		sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize);
 	PROC_UNLOCK(p);
 
-	(void)grow_stack(p, (u_long)sip);
-	if (!useracc((caddr_t)sip, fsize, VM_PROT_WRITE)) {
-		/*
-		 * Process has trashed its stack; give it an illegal
-		 * instruction to halt it in its tracks.
-		 */
-		PROC_LOCK(p);
-		SIGACTION(p, SIGILL) = SIG_DFL;	
-		SIGDELSET(p->p_sigignore, SIGILL);
-		SIGDELSET(p->p_sigcatch, SIGILL);
-		SIGDELSET(p->p_sigmask, SIGILL);
-		psignal(p, SIGILL);
-		return;
-	}
-
 	/*
 	 * Build the signal context to be used by sigreturn.
 	 */
@@ -1255,7 +1240,19 @@
 	/*
 	 * copy the frame out to userland.
 	 */
-	(void) copyout((caddr_t)&ksi, (caddr_t)sip, fsize);
+	if (copyout((caddr_t)&ksi, (caddr_t)sip, fsize) != 0) {
+		/*
+		 * Process has trashed its stack; give it an illegal
+		 * instruction to halt it in its tracks.
+		 */
+		PROC_LOCK(p);
+		SIGACTION(p, SIGILL) = SIG_DFL;	
+		SIGDELSET(p->p_sigignore, SIGILL);
+		SIGDELSET(p->p_sigcatch, SIGILL);
+		SIGDELSET(p->p_sigmask, SIGILL);
+		psignal(p, SIGILL);
+		return;
+	}
 
 	/*
 	 * Set up the registers to return to sigcode.
@@ -1338,31 +1335,11 @@
 		sfp = (struct sigframe *)(alpha_pal_rdusp() - rndfsize);
 	PROC_UNLOCK(p);
 
-	(void)grow_stack(p, (u_long)sfp);
 #ifdef DEBUG
 	if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
 		printf("sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid,
 		       sig, &sf, sfp);
 #endif
-	if (!useracc((caddr_t)sfp, sizeof(sf), VM_PROT_WRITE)) {
-#ifdef DEBUG
-		if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
-			printf("sendsig(%d): useracc failed on sig %d\n",
-			       p->p_pid, sig);
-#endif
-		/*
-		 * Process has trashed its stack; give it an illegal
-		 * instruction to halt it in its tracks.
-		 */
-		PROC_LOCK(p);
-		SIGACTION(p, SIGILL) = SIG_DFL;
-		SIGDELSET(p->p_sigignore, SIGILL);
-		SIGDELSET(p->p_sigcatch, SIGILL);
-		SIGDELSET(p->p_sigmask, SIGILL);
-		psignal(p, SIGILL);
-		return;
-	}
-
 	/* save the floating-point state, if necessary, then copy it. */
 	alpha_fpstate_save(td, 1);
 	sf.sf_uc.uc_mcontext.mc_ownedfp = td->td_md.md_flags & MDP_FPUSED;
@@ -1380,7 +1357,24 @@
 	/*
 	 * copy the frame out to userland.
 	 */
-	(void) copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf));
+	if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) {
+#ifdef DEBUG
+		if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
+			printf("sendsig(%d): copyout failed on sig %d\n",
+			       p->p_pid, sig);
+#endif
+		/*
+		 * Process has trashed its stack; give it an illegal
+		 * instruction to halt it in its tracks.
+		 */
+		PROC_LOCK(p);
+		SIGACTION(p, SIGILL) = SIG_DFL;
+		SIGDELSET(p->p_sigignore, SIGILL);
+		SIGDELSET(p->p_sigcatch, SIGILL);
+		SIGDELSET(p->p_sigmask, SIGILL);
+		psignal(p, SIGILL);
+		return;
+	}
 #ifdef DEBUG
 	if (sigdebug & SDB_FOLLOW)
 		printf("sendsig(%d): sig %d sfp %p code %lx\n", p->p_pid, sig,

==== //depot/projects/smpng/sys/alpha/alpha/vm_machdep.c#10 (text+ko) ====

@@ -38,7 +38,7 @@
  *
  *	from: @(#)vm_machdep.c	7.3 (Berkeley) 5/13/91
  *	Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $FreeBSD: src/sys/alpha/alpha/vm_machdep.c,v 1.65 2002/03/20 18:58:44 obrien Exp $
+ * $FreeBSD: src/sys/alpha/alpha/vm_machdep.c,v 1.66 2002/04/05 00:52:15 alc Exp $
  */
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -352,21 +352,6 @@
 	prom_halt(0);
 }
 
-int
-grow_stack(p, sp)
-	struct proc *p;
-	size_t sp;
-{
-	int rv;
-
-	rv = vm_map_growstack (p, sp);
-	if (rv != KERN_SUCCESS)
-		return (0);
-
-	return (1);
-}
-
-
 /*
  * Software interrupt handler for queued VM system processing.
  */   

==== //depot/projects/smpng/sys/alpha/osf1/osf1_misc.c#13 (text+ko) ====

@@ -29,7 +29,7 @@
 
 /*
  * Additional Copyright (c) 1999 by Andrew Gallatin
- * $FreeBSD: src/sys/alpha/osf1/osf1_misc.c,v 1.28 2002/04/01 21:30:29 jhb Exp $
+ * $FreeBSD: src/sys/alpha/osf1/osf1_misc.c,v 1.29 2002/04/05 00:08:38 eric Exp $
  */
 
 
@@ -1039,10 +1039,10 @@
  *  setuid() won't work.
  *
  *  Instead, by P1003.1b-1993, setuid() is supposed to work like:
- *	If the process has appropriate [super-user] priviledges, the
+ *	If the process has appropriate [super-user] privileges, the
  *	    setuid() function sets the real user ID, effective user
  *	    ID, and the saved set-user-ID to uid.
- *	If the process does not have appropriate priviledges, but uid
+ *	If the process does not have appropriate privileges, but uid
  *	    is equal to the real user ID or the saved set-user-ID, the
  *	    setuid() function sets the effective user ID to uid; the
  *	    real user ID and saved set-user-ID remain unchanged by

==== //depot/projects/smpng/sys/alpha/osf1/osf1_signal.c#8 (text+ko) ====

@@ -30,7 +30,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.
  *
- * $FreeBSD: src/sys/alpha/osf1/osf1_signal.c,v 1.16 2002/04/04 17:49:44 bde Exp $
+ * $FreeBSD: src/sys/alpha/osf1/osf1_signal.c,v 1.17 2002/04/05 00:52:15 alc Exp $
  */
 
 #include <sys/param.h>
@@ -616,21 +616,6 @@
 		sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize);
 	PROC_UNLOCK(p);
 
-	(void)grow_stack(p, (u_long)sip);
-	if (useracc((caddr_t)sip, fsize, VM_PROT_WRITE) == 0) {
-		/*
-		 * Process has trashed its stack; give it an illegal
-		 * instruction to halt it in its tracks.
-		 */
-		PROC_LOCK(p);
-		SIGACTION(p, SIGILL) = SIG_DFL;
-		SIGDELSET(p->p_sigignore, SIGILL);
-		SIGDELSET(p->p_sigcatch, SIGILL);
-		SIGDELSET(p->p_sigmask, SIGILL);
-		psignal(p, SIGILL);
-		return;
-	}
-
 	/*
 	 * Build the signal context to be used by sigreturn.
 	 */
@@ -667,7 +652,19 @@
 	/*
 	 * copy the frame out to userland.
 	 */
-	(void) copyout((caddr_t)&ksi, (caddr_t)sip, fsize);
+	if (copyout((caddr_t)&ksi, (caddr_t)sip, fsize) != 0) {
+		/*
+		 * Process has trashed its stack; give it an illegal
+		 * instruction to halt it in its tracks.
+		 */
+		PROC_LOCK(p);
+		SIGACTION(p, SIGILL) = SIG_DFL;
+		SIGDELSET(p->p_sigignore, SIGILL);
+		SIGDELSET(p->p_sigcatch, SIGILL);
+		SIGDELSET(p->p_sigmask, SIGILL);
+		psignal(p, SIGILL);
+		return;
+	}
 
 	/*
 	 * Set up the registers to return to sigcode.

==== //depot/projects/smpng/sys/conf/files#32 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.618 2002/04/02 02:50:48 imp Exp $
+# $FreeBSD: src/sys/conf/files,v 1.620 2002/04/04 23:44:33 tmm Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -16,6 +16,7 @@
 	dependency	"$S/dev/aic7xxx/aic7xxx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm"
 kern/device_if.m		standard
 kern/bus_if.m			standard
+kern/clock_if.m			optional genclock
 kern/linker_if.m			standard
 cam/cam.c		optional scbus
 cam/cam_extend.c	optional scbus
@@ -419,6 +420,7 @@
 dev/mii/qsphy.c		optional miibus
 dev/mii/acphy.c		optional miibus
 dev/mii/miibus_if.m	optional miibus
+dev/mk48txx/mk48txx.c	optional mk48txx
 dev/mlx/mlx.c		optional mlx
 dev/mlx/mlx_disk.c	optional mlx
 dev/mlx/mlx_pci.c	optional mlx
@@ -838,6 +840,7 @@
 kern/subr_autoconf.c	standard
 kern/subr_blist.c	standard
 kern/subr_bus.c		standard
+kern/subr_clock.c	optional genclock
 kern/subr_devstat.c	standard
 kern/subr_disk.c	standard
 kern/subr_disklabel.c	standard

==== //depot/projects/smpng/sys/conf/files.sparc64#14 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.sparc64,v 1.16 2002/03/27 05:39:18 dillon Exp $
+# $FreeBSD: src/sys/conf/files.sparc64,v 1.18 2002/04/05 02:42:25 tmm Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -17,8 +17,8 @@
 kern/syscalls.c			optional	ktr
 sparc64/ebus/ebus.c		count		ebus
 sparc64/isa/isa.c		optional	isa
-# The following is needed for both ISA and EBus.
-sparc64/isa/ofw_isa.c		standard
+sparc64/isa/ofw_isa.c		optional	ebus
+sparc64/isa/ofw_isa.c		optional	isa
 sparc64/pci/apb.c		optional	apb
 sparc64/pci/ofw_pci.c		optional	pci
 sparc64/pci/psycho.c		optional	pci
@@ -38,6 +38,9 @@
 # Otherwise it's they're normal.
 # sparc64/sparc64/locore.s	standard
 # sparc64/sparc64/exception.s	standard
+sparc64/sparc64/eeprom.c	optional	eeprom
+sparc64/sparc64/eeprom_ebus.c	optional	eeprom ebus
+sparc64/sparc64/eeprom_sbus.c	optional	eeprom sbus
 sparc64/sparc64/emul.c		standard
 sparc64/sparc64/fp.c		standard
 sparc64/sparc64/identcpu.c	standard

==== //depot/projects/smpng/sys/conf/options#18 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.309 2002/04/03 10:56:53 ru Exp $
+# $FreeBSD: src/sys/conf/options,v 1.310 2002/04/04 23:54:58 mjacob Exp $
 #
 #        On the handling of kernel options
 #
@@ -231,8 +231,9 @@
 SCSI_NCR_MAX_WIDE	opt_ncr.h
 SCSI_NCR_MYADDR		opt_ncr.h
 
-# Options used only in pci/isp_pci.c
+# Options used only in dev/isp/*
 ISP_TARGET_MODE		opt_isp.h
+ISP_FW_CRASH_DUMP	opt_isp.h
 
 # Options used in the 'ata' ATA/ATAPI driver
 ACD_DEBUG		opt_ata.h

==== //depot/projects/smpng/sys/dev/ata/ata-all.c#17 (text+ko) ====

@@ -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.
  *
- * $FreeBSD: src/sys/dev/ata/ata-all.c,v 1.144 2002/04/02 13:47:23 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-all.c,v 1.146 2002/04/05 15:58:45 sos Exp $
  */
 
 #include "opt_ata.h"
@@ -249,6 +249,7 @@
     ch->device[MASTER].mode = ATA_PIO;
     ch->device[SLAVE].mode = ATA_PIO;
     ch->devices = 0;
+    ata_dmafreetags(ch);
 
     bus_teardown_intr(dev, ch->r_irq, ch->ih);
     bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq);
@@ -383,8 +384,10 @@
 	    id1 = ata_drawersensor(atadev, 0, 0x4f, 0);
 	    ata_drawersensor(atadev, 1, 0x4e, 0x80);
 	    id2 = ata_drawersensor(atadev, 0, 0x4f, 0);
-	    if (id1 != 0xa3 || id2 != 0x5c)
+	    if (id1 != 0xa3 || id2 != 0x5c) {
+		ATA_UNLOCK_CH(ch);
 		return ENXIO;
+	    }
 
 	    div = 1 << (((ata_drawersensor(atadev, 0, 0x5d, 0)&0x20)>>3) +
 			((ata_drawersensor(atadev, 0, 0x47, 0)&0x30)>>4) + 1);
@@ -1251,7 +1254,7 @@
     }
 
     ATA_SLEEPLOCK_CH(atadev->channel, ATA_ACTIVE);
-    ata_dmainit(atadev->channel, atadev->unit, pmode, wmode, umode);
+    ata_dmainit(atadev, pmode, wmode, umode);
     ATA_UNLOCK_CH(atadev->channel);
     ata_start(atadev->channel); /* XXX SOS */
 }

==== //depot/projects/smpng/sys/dev/ata/ata-all.h#8 (text+ko) ====

@@ -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.
  *
- * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.51 2002/03/11 21:04:32 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.52 2002/04/05 13:13:55 sos Exp $
  */
 
 /* ATA register defines */
@@ -158,6 +158,18 @@
     u_int32_t count;
 };  
 
+struct ata_dmastate {
+    bus_dma_tag_t		ddmatag;	/* data DMA tag */
+    bus_dmamap_t		ddmamap;	/* data DMA map */
+    bus_dma_tag_t		cdmatag;	/* control DMA tag */
+    bus_dmamap_t		cdmamap;	/* control DMA map */
+    struct ata_dmaentry		*dmatab;	/* DMA transfer table */
+    bus_addr_t			mdmatab;	/* bus address of dmatab */
+    int				flags;		/* debugging */
+#define	ATA_DS_ACTIVE			0x01	/* debugging */
+#define	ATA_DS_READ			0x02	/* transaction is a read */
+};
+
 /* structure describing an ATA/ATAPI device */
 struct ata_device {
     struct ata_channel		*channel;
@@ -176,6 +188,7 @@
     int				mode;		/* transfermode */
     int				cmd;		/* last cmd executed */
     void			*result;	/* misc data */
+    struct ata_dmastate		dmastate;	/* dma state */
 };
 
 /* structure describing an ATA channel */
@@ -185,6 +198,7 @@
     struct resource		*r_io;		/* io addr resource handle */
     struct resource		*r_altio;	/* altio addr resource handle */
     struct resource		*r_bmio;	/* bmio addr resource handle */
+    bus_dma_tag_t		dmatag;		/* parent dma tag */
     struct resource		*r_irq;		/* interrupt of this channel */
     void			*ih;		/* interrupt handle */
     int (*intr_func)(struct ata_channel *);	/* interrupt function */
@@ -259,12 +273,14 @@
 int ata_umode(struct ata_params *);
 int ata_find_dev(device_t, u_int32_t, u_int32_t);
 
-void *ata_dmaalloc(struct ata_channel *, int);
-void ata_dmainit(struct ata_channel *, int, int, int, int);
-int ata_dmasetup(struct ata_channel *, int, struct ata_dmaentry *, caddr_t, int);
-void ata_dmastart(struct ata_channel *, int, struct ata_dmaentry *, int);
+int ata_dmaalloc(struct ata_device *);
+void ata_dmafree(struct ata_device *);
+void ata_dmafreetags(struct ata_channel *);
+void ata_dmainit(struct ata_device *, int, int, int);
+int ata_dmasetup(struct ata_device *, caddr_t, int32_t);
+void ata_dmastart(struct ata_device *, int);
 int ata_dmastatus(struct ata_channel *);
-int ata_dmadone(struct ata_channel *);
+int ata_dmadone(struct ata_device *);
 
 /* macros for locking a channel */
 #define ATA_LOCK_CH(ch, value)\
@@ -294,10 +310,18 @@
 	bus_space_read_multi_2(rman_get_bustag((res)), \
 			       rman_get_bushandle((res)), \
 			       (offset), (addr), (count))
+#define ATA_INSW_STRM(res, offset, addr, count) \
+	bus_space_read_multi_stream_2(rman_get_bustag((res)), \
+			 	      rman_get_bushandle((res)), \
+				      (offset), (addr), (count))
 #define ATA_INSL(res, offset, addr, count) \
 	bus_space_read_multi_4(rman_get_bustag((res)), \
 			       rman_get_bushandle((res)), \
 			       (offset), (addr), (count))
+#define ATA_INSL_STRM(res, offset, addr, count) \
+	bus_space_read_multi_stream_4(rman_get_bustag((res)), \
+			 	      rman_get_bushandle((res)), \
+				      (offset), (addr), (count))
 #define ATA_OUTB(res, offset, value) \
 	bus_space_write_1(rman_get_bustag((res)), \
 			  rman_get_bushandle((res)), (offset), (value))
@@ -311,7 +335,15 @@
 	bus_space_write_multi_2(rman_get_bustag((res)), \
 				rman_get_bushandle((res)), \
 				(offset), (addr), (count))
+#define ATA_OUTSW_STRM(res, offset, addr, count) \
+	bus_space_write_multi_stream_2(rman_get_bustag((res)), \
+			 	       rman_get_bushandle((res)), \
+				       (offset), (addr), (count))
 #define ATA_OUTSL(res, offset, addr, count) \
 	bus_space_write_multi_4(rman_get_bustag((res)), \
 				rman_get_bushandle((res)), \
 				(offset), (addr), (count))
+#define ATA_OUTSL_STRM(res, offset, addr, count) \
+	bus_space_write_multi_stream_4(rman_get_bustag((res)), \
+			 	       rman_get_bushandle((res)), \
+				       (offset), (addr), (count))

==== //depot/projects/smpng/sys/dev/ata/ata-disk.c#16 (text+ko) ====

@@ -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.
  *
- * $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.129 2002/03/31 22:36:35 phk Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.130 2002/04/05 13:13:55 sos Exp $
  */
 
 #include "opt_ata.h"
@@ -106,6 +106,8 @@
 {
     struct ad_softc *adp;
     dev_t dev;
+    u_int32_t lbasize;
+    u_int64_t lbasize48;
 
     if (!(adp = malloc(sizeof(struct ad_softc), M_AD, M_NOWAIT | M_ZERO))) {
 	ata_prtdev(atadev, "failed to allocate driver storage\n");
@@ -123,20 +125,26 @@
     adp->total_secs = atadev->param->cylinders * adp->heads * adp->sectors;	
     bioq_init(&adp->queue);
 
+    lbasize = (u_int32_t)atadev->param->lba_size_lo |
+	((u_int32_t)atadev->param->lba_size_hi << 16);
+
     /* does this device need oldstyle CHS addressing */
     if (!ad_version(atadev->param->version_major) || 
-	!(atadev->param->atavalid & ATA_FLAG_54_58) || !atadev->param->lba_size)
+	!(atadev->param->atavalid & ATA_FLAG_54_58) || !lbasize)
 	adp->flags |= AD_F_CHS_USED;
 
     /* use the 28bit LBA size if valid */
-    if (atadev->param->cylinders == 16383 &&
-	adp->total_secs < atadev->param->lba_size)
-	adp->total_secs = atadev->param->lba_size;
+    if (atadev->param->cylinders == 16383 && adp->total_secs < lbasize)
+	adp->total_secs = lbasize;
+
+    lbasize48 = (u_int64_t)atadev->param->lba_size48_1 |
+	((u_int64_t)atadev->param->lba_size48_2 << 16) |
+	((u_int64_t)atadev->param->lba_size48_3 << 32) |
+	((u_int64_t)atadev->param->lba_size48_4 << 48);
 
     /* use the 48bit LBA size if valid */
-    if (atadev->param->support.address48 &&
-	atadev->param->lba_size48 > 268435455)
-	adp->total_secs = atadev->param->lba_size48;
+    if (atadev->param->support.address48 && lbasize48 > 268435455)
+	adp->total_secs = lbasize48;
     
     ATA_SLEEPLOCK_CH(atadev->channel, ATA_CONTROL);
     /* use multiple sectors/interrupt if device supports it */
@@ -168,11 +176,10 @@
 
     /* use DMA if allowed and if drive/controller supports it */
     if (ata_dma)
-	ata_dmainit(atadev->channel, atadev->unit, ata_pmode(atadev->param), 
+	ata_dmainit(atadev, ata_pmode(atadev->param),
 		    ata_wmode(atadev->param), ata_umode(atadev->param));
     else
-	ata_dmainit(atadev->channel, atadev->unit,
-		    ata_pmode(atadev->param), -1, -1);
+	ata_dmainit(atadev, ata_pmode(atadev->param), -1, -1);
 
     /* use tagged queueing if allowed and supported */
     if (ata_tags && ad_tagsupported(adp)) {
@@ -235,6 +242,7 @@
 	biofinish(request->bp, NULL, ENXIO);
 	ad_free(request);
     }
+    ata_dmafree(atadev);
     while ((bp = bioq_first(&adp->queue))) {
 	bioq_remove(&adp->queue, bp); 
 	biofinish(bp, NULL, ENXIO);
@@ -366,7 +374,7 @@
     if (bp->bio_cmd == BIO_READ) 
 	request->flags |= ADR_F_READ;
     if (adp->device->mode >= ATA_DMA) {
-	if (!(request->dmatab = ata_dmaalloc(atadev->channel, atadev->unit)))
+	if (ata_dmaalloc(atadev))
 	    adp->device->mode = ATA_PIO;
     }
 
@@ -430,8 +438,7 @@
 	/* does this drive & transfer work with DMA ? */
 	request->flags &= ~ADR_F_DMA_USED;
 	if (adp->device->mode >= ATA_DMA &&
-	    !ata_dmasetup(adp->device->channel, adp->device->unit,
-			  request->dmatab, request->data, request->bytecount)) {
+	    !ata_dmasetup(adp->device, request->data, request->bytecount)) {
 	    request->flags |= ADR_F_DMA_USED;
 	    request->currentsize = request->bytecount;
 
@@ -480,8 +487,7 @@
 	    }
 
 	    /* start transfer, return and wait for interrupt */
-	    ata_dmastart(adp->device->channel, adp->device->unit,
-			 request->dmatab, request->flags & ADR_F_READ);
+	    ata_dmastart(adp->device, request->flags & ADR_F_READ);
 	    return ATA_OP_CONTINUES;
 	}
 
@@ -514,13 +520,13 @@
 
     /* output the data */
     if (adp->device->channel->flags & ATA_USE_16BIT)
-	ATA_OUTSW(adp->device->channel->r_io, ATA_DATA,
-		  (void *)((uintptr_t)request->data + request->donecount),
-		  request->currentsize / sizeof(int16_t));
+	ATA_OUTSW_STRM(adp->device->channel->r_io, ATA_DATA,
+		       (void *)((uintptr_t)request->data + request->donecount),
+		       request->currentsize / sizeof(int16_t));
     else
-	ATA_OUTSL(adp->device->channel->r_io, ATA_DATA,
-		  (void *)((uintptr_t)request->data + request->donecount),
-		  request->currentsize / sizeof(int32_t));
+	ATA_OUTSL_STRM(adp->device->channel->r_io, ATA_DATA,
+		       (void *)((uintptr_t)request->data + request->donecount),
+		       request->currentsize / sizeof(int32_t));
     return ATA_OP_CONTINUES;
 
 transfer_failed:
@@ -551,7 +557,7 @@
 
     /* finish DMA transfer */
     if (request->flags & ADR_F_DMA_USED)
-	dma_stat = ata_dmadone(adp->device->channel);
+	dma_stat = ata_dmadone(adp->device);
 
     /* do we have a corrected soft error ? */
     if (adp->device->channel->status & ATA_S_CORR)
@@ -578,8 +584,7 @@
 	    if (request->retries++ < AD_MAX_RETRIES)
 		printf(" retrying\n");
 	    else {
-		ata_dmainit(adp->device->channel, adp->device->unit, 
-			    ata_pmode(adp->device->param), -1, -1);
+		ata_dmainit(adp->device, ata_pmode(adp->device->param), -1, -1);
 		printf(" falling back to PIO mode\n");
 	    }
 	    TAILQ_INSERT_HEAD(&adp->device->channel->ata_queue, request, chain);
@@ -590,8 +595,7 @@
 	if (request->flags & ADR_F_DMA_USED) {
 	    untimeout((timeout_t *)ad_timeout, request,request->timeout_handle);
 	    ad_invalidatequeue(adp, request);
-	    ata_dmainit(adp->device->channel, adp->device->unit,
-			ata_pmode(adp->device->param), -1, -1);
+	    ata_dmainit(adp->device, ata_pmode(adp->device->param), -1, -1);
 	    request->flags |= ADR_F_FORCE_PIO;
 	    printf(" trying PIO mode\n");
 	    TAILQ_INSERT_HEAD(&adp->device->channel->ata_queue, request, chain);
@@ -623,13 +627,15 @@
 	else {
 	    /* data ready, read in */
 	    if (adp->device->channel->flags & ATA_USE_16BIT)
-		ATA_INSW(adp->device->channel->r_io, ATA_DATA,
-			 (void*)((uintptr_t)request->data + request->donecount),
-			 request->currentsize / sizeof(int16_t));
+		ATA_INSW_STRM(adp->device->channel->r_io, ATA_DATA,
+			      (void*)((uintptr_t)request->data +
+			      request->donecount), request->currentsize /
+			      sizeof(int16_t));
 	    else
-		ATA_INSL(adp->device->channel->r_io, ATA_DATA,
-			 (void*)((uintptr_t)request->data + request->donecount),
-			 request->currentsize / sizeof(int32_t));
+		ATA_INSL_STRM(adp->device->channel->r_io, ATA_DATA,
+			      (void*)((uintptr_t)request->data +
+			      request->donecount), request->currentsize /
+			      sizeof(int32_t));
 	}
     }
 
@@ -743,8 +749,7 @@
 	    ad_invalidatequeue(adp, NULL);
 	    return ATA_OP_FINISHED;
 	}
-	ata_dmastart(adp->device->channel, adp->device->unit,
-		     request->dmatab, request->flags & ADR_F_READ);
+	ata_dmastart(adp->device, request->flags & ADR_F_READ);
 	return ATA_OP_CONTINUES;
     }
     return ATA_OP_FINISHED;
@@ -753,8 +758,6 @@
 static void
 ad_free(struct ad_request *request)
 {
-    if (request->dmatab)
-	free(request->dmatab, M_DEVBUF);
     request->softc->tags[request->tag] = NULL;
     free(request, M_AD);
 }
@@ -829,11 +832,10 @@
 	       request->tag, request->serv);
 
     if (request->flags & ADR_F_DMA_USED) {
-	ata_dmadone(adp->device->channel);
+	ata_dmadone(adp->device);
 	ad_invalidatequeue(adp, request);
 	if (request->retries == AD_MAX_RETRIES) {
-	    ata_dmainit(adp->device->channel, adp->device->unit,
-			ata_pmode(adp->device->param), -1, -1);
+	    ata_dmainit(adp->device, ata_pmode(adp->device->param), -1, -1);
 	    ata_prtdev(adp->device, "trying fallback to PIO mode\n");
 	    request->retries = 0;
 	}
@@ -863,13 +865,11 @@
     ata_command(atadev, ATA_C_SET_MULTI, 0,
 		adp->transfersize / DEV_BSIZE, 0, ATA_WAIT_READY);
     if (adp->device->mode >= ATA_DMA)
-	ata_dmainit(atadev->channel, atadev->unit,
-		    ata_pmode(adp->device->param),
+	ata_dmainit(atadev, ata_pmode(adp->device->param),
 		    ata_wmode(adp->device->param),
 		    ata_umode(adp->device->param));
     else
-	ata_dmainit(atadev->channel, atadev->unit,
-		    ata_pmode(adp->device->param), -1, -1);
+	ata_dmainit(atadev, ata_pmode(adp->device->param), -1, -1);
 }
 
 void

==== //depot/projects/smpng/sys/dev/ata/ata-disk.h#8 (text+ko) ====

@@ -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.
  *
- * $FreeBSD: src/sys/dev/ata/ata-disk.h,v 1.40 2002/03/03 15:36:20 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-disk.h,v 1.41 2002/04/05 13:13:55 sos Exp $
  */
 
 /* structure describing an ATA disk request */
@@ -48,7 +48,6 @@
     struct bio			*bp;		/* associated bio ptr */
     u_int8_t			tag;		/* tag ID of this request */
     int				serv;		/* request had service */
-    struct ata_dmaentry		*dmatab;	/* DMA transfer table */
     TAILQ_ENTRY(ad_request)	chain;		/* list management */
 };
 

==== //depot/projects/smpng/sys/dev/ata/ata-dma.c#17 (text+ko) ====

@@ -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.
  *
- * $FreeBSD: src/sys/dev/ata/ata-dma.c,v 1.92 2002/04/02 16:45:06 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-dma.c,v 1.93 2002/04/05 13:13:55 sos Exp $
  */
 
 #include <sys/param.h>
@@ -36,80 +36,184 @@
 #include <sys/bus.h>
 #include <sys/disk.h>
 #include <sys/devicestat.h>
-#include <vm/vm.h>	     
-#include <vm/pmap.h>
 #include <pci/pcivar.h>
 #include <machine/bus.h>
 #include <sys/rman.h>
 #include <dev/ata/ata-all.h>
 
 /* prototypes */
-static void cyrix_timing(struct ata_channel *, int, int);
-static void promise_timing(struct ata_channel *, int, int);
-static void hpt_timing(struct ata_channel *, int, int);
-static int hpt_cable80(struct ata_channel *);
+static void ata_dmacreate(struct ata_device *, int, int);
+static void ata_dmasetupd_cb(void *, bus_dma_segment_t *, int, int);
+static void ata_dmasetupc_cb(void *, bus_dma_segment_t *, int, int);
+static void cyrix_timing(struct ata_device *, int, int);
+static void promise_timing(struct ata_device *, int, int);
+static void hpt_timing(struct ata_device *, int, int);
+static int hpt_cable80(struct ata_device *);
 
 /* misc defines */
-#ifdef __alpha__
-#undef vtophys
-#define vtophys(va)	alpha_XXX_dmamap((vm_offset_t)va)
-#endif
-#define ATAPI_DEVICE(ch, device) \
-	((device == ATA_MASTER && ch->devices & ATA_ATAPI_MASTER) || \
-	 (device == ATA_SLAVE && ch->devices & ATA_ATAPI_SLAVE))
+#define ATAPI_DEVICE(atadev) \
+	((atadev->unit == ATA_MASTER && \
+	  atadev->channel->devices & ATA_ATAPI_MASTER) || \
+	 (atadev->unit == ATA_SLAVE && \
+	  atadev->channel->devices & ATA_ATAPI_SLAVE))
+
+#define	MAXSEGSZ	PAGE_SIZE
+#define	MAXTABSZ	PAGE_SIZE
+#define	MAXCTLDMASZ	(2 * (MAXTABSZ + MAXPHYS))
+
+struct ata_dc_cb_args {
+    bus_addr_t maddr;
+    int error;
+};
+
+static void
+ata_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error)
+{
+    struct ata_dc_cb_args *cba = (struct ata_dc_cb_args *)xsc;
+
+    if (!(cba->error = error))
+	cba->maddr = segs[0].ds_addr;
+}
+
+int
+ata_dmaalloc(struct ata_device *atadev)
+{
+    struct ata_channel *ch;
+    struct ata_dc_cb_args ccba;
+    struct ata_dmastate *ds;
+    int error;
+
+    ch = atadev->channel;
+    ds = &atadev->dmastate;
+    if (!ds->cdmatag) {
+	if ((error = bus_dma_tag_create(ch->dmatag, 1, PAGE_SIZE,
+					BUS_SPACE_MAXADDR_32BIT,
+					BUS_SPACE_MAXADDR, NULL, NULL,
+					MAXTABSZ, 1, MAXTABSZ,
+					BUS_DMA_ALLOCNOW, &ds->cdmatag)))
+	    return error;
+    }
+    if (!ds->ddmatag) {
+	if ((error = bus_dma_tag_create(ch->dmatag, ch->alignment + 1, 0,
+					BUS_SPACE_MAXADDR_32BIT,
+					BUS_SPACE_MAXADDR, NULL, NULL,
+					MAXPHYS, ATA_DMA_ENTRIES, MAXSEGSZ,
+					BUS_DMA_ALLOCNOW, &ds->ddmatag)))
+	    return error;
+    }
+    if (!ds->mdmatab) {
+	if ((error = bus_dmamem_alloc(ds->cdmatag, (void **)&ds->dmatab, 0,
+				      &ds->cdmamap)))
+	    return error;
+
+	if ((error = bus_dmamap_load(ds->cdmatag, ds->cdmamap, ds->dmatab,
+				     MAXTABSZ, ata_dmasetupc_cb, &ccba,
+				     0)) != 0 || ccba.error != 0) {
+	    bus_dmamem_free(ds->cdmatag, ds->dmatab, ds->cdmamap);
+	    return error;
+	}
+	ds->mdmatab = ccba.maddr;
+    }
+    if (!ds->ddmamap) {
+	if ((error = bus_dmamap_create(ds->ddmatag, 0, &ds->ddmamap)) != 0)
+	    return error;
+    }
+    return 0;
+}
+
+void
+ata_dmafree(struct ata_device *atadev)
+{
+    struct ata_dmastate *ds;
+
+    ds = &atadev->dmastate;
+    if (ds->mdmatab) {
+	bus_dmamap_unload(ds->cdmatag, ds->cdmamap);
+	bus_dmamem_free(ds->cdmatag, ds->dmatab, ds->cdmamap);
+	ds->mdmatab = 0;
+	ds->cdmamap = NULL;
+	ds->dmatab = NULL;
+    }
+    if (ds->ddmamap) {
+	bus_dmamap_destroy(ds->ddmatag, ds->ddmamap);
+	ds->ddmamap = NULL;
+    }
+    if (ds->cdmatag) {
+	bus_dma_tag_destroy(ds->cdmatag);
+	ds->cdmatag = NULL;
+    }
+    if (ds->ddmatag) {
+	bus_dma_tag_destroy(ds->ddmatag);
+	ds->ddmatag = NULL;
+    }
+}
+
+void
+ata_dmafreetags(struct ata_channel *ch)
+{
+
+    if (ch->dmatag) {
+	bus_dma_tag_destroy(ch->dmatag);
+	ch->dmatag = NULL;
+    }
+}
 
-void *
-ata_dmaalloc(struct ata_channel *ch, int device)
+static void
+ata_dmacreate(struct ata_device *atadev, int apiomode, int mode)
 {
-    void *dmatab;
 
-    if ((dmatab = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT))) {
-	if (((uintptr_t)dmatab >> PAGE_SHIFT) ^
-	    (((uintptr_t)dmatab + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
-	    ata_printf(ch, device, "dmatab crosses page boundary, no DMA\n");
-	    free(dmatab, M_DEVBUF);
-	    dmatab = NULL;
+    atadev->mode = mode;
+    if (!atadev->channel->dmatag) {
+	if (bus_dma_tag_create(NULL, 1, 0,
+			       BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
+			       NULL, NULL, MAXCTLDMASZ, ATA_DMA_ENTRIES,
+			       BUS_SPACE_MAXSIZE_32BIT, 0,
+			       &atadev->channel->dmatag)) {
+	    ata_prtdev(atadev, "DMA tag allocation failed, disabling DMA\n");
+	    ata_dmainit(atadev, apiomode, -1, -1);
 	}
     }
-    return dmatab;
 }
 
 void
-ata_dmainit(struct ata_channel *ch, int device,
-	    int apiomode, int wdmamode, int udmamode)
+ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode)
 {
-    struct ata_device *atadev = &ch->device[ATA_DEV(device)];
-    device_t parent = device_get_parent(ch->dev);
-    int devno = (ch->unit << 1) + ATA_DEV(device);
+    device_t parent = device_get_parent(atadev->channel->dev);
+    int chiptype = atadev->channel->chiptype;
+    int chiprev = pci_get_revid(parent);
+    int channel = atadev->channel->unit;
+    int device = ATA_DEV(atadev->unit);
+    int devno = (channel << 1) + device;
     int error;
 
     /* set our most pessimistic default mode */
     atadev->mode = ATA_PIO;
 
-    if (!ch->r_bmio)
+    if (!atadev->channel->r_bmio)
 	return;
 
     /* if simplex controller, only allow DMA on primary channel */
-    if (ch->unit == 1) {
-	ATA_OUTB(ch->r_bmio, ATA_BMSTAT_PORT,
-		 ATA_INB(ch->r_bmio, ATA_BMSTAT_PORT) &
+    if (channel == 1) {
+	ATA_OUTB(atadev->channel->r_bmio, ATA_BMSTAT_PORT,
+		 ATA_INB(atadev->channel->r_bmio, ATA_BMSTAT_PORT) &
 		 (ATA_BMSTAT_DMA_MASTER | ATA_BMSTAT_DMA_SLAVE));
-	if (ATA_INB(ch->r_bmio, ATA_BMSTAT_PORT) & ATA_BMSTAT_DMA_SIMPLEX) {
+	if (ATA_INB(atadev->channel->r_bmio, ATA_BMSTAT_PORT) &
+	    ATA_BMSTAT_DMA_SIMPLEX) {
 	    ata_prtdev(atadev, "simplex device, DMA on primary only\n");
 	    return;
 	}
     }
 
     /* DMA engine address alignment is usually 1 word (2 bytes) */
-    ch->alignment = 0x1;
+    atadev->channel->alignment = 0x1;
 
 #if 1
-    if (udmamode > 2 && !ch->device[ATA_DEV(device)].param->hwres_cblid) {
+    if (udmamode > 2 && !atadev->param->hwres_cblid) {
 	ata_prtdev(atadev,"DMA limited to UDMA33, non-ATA66 cable or device\n");
 	udmamode = 2;
     }
 #endif
-    switch (ch->chiptype) {
+    switch (chiptype) {
 
     case 0x248a8086:	/* Intel ICH3 mobile */ 
     case 0x248b8086:	/* Intel ICH3 */
@@ -133,7 +237,7 @@
 				     (pci_read_config(parent, 0x48, 4) &
 				     ~mask48) | new48, 4);
 		    pci_write_config(parent, 0x54, word54 | (0x1000<<devno), 2);
-		    atadev->mode = ATA_UDMA5;

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

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?200204051615.g35GFS025877>