PERFORCE change 143262 for review

Julian Elischer julian at FreeBSD.org
Tue Jun 10 21:12:50 UTC 2008


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

Change 143262 by julian at julian_trafmon1 on 2008/06/10 21:12:34

	IFC at 143258

Affected files ...

.. //depot/projects/vimage/src/sys/arm/xscale/pxa/files.pxa#2 integrate
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_obio.c#2 integrate
.. //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_space.c#2 integrate
.. //depot/projects/vimage/src/sys/dev/bce/if_bce.c#14 integrate
.. //depot/projects/vimage/src/sys/dev/bce/if_bcereg.h#9 integrate
.. //depot/projects/vimage/src/sys/dev/ciss/ciss.c#11 integrate
.. //depot/projects/vimage/src/sys/dev/tx/if_tx.c#3 integrate
.. //depot/projects/vimage/src/sys/dev/tx/if_txvar.h#2 integrate
.. //depot/projects/vimage/src/sys/dev/usb/ehci.c#8 integrate
.. //depot/projects/vimage/src/sys/dev/usb/ehcivar.h#3 integrate
.. //depot/projects/vimage/src/sys/dev/usb/uplcom.c#7 integrate
.. //depot/projects/vimage/src/sys/kern/uipc_sem.c#6 integrate
.. //depot/projects/vimage/src/sys/security/audit/audit_worker.c#8 integrate

Differences ...

==== //depot/projects/vimage/src/sys/arm/xscale/pxa/files.pxa#2 (text+ko) ====

@@ -1,5 +1,6 @@
-# $FreeBSD: src/sys/arm/xscale/pxa/files.pxa,v 1.1 2008/06/06 05:08:09 benno Exp $
+# $FreeBSD: src/sys/arm/xscale/pxa/files.pxa,v 1.2 2008/06/10 03:44:14 kevlo Exp $
 
+arm/arm/bus_space_generic.c		standard
 arm/arm/cpufunc_asm_xscale.S		standard
 arm/arm/irq_dispatch.S			standard
 

==== //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_obio.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/pxa/pxa_obio.c,v 1.1 2008/06/06 05:08:09 benno Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/pxa/pxa_obio.c,v 1.2 2008/06/10 06:06:15 kevlo Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -183,6 +183,12 @@
 }
 
 static int
+pxa_teardown_intr(device_t dev, device_t child, struct resource *ires,
+    void *cookie)
+{
+	return (BUS_TEARDOWN_INTR(device_get_parent(dev), child, ires, cookie));}
+
+static int
 pxa_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
 {
 	struct	obio_device *od;
@@ -313,19 +319,20 @@
 }
 
 static device_method_t pxa_methods[] = {
-	DEVMETHOD(device_identify, pxa_identify),
-	DEVMETHOD(device_probe, pxa_probe),
-	DEVMETHOD(device_attach, pxa_attach),
+	DEVMETHOD(device_identify,	pxa_identify),
+	DEVMETHOD(device_probe,		pxa_probe),
+	DEVMETHOD(device_attach,	pxa_attach),
 
-	DEVMETHOD(bus_print_child, pxa_print_child),
+	DEVMETHOD(bus_print_child,	pxa_print_child),
 
-	DEVMETHOD(bus_read_ivar, pxa_read_ivar),
-	DEVMETHOD(bus_setup_intr, pxa_setup_intr),
+	DEVMETHOD(bus_read_ivar,	pxa_read_ivar),
+	DEVMETHOD(bus_setup_intr,	pxa_setup_intr),
+	DEVMETHOD(bus_teardown_intr,	pxa_teardown_intr),
 
-	DEVMETHOD(bus_get_resource_list, pxa_get_resource_list),
-	DEVMETHOD(bus_alloc_resource, pxa_alloc_resource),
-	DEVMETHOD(bus_release_resource, pxa_release_resource),
-	DEVMETHOD(bus_activate_resource, pxa_activate_resource),
+	DEVMETHOD(bus_get_resource_list,	pxa_get_resource_list),
+	DEVMETHOD(bus_alloc_resource,		pxa_alloc_resource),
+	DEVMETHOD(bus_release_resource,		pxa_release_resource),
+	DEVMETHOD(bus_activate_resource,	pxa_activate_resource),
 
 	{0, 0}
 };

==== //depot/projects/vimage/src/sys/arm/xscale/pxa/pxa_space.c#2 (text+ko) ====

@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/pxa/pxa_space.c,v 1.1 2008/06/06 05:08:09 benno Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/pxa/pxa_space.c,v 1.2 2008/06/10 03:44:14 kevlo Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -48,13 +48,6 @@
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 
-#include <machine/pcb.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_extern.h>
-
 #include <machine/bus.h>
 
 #include <arm/xscale/pxa/pxareg.h>
@@ -63,7 +56,6 @@
 MALLOC_DEFINE(M_PXATAG, "PXA bus_space tags", "Bus_space tags for PXA");
 
 /* Prototypes for all the bus_space structure functions */
-bs_protos(obio);
 bs_protos(generic);
 bs_protos(generic_armv4);
 bs_protos(pxa);
@@ -77,16 +69,16 @@
 	(void *) 0,
 
 	/* mapping/unmapping */
