Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Oct 2003 08:42:47 -0800 (PST)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 40839 for review
Message-ID:  <200310301642.h9UGglQj044129@repoman.freebsd.org>

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

Change 40839 by sam@sam_ebb on 2003/10/30 08:42:36

	IFC @ 40838

Affected files ...

.. //depot/projects/netperf/sys/amd64/amd64/pmap.c#14 integrate
.. //depot/projects/netperf/sys/amd64/amd64/trap.c#7 integrate
.. //depot/projects/netperf/sys/compat/freebsd32/freebsd32.h#2 integrate
.. //depot/projects/netperf/sys/compat/freebsd32/freebsd32_misc.c#2 integrate
.. //depot/projects/netperf/sys/compat/ia32/ia32_signal.h#2 integrate
.. //depot/projects/netperf/sys/compat/ia32/ia32_sysvec.c#3 integrate
.. //depot/projects/netperf/sys/dev/ata/ata-chipset.c#8 integrate
.. //depot/projects/netperf/sys/dev/ata/ata-pci.h#5 integrate
.. //depot/projects/netperf/sys/dev/hatm/if_hatm.c#8 integrate
.. //depot/projects/netperf/sys/dev/hatm/if_hatm_intr.c#6 integrate
.. //depot/projects/netperf/sys/dev/hatm/if_hatmvar.h#6 integrate
.. //depot/projects/netperf/sys/dev/sound/isa/mpu.c#3 integrate
.. //depot/projects/netperf/sys/dev/syscons/syscons.c#5 integrate
.. //depot/projects/netperf/sys/i386/acpica/acpi_machdep.c#5 integrate
.. //depot/projects/netperf/sys/i386/acpica/acpi_wakecode.S#5 integrate
.. //depot/projects/netperf/sys/i386/acpica/acpi_wakeup.c#6 integrate
.. //depot/projects/netperf/sys/i386/i386/trap.c#5 integrate
.. //depot/projects/netperf/sys/isa/syscons_isa.c#2 integrate
.. //depot/projects/netperf/sys/kern/kern_sig.c#8 integrate
.. //depot/projects/netperf/sys/kern/vfs_default.c#3 integrate
.. //depot/projects/netperf/sys/net/route.c#24 integrate
.. //depot/projects/netperf/sys/netinet6/in6.c#12 integrate
.. //depot/projects/netperf/sys/netinet6/in6.h#5 integrate
.. //depot/projects/netperf/sys/netinet6/in6_src.c#15 integrate
.. //depot/projects/netperf/sys/netinet6/in6_var.h#6 integrate
.. //depot/projects/netperf/sys/netinet6/ip6_input.c#16 integrate
.. //depot/projects/netperf/sys/vm/swap_pager.c#10 integrate

Differences ...

==== //depot/projects/netperf/sys/amd64/amd64/pmap.c#14 (text+ko) ====

@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.443 2003/10/14 05:51:31 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.444 2003/10/30 04:08:22 peter Exp $");
 
 /*
  *	Manages physical address maps.
@@ -2695,7 +2695,6 @@
 	vm_size_t size;
 {
 	vm_offset_t base, offset, tmpva;
-	pt_entry_t *pte;
 
 	/* If we gave a direct map region in pmap_mapdev, do nothing */
 	if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS)
@@ -2703,10 +2702,8 @@
 	base = va & PG_FRAME;
 	offset = va & PAGE_MASK;
 	size = roundup(offset + size, PAGE_SIZE);
-	for (tmpva = base; tmpva < (base + size); tmpva += PAGE_SIZE) {
-		pte = vtopte(tmpva);
-		pte_clear(pte);
-	}
+	for (tmpva = base; tmpva < (base + size); tmpva += PAGE_SIZE)
+		pmap_kremove(tmpva);
 	pmap_invalidate_range(kernel_pmap, va, tmpva);
 	kmem_free(kernel_map, base, size);
 }

==== //depot/projects/netperf/sys/amd64/amd64/trap.c#7 (text+ko) ====

@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.267 2003/10/28 01:06:37 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.268 2003/10/30 04:06:28 peter Exp $");
 
 /*
  * AMD64 Trap and System call handling
@@ -261,6 +261,8 @@
 			break;
 
 		case T_PAGEFLT:		/* page fault */
+			if (td->td_flags & TDF_SA)
+				thread_user_enter(p, td);
 			i = trap_pfault(&frame, TRUE);
 			if (i == -1)
 				goto userout;

==== //depot/projects/netperf/sys/compat/freebsd32/freebsd32.h#2 (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/compat/freebsd32/freebsd32.h,v 1.2 2003/08/22 23:07:28 peter Exp $
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32.h,v 1.3 2003/10/30 02:40:30 peter Exp $
  */
 
 #ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
@@ -75,6 +75,8 @@
 	int32_t	ru_nivcsw;
 };
 
+#define FREEBSD32_MNAMELEN        (88 - 2 * sizeof(int32_t)) /* size of on/from name bufs */
+
 struct statfs32 {
 	int32_t	f_spare2;
 	int32_t	f_bsize;
@@ -91,12 +93,12 @@
 	int32_t	f_syncwrites;
 	int32_t	f_asyncwrites;
 	char	f_fstypename[MFSNAMELEN];
-	char	f_mntonname[MNAMELEN];
+	char	f_mntonname[FREEBSD32_MNAMELEN];
 	int32_t	f_syncreads;
 	int32_t	f_asyncreads;
 	int16_t	f_spares1;
-	char	f_mntfromname[MNAMELEN];
-	int16_t	f_spares2;
+	char	f_mntfromname[FREEBSD32_MNAMELEN];
+	int16_t	f_spares2 __packed;
 	int32_t f_spare[2];
 };
 

