PERFORCE change 105988 for review

Matt Jacob mjacob at FreeBSD.org
Mon Sep 11 13:30:43 PDT 2006


http://perforce.freebsd.org/chv.cgi?CH=105988

Change 105988 by mjacob at newisp on 2006/09/11 20:29:52

	IFC

Affected files ...

.. //depot/projects/newisp/amd64/amd64/local_apic.c#4 integrate
.. //depot/projects/newisp/amd64/amd64/mp_machdep.c#2 integrate
.. //depot/projects/newisp/amd64/amd64/nexus.c#2 integrate
.. //depot/projects/newisp/cam/cam_xpt.c#2 integrate
.. //depot/projects/newisp/dev/acpica/acpi.c#2 integrate
.. //depot/projects/newisp/dev/ata/ata-all.c#2 integrate
.. //depot/projects/newisp/dev/ata/ata-chipset.c#4 integrate
.. //depot/projects/newisp/dev/ata/ata-pci.h#3 integrate
.. //depot/projects/newisp/dev/ata/ata-usb.c#2 integrate
.. //depot/projects/newisp/dev/em/if_em.c#5 integrate
.. //depot/projects/newisp/dev/nfe/if_nfe.c#2 integrate
.. //depot/projects/newisp/dev/nfe/if_nfereg.h#2 integrate
.. //depot/projects/newisp/i386/i386/busdma_machdep.c#2 integrate
.. //depot/projects/newisp/i386/i386/local_apic.c#4 integrate
.. //depot/projects/newisp/i386/i386/mp_machdep.c#2 integrate
.. //depot/projects/newisp/i386/i386/nexus.c#2 integrate
.. //depot/projects/newisp/kern/bus_if.m#3 integrate
.. //depot/projects/newisp/kern/subr_bus.c#3 integrate
.. //depot/projects/newisp/kern/subr_rman.c#2 integrate
.. //depot/projects/newisp/netinet/ip_output.c#3 integrate
.. //depot/projects/newisp/sys/bus.h#3 integrate

Differences ...

==== //depot/projects/newisp/amd64/amd64/local_apic.c#4 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.28 2006/09/06 22:05:34 sobomax Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.29 2006/09/11 20:12:42 jhb Exp $");
 
 #include "opt_hwpmc_hooks.h"
 
@@ -794,6 +794,76 @@
 		}
 	}
 }