-	obio_bs_map,
-	obio_bs_unmap,
-	obio_bs_subregion,
+	generic_bs_map,
+	generic_bs_unmap,
+	generic_bs_subregion,
 
 	/* allocation/deallocation */
-	obio_bs_alloc,
-	obio_bs_free,
+	generic_bs_alloc,
+	generic_bs_free,
 
 	/* barrier */
-	obio_bs_barrier,
+	generic_bs_barrier,
 
 	/* read (single) */
 	pxa_bs_r_1,
@@ -174,94 +166,6 @@
 	return ((bus_space_tag_t)tag);
 }
 
-int
-obio_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
-    bus_space_handle_t *bshp)
-{
-	const struct pmap_devmap *pd;
-	vm_paddr_t startpa, endpa, pa, offset;
-	vm_offset_t va;
-	pt_entry_t *pte;
-
-	if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
-		/* Device was statically mapped. */
-		*bshp = pd->pd_va + (bpa - pd->pd_pa);
-		return (0);
-	}
-
-	endpa = round_page(bpa + size);
-	offset = bpa & PAGE_MASK;
-	startpa = trunc_page(bpa);
-		
-	va = kmem_alloc(kernel_map, endpa - startpa);
-	if (va == 0)
-		return (ENOMEM);
-
-	*bshp = va + offset;
-
-	for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
-		pmap_kenter(va, pa);
-		pte = vtopte(va);
-		*pte &= ~L2_S_CACHE_MASK;
-		PTE_SYNC(pte);
-	}
-
-	return (0);
-}
-
-int
-obio_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
-    bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *bpap,
-    bus_space_handle_t *bshp)
-{
-
-	panic("obio_bs_alloc(): not implemented");
-}
-
-
-void
-obio_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
-{
-	vm_offset_t va, endva;
-
-	if (pmap_devmap_find_va((vm_offset_t)t, size) != NULL) {
-		/* Device was statically mapped; nothing to do. */
-		return;
-	}
-
-	endva = round_page((vm_offset_t)t + size);
-	va = trunc_page((vm_offset_t)t);
-
-	while (va < endva) {
-		pmap_kremove(va);
-		va += PAGE_SIZE;
-	}
-	kmem_free(kernel_map, va, endva - va);
-}
-
-void    
-obio_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
-{
-
-	panic("obio_bs_free(): not implemented");
-}
-
-int
-obio_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
-    bus_size_t size, bus_space_handle_t *nbshp)
-{
-
-	*nbshp = bsh + offset;
-	return (0);
-}
-
-void
-obio_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
-    bus_size_t len, int flags)
-{
-
-	/* Nothing to do. */
-}
 
 #define	READ_SINGLE(type, proto, base)					\
 	type								\

==== //depot/projects/vimage/src/sys/dev/bce/if_bce.c#14 (text) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.40 2008/05/30 18:26:37 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.41 2008/06/10 02:19:11 davidch Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -82,6 +82,11 @@
 	int bce_debug_bootcode_running_failure = 0;
 #endif
 
+/****************************************************************************/
+/* BCE Build Time Options                                                   */
+/****************************************************************************/
+#define BCE_USE_SPLIT_HEADER 1
+/* #define BCE_NVRAM_WRITE_SUPPORT 1 */
 
 /****************************************************************************/
 /* PCI Device ID Table                                                      */
@@ -224,16 +229,22 @@
 static void bce_dump_mbuf 			(struct bce_softc *, struct mbuf *);
 static void bce_dump_tx_mbuf_chain	(struct bce_softc *, u16, int);
 static void bce_dump_rx_mbuf_chain	(struct bce_softc *, u16, int);
-static void bce_dump_pg_mbuf_chain	(struct bce_softc *, u16, int);
+#ifdef BCE_USE_SPLIT_HEADER
+static void bce_dump_pg_mbuf_chain	(struct bce_softc *, u16, int);
+#endif
 static void bce_dump_txbd			(struct bce_softc *, int, struct tx_bd *);
 static void bce_dump_rxbd			(struct bce_softc *, int, struct rx_bd *);
-static void bce_dump_pgbd			(struct bce_softc *, int, struct rx_bd *);
+#ifdef BCE_USE_SPLIT_HEADER
+static void bce_dump_pgbd			(struct bce_softc *, int, struct rx_bd *);
+#endif
 static void bce_dump_l2fhdr			(struct bce_softc *, int, struct l2_fhdr *);
 static void bce_dump_ctx			(struct bce_softc *, u16);
 static void bce_dump_ftqs			(struct bce_softc *);
 static void bce_dump_tx_chain		(struct bce_softc *, u16, int);
 static void bce_dump_rx_chain		(struct bce_softc *, u16, int);
-static void bce_dump_pg_chain		(struct bce_softc *, u16, int);
+#ifdef BCE_USE_SPLIT_HEADER
+static void bce_dump_pg_chain		(struct bce_softc *, u16, int);
+#endif
 static void bce_dump_status_block	(struct bce_softc *);
 static void bce_dump_stats_block	(struct bce_softc *);
 static void bce_dump_driver_state	(struct bce_softc *);