==== //depot/projects/netperf/sys/compat/freebsd32/freebsd32_misc.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.13 2003/08/23 00:04:52 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.14 2003/10/30 02:40:30 peter Exp $");
 
 #include "opt_compat.h"
 
@@ -79,6 +79,11 @@
 #include <compat/freebsd32/freebsd32.h>
 #include <compat/freebsd32/freebsd32_proto.h>
 
+CTASSERT(sizeof(struct timeval32) == 8);
+CTASSERT(sizeof(struct timespec32) == 8);
+CTASSERT(sizeof(struct statfs32) == 256);
+CTASSERT(sizeof(struct rusage32) == 72);
+
 /*
  * [ taken from the linux emulator ]
  * Search an alternate path before passing pathname arguments on
@@ -356,6 +361,8 @@
 	int		ss_flags;
 };
 
+CTASSERT(sizeof(struct sigaltstack32) == 12);
+
 int
 freebsd32_sigaltstack(struct thread *td,
 		      struct freebsd32_sigaltstack_args *uap)
@@ -589,6 +596,8 @@
 	struct timeval32 it_value;
 };
 
+CTASSERT(sizeof(struct itimerval32) == 16);
+
 int
 freebsd32_setitimer(struct thread *td, struct freebsd32_setitimer_args *uap)
 {
@@ -668,6 +677,8 @@
 	u_int32_t	udata;		/* opaque user data identifier */
 };
 
+CTASSERT(sizeof(struct kevent32) == 20);
+
 int
 freebsd32_kevent(struct thread *td, struct freebsd32_kevent_args *uap)
 {
@@ -819,6 +830,8 @@
 };
 #define	STACKGAPLEN	400
 
+CTASSERT(sizeof(struct iovec32) == 8);
+
 int
 freebsd32_readv(struct thread *td, struct freebsd32_readv_args *uap)
 {
@@ -1198,8 +1211,14 @@
 	u_int32_t st_blksize;
 	u_int32_t st_flags;
 	u_int32_t st_gen;
+	struct timespec32 st_birthtimespec;
+	unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
+	unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
 };
 
+
+CTASSERT(sizeof(struct stat32) == 96);
+
 static void
 copy_stat( struct stat *in, struct stat32 *out)
 {
@@ -1342,6 +1361,8 @@
 	sigset_t	sa_mask;
 };
 
+CTASSERT(sizeof(struct sigaction32) == 24);
+
 int
 freebsd32_sigaction(struct thread *td, struct freebsd32_sigaction_args *uap)
 {

==== //depot/projects/netperf/sys/compat/ia32/ia32_signal.h#2 (text+ko) ====

@@ -26,7 +26,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/compat/ia32/ia32_signal.h,v 1.1 2003/05/14 04:10:48 peter Exp $
+ * $FreeBSD: src/sys/compat/ia32/ia32_signal.h,v 1.2 2003/10/30 02:40:30 peter Exp $
  */
 
 struct ia32_sigaltstack {
@@ -35,7 +35,6 @@
 	int		ss_flags;	/* SS_DISABLE and/or SS_ONSTACK */
 };
 
-/* XXX should be 640 bytes long; check and see if __packed is needed */
 struct ia32_mcontext {
 	int	mc_onstack;		/* XXX - sigcontext compat. */
 	int	mc_gs;			/* machine state (struct trapframe) */
@@ -69,7 +68,6 @@
 	int	mc_spare2[8];
 };
 
-/* XXX should be 704 bytes long; check and see if __packed is needed */
 struct ia32_ucontext {
 	sigset_t		uc_sigmask;
 	struct ia32_mcontext	uc_mcontext;

==== //depot/projects/netperf/sys/compat/ia32/ia32_sysvec.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.9 2003/09/25 01:10:23 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.10 2003/10/30 02:43:19 peter Exp $");
 
 #include "opt_compat.h"
 
@@ -75,6 +75,16 @@
 #include <machine/pcb.h>
 #include <machine/cpufunc.h>
 
+CTASSERT(sizeof(struct ia32_mcontext) == 640);
+CTASSERT(sizeof(struct ia32_ucontext) == 704);
+CTASSERT(sizeof(struct ia32_sigframe) == 800);
+CTASSERT(sizeof(struct ia32_siginfo) == 64);
+#ifdef COMPAT_FREEBSD4
+CTASSERT(sizeof(struct ia32_mcontext4) == 260);
+CTASSERT(sizeof(struct ia32_ucontext4) == 324);
+CTASSERT(sizeof(struct ia32_sigframe4) == 408);
+#endif
+
 static register_t *ia32_copyout_strings(struct image_params *imgp);
 static void ia32_setregs(struct thread *td, u_long entry, u_long stack,
     u_long ps_strings);

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

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.43 2003/10/28 21:08:14 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.44 2003/10/30 13:16:21 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -167,6 +167,14 @@
 	atadev->mode = mode;
 }
 
+static void
+ata_sata_setmode(struct ata_device *atadev, int mode)
+{
+    mode = ata_limit_mode(atadev, mode, ATA_DMA_MAX);
+    if (!ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode))
+	atadev->mode = mode;
+}
+
 /*
  * Acard chipset support functions
  */
