From owner-p4-projects@FreeBSD.ORG Sat Feb 28 09:26:46 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id ECF9C1065670; Sat, 28 Feb 2009 09:26:45 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC162106566B for ; Sat, 28 Feb 2009 09:26:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 98D858FC14 for ; Sat, 28 Feb 2009 09:26:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n1S9QjgW059337 for ; Sat, 28 Feb 2009 09:26:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n1S9Qjkl059335 for perforce@freebsd.org; Sat, 28 Feb 2009 09:26:45 GMT (envelope-from hselasky@FreeBSD.org) Date: Sat, 28 Feb 2009 09:26:45 GMT Message-Id: <200902280926.n1S9Qjkl059335@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 158437 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Feb 2009 09:26:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=158437 Change 158437 by hselasky@hselasky_laptop001 on 2009/02/28 09:26:26 IFC @ 158435 Affected files ... .. //depot/projects/usb/src/sys/arm/at91/files.at91#7 integrate .. //depot/projects/usb/src/sys/dev/ata/ata-usb.c#39 integrate .. //depot/projects/usb/src/sys/dev/bce/if_bce.c#16 integrate .. //depot/projects/usb/src/sys/dev/bce/if_bcefw.h#6 integrate .. //depot/projects/usb/src/sys/dev/bce/if_bcereg.h#10 integrate .. //depot/projects/usb/src/sys/dev/drm/drmP.h#9 integrate .. //depot/projects/usb/src/sys/dev/drm/drm_drv.c#8 integrate .. //depot/projects/usb/src/sys/dev/drm/drm_irq.c#6 integrate .. //depot/projects/usb/src/sys/dev/drm/i915_dma.c#9 integrate .. //depot/projects/usb/src/sys/dev/drm/i915_drv.h#6 integrate .. //depot/projects/usb/src/sys/dev/drm/i915_irq.c#6 integrate .. //depot/projects/usb/src/sys/dev/drm/mach64_drv.c#4 integrate .. //depot/projects/usb/src/sys/dev/drm/mach64_drv.h#3 integrate .. //depot/projects/usb/src/sys/dev/drm/mach64_irq.c#3 integrate .. //depot/projects/usb/src/sys/dev/drm/mga_dma.c#3 integrate .. //depot/projects/usb/src/sys/dev/drm/mga_irq.c#3 integrate .. //depot/projects/usb/src/sys/dev/drm/r128_drv.c#4 integrate .. //depot/projects/usb/src/sys/dev/drm/r128_drv.h#3 integrate .. //depot/projects/usb/src/sys/dev/drm/r128_irq.c#3 integrate .. //depot/projects/usb/src/sys/dev/drm/radeon_cp.c#5 integrate .. //depot/projects/usb/src/sys/dev/drm/radeon_irq.c#5 integrate .. //depot/projects/usb/src/sys/dev/sound/pci/hda/hdac.c#25 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_dev.c#3 integrate .. //depot/projects/usb/src/sys/dev/usb/usb_generic.c#3 integrate .. //depot/projects/usb/src/sys/dev/usb/wlan/if_rum.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/wlan/if_rumvar.h#3 integrate .. //depot/projects/usb/src/sys/dev/usb/wlan/if_ural.c#4 integrate .. //depot/projects/usb/src/sys/dev/usb/wlan/if_uralvar.h#3 integrate .. //depot/projects/usb/src/sys/dev/usb/wlan/if_zyd.c#4 integrate .. //depot/projects/usb/src/sys/dev/usb/wlan/if_zydreg.h#3 edit .. //depot/projects/usb/src/sys/fs/msdosfs/denode.h#6 integrate .. //depot/projects/usb/src/sys/fs/msdosfs/msdosfs_denode.c#8 integrate .. //depot/projects/usb/src/sys/fs/msdosfs/msdosfs_vfsops.c#10 integrate .. //depot/projects/usb/src/sys/fs/msdosfs/msdosfs_vnops.c#12 integrate .. //depot/projects/usb/src/sys/fs/msdosfs/msdosfsmount.h#3 integrate .. //depot/projects/usb/src/sys/netinet/sctp_crc32.c#8 integrate .. //depot/projects/usb/src/sys/netinet/sctp_input.c#16 integrate .. //depot/projects/usb/src/sys/netinet/sctp_output.c#16 integrate .. //depot/projects/usb/src/sys/netinet/sctp_output.h#10 integrate .. //depot/projects/usb/src/sys/netinet/sctp_usrreq.c#15 integrate .. //depot/projects/usb/src/sys/sys/cdefs.h#6 integrate .. //depot/projects/usb/src/sys/sys/param.h#22 integrate Differences ... ==== //depot/projects/usb/src/sys/arm/at91/files.at91#7 (text) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/arm/at91/files.at91,v 1.9 2008/11/25 19:05:46 imp Exp $ +# $FreeBSD: src/sys/arm/at91/files.at91,v 1.10 2009/02/27 23:12:28 imp Exp $ arm/arm/cpufunc_asm_arm9.S standard arm/arm/irq_dispatch.S standard arm/at91/at91_machdep.c standard @@ -15,10 +15,10 @@ arm/at91/at91_twi.c optional at91_twi arm/at91/at91_udp.c optional at91_udp arm/at91/if_ate.c optional ate -arm/at91/ohci_atmelarm.c optional ohci arm/at91/uart_bus_at91usart.c optional uart arm/at91/uart_cpu_at91rm9200usart.c optional uart arm/at91/uart_dev_at91usart.c optional uart +dev/usb/controller/ohci_atmelarm.c optional ohci # # All the boards we support # ==== //depot/projects/usb/src/sys/dev/ata/ata-usb.c#39 (text) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-usb.c,v 1.12 2009/02/23 21:19:18 thompsa Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-usb.c,v 1.13 2009/02/27 19:27:33 mav Exp $"); #include "usbdevs.h" #include @@ -322,6 +322,7 @@ struct usb2_interface_descriptor *id; const char *proto, *subclass; struct usb2_device_request request; + device_t child; uint16_t i; uint8_t maxlun; uint8_t has_intr; @@ -413,11 +414,11 @@ /* ata channels are children to this USB control device */ for (i = 0; i <= sc->maxlun; i++) { - if (!device_add_child(sc->dev, "ata", - devclass_find_free_unit(ata_devclass, 2))) { - device_printf(sc->dev, "failed to attach ata child device\n"); - goto detach; - } + if ((child = device_add_child(sc->dev, "ata", + devclass_find_free_unit(ata_devclass, 2))) == NULL) { + device_printf(sc->dev, "failed to add ata child device\n"); + } else + device_set_ivars(child, (void *)(intptr_t)i); } bus_generic_attach(sc->dev); @@ -957,23 +958,10 @@ static int ata_usbchannel_probe(device_t dev) { - struct ata_channel *ch = device_get_softc(dev); - device_t *children; - int count, i; char buffer[32]; - /* take care of green memory */ - bzero(ch, sizeof(struct ata_channel)); - - /* find channel number on this controller */ - if (!device_get_children(device_get_parent(dev), &children, &count)) { - for (i = 0; i < count; i++) { - if (children[i] == dev) - ch->unit = i; - } - free(children, M_TEMP); - } - snprintf(buffer, sizeof(buffer), "USB lun %d", ch->unit); + snprintf(buffer, sizeof(buffer), "USB lun %d", + (int)(intptr_t)device_get_ivars(dev)); device_set_desc_copy(dev, buffer); return (0); @@ -984,8 +972,13 @@ { struct ata_channel *ch = device_get_softc(dev); + if (ch->attached) + return (0); + ch->attached = 1; + /* initialize the softc basics */ ch->dev = dev; + ch->unit = (intptr_t)device_get_ivars(dev); ch->state = ATA_IDLE; ch->hw.begin_transaction = ata_usbchannel_begin_transaction; ch->hw.end_transaction = ata_usbchannel_end_transaction; @@ -1015,6 +1008,10 @@ device_t *children; int nchildren, i; + if (!ch->attached) + return (0); + ch->attached = 0; + /* detach & delete all children */ if (!device_get_children(dev, &children, &nchildren)) { for (i = 0; i < nchildren; i++) ==== //depot/projects/usb/src/sys/dev/bce/if_bce.c#16 (text) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2008 Broadcom Corporation + * Copyright (c) 2006-2009 Broadcom Corporation * David Christensen . All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.50 2009/01/15 22:28:05 delphij Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.51 2009/02/27 19:25:06 davidch Exp $"); /* * The following controllers are supported by this driver: @@ -89,7 +89,6 @@ /****************************************************************************/ /* BCE Build Time Options */ /****************************************************************************/ -#define BCE_USE_SPLIT_HEADER 1 /* #define BCE_NVRAM_WRITE_SUPPORT 1 */ @@ -294,12 +293,12 @@ 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); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS 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 *); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS 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 *); @@ -307,7 +306,7 @@ 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); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS static void bce_dump_pg_chain (struct bce_softc *, u16, int); #endif static void bce_dump_status_block (struct bce_softc *); @@ -392,7 +391,7 @@ static void bce_fill_rx_chain (struct bce_softc *); static void bce_free_rx_chain (struct bce_softc *); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS static int bce_get_pg_buf (struct bce_softc *, struct mbuf *, u16 *, u16 *); static int bce_init_pg_chain (struct bce_softc *); static void bce_fill_pg_chain (struct bce_softc *); @@ -597,7 +596,7 @@ /* Firmware version and device features. */ printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS printf("SPLT "); #endif if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) @@ -1013,7 +1012,7 @@ * This may change later if the MTU size is set to * something other than 1500. */ -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS 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) - @@ -2753,7 +2752,7 @@ } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /* Free, unmap and destroy all page buffer descriptor chain pages. */ for (i = 0; i < PG_PAGES; i++ ) { if (sc->pg_bd_chain[i] != NULL) { @@ -2817,7 +2816,7 @@ sc->rx_mbuf_tag = NULL; } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /* Unload and destroy the page mbuf maps. */ for (i = 0; i < TOTAL_PG_BD; i++) { if (sc->pg_mbuf_map[i] != NULL) { @@ -3267,7 +3266,7 @@ /* * Create a DMA tag for RX mbufs. */ -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS max_size = max_seg_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ? MCLBYTES : sc->rx_bd_mbuf_alloc_size); #else @@ -3303,7 +3302,7 @@ } } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /* * Create a DMA tag for the page buffer descriptor chain, * allocate and clear the memory, and fetch the physical @@ -4384,7 +4383,7 @@ bce_disable_intr(sc); /* Free RX buffers. */ -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS bce_free_pg_chain(sc); #endif bce_free_rx_chain(sc); @@ -4822,7 +4821,7 @@ goto bce_get_rx_buf_exit); /* This is a new mbuf allocation. */ -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS MGETHDR(m_new, M_DONTWAIT, MT_DATA); #else if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES) @@ -4901,7 +4900,7 @@ } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /****************************************************************************/ /* Encapsulate an mbuf cluster into the page chain. */ /* */ @@ -5010,7 +5009,7 @@ return(rc); } -#endif /* BCE_USE_SPLIT_HEADER */ +#endif /* ZERO_COPY_SOCKETS */ /****************************************************************************/ /* Initialize the TX context memory. */ @@ -5368,7 +5367,7 @@ } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /****************************************************************************/ /* Allocate memory and initialize the page data structures. */ /* Assumes that bce_init_rx_chain() has not already been called. */ @@ -5534,7 +5533,7 @@ DBEXIT(BCE_VERBOSE_RESET | BCE_VERBOSE_RECV | BCE_VERBOSE_UNLOAD); } -#endif /* BCE_USE_SPLIT_HEADER */ +#endif /* ZERO_COPY_SOCKETS */ /****************************************************************************/ @@ -5707,7 +5706,7 @@ unsigned int pkt_len; u16 sw_rx_cons, sw_rx_cons_idx, hw_rx_cons; u32 status; -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS unsigned int rem_len; u16 sw_pg_cons, sw_pg_cons_idx; #endif @@ -5723,7 +5722,7 @@ bus_dmamap_sync(sc->rx_bd_chain_tag, sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTWRITE); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /* 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, @@ -5735,7 +5734,7 @@ /* Get working copies of the driver's view of the consumer indices. */ sw_rx_cons = sc->rx_cons; -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS sw_pg_cons = sc->pg_cons; #endif @@ -5797,7 +5796,7 @@ */ m_adj(m0, sizeof(struct l2_fhdr) + ETHER_ALIGN); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /* * Check whether the received frame fits in a single * mbuf or not (i.e. packet data + FCS <= @@ -5970,7 +5969,7 @@ if (m0) { /* Make sure we don't lose our place when we release the lock. */ sc->rx_cons = sw_rx_cons; -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS sc->pg_cons = sw_pg_cons; #endif @@ -5980,7 +5979,7 @@ /* Recover our place. */ sw_rx_cons = sc->rx_cons; -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS sw_pg_cons = sc->pg_cons; #endif } @@ -5991,7 +5990,7 @@ } /* No new packets to process. Refill the RX and page chains and exit. */ -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS sc->pg_cons = sw_pg_cons; bce_fill_pg_chain(sc); #endif @@ -6003,7 +6002,7 @@ bus_dmamap_sync(sc->rx_bd_chain_tag, sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS 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); @@ -6249,7 +6248,7 @@ * Calculate and program the hardware Ethernet MTU * size. Be generous on the receive if we have room. */ -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS 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 @@ -6281,7 +6280,7 @@ /* Program appropriate promiscuous/multicast filtering. */ bce_set_rx_mode(sc); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /* Init page buffer descriptor chain. */ bce_init_pg_chain(sc); #endif @@ -6794,7 +6793,7 @@ BCE_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; ifp->if_drv_flags &= ~IFF_DRV_RUNNING; -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /* No buffer allocation size changes are necessary. */ #else /* Recalculate our buffer allocation sizes. */ @@ -7495,7 +7494,7 @@ bce_stats_update(sc); /* Top off the receive and page chains. */ -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS bce_fill_pg_chain(sc); #endif bce_fill_rx_chain(sc); @@ -7675,7 +7674,7 @@ } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /****************************************************************************/ /* Provides a sysctl interface to allow dumping the page chain. */ /* */ @@ -8248,7 +8247,7 @@ (void *)sc, 0, bce_sysctl_dump_tx_chain, "I", "Dump tx_bd chain"); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "dump_pg_chain", CTLTYPE_INT | CTLFLAG_RW, (void *)sc, 0, @@ -8543,7 +8542,7 @@ } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /****************************************************************************/ /* Prints out the mbufs in the mbuf page chain. */ /* */ @@ -8667,7 +8666,7 @@ } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /****************************************************************************/ /* Prints out a rx_bd structure in the page chain. */ /* */ @@ -9154,7 +9153,7 @@ } -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS /****************************************************************************/ /* Prints out the page chain. */ /* */ @@ -9635,7 +9634,7 @@ "0x%08X:%08X - (sc->rx_bd_chain) rx_bd chain virtual address\n", val_hi, val_lo); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS val_hi = BCE_ADDR_HI(sc->pg_bd_chain); val_lo = BCE_ADDR_LO(sc->pg_bd_chain); BCE_PRINTF( @@ -9655,7 +9654,7 @@ "0x%08X:%08X - (sc->rx_mbuf_ptr) rx mbuf chain virtual address\n", val_hi, val_lo); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS val_hi = BCE_ADDR_HI(sc->pg_mbuf_ptr); val_lo = BCE_ADDR_LO(sc->pg_mbuf_ptr); BCE_PRINTF( @@ -9708,7 +9707,7 @@ BCE_PRINTF(" 0x%08X - (sc->free_rx_bd) free rx_bd's\n", sc->free_rx_bd); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS BCE_PRINTF(" 0x%04X(0x%04X) - (sc->pg_prod) page producer index\n", sc->pg_prod, (u16) PG_CHAIN_IDX(sc->pg_prod)); @@ -10218,7 +10217,7 @@ bce_dump_tpat_state(sc, 0); bce_dump_cp_state(sc, 0); bce_dump_com_state(sc, 0); -#ifdef BCE_USE_SPLIT_HEADER +#ifdef ZERO_COPY_SOCKETS 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); ==== //depot/projects/usb/src/sys/dev/bce/if_bcefw.h#6 (text) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2008 Broadcom Corporation + * Copyright (c) 2006-2009 Broadcom Corporation * David Christensen . All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -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_bcefw.h,v 1.7 2008/06/13 01:16:37 davidch Exp $ + * $FreeBSD: src/sys/dev/bce/if_bcefw.h,v 1.8 2009/02/27 19:25:06 davidch Exp $ */ /* ==== //depot/projects/usb/src/sys/dev/bce/if_bcereg.h#10 (text) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2008 Broadcom Corporation + * Copyright (c) 2006-2009 Broadcom Corporation * David Christensen . All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -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.22 2008/11/22 05:55:56 kmacy Exp $ + * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.23 2009/02/27 19:25:06 davidch Exp $ */ #ifndef _BCE_H_DEFINED @@ -6206,6 +6206,7 @@ #define RX_PAGE(x) (((x) & ~USABLE_RX_BD_PER_PAGE) >> (BCM_PAGE_BITS - 4)) #define RX_IDX(x) ((x) & USABLE_RX_BD_PER_PAGE) +#ifdef ZERO_COPY_SOCKETS /* * To accomodate jumbo frames, the page chain should * be 4 times larger than the receive chain. @@ -6226,6 +6227,8 @@ #define PG_PAGE(x) (((x) & ~USABLE_PG_BD_PER_PAGE) >> (BCM_PAGE_BITS - 4)) #define PG_IDX(x) ((x) & USABLE_PG_BD_PER_PAGE) +#endif /* ZERO_COPY_SOCKETS */ + /* Context size. */ #define CTX_SHIFT 7 #define CTX_SIZE (1 << CTX_SHIFT) @@ -6499,8 +6502,11 @@ u16 tx_prod; u16 tx_cons; u32 tx_prod_bseq; /* Counts the bytes used. */ + +#ifdef ZERO_COPY_SOCKETS u16 pg_prod; u16 pg_cons; +#endif int bce_link; struct callout bce_tick_callout; @@ -6513,7 +6519,10 @@ int rx_bd_mbuf_alloc_size; int rx_bd_mbuf_data_len; int rx_bd_mbuf_align_pad; + +#ifdef ZERO_COPY_SOCKETS int pg_bd_mbuf_alloc_size; +#endif /* Receive mode settings (i.e promiscuous, multicast, etc.). */ u32 rx_mode; @@ -6533,11 +6542,13 @@ struct rx_bd *rx_bd_chain[RX_PAGES]; bus_addr_t rx_bd_chain_paddr[RX_PAGES]; +#ifdef ZERO_COPY_SOCKETS /* H/W maintained page buffer descriptor chain structure. */ bus_dma_tag_t pg_bd_chain_tag; bus_dmamap_t pg_bd_chain_map[PG_PAGES]; struct rx_bd *pg_bd_chain[PG_PAGES]; bus_addr_t pg_bd_chain_paddr[PG_PAGES]; +#endif /* H/W maintained status block. */ bus_dma_tag_t status_tag; @@ -6567,7 +6578,10 @@ /* Bus tag for RX/TX mbufs. */ bus_dma_tag_t rx_mbuf_tag; bus_dma_tag_t tx_mbuf_tag; + +#ifdef ZERO_COPY_SOCKETS bus_dma_tag_t pg_mbuf_tag; +#endif /* S/W maintained mbuf TX chain structure. */ bus_dmamap_t tx_mbuf_map[TOTAL_TX_BD]; @@ -6577,17 +6591,22 @@ bus_dmamap_t rx_mbuf_map[TOTAL_RX_BD]; struct mbuf *rx_mbuf_ptr[TOTAL_RX_BD]; +#ifdef ZERO_COPY_SOCKETS /* S/W maintained mbuf page chain structure. */ bus_dmamap_t pg_mbuf_map[TOTAL_PG_BD]; struct mbuf *pg_mbuf_ptr[TOTAL_PG_BD]; +#endif /* Track the number of buffer descriptors in use. */ u16 free_rx_bd; u16 max_rx_bd; u16 used_tx_bd; u16 max_tx_bd; + +#ifdef ZERO_COPY_SOCKETS u16 free_pg_bd; u16 max_pg_bd; +#endif /* Provides access to hardware statistics through sysctl. */ u64 stat_IfHCInOctets; @@ -6661,7 +6680,10 @@ /* Track the number of enqueued mbufs. */ int debug_tx_mbuf_alloc; int debug_rx_mbuf_alloc; + +#ifdef ZERO_COPY_SOCKETS int debug_pg_mbuf_alloc; +#endif /* Track how many and what type of interrupts are generated. */ u32 interrupts_generated; @@ -6676,8 +6698,10 @@ u32 rx_low_watermark; /* Lowest number of rx_bd's free. */ u32 rx_empty_count; /* Number of times the RX chain was empty. */ +#ifdef ZERO_COPY_SOCKETS u32 pg_low_watermark; /* Lowest number of pages free. */ u32 pg_empty_count; /* Number of times the page chain was empty. */ +#endif u32 tx_hi_watermark; /* Greatest number of tx_bd's used. */ u32 tx_full_count; /* Number of times the TX chain was full. */ @@ -6693,5 +6717,5 @@ #endif }; -#endif /* #ifndef _BCE_H_DEFINED */ +#endif /* __BCEREG_H_DEFINED */ ==== //depot/projects/usb/src/sys/dev/drm/drmP.h#9 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/drmP.h,v 1.31 2009/02/27 06:01:42 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/drmP.h,v 1.32 2009/02/28 02:37:55 rnoland Exp $"); #ifndef _DRM_P_H_ #define _DRM_P_H_ @@ -794,6 +794,7 @@ u32 drm_vblank_count(struct drm_device *dev, int crtc); int drm_vblank_get(struct drm_device *dev, int crtc); void drm_vblank_put(struct drm_device *dev, int crtc); +void drm_vblank_cleanup(struct drm_device *dev); int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); int drm_vblank_init(struct drm_device *dev, int num_crtcs); void drm_vbl_send_signals(struct drm_device *dev, int crtc); ==== //depot/projects/usb/src/sys/dev/drm/drm_drv.c#8 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/drm_drv.c,v 1.20 2009/02/27 06:01:42 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/drm_drv.c,v 1.22 2009/02/28 02:37:55 rnoland Exp $"); /** @file drm_drv.c * The catch-all file for DRM device support, including module setup/teardown, @@ -134,6 +134,9 @@ .d_flags = D_TRACKCLOSE }; +int drm_msi = 1; /* Enable by default. */ +TUNABLE_INT("hw.drm.msi", &drm_msi); + static struct drm_msi_blacklist_entry drm_msi_blacklist[] = { {0x8086, 0x2772}, /* Intel i945G */ \ {0x8086, 0x27A2}, /* Intel i945GM */ \ @@ -222,7 +225,8 @@ dev->pci_vendor = pci_get_vendor(dev->device); dev->pci_device = pci_get_device(dev->device); - if (!drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) { + if (drm_msi && + !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) { msicount = pci_msi_count(dev->device); DRM_DEBUG("MSI count = %d\n", msicount); if (msicount > 1) @@ -519,6 +523,8 @@ DRM_DEBUG("mtrr_del = %d", retcode); } + drm_vblank_cleanup(dev); + DRM_LOCK(); drm_lastclose(dev); DRM_UNLOCK(); ==== //depot/projects/usb/src/sys/dev/drm/drm_irq.c#6 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/drm_irq.c,v 1.9 2009/02/25 18:54:35 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/drm_irq.c,v 1.10 2009/02/28 02:37:55 rnoland Exp $"); /** @file drm_irq.c * Support code for handling setup/teardown of interrupt handlers and @@ -96,7 +96,7 @@ } } -static void drm_vblank_cleanup(struct drm_device *dev) +void drm_vblank_cleanup(struct drm_device *dev) { unsigned long irqflags; @@ -213,8 +213,6 @@ bus_teardown_intr(dev->device, dev->irqr, dev->irqh); DRM_LOCK(); - drm_vblank_cleanup(dev); - return 0; } ==== //depot/projects/usb/src/sys/dev/drm/i915_dma.c#9 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/i915_dma.c,v 1.15 2009/02/25 20:24:13 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/i915_dma.c,v 1.16 2009/02/28 02:37:55 rnoland Exp $"); #include "dev/drm/drmP.h" #include "dev/drm/drm.h" @@ -902,6 +902,13 @@ #endif DRM_SPININIT(&dev_priv->user_irq_lock, "userirq"); + ret = drm_vblank_init(dev, I915_NUM_PIPE); + + if (ret) { + (void) i915_driver_unload(dev); + return ret; + } + return ret; } ==== //depot/projects/usb/src/sys/dev/drm/i915_drv.h#6 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/i915_drv.h,v 1.9 2009/02/25 20:24:13 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/i915_drv.h,v 1.10 2009/02/28 02:37:55 rnoland Exp $"); #ifndef _I915_DRV_H_ #define _I915_DRV_H_ @@ -49,6 +49,8 @@ PIPE_B, }; +#define I915_NUM_PIPE 2 + /* Interface history: * * 1.1: Original. ==== //depot/projects/usb/src/sys/dev/drm/i915_irq.c#6 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/i915_irq.c,v 1.10 2009/02/25 20:24:13 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/i915_irq.c,v 1.11 2009/02/28 02:37:55 rnoland Exp $"); #include "dev/drm/drmP.h" #include "dev/drm/drm.h" @@ -484,11 +484,6 @@ int i915_driver_irq_postinstall(struct drm_device *dev) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; - int ret, num_pipes = 2; - - ret = drm_vblank_init(dev, num_pipes); - if (ret) - return ret; dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B; ==== //depot/projects/usb/src/sys/dev/drm/mach64_drv.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/mach64_drv.c,v 1.8 2008/10/13 18:03:27 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/mach64_drv.c,v 1.9 2009/02/28 02:37:55 rnoland Exp $"); #include @@ -54,6 +54,7 @@ DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ; dev->driver->buf_priv_size = 1; /* No dev_priv */ + dev->driver->load = mach64_driver_load; dev->driver->lastclose = mach64_driver_lastclose; dev->driver->get_vblank_counter = mach64_get_vblank_counter; dev->driver->enable_vblank = mach64_enable_vblank; @@ -94,6 +95,12 @@ return drm_attach(nbdev, mach64_pciidlist); } +int +mach64_driver_load(struct drm_device * dev, unsigned long flags) +{ + return drm_vblank_init(dev, 1); +} + static int mach64_detach(device_t nbdev) { ==== //depot/projects/usb/src/sys/dev/drm/mach64_drv.h#3 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/mach64_drv.h,v 1.3 2008/08/23 20:59:12 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/mach64_drv.h,v 1.4 2009/02/28 02:37:55 rnoland Exp $"); #ifndef __MACH64_DRV_H__ #define __MACH64_DRV_H__ @@ -166,6 +166,7 @@ extern int mach64_get_param(struct drm_device *dev, void *data, struct drm_file *file_priv); +extern int mach64_driver_load(struct drm_device * dev, unsigned long flags); extern u32 mach64_get_vblank_counter(struct drm_device *dev, int crtc); extern int mach64_enable_vblank(struct drm_device *dev, int crtc); extern void mach64_disable_vblank(struct drm_device *dev, int crtc); ==== //depot/projects/usb/src/sys/dev/drm/mach64_irq.c#3 (text+ko) ==== @@ -36,7 +36,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/mach64_irq.c,v 1.3 2008/08/23 20:59:12 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/mach64_irq.c,v 1.4 2009/02/28 02:37:55 rnoland Exp $"); #include "dev/drm/drmP.h" #include "dev/drm/drm.h" @@ -146,7 +146,7 @@ int mach64_driver_irq_postinstall(struct drm_device * dev) { - return drm_vblank_init(dev, 1); + return 0; } void mach64_driver_irq_uninstall(struct drm_device * dev) ==== //depot/projects/usb/src/sys/dev/drm/mga_dma.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/mga_dma.c,v 1.14 2008/08/23 20:59:12 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/mga_dma.c,v 1.15 2009/02/28 02:37:55 rnoland Exp $"); /** * \file mga_dma.c @@ -399,6 +399,7 @@ int mga_driver_load(struct drm_device *dev, unsigned long flags) { drm_mga_private_t *dev_priv; + int ret; dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); if (!dev_priv) @@ -418,6 +419,13 @@ dev->types[7] = _DRM_STAT_PRIMARY; dev->types[8] = _DRM_STAT_SECONDARY; + ret = drm_vblank_init(dev, 1); + + if (ret) { + (void) mga_driver_unload(dev); + return ret; + } + return 0; } ==== //depot/projects/usb/src/sys/dev/drm/mga_irq.c#3 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/mga_irq.c,v 1.7 2008/08/23 20:59:12 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/mga_irq.c,v 1.8 2009/02/28 02:37:55 rnoland Exp $"); #include "dev/drm/drmP.h" #include "dev/drm/drm.h" @@ -157,11 +157,6 @@ int mga_driver_irq_postinstall(struct drm_device * dev) { drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; - int ret; - - ret = drm_vblank_init(dev, 1); - if (ret) - return ret; DRM_INIT_WAITQUEUE(&dev_priv->fence_queue); ==== //depot/projects/usb/src/sys/dev/drm/r128_drv.c#4 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/drm/r128_drv.c,v 1.16 2008/10/13 18:03:27 rnoland Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/drm/r128_drv.c,v 1.17 2009/02/28 02:37:55 rnoland Exp $"); #include "dev/drm/drmP.h" #include "dev/drm/drm.h" @@ -52,6 +52,7 @@ DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ; dev->driver->buf_priv_size = sizeof(drm_r128_buf_priv_t); + dev->driver->load = r128_driver_load; dev->driver->preclose = r128_driver_preclose; dev->driver->lastclose = r128_driver_lastclose; dev->driver->get_vblank_counter = r128_get_vblank_counter; @@ -93,6 +94,11 @@ return drm_attach(nbdev, r128_pciidlist); } +int r128_driver_load(struct drm_device * dev, unsigned long flags) +{ + return drm_vblank_init(dev, 1); +} + static int r128_detach(device_t nbdev) { ==== //depot/projects/usb/src/sys/dev/drm/r128_drv.h#3 (text+ko) ==== >>> TRUNCATED FOR MAIL (1000 lines) <<<