+
+static void
+dump_mask(const char *prefix, uint32_t v, int base)
+{
+	int i, first;
+
+	first = 1;
+	for (i = 0; i < 32; i++)
+		if (v & (1 << i)) {
+			if (first) {
+				db_printf("%s:", prefix);
+				first = 0;
+			}
+			db_printf(" %02x", base + i);
+		}
+	if (!first)
+		db_printf("\n");
+}
+
+/* Show info from the lapic regs for this CPU. */
+DB_SHOW_COMMAND(lapic, db_show_lapic)
+{
+	uint32_t v;
+
+	db_printf("lapic ID = %d\n", lapic_id());
+	v = lapic->version;
+	db_printf("version  = %d.%d\n", (v & APIC_VER_VERSION) >> 4,
+	    v & 0xf);
+	db_printf("max LVT  = %d\n", (v & APIC_VER_MAXLVT) >> MAXLVTSHIFT);
+	v = lapic->svr;
+	db_printf("SVR      = %02x (%s)\n", v & APIC_SVR_VECTOR,
+	    v & APIC_SVR_ENABLE ? "enabled" : "disabled");
+	db_printf("TPR      = %02x\n", lapic->tpr);
+
+#define dump_field(prefix, index)					\
+	dump_mask(__XSTRING(prefix ## index), lapic->prefix ## index,	\
+	    index * 32)
+
+	db_printf("In-service Interrupts:\n");
+	dump_field(isr, 0);
+	dump_field(isr, 1);
+	dump_field(isr, 2);
+	dump_field(isr, 3);
+	dump_field(isr, 4);
+	dump_field(isr, 5);
+	dump_field(isr, 6);
+	dump_field(isr, 7);
+
+	db_printf("TMR Interrupts:\n");
+	dump_field(tmr, 0);
+	dump_field(tmr, 1);
+	dump_field(tmr, 2);
+	dump_field(tmr, 3);
+	dump_field(tmr, 4);
+	dump_field(tmr, 5);
+	dump_field(tmr, 6);
+	dump_field(tmr, 7);
+
+	db_printf("IRR Interrupts:\n");
+	dump_field(irr, 0);
+	dump_field(irr, 1);
+	dump_field(irr, 2);
+	dump_field(irr, 3);
+	dump_field(irr, 4);
+	dump_field(irr, 5);
+	dump_field(irr, 6);
+	dump_field(irr, 7);
+
+#undef dump_field
+}
 #endif
 
 /*

==== //depot/projects/newisp/amd64/amd64/mp_machdep.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.276 2006/05/16 14:32:16 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.277 2006/09/11 20:10:42 jhb Exp $");
 
 #include "opt_cpu.h"
 #include "opt_kstack_pages.h"
@@ -342,7 +342,10 @@
 	setidt(IPI_INVLTLB, IDTVEC(invltlb), SDT_SYSIGT, SEL_KPL, 0);
 	setidt(IPI_INVLPG, IDTVEC(invlpg), SDT_SYSIGT, SEL_KPL, 0);
 	setidt(IPI_INVLRNG, IDTVEC(invlrng), SDT_SYSIGT, SEL_KPL, 0);
-	
+
+	/* Install an inter-CPU IPI for cache invalidation. */
+	setidt(IPI_INVLCACHE, IDTVEC(invlcache), SDT_SYSIGT, SEL_KPL, 0);
+
 	/* Install an inter-CPU IPI for all-CPU rendezvous */
 	setidt(IPI_RENDEZVOUS, IDTVEC(rendezvous), SDT_SYSIGT, SEL_KPL, 0);
 

==== //depot/projects/newisp/amd64/amd64/nexus.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.68 2006/04/20 04:16:34 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.69 2006/09/11 19:31:51 jhb Exp $");
 
 /*
  * This code implements a `root nexus' for Intel Architecture
@@ -140,7 +140,7 @@
 static int
 nexus_probe(device_t dev)
 {
-	int irq, last;
+	int irq;
 
 	device_quiet(dev);	/* suppress attach message for neatness */
 
@@ -173,18 +173,10 @@
 	 * We search for regions of existing IRQs and add those to the IRQ
 	 * resource manager.
 	 */
-	last = -1;
 	for (irq = 0; irq < NUM_IO_INTS; irq++)
-		if (intr_lookup_source(irq) != NULL) {
-			if (last == -1)
-				last = irq;
-		} else if (last != -1) {
-			if (rman_manage_region(&irq_rman, last, irq - 1) != 0)
+		if (intr_lookup_source(irq) != NULL)
+			if (rman_manage_region(&irq_rman, irq, irq) != 0)
 				panic("nexus_probe irq_rman add");
-			last = -1;
-		}
-	if (last != -1 && rman_manage_region(&irq_rman, last, irq - 1) != 0)
-		panic("nexus_probe irq_rman add");
 
 	/*
 	 * ISA DMA on PCI systems is implemented in the ISA part of each

==== //depot/projects/newisp/cam/cam_xpt.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.162 2006/06/26 05:41:11 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.164 2006/09/11 17:57:23 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -387,9 +387,9 @@
 		/*quirks*/0, /*mintags*/0, /*maxtags*/0
 	},
 	{
-		/* Does not support other than LUN 0 */
+		/* This does not support other than LUN 0 */
 		{ T_DIRECT, SIP_MEDIA_FIXED, "VMware*", "*", "*" },
-		CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0
+		CAM_QUIRK_NOLUNS, /*mintags*/2, /*maxtags*/255
 	},
 	{
 		/*

==== //depot/projects/newisp/dev/acpica/acpi.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.227 2006/07/29 21:46:16 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.228 2006/09/11 19:32:54 jhb Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -415,13 +415,13 @@
     acpi_rman_io.rm_type = RMAN_ARRAY;
     acpi_rman_io.rm_start = 0;
     acpi_rman_io.rm_end = 0xffff;
-    acpi_rman_io.rm_descr = "I/O ports";
+    acpi_rman_io.rm_descr = "ACPI I/O ports";
     if (rman_init(&acpi_rman_io) != 0)
 	panic("acpi rman_init IO ports failed");
     acpi_rman_mem.rm_type = RMAN_ARRAY;
     acpi_rman_mem.rm_start = 0;
     acpi_rman_mem.rm_end = ~0ul;
-    acpi_rman_mem.rm_descr = "I/O memory addresses";
+    acpi_rman_mem.rm_descr = "ACPI I/O memory addresses";
     if (rman_init(&acpi_rman_mem) != 0)
 	panic("acpi rman_init memory failed");
 

==== //depot/projects/newisp/dev/ata/ata-all.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.273 2006/05/12 05:04:40 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.274 2006/09/11 18:33:59 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -636,7 +636,9 @@
 	if (init) {
 	    sprintf(buffer, "%.40s/%.8s", atacap->model, atacap->revision);
 	    device_set_desc_copy(atadev->dev, buffer);
-	    if (atadev->param.config & ATA_PROTO_ATAPI) {
+	    if ((atadev->param.config & ATA_PROTO_ATAPI) &&
+		(atadev->param.config != ATA_CFA_MAGIC1) &&
+		(atadev->param.config != ATA_CFA_MAGIC2)) {
 		if (atapi_dma && ch->dma &&
 		    (atadev->param.config & ATA_DRQ_MASK) != ATA_DRQ_INTR &&
 		    ata_umode(&atadev->param) >= ATA_UDMA2)

==== //depot/projects/newisp/dev/ata/ata-chipset.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.173 2006/09/02 12:55:42 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.174 2006/09/11 19:48:30 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -3952,14 +3952,17 @@
     struct ata_pci_controller *ctlr = device_get_softc(dev);
     struct ata_chip_id *idx;
     static struct ata_chip_id ids[] =
-    {{ ATA_ROSB4,     0x00, SWKS33,  0x00, ATA_UDMA2, "ROSB4" },
-     { ATA_CSB5,      0x92, SWKS100, 0x00, ATA_UDMA5, "CSB5" },
-     { ATA_CSB5,      0x00, SWKS66,  0x00, ATA_UDMA4, "CSB5" },
-     { ATA_CSB6,      0x00, SWKS100, 0x00, ATA_UDMA5, "CSB6" },
-     { ATA_CSB6_1,    0x00, SWKS66,  0x00, ATA_UDMA4, "CSB6" },
-     { ATA_HT1000,    0x00, SWKS100, 0x00, ATA_UDMA5, "HT1000" },
-     { ATA_HT1000_S1, 0x00, SWKS100, 0x00, ATA_SA150, "HT1000 SATA" },
-     { ATA_HT1000_S2, 0x00, SWKSMIO, 0x00, ATA_SA150, "HT1000 SATA mmio" },
+    {{ ATA_ROSB4,     0x00, SWKS33,  0, ATA_UDMA2, "ROSB4" },
+     { ATA_CSB5,      0x92, SWKS100, 0, ATA_UDMA5, "CSB5" },
+     { ATA_CSB5,      0x00, SWKS66,  0, ATA_UDMA4, "CSB5" },
+     { ATA_CSB6,      0x00, SWKS100, 0, ATA_UDMA5, "CSB6" },
+     { ATA_CSB6_1,    0x00, SWKS66,  0, ATA_UDMA4, "CSB6" },
+     { ATA_HT1000,    0x00, SWKS100, 0, ATA_UDMA5, "HT1000" },
+     { ATA_HT1000_S1, 0x00, SWKS100, 4, ATA_SA150, "HT1000" },
+     { ATA_HT1000_S2, 0x00, SWKSMIO, 4, ATA_SA150, "HT1000" },
+     { ATA_K2,        0x00, SWKSMIO, 4, ATA_SA150, "K2" },
+     { ATA_FRODO4,    0x00, SWKSMIO, 4, ATA_SA150, "Frodo4" },
+     { ATA_FRODO8,    0x00, SWKSMIO, 8, ATA_SA150, "Frodo8" },
      { 0, 0, 0, 0, 0, 0}};
     char buffer[64];
 
@@ -3989,7 +3992,7 @@
 						    &ctlr->r_rid2, RF_ACTIVE)))
 	    return ENXIO;
 
-	ctlr->channels = 4;
+	ctlr->channels = ctlr->chip->cfg2;
 	ctlr->allocate = ata_serverworks_allocate;
 	ctlr->setmode = ata_sata_setmode;
 	return 0;

==== //depot/projects/newisp/dev/ata/ata-pci.h#3 (text+ko) ====

@@ -23,7 +23,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.70 2006/09/02 12:55:42 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.71 2006/09/11 19:48:30 sos Exp $
  */
 
 /* structure holding chipset config info */
@@ -266,6 +266,9 @@
 #define ATA_HT1000              0x02141166
 #define ATA_HT1000_S1           0x024b1166
 #define ATA_HT1000_S2           0x024a1166
+#define ATA_K2			0x02401166
+#define ATA_FRODO4		0x02411166
+#define ATA_FRODO8		0x02421166
 
 #define ATA_SILICON_IMAGE_ID    0x1095
 #define ATA_SII3114             0x31141095

==== //depot/projects/newisp/dev/ata/ata-usb.c#2 (text) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-usb.c,v 1.4 2006/03/31 08:09:05 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-usb.c,v 1.5 2006/09/11 19:47:53 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -85,7 +85,7 @@
 
 /* USB-ATA 'controller' softc */
 struct atausb_softc {
-    USBBASEDEVICE	dev;		/* base device */
+    device_t		dev;		/* base device */
     usbd_interface_handle iface;	/* interface */
     int			ifaceno;	/* interface number */
     u_int8_t		bulkin;		/* endpoint address's */
@@ -349,7 +349,7 @@
 }
 
 static int
-atausb_detach(device_ptr_t dev)
+atausb_detach(device_t dev)
 {
     struct atausb_softc *sc = device_get_softc(dev);
     usbd_device_handle udev;

==== //depot/projects/newisp/dev/em/if_em.c#5 (text+ko) ====

@@ -31,7 +31,7 @@
 
 ***************************************************************************/
 
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.142 2006/09/09 20:05:24 pdeuskar Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.143 2006/09/10 19:23:27 pdeuskar Exp $*/
 
 #ifdef HAVE_KERNEL_OPTION_HEADERS
 #include "opt_device_polling.h"
@@ -1456,7 +1456,7 @@
 	current_tx_desc = NULL;
 	txd_upper = txd_lower = txd_used = txd_saved = 0;
 
-        do_tso = ((m_head->m_pkthdr.csum_flags & CSUM_TSO) != 0);
+	do_tso = ((m_head->m_pkthdr.csum_flags & CSUM_TSO) != 0);
 
 	/*
 	 * Force a cleanup if number of TX descriptors
@@ -1509,16 +1509,16 @@
 		*m_headp = m_head;
 	}
 
-        /*
-         * TSO workaround:
-         *  If an mbuf is only header we need
-         *     to pull 4 bytes of data into it.
-         */
-        if (do_tso && (m_head->m_len <= M_TSO_LEN)) {
-                m_head = m_pullup(m_head, M_TSO_LEN + 4);
-                if (m_head == NULL)
-                        return (ENOBUFS);
-        }
+	/*
+	 * TSO workaround:
+	 *  If an mbuf is only header we need
+	 *     to pull 4 bytes of data into it.
+	 */
+	if (do_tso && (m_head->m_len <= M_TSO_LEN)) {
+		m_head = m_pullup(m_head, M_TSO_LEN + 4);
+		if (m_head == NULL)
+			return (ENOBUFS);
+	}
 
 	/*
 	 * Map the packet for DMA.
@@ -1558,17 +1558,17 @@
 		return (EIO);
 	}
 
-        /*
-         * TSO Hardware workaround, if this packet is not
-         * TSO, and is only a single descriptor long, and
-         * it follows a TSO burst, then we need to add a
-         * sentinel descriptor to prevent premature writeback.
-         */
-        if ((do_tso == 0) && (adapter->tx_tso == TRUE)) {
-                if (nsegs == 1)
-                        tso_desc = TRUE;
-                adapter->tx_tso = FALSE;
-        }
+	/*
+	 * TSO Hardware workaround, if this packet is not
+	 * TSO, and is only a single descriptor long, and
+	 * it follows a TSO burst, then we need to add a
+	 * sentinel descriptor to prevent premature writeback.
+	 */
+	if ((do_tso == 0) && (adapter->tx_tso == TRUE)) {
+		if (nsegs == 1)
+			tso_desc = TRUE;
+		adapter->tx_tso = FALSE;
+	}
 
 	if (nsegs > adapter->num_tx_desc_avail - 2) {
 		adapter->no_tx_desc_avail2++;
@@ -1576,24 +1576,24 @@
 		return (ENOBUFS);
 	}
 
-        /* Do hardware assists */
+	/* Do hardware assists */
 	m_head = *m_headp;
-        if ( ifp->if_hwassist > 0) {
-                if (em_tso_setup(adapter, m_head, &txd_upper, &txd_lower)) {
-                        /* we need to make a final sentinel transmit desc */
-                        tso_desc = TRUE;
-                } else
-                        em_transmit_checksum_setup(adapter,  m_head,
-                            &txd_upper, &txd_lower);
-        }
+	if ( ifp->if_hwassist > 0) {
+		if (em_tso_setup(adapter, m_head, &txd_upper, &txd_lower)) {
+			/* we need to make a final sentinel transmit desc */
+			tso_desc = TRUE;
+		} else
+			em_transmit_checksum_setup(adapter,  m_head,
+			    &txd_upper, &txd_lower);
+	}
 
 	i = adapter->next_avail_tx_desc;
 	if (adapter->pcix_82544)
 		txd_saved = i;
 
 	for (j = 0; j < nsegs; j++) {
-                bus_size_t seg_len;
-                bus_addr_t seg_addr;
+		bus_size_t seg_len;
+		bus_addr_t seg_addr;
 		/* If adapter is 82544 and on PCIX bus. */
 		if(adapter->pcix_82544) {
 			DESC_ARRAY	desc_array;
@@ -1627,46 +1627,46 @@
 				txd_used++;
 			}
 		} else {
-                       tx_buffer = &adapter->tx_buffer_area[i];
-                        current_tx_desc = &adapter->tx_desc_base[i];
-                        seg_addr = htole64(segs[j].ds_addr);
-                        seg_len  = segs[j].ds_len;
-                        /*
-                        ** TSO Workaround:
-                        ** If this is the last descriptor, we want to
-                        ** split it so we have a small final sentinel
-                        */
-                        if (tso_desc && (j == (nsegs -1)) && (seg_len > 8)) {
-                                seg_len -= 4;
-                                current_tx_desc->buffer_addr = seg_addr;
-                                current_tx_desc->lower.data = htole32(
-                                adapter->txd_cmd | txd_lower | seg_len);
-                                current_tx_desc->upper.data =
-                                    htole32(txd_upper);
-                                if (++i == adapter->num_tx_desc)
-                                        i = 0;
-                                /* Now make the sentinel */
-                                ++txd_used; /* using an extra txd */
-                                current_tx_desc = &adapter->tx_desc_base[i];
-                                tx_buffer = &adapter->tx_buffer_area[i];
-                                current_tx_desc->buffer_addr =
-                                    seg_addr + seg_len;
-                                current_tx_desc->lower.data = htole32(
-                                adapter->txd_cmd | txd_lower | 4);
-                                current_tx_desc->upper.data =
-                                    htole32(txd_upper);
-                                if (++i == adapter->num_tx_desc)
-                                        i = 0;
-                        } else {
-                                current_tx_desc->buffer_addr = seg_addr;
-                                current_tx_desc->lower.data = htole32(
-                                adapter->txd_cmd | txd_lower | seg_len);
-                                current_tx_desc->upper.data =
-                                    htole32(txd_upper);
-                                if (++i == adapter->num_tx_desc)
-                                        i = 0;
-                        }
-                        tx_buffer->m_head = NULL;
+			tx_buffer = &adapter->tx_buffer_area[i];
+			current_tx_desc = &adapter->tx_desc_base[i];
+			seg_addr = htole64(segs[j].ds_addr);
+			seg_len  = segs[j].ds_len;
+			/*
+			** TSO Workaround:
+			** If this is the last descriptor, we want to
+			** split it so we have a small final sentinel
+			*/
+			if (tso_desc && (j == (nsegs -1)) && (seg_len > 8)) {
+				seg_len -= 4;
+				current_tx_desc->buffer_addr = seg_addr;
+				current_tx_desc->lower.data = htole32(
+				adapter->txd_cmd | txd_lower | seg_len);
+				current_tx_desc->upper.data =
+				    htole32(txd_upper);
+				if (++i == adapter->num_tx_desc)
+					i = 0;
+				/* Now make the sentinel */
+				++txd_used; /* using an extra txd */
+				current_tx_desc = &adapter->tx_desc_base[i];
+				tx_buffer = &adapter->tx_buffer_area[i];
+				current_tx_desc->buffer_addr =
+				    seg_addr + seg_len;
+				current_tx_desc->lower.data = htole32(
+				adapter->txd_cmd | txd_lower | 4);
+				current_tx_desc->upper.data =
+				    htole32(txd_upper);
+				if (++i == adapter->num_tx_desc)
+					i = 0;
+			} else {
+				current_tx_desc->buffer_addr = seg_addr;
+				current_tx_desc->lower.data = htole32(
+				adapter->txd_cmd | txd_lower | seg_len);
+				current_tx_desc->upper.data =
+				    htole32(txd_upper);
+				if (++i == adapter->num_tx_desc)
+					i = 0;
+			}
+			tx_buffer->m_head = NULL;
 		}
 	}
 
@@ -1675,9 +1675,9 @@
 		adapter->num_tx_desc_avail -= txd_used;
 	else {
 		adapter->num_tx_desc_avail -= nsegs;
-                if (tso_desc) /* TSO used an extra for sentinel */
-                        adapter->num_tx_desc_avail -= txd_used;
-        }
+		if (tso_desc) /* TSO used an extra for sentinel */
+			adapter->num_tx_desc_avail -= txd_used;
+	}
 
 	if (mtag != NULL) {
 		/* Set the vlan id. */
@@ -2337,12 +2337,12 @@
 		ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
 	}
 