@@ -819,8 +827,10 @@
 
     if (ctlr->chip->chipid == ATA_I82371FB)
 	ctlr->setmode = ata_intel_old_setmode;
-    else 
+    else if (ctlr->chip->max_dma < ATA_SA150) 
 	ctlr->setmode = ata_intel_new_setmode;
+    else
+	ctlr->setmode = ata_sata_setmode;
     return 0;
 }
 
@@ -849,8 +859,7 @@
 
     mode = ata_limit_mode(atadev, mode, ctlr->chip->max_dma);
 
-    if (ctlr->chip->max_dma < ATA_SA150 && mode > ATA_UDMA2 &&
-	!(reg54 & (0x10 << devno))) {
+    if ( mode > ATA_UDMA2 && !(reg54 & (0x10 << devno))) {
 	ata_prtdev(atadev,"DMA limited to UDMA33, non-ATA66 cable or device\n");
 	mode = ATA_UDMA2;
     }
@@ -864,47 +873,46 @@
     if (error)
 	return;
 
-    if (ctlr->chip->max_dma < ATA_SA150) {
-	if (mode >= ATA_UDMA0) {
-	    pci_write_config(parent, 0x48, reg48 | (0x0001 << devno), 2);
-	    pci_write_config(parent, 0x4a, (reg4a & ~(0x3 << (devno<<2))) | 
-					   (0x01 + !(mode & 0x01)), 2);
-	}
-	else {
-	    pci_write_config(parent, 0x48, reg48 & ~(0x0001 << devno), 2);
-	    pci_write_config(parent, 0x4a, (reg4a & ~(0x3 << (devno << 2))), 2);
-	}
-	if (mode >= ATA_UDMA2)
-	    pci_write_config(parent, 0x54, reg54 | (0x1 << devno), 2);
-	else
-	    pci_write_config(parent, 0x54, reg54 & ~(0x1 << devno), 2);
+    if (mode >= ATA_UDMA0) {
+	pci_write_config(parent, 0x48, reg48 | (0x0001 << devno), 2);
+	pci_write_config(parent, 0x4a, (reg4a & ~(0x3 << (devno<<2))) | 
+				       (0x01 + !(mode & 0x01)), 2);
+    }
+    else {
+	pci_write_config(parent, 0x48, reg48 & ~(0x0001 << devno), 2);
+	pci_write_config(parent, 0x4a, (reg4a & ~(0x3 << (devno << 2))), 2);
+    }
+    if (mode >= ATA_UDMA2)
+	pci_write_config(parent, 0x54, reg54 | (0x1 << devno), 2);
+    else
+	pci_write_config(parent, 0x54, reg54 & ~(0x1 << devno), 2);
 
-	if (mode >= ATA_UDMA5)
-	    pci_write_config(parent, 0x54, reg54 | (0x10000 << devno), 2);
-	else 
-	    pci_write_config(parent, 0x54, reg54 & ~(0x10000 << devno), 2);
+    if (mode >= ATA_UDMA5)
+	pci_write_config(parent, 0x54, reg54 | (0x10000 << devno), 2);
+    else 
+	pci_write_config(parent, 0x54, reg54 & ~(0x10000 << devno), 2);
 
-	reg40 &= ~0x00ff00ff;
-	reg40 |= 0x40774077;
+    reg40 &= ~0x00ff00ff;
+    reg40 |= 0x40774077;
 
-	if (atadev->unit == ATA_MASTER) {
-	    mask40 = 0x3300;
-	    new40 = timings[ata_mode2idx(mode)] << 8;
-	}
-	else {
-	    mask44 = 0x0f;
-	    new44 = ((timings[ata_mode2idx(mode)] & 0x30) >> 2) |
-		    (timings[ata_mode2idx(mode)] & 0x03);
-	}
-	if (atadev->channel->unit) {
-	    mask40 <<= 16;
-	    new40 <<= 16;
-	    mask44 <<= 4;
-	    new44 <<= 4;
-	}
-	pci_write_config(parent, 0x40, (reg40 & ~mask40) | new40, 4);
-	pci_write_config(parent, 0x44, (reg44 & ~mask44) | new44, 1);
+    if (atadev->unit == ATA_MASTER) {
+	mask40 = 0x3300;
+	new40 = timings[ata_mode2idx(mode)] << 8;
+    }
+    else {
+	mask44 = 0x0f;
+	new44 = ((timings[ata_mode2idx(mode)] & 0x30) >> 2) |
+		(timings[ata_mode2idx(mode)] & 0x03);
+    }
+    if (atadev->channel->unit) {
+	mask40 <<= 16;
+	new40 <<= 16;
+	mask44 <<= 4;
+	new44 <<= 4;
     }
+    pci_write_config(parent, 0x40, (reg40 & ~mask40) | new40, 4);
+    pci_write_config(parent, 0x44, (reg44 & ~mask44) | new44, 1);
+
     atadev->mode = mode;
 }
 
@@ -1199,11 +1207,12 @@
     ch->r_io[ATA_BMDTP_PORT].res = ctlr->r_io2;
     ch->r_io[ATA_BMDTP_PORT].offset = 0x244 + (ch->unit << 7);
     ch->r_io[ATA_BMDEVSPEC_0].res = ctlr->r_io2;
-    ch->r_io[ATA_BMDEVSPEC_0].offset = (ch->unit << 2);
+    ch->r_io[ATA_BMDEVSPEC_0].offset = ((ch->unit + 1) << 2);
     ch->r_io[ATA_IDX_ADDR].res = ctlr->r_io2;
 
     ATA_IDX_OUTL(ch, ATA_BMCMD_PORT,
-		 (ATA_IDX_INL(ch, ATA_BMCMD_PORT) & ~0x00000f8f) | ch->unit);
+		 (ATA_IDX_INL(ch, ATA_BMCMD_PORT) & ~0x00003f9f) |
+		 (ch->unit + 1));
     ATA_IDX_OUTL(ch, ATA_BMDEVSPEC_0, 0x00000001);
 
     ch->flags |= (ATA_NO_SLAVE | ATA_USE_16BIT);