@@ -294,7 +305,9 @@
 static int  bce_chipinit 			(struct bce_softc *);
 static int  bce_blockinit 			(struct bce_softc *);
 static int  bce_get_rx_buf			(struct bce_softc *, struct mbuf *, u16 *, u16 *, u32 *);
-static int  bce_get_pg_buf			(struct bce_softc *, struct mbuf *, u16 *, u16 *);
+#ifdef BCE_USE_SPLIT_HEADER
+static int  bce_get_pg_buf			(struct bce_softc *, struct mbuf *, u16 *, u16 *);
+#endif
 
 static int  bce_init_tx_chain		(struct bce_softc *);
 static void bce_free_tx_chain		(struct bce_softc *);
@@ -302,10 +315,12 @@
 static int  bce_init_rx_chain		(struct bce_softc *);
 static void bce_fill_rx_chain		(struct bce_softc *);
 static void bce_free_rx_chain		(struct bce_softc *);
-
+
+#ifdef BCE_USE_SPLIT_HEADER
 static int  bce_init_pg_chain		(struct bce_softc *);
 static void bce_fill_pg_chain		(struct bce_softc *);
-static void bce_free_pg_chain		(struct bce_softc *);
+static void bce_free_pg_chain		(struct bce_softc *);
+#endif
 
 static int  bce_tx_encap			(struct bce_softc *, struct mbuf **);
 static void bce_start_locked		(struct ifnet *);
@@ -778,10 +793,18 @@
 	/* Use standard mbuf sizes for buffer allocation. */
 #ifdef BCE_USE_SPLIT_HEADER
 	sc->rx_bd_mbuf_alloc_size = MHLEN;
+	/* Make sure offset is 16 byte aligned for hardware. */
+	sc->rx_bd_mbuf_align_pad  = roundup2((MSIZE - MHLEN), 16) -
+		(MSIZE - MHLEN);
+	sc->rx_bd_mbuf_data_len   = sc->rx_bd_mbuf_alloc_size -
+		sc->rx_bd_mbuf_align_pad;
+	sc->pg_bd_mbuf_alloc_size = MCLBYTES;
 #else
 	sc->rx_bd_mbuf_alloc_size = MCLBYTES;
-#endif
-	sc->pg_bd_mbuf_alloc_size = MCLBYTES;
+	sc->rx_bd_mbuf_align_pad  = roundup2(MCLBYTES, 16) - MCLBYTES;
+	sc->rx_bd_mbuf_data_len   = sc->rx_bd_mbuf_alloc_size -
+		sc->rx_bd_mbuf_align_pad;
+#endif
 
 	ifp->if_snd.ifq_drv_maxlen = USABLE_TX_BD;
 	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
@@ -856,6 +879,9 @@
 		((sc->bce_flags & BCE_PCI_32BIT_FLAG) ? "32-bit" : "64-bit"),
 		sc->bus_speed_mhz);
 	printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver);
+#ifdef BCE_USE_SPLIT_HEADER
+	printf("SPLT ");
+#endif
 	if (sc->bce_flags & BCE_MFW_ENABLE_FLAG)
 		printf("MFW ");
 	if (sc->bce_flags & BCE_USING_MSI_FLAG)
@@ -2246,6 +2272,7 @@
 	}
 
 
+#ifdef BCE_USE_SPLIT_HEADER
 	/* Free, unmap and destroy all page buffer descriptor chain pages. */
 	for (i = 0; i < PG_PAGES; i++ ) {
 		if (sc->pg_bd_chain[i] != NULL) {
@@ -2272,6 +2299,7 @@
 		bus_dma_tag_destroy(sc->pg_bd_chain_tag);
 		sc->pg_bd_chain_tag = NULL;
 	}
+#endif
 
 
 	/* Unload and destroy the TX mbuf maps. */
@@ -2308,6 +2336,7 @@
 		sc->rx_mbuf_tag = NULL;
 	}
 
+#ifdef BCE_USE_SPLIT_HEADER
 	/* Unload and destroy the page mbuf maps. */
 	for (i = 0; i < TOTAL_PG_BD; i++) {
 		if (sc->pg_mbuf_map[i] != NULL) {
@@ -2324,6 +2353,7 @@
 		bus_dma_tag_destroy(sc->pg_mbuf_tag);
 		sc->pg_mbuf_tag = NULL;
 	}
+#endif
 
 	/* Destroy the parent tag */
 	if (sc->parent_tag != NULL) {
@@ -2376,7 +2406,21 @@
 /* Allocate any DMA memory needed by the driver.                            */
 /*                                                                          */
 /* Allocates DMA memory needed for the various global structures needed by  */
-/* hardware.                                                                */
+/* hardware.                                                                */
+/*                                                                          */
+/* Memory alignment requirements:                                           */
+/* -----------------+----------+----------+                                 */
+/* Data Structure   |   5706   |   5708   |                                 */
+/* -----------------+----------+----------+                                 */
+/* Status Block     | 8 bytes  | 8 bytes  |                                 */
+/* Statistics Block | 8 bytes  | 8 bytes  |                                 */
+/* RX Buffers       | 16 bytes | 16 bytes |                                 */
+/* PG Buffers       |   none   |   none   |                                 */
+/* TX Buffers       |   none   |   none   |                                 */
+/* Chain Pages(1)   |   4KiB   |   4KiB   |                                 */
+/* -----------------+----------+----------+                                 */
+/*                                                                          */
+/* (1) Must align with CPU page size (BCM_PAGE_SZIE).                       */
 /*                                                                          */
 /* Returns:                                                                 */
 /*   0 for success, positive value for failure.                             */
@@ -2683,8 +2727,12 @@
 	/*
 	 * Create a DMA tag for RX mbufs.
 	 */
+#ifdef BCE_USE_SPLIT_HEADER
 	max_size = max_seg_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ? 
-		MCLBYTES : sc->rx_bd_mbuf_alloc_size);
+		MCLBYTES : sc->rx_bd_mbuf_alloc_size);
+#else
+	max_size = max_seg_size = MJUM9BYTES;
+#endif
 
 	if (bus_dma_tag_create(sc->parent_tag,
 			1,
@@ -2715,6 +2763,7 @@
 		}
 	}
 