-        /* Enable TSO if available */
-        if ((adapter->hw.mac_type > em_82544) &&
-            (adapter->hw.mac_type != em_82547)) {
-                ifp->if_capabilities |= IFCAP_TSO;
-                ifp->if_capenable |= IFCAP_TSO;
-        }
+	/* Enable TSO if available */
+	if ((adapter->hw.mac_type > em_82544) &&
+	    (adapter->hw.mac_type != em_82547)) {
+		ifp->if_capabilities |= IFCAP_TSO;
+		ifp->if_capenable |= IFCAP_TSO;
+	}
 
 	/*
 	 * Tell the upper layer(s) we support long frames.
@@ -2562,7 +2562,7 @@
 static int
 em_setup_transmit_structures(struct adapter *adapter)
 {
-        struct ifnet   *ifp = adapter->ifp;
+	struct ifnet   *ifp = adapter->ifp;
 	device_t dev = adapter->dev;
 	struct em_buffer *tx_buffer;
 	bus_size_t size, segsize;
@@ -2573,11 +2573,11 @@
 	 */
 	segsize = size = roundup2(adapter->hw.max_frame_size, MCLBYTES);
 
-        /* Overrides for TSO - want large sizes */
-        if (ifp->if_hwassist & EM_TCPSEG_FEATURES) {
-                size = EM_TSO_SIZE;
-                segsize = PAGE_SIZE;
-        }
+	/* Overrides for TSO - want large sizes */
+	if (ifp->if_hwassist & EM_TCPSEG_FEATURES) {
+		size = EM_TSO_SIZE;
+		segsize = PAGE_SIZE;
+	}
 
 	if ((error = bus_dma_tag_create(bus_get_dma_tag(dev),	/* parent */
 				1, 0,			/* alignment, bounds */
@@ -2852,76 +2852,74 @@
  *
  **********************************************************************/
 static boolean_t
-em_tso_setup(struct adapter *adapter,
-             struct mbuf *mp,
-             uint32_t *txd_upper,
-             uint32_t *txd_lower)
+em_tso_setup(struct adapter *adapter, struct mbuf *mp, uint32_t *txd_upper,
+   uint32_t *txd_lower)
 {
-        struct em_context_desc *TXD;
-        struct em_buffer *tx_buffer;
-        struct ip *ip;
-        struct tcphdr *th;
-        int curr_txd, hdr_len, ip_hlen, tcp_hlen;
+	struct em_context_desc *TXD;
+	struct em_buffer *tx_buffer;
+	struct ip *ip;
+	struct tcphdr *th;
+	int curr_txd, hdr_len, ip_hlen, tcp_hlen;
 
-        if (((mp->m_pkthdr.csum_flags & CSUM_TSO) == 0) ||
-            (mp->m_pkthdr.len <= E1000_TX_BUFFER_SIZE)) {
-                return FALSE;
-        }
+	if (((mp->m_pkthdr.csum_flags & CSUM_TSO) == 0) ||
+	    (mp->m_pkthdr.len <= E1000_TX_BUFFER_SIZE)) {
+		return FALSE;
+	}
 
-        *txd_lower = (E1000_TXD_CMD_DEXT |
-                      E1000_TXD_DTYP_D |
-                      E1000_TXD_CMD_TSE);
+	*txd_lower = (E1000_TXD_CMD_DEXT |
+		      E1000_TXD_DTYP_D |
+		      E1000_TXD_CMD_TSE);
 
-        *txd_upper = (E1000_TXD_POPTS_IXSM |
-                      E1000_TXD_POPTS_TXSM) << 8;
+	*txd_upper = (E1000_TXD_POPTS_IXSM |
+		      E1000_TXD_POPTS_TXSM) << 8;
 
-        curr_txd = adapter->next_avail_tx_desc;
-        tx_buffer = &adapter->tx_buffer_area[curr_txd];
-        TXD = (struct em_context_desc *) &adapter->tx_desc_base[curr_txd];
+	curr_txd = adapter->next_avail_tx_desc;
+	tx_buffer = &adapter->tx_buffer_area[curr_txd];
+	TXD = (struct em_context_desc *) &adapter->tx_desc_base[curr_txd];
 
-        mp->m_data += sizeof(struct ether_header);
-        ip = mtod(mp, struct ip *);
-        ip->ip_len = 0;
-        ip->ip_sum = 0;
-        ip_hlen = ip->ip_hl << 2 ;
-        th = (struct tcphdr *)((caddr_t)ip + ip_hlen);
-        tcp_hlen = th->th_off << 2;
+	mp->m_data += sizeof(struct ether_header);
+	ip = mtod(mp, struct ip *);
+	ip->ip_len = 0;
+	ip->ip_sum = 0;
+	ip_hlen = ip->ip_hl << 2 ;
+	th = (struct tcphdr *)((caddr_t)ip + ip_hlen);
+	tcp_hlen = th->th_off << 2;
 
-        hdr_len = ETHER_HDR_LEN + ip_hlen + tcp_hlen;
+	hdr_len = ETHER_HDR_LEN + ip_hlen + tcp_hlen;
 	th->th_sum = in_pseudo(ip->ip_src.s_addr,
 	    ip->ip_dst.s_addr, htons(IPPROTO_TCP));
 
-        mp->m_data -= sizeof(struct ether_header);
-        TXD->lower_setup.ip_fields.ipcss = ETHER_HDR_LEN;
-        TXD->lower_setup.ip_fields.ipcso =
-                ETHER_HDR_LEN + offsetof(struct ip, ip_sum);
-        TXD->lower_setup.ip_fields.ipcse =
-                htole16(ETHER_HDR_LEN + ip_hlen - 1);
+	mp->m_data -= sizeof(struct ether_header);
+	TXD->lower_setup.ip_fields.ipcss = ETHER_HDR_LEN;
+	TXD->lower_setup.ip_fields.ipcso =
+		ETHER_HDR_LEN + offsetof(struct ip, ip_sum);
+	TXD->lower_setup.ip_fields.ipcse =
+		htole16(ETHER_HDR_LEN + ip_hlen - 1);
 
-        TXD->upper_setup.tcp_fields.tucss =
-                ETHER_HDR_LEN + ip_hlen;
-        TXD->upper_setup.tcp_fields.tucse = 0;
-        TXD->upper_setup.tcp_fields.tucso =
-                ETHER_HDR_LEN + ip_hlen +
-                offsetof(struct tcphdr, th_sum);
-        TXD->tcp_seg_setup.fields.mss = htole16(mp->m_pkthdr.tso_segsz);
-        TXD->tcp_seg_setup.fields.hdr_len = hdr_len;
-        TXD->cmd_and_length = htole32(adapter->txd_cmd |
-                                E1000_TXD_CMD_DEXT |
-                                E1000_TXD_CMD_TSE |
-                                E1000_TXD_CMD_IP | E1000_TXD_CMD_TCP |
-                                (mp->m_pkthdr.len - (hdr_len)));
+	TXD->upper_setup.tcp_fields.tucss =
+		ETHER_HDR_LEN + ip_hlen;
+	TXD->upper_setup.tcp_fields.tucse = 0;
+	TXD->upper_setup.tcp_fields.tucso =
+		ETHER_HDR_LEN + ip_hlen +
+		offsetof(struct tcphdr, th_sum);
+	TXD->tcp_seg_setup.fields.mss = htole16(mp->m_pkthdr.tso_segsz);
+	TXD->tcp_seg_setup.fields.hdr_len = hdr_len;
+	TXD->cmd_and_length = htole32(adapter->txd_cmd |
+				E1000_TXD_CMD_DEXT |
+				E1000_TXD_CMD_TSE |
+				E1000_TXD_CMD_IP | E1000_TXD_CMD_TCP |
+				(mp->m_pkthdr.len - (hdr_len)));
 
-        tx_buffer->m_head = NULL;
+	tx_buffer->m_head = NULL;
 
-        if (++curr_txd == adapter->num_tx_desc)
-                curr_txd = 0;
+	if (++curr_txd == adapter->num_tx_desc)
+		curr_txd = 0;
 
-        adapter->num_tx_desc_avail--;
-        adapter->next_avail_tx_desc = curr_txd;
-        adapter->tx_tso = TRUE;
+	adapter->num_tx_desc_avail--;
+	adapter->next_avail_tx_desc = curr_txd;
+	adapter->tx_tso = TRUE;
 
-        return TRUE;
+	return TRUE;
 }
 
 /**********************************************************************
@@ -3870,10 +3868,10 @@
 	    (long long)adapter->stats.gprc);
 	device_printf(dev, "Good Packets Xmtd = %lld\n",
 	    (long long)adapter->stats.gptc);
-        device_printf(dev, "TSO Contexts Xmtd = %lld\n",
-            (long long)adapter->stats.tsctc);
-        device_printf(dev, "TSO Contexts Failed = %lld\n",
-            (long long)adapter->stats.tsctfc);
+	device_printf(dev, "TSO Contexts Xmtd = %lld\n",
+	    (long long)adapter->stats.tsctc);
+	device_printf(dev, "TSO Contexts Failed = %lld\n",
+	    (long long)adapter->stats.tsctfc);
 }
 
 static int

==== //depot/projects/newisp/dev/nfe/if_nfe.c#2 (text+ko) ====

@@ -21,7 +21,7 @@
 /* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/nfe/if_nfe.c,v 1.3 2006/08/14 15:35:43 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/nfe/if_nfe.c,v 1.4 2006/09/11 07:31:55 obrien Exp $");
 
 /* Uncomment the following line to enable polling. */
 /* #define DEVICE_POLLING */
@@ -200,6 +200,22 @@
 	"NVIDIA nForce MCP55 Networking Adapter"},
 	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP55_LAN2,
 	"NVIDIA nForce MCP55 Networking Adapter"},
+	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_LAN1,
+	"NVIDIA nForce MCP61 Networking Adapter"},
+	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_LAN2,
+	"NVIDIA nForce MCP61 Networking Adapter"},
+	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_LAN3,
+	"NVIDIA nForce MCP61 Networking Adapter"},
+	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP61_LAN2,
+	"NVIDIA nForce MCP61 Networking Adapter"},
+	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LAN1,
+	"NVIDIA nForce MCP65 Networking Adapter"},
+	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LAN2,
+	"NVIDIA nForce MCP65 Networking Adapter"},
+	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LAN3,
+	"NVIDIA nForce MCP65 Networking Adapter"},
+	{PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_MCP65_LAN2,
+	"NVIDIA nForce MCP65 Networking Adapter"},
 	{0, 0, NULL}
 };
 