@@ -1274,9 +1283,12 @@
 
     irq_vector = ATA_INL(ctlr->r_io2, 0x0040);
     for (unit = 0; unit < ctlr->channels; unit++) {
-	if (irq_vector & (1 << unit)) {
+	if (irq_vector & (1 << (unit + 1))) {
 	    if ((ch = ctlr->interrupt[unit].argument)) {
 		ctlr->interrupt[unit].function(ch);
+		ATA_IDX_OUTL(ch, ATA_BMCMD_PORT,
+			     (ATA_IDX_INL(ch, ATA_BMCMD_PORT) & ~0x00003f9f) |
+			     (ch->unit + 1));
 		ATA_IDX_OUTL(ch, ATA_BMDEVSPEC_0, 0x00000001);
 	    }
 	}
@@ -1619,7 +1631,10 @@
 	pci_write_config(dev, 0x8a, (pci_read_config(dev, 0x8a, 1) & 0x3f), 1);
 
 	ctlr->allocate = ata_sii_mio_allocate;
-	ctlr->setmode = ata_sii_setmode;
+	if (ctlr->chip->max_dma >= ATA_SA150)
+	    ctlr->setmode = ata_sata_setmode;
+	else
+	    ctlr->setmode = ata_sii_setmode;
     }
     else {
 	if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS,
@@ -1735,7 +1750,7 @@
     int rego = (atadev->channel->unit << 4) + (ATA_DEV(atadev->unit) << 1);
     int mreg = atadev->channel->unit ? 0x84 : 0x80;
     int mask = 0x03 << (ATA_DEV(atadev->unit) << 2);
-    int mval;
+    int mval = pci_read_config(parent, mreg, 1) & ~mask;
     int error;
 
     mode = ata_limit_mode(atadev, mode, ctlr->chip->max_dma);
@@ -1743,12 +1758,10 @@
     if (ctlr->chip->max_dma < ATA_UDMA2) {
 	mode = ata_check_80pin(atadev, mode);
     }
-    else if (ctlr->chip->max_dma < ATA_SA150 && mode > ATA_UDMA2 &&
-	     (pci_read_config(parent, 0x79, 1) &
-	      (atadev->channel->unit ? 0x02 : 0x01))) {
-	ata_prtdev(atadev,
-		   "DMA limited to UDMA33, non-ATA66 cable or device\n");
-	    mode = ATA_UDMA2;
+    else if (mode > ATA_UDMA2 && (pci_read_config(parent, 0x79, 1) &
+				  (atadev->channel->unit ? 0x02 : 0x01))) {
+	ata_prtdev(atadev,"DMA limited to UDMA33, non-ATA66 cable or device\n");
+	mode = ATA_UDMA2;
     }
 
     error = ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode);
@@ -1757,41 +1770,36 @@
 	ata_prtdev(atadev, "%ssetting %s on %s chip\n",
 		   (error) ? "FAILURE " : "",
 		   ata_mode2str(mode), ctlr->chip->text);
-
     if (error)
 	return;
 
-    mval = pci_read_config(parent, mreg, 1) & ~mask;
+    if (mode >= ATA_UDMA0) {
+	u_int8_t udmatimings[] = { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 };
+	u_int8_t ureg = 0xac + rego;
 
-    if (ctlr->chip->max_dma < ATA_SA150) {
-	if (mode >= ATA_UDMA0) {
-	    u_int8_t udmatimings[] = { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 };
-	    u_int8_t ureg = 0xac + rego;
+	pci_write_config(parent, mreg,
+			 mval | (0x03 << (ATA_DEV(atadev->unit) << 2)), 1);
+	pci_write_config(parent, ureg, 
+			 (pci_read_config(parent, ureg, 1) & ~0x3f) |
+			 udmatimings[mode & ATA_MODE_MASK], 1);
 
-	    pci_write_config(parent, mreg,
-			     mval | (0x03 << (ATA_DEV(atadev->unit) << 2)), 1);
-	    pci_write_config(parent, ureg, 
-			     (pci_read_config(parent, ureg, 1) & ~0x3f) |
-			     udmatimings[mode & ATA_MODE_MASK], 1);
+    }
+    else if (mode >= ATA_WDMA0) {
+	u_int8_t dreg = 0xa8 + rego;
+	u_int16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 };
 
-	}
-	else if (mode >= ATA_WDMA0) {
-	    u_int8_t dreg = 0xa8 + rego;
-	    u_int16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 };
+	pci_write_config(parent, mreg,
+			 mval | (0x02 << (ATA_DEV(atadev->unit) << 2)), 1);
+	pci_write_config(parent, dreg, dmatimings[mode & ATA_MODE_MASK], 2);
 
-	    pci_write_config(parent, mreg,
-			     mval | (0x02 << (ATA_DEV(atadev->unit) << 2)), 1);
-	    pci_write_config(parent, dreg, dmatimings[mode & ATA_MODE_MASK], 2);
+    }
+    else {
+	u_int8_t preg = 0xa4 + rego;
+	u_int16_t piotimings[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
 
-	}
-	else {
-	    u_int8_t preg = 0xa4 + rego;
-	    u_int16_t piotimings[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
-
-	    pci_write_config(parent, mreg,
-			     mval | (0x01 << (ATA_DEV(atadev->unit) << 2)), 1);
-	    pci_write_config(parent, preg, piotimings[mode & ATA_MODE_MASK], 2);
-	}
+	pci_write_config(parent, mreg,
+			 mval | (0x01 << (ATA_DEV(atadev->unit) << 2)), 1);
+	pci_write_config(parent, preg, piotimings[mode & ATA_MODE_MASK], 2);
     }
     atadev->mode = mode;
 }
@@ -2059,11 +2067,21 @@
      { ATA_VIA8233C,  0x00, VIA100, 0x00,   ATA_UDMA5, "VIA 8233C" },
      { ATA_VIA8233A,  0x00, VIA133, 0x00,   ATA_UDMA6, "VIA 8233A" },
      { ATA_VIA8235,   0x00, VIA133, 0x00,   ATA_UDMA6, "VIA 8235" },
+     { ATA_VIA8237,   0x00, VIA133, 0x00,   ATA_UDMA6, "VIA 8237" },
+     { 0, 0, 0, 0, 0, 0 }};
+    static struct ata_chip_id new_ids[] =
+    {{ ATA_VIA8237,   0x00, 0x00,   0x00,   ATA_SA150, "VIA 8237" },
      { 0, 0, 0, 0, 0, 0 }};
     char buffer[64];
 
-    if (!(idx = ata_find_chip(dev, ids, pci_get_slot(dev))))
-	return ENXIO;
+    if (pci_get_devid(dev) == ATA_VIA82C571) {
+	if (!(idx = ata_find_chip(dev, ids, pci_get_slot(dev)))) 
+	    return ENXIO;
+    }
+    else {
+	if (!(idx = ata_match_chip(dev, new_ids))) 
+	    return ENXIO;
+    }
 
     sprintf(buffer, "%s %s controller", idx->text, ata_mode2str(idx->max_dma));
     device_set_desc_copy(dev, buffer);
@@ -2080,6 +2098,11 @@
     if (ata_setup_interrupt(dev))
 	return ENXIO;
     
+    if (ctlr->chip->max_dma >= ATA_SA150) {
+	ctlr->setmode = ata_sata_setmode;
+	return 0;
+    }
+
     /* prepare for ATA-66 on the 82C686a and 82C596b */
     if (ctlr->chip->cfg2 & VIACLK)
 	pci_write_config(dev, 0x50, 0x030b030b, 4);	  

==== //depot/projects/netperf/sys/dev/ata/ata-pci.h#5 (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-pci.h,v 1.16 2003/09/08 13:55:05 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.17 2003/10/30 13:16:21 sos Exp $
  */
 
 /* structure holding chipset config info */
@@ -217,6 +217,7 @@
 #define ATA_VIA8233A		0x31471106
 #define ATA_VIA8233C		0x31091106
 #define ATA_VIA8235		0x31771106
+#define ATA_VIA8237		0x31491106
 #define ATA_VIA8361		0x31121106
 #define ATA_VIA8363		0x03051106
 #define ATA_VIA8371		0x03911106

==== //depot/projects/netperf/sys/dev/hatm/if_hatm.c#8 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hatm/if_hatm.c,v 1.15 2003/10/29 15:07:10 harti Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hatm/if_hatm.c,v 1.16 2003/10/30 10:43:52 harti Exp $");
 
 #include "opt_inet.h"
 #include "opt_natm.h"
@@ -307,15 +307,22 @@
 {
 	u_int i, b;
 	struct mbuf_page *pg;
+	struct mbuf_chunk_hdr *h;
 
 	if (sc->mbuf_pages != NULL) {
 		for (i = 0; i < sc->mbuf_npages; i++) {
 			pg = sc->mbuf_pages[i];
 			for (b = 0; b < pg->hdr.nchunks; b++) {
-				if (MBUF_TST_BIT(pg->hdr.card, b))
+				h = (struct mbuf_chunk_hdr *) ((char *)pg +
+				    b * pg->hdr.chunksize + pg->hdr.hdroff);
+				if (h->flags & MBUF_CARD)
 					if_printf(&sc->ifatm.ifnet,
 					    "%s -- mbuf page=%u card buf %u\n",
 					    __func__, i, b);
+				if (h->flags & MBUF_USED)
+					if_printf(&sc->ifatm.ifnet,
+					    "%s -- mbuf page=%u used buf %u\n",
+					    __func__, i, b);
 			}
 			bus_dmamap_unload(sc->mbuf_tag, pg->hdr.map);
 			bus_dmamap_destroy(sc->mbuf_tag, pg->hdr.map);
@@ -2332,10 +2339,14 @@
 	for (p = 0; p < sc->mbuf_npages; p++) {
 		pg = sc->mbuf_pages[p];
 		for (i = 0; i < pg->hdr.nchunks; i++) {
-			if (MBUF_TST_BIT(pg->hdr.card, i)) {
-				MBUF_CLR_BIT(pg->hdr.card, i);
-				ch = (struct mbuf_chunk_hdr *) ((char *)pg +
-				    i * pg->hdr.chunksize + pg->hdr.hdroff);
+			ch = (struct mbuf_chunk_hdr *) ((char *)pg +
+			    i * pg->hdr.chunksize + pg->hdr.hdroff);
+			if (ch->flags & MBUF_CARD) {
+				ch->flags &= ~MBUF_CARD;
+				ch->flags |= MBUF_USED;
+				hatm_ext_free(&sc->mbuf_list[pg->hdr.pool],
+				    (struct mbufx_free *)((u_char *)ch -
+				    pg->hdr.hdroff));
 			}
 		}
 	}

==== //depot/projects/netperf/sys/dev/hatm/if_hatm_intr.c#6 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hatm/if_hatm_intr.c,v 1.12 2003/10/29 15:11:26 harti Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hatm/if_hatm_intr.c,v 1.14 2003/10/30 16:19:50 harti Exp $");
 
 /*
  * ForeHE driver.
@@ -83,13 +83,34 @@
 CTASSERT(sizeof(((struct mbuf1_chunk *)NULL)->storage) >= MBUF1_SIZE);
 CTASSERT(sizeof(struct tpd) <= HE_TPD_SIZE);
 
+CTASSERT(MBUF0_PER_PAGE <= 256);
+CTASSERT(MBUF1_PER_PAGE <= 256);
+
 static void hatm_mbuf_page_alloc(struct hatm_softc *sc, u_int group);
 
 /*
  * Free an external mbuf to a list. We use atomic functions so that
  * we don't need a mutex for the list.
+ *
+ * Note that in general this algorithm is not safe when multiple readers
+ * and writers are present. To cite from a mail from David Schultz
+ * <das@freebsd.org>:
+ *
+ *	It looks like this is subject to the ABA problem.  For instance,
+ *	suppose X, Y, and Z are the top things on the freelist and a
+ *	thread attempts to make an allocation.  You set buf to X and load
+ *	buf->link (Y) into a register.  Then the thread get preempted, and
+ *	another thread allocates both X and Y, then frees X.  When the
+ *	original thread gets the CPU again, X is still on top of the
+ *	freelist, so the atomic operation succeeds.  However, the atomic
+ *	op places Y on top of the freelist, even though Y is no longer
+ *	free.
+ *
+ * We are, however sure that we have only one thread that ever allocates
+ * buffers because the only place we're call from is the interrupt handler.
+ * Under these circumstances the code looks safe.
  */
-static __inline void
+__inline void
 hatm_ext_free(struct mbufx_free **list, struct mbufx_free *buf)
 {
 	for (;;) {
@@ -179,7 +200,6 @@
 		return;
 	if ((pg = malloc(MBUF_ALLOC_SIZE, M_DEVBUF, M_NOWAIT)) == NULL)
 		return;
-	bzero(pg->hdr.card, sizeof(pg->hdr.card));
 
 	err = bus_dmamap_create(sc->mbuf_tag, 0, &pg->hdr.map);
 	if (err != 0) {
@@ -203,6 +223,7 @@
 	if (group == 0) {
 		struct mbuf0_chunk *c;
 
+		pg->hdr.pool = 0;
 		pg->hdr.nchunks = MBUF0_PER_PAGE;
 		pg->hdr.chunksize = MBUF0_CHUNK;
 		pg->hdr.hdroff = sizeof(c->storage);
@@ -210,12 +231,14 @@
 		for (i = 0; i < MBUF0_PER_PAGE; i++, c++) {
 			c->hdr.pageno = sc->mbuf_npages;
 			c->hdr.chunkno = i;
+			c->hdr.flags = MBUF_USED;
 			hatm_ext_free(&sc->mbuf_list[0],
 			    (struct mbufx_free *)c);
 		}
 	} else {
 		struct mbuf1_chunk *c;
 
+		pg->hdr.pool = 1;
 		pg->hdr.nchunks = MBUF1_PER_PAGE;
 		pg->hdr.chunksize = MBUF1_CHUNK;
 		pg->hdr.hdroff = sizeof(c->storage);
@@ -223,6 +246,7 @@
 		for (i = 0; i < MBUF1_PER_PAGE; i++, c++) {
 			c->hdr.pageno = sc->mbuf_npages;
 			c->hdr.chunkno = i;
+			c->hdr.flags = MBUF_USED;
 			hatm_ext_free(&sc->mbuf_list[1],
 			    (struct mbufx_free *)c);
 		}
@@ -239,6 +263,9 @@
 	struct hatm_softc *sc = args;
 	struct mbuf0_chunk *c = buf;
 
+	KASSERT((c->hdr.flags & (MBUF_USED | MBUF_CARD)) == MBUF_USED,
+	    ("freeing unused mbuf %x", c->hdr.flags));
+	c->hdr.flags &= ~MBUF_USED;
 	hatm_ext_free(&sc->mbuf_list[0], (struct mbufx_free *)c);
 }
 static void
@@ -247,6 +274,9 @@
 	struct hatm_softc *sc = args;
 	struct mbuf1_chunk *c = buf;
 
+	KASSERT((c->hdr.flags & (MBUF_USED | MBUF_CARD)) == MBUF_USED,
+	    ("freeing unused mbuf %x", c->hdr.flags));
+	c->hdr.flags &= ~MBUF_USED;
 	hatm_ext_free(&sc->mbuf_list[1], (struct mbufx_free *)c);
 }
 
@@ -333,7 +363,7 @@
 				break;
 			buf0 = (struct mbuf0_chunk *)cf;
 			pg = sc->mbuf_pages[buf0->hdr.pageno];
-			MBUF_SET_BIT(pg->hdr.card, buf0->hdr.chunkno);
+			buf0->hdr.flags |= MBUF_CARD;
 			rbp->rbp[rbp->tail].phys = pg->hdr.phys +
 			    buf0->hdr.chunkno * MBUF0_CHUNK + MBUF0_OFFSET;
 			rbp->rbp[rbp->tail].handle =
@@ -351,7 +381,7 @@
 				break;
 			buf1 = (struct mbuf1_chunk *)cf;
 			pg = sc->mbuf_pages[buf1->hdr.pageno];
-			MBUF_SET_BIT(pg->hdr.card, buf1->hdr.chunkno);
+			buf1->hdr.flags |= MBUF_CARD;
 			rbp->rbp[rbp->tail].phys = pg->hdr.phys +
 			    buf1->hdr.chunkno * MBUF1_CHUNK + MBUF1_OFFSET;
 			rbp->rbp[rbp->tail].handle =
@@ -400,7 +430,6 @@
 	}
 
 	MBUF_PARSE_HANDLE(handle, pageno, chunkno);
-	MBUF_CLR_BIT(sc->mbuf_pages[pageno]->hdr.card, chunkno);
 
 	DBG(sc, RX, ("RX group=%u handle=%x page=%u chunk=%u", group, handle,
 	    pageno, chunkno));
@@ -415,7 +444,14 @@
 		    c0->hdr.pageno, pageno));
 		KASSERT(c0->hdr.chunkno == chunkno, ("chunkno = %u/%u",
 		    c0->hdr.chunkno, chunkno));
+		KASSERT(c0->hdr.flags & MBUF_CARD, ("mbuf not on card %u/%u",
+		    pageno, chunkno));
+		KASSERT(!(c0->hdr.flags & MBUF_USED), ("used mbuf %u/%u",
+		    pageno, chunkno));
 
+		c0->hdr.flags |= MBUF_USED;
+		c0->hdr.flags &= ~MBUF_CARD;
+
 		if (m != NULL) {
 			m->m_ext.ref_cnt = &c0->hdr.ref_cnt;
 			m_extadd(m, (void *)c0, MBUF0_SIZE,
@@ -432,6 +468,13 @@
 		    c1->hdr.pageno, pageno));
 		KASSERT(c1->hdr.chunkno == chunkno, ("chunkno = %u/%u",
 		    c1->hdr.chunkno, chunkno));
+		KASSERT(c1->hdr.flags & MBUF_CARD, ("mbuf not on card %u/%u",
+		    pageno, chunkno));
+		KASSERT(!(c1->hdr.flags & MBUF_USED), ("used mbuf %u/%u",
+		    pageno, chunkno));
+
+		c1->hdr.flags |= MBUF_USED;
+		c1->hdr.flags &= ~MBUF_CARD;
 
 		if (m != NULL) {
 			m->m_ext.ref_cnt = &c1->hdr.ref_cnt;

==== //depot/projects/netperf/sys/dev/hatm/if_hatmvar.h#6 (text+ko) ====

@@ -26,7 +26,7 @@
  *
  * Author: Hartmut Brandt <harti@freebsd.org>
  *
- * $FreeBSD: src/sys/dev/hatm/if_hatmvar.h,v 1.11 2003/10/29 15:07:10 harti Exp $
+ * $FreeBSD: src/sys/dev/hatm/if_hatmvar.h,v 1.12 2003/10/30 10:43:52 harti Exp $
  *
  * Fore HE driver for NATM
  */
@@ -239,12 +239,12 @@
 
 /* each allocated page has one of these structures at its very end. */
 struct mbuf_page_hdr {
-	uint8_t		card[32];	/* bitmap for on-card */
 	uint16_t	nchunks;	/* chunks on this page */
 	bus_dmamap_t	map;		/* the DMA MAP */
 	uint32_t	phys;		/* physical base address */
 	uint32_t	hdroff;		/* chunk header offset */
 	uint32_t	chunksize;	/* chunk size */
+	u_int		pool;		/* pool number */
 };
 struct mbuf_page {
 	char	storage[MBUF_ALLOC_SIZE - sizeof(struct mbuf_page_hdr)];
@@ -257,10 +257,6 @@
 #define MBUF1_PER_PAGE	((MBUF_ALLOC_SIZE - sizeof(struct mbuf_page_hdr)) / \
     MBUF1_CHUNK)
 
-#define MBUF_CLR_BIT(ARRAY, BIT) ((ARRAY)[(BIT) / 8] &= ~(1 << ((BIT) % 8)))
-#define MBUF_SET_BIT(ARRAY, BIT) ((ARRAY)[(BIT) / 8] |= (1 << ((BIT) % 8)))
-#define MBUF_TST_BIT(ARRAY, BIT) ((ARRAY)[(BIT) / 8] & (1 << ((BIT) % 8)))
-
 /*
  * Convert to/from handles
  */
@@ -281,12 +277,15 @@
 
 #define MBUF_LARGE_FLAG	0x80000000
 
-/* chunks have the following structure at the end (4 byte) */
+/* chunks have the following structure at the end (8 byte) */
 struct mbuf_chunk_hdr {
-	uint16_t		pageno;
-	uint16_t		chunkno;
-	u_int			ref_cnt;
+	uint16_t	pageno;
+	uint8_t		chunkno;
+	uint8_t		flags;
+	u_int		ref_cnt;
 };
+#define	MBUF_CARD	0x01	/* buffer is on card */
+#define	MBUF_USED	0x02	/* buffer is somewhere in the system */
 
 #define MBUFX_STORAGE_SIZE(X) (MBUF##X##_CHUNK	\
     - sizeof(struct mbuf_chunk_hdr))
@@ -628,3 +627,5 @@
 void hatm_tx_vcc_closed(struct hatm_softc *sc, u_int cid);
 void hatm_vcc_closed(struct hatm_softc *sc, u_int cid);
 void hatm_load_vc(struct hatm_softc *sc, u_int cid, int reopen);
+
+void hatm_ext_free(struct mbufx_free **, struct mbufx_free *);

==== //depot/projects/netperf/sys/dev/sound/isa/mpu.c#3 (text+ko) ====

@@ -33,7 +33,7 @@
  * This handles io against /dev/midi, the midi {in, out}put event queues
  * and the event/message transmittion to/from an MPU401 interface.
  *
- * $FreeBSD: src/sys/dev/sound/isa/mpu.c,v 1.17 2003/09/16 11:04:22 bde Exp $
+ * $FreeBSD: src/sys/dev/sound/isa/mpu.c,v 1.18 2003/10/29 21:54:37 deischen Exp $
  *
  */
 
@@ -362,6 +362,7 @@
 	/* Allocate the resources, switch to uart mode. */
 	if (mpu_allocres(scp, dev) || mpu_uartmode(scp)) {
 		mpu_releaseres(scp, dev);
+		mtx_destroy(&scp->mtx);
 		return (ENXIO);
 	}
 
@@ -768,7 +769,6 @@
 		bus_release_resource(dev, SYS_RES_IOPORT, scp->io_rid, scp->io);
 		scp->io = NULL;
 	}
-	mtx_destroy(&scp->mtx);
 }
 
 static device_method_t mpu_methods[] = {

==== //depot/projects/netperf/sys/dev/syscons/syscons.c#5 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/syscons/syscons.c,v 1.408 2003/09/26 18:57:34 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/syscons/syscons.c,v 1.409 2003/10/29 20:48:13 njl Exp $");
 
 #include "opt_syscons.h"
 #include "opt_splash.h"
@@ -2147,6 +2147,9 @@
 
     DPRINTF(5, ("sc0: sc_switch_scr() %d ", next_scr + 1));
 
+    if (sc->cur_scp == NULL)
+	return (0);
+
     /* prevent switch if previously requested */
     if (sc->flags & SC_SCRN_VTYLOCK) {
 	    sc_bell(sc->cur_scp, sc->cur_scp->bell_pitch,

==== //depot/projects/netperf/sys/i386/acpica/acpi_machdep.c#5 (text+ko) ====

@@ -25,12 +25,14 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_machdep.c,v 1.13 2003/09/17 08:47:39 iwasaki Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_machdep.c,v 1.14 2003/10/30 16:14:55 iwasaki Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
 #include <sys/fcntl.h>
+#include <sys/kernel.h>
+#include <sys/sysctl.h>
 #include <sys/uio.h>
 
 #include "acpi.h"
@@ -59,6 +61,9 @@
 #include <i386/bios/apm.h>
 #endif
 
+u_int32_t acpi_no_reset_video = 0;
+TUNABLE_INT("hw.acpi.no_reset_video", &acpi_no_reset_video);
+
 static struct apm_softc	apm_softc;
 
 static d_open_t apmopen;
@@ -327,6 +332,11 @@
 
 	if (intr_model != ACPI_INTR_PIC)
 		acpi_SetIntrModel(intr_model);
+
+	SYSCTL_ADD_UINT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+            OID_AUTO, "no_reset_video", CTLFLAG_RD | CTLFLAG_RW, &acpi_no_reset_video, 0,
+	    "Disable calling the VESA reset BIOS vector on the resume path");
+
 	return (0);
 }
 

==== //depot/projects/netperf/sys/i386/acpica/acpi_wakecode.S#5 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <machine/asm.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_wakecode.S,v 1.5 2003/10/29 03:30:45 iwasaki Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_wakecode.S,v 1.6 2003/10/30 16:14:55 iwasaki Exp $");
 
 #define LOCORE
 
@@ -48,12 +48,15 @@
 	 * Re-initialize video BIOS.  Restore DS and SS from CS in
 	 * case the BIOS modified them.
 	 */
+	cmp	$1, no_reset_video
+	je	wakeup_16_gdt
 	lcall	$0xc000, $3
 	movw	%cs, %ax
 	movw	%ax, %ds
 	movw	%ax, %ss
 #endif
 
+wakeup_16_gdt:
 	/* Load GDT for real mode */
 	lgdt	physical_gdt
 
@@ -211,6 +214,7 @@
 previous_cr2:		.long 0
 previous_cr3:		.long 0
 previous_cr4:		.long 0
+no_reset_video:		.long 0
 
 /* transfer from real mode to protected mode */
 previous_cr0:		.long 0

==== //depot/projects/netperf/sys/i386/acpica/acpi_wakeup.c#6 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 

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



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