+#ifdef BCE_USE_SPLIT_HEADER
 	/*
 	 * Create a DMA tag for the page buffer descriptor chain,
 	 * allocate and clear the memory, and fetch the physical
@@ -2777,7 +2826,7 @@
 	 * Create a DMA tag for page mbufs.
 	 */
 	max_size = max_seg_size = ((sc->pg_bd_mbuf_alloc_size < MCLBYTES) ? 
-		MCLBYTES : sc->rx_bd_mbuf_alloc_size);
+		MCLBYTES : sc->pg_bd_mbuf_alloc_size);
 
 	if (bus_dma_tag_create(sc->parent_tag,
 			1,
@@ -2807,6 +2856,7 @@
 			goto bce_dma_alloc_exit;
 		}
 	}
+#endif
 
 bce_dma_alloc_exit:
 	DBPRINT(sc, BCE_VERBOSE_RESET, "Exiting %s()\n", __FUNCTION__);
@@ -3449,7 +3499,9 @@
 	bce_disable_intr(sc);
 
 	/* Free RX buffers. */
-	bce_free_pg_chain(sc);
+#ifdef BCE_USE_SPLIT_HEADER
+	bce_free_pg_chain(sc);
+#endif
 	bce_free_rx_chain(sc);
 
 	/* Free TX buffers. */
@@ -3811,8 +3863,12 @@
 #ifdef BCE_USE_SPLIT_HEADER
 		MGETHDR(m_new, M_DONTWAIT, MT_DATA);
 #else
-		m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+		if (sc->rx_bd_mbuf_alloc_size == MCLBYTES)
+			m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+		else
+			m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, sc->rx_bd_mbuf_alloc_size);
 #endif
+
 		if (m_new == NULL) {
 			sc->mbuf_alloc_failed++;
 			rc = ENOBUFS;
@@ -3825,9 +3881,12 @@
 		m_new = m;
 	}
 
+	/* Make sure we have a valid packet header. */
 	M_ASSERTPKTHDR(m_new);
 
-	m_new->m_pkthdr.len = m_new->m_len = sc->rx_bd_mbuf_alloc_size;
+	/* Initialize the mbuf size and pad if necessary for alignment. */
+	m_new->m_pkthdr.len = m_new->m_len = sc->rx_bd_mbuf_alloc_size;
+	m_adj(m_new, sc->rx_bd_mbuf_align_pad);
 
 	/* ToDo: Consider calling m_fragment() to test error handling. */
 
@@ -3838,8 +3897,8 @@
 
 	/* Handle any mapping errors. */
 	if (error) {
-		BCE_PRINTF("%s(%d): Error mapping mbuf into RX chain!\n",
-			__FILE__, __LINE__);
+		BCE_PRINTF("%s(%d): Error mapping mbuf into RX chain (%d)!\n",
+			__FILE__, __LINE__, error);
 
 		m_freem(m_new);
 		DBRUN(sc->debug_rx_mbuf_alloc--);
@@ -3861,7 +3920,7 @@
 	rxbd->rx_bd_haddr_hi  = htole32(BCE_ADDR_HI(segs[0].ds_addr));
 	rxbd->rx_bd_len       = htole32(segs[0].ds_len);
 	rxbd->rx_bd_flags     = htole32(RX_BD_FLAGS_START | RX_BD_FLAGS_END);
-	*prod_bseq += segs[0].ds_len;
+	*prod_bseq            += segs[0].ds_len;
 
 	/* Save the mbuf and update our counter. */
 	sc->rx_mbuf_ptr[*chain_prod] = m_new;
@@ -3881,6 +3940,7 @@
 }
 
 
+#ifdef BCE_USE_SPLIT_HEADER
 /****************************************************************************/
 /* Encapsulate an mbuf cluster into the page chain.                        */
 /*                                                                          */
@@ -3991,6 +4051,7 @@
 
 	return(rc);
 }
+#endif /* BCE_USE_SPLIT_HEADER */
 
 
 /****************************************************************************/
@@ -4234,8 +4295,10 @@
 
 	DBPRINT(sc, BCE_VERBOSE_RESET, "Entering %s()\n", __FUNCTION__);
 