@@ -292,6 +308,18 @@
 	case PCI_PRODUCT_NVIDIA_MCP55_LAN2:
 		sc->nfe_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM | NFE_HW_VLAN;
 		break;
+	case PCI_PRODUCT_NVIDIA_MCP61_LAN1:
+	case PCI_PRODUCT_NVIDIA_MCP61_LAN2:
+	case PCI_PRODUCT_NVIDIA_MCP61_LAN3:
+	case PCI_PRODUCT_NVIDIA_MCP61_LAN4:
+		sc->nfe_flags |= NFE_40BIT_ADDR;
+		break;
+	case PCI_PRODUCT_NVIDIA_MCP65_LAN1:
+	case PCI_PRODUCT_NVIDIA_MCP65_LAN2:
+	case PCI_PRODUCT_NVIDIA_MCP65_LAN3:
+	case PCI_PRODUCT_NVIDIA_MCP65_LAN4:
+		sc->nfe_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM;
+ 		break;
 	}
 
 #ifndef NFE_NO_JUMBO

==== //depot/projects/newisp/dev/nfe/if_nfereg.h#2 (text+ko) ====

@@ -15,7 +15,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $FreeBSD: src/sys/dev/nfe/if_nfereg.h,v 1.2 2006/06/26 23:41:07 obrien Exp $
+ * $FreeBSD: src/sys/dev/nfe/if_nfereg.h,v 1.3 2006/09/11 07:31:55 obrien Exp $
  */
 
 #define NFE_PCI_BA		0x10