+#ifdef BCE_USE_SPLIT_HEADER
 	/* Clear the jumbo page chain support. */
-	CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_PG_BUF_SIZE, 0);
+	CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_PG_BUF_SIZE, 0);
+#endif
 
 	/* Free any mbufs still in the RX mbuf chain. */
 	for (i = 0; i < TOTAL_RX_BD; i++) {
@@ -4264,6 +4327,7 @@
 }
 
 
+#ifdef BCE_USE_SPLIT_HEADER
 /****************************************************************************/
 /* Allocate memory and initialize the page data structures.                 */
 /* Assumes that bce_init_rx_chain() has not already been called.            */
@@ -4312,7 +4376,11 @@
 	CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_NX_PG_BDHADDR_LO, val);
 
 	/* Configure the rx_bd and page chain mbuf cluster size. */
-	val = (sc->rx_bd_mbuf_alloc_size << 16) | sc->pg_bd_mbuf_alloc_size;
+#ifdef BCE_USE_SPLIT_HEADER
+	val = (sc->rx_bd_mbuf_data_len << 16) | sc->pg_bd_mbuf_alloc_size;
+#else
+	val = (sc->rx_bd_mbuf_data_len << 16);
+#endif
 	CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_PG_BUF_SIZE, val);
 
 	/* Configure the context reserved for jumbo support. */
@@ -4413,6 +4481,7 @@
 
 	DBPRINT(sc, BCE_EXCESSIVE_RESET, "Exiting %s()\n", __FUNCTION__);
 }
+#endif /* BCE_USE_SPLIT_HEADER */
 
 
 /****************************************************************************/
@@ -4567,9 +4636,13 @@
 {
 	struct ifnet *ifp = sc->bce_ifp;
 	struct l2_fhdr *l2fhdr;
-	unsigned int pages, pkt_len, rem_len;
-	u16 sw_rx_cons, sw_rx_cons_idx, sw_pg_cons, sw_pg_cons_idx, hw_rx_cons;
+	unsigned int pkt_len;
+	u16 sw_rx_cons, sw_rx_cons_idx, hw_rx_cons;
 	u32 status;
+#ifdef BCE_USE_SPLIT_HEADER
+	unsigned int pages, rem_len;
+	u16 sw_pg_cons, sw_pg_cons_idx;
+#endif
 
 
 #ifdef BCE_DEBUG
@@ -4583,17 +4656,21 @@
 		bus_dmamap_sync(sc->rx_bd_chain_tag,
 		    sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTWRITE);
 
+#ifdef BCE_USE_SPLIT_HEADER
 	/* Prepare the page chain pages to be accessed by the host CPU. */
 	for (int i = 0; i < PG_PAGES; i++)
 		bus_dmamap_sync(sc->pg_bd_chain_tag,
-		    sc->pg_bd_chain_map[i], BUS_DMASYNC_POSTWRITE);
+		    sc->pg_bd_chain_map[i], BUS_DMASYNC_POSTWRITE);
+#endif
 
 	/* Get the hardware's view of the RX consumer index. */
 	hw_rx_cons = sc->hw_rx_cons = bce_get_hw_rx_cons(sc);
 
 	/* Get working copies of the driver's view of the consumer indices. */
 	sw_rx_cons = sc->rx_cons;
-	sw_pg_cons = sc->pg_cons;
+#ifdef BCE_USE_SPLIT_HEADER
+	sw_pg_cons = sc->pg_cons;
+#endif
 
 	DBPRINT(sc, BCE_INFO_RECV, "%s(enter): rx_prod = 0x%04X, "
 		"rx_cons = 0x%04X, rx_prod_bseq = 0x%08X\n",
@@ -4656,10 +4733,12 @@
 		 */
 		m_adj(m0, sizeof(struct l2_fhdr) + ETHER_ALIGN);
 
+
+#ifdef BCE_USE_SPLIT_HEADER
 		/*
 		 * Check whether the received frame fits in a single
 		 * mbuf or not (i.e. packet data + FCS <= 
-		 * sc->rx_bd_mbuf_alloc_size bytes).
+		 * sc->rx_bd_mbuf_data_len bytes).
 		 */
 		if (pkt_len > m0->m_len) {
 			/*
@@ -4737,7 +4816,8 @@
 
 			/* Set the total packet length. */
 			m0->m_pkthdr.len = m0->m_len = pkt_len;
-		}
+		}
+#endif
 
 		/* Remove the trailing Ethernet FCS. */
 		m_adj(m0, -ETHER_CRC_LEN);
@@ -4825,7 +4905,9 @@
 		if (m0) {
 			/* Make sure we don't lose our place when we release the lock. */
 			sc->rx_cons = sw_rx_cons;
-			sc->pg_cons = sw_pg_cons;
+#ifdef BCE_USE_SPLIT_HEADER
+			sc->pg_cons = sw_pg_cons;
+#endif
 
 			BCE_UNLOCK(sc);
 			(*ifp->if_input)(ifp, m0);
@@ -4833,7 +4915,9 @@
 			
 			/* Recover our place. */
 			sw_rx_cons = sc->rx_cons;
-			sw_pg_cons = sc->pg_cons;
+#ifdef BCE_USE_SPLIT_HEADER
+			sw_pg_cons = sc->pg_cons;
+#endif
 		}
 
 		/* Refresh hw_cons to see if there's new work */
@@ -4842,8 +4926,10 @@
 	}
 
 	/* No new packets to process.  Refill the RX and page chains and exit. */
+#ifdef BCE_USE_SPLIT_HEADER
 	sc->pg_cons = sw_pg_cons;
-	bce_fill_pg_chain(sc);
+	bce_fill_pg_chain(sc);
+#endif
 
 	sc->rx_cons = sw_rx_cons;
 	bce_fill_rx_chain(sc);
@@ -4852,9 +4938,11 @@
 		bus_dmamap_sync(sc->rx_bd_chain_tag,
 		    sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
 
+#ifdef BCE_USE_SPLIT_HEADER
 	for (int i = 0; i < PG_PAGES; i++)
 		bus_dmamap_sync(sc->pg_bd_chain_tag,
-		    sc->pg_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
+		    sc->pg_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
+#endif
 
 	DBPRINT(sc, BCE_INFO_RECV, "%s(exit): rx_prod = 0x%04X, "
 		"rx_cons = 0x%04X, rx_prod_bseq = 0x%08X\n",
@@ -5089,12 +5177,19 @@
 	bcopy(IF_LLADDR(sc->bce_ifp), sc->eaddr, ETHER_ADDR_LEN);
 	bce_set_mac_addr(sc);
 
-	/* Calculate and program the hardware Ethernet MTU size. */
-	if (ifp->if_mtu <= sc->pg_bd_mbuf_alloc_size)
-		/* Be generous on receive if we have room. */
-		ether_mtu = sc->pg_bd_mbuf_alloc_size;
+	/* 
+	 * Calculate and program the hardware Ethernet MTU 
+	 * size. Be generous on the receive if we have room.
+	 */
+#ifdef BCE_USE_SPLIT_HEADER
+	if (ifp->if_mtu <= (sc->rx_bd_mbuf_data_len + sc->pg_bd_mbuf_alloc_size))
+		ether_mtu = sc->rx_bd_mbuf_data_len + sc->pg_bd_mbuf_alloc_size;
+#else
+	if (ifp->if_mtu <= sc->rx_bd_mbuf_data_len)
+		ether_mtu = sc->rx_bd_mbuf_data_len;
+#endif
 	else
-		ether_mtu = ifp->if_mtu;
+		ether_mtu = ifp->if_mtu;
 
 	ether_mtu += ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN;
 
@@ -5110,14 +5205,18 @@
 		REG_WR(sc, BCE_EMAC_RX_MTU_SIZE, ether_mtu);
 
 	DBPRINT(sc, BCE_INFO_LOAD, 
-		"%s(): rx_bd_mbuf_alloc_size = %d, pg_bd_mbuf_alloc_size = %d\n",
-		__FUNCTION__, sc->rx_bd_mbuf_alloc_size, sc->pg_bd_mbuf_alloc_size);
+		"%s(): rx_bd_mbuf_alloc_size = %d, rx_bce_mbuf_data_len = %d, "
+		"rx_bd_mbuf_align_pad = %d, pg_bd_mbuf_alloc_size = %d\n",
+		__FUNCTION__, sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len,
+		sc->rx_bd_mbuf_align_pad, sc->pg_bd_mbuf_alloc_size);
 
 	/* Program appropriate promiscuous/multicast filtering. */
 	bce_set_rx_mode(sc);
 
+#ifdef BCE_USE_SPLIT_HEADER
 	/* Init page buffer descriptor chain. */
-	bce_init_pg_chain(sc);
+	bce_init_pg_chain(sc);
+#endif
 
 	/* Init RX buffer descriptor chain. */
 	bce_init_rx_chain(sc);
@@ -5583,7 +5682,24 @@
 
 			BCE_LOCK(sc);
 			ifp->if_mtu = ifr->ifr_mtu;
-			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+#ifdef BCE_USE_SPLIT_HEADER
+			/* No buffer allocation size changes are necessary. */
+#else
+			/* Recalculate our buffer allocation sizes. */
+			if ((ifp->if_mtu + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN) > MCLBYTES) {
+				sc->rx_bd_mbuf_alloc_size = MJUM9BYTES;
+				sc->rx_bd_mbuf_align_pad  = roundup2(MJUM9BYTES, 16) - MJUM9BYTES;
+				sc->rx_bd_mbuf_data_len   = sc->rx_bd_mbuf_alloc_size -
+					sc->rx_bd_mbuf_align_pad;
+			} else {
+				sc->rx_bd_mbuf_alloc_size = MCLBYTES;
+				sc->rx_bd_mbuf_align_pad  = roundup2(MCLBYTES, 16) - MCLBYTES;
+				sc->rx_bd_mbuf_data_len   = sc->rx_bd_mbuf_alloc_size -
+					sc->rx_bd_mbuf_align_pad;
+			}
+#endif
+
 			bce_init_locked(sc);
 			BCE_UNLOCK(sc);
 			break;
@@ -6233,7 +6349,9 @@
 	bce_stats_update(sc);
 
 	/* Top off the receive and page chains. */
-	bce_fill_pg_chain(sc);
+#ifdef BCE_USE_SPLIT_HEADER
+	bce_fill_pg_chain(sc);
+#endif
 	bce_fill_rx_chain(sc);
 
 	/* Check that chip hasn't hung. */
@@ -6406,6 +6524,7 @@
 }
 
 
+#ifdef BCE_USE_SPLIT_HEADER
 /****************************************************************************/
 /* Provides a sysctl interface to allow dumping the page chain.             */
 /*                                                                          */
@@ -6431,7 +6550,8 @@
         }
 
         return error;
-}
+}
+#endif
 
 
 /****************************************************************************/
@@ -6923,10 +7043,12 @@
 		(void *)sc, 0,
 		bce_sysctl_dump_tx_chain, "I", "Dump tx_bd chain");
 
+#ifdef BCE_USE_SPLIT_HEADER
 	SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
 		"dump_pg_chain", CTLTYPE_INT | CTLFLAG_RW,
 		(void *)sc, 0,
-		bce_sysctl_dump_pg_chain, "I", "Dump page chain");
+		bce_sysctl_dump_pg_chain, "I", "Dump page chain");
+#endif
 
 	SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
 		"breakpoint", CTLTYPE_INT | CTLFLAG_RW,
@@ -7104,6 +7226,7 @@
 }
 
 
+#ifdef BCE_USE_SPLIT_HEADER
 /****************************************************************************/
 /* Prints out the mbufs in the mbuf page chain.                             */
 /*                                                                          */
@@ -7132,7 +7255,8 @@
 		"----------------------------"
 		"----------------"
 		"----------------------------\n");
-}
+}
+#endif
 
 
 /****************************************************************************/
@@ -7226,6 +7350,7 @@
 }
 
 
+#ifdef BCE_USE_SPLIT_HEADER
 /****************************************************************************/
 /* Prints out a rx_bd structure in the page chain.                          */
 /*                                                                          */
@@ -7248,7 +7373,8 @@
 			"flags = 0x%08X\n", idx, 
 			pgbd->rx_bd_haddr_hi, pgbd->rx_bd_haddr_lo,
 			pgbd->rx_bd_len, pgbd->rx_bd_flags);
-}
+}
+#endif
 
 
 /****************************************************************************/
@@ -7612,6 +7738,7 @@
 }
 
 
+#ifdef BCE_USE_SPLIT_HEADER
 /****************************************************************************/
 /* Prints out the page chain.                                               */
 /*                                                                          */
@@ -7654,7 +7781,8 @@
 		"----------------------------"
 		"----------------"
 		"----------------------------\n");
-}
+}
+#endif
 
 
 /****************************************************************************/
@@ -8091,11 +8219,13 @@
 		"0x%08X:%08X - (sc->rx_bd_chain) rx_bd chain virtual address\n",
 		val_hi, val_lo);
 
+#ifdef BCE_USE_SPLIT_HEADER
 	val_hi = BCE_ADDR_HI(sc->pg_bd_chain);
 	val_lo = BCE_ADDR_LO(sc->pg_bd_chain);
 	BCE_PRINTF(
 		"0x%08X:%08X - (sc->pg_bd_chain) page chain virtual address\n",
-		val_hi, val_lo);
+		val_hi, val_lo);
+#endif
 
 	val_hi = BCE_ADDR_HI(sc->tx_mbuf_ptr);
 	val_lo = BCE_ADDR_LO(sc->tx_mbuf_ptr);
@@ -8109,11 +8239,13 @@
 		"0x%08X:%08X - (sc->rx_mbuf_ptr) rx mbuf chain virtual address\n",
 		val_hi, val_lo);
 
+#ifdef BCE_USE_SPLIT_HEADER
 	val_hi = BCE_ADDR_HI(sc->pg_mbuf_ptr);
 	val_lo = BCE_ADDR_LO(sc->pg_mbuf_ptr);
 	BCE_PRINTF( 
 		"0x%08X:%08X - (sc->pg_mbuf_ptr) page mbuf chain virtual address\n",
-		val_hi, val_lo);
+		val_hi, val_lo);
+#endif
 
 	BCE_PRINTF("         0x%08X - (sc->interrupts_generated) h/w intrs\n",
 		sc->interrupts_generated);
@@ -8160,6 +8292,7 @@
 	BCE_PRINTF("         0x%08X - (sc->free_rx_bd) free rx_bd's\n",
 		sc->free_rx_bd);
 
+#ifdef BCE_USE_SPLIT_HEADER
 	BCE_PRINTF("     0x%04X(0x%04X) - (sc->pg_prod) page producer index\n",
 		sc->pg_prod, (u16) PG_CHAIN_IDX(sc->pg_prod));
 
@@ -8174,6 +8307,7 @@
 
 	BCE_PRINTF("0x%08X/%08X - (sc->pg_low_watermark) page low watermark\n",
 		sc->pg_low_watermark, sc->max_pg_bd);
+#endif
 
 	BCE_PRINTF("         0x%08X - (sc->mbuf_alloc_failed) "
 		"mbuf alloc failures\n",
@@ -8482,16 +8616,13 @@
 		bce_unfreeze_controller(sc);
    		bce_dump_txbd(sc, 0, NULL);
 		bce_dump_rxbd(sc, 0, NULL);
-		bce_dump_pgbd(sc, 0, NULL);
 		bce_dump_tx_mbuf_chain(sc, 0, USABLE_TX_BD);
 		bce_dump_rx_mbuf_chain(sc, 0, USABLE_RX_BD);
-		bce_dump_pg_mbuf_chain(sc, 0, USABLE_PG_BD);
 		bce_dump_l2fhdr(sc, 0, NULL);
 		bce_dump_ctx(sc, RX_CID);
 		bce_dump_ftqs(sc);
 		bce_dump_tx_chain(sc, 0, USABLE_TX_BD);
 		bce_dump_rx_chain(sc, 0, USABLE_RX_BD);
-		bce_dump_pg_chain(sc, 0, USABLE_PG_BD);
 		bce_dump_status_block(sc);
 		bce_dump_stats_block(sc);
 		bce_dump_driver_state(sc);
@@ -8500,6 +8631,11 @@
 		bce_dump_txp_state(sc);
 		bce_dump_rxp_state(sc);
 		bce_dump_tpat_state(sc);
+#ifdef BCE_USE_SPLIT_HEADER
+		bce_dump_pgbd(sc, 0, NULL);
+		bce_dump_pg_mbuf_chain(sc, 0, USABLE_PG_BD);
+		bce_dump_pg_chain(sc, 0, USABLE_PG_BD);
+#endif
 	}
 
 	bce_dump_status_block(sc);

==== //depot/projects/vimage/src/sys/dev/bce/if_bcereg.h#9 (text) ====

@@ -26,7 +26,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.18 2008/04/11 23:10:40 davidch Exp $
+ * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.19 2008/06/10 02:19:11 davidch Exp $
  */
 
 #ifndef	_BCE_H_DEFINED
@@ -131,7 +131,9 @@
 
 /****************************************************************************/
 /* Debugging macros and definitions.                                        */
-/****************************************************************************/
+/****************************************************************************/
+/* #define BCE_DEBUG 1 */
+
 #define BCE_CP_LOAD 			0x00000001
 #define BCE_CP_SEND		 		0x00000002
 #define BCE_CP_RECV				0x00000004
@@ -466,7 +468,7 @@
  * running and there won't be any firmware-driver synchronization during a
  * driver reset. 
  */
-#define FW_ACK_TIME_OUT_MS                  100
+#define FW_ACK_TIME_OUT_MS                  1000
 
 
 #define BCE_DRV_RESET_SIGNATURE				0x00000000
@@ -4924,8 +4926,7 @@
 #define BCE_MAX_JUMBO_ETHER_MTU			9018
 #define BCE_MAX_JUMBO_ETHER_MTU_VLAN 	9022
 
-// #define BCE_MAX_MTU		ETHER_MAX_LEN_JUMBO + ETHER_VLAN_ENCAP_LEN	/* 9022 */
-
+
 /****************************************************************************/
 /* BCE Device State Data Structure                                          */
 /****************************************************************************/
@@ -5047,7 +5048,9 @@
 
 	/* Frame size and mbuf allocation size for RX frames. */
 	u32					max_frame_size;
-	int					rx_bd_mbuf_alloc_size;
+	int					rx_bd_mbuf_alloc_size;
+	int					rx_bd_mbuf_data_len;
+	int					rx_bd_mbuf_align_pad;
 	int					pg_bd_mbuf_alloc_size;
 
 	/* Receive mode settings (i.e promiscuous, multicast, etc.). */

==== //depot/projects/vimage/src/sys/dev/ciss/ciss.c#11 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/ciss/ciss.c,v 1.88 2008/05/16 08:27:02 ps Exp $
+ *	$FreeBSD: src/sys/dev/ciss/ciss.c,v 1.89 2008/06/10 17:51:51 ps Exp $
  */
 
 /*
@@ -298,6 +298,11 @@
     { 0x103C, 0x323A, CISS_BOARD_SA5,	"HP Smart Array" },
     { 0x103C, 0x323B, CISS_BOARD_SA5,	"HP Smart Array" },
     { 0x103C, 0x323C, CISS_BOARD_SA5,	"HP Smart Array" },
+    { 0x103C, 0x3241, CISS_BOARD_SA5,	"HP Smart Array P212" },
+    { 0x103C, 0x3243, CISS_BOARD_SA5,	"HP Smart Array P410" },
+    { 0x103C, 0x3245, CISS_BOARD_SA5,	"HP Smart Array P410i" },
+    { 0x103C, 0x3247, CISS_BOARD_SA5,	"HP Smart Array P411" },
+    { 0x103C, 0x3249, CISS_BOARD_SA5,	"HP Smart Array P812" },
     { 0, 0, 0, NULL }
 };
 

==== //depot/projects/vimage/src/sys/dev/tx/if_tx.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/tx/if_tx.c,v 1.97 2007/02/23 12:18:57 piso Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/tx/if_tx.c,v 1.98 2008/06/10 17:59:43 jhb Exp $");
 

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


More information about the p4-projects mailing list