@@ -218,6 +218,14 @@
 #define	PCI_PRODUCT_NVIDIA_NFORCE430_LAN2	0x0269
 #define	PCI_PRODUCT_NVIDIA_MCP55_LAN1		0x0372
 #define	PCI_PRODUCT_NVIDIA_MCP55_LAN2		0x0373
+#define	PCI_PRODUCT_NVIDIA_MCP61_LAN1		0x03e5
+#define	PCI_PRODUCT_NVIDIA_MCP61_LAN2		0x03e6
+#define	PCI_PRODUCT_NVIDIA_MCP61_LAN3		0x03ee
+#define	PCI_PRODUCT_NVIDIA_MCP61_LAN4		0x03ef
+#define	PCI_PRODUCT_NVIDIA_MCP65_LAN1		0x0450
+#define	PCI_PRODUCT_NVIDIA_MCP65_LAN2		0x0451
+#define	PCI_PRODUCT_NVIDIA_MCP65_LAN3		0x0452
+#define	PCI_PRODUCT_NVIDIA_MCP65_LAN4		0x0453
 
 #define	PCI_PRODUCT_NVIDIA_NFORCE3_LAN2	PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN1
 #define	PCI_PRODUCT_NVIDIA_NFORCE3_LAN3	PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN2

==== //depot/projects/newisp/i386/i386/busdma_machdep.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.80 2006/06/01 04:49:29 silby Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.81 2006/09/11 06:48:53 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/kdb.h>
@@ -53,6 +53,9 @@
 #include <machine/md_var.h>
 
 #define MAX_BPAGES 512
+#define BUS_DMA_USE_FILTER	BUS_DMA_BUS2
+#define BUS_DMA_COULD_BOUNCE	BUS_DMA_BUS3
+#define BUS_DMA_MIN_ALLOC_COMP	BUS_DMA_BUS4
 
 struct bounce_zone;
 
@@ -137,7 +140,7 @@
 static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map,
 				   vm_offset_t vaddr, bus_size_t size);
 static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage);
-static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
+static int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
 
 /*
  * Return true if a match is made.
@@ -147,7 +150,7 @@
  * If paddr is within the bounds of the dma tag then call the filter callback
  * to check for a match, if there is no filter callback then assume a match.
  */
-static __inline int
+static int
 run_filter(bus_dma_tag_t dmat, bus_addr_t paddr)
 {
 	int retval;
@@ -202,8 +205,6 @@
 	panic("driver error: busdma dflt_lock called");
 }
 
-#define BUS_DMA_COULD_BOUNCE	BUS_DMA_BUS3
-#define BUS_DMA_MIN_ALLOC_COMP	BUS_DMA_BUS4
 /*
  * Allocate a device specific dma_tag.
  */
@@ -265,6 +266,9 @@
 		else if (parent->boundary != 0)
 			newtag->boundary = MIN(parent->boundary,
 					       newtag->boundary);
+		if ((newtag->filter != NULL) ||
+		    ((parent->flags & BUS_DMA_USE_FILTER) != 0))
+			newtag->flags |= BUS_DMA_USE_FILTER;
 		if (newtag->filter == NULL) {
 			/*
 			 * Short circuit looking at our parent directly
@@ -553,37 +557,16 @@
 	CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags);
 }
 
-/*
- * Utility function to load a linear buffer.  lastaddrp holds state
- * between invocations (for multiple-buffer loads).  segp contains
- * the starting segment on entrace, and the ending segment on exit.
- * first indicates if this is the first invocation of this function.
- */
-static __inline int
-_bus_dmamap_load_buffer(bus_dma_tag_t dmat,
-    			bus_dmamap_t map,
-			void *buf, bus_size_t buflen,
-			pmap_t pmap,
-			int flags,
-			bus_addr_t *lastaddrp,
-			bus_dma_segment_t *segs,
-			int *segp,
-			int first)
+static int
+_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
+			bus_size_t buflen, int flags, int *nb)
 {
-	bus_size_t sgsize;
-	bus_addr_t curaddr, lastaddr, baddr, bmask;
 	vm_offset_t vaddr;
+	vm_offset_t vendaddr;
 	bus_addr_t paddr;
-	int needbounce = 0;
-	int seg;
+	int needbounce = *nb;
 
-	if (map == NULL)
-		map = &nobounce_dmamap;
-
-	if ((map != &nobounce_dmamap && map->pagesneeded == 0) 
-	 && ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) {
-		vm_offset_t	vendaddr;
-
+	if ((map != &nobounce_dmamap && map->pagesneeded == 0)) {
 		CTR4(KTR_BUSDMA, "lowaddr= %d Maxmem= %d, boundary= %d, "
 		    "alignment= %d", dmat->lowaddr, ptoa((vm_paddr_t)Maxmem),
 		    dmat->boundary, dmat->alignment);
@@ -598,7 +581,8 @@
 
 		while (vaddr < vendaddr) {
 			paddr = pmap_kextract(vaddr);
-			if (run_filter(dmat, paddr) != 0) {
+			if (((dmat->flags & BUS_DMA_USE_FILTER) != 0) &&
+			    run_filter(dmat, paddr) != 0) {
 				needbounce = 1;
 				map->pagesneeded++;
 			}
@@ -630,6 +614,43 @@
 		mtx_unlock(&bounce_lock);
 	}
 
+	*nb = needbounce;
+	return (0);
+}
+
+/*
+ * Utility function to load a linear buffer.  lastaddrp holds state
+ * between invocations (for multiple-buffer loads).  segp contains
+ * the starting segment on entrace, and the ending segment on exit.
+ * first indicates if this is the first invocation of this function.
+ */
+static __inline int
+_bus_dmamap_load_buffer(bus_dma_tag_t dmat,
+    			bus_dmamap_t map,
+			void *buf, bus_size_t buflen,
+			pmap_t pmap,
+			int flags,
+			bus_addr_t *lastaddrp,
+			bus_dma_segment_t *segs,
+			int *segp,
+			int first)
+{
+	bus_size_t sgsize;
+	bus_addr_t curaddr, lastaddr, baddr, bmask;
+	vm_offset_t vaddr;
+	int needbounce = 0;
+	int seg, error;
+
+	if (map == NULL)
+		map = &nobounce_dmamap;
+
+	if ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
+		error = _bus_dmamap_count_pages(dmat, map, buf, buflen, flags,
+		    &needbounce);
+		if (error)
+			return (error);
+	}
+
 	vaddr = (vm_offset_t)buf;
 	lastaddr = *lastaddrp;
 	bmask = ~(dmat->boundary - 1);
@@ -659,7 +680,8 @@

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


More information about the p4-projects mailing list