From owner-svn-src-user@FreeBSD.ORG Sun Sep 5 03:05:03 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 927D71065679; Sun, 5 Sep 2010 03:05:03 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81BA28FC13; Sun, 5 Sep 2010 03:05:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o85353Mc050739; Sun, 5 Sep 2010 03:05:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o853530u050736; Sun, 5 Sep 2010 03:05:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009050305.o853530u050736@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 5 Sep 2010 03:05:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212220 - user/nwhitehorn/ps3/powerpc/aim X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 03:05:03 -0000 Author: nwhitehorn Date: Sun Sep 5 03:05:03 2010 New Revision: 212220 URL: http://svn.freebsd.org/changeset/base/212220 Log: Make the SLB UMA hypervisor allocator correctly free contig pages. Using vm_page_free() on pages allocated with vm_phys_alloc_contig() causes errors due to inconsistent wired-state tracking. Thanks to Colin Percival for helping me debug this. Modified: user/nwhitehorn/ps3/powerpc/aim/slb.c user/nwhitehorn/ps3/powerpc/aim/uma_machdep.c Modified: user/nwhitehorn/ps3/powerpc/aim/slb.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/slb.c Sun Sep 5 01:58:21 2010 (r212219) +++ user/nwhitehorn/ps3/powerpc/aim/slb.c Sun Sep 5 03:05:03 2010 (r212220) @@ -37,7 +37,11 @@ #include #include #include +#include #include +#include +#include +#include #include #include @@ -46,8 +50,6 @@ uintptr_t moea64_get_unique_vsid(void); void moea64_release_vsid(uint64_t vsid); -void *uma_small_alloc_core(uma_zone_t zone, int bytes, u_int8_t *flags, - int wait, vm_offset_t minphys, vm_offset_t maxphys); struct slbcontainer { struct slb slb; @@ -280,13 +282,57 @@ static void * slb_uma_cache_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { static vm_offset_t realmax = 0; + void *va; + vm_page_t m; + int pflags; if (realmax == 0) realmax = platform_real_maxaddr(); - return (uma_small_alloc_core(zone, bytes, flags, wait, 0, realmax)); + *flags = UMA_SLAB_PRIV; + if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT) + pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED; + else + pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED; + if (wait & M_ZERO) + pflags |= VM_ALLOC_ZERO; + + for (;;) { + m = vm_phys_alloc_contig(1, 0, realmax, PAGE_SIZE, + PAGE_SIZE); + if (m == NULL) { + if (wait & M_NOWAIT) + return (NULL); + VM_WAIT; + } else + break; + } + + va = (void *) VM_PAGE_TO_PHYS(m); + + if (!hw_direct_map) + pmap_kenter((vm_offset_t)va, VM_PAGE_TO_PHYS(m)); + + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) + bzero(va, PAGE_SIZE); + + return (va); } +static void +slb_uma_cache_free(void *mem, int size, u_int8_t flags) +{ + vm_page_t m; + + if (!hw_direct_map) + pmap_remove(kernel_pmap,(vm_offset_t)mem, + (vm_offset_t)mem + PAGE_SIZE); + + m = PHYS_TO_VM_PAGE((vm_offset_t)mem); + vm_page_lock_queues(); + vm_phys_free_pages(m, 0); + vm_page_unlock_queues(); +} static void slb_zone_init(void *dummy) @@ -297,8 +343,10 @@ slb_zone_init(void *dummy) slb_cache_zone = uma_zcreate("SLB cache", 64*sizeof(struct slb), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); - if (platform_real_maxaddr() != VM_MAX_ADDRESS) + if (platform_real_maxaddr() != VM_MAX_ADDRESS) { uma_zone_set_allocf(slb_cache_zone, slb_uma_cache_alloc); + uma_zone_set_freef(slb_cache_zone, slb_uma_cache_free); + } } struct slb * Modified: user/nwhitehorn/ps3/powerpc/aim/uma_machdep.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/uma_machdep.c Sun Sep 5 01:58:21 2010 (r212219) +++ user/nwhitehorn/ps3/powerpc/aim/uma_machdep.c Sun Sep 5 03:05:03 2010 (r212220) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -49,20 +48,9 @@ static int hw_uma_mdpages; SYSCTL_INT(_hw, OID_AUTO, uma_mdpages, CTLFLAG_RD, &hw_uma_mdpages, 0, "UMA MD pages in use"); -void *uma_small_alloc_core(uma_zone_t zone, int bytes, u_int8_t *flags, - int wait, vm_offset_t minphys, vm_offset_t maxphys); - void * uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { - return (uma_small_alloc_core(zone, bytes, flags, wait, - 0, VM_MAX_ADDRESS)); -} - -void * -uma_small_alloc_core(uma_zone_t zone, int bytes, u_int8_t *flags, int wait, - vm_offset_t minphys, vm_offset_t maxphys) -{ static vm_pindex_t color; void *va; vm_page_t m; @@ -77,12 +65,7 @@ uma_small_alloc_core(uma_zone_t zone, in pflags |= VM_ALLOC_ZERO; for (;;) { - if (minphys == 0 && maxphys == VM_MAX_ADDRESS) - m = vm_page_alloc(NULL, color++, - pflags | VM_ALLOC_NOOBJ); - else - m = vm_phys_alloc_contig(1, minphys, maxphys, PAGE_SIZE, - PAGE_SIZE); + m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); if (m == NULL) { if (wait & M_NOWAIT) return (NULL); From owner-svn-src-user@FreeBSD.ORG Sun Sep 5 18:56:24 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9461410656A5; Sun, 5 Sep 2010 18:56:24 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 834888FC12; Sun, 5 Sep 2010 18:56:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o85IuOnM095369; Sun, 5 Sep 2010 18:56:24 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85IuOr8095366; Sun, 5 Sep 2010 18:56:24 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009051856.o85IuOr8095366@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 5 Sep 2010 18:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212237 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 18:56:24 -0000 Author: nwhitehorn Date: Sun Sep 5 18:56:24 2010 New Revision: 212237 URL: http://svn.freebsd.org/changeset/base/212237 Log: Improve performance by only restarting TX DMA when it is really necessary. This brings up TX performance to 100 Mbit. There is still an issue where outbound traffic will hang the controller under very heavy TX load. I haven't debugged that one yet. Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Sun Sep 5 18:47:04 2010 (r212236) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Sun Sep 5 18:56:24 2010 (r212237) @@ -68,6 +68,7 @@ static int glc_add_rxbuf(struct glc_soft static int glc_add_rxbuf_dma(struct glc_softc *sc, int idx); static int glc_encap(struct glc_softc *sc, struct mbuf **m_head, bus_addr_t *pktdesc); +static int glc_intr_filter(void *xsc); static void glc_intr(void *xsc); static MALLOC_DEFINE(M_GLC, "gelic", "PS3 GELIC ethernet"); @@ -193,15 +194,15 @@ glc_attach(device_t dev) } bus_setup_intr(dev, sc->sc_irq, - INTR_TYPE_MISC | INTR_MPSAFE | INTR_ENTROPY, NULL, glc_intr, - sc, &sc->sc_irqctx); - sc->sc_interrupt_status = (uint64_t *)contigmalloc(8, M_GLC, M_ZERO, 0, + INTR_TYPE_MISC | INTR_MPSAFE | INTR_ENTROPY, + glc_intr_filter, glc_intr, sc, &sc->sc_irqctx); + sc->sc_hwirq_status = (uint64_t *)contigmalloc(8, M_GLC, M_ZERO, 0, BUS_SPACE_MAXADDR_32BIT, 8, PAGE_SIZE); lv1_net_set_interrupt_status_indicator(sc->sc_bus, sc->sc_dev, - vtophys(sc->sc_interrupt_status), 0); + vtophys(sc->sc_hwirq_status), 0); lv1_net_set_interrupt_mask(sc->sc_bus, sc->sc_dev, GELIC_INT_RXDONE | GELIC_INT_TXDONE | GELIC_INT_RXFRAME | - GELIC_INT_PHY, 0); + GELIC_INT_PHY | GELIC_INT_TX_CHAIN_END, 0); /* * Set up DMA. @@ -398,12 +399,9 @@ glc_start_locked(struct ifnet *ifp) bus_dmamap_sync(sc->sc_dmadesc_tag, sc->sc_txdmadesc_map, BUS_DMASYNC_PREREAD); - /* XXX: kickstart always until problems are sorted out */ - kickstart = 1; - if (kickstart && first != 0) { - lv1_net_stop_tx_dma(sc->sc_bus, sc->sc_dev, 0); lv1_net_start_tx_dma(sc->sc_bus, sc->sc_dev, first, 0); + sc->sc_wdog_timer = 5; } } @@ -577,9 +575,6 @@ glc_encap(struct glc_softc *sc, struct m txs->txs_firstdesc*sizeof(struct glc_dmadesc)); for (i = 0; i < nsegs; i++) { - if (i+1 == nsegs) - txs->txs_lastdesc = sc->next_txdma_slot; - bzero(&sc->sc_txdmadesc[idx], sizeof(sc->sc_txdmadesc[idx])); sc->sc_txdmadesc[idx].paddr = glc_map_addr(sc, segs[i].ds_addr); sc->sc_txdmadesc[idx].len = segs[i].ds_len; @@ -589,7 +584,7 @@ glc_encap(struct glc_softc *sc, struct m sc->sc_txdmadesc[idx].cmd_stat |= GELIC_CMDSTAT_NOIPSEC; if (i+1 == nsegs) { - txs->txs_lastdesc = sc->next_txdma_slot; + txs->txs_lastdesc = idx; sc->sc_txdmadesc[idx].next = 0; sc->sc_txdmadesc[idx].cmd_stat |= GELIC_CMDSTAT_LAST; } @@ -659,7 +654,7 @@ glc_rxintr(struct glc_softc *sc) mtx_lock(&sc->sc_mtx); requeue: - if (sc->sc_rxdmadesc[i].cmd_stat & GELIC_CMDSTAT_RX_END) + if (sc->sc_rxdmadesc[i].cmd_stat & GELIC_CMDSTAT_CHAIN_END) restart_rxdma = 1; glc_add_rxbuf_dma(sc, i); if (restart_rxdma) @@ -673,7 +668,7 @@ glc_txintr(struct glc_softc *sc) { struct ifnet *ifp = sc->sc_ifp; struct glc_txsoft *txs; - int progress = 0; + int progress = 0, kickstart = 0; while ((txs = STAILQ_FIRST(&sc->sc_txdirtyq)) != NULL) { if (sc->sc_txdmadesc[txs->txs_lastdesc].cmd_stat @@ -688,8 +683,18 @@ glc_txintr(struct glc_softc *sc) txs->txs_mbuf = NULL; } - STAILQ_INSERT_TAIL(&sc->sc_txfreeq, txs, txs_q); + if ((sc->sc_txdmadesc[txs->txs_lastdesc].cmd_stat & 0xf0000000) + != 0) { + lv1_net_stop_tx_dma(sc->sc_bus, sc->sc_dev, 0); + kickstart = 1; + ifp->if_oerrors++; + } + + if (sc->sc_txdmadesc[txs->txs_lastdesc].cmd_stat & + GELIC_CMDSTAT_CHAIN_END) + kickstart = 1; + STAILQ_INSERT_TAIL(&sc->sc_txfreeq, txs, txs_q); ifp->if_opackets++; progress = 1; } @@ -699,15 +704,19 @@ glc_txintr(struct glc_softc *sc) else sc->first_used_txdma_slot = -1; + if (kickstart && txs != NULL) { + lv1_net_start_tx_dma(sc->sc_bus, sc->sc_dev, + glc_map_addr(sc, sc->sc_txdmadesc_phys + + txs->txs_firstdesc*sizeof(struct glc_dmadesc)), 0); + } + if (progress) { /* * We freed some descriptors, so reset IFF_DRV_OACTIVE * and restart. */ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; -#if 0 sc->sc_wdog_timer = STAILQ_EMPTY(&sc->sc_txdirtyq) ? 0 : 5; -#endif if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -715,25 +724,37 @@ glc_txintr(struct glc_softc *sc) } } +static int +glc_intr_filter(void *xsc) +{ + struct glc_softc *sc = xsc; + + powerpc_sync(); + atomic_set_64(&sc->sc_interrupt_status, *sc->sc_hwirq_status); + return (FILTER_SCHEDULE_THREAD); +} + static void glc_intr(void *xsc) { struct glc_softc *sc = xsc; + uint64_t status; mtx_lock(&sc->sc_mtx); - powerpc_sync(); - if (*sc->sc_interrupt_status == 0) { - device_printf(sc->sc_self, "stray interrupt!\n"); + status = atomic_readandclear_64(&sc->sc_interrupt_status); + + if (status == 0) { mtx_unlock(&sc->sc_mtx); return; } - if (*sc->sc_interrupt_status & (GELIC_INT_RXDONE | GELIC_INT_RXFRAME)) + if (status & (GELIC_INT_RXDONE | GELIC_INT_RXFRAME)) glc_rxintr(sc); - if (*sc->sc_interrupt_status & GELIC_INT_TXDONE) + if (status & (GELIC_INT_TXDONE | GELIC_INT_TX_CHAIN_END)) glc_txintr(sc); mtx_unlock(&sc->sc_mtx); } + Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Sun Sep 5 18:47:04 2010 (r212236) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Sun Sep 5 18:56:24 2010 (r212237) @@ -76,7 +76,8 @@ struct glc_softc { int sc_irqid; struct resource *sc_irq; void *sc_irqctx; - uint64_t *sc_interrupt_status; + uint64_t *sc_hwirq_status; + volatile uint64_t sc_interrupt_status; /* Transmission */ @@ -100,6 +101,7 @@ struct glc_softc { bus_addr_t sc_rxdmadesc_phys; int sc_bus, sc_dev; + int sc_wdog_timer; }; #define GELIC_GET_MAC_ADDRESS 0x0001 @@ -119,7 +121,7 @@ struct glc_softc { /* Command status code */ #define GELIC_DESCR_OWNED 0xa0000000 #define GELIC_CMDSTAT_DMA_DONE 0x00000000 -#define GELIC_CMDSTAT_RX_END 0x00000002 +#define GELIC_CMDSTAT_CHAIN_END 0x00000002 #define GELIC_CMDSTAT_NOIPSEC 0x00080000 #define GELIC_CMDSTAT_LAST 0x00040000 #define GELIC_RXERRORS 0x7def8000 @@ -128,6 +130,7 @@ struct glc_softc { #define GELIC_INT_RXDONE 0x0000000000004000UL #define GELIC_INT_RXFRAME 0x1000000000000000UL #define GELIC_INT_TXDONE 0x0080000000000000UL +#define GELIC_INT_TX_CHAIN_END 0x0100000000000000UL #define GELIC_INT_PHY 0x0000000020000000UL /* Hardware DMA descriptor. Must be 32-byte aligned */ From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 04:15:00 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F413410656C3; Mon, 6 Sep 2010 04:14:59 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E27768FC12; Mon, 6 Sep 2010 04:14:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o864ExwH011099; Mon, 6 Sep 2010 04:14:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o864Exu9011096; Mon, 6 Sep 2010 04:14:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009060414.o864Exu9011096@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 6 Sep 2010 04:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212246 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 04:15:00 -0000 Author: nwhitehorn Date: Mon Sep 6 04:14:59 2010 New Revision: 212246 URL: http://svn.freebsd.org/changeset/base/212246 Log: Add a watchdog timer and correct a misunderstaning about busdma that was causing random bits of the ring buffer to be overwritten. The PS3's network interface now runs stably even at high transfer rates. Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Mon Sep 6 03:00:54 2010 (r212245) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Mon Sep 6 04:14:59 2010 (r212246) @@ -70,6 +70,7 @@ static int glc_encap(struct glc_softc *s bus_addr_t *pktdesc); static int glc_intr_filter(void *xsc); static void glc_intr(void *xsc); +static void glc_tick(void *xsc); static MALLOC_DEFINE(M_GLC, "gelic", "PS3 GELIC ethernet"); @@ -151,7 +152,9 @@ glc_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&sc->sc_tick_ch, &sc->sc_mtx, 0); sc->next_txdma_slot = 0; + sc->bsy_txdma_slots = 0; sc->first_used_txdma_slot = -1; /* @@ -318,6 +321,7 @@ glc_init_locked(struct glc_softc *sc) { int i; struct glc_rxsoft *rxs; + struct glc_txsoft *txs; mtx_assert(&sc->sc_mtx, MA_OWNED); @@ -342,12 +346,22 @@ glc_init_locked(struct glc_softc *sc) BUS_DMASYNC_PREREAD); } + txs = STAILQ_FIRST(&sc->sc_txdirtyq); + if (txs != NULL) { + lv1_net_start_tx_dma(sc->sc_bus, sc->sc_dev, + glc_map_addr(sc, sc->sc_txdmadesc_phys + + txs->txs_firstdesc*sizeof(struct glc_dmadesc)), 0); + } + lv1_net_start_rx_dma(sc->sc_bus, sc->sc_dev, sc->sc_rxsoft[0].rxs_desc, 0); sc->sc_ifp->if_drv_flags |= IFF_DRV_RUNNING; sc->sc_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->sc_ifpflags = sc->sc_ifp->if_flags; + + sc->sc_wdog_timer = 0; + callout_reset(&sc->sc_tick_ch, hz, glc_tick, sc); } static void @@ -361,6 +375,24 @@ glc_init(void *xsc) } static void +glc_tick(void *xsc) +{ + struct glc_softc *sc = xsc; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + + if (sc->sc_wdog_timer == 0 || --sc->sc_wdog_timer != 0) { + callout_reset(&sc->sc_tick_ch, hz, glc_tick, sc); + return; + } + + /* Problems */ + device_printf(sc->sc_self, "device timeout\n"); + + glc_init_locked(sc); +} + +static void glc_start_locked(struct ifnet *ifp) { struct glc_softc *sc = ifp->if_softc; @@ -371,6 +403,10 @@ glc_start_locked(struct ifnet *ifp) mtx_assert(&sc->sc_mtx, MA_OWNED); first = 0; + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return; + if (STAILQ_EMPTY(&sc->sc_txdirtyq)) kickstart = 1; @@ -380,15 +416,21 @@ glc_start_locked(struct ifnet *ifp) if (mb_head == NULL) break; + /* Check if the ring buffer is full */ + if (sc->bsy_txdma_slots > 125) { + /* Put the packet back and stop */ + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + IFQ_DRV_PREPEND(&ifp->if_snd, mb_head); + break; + } + BPF_MTAP(ifp, mb_head); if (sc->sc_tx_vlan >= 0) mb_head = ether_vlanencap(mb_head, sc->sc_tx_vlan); if (glc_encap(sc, &mb_head, &pktdesc)) { - /* Put the packet back and stop */ ifp->if_drv_flags |= IFF_DRV_OACTIVE; - IFQ_DRV_PREPEND(&ifp->if_snd, mb_head); break; } @@ -396,9 +438,6 @@ glc_start_locked(struct ifnet *ifp) first = pktdesc; } - bus_dmamap_sync(sc->sc_dmadesc_tag, sc->sc_txdmadesc_map, - BUS_DMASYNC_PREREAD); - if (kickstart && first != 0) { lv1_net_start_tx_dma(sc->sc_bus, sc->sc_dev, first, 0); sc->sc_wdog_timer = 5; @@ -516,50 +555,46 @@ glc_encap(struct glc_softc *sc, struct m struct glc_txsoft *txs; struct mbuf *m; bus_addr_t firstslotphys; - int i, idx; - int nsegs = 16; + int i, idx, nsegs, nsegs_max; int err = 0; - /* Check if the ring buffer is full */ - if (sc->next_txdma_slot == sc->first_used_txdma_slot) - return (-1); - /* Max number of segments is the number of free DMA slots */ - if (sc->next_txdma_slot >= sc->first_used_txdma_slot) - nsegs = 128 - sc->next_txdma_slot + sc->first_used_txdma_slot; - else - nsegs = sc->first_used_txdma_slot - sc->next_txdma_slot; + nsegs_max = 128 - sc->bsy_txdma_slots; - if (nsegs > 16) - nsegs = 16; + if (nsegs_max > 16 || sc->first_used_txdma_slot < 0) + nsegs_max = 16; /* Get a work queue entry. */ if ((txs = STAILQ_FIRST(&sc->sc_txfreeq)) == NULL) { /* Ran out of descriptors. */ return (ENOBUFS); } - - err = bus_dmamap_load_mbuf_sg(sc->sc_txdma_tag, txs->txs_dmamap, - *m_head, segs, &nsegs, BUS_DMA_NOWAIT); - if (err == EFBIG) { - m = m_collapse(*m_head, M_DONTWAIT, nsegs); + nsegs = 0; + for (m = *m_head; m != NULL; m = m->m_next) + nsegs++; + + if (nsegs > nsegs_max) { + m = m_collapse(*m_head, M_DONTWAIT, nsegs_max); if (m == NULL) { m_freem(*m_head); *m_head = NULL; return (ENOBUFS); } *m_head = m; - - err = bus_dmamap_load_mbuf_sg(sc->sc_txdma_tag, - txs->txs_dmamap, *m_head, segs, &nsegs, BUS_DMA_NOWAIT); - if (err != 0) { - m_freem(*m_head); - *m_head = NULL; - return (err); - } - } else if (err != 0) + } + + err = bus_dmamap_load_mbuf_sg(sc->sc_txdma_tag, txs->txs_dmamap, + *m_head, segs, &nsegs, BUS_DMA_NOWAIT); + if (err != 0) { + m_freem(*m_head); + *m_head = NULL; return (err); + } + + KASSERT(nsegs <= 128 - sc->bsy_txdma_slots, + ("GLC: Mapped too many (%d) DMA segments with %d available", + nsegs, 128 - sc->bsy_txdma_slots)); if (nsegs == 0) { m_freem(*m_head); @@ -594,21 +629,23 @@ glc_encap(struct glc_softc *sc, struct m idx = (idx + 1) % GLC_MAX_TX_PACKETS; } sc->next_txdma_slot = idx; - idx = (txs->txs_firstdesc - 1) % GLC_MAX_TX_PACKETS; - sc->sc_txdmadesc[idx].next = firstslotphys; + sc->bsy_txdma_slots += nsegs; + if (txs->txs_firstdesc != 0) + idx = txs->txs_firstdesc - 1; + else + idx = GLC_MAX_TX_PACKETS - 1; if (sc->first_used_txdma_slot < 0) sc->first_used_txdma_slot = txs->txs_firstdesc; bus_dmamap_sync(sc->sc_txdma_tag, txs->txs_dmamap, BUS_DMASYNC_PREWRITE); + sc->sc_txdmadesc[idx].next = firstslotphys; STAILQ_REMOVE_HEAD(&sc->sc_txfreeq, txs_q); STAILQ_INSERT_TAIL(&sc->sc_txdirtyq, txs, txs_q); txs->txs_mbuf = *m_head; - - if (pktdesc != NULL) - *pktdesc = firstslotphys; + *pktdesc = firstslotphys; return (0); } @@ -677,6 +714,7 @@ glc_txintr(struct glc_softc *sc) STAILQ_REMOVE_HEAD(&sc->sc_txdirtyq, txs_q); bus_dmamap_unload(sc->sc_txdma_tag, txs->txs_dmamap); + sc->bsy_txdma_slots -= txs->txs_ndescs; if (txs->txs_mbuf != NULL) { m_freem(txs->txs_mbuf); Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Mon Sep 6 03:00:54 2010 (r212245) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Mon Sep 6 04:14:59 2010 (r212246) @@ -84,7 +84,7 @@ struct glc_softc { bus_dma_tag_t sc_txdma_tag; struct glc_txsoft sc_txsoft[GLC_MAX_TX_PACKETS]; struct glc_dmadesc *sc_txdmadesc; - int next_txdma_slot, first_used_txdma_slot; + int next_txdma_slot, first_used_txdma_slot, bsy_txdma_slots; bus_dmamap_t sc_txdmadesc_map; bus_addr_t sc_txdmadesc_phys; @@ -102,6 +102,7 @@ struct glc_softc { int sc_bus, sc_dev; int sc_wdog_timer; + struct callout sc_tick_ch; }; #define GELIC_GET_MAC_ADDRESS 0x0001 From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 07:24:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F12EF10656A4; Mon, 6 Sep 2010 07:24:28 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C697F8FC12; Mon, 6 Sep 2010 07:24:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o867OSuP021752; Mon, 6 Sep 2010 07:24:28 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o867OSLm021751; Mon, 6 Sep 2010 07:24:28 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009060724.o867OSLm021751@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 07:24:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212249 - user/weongyo X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 07:24:29 -0000 Author: weongyo Date: Mon Sep 6 07:24:28 2010 New Revision: 212249 URL: http://svn.freebsd.org/changeset/base/212249 Log: Creates my own repository. Added: user/weongyo/ From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 07:35:14 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CD8810656AC; Mon, 6 Sep 2010 07:35:14 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2205C8FC1C; Mon, 6 Sep 2010 07:35:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o867ZEt1022988; Mon, 6 Sep 2010 07:35:14 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o867ZEuQ022986; Mon, 6 Sep 2010 07:35:14 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009060735.o867ZEuQ022986@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 07:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212252 - in user/weongyo/usb: . sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 07:35:14 -0000 Author: weongyo Date: Mon Sep 6 07:35:13 2010 New Revision: 212252 URL: http://svn.freebsd.org/changeset/base/212252 Log: Creates a user branch to store works related with USB drivers from r212249. Added: user/weongyo/usb/ user/weongyo/usb/sys/ - copied from r212248, head/sys/ From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 13:47:12 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A4FA10656A4; Mon, 6 Sep 2010 13:47:12 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F79C8FC0C; Mon, 6 Sep 2010 13:47:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o86DlBRP050946; Mon, 6 Sep 2010 13:47:11 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86DlBZB050943; Mon, 6 Sep 2010 13:47:11 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009061347.o86DlBZB050943@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 6 Sep 2010 13:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212257 - in user/nwhitehorn/ps3/powerpc: aim ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 13:47:12 -0000 Author: nwhitehorn Date: Mon Sep 6 13:47:11 2010 New Revision: 212257 URL: http://svn.freebsd.org/changeset/base/212257 Log: Add some seatbelts to mmu_ps3 and fiddle the SLB allocator some more following advice from alc. PS3 still hangs in low-memory situations. Modified: user/nwhitehorn/ps3/powerpc/aim/slb.c user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Modified: user/nwhitehorn/ps3/powerpc/aim/slb.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/slb.c Mon Sep 6 13:17:01 2010 (r212256) +++ user/nwhitehorn/ps3/powerpc/aim/slb.c Mon Sep 6 13:47:11 2010 (r212257) @@ -316,22 +316,10 @@ slb_uma_cache_alloc(uma_zone_t zone, int if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) bzero(va, PAGE_SIZE); - return (va); -} - -static void -slb_uma_cache_free(void *mem, int size, u_int8_t flags) -{ - vm_page_t m; + /* vm_phys_alloc_contig does not track wiring */ + m->wire_count = 1; - if (!hw_direct_map) - pmap_remove(kernel_pmap,(vm_offset_t)mem, - (vm_offset_t)mem + PAGE_SIZE); - - m = PHYS_TO_VM_PAGE((vm_offset_t)mem); - vm_page_lock_queues(); - vm_phys_free_pages(m, 0); - vm_page_unlock_queues(); + return (va); } static void @@ -343,10 +331,8 @@ slb_zone_init(void *dummy) slb_cache_zone = uma_zcreate("SLB cache", 64*sizeof(struct slb), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); - if (platform_real_maxaddr() != VM_MAX_ADDRESS) { + if (platform_real_maxaddr() != VM_MAX_ADDRESS) uma_zone_set_allocf(slb_cache_zone, slb_uma_cache_alloc); - uma_zone_set_freef(slb_cache_zone, slb_uma_cache_free); - } } struct slb * Modified: user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Mon Sep 6 13:17:01 2010 (r212256) +++ user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c Mon Sep 6 13:47:11 2010 (r212257) @@ -259,6 +259,7 @@ mps3_pte_insert(u_int ptegidx, struct lp pvo_pt->pte_hi |= LPTE_VALID; pvo_pt->pte_hi &= ~LPTE_HID; evicted.pte_hi = 0; + PTESYNC(); result = lv1_insert_htab_entry(mps3_vas_id, ptegidx << 3, pvo_pt->pte_hi, pvo_pt->pte_lo, LPTE_LOCKED | LPTE_WIRED, 0, &index, &evicted.pte_hi, &evicted.pte_lo); @@ -290,6 +291,9 @@ mps3_pte_insert(u_int ptegidx, struct lp if (evicted.pte_hi & LPTE_HID) ptegidx ^= moea64_pteg_mask; /* PTEs indexed by primary */ + KASSERT((evicted.pte_hi & (LPTE_WIRED | LPTE_LOCKED)) == 0, + ("Evicted a wired PTE")); + result = 0; LIST_FOREACH(pvo, &moea64_pvo_table[ptegidx], pvo_olink) { if (!PVO_PTEGIDX_ISSET(pvo)) From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 20:51:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA66B10656C3; Mon, 6 Sep 2010 20:51:35 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A3EB8FC14; Mon, 6 Sep 2010 20:51:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o86KpZRe064863; Mon, 6 Sep 2010 20:51:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86KpZol064861; Mon, 6 Sep 2010 20:51:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009062051.o86KpZol064861@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 6 Sep 2010 20:51:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212264 - user/nwhitehorn/ps3/powerpc/aim X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 20:51:35 -0000 Author: nwhitehorn Date: Mon Sep 6 20:51:35 2010 New Revision: 212264 URL: http://svn.freebsd.org/changeset/base/212264 Log: Missed a line. Submitted by: alc Modified: user/nwhitehorn/ps3/powerpc/aim/slb.c Modified: user/nwhitehorn/ps3/powerpc/aim/slb.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/slb.c Mon Sep 6 20:40:38 2010 (r212263) +++ user/nwhitehorn/ps3/powerpc/aim/slb.c Mon Sep 6 20:51:35 2010 (r212264) @@ -317,6 +317,7 @@ slb_uma_cache_alloc(uma_zone_t zone, int bzero(va, PAGE_SIZE); /* vm_phys_alloc_contig does not track wiring */ + atomic_add_int(&cnt.v_wire_count, 1); m->wire_count = 1; return (va); From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 22:59:59 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D22210656A8; Mon, 6 Sep 2010 22:59:59 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BF348FC26; Mon, 6 Sep 2010 22:59:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o86MxwxS069369; Mon, 6 Sep 2010 22:59:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86MxwT6069366; Mon, 6 Sep 2010 22:59:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009062259.o86MxwT6069366@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 6 Sep 2010 22:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212276 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:59:59 -0000 Author: nwhitehorn Date: Mon Sep 6 22:59:58 2010 New Revision: 212276 URL: http://svn.freebsd.org/changeset/base/212276 Log: Fill out the PS3 ethernet driver by adding support for checksum offloading, media reporting and setting, and link state change notification. Next up will be USB support. Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glc.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Mon Sep 6 22:47:52 2010 (r212275) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glc.c Mon Sep 6 22:59:58 2010 (r212276) @@ -64,6 +64,7 @@ static int glc_attach(device_t); static void glc_init(void *xsc); static void glc_start(struct ifnet *ifp); static int glc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); +static void glc_set_multicast(struct glc_softc *sc); static int glc_add_rxbuf(struct glc_softc *sc, int idx); static int glc_add_rxbuf_dma(struct glc_softc *sc, int idx); static int glc_encap(struct glc_softc *sc, struct mbuf **m_head, @@ -71,6 +72,8 @@ static int glc_encap(struct glc_softc *s static int glc_intr_filter(void *xsc); static void glc_intr(void *xsc); static void glc_tick(void *xsc); +static void glc_media_status(struct ifnet *ifp, struct ifmediareq *ifmr); +static int glc_media_change(struct ifnet *ifp); static MALLOC_DEFINE(M_GLC, "gelic", "PS3 GELIC ethernet"); @@ -297,10 +300,23 @@ glc_attach(device_t dev) if_initname(sc->sc_ifp, device_get_name(dev), device_get_unit(dev)); sc->sc_ifp->if_mtu = ETHERMTU; sc->sc_ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + sc->sc_ifp->if_hwassist = CSUM_TCP | CSUM_UDP; + sc->sc_ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_RXCSUM; + sc->sc_ifp->if_capenable = IFCAP_HWCSUM | IFCAP_RXCSUM; sc->sc_ifp->if_start = glc_start; sc->sc_ifp->if_ioctl = glc_ioctl; sc->sc_ifp->if_init = glc_init; + ifmedia_init(&sc->sc_media, IFM_IMASK, glc_media_change, + glc_media_status); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_10_T, 0, NULL); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_100_TX, 0, NULL); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); + IFQ_SET_MAXLEN(&sc->sc_ifp->if_snd, GLC_MAX_TX_PACKETS); sc->sc_ifp->if_snd.ifq_drv_maxlen = GLC_MAX_TX_PACKETS; IFQ_SET_READY(&sc->sc_ifp->if_snd); @@ -328,6 +344,8 @@ glc_init_locked(struct glc_softc *sc) lv1_net_stop_tx_dma(sc->sc_bus, sc->sc_dev, 0); lv1_net_stop_rx_dma(sc->sc_bus, sc->sc_dev, 0); + glc_set_multicast(sc); + for (i = 0; i < GLC_MAX_RX_PACKETS; i++) { rxs = &sc->sc_rxsoft[i]; rxs->rxs_desc_slot = i; @@ -365,6 +383,17 @@ glc_init_locked(struct glc_softc *sc) } static void +glc_stop(void *xsc) +{ + struct glc_softc *sc = xsc; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + + lv1_net_stop_tx_dma(sc->sc_bus, sc->sc_dev, 0); + lv1_net_stop_rx_dma(sc->sc_bus, sc->sc_dev, 0); +} + +static void glc_init(void *xsc) { struct glc_softc *sc = xsc; @@ -458,31 +487,35 @@ static int glc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct glc_softc *sc = ifp->if_softc; -#if 0 struct ifreq *ifr = (struct ifreq *)data; -#endif int err = 0; switch (cmd) { case SIOCSIFFLAGS: mtx_lock(&sc->sc_mtx); if ((ifp->if_flags & IFF_UP) != 0) { -#if 0 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && ((ifp->if_flags ^ sc->sc_ifpflags) & (IFF_ALLMULTI | IFF_PROMISC)) != 0) - bm_setladrf(sc); + glc_set_multicast(sc); else -#endif glc_init_locked(sc); } -#if 0 else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) - bm_stop(sc); -#endif + glc_stop(sc); sc->sc_ifpflags = ifp->if_flags; mtx_unlock(&sc->sc_mtx); break; + case SIOCADDMULTI: + case SIOCDELMULTI: + mtx_lock(&sc->sc_mtx); + glc_set_multicast(sc); + mtx_unlock(&sc->sc_mtx); + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + err = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); + break; default: err = ether_ioctl(ifp, cmd, data); break; @@ -491,6 +524,51 @@ glc_ioctl(struct ifnet *ifp, u_long cmd, return (err); } +static void +glc_set_multicast(struct glc_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ifmultiaddr *inm; + uint64_t addr; + int naddrs; + + /* Clear multicast filter */ + lv1_net_remove_multicast_address(sc->sc_bus, sc->sc_dev, 0, 1); + + /* Add broadcast */ + lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, + 0xffffffffffffL, 0); + + if ((ifp->if_flags & IFF_ALLMULTI) != 0) { + lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, 0, 1); + } else { + if_maddr_rlock(ifp); + naddrs = 1; /* Include broadcast */ + TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { + if (inm->ifma_addr->sa_family != AF_LINK) + continue; + addr = 0; + memcpy(&((uint8_t *)(&addr))[2], + LLADDR((struct sockaddr_dl *)inm->ifma_addr), + ETHER_ADDR_LEN); + + lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, + addr, 0); + + /* + * Filter can only hold 32 addresses, so fall back to + * the IFF_ALLMULTI case if we have too many. + */ + if (++naddrs >= 32) { + lv1_net_add_multicast_address(sc->sc_bus, + sc->sc_dev, 0, 1); + break; + } + } + if_maddr_runlock(ifp); + } +} + static int glc_add_rxbuf(struct glc_softc *sc, int idx) { @@ -624,6 +702,10 @@ glc_encap(struct glc_softc *sc, struct m sc->sc_txdmadesc[idx].cmd_stat |= GELIC_CMDSTAT_LAST; } + if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) + sc->sc_txdmadesc[idx].cmd_stat |= GELIC_CMDSTAT_CSUM_TCP; + if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) + sc->sc_txdmadesc[idx].cmd_stat |= GELIC_CMDSTAT_CSUM_UDP; sc->sc_txdmadesc[idx].cmd_stat |= GELIC_DESCR_OWNED; idx = (idx + 1) % GLC_MAX_TX_PACKETS; @@ -670,6 +752,16 @@ glc_rxintr(struct glc_softc *sc) } m = sc->sc_rxsoft[i].rxs_mbuf; + if (sc->sc_rxdmadesc[i].data_stat & GELIC_RX_IPCSUM) { + m->m_pkthdr.csum_flags |= + CSUM_IP_CHECKED | CSUM_IP_VALID; + } + if (sc->sc_rxdmadesc[i].data_stat & GELIC_RX_TCPUDPCSUM) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + if (glc_add_rxbuf(sc, i)) { ifp->if_ierrors++; goto requeue; @@ -776,7 +868,7 @@ static void glc_intr(void *xsc) { struct glc_softc *sc = xsc; - uint64_t status; + uint64_t status, linkstat, junk; mtx_lock(&sc->sc_mtx); @@ -793,6 +885,80 @@ glc_intr(void *xsc) if (status & (GELIC_INT_TXDONE | GELIC_INT_TX_CHAIN_END)) glc_txintr(sc); + if (status & GELIC_INT_PHY) { + lv1_net_control(sc->sc_bus, sc->sc_dev, GELIC_GET_LINK_STATUS, + GELIC_VLAN_TX_ETHERNET, 0, 0, &linkstat, &junk); + + linkstat = (linkstat & GELIC_LINK_UP) ? + LINK_STATE_UP : LINK_STATE_DOWN; + if (linkstat != sc->sc_ifp->if_link_state) + if_link_state_change(sc->sc_ifp, linkstat); + } + mtx_unlock(&sc->sc_mtx); } +static void +glc_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct glc_softc *sc = ifp->if_softc; + uint64_t status, junk; + + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; + + lv1_net_control(sc->sc_bus, sc->sc_dev, GELIC_GET_LINK_STATUS, + GELIC_VLAN_TX_ETHERNET, 0, 0, &status, &junk); + + if (status & GELIC_LINK_UP) + ifmr->ifm_status |= IFM_ACTIVE; + + if (status & GELIC_SPEED_10) + ifmr->ifm_active |= IFM_10_T; + else if (status & GELIC_SPEED_100) + ifmr->ifm_active |= IFM_100_TX; + else if (status & GELIC_SPEED_1000) + ifmr->ifm_active |= IFM_1000_T; + + if (status & GELIC_FULL_DUPLEX) + ifmr->ifm_active |= IFM_FDX; + else + ifmr->ifm_active |= IFM_HDX; +} + +static int +glc_media_change(struct ifnet *ifp) +{ + struct glc_softc *sc = ifp->if_softc; + uint64_t mode, junk; + int result; + + if (IFM_TYPE(sc->sc_media.ifm_media) != IFM_ETHER) + return (EINVAL); + + switch (IFM_SUBTYPE(sc->sc_media.ifm_media)) { + case IFM_AUTO: + mode = GELIC_AUTO_NEG; + break; + case IFM_10_T: + mode = GELIC_SPEED_10; + break; + case IFM_100_TX: + mode = GELIC_SPEED_100; + break; + case IFM_1000_T: + mode = GELIC_SPEED_1000 | GELIC_FULL_DUPLEX; + break; + default: + return (EINVAL); + } + + if (IFM_OPTIONS(sc->sc_media.ifm_media) & IFM_FDX) + mode |= GELIC_FULL_DUPLEX; + + result = lv1_net_control(sc->sc_bus, sc->sc_dev, GELIC_SET_LINK_MODE, + GELIC_VLAN_TX_ETHERNET, mode, 0, &junk, &junk); + + return (result ? EIO : 0); +} + Modified: user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Mon Sep 6 22:47:52 2010 (r212275) +++ user/nwhitehorn/ps3/powerpc/ps3/if_glcreg.h Mon Sep 6 22:59:58 2010 (r212276) @@ -79,6 +79,8 @@ struct glc_softc { uint64_t *sc_hwirq_status; volatile uint64_t sc_interrupt_status; + struct ifmedia sc_media; + /* Transmission */ bus_dma_tag_t sc_txdma_tag; @@ -107,6 +109,7 @@ struct glc_softc { #define GELIC_GET_MAC_ADDRESS 0x0001 #define GELIC_GET_LINK_STATUS 0x0002 +#define GELIC_SET_LINK_MODE 0x0003 #define GELIC_LINK_UP 0x0001 #define GELIC_FULL_DUPLEX 0x0002 #define GELIC_AUTO_NEG 0x0004 @@ -123,10 +126,16 @@ struct glc_softc { #define GELIC_DESCR_OWNED 0xa0000000 #define GELIC_CMDSTAT_DMA_DONE 0x00000000 #define GELIC_CMDSTAT_CHAIN_END 0x00000002 +#define GELIC_CMDSTAT_CSUM_TCP 0x00020000 +#define GELIC_CMDSTAT_CSUM_UDP 0x00030000 #define GELIC_CMDSTAT_NOIPSEC 0x00080000 #define GELIC_CMDSTAT_LAST 0x00040000 #define GELIC_RXERRORS 0x7def8000 +/* RX Data Status codes */ +#define GELIC_RX_IPCSUM 0x20000000 +#define GELIC_RX_TCPUDPCSUM 0x10000000 + /* Interrupt options */ #define GELIC_INT_RXDONE 0x0000000000004000UL #define GELIC_INT_RXFRAME 0x1000000000000000UL From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 23:05:38 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E802C1065756; Mon, 6 Sep 2010 23:05:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCD4D8FC12; Mon, 6 Sep 2010 23:05:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o86N5csJ069647; Mon, 6 Sep 2010 23:05:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86N5cLT069643; Mon, 6 Sep 2010 23:05:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009062305.o86N5cLT069643@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 6 Sep 2010 23:05:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212277 - in user/nwhitehorn/ps3: dev/ofw powerpc/aim powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 23:05:39 -0000 Author: nwhitehorn Date: Mon Sep 6 23:05:38 2010 New Revision: 212277 URL: http://svn.freebsd.org/changeset/base/212277 Log: Set the Data Address Breakpoint Register to throw exceptions on NULL pointer dereferences. Fix two that appeared related to FDT. Modified: user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c user/nwhitehorn/ps3/powerpc/aim/nexus.c user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Modified: user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c ============================================================================== --- user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Mon Sep 6 22:59:58 2010 (r212276) +++ user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c Mon Sep 6 23:05:38 2010 (r212277) @@ -95,6 +95,7 @@ OFW_DEF(ofw_fdt); static void *fdtp = NULL; +extern int pmap_bootstrapped; static int ofw_fdt_init(ofw_t ofw, void *data) { @@ -138,6 +139,9 @@ ofw_fdt_peer(ofw_t ofw, phandle_t node) phandle_t p; int depth, offset; + if (fdtp == NULL) + return (-1); + if (node == 0) { /* Find root node */ offset = fdt_path_offset(fdtp, "/"); @@ -382,6 +386,9 @@ ofw_fdt_finddevice(ofw_t ofw, const char phandle_t p; int offset; + if (fdtp == NULL) + return (-1); + offset = fdt_path_offset(fdtp, device); p = (phandle_t)(uintptr_t)fdt_offset_ptr(fdtp, offset, sizeof(p)); Modified: user/nwhitehorn/ps3/powerpc/aim/nexus.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/aim/nexus.c Mon Sep 6 22:59:58 2010 (r212276) +++ user/nwhitehorn/ps3/powerpc/aim/nexus.c Mon Sep 6 23:05:38 2010 (r212277) @@ -211,9 +211,6 @@ nexus_attach(device_t dev) struct nexus_softc *sc; u_long start, end; - if ((root = OF_peer(0)) == -1) - panic("nexus_probe: OF_peer failed."); - sc = device_get_softc(dev); start = 0; @@ -227,6 +224,10 @@ nexus_attach(device_t dev) rman_manage_region(&sc->sc_rman, start, end)) panic("nexus_probe IRQ rman"); + if ((root = OF_peer(0)) == -1) + return (bus_generic_attach(dev)); + + /* * Now walk the OFW tree to locate top-level devices */ Modified: user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c ============================================================================== --- user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Mon Sep 6 22:59:58 2010 (r212276) +++ user/nwhitehorn/ps3/powerpc/ps3/platform_ps3.c Mon Sep 6 23:05:38 2010 (r212277) @@ -156,6 +156,9 @@ ps3_attach(platform_t plat) pmap_mmu_install("mmu_ps3", BUS_PROBE_SPECIFIC); cpu_idle_hook = ps3_cpu_idle; + /* Set a breakpoint to make NULL an invalid address */ + lv1_set_dabr(0x7 /* read and write, MMU on */, 2 /* kernel accesses */); + return (0); } From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 23:11:56 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D60A9106566C; Mon, 6 Sep 2010 23:11:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C21E18FC08; Mon, 6 Sep 2010 23:11:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o86NBuIt070322; Mon, 6 Sep 2010 23:11:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86NBu2l070299; Mon, 6 Sep 2010 23:11:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009062311.o86NBu2l070299@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 6 Sep 2010 23:11:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212279 - in user/nwhitehorn/ps3: amd64/include boot/i386/boot2 boot/i386/efi boot/i386/libi386 boot/i386/loader boot/i386/zfsloader boot/ofw/libofw boot/pc98/boot2 cam/ata cam/scsi cdd... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 23:11:56 -0000 Author: nwhitehorn Date: Mon Sep 6 23:11:56 2010 New Revision: 212279 URL: http://svn.freebsd.org/changeset/base/212279 Log: IFC @ r212278 Modified: user/nwhitehorn/ps3/amd64/include/cpufunc.h user/nwhitehorn/ps3/boot/i386/boot2/Makefile user/nwhitehorn/ps3/boot/i386/efi/Makefile user/nwhitehorn/ps3/boot/i386/libi386/pxe.c user/nwhitehorn/ps3/boot/i386/loader/Makefile user/nwhitehorn/ps3/boot/i386/zfsloader/Makefile user/nwhitehorn/ps3/boot/ofw/libofw/ofw_copy.c user/nwhitehorn/ps3/boot/pc98/boot2/Makefile user/nwhitehorn/ps3/boot/pc98/boot2/boot2.c user/nwhitehorn/ps3/cam/ata/ata_da.c user/nwhitehorn/ps3/cam/scsi/scsi_da.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/nwhitehorn/ps3/cddl/dev/dtrace/dtrace_load.c user/nwhitehorn/ps3/dev/acpi_support/acpi_hp.c user/nwhitehorn/ps3/dev/acpica/acpi.c user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c user/nwhitehorn/ps3/dev/ata/ata-all.h user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c user/nwhitehorn/ps3/dev/ata/chipsets/ata-ahci.c user/nwhitehorn/ps3/dev/ata/chipsets/ata-siliconimage.c user/nwhitehorn/ps3/dev/bge/if_bge.c user/nwhitehorn/ps3/dev/bge/if_bgereg.h user/nwhitehorn/ps3/dev/fb/vesa.c user/nwhitehorn/ps3/dev/hwpmc/hwpmc_core.c user/nwhitehorn/ps3/dev/if_ndis/if_ndis_usb.c user/nwhitehorn/ps3/dev/iscsi/initiator/iscsi.c user/nwhitehorn/ps3/dev/iscsi/initiator/iscsivar.h user/nwhitehorn/ps3/dev/powermac_nvram/powermac_nvram.c user/nwhitehorn/ps3/dev/powermac_nvram/powermac_nvramvar.h user/nwhitehorn/ps3/dev/sis/if_sis.c user/nwhitehorn/ps3/dev/sis/if_sisreg.h user/nwhitehorn/ps3/dev/twa/tw_osl_freebsd.c user/nwhitehorn/ps3/dev/usb/controller/ehci.c user/nwhitehorn/ps3/dev/usb/controller/ohci.c user/nwhitehorn/ps3/dev/usb/controller/uhci.c user/nwhitehorn/ps3/dev/usb/input/atp.c user/nwhitehorn/ps3/dev/usb/input/uep.c user/nwhitehorn/ps3/dev/usb/input/uhid.c user/nwhitehorn/ps3/dev/usb/input/ukbd.c user/nwhitehorn/ps3/dev/usb/input/ums.c user/nwhitehorn/ps3/dev/usb/misc/udbp.c user/nwhitehorn/ps3/dev/usb/misc/ufm.c user/nwhitehorn/ps3/dev/usb/net/if_aue.c user/nwhitehorn/ps3/dev/usb/net/if_axe.c user/nwhitehorn/ps3/dev/usb/net/if_axereg.h user/nwhitehorn/ps3/dev/usb/net/if_cdce.c user/nwhitehorn/ps3/dev/usb/net/if_cue.c user/nwhitehorn/ps3/dev/usb/net/if_kue.c user/nwhitehorn/ps3/dev/usb/net/if_rue.c user/nwhitehorn/ps3/dev/usb/net/if_udav.c user/nwhitehorn/ps3/dev/usb/net/uhso.c user/nwhitehorn/ps3/dev/usb/serial/u3g.c user/nwhitehorn/ps3/dev/usb/serial/uark.c user/nwhitehorn/ps3/dev/usb/serial/ubsa.c user/nwhitehorn/ps3/dev/usb/serial/ubser.c user/nwhitehorn/ps3/dev/usb/serial/uchcom.c user/nwhitehorn/ps3/dev/usb/serial/ucycom.c user/nwhitehorn/ps3/dev/usb/serial/ufoma.c user/nwhitehorn/ps3/dev/usb/serial/uftdi.c user/nwhitehorn/ps3/dev/usb/serial/ugensa.c user/nwhitehorn/ps3/dev/usb/serial/uipaq.c user/nwhitehorn/ps3/dev/usb/serial/ulpt.c user/nwhitehorn/ps3/dev/usb/serial/umct.c user/nwhitehorn/ps3/dev/usb/serial/umoscom.c user/nwhitehorn/ps3/dev/usb/serial/uvisor.c user/nwhitehorn/ps3/dev/usb/storage/umass.c user/nwhitehorn/ps3/dev/usb/storage/urio.c user/nwhitehorn/ps3/dev/usb/usb_compat_linux.c user/nwhitehorn/ps3/dev/usb/usb_controller.h user/nwhitehorn/ps3/dev/usb/usb_device.c user/nwhitehorn/ps3/dev/usb/usb_generic.c user/nwhitehorn/ps3/dev/usb/usb_hub.c user/nwhitehorn/ps3/dev/usb/usb_transfer.c user/nwhitehorn/ps3/dev/usb/usb_transfer.h user/nwhitehorn/ps3/dev/usb/usbdi.h user/nwhitehorn/ps3/dev/usb/usbdi_util.h user/nwhitehorn/ps3/dev/usb/wlan/if_rum.c user/nwhitehorn/ps3/dev/usb/wlan/if_run.c user/nwhitehorn/ps3/dev/usb/wlan/if_uath.c user/nwhitehorn/ps3/dev/usb/wlan/if_upgt.c user/nwhitehorn/ps3/dev/usb/wlan/if_ural.c user/nwhitehorn/ps3/dev/usb/wlan/if_urtw.c user/nwhitehorn/ps3/dev/usb/wlan/if_zyd.c user/nwhitehorn/ps3/fs/ext2fs/ext2_alloc.c user/nwhitehorn/ps3/fs/nfsclient/nfs_clbio.c user/nwhitehorn/ps3/fs/nfsclient/nfs_clvnops.c user/nwhitehorn/ps3/fs/unionfs/union_vfsops.c user/nwhitehorn/ps3/geom/geom_io.c user/nwhitehorn/ps3/geom/sched/subr_disk.c user/nwhitehorn/ps3/i386/include/cpufunc.h user/nwhitehorn/ps3/kern/kern_et.c user/nwhitehorn/ps3/kern/kern_malloc.c user/nwhitehorn/ps3/kern/kern_rmlock.c user/nwhitehorn/ps3/kern/kern_sig.c user/nwhitehorn/ps3/kern/sched_ule.c user/nwhitehorn/ps3/kern/subr_bus.c user/nwhitehorn/ps3/kern/subr_disk.c user/nwhitehorn/ps3/kern/subr_sbuf.c user/nwhitehorn/ps3/kern/uipc_syscalls.c user/nwhitehorn/ps3/kern/vfs_subr.c user/nwhitehorn/ps3/mips/rmi/intr_machdep.c user/nwhitehorn/ps3/mips/rmi/iodi.c user/nwhitehorn/ps3/mips/rmi/pic.h user/nwhitehorn/ps3/mips/rmi/xlr_machdep.c user/nwhitehorn/ps3/mips/rmi/xlr_pci.c user/nwhitehorn/ps3/net/if_epair.c user/nwhitehorn/ps3/net/if_lagg.c user/nwhitehorn/ps3/netinet/in.c user/nwhitehorn/ps3/netinet/ip_carp.c user/nwhitehorn/ps3/netinet/ip_input.c user/nwhitehorn/ps3/netinet/ip_var.h user/nwhitehorn/ps3/netinet/ipfw/ip_fw_nat.c user/nwhitehorn/ps3/netinet/sctp_input.c user/nwhitehorn/ps3/netinet/sctp_output.c user/nwhitehorn/ps3/netinet/sctp_pcb.c user/nwhitehorn/ps3/netinet/sctp_timer.c user/nwhitehorn/ps3/netinet/sctp_uio.h user/nwhitehorn/ps3/netinet/sctputil.c user/nwhitehorn/ps3/netinet6/ip6_input.c user/nwhitehorn/ps3/netinet6/ip6_var.h user/nwhitehorn/ps3/nfsclient/nfs_diskless.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c user/nwhitehorn/ps3/powerpc/aim/nexus.c user/nwhitehorn/ps3/powerpc/conf/GENERIC64 user/nwhitehorn/ps3/powerpc/include/param.h user/nwhitehorn/ps3/powerpc/powerpc/mp_machdep.c user/nwhitehorn/ps3/sparc64/conf/GENERIC user/nwhitehorn/ps3/sys/_rmlock.h user/nwhitehorn/ps3/sys/bio.h user/nwhitehorn/ps3/sys/bus.h user/nwhitehorn/ps3/sys/copyright.h user/nwhitehorn/ps3/sys/rmlock.h user/nwhitehorn/ps3/vm/memguard.c user/nwhitehorn/ps3/vm/memguard.h user/nwhitehorn/ps3/vm/vm_page.c Directory Properties: user/nwhitehorn/ps3/ (props changed) user/nwhitehorn/ps3/amd64/include/xen/ (props changed) user/nwhitehorn/ps3/boot/powerpc/ps3/ (props changed) user/nwhitehorn/ps3/cddl/contrib/opensolaris/ (props changed) user/nwhitehorn/ps3/contrib/dev/acpica/ (props changed) user/nwhitehorn/ps3/contrib/pf/ (props changed) user/nwhitehorn/ps3/contrib/x86emu/ (props changed) user/nwhitehorn/ps3/dev/xen/xenpci/ (props changed) user/nwhitehorn/ps3/powerpc/ps3/ (props changed) Modified: user/nwhitehorn/ps3/amd64/include/cpufunc.h ============================================================================== --- user/nwhitehorn/ps3/amd64/include/cpufunc.h Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/amd64/include/cpufunc.h Mon Sep 6 23:11:56 2010 (r212279) @@ -421,40 +421,40 @@ invlpg(u_long addr) __asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory"); } -static __inline u_int +static __inline u_short rfs(void) { - u_int sel; - __asm __volatile("mov %%fs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%fs,%0" : "=rm" (sel)); return (sel); } -static __inline u_int +static __inline u_short rgs(void) { - u_int sel; - __asm __volatile("mov %%gs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%gs,%0" : "=rm" (sel)); return (sel); } -static __inline u_int +static __inline u_short rss(void) { - u_int sel; - __asm __volatile("mov %%ss,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%ss,%0" : "=rm" (sel)); return (sel); } static __inline void -load_ds(u_int sel) +load_ds(u_short sel) { - __asm __volatile("mov %0,%%ds" : : "rm" (sel)); + __asm __volatile("movw %0,%%ds" : : "rm" (sel)); } static __inline void -load_es(u_int sel) +load_es(u_short sel) { - __asm __volatile("mov %0,%%es" : : "rm" (sel)); + __asm __volatile("movw %0,%%es" : : "rm" (sel)); } static __inline void @@ -476,10 +476,10 @@ cpu_mwait(int extensions, int hints) #define MSR_FSBASE 0xc0000100 #endif static __inline void -load_fs(u_int sel) +load_fs(u_short sel) { /* Preserve the fsbase value across the selector load */ - __asm __volatile("rdmsr; mov %0,%%fs; wrmsr" + __asm __volatile("rdmsr; movw %0,%%fs; wrmsr" : : "rm" (sel), "c" (MSR_FSBASE) : "eax", "edx"); } @@ -487,28 +487,28 @@ load_fs(u_int sel) #define MSR_GSBASE 0xc0000101 #endif static __inline void -load_gs(u_int sel) +load_gs(u_short sel) { /* * Preserve the gsbase value across the selector load. * Note that we have to disable interrupts because the gsbase * being trashed happens to be the kernel gsbase at the time. */ - __asm __volatile("pushfq; cli; rdmsr; mov %0,%%gs; wrmsr; popfq" + __asm __volatile("pushfq; cli; rdmsr; movw %0,%%gs; wrmsr; popfq" : : "rm" (sel), "c" (MSR_GSBASE) : "eax", "edx"); } #else /* Usable by userland */ static __inline void -load_fs(u_int sel) +load_fs(u_short sel) { - __asm __volatile("mov %0,%%fs" : : "rm" (sel)); + __asm __volatile("movw %0,%%fs" : : "rm" (sel)); } static __inline void -load_gs(u_int sel) +load_gs(u_short sel) { - __asm __volatile("mov %0,%%gs" : : "rm" (sel)); + __asm __volatile("movw %0,%%gs" : : "rm" (sel)); } #endif @@ -692,8 +692,8 @@ void load_dr4(u_int64_t dr4); void load_dr5(u_int64_t dr5); void load_dr6(u_int64_t dr6); void load_dr7(u_int64_t dr7); -void load_fs(u_int sel); -void load_gs(u_int sel); +void load_fs(u_short sel); +void load_gs(u_short sel); void ltr(u_short sel); void outb(u_int port, u_char data); void outl(u_int port, u_int data); Modified: user/nwhitehorn/ps3/boot/i386/boot2/Makefile ============================================================================== --- user/nwhitehorn/ps3/boot/i386/boot2/Makefile Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/boot/i386/boot2/Makefile Mon Sep 6 23:11:56 2010 (r212279) @@ -3,7 +3,9 @@ .include # XXX: clang can compile the boot code just fine, but boot2 gets too big -CC:=${CC:C/^cc|^clang/gcc/} +.if ${CC:T:Mclang} == "clang" +CC=gcc +.endif FILES= boot boot1 boot2 Modified: user/nwhitehorn/ps3/boot/i386/efi/Makefile ============================================================================== --- user/nwhitehorn/ps3/boot/i386/efi/Makefile Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/boot/i386/efi/Makefile Mon Sep 6 23:11:56 2010 (r212279) @@ -42,7 +42,7 @@ ${PROG}: ${LDSCRIPT} CLEANFILES= vers.c loader.efi -NEWVERSWHAT= "EFI loader" ${MACHINE_ARCH} +NEWVERSWHAT= "EFI loader" x86 vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} Modified: user/nwhitehorn/ps3/boot/i386/libi386/pxe.c ============================================================================== --- user/nwhitehorn/ps3/boot/i386/libi386/pxe.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/boot/i386/libi386/pxe.c Mon Sep 6 23:11:56 2010 (r212279) @@ -409,6 +409,7 @@ pxe_perror(int err) * Reach inside the libstand NFS code and dig out an NFS handle * for the root filesystem. */ +#ifdef OLD_NFSV2 struct nfs_iodesc { struct iodesc *iodesc; off_t off; @@ -456,6 +457,64 @@ pxe_setnfshandle(char *rootpath) sprintf(cp, "X"); setenv("boot.nfsroot.nfshandle", buf, 1); } +#else /* !OLD_NFSV2 */ + +#define NFS_V3MAXFHSIZE 64 + +struct nfs_iodesc { + struct iodesc *iodesc; + off_t off; + uint32_t fhsize; + u_char fh[NFS_V3MAXFHSIZE]; + /* structure truncated */ +}; +extern struct nfs_iodesc nfs_root_node; +extern int rpc_port; + +static void +pxe_rpcmountcall() +{ + struct iodesc *d; + int error; + + if (!(d = socktodesc(pxe_sock))) + return; + d->myport = htons(--rpc_port); + d->destip = rootip; + if ((error = nfs_getrootfh(d, rootpath, &nfs_root_node.fhsize, + nfs_root_node.fh)) != 0) { + printf("NFS MOUNT RPC error: %d\n", error); + nfs_root_node.fhsize = 0; + } + nfs_root_node.iodesc = d; +} + +static void +pxe_setnfshandle(char *rootpath) +{ + int i; + u_char *fh; + char buf[2 * NFS_V3MAXFHSIZE + 3], *cp; + + /* + * If NFS files were never opened, we need to do mount call + * ourselves. Use nfs_root_node.iodesc as flag indicating + * previous NFS usage. + */ + if (nfs_root_node.iodesc == NULL) + pxe_rpcmountcall(); + + fh = &nfs_root_node.fh[0]; + buf[0] = 'X'; + cp = &buf[1]; + for (i = 0; i < nfs_root_node.fhsize; i++, cp += 2) + sprintf(cp, "%02x", fh[i]); + sprintf(cp, "X"); + setenv("boot.nfsroot.nfshandle", buf, 1); + sprintf(buf, "%d", nfs_root_node.fhsize); + setenv("boot.nfsroot.nfshandlelen", buf, 1); +} +#endif /* OLD_NFSV2 */ void pxenv_call(int func) Modified: user/nwhitehorn/ps3/boot/i386/loader/Makefile ============================================================================== --- user/nwhitehorn/ps3/boot/i386/loader/Makefile Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/boot/i386/loader/Makefile Mon Sep 6 23:11:56 2010 (r212279) @@ -6,7 +6,7 @@ MK_SSP= no LOADER?= loader PROG= ${LOADER}.sym INTERNALPROG= -NEWVERSWHAT?= "bootstrap loader" i386 +NEWVERSWHAT?= "bootstrap loader" x86 # architecture-specific loader code SRCS= main.c conf.c vers.c Modified: user/nwhitehorn/ps3/boot/i386/zfsloader/Makefile ============================================================================== --- user/nwhitehorn/ps3/boot/i386/zfsloader/Makefile Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/boot/i386/zfsloader/Makefile Mon Sep 6 23:11:56 2010 (r212279) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../loader LOADER= zfsloader -NEWVERSWHAT= "ZFS enabled bootstrap loader" i386 +NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 LOADER_ZFS_SUPPORT=yes LOADER_ONLY= yes NO_MAN= yes Modified: user/nwhitehorn/ps3/boot/ofw/libofw/ofw_copy.c ============================================================================== --- user/nwhitehorn/ps3/boot/ofw/libofw/ofw_copy.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/boot/ofw/libofw/ofw_copy.c Mon Sep 6 23:11:56 2010 (r212279) @@ -68,7 +68,7 @@ ofw_mapmem(vm_offset_t dest, const size_ /* * Trim area covered by existing mapping, if any */ - if (dest < (last_dest + last_len)) { + if (dest < (last_dest + last_len) && dest >= last_dest) { nlen -= (last_dest + last_len) - dest; dest = last_dest + last_len; } Modified: user/nwhitehorn/ps3/boot/pc98/boot2/Makefile ============================================================================== --- user/nwhitehorn/ps3/boot/pc98/boot2/Makefile Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/boot/pc98/boot2/Makefile Mon Sep 6 23:11:56 2010 (r212279) @@ -1,5 +1,12 @@ # $FreeBSD$ +.include + +# XXX: clang can compile the boot code just fine, but boot2 gets too big +.if ${CC:T:Mclang} == "clang" +CC=gcc +.endif + FILES= boot boot1 boot2 NM?= nm Modified: user/nwhitehorn/ps3/boot/pc98/boot2/boot2.c ============================================================================== --- user/nwhitehorn/ps3/boot/pc98/boot2/boot2.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/boot/pc98/boot2/boot2.c Mon Sep 6 23:11:56 2010 (r212279) @@ -187,9 +187,8 @@ xfsread(ino_t inode, void *buf, size_t n static inline uint32_t memsize(void) { - u_char *p = (u_char *)PTOV(0); - - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; + return (*(u_char *)PTOV(0x401) * 128 * 1024 + + *(uint16_t *)PTOV(0x594) * 1024 * 1024); } static inline void Modified: user/nwhitehorn/ps3/cam/ata/ata_da.c ============================================================================== --- user/nwhitehorn/ps3/cam/ata/ata_da.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/cam/ata/ata_da.c Mon Sep 6 23:11:56 2010 (r212279) @@ -874,7 +874,8 @@ adastart(struct cam_periph *periph, unio } bioq_remove(&softc->bio_queue, bp); - if ((softc->flags & ADA_FLAG_NEED_OTAG) != 0) { + if ((bp->bio_flags & BIO_ORDERED) != 0 + || (softc->flags & ADA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~ADA_FLAG_NEED_OTAG; softc->ordered_tag_count++; tag_code = 0; Modified: user/nwhitehorn/ps3/cam/scsi/scsi_da.c ============================================================================== --- user/nwhitehorn/ps3/cam/scsi/scsi_da.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/cam/scsi/scsi_da.c Mon Sep 6 23:11:56 2010 (r212279) @@ -1354,7 +1354,8 @@ dastart(struct cam_periph *periph, union bioq_remove(&softc->bio_queue, bp); - if ((softc->flags & DA_FLAG_NEED_OTAG) != 0) { + if ((bp->bio_flags & BIO_ORDERED) != 0 + || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~DA_FLAG_NEED_OTAG; softc->ordered_tag_count++; tag_code = MSG_ORDERED_Q_TAG; @@ -1368,7 +1369,8 @@ dastart(struct cam_periph *periph, union /*retries*/da_retry_count, /*cbfcnp*/dadone, /*tag_action*/tag_code, - /*read_op*/bp->bio_cmd == BIO_READ, + /*read_op*/bp->bio_cmd + == BIO_READ, /*byte2*/0, softc->minimum_cmd_size, /*lba*/bp->bio_pblkno, @@ -1377,17 +1379,24 @@ dastart(struct cam_periph *periph, union /*data_ptr*/ bp->bio_data, /*dxfer_len*/ bp->bio_bcount, /*sense_len*/SSD_FULL_SIZE, - /*timeout*/da_default_timeout*1000); + da_default_timeout * 1000); break; case BIO_FLUSH: + /* + * BIO_FLUSH doesn't currently communicate + * range data, so we synchronize the cache + * over the whole disk. We also force + * ordered tag semantics the flush applies + * to all previously queued I/O. + */ scsi_synchronize_cache(&start_ccb->csio, /*retries*/1, /*cbfcnp*/dadone, - MSG_SIMPLE_Q_TAG, - /*begin_lba*/0,/* Cover the whole disk */ + MSG_ORDERED_Q_TAG, + /*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE, - /*timeout*/da_default_timeout*1000); + da_default_timeout*1000); break; } start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Sep 6 23:11:56 2010 (r212279) @@ -598,6 +598,7 @@ sendreq: break; case ZIO_TYPE_IOCTL: bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; bp->bio_data = NULL; bp->bio_offset = cp->provider->mediasize; bp->bio_length = 0; Modified: user/nwhitehorn/ps3/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- user/nwhitehorn/ps3/cddl/dev/dtrace/dtrace_load.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/cddl/dev/dtrace/dtrace_load.c Mon Sep 6 23:11:56 2010 (r212279) @@ -163,7 +163,7 @@ dtrace_load(void *dummy) #else dtrace_dev = make_dev(&dtrace_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "dtrace/dtrace"); - helper_dev = make_dev(&helper_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, + helper_dev = make_dev(&helper_cdevsw, 0, UID_ROOT, GID_WHEEL, 0660, "dtrace/helper"); #endif Modified: user/nwhitehorn/ps3/dev/acpi_support/acpi_hp.c ============================================================================== --- user/nwhitehorn/ps3/dev/acpi_support/acpi_hp.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/dev/acpi_support/acpi_hp.c Mon Sep 6 23:11:56 2010 (r212279) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -116,7 +117,6 @@ struct acpi_hp_inst_seq_pair { struct acpi_hp_softc { device_t dev; - ACPI_HANDLE handle; device_t wmi_dev; int has_notify; /* notification GUID found */ int has_cmi; /* CMI GUID found */ @@ -289,6 +289,7 @@ static struct { ACPI_SERIAL_DECL(hp, "HP ACPI-WMI Mapping"); +static void acpi_hp_identify(driver_t *driver, device_t parent); static int acpi_hp_probe(device_t dev); static int acpi_hp_attach(device_t dev); static int acpi_hp_detach(device_t dev); @@ -320,6 +321,7 @@ static struct cdevsw hpcmi_cdevsw = { }; static device_method_t acpi_hp_methods[] = { + DEVMETHOD(device_identify, acpi_hp_identify), DEVMETHOD(device_probe, acpi_hp_probe), DEVMETHOD(device_attach, acpi_hp_attach), DEVMETHOD(device_detach, acpi_hp_detach), @@ -405,7 +407,7 @@ acpi_hp_evaluate_auto_on_off(struct acpi "WLAN on air changed to %i " "(new_wlan_status is %i)\n", sc->was_wlan_on_air, new_wlan_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xc0+sc->was_wlan_on_air); } } @@ -420,7 +422,7 @@ acpi_hp_evaluate_auto_on_off(struct acpi " to %i (new_bluetooth_status is %i)\n", sc->was_bluetooth_on_air, new_bluetooth_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xd0+sc->was_bluetooth_on_air); } } @@ -433,16 +435,43 @@ acpi_hp_evaluate_auto_on_off(struct acpi "WWAN on air changed to %i" " (new_wwan_status is %i)\n", sc->was_wwan_on_air, new_wwan_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xe0+sc->was_wwan_on_air); } } } +static void +acpi_hp_identify(driver_t *driver, device_t parent) +{ + + /* Don't do anything if driver is disabled. */ + if (acpi_disabled("hp")) + return; + + /* Add only a single device instance. */ + if (device_find_child(parent, "acpi_hp", -1) != NULL) + return; + + /* Make sure acpi_wmi driver is present. */ + if (devclass_find("acpi_wmi") == NULL) + return; + + /* + * Add our device with late order, so that it is hopefully + * probed after acpi_wmi. + * XXX User proper constant instead of UINT_MAX for order. + */ + if (BUS_ADD_CHILD(parent, UINT_MAX, "acpi_hp", -1) == NULL) + device_printf(parent, "add acpi_hp child failed\n"); +} + static int acpi_hp_probe(device_t dev) { - if (acpi_disabled("hp") || device_get_unit(dev) != 0) + + /* Skip auto-enumerated devices from ACPI namespace. */ + if (acpi_get_handle(dev) != NULL) return (ENXIO); device_set_desc(dev, "HP ACPI-WMI Mapping"); @@ -460,7 +489,6 @@ acpi_hp_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - sc->handle = acpi_get_handle(dev); sc->has_notify = 0; sc->has_cmi = 0; sc->bluetooth_enable_if_radio_on = 0; @@ -477,7 +505,7 @@ acpi_hp_attach(device_t dev) sc->verbose = 0; memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); - if (!(wmi_devclass = devclass_find ("acpi_wmi"))) { + if (!(wmi_devclass = devclass_find("acpi_wmi"))) { device_printf(dev, "Couldn't find acpi_wmi devclass\n"); return (EINVAL); } Modified: user/nwhitehorn/ps3/dev/acpica/acpi.c ============================================================================== --- user/nwhitehorn/ps3/dev/acpica/acpi.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/dev/acpica/acpi.c Mon Sep 6 23:11:56 2010 (r212279) @@ -1690,10 +1690,10 @@ acpi_probe_order(ACPI_HANDLE handle, int ACPI_OBJECT_TYPE type; /* - * 1. I/O port and memory system resource holders - * 2. Embedded controllers (to handle early accesses) - * 3. PCI Link Devices - * 100000. CPUs + * 1. CPUs + * 2. I/O port and memory system resource holders + * 3. Embedded controllers (to handle early accesses) + * 4. PCI Link Devices */ AcpiGetType(handle, &type); if (type == ACPI_TYPE_PROCESSOR) @@ -1753,8 +1753,7 @@ acpi_probe_child(ACPI_HANDLE handle, UIN * placeholder so that the probe/attach passes will run * breadth-first. Orders less than ACPI_DEV_BASE_ORDER * are reserved for special objects (i.e., system - * resources). CPU devices have a very high order to - * ensure they are probed after other devices. + * resources). */ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "scanning '%s'\n", handle_str)); order = level * 10 + 100; Modified: user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c ============================================================================== --- user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c Mon Sep 6 23:11:56 2010 (r212279) @@ -74,6 +74,7 @@ struct hpet_softc { int irq; int useirq; int legacy_route; + uint32_t allowed_irqs; struct resource *mem_res; struct resource *intr_res; void *intr_handle; @@ -146,7 +147,7 @@ hpet_start(struct eventtimer *et, struct hpet_timer *mt = (struct hpet_timer *)et->et_priv; struct hpet_timer *t; struct hpet_softc *sc = mt->sc; - uint32_t fdiv; + uint32_t fdiv, cmp; t = (mt->pcpu_master < 0) ? mt : &sc->t[mt->pcpu_slaves[curcpu]]; if (period != NULL) { @@ -164,23 +165,31 @@ hpet_start(struct eventtimer *et, fdiv += sc->freq * first->sec; } else fdiv = t->div; + if (t->irq < 0) + bus_write_4(sc->mem_res, HPET_ISR, 1 << t->num); + t->caps |= HPET_TCNF_INT_ENB; t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); +restart: + cmp = t->last + fdiv; if (t->mode == 1 && (t->caps & HPET_TCAP_PER_INT)) { t->caps |= HPET_TCNF_TYPE; bus_write_4(sc->mem_res, HPET_TIMER_CAP_CNF(t->num), t->caps | HPET_TCNF_VAL_SET); - bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), - t->last + fdiv); - bus_read_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num)); - bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), - t->div); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), cmp); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), t->div); } else { - bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), - t->last + fdiv); + t->caps &= ~HPET_TCNF_TYPE; + bus_write_4(sc->mem_res, HPET_TIMER_CAP_CNF(t->num), t->caps); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), cmp); + } + if (fdiv < 5000) { + bus_read_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num)); + t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); + if ((int32_t)(t->last - cmp) < 0) { + fdiv *= 2; + goto restart; + } } - t->caps |= HPET_TCNF_INT_ENB; - bus_write_4(sc->mem_res, HPET_ISR, 1 << t->num); - bus_write_4(sc->mem_res, HPET_TIMER_CAP_CNF(t->num), t->caps); return (0); } @@ -321,7 +330,7 @@ hpet_attach(device_t dev) int i, j, num_msi, num_timers, num_percpu_et, num_percpu_t, cur_cpu; int pcpu_master; static int maxhpetet = 0; - uint32_t val, val2, cvectors; + uint32_t val, val2, cvectors, dvectors; uint16_t vendor, rev; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -438,10 +447,9 @@ hpet_attach(device_t dev) sc->t[1].vectors = 0; } - num_msi = 0; - sc->useirq = 0; - /* Find common legacy IRQ vectors for all timers. */ - cvectors = 0xffff0000; + /* Check what IRQs we want use. */ + /* By default allow any PCI IRQs. */ + sc->allowed_irqs = 0xffff0000; /* * HPETs in AMD chipsets before SB800 have problems with IRQs >= 16 * Lower are also not always working for different reasons. @@ -450,7 +458,25 @@ hpet_attach(device_t dev) * interrupt loss. Avoid legacy IRQs for AMD. */ if (vendor == HPET_VENDID_AMD) - cvectors = 0x00000000; + sc->allowed_irqs = 0x00000000; + /* + * Neither QEMU nor VirtualBox report supported IRQs correctly. + * The only way to use HPET there is to specify IRQs manually + * and/or use legacy_route. Legacy_route mode work on both. + */ + if (vm_guest) + sc->allowed_irqs = 0x00000000; + /* Let user override. */ + resource_int_value(device_get_name(dev), device_get_unit(dev), + "allowed_irqs", &sc->allowed_irqs); + + num_msi = 0; + sc->useirq = 0; + /* Find IRQ vectors for all timers. */ + cvectors = sc->allowed_irqs & 0xffff0000; + dvectors = sc->allowed_irqs & 0x0000ffff; + if (sc->legacy_route) + dvectors &= 0x0000fefe; for (i = 0; i < num_timers; i++) { t = &sc->t[i]; if (sc->legacy_route && i < 2) @@ -465,6 +491,10 @@ hpet_attach(device_t dev) } } #endif + else if (dvectors & t->vectors) { + t->irq = ffs(dvectors & t->vectors) - 1; + dvectors &= ~(1 << t->irq); + } if (t->irq >= 0) { if (!(t->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, &t->intr_rid, @@ -495,7 +525,7 @@ hpet_attach(device_t dev) if (sc->legacy_route) hpet_enable(sc); /* Group timers for per-CPU operation. */ - num_percpu_et = min(num_msi / mp_ncpus, 2); + num_percpu_et = min(num_msi / mp_ncpus, 1); num_percpu_t = num_percpu_et * mp_ncpus; pcpu_master = 0; cur_cpu = CPU_FIRST(); @@ -510,7 +540,8 @@ hpet_attach(device_t dev) bus_bind_intr(dev, t->intr_res, cur_cpu); cur_cpu = CPU_NEXT(cur_cpu); num_percpu_t--; - } + } else if (t->irq >= 0) + bus_bind_intr(dev, t->intr_res, CPU_FIRST()); } bus_write_4(sc->mem_res, HPET_ISR, 0xffffffff); sc->irq = -1; @@ -545,7 +576,7 @@ hpet_attach(device_t dev) /* Legacy route doesn't need more configuration. */ } else #ifdef DEV_APIC - if (t->irq >= 0) { + if ((t->caps & HPET_TCAP_FSB_INT_DEL) && t->irq >= 0) { uint64_t addr; uint32_t data; @@ -561,7 +592,9 @@ hpet_attach(device_t dev) t->irq = -2; } else #endif - if (sc->irq >= 0 && (t->vectors & (1 << sc->irq))) + if (t->irq >= 0) + t->caps |= (t->irq << 9); + else if (sc->irq >= 0 && (t->vectors & (1 << sc->irq))) t->caps |= (sc->irq << 9) | HPET_TCNF_INT_TYPE; bus_write_4(sc->mem_res, HPET_TIMER_CAP_CNF(i), t->caps); /* Skip event timers without set up IRQ. */ @@ -585,7 +618,7 @@ hpet_attach(device_t dev) t->et.et_quality -= 10; t->et.et_frequency = sc->freq; t->et.et_min_period.sec = 0; - t->et.et_min_period.frac = 0x00004000LLU << 32; + t->et.et_min_period.frac = 0x00008000LLU << 32; t->et.et_max_period.sec = 0xfffffffeLLU / sc->freq; t->et.et_max_period.frac = ((0xfffffffeLLU << 32) / sc->freq) << 32; Modified: user/nwhitehorn/ps3/dev/ata/ata-all.h ============================================================================== --- user/nwhitehorn/ps3/dev/ata/ata-all.h Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/dev/ata/ata-all.h Mon Sep 6 23:11:56 2010 (r212279) @@ -565,6 +565,7 @@ struct ata_channel { #define ATA_NO_ATAPI_DMA 0x40 #define ATA_SATA 0x80 #define ATA_DMA_BEFORE_CMD 0x100 +#define ATA_KNOWN_PRESENCE 0x200 int pm_level; /* power management level */ int devices; /* what is present */ Modified: user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c ============================================================================== --- user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c Mon Sep 6 23:11:56 2010 (r212279) @@ -474,7 +474,8 @@ ata_generic_reset(device_t dev) ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_MASTER)); DELAY(10); ostat0 = ATA_IDX_INB(ch, ATA_STATUS); - if ((ostat0 & 0xf8) != 0xf8 && ostat0 != 0xa5) { + if (((ostat0 & 0xf8) != 0xf8 || (ch->flags & ATA_KNOWN_PRESENCE)) && + ostat0 != 0xa5) { stat0 = ATA_S_BUSY; mask |= 0x01; } @@ -484,7 +485,8 @@ ata_generic_reset(device_t dev) ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_SLAVE)); DELAY(10); ostat1 = ATA_IDX_INB(ch, ATA_STATUS); - if ((ostat1 & 0xf8) != 0xf8 && ostat1 != 0xa5) { + if (((ostat1 & 0xf8) != 0xf8 || (ch->flags & ATA_KNOWN_PRESENCE)) && + ostat1 != 0xa5) { stat1 = ATA_S_BUSY; mask |= 0x02; } @@ -570,22 +572,16 @@ ata_generic_reset(device_t dev) } } - if (mask == 0x00) /* nothing to wait for */ - break; - if (mask == 0x01) /* wait for master only */ - if (!(stat0 & ATA_S_BUSY) || (stat0 == 0xff && timeout > 10)) - break; - if (mask == 0x02) /* wait for slave only */ - if (!(stat1 & ATA_S_BUSY) || (stat1 == 0xff && timeout > 10)) - break; - if (mask == 0x03) { /* wait for both master & slave */ - if (!(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY)) - break; - if ((stat0 == 0xff) && (timeout > 20)) - mask &= ~0x01; - if ((stat1 == 0xff) && (timeout > 20)) - mask &= ~0x02; + if ((ch->flags & ATA_KNOWN_PRESENCE) == 0 && + timeout > ((mask == 0x03) ? 20 : 10)) { + if ((mask & 0x01) && stat0 == 0xff) + mask &= ~0x01; + if ((mask & 0x02) && stat1 == 0xff) + mask &= ~0x02; } + if (((mask & 0x01) == 0 || !(stat0 & ATA_S_BUSY)) && + ((mask & 0x02) == 0 || !(stat1 & ATA_S_BUSY))) + break; ata_udelay(100000); } Modified: user/nwhitehorn/ps3/dev/ata/chipsets/ata-ahci.c ============================================================================== --- user/nwhitehorn/ps3/dev/ata/chipsets/ata-ahci.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/dev/ata/chipsets/ata-ahci.c Mon Sep 6 23:11:56 2010 (r212279) @@ -815,7 +815,7 @@ ata_ahci_hardreset(device_t dev, int por if (!ata_sata_phy_reset(dev, port, 0)) return (ENOENT); /* Wait for clearing busy status. */ - if (ata_ahci_wait_ready(dev, 10000)) { + if (ata_ahci_wait_ready(dev, 15000)) { device_printf(dev, "hardware reset timeout\n"); return (EBUSY); } Modified: user/nwhitehorn/ps3/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- user/nwhitehorn/ps3/dev/ata/chipsets/ata-siliconimage.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/dev/ata/chipsets/ata-siliconimage.c Mon Sep 6 23:11:56 2010 (r212279) @@ -316,6 +316,7 @@ ata_sii_ch_attach(device_t dev) ch->r_io[ATA_SCONTROL].offset = 0x100 + (unit01 << 7) + (unit10 << 8); ch->flags |= ATA_NO_SLAVE; ch->flags |= ATA_SATA; + ch->flags |= ATA_KNOWN_PRESENCE; /* enable PHY state change interrupt */ ATA_OUTL(ctlr->r_res2, 0x148 + (unit01 << 7) + (unit10 << 8),(1 << 16)); @@ -364,7 +365,15 @@ ata_sii_status(device_t dev) static void ata_sii_reset(device_t dev) { + struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); + int offset = ((ch->unit & 1) << 7) + ((ch->unit & 2) << 8); + uint32_t val; + + /* Apply R_ERR on DMA activate FIS errata workaround. */ + val = ATA_INL(ctlr->r_res2, 0x14c + offset); + if ((val & 0x3) == 0x1) + ATA_OUTL(ctlr->r_res2, 0x14c + offset, val & ~0x3); if (ata_sata_phy_reset(dev, -1, 1)) ata_generic_reset(dev); Modified: user/nwhitehorn/ps3/dev/bge/if_bge.c ============================================================================== --- user/nwhitehorn/ps3/dev/bge/if_bge.c Mon Sep 6 23:07:58 2010 (r212278) +++ user/nwhitehorn/ps3/dev/bge/if_bge.c Mon Sep 6 23:11:56 2010 (r212279) @@ -355,8 +355,10 @@ static int bge_suspend(device_t); static int bge_resume(device_t); static void bge_release_resources(struct bge_softc *); static void bge_dma_map_addr(void *, bus_dma_segment_t *, int, int); -static int bge_dma_alloc(device_t); +static int bge_dma_alloc(struct bge_softc *); static void bge_dma_free(struct bge_softc *); +static int bge_dma_ring_alloc(struct bge_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]); static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]); @@ -614,13 +616,9 @@ bge_dma_map_addr(void *arg, bus_dma_segm if (error) return; - ctx = arg; - - if (nseg > ctx->bge_maxsegs) { - ctx->bge_maxsegs = 0; - return; - } + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + ctx = arg; ctx->bge_busaddr = segs->ds_addr; } @@ -2122,27 +2120,84 @@ bge_dma_free(struct bge_softc *sc) if (sc->bge_cdata.bge_stats_tag) bus_dma_tag_destroy(sc->bge_cdata.bge_stats_tag); + if (sc->bge_cdata.bge_buffer_tag) + bus_dma_tag_destroy(sc->bge_cdata.bge_buffer_tag); + /* Destroy the parent tag. */ if (sc->bge_cdata.bge_parent_tag) bus_dma_tag_destroy(sc->bge_cdata.bge_parent_tag); } static int -bge_dma_alloc(device_t dev) +bge_dma_ring_alloc(struct bge_softc *sc, bus_size_t alignment, + bus_size_t maxsize, bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, + bus_addr_t *paddr, const char *msg) { struct bge_dmamap_arg ctx; - struct bge_softc *sc; bus_addr_t lowaddr; - bus_size_t sbsz, txsegsz, txmaxsegsz; - int i, error; + bus_size_t ring_end; + int error; - sc = device_get_softc(dev); + lowaddr = BUS_SPACE_MAXADDR; +again: + error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, + alignment, 0, lowaddr, BUS_SPACE_MAXADDR, NULL, + NULL, maxsize, 1, maxsize, 0, NULL, NULL, tag); + if (error != 0) { + device_printf(sc->bge_dev, + "could not create %s dma tag\n", msg); + return (ENOMEM); + } + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->bge_dev, + "could not allocate DMA'able memory for %s\n", msg); + return (ENOMEM); + } + /* Load the address of the ring. */ + ctx.bge_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, bge_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->bge_dev, + "could not load DMA'able memory for %s\n", msg); + return (ENOMEM); + } + *paddr = ctx.bge_busaddr; + ring_end = *paddr + maxsize; + if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0 && + BGE_ADDR_HI(*paddr) != BGE_ADDR_HI(ring_end)) { + /* + * 4GB boundary crossed. Limit maximum allowable DMA + * address space to 32bit and try again. + */ + bus_dmamap_unload(*tag, *map); + bus_dmamem_free(*tag, *ring, *map); + bus_dma_tag_destroy(*tag); + if (bootverbose) + device_printf(sc->bge_dev, "4GB boundary crossed, " + "limit DMA address space to 32bit for %s\n", msg); + *ring = NULL; + *tag = NULL; + *map = NULL; + lowaddr = BUS_SPACE_MAXADDR_32BIT; + goto again; + } + return (0); +} + +static int +bge_dma_alloc(struct bge_softc *sc) +{ + bus_addr_t lowaddr; + bus_size_t boundary, sbsz, txsegsz, txmaxsegsz; + int i, error; lowaddr = BUS_SPACE_MAXADDR; if ((sc->bge_flags & BGE_FLAG_40BIT_BUG) != 0) lowaddr = BGE_DMA_MAXADDR; - if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0) - lowaddr = BUS_SPACE_MAXADDR_32BIT; /* * Allocate the parent bus DMA tag appropriate for PCI. */ @@ -2150,16 +2205,84 @@ bge_dma_alloc(device_t dev) 1, 0, lowaddr, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->bge_cdata.bge_parent_tag); - if (error != 0) { device_printf(sc->bge_dev, "could not allocate parent dma tag\n"); return (ENOMEM); } + /* Create tag for standard RX ring. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_STD_RX_RING_SZ, + &sc->bge_cdata.bge_rx_std_ring_tag, + (uint8_t **)&sc->bge_ldata.bge_rx_std_ring, + &sc->bge_cdata.bge_rx_std_ring_map, + &sc->bge_ldata.bge_rx_std_ring_paddr, "RX ring"); + if (error) + return (error); + + /* Create tag for RX return ring. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_RX_RTN_RING_SZ(sc), + &sc->bge_cdata.bge_rx_return_ring_tag, + (uint8_t **)&sc->bge_ldata.bge_rx_return_ring, + &sc->bge_cdata.bge_rx_return_ring_map, + &sc->bge_ldata.bge_rx_return_ring_paddr, "RX return ring"); + if (error) + return (error); + + /* Create tag for TX ring. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_TX_RING_SZ, + &sc->bge_cdata.bge_tx_ring_tag, + (uint8_t **)&sc->bge_ldata.bge_tx_ring, + &sc->bge_cdata.bge_tx_ring_map, + &sc->bge_ldata.bge_tx_ring_paddr, "TX ring"); + if (error) + return (error); + /* - * Create tag for Tx mbufs. + * Create tag for status block. + * Because we only use single Tx/Rx/Rx return ring, use + * minimum status block size except BCM5700 AX/BX which + * seems to want to see full status block size regardless + * of configured number of ring. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && + sc->bge_chipid != BGE_CHIPID_BCM5700_C0) + sbsz = BGE_STATUS_BLK_SZ; + else + sbsz = 32; + error = bge_dma_ring_alloc(sc, PAGE_SIZE, sbsz, + &sc->bge_cdata.bge_status_tag, + (uint8_t **)&sc->bge_ldata.bge_status_block, + &sc->bge_cdata.bge_status_map, + &sc->bge_ldata.bge_status_block_paddr, "status block"); + if (error) + return (error); + + /* Create tag for jumbo RX ring. */ + if (BGE_IS_JUMBO_CAPABLE(sc)) { + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_JUMBO_RX_RING_SZ, + &sc->bge_cdata.bge_rx_jumbo_ring_tag, + (uint8_t **)&sc->bge_ldata.bge_rx_jumbo_ring, + &sc->bge_cdata.bge_rx_jumbo_ring_map, + &sc->bge_ldata.bge_rx_jumbo_ring_paddr, "jumbo RX ring"); + if (error) + return (error); + } + + /* Create parent tag for buffers. */ + boundary = 0; + if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0) + boundary = BGE_DMA_BNDRY; + error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), + 1, boundary, lowaddr, BUS_SPACE_MAXADDR, NULL, + NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, + 0, NULL, NULL, &sc->bge_cdata.bge_buffer_tag); + if (error != 0) { + device_printf(sc->bge_dev, + "could not allocate buffer dma tag\n"); + return (ENOMEM); + } + /* Create tag for Tx mbufs. */ if (sc->bge_flags & BGE_FLAG_TSO) { txsegsz = BGE_TSOSEG_SZ; txmaxsegsz = 65535 + sizeof(struct ether_vlan_header); @@ -2167,7 +2290,7 @@ bge_dma_alloc(device_t dev) txsegsz = MCLBYTES; txmaxsegsz = MCLBYTES * BGE_NSEG_NEW; } - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1, + error = bus_dma_tag_create(sc->bge_cdata.bge_buffer_tag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, txmaxsegsz, BGE_NSEG_NEW, txsegsz, 0, NULL, NULL, &sc->bge_cdata.bge_tx_mtag); @@ -2177,10 +2300,8 @@ bge_dma_alloc(device_t dev) return (ENOMEM); } - /* - * Create tag for Rx mbufs. - */ - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1, 0, + /* Create tag for Rx mbufs. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Sep 6 23:52:04 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE50F10656B0; Mon, 6 Sep 2010 23:52:04 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCDCE8FC08; Mon, 6 Sep 2010 23:52:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o86Nq4LA071555; Mon, 6 Sep 2010 23:52:04 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86Nq4gr071551; Mon, 6 Sep 2010 23:52:04 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009062352.o86Nq4gr071551@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 23:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212280 - in user/weongyo/usb/sys: dev/usb modules/usb/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 23:52:05 -0000 Author: weongyo Date: Mon Sep 6 23:52:04 2010 New Revision: 212280 URL: http://svn.freebsd.org/changeset/base/212280 Log: Adds `sleepout' prototype which is a comic combination of callout(9) and taskqueue(8) only for USB drivers to implement one step timer. In current USB drivers using callout(9) interface they all have two step execution flow as follows: 1. callout callback is fired by the interrupt context. Then it needs to pass it to USB process context because it could sleep(!) while callout(9) don't allow it. 2. In the USB process context it operates USB commands that most of times it'd be blocked at least 125 us (it'd be always true for USB) In a view of driver developer it'd be more convenient if USB stack has a feature like this (timer supporting blocking). This's an experimental. Added: user/weongyo/usb/sys/dev/usb/usb_sleepout.c (contents, props changed) user/weongyo/usb/sys/dev/usb/usb_sleepout.h (contents, props changed) Modified: user/weongyo/usb/sys/modules/usb/usb/Makefile Added: user/weongyo/usb/sys/dev/usb/usb_sleepout.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/weongyo/usb/sys/dev/usb/usb_sleepout.c Mon Sep 6 23:52:04 2010 (r212280) @@ -0,0 +1,123 @@ +/*- + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include +#include + +#include + +void +sleepout_create(struct sleepout *s, const char *name) +{ + + s->s_taskqueue = taskqueue_create(name, M_WAITOK, + taskqueue_thread_enqueue, &s->s_taskqueue); + /* XXX adjusts the priority. */ + taskqueue_start_threads(&s->s_taskqueue, 1, PI_NET, "%s sleepout", + name); +} + +void +sleepout_free(struct sleepout *s) +{ + + taskqueue_free(s->s_taskqueue); +} + +static void +_sleepout_taskqueue_callback(void *arg, int pending) +{ + struct sleepout_task *st = arg; + + (void)pending; + + if (st->st_mtx != NULL) + mtx_lock(st->st_mtx); + + st->st_func(st->st_arg); + + if (st->st_mtx != NULL) + mtx_unlock(st->st_mtx); +} + +void +sleepout_init(struct sleepout *s, struct sleepout_task *st, int mpsafe) +{ + + st->st_sleepout = s; + callout_init(&st->st_callout, mpsafe); + TASK_INIT(&st->st_task, 0, _sleepout_taskqueue_callback, st); + st->st_mtx = NULL; +} + +void +sleepout_init_mtx(struct sleepout *s, struct sleepout_task *st, struct mtx *mtx, + int flags) +{ + + st->st_sleepout = s; + callout_init_mtx(&st->st_callout, mtx, flags); + TASK_INIT(&st->st_task, 0, _sleepout_taskqueue_callback, st); + st->st_mtx = mtx; +} + +static void +_sleepout_callout_callback(void *arg) +{ + struct sleepout_task *st = arg; + struct sleepout *s = st->st_sleepout; + + taskqueue_enqueue(s->s_taskqueue, &st->st_task); +} + +int +sleepout_reset(struct sleepout_task *st, int to_ticks, sleepout_func_t ftn, + void *arg) +{ + + st->st_func = ftn; + st->st_arg = arg; + return (callout_reset(&st->st_callout, to_ticks, + _sleepout_callout_callback, st)); +} + +int +sleepout_pending(struct sleepout_task *st) +{ + + return (callout_pending(&st->st_callout)); +} + +int +sleepout_stop(struct sleepout_task *st) +{ + + return (callout_stop(&st->st_callout)); +} + +int +sleepout_drain(struct sleepout_task *st) +{ + struct sleepout *s = st->st_sleepout; + + taskqueue_drain(s->s_taskqueue, &st->st_task); + return (callout_drain(&st->st_callout)); + +} Added: user/weongyo/usb/sys/dev/usb/usb_sleepout.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/weongyo/usb/sys/dev/usb/usb_sleepout.h Mon Sep 6 23:52:04 2010 (r212280) @@ -0,0 +1,48 @@ +/*- + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef _USB_SLEEPOUT_H_ +#define _USB_SLEEPOUT_H_ + +#include +#include + +struct sleepout { + struct taskqueue *s_taskqueue; +}; + +typedef void (*sleepout_func_t)(void *); + +struct sleepout_task { + struct sleepout *st_sleepout; + struct callout st_callout; + struct task st_task; + struct mtx *st_mtx; + sleepout_func_t st_func; + void *st_arg; +}; + +void sleepout_create(struct sleepout *, const char *); +void sleepout_free(struct sleepout *); +void sleepout_init(struct sleepout *, struct sleepout_task *, int); +void sleepout_init_mtx(struct sleepout *, struct sleepout_task *, + struct mtx *, int); +int sleepout_reset(struct sleepout_task *, int, sleepout_func_t, void *); +int sleepout_pending(struct sleepout_task *); +int sleepout_stop(struct sleepout_task *); +int sleepout_drain(struct sleepout_task *); + +#endif Modified: user/weongyo/usb/sys/modules/usb/usb/Makefile ============================================================================== --- user/weongyo/usb/sys/modules/usb/usb/Makefile Mon Sep 6 23:11:56 2010 (r212279) +++ user/weongyo/usb/sys/modules/usb/usb/Makefile Mon Sep 6 23:52:04 2010 (r212280) @@ -33,10 +33,11 @@ KMOD= usb SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ opt_usb.h opt_bus.h opt_ddb.h \ usbdevs.h usbdevs_data.h \ + usb_sleepout.h \ usb_busdma.c usb_controller.c usb_compat_linux.c usb_core.c usb_debug.c \ usb_dev.c usb_device.c usb_dynamic.c usb_error.c usb_generic.c \ usb_handle_request.c usb_hid.c usb_hub.c usb_lookup.c usb_mbuf.c \ usb_msctest.c usb_parse.c usb_process.c usb_request.c \ - usb_transfer.c usb_util.c + usb_sleepout.c usb_transfer.c usb_util.c .include From owner-svn-src-user@FreeBSD.ORG Wed Sep 8 20:00:15 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9A3E10656CC; Wed, 8 Sep 2010 20:00:15 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97CF08FC17; Wed, 8 Sep 2010 20:00:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o88K0FCE068191; Wed, 8 Sep 2010 20:00:15 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88K0Ff5068188; Wed, 8 Sep 2010 20:00:15 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009082000.o88K0Ff5068188@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 8 Sep 2010 20:00:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212334 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 20:00:15 -0000 Author: weongyo Date: Wed Sep 8 20:00:15 2010 New Revision: 212334 URL: http://svn.freebsd.org/changeset/base/212334 Log: No more uether module dependancy and ue[0-9+] interface name on axe(4). In my personal opinion I don't think that uether module gives benefits to USB stack though it existed on the tree about 10 years. After 8.0 release I think it becomes worse than before. As further works, changes of other USB ethernet drivers would be happen soon. Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/if_axereg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Wed Sep 8 19:53:16 2010 (r212333) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Wed Sep 8 20:00:15 2010 (r212334) @@ -89,6 +89,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -96,6 +98,19 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include +#include + +#include "miibus_if.h" + +#include +#include + #include #include #include @@ -104,8 +119,8 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR axe_debug #include #include +#include -#include #include /* @@ -177,20 +192,20 @@ static miibus_readreg_t axe_miibus_readr static miibus_writereg_t axe_miibus_writereg; static miibus_statchg_t axe_miibus_statchg; -static uether_fn_t axe_attach_post; -static uether_fn_t axe_init; -static uether_fn_t axe_stop; -static uether_fn_t axe_start; -static uether_fn_t axe_tick; -static uether_fn_t axe_setmulti; -static uether_fn_t axe_setpromisc; - static int axe_ifmedia_upd(struct ifnet *); static void axe_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int axe_cmd(struct axe_softc *, int, int, int, void *); static void axe_ax88178_init(struct axe_softc *); static void axe_ax88772_init(struct axe_softc *); static int axe_get_phyno(struct axe_softc *, int); +static void axe_watchdog(void *); +static void axe_init(void *); +static void axe_init_locked(struct axe_softc *); +static int axe_ioctl(struct ifnet *, u_long, caddr_t); +static void axe_start(struct ifnet *); +static void axe_tick(struct axe_softc *); +static void axe_stop(struct axe_softc *); +static void axe_setmulti_locked(struct axe_softc *); static const struct usb_config axe_config[AXE_N_TRANSFER] = { @@ -252,23 +267,18 @@ static devclass_t axe_devclass; DRIVER_MODULE(axe, uhub, axe_driver, axe_devclass, NULL, 0); DRIVER_MODULE(miibus, axe, miibus_driver, miibus_devclass, 0, 0); -MODULE_DEPEND(axe, uether, 1, 1, 1); MODULE_DEPEND(axe, usb, 1, 1, 1); MODULE_DEPEND(axe, ether, 1, 1, 1); MODULE_DEPEND(axe, miibus, 1, 1, 1); MODULE_VERSION(axe, 1); -static const struct usb_ether_methods axe_ue_methods = { - .ue_attach_post = axe_attach_post, - .ue_start = axe_start, - .ue_init = axe_init, - .ue_stop = axe_stop, - .ue_tick = axe_tick, - .ue_setmulti = axe_setmulti, - .ue_setpromisc = axe_setpromisc, - .ue_mii_upd = axe_ifmedia_upd, - .ue_mii_sts = axe_ifmedia_sts, -}; +static uint8_t +axe_pause(struct axe_softc *sc, unsigned int _ticks) +{ + + usb_pause_mtx(&sc->sc_mtx, _ticks); + return (0); +} static int axe_cmd(struct axe_softc *sc, int cmd, int index, int val, void *buf) @@ -286,7 +296,8 @@ axe_cmd(struct axe_softc *sc, int cmd, i USETW(req.wIndex, index); USETW(req.wLength, AXE_CMD_LEN(cmd)); - err = uether_do_request(&sc->sc_ue, &req, buf, 1000); + err = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, buf, 0, + NULL, 1000); return (err); } @@ -362,7 +373,7 @@ axe_miibus_statchg(device_t dev) if (!locked) AXE_LOCK(sc); - ifp = uether_getifp(&sc->sc_ue); + ifp = sc->sc_ifp; if (mii == NULL || ifp == NULL || (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) goto done; @@ -426,8 +437,7 @@ axe_ifmedia_upd(struct ifnet *ifp) struct mii_data *mii = GET_MII(sc); int error; - AXE_LOCK_ASSERT(sc, MA_OWNED); - + AXE_LOCK(sc); if (mii->mii_instance) { struct mii_softc *miisc; @@ -435,6 +445,7 @@ axe_ifmedia_upd(struct ifnet *ifp) mii_phy_reset(miisc); } error = mii_mediachg(mii); + AXE_UNLOCK(sc); return (error); } @@ -455,10 +466,19 @@ axe_ifmedia_sts(struct ifnet *ifp, struc } static void -axe_setmulti(struct usb_ether *ue) +axe_setmulti(void *arg, int npending) { - struct axe_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct axe_softc *sc = arg; + + AXE_LOCK(sc); + axe_setmulti_locked(sc); + AXE_UNLOCK(sc); +} + +static void +axe_setmulti_locked(struct axe_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; struct ifmultiaddr *ifma; uint32_t h = 0; uint16_t rxmode; @@ -517,17 +537,15 @@ axe_get_phyno(struct axe_softc *sc, int #define AXE_GPIO_WRITE(x, y) do { \ axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, (x), NULL); \ - uether_pause(ue, (y)); \ + axe_pause(sc, (y)); \ } while (0) static void axe_ax88178_init(struct axe_softc *sc) { - struct usb_ether *ue; int gpio0, phymode; uint16_t eeprom, val; - ue = &sc->sc_ue; axe_cmd(sc, AXE_CMD_SROM_WR_ENABLE, 0, 0, NULL); /* XXX magic */ axe_cmd(sc, AXE_CMD_SROM_READ, 0, 0x0017, &eeprom); @@ -544,7 +562,7 @@ axe_ax88178_init(struct axe_softc *sc) } if (bootverbose) - device_printf(sc->sc_ue.ue_dev, "EEPROM data : 0x%04x\n", + device_printf(sc->sc_dev, "EEPROM data : 0x%04x\n", eeprom); /* Program GPIOs depending on PHY hardware. */ switch (phymode) { @@ -588,15 +606,15 @@ axe_ax88178_init(struct axe_softc *sc) AXE_GPIO_WRITE(val | AXE_GPIO2_EN, hz / 4); AXE_GPIO_WRITE(val | AXE_GPIO2 | AXE_GPIO2_EN, hz / 32); if (phymode == AXE_PHY_MODE_REALTEK_8211CL) { - axe_miibus_writereg(ue->ue_dev, sc->sc_phyno, + axe_miibus_writereg(sc->sc_dev, sc->sc_phyno, 0x1F, 0x0005); - axe_miibus_writereg(ue->ue_dev, sc->sc_phyno, + axe_miibus_writereg(sc->sc_dev, sc->sc_phyno, 0x0C, 0x0000); - val = axe_miibus_readreg(ue->ue_dev, sc->sc_phyno, + val = axe_miibus_readreg(sc->sc_dev, sc->sc_phyno, 0x0001); - axe_miibus_writereg(ue->ue_dev, sc->sc_phyno, + axe_miibus_writereg(sc->sc_dev, sc->sc_phyno, 0x01, val | 0x0080); - axe_miibus_writereg(ue->ue_dev, sc->sc_phyno, + axe_miibus_writereg(sc->sc_dev, sc->sc_phyno, 0x1F, 0x0000); } break; @@ -607,14 +625,14 @@ axe_ax88178_init(struct axe_softc *sc) /* soft reset */ axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_CLEAR, NULL); - uether_pause(ue, hz / 4); + axe_pause(sc, hz / 4); axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_PRL | AXE_178_RESET_MAGIC, NULL); - uether_pause(ue, hz / 4); + axe_pause(sc, hz / 4); /* Enable MII/GMII/RGMII interface to work with external PHY. */ axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, 0, NULL); - uether_pause(ue, hz / 4); + axe_pause(sc, hz / 4); axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL); } @@ -624,22 +642,22 @@ static void axe_ax88772_init(struct axe_softc *sc) { axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x00b0, NULL); - uether_pause(&sc->sc_ue, hz / 16); + axe_pause(sc, hz / 16); if (sc->sc_phyno == AXE_772_PHY_NO_EPHY) { /* ask for the embedded PHY */ axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, 0x01, NULL); - uether_pause(&sc->sc_ue, hz / 64); + axe_pause(sc, hz / 64); /* power down and reset state, pin reset state */ axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_CLEAR, NULL); - uether_pause(&sc->sc_ue, hz / 16); + axe_pause(sc, hz / 16); /* power down/reset state, pin operating state */ axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_IPPD | AXE_SW_RESET_PRL, NULL); - uether_pause(&sc->sc_ue, hz / 4); + axe_pause(sc, hz / 4); /* power up, reset */ axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_PRL, NULL); @@ -650,14 +668,14 @@ axe_ax88772_init(struct axe_softc *sc) } else { /* ask for external PHY */ axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, 0x00, NULL); - uether_pause(&sc->sc_ue, hz / 64); + axe_pause(sc, hz / 64); /* power down internal PHY */ axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_IPPD | AXE_SW_RESET_PRL, NULL); } - uether_pause(&sc->sc_ue, hz / 4); + axe_pause(sc, hz / 4); axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL); } @@ -667,34 +685,33 @@ axe_reset(struct axe_softc *sc) struct usb_config_descriptor *cd; usb_error_t err; - cd = usbd_get_config_descriptor(sc->sc_ue.ue_udev); + cd = usbd_get_config_descriptor(sc->sc_udev); - err = usbd_req_set_config(sc->sc_ue.ue_udev, &sc->sc_mtx, + err = usbd_req_set_config(sc->sc_udev, &sc->sc_mtx, cd->bConfigurationValue); if (err) DPRINTF("reset failed (ignored)\n"); /* Wait a little while for the chip to get its brains in order. */ - uether_pause(&sc->sc_ue, hz / 100); + axe_pause(sc, hz / 100); } static void -axe_attach_post(struct usb_ether *ue) +axe_attach_post(struct axe_softc *sc) { - struct axe_softc *sc = uether_getsc(ue); /* * Load PHY indexes first. Needed by axe_xxx_init(). */ axe_cmd(sc, AXE_CMD_READ_PHYID, 0, 0, sc->sc_phyaddrs); if (bootverbose) - device_printf(sc->sc_ue.ue_dev, "PHYADDR 0x%02x:0x%02x\n", + device_printf(sc->sc_dev, "PHYADDR 0x%02x:0x%02x\n", sc->sc_phyaddrs[0], sc->sc_phyaddrs[1]); sc->sc_phyno = axe_get_phyno(sc, AXE_PHY_SEL_PRI); if (sc->sc_phyno == -1) sc->sc_phyno = axe_get_phyno(sc, AXE_PHY_SEL_SEC); if (sc->sc_phyno == -1) { - device_printf(sc->sc_ue.ue_dev, + device_printf(sc->sc_dev, "no valid PHY address found, assuming PHY address 0\n"); sc->sc_phyno = 0; } @@ -708,9 +725,9 @@ axe_attach_post(struct usb_ether *ue) * Get station address. */ if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) - axe_cmd(sc, AXE_178_CMD_READ_NODEID, 0, 0, ue->ue_eaddr); + axe_cmd(sc, AXE_178_CMD_READ_NODEID, 0, 0, sc->sc_eaddr); else - axe_cmd(sc, AXE_172_CMD_READ_NODEID, 0, 0, ue->ue_eaddr); + axe_cmd(sc, AXE_172_CMD_READ_NODEID, 0, 0, sc->sc_eaddr); /* * Fetch IPG values. @@ -736,6 +753,19 @@ axe_probe(device_t dev) return (usbd_lookup_id_by_uaa(axe_devs, sizeof(axe_devs), uaa)); } +static void +axe_watchdog(void *arg) +{ + struct axe_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + axe_tick(sc); + sleepout_reset(&sc->sc_watchdog, hz, axe_watchdog, sc); +} + /* * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. @@ -745,38 +775,68 @@ axe_attach(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); struct axe_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp; uint8_t iface_index; int error; - sc->sc_flags = USB_GET_DRIVER_INFO(uaa); - device_set_usb_desc(dev); + sc->sc_flags = USB_GET_DRIVER_INFO(uaa); + sc->sc_dev = dev; + sc->sc_udev = uaa->device; + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sleepout_create(&sc->sc_sleepout, "axe sleepout"); + sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_setmulti, 0, axe_setmulti, sc); iface_index = AXE_IFACE_IDX; error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, axe_config, AXE_N_TRANSFER, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating USB transfers failed\n"); - goto detach; + goto error1; } - ue->ue_sc = sc; - ue->ue_dev = dev; - ue->ue_udev = uaa->device; - ue->ue_mtx = &sc->sc_mtx; - ue->ue_methods = &axe_ue_methods; + AXE_LOCK(sc); + axe_attach_post(sc); + AXE_UNLOCK(sc); - error = uether_ifattach(ue); + sc->sc_ifp = ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(sc->sc_dev, "could not allocate ifnet\n"); + goto error2; + } + + ifp->if_softc = sc; + if_initname(ifp, device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev)); + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = axe_ioctl; + ifp->if_start = axe_start; + ifp->if_init = axe_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, + axe_ifmedia_upd, axe_ifmedia_sts); if (error) { - device_printf(dev, "could not attach interface\n"); - goto detach; + device_printf(sc->sc_dev, "MII without any PHY\n"); + goto error2; } - return (0); /* success */ -detach: + if_printf(ifp, " on %s\n", + device_get_nameunit(sc->sc_dev)); + ether_ifattach(ifp, sc->sc_eaddr); + return (0); +error2: + if (sc->sc_ifp != NULL) { + if_free(sc->sc_ifp); + sc->sc_ifp = NULL; + } +error1: axe_detach(dev); return (ENXIO); /* failure */ } @@ -785,10 +845,23 @@ static int axe_detach(device_t dev) { struct axe_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp = sc->sc_ifp; + + if (sc->sc_miibus != NULL) + device_delete_child(sc->sc_dev, sc->sc_miibus); + sleepout_drain(&sc->sc_watchdog); + taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER); - uether_ifdetach(ue); + + if (ifp != NULL) { + AXE_LOCK(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + AXE_UNLOCK(sc); + ether_ifdetach(ifp); + if_free(ifp); + } + sleepout_free(&sc->sc_sleepout); mtx_destroy(&sc->sc_mtx); return (0); @@ -797,6 +870,7 @@ axe_detach(device_t dev) static void axe_intr_callback(struct usb_xfer *xfer, usb_error_t error) { + switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: case USB_ST_SETUP: @@ -815,6 +889,72 @@ tr_setup: } } +static void +axe_rxflush(struct axe_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + AXE_LOCK_ASSERT(sc, MA_OWNED); + + for (;;) { + _IF_DEQUEUE(&sc->sc_rxq, m); + if (m == NULL) + break; + + /* + * The USB xfer has been resubmitted so its safe to unlock now. + */ + AXE_UNLOCK(sc); + ifp->if_input(ifp, m); + AXE_LOCK(sc); + } +} + +static struct mbuf * +axe_newbuf(void) +{ + struct mbuf *m_new; + + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new == NULL) + return (NULL); + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, ETHER_ALIGN); + return (m_new); +} + +static int +axe_rxbuf(struct axe_softc *sc, struct usb_page_cache *pc, + unsigned int offset, unsigned int len) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + AXE_LOCK_ASSERT(sc, MA_OWNED); + + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) + return (1); + + m = axe_newbuf(); + if (m == NULL) { + ifp->if_ierrors++; + return (ENOMEM); + } + + usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); + + /* finalize mbuf */ + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + /* enqueue for later when the lock can be released */ + _IF_ENQUEUE(&sc->sc_rxq, m); + return (0); +} + #if (AXE_BULK_BUF_SIZE >= 0x10000) #error "Please update axe_bulk_read_callback()!" #endif @@ -823,8 +963,7 @@ static void axe_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct axe_softc *sc = usbd_xfer_softc(xfer); - struct usb_ether *ue = &sc->sc_ue; - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; struct axe_sframe_hdr hdr; struct usb_page_cache *pc; int err, pos, len; @@ -861,12 +1000,12 @@ axe_bulk_read_callback(struct usb_xfer * err = EINVAL; break; } - err = uether_rxbuf(ue, pc, pos, len); + err = axe_rxbuf(sc, pc, pos, len); pos += len + (len % 2); } } else { - err = uether_rxbuf(ue, pc, 0, actlen); + err = axe_rxbuf(sc, pc, 0, actlen); } if (err != 0) @@ -877,7 +1016,7 @@ axe_bulk_read_callback(struct usb_xfer * tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - uether_rxflush(ue); + axe_rxflush(sc); return; default: /* Error */ @@ -902,7 +1041,7 @@ axe_bulk_write_callback(struct usb_xfer { struct axe_softc *sc = usbd_xfer_softc(xfer); struct axe_sframe_hdr hdr; - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; struct mbuf *m; int pos; @@ -995,25 +1134,24 @@ tr_setup: } static void -axe_tick(struct usb_ether *ue) +axe_tick(struct axe_softc *sc) { - struct axe_softc *sc = uether_getsc(ue); struct mii_data *mii = GET_MII(sc); AXE_LOCK_ASSERT(sc, MA_OWNED); mii_tick(mii); if ((sc->sc_flags & AXE_FLAG_LINK) == 0) { - axe_miibus_statchg(ue->ue_dev); + axe_miibus_statchg(sc->sc_dev); if ((sc->sc_flags & AXE_FLAG_LINK) != 0) - axe_start(ue); + axe_start(sc->sc_ifp); } } static void -axe_start(struct usb_ether *ue) +axe_start(struct ifnet *ifp) { - struct axe_softc *sc = uether_getsc(ue); + struct axe_softc *sc = ifp->if_softc; /* * start the USB transfers, if not already started: @@ -1024,16 +1162,25 @@ axe_start(struct usb_ether *ue) } static void -axe_init(struct usb_ether *ue) +axe_init(void *arg) { - struct axe_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct axe_softc *sc = arg; + + AXE_LOCK(sc); + axe_init_locked(sc); + AXE_UNLOCK(sc); +} + +static void +axe_init_locked(struct axe_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; uint16_t rxmode; AXE_LOCK_ASSERT(sc, MA_OWNED); /* Cancel pending I/O */ - axe_stop(ue); + axe_stop(sc); /* Set MAC address. */ if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) @@ -1077,19 +1224,18 @@ axe_init(struct usb_ether *ue) axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); /* Load the multicast filter. */ - axe_setmulti(ue); + axe_setmulti_locked(sc); usbd_xfer_set_stall(sc->sc_xfer[AXE_BULK_DT_WR]); ifp->if_drv_flags |= IFF_DRV_RUNNING; - axe_start(ue); + sleepout_reset(&sc->sc_watchdog, hz, axe_watchdog, sc); } static void -axe_setpromisc(struct usb_ether *ue) +axe_setpromisc(struct axe_softc *sc) { - struct axe_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; uint16_t rxmode; axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, &rxmode); @@ -1104,17 +1250,18 @@ axe_setpromisc(struct usb_ether *ue) axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); - axe_setmulti(ue); + axe_setmulti_locked(sc); } static void -axe_stop(struct usb_ether *ue) +axe_stop(struct axe_softc *sc) { - struct axe_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; AXE_LOCK_ASSERT(sc, MA_OWNED); + sleepout_stop(&sc->sc_watchdog); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sc->sc_flags &= ~AXE_FLAG_LINK; @@ -1127,3 +1274,41 @@ axe_stop(struct usb_ether *ue) axe_reset(sc); } + +static int +axe_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct axe_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *)data; + struct mii_data *mii = GET_MII(sc); + int error = 0; + + switch (command) { + case SIOCSIFFLAGS: + AXE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + axe_setpromisc(sc); + else + axe_init_locked(sc); + } else + axe_stop(sc); + AXE_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifp->if_flags & IFF_UP && + ifp->if_drv_flags & IFF_DRV_RUNNING) + taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, + &sc->sc_setmulti); + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + return (error); +} Modified: user/weongyo/usb/sys/dev/usb/net/if_axereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axereg.h Wed Sep 8 19:53:16 2010 (r212333) +++ user/weongyo/usb/sys/dev/usb/net/if_axereg.h Wed Sep 8 20:00:15 2010 (r212334) @@ -185,7 +185,7 @@ struct axe_sframe_hdr { uint16_t ilen; } __packed; -#define GET_MII(sc) uether_getmii(&(sc)->sc_ue) +#define GET_MII(sc) (device_get_softc(sc->sc_miibus)) /* The interrupt endpoint is currently unused by the ASIX part. */ enum { @@ -196,16 +196,26 @@ enum { }; struct axe_softc { - struct usb_ether sc_ue; + struct ifnet *sc_ifp; + device_t sc_dev; + device_t sc_miibus; + struct usb_device *sc_udev; /* used by uether_do_request() */ struct mtx sc_mtx; - struct usb_xfer *sc_xfer[AXE_N_TRANSFER]; - int sc_phyno; + struct usb_xfer *sc_xfer[AXE_N_TRANSFER]; + + /* ethernet address from eeprom */ + uint8_t sc_eaddr[ETHER_ADDR_LEN]; + struct ifqueue sc_rxq; + + struct sleepout sc_sleepout; + struct sleepout_task sc_watchdog; + struct task sc_setmulti; + int sc_phyno; int sc_flags; #define AXE_FLAG_LINK 0x0001 #define AXE_FLAG_772 0x1000 /* AX88772 */ #define AXE_FLAG_178 0x2000 /* AX88178 */ - uint8_t sc_ipgs[3]; uint8_t sc_phyaddrs[2]; }; From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 00:31:23 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8270810656AA; Thu, 9 Sep 2010 00:31:23 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 703F58FC17; Thu, 9 Sep 2010 00:31:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o890VNJ9005803; Thu, 9 Sep 2010 00:31:23 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o890VN1w005800; Thu, 9 Sep 2010 00:31:23 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009090031.o890VN1w005800@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 00:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212343 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 00:31:23 -0000 Author: weongyo Date: Thu Sep 9 00:31:23 2010 New Revision: 212343 URL: http://svn.freebsd.org/changeset/base/212343 Log: aue(4) doesn't depend on uether module anymore. Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_auereg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Wed Sep 8 21:08:54 2010 (r212342) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Thu Sep 9 00:31:23 2010 (r212343) @@ -81,6 +81,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -88,6 +90,19 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include +#include + +#include "miibus_if.h" + +#include +#include + #include #include #include @@ -95,9 +110,7 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR aue_debug #include -#include - -#include +#include #include #ifdef USB_DEBUG @@ -197,14 +210,6 @@ static usb_callback_t aue_intr_callback; static usb_callback_t aue_bulk_read_callback; static usb_callback_t aue_bulk_write_callback; -static uether_fn_t aue_attach_post; -static uether_fn_t aue_init; -static uether_fn_t aue_stop; -static uether_fn_t aue_start; -static uether_fn_t aue_tick; -static uether_fn_t aue_setmulti; -static uether_fn_t aue_setpromisc; - static uint8_t aue_csr_read_1(struct aue_softc *, uint16_t); static uint16_t aue_csr_read_2(struct aue_softc *, uint16_t); static void aue_csr_write_1(struct aue_softc *, uint16_t, uint8_t); @@ -214,12 +219,21 @@ static void aue_read_eeprom(struct aue_s uint16_t); static void aue_reset(struct aue_softc *); static void aue_reset_pegasus_II(struct aue_softc *); - static int aue_ifmedia_upd(struct ifnet *); static void aue_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static int aue_ioctl(struct ifnet *, u_long, caddr_t); +static void aue_start(struct ifnet *); +static void aue_init(void *); +static void aue_setmulti(void *, int); +static void aue_setmulti_locked(struct aue_softc *); +static void aue_rxflush(struct aue_softc *); +static int aue_rxbuf(struct aue_softc *, struct usb_page_cache *, + unsigned int, unsigned int); +static void aue_setpromisc(struct aue_softc *); +static void aue_init_locked(struct aue_softc *); +static void aue_watchdog(void *); static const struct usb_config aue_config[AUE_N_TRANSFER] = { - [AUE_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -277,30 +291,24 @@ static devclass_t aue_devclass; DRIVER_MODULE(aue, uhub, aue_driver, aue_devclass, NULL, 0); DRIVER_MODULE(miibus, aue, miibus_driver, miibus_devclass, 0, 0); -MODULE_DEPEND(aue, uether, 1, 1, 1); MODULE_DEPEND(aue, usb, 1, 1, 1); MODULE_DEPEND(aue, ether, 1, 1, 1); MODULE_DEPEND(aue, miibus, 1, 1, 1); MODULE_VERSION(aue, 1); -static const struct usb_ether_methods aue_ue_methods = { - .ue_attach_post = aue_attach_post, - .ue_start = aue_start, - .ue_init = aue_init, - .ue_stop = aue_stop, - .ue_tick = aue_tick, - .ue_setmulti = aue_setmulti, - .ue_setpromisc = aue_setpromisc, - .ue_mii_upd = aue_ifmedia_upd, - .ue_mii_sts = aue_ifmedia_sts, -}; - #define AUE_SETBIT(sc, reg, x) \ aue_csr_write_1(sc, reg, aue_csr_read_1(sc, reg) | (x)) #define AUE_CLRBIT(sc, reg, x) \ aue_csr_write_1(sc, reg, aue_csr_read_1(sc, reg) & ~(x)) +static void +aue_pause(struct aue_softc *sc, unsigned int _ticks) +{ + + usb_pause_mtx(&sc->sc_mtx, _ticks); +} + static uint8_t aue_csr_read_1(struct aue_softc *sc, uint16_t reg) { @@ -314,7 +322,8 @@ aue_csr_read_1(struct aue_softc *sc, uin USETW(req.wIndex, reg); USETW(req.wLength, 1); - err = uether_do_request(&sc->sc_ue, &req, &val, 1000); + err = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, &val, 0, + NULL, 1000); if (err) return (0); return (val); @@ -333,7 +342,8 @@ aue_csr_read_2(struct aue_softc *sc, uin USETW(req.wIndex, reg); USETW(req.wLength, 2); - err = uether_do_request(&sc->sc_ue, &req, &val, 1000); + err = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, &val, 0, + NULL, 1000); if (err) return (0); return (le16toh(val)); @@ -351,9 +361,9 @@ aue_csr_write_1(struct aue_softc *sc, ui USETW(req.wIndex, reg); USETW(req.wLength, 1); - if (uether_do_request(&sc->sc_ue, &req, &val, 1000)) { - /* error ignored */ - } + /* XXX error ignored */ + (void)usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, &val, 0, + NULL, 1000); } static void @@ -369,9 +379,9 @@ aue_csr_write_2(struct aue_softc *sc, ui val = htole16(val); - if (uether_do_request(&sc->sc_ue, &req, &val, 1000)) { - /* error ignored */ - } + /* XXX error ignored */ + (void)usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, &val, 0, + NULL, 1000); } /* @@ -389,12 +399,11 @@ aue_eeprom_getword(struct aue_softc *sc, for (i = 0; i != AUE_TIMEOUT; i++) { if (aue_csr_read_1(sc, AUE_EE_CTL) & AUE_EECTL_DONE) break; - if (uether_pause(&sc->sc_ue, hz / 100)) - break; + aue_pause(sc, hz / 100); } if (i == AUE_TIMEOUT) - device_printf(sc->sc_ue.ue_dev, "EEPROM read timed out\n"); + device_printf(sc->sc_dev, "EEPROM read timed out\n"); word = aue_csr_read_2(sc, AUE_EE_DATA); *dest = word; @@ -446,12 +455,11 @@ aue_miibus_readreg(device_t dev, int phy for (i = 0; i != AUE_TIMEOUT; i++) { if (aue_csr_read_1(sc, AUE_PHY_CTL) & AUE_PHYCTL_DONE) break; - if (uether_pause(&sc->sc_ue, hz / 100)) - break; + aue_pause(sc, hz / 100); } if (i == AUE_TIMEOUT) - device_printf(sc->sc_ue.ue_dev, "MII read timed out\n"); + device_printf(sc->sc_dev, "MII read timed out\n"); val = aue_csr_read_2(sc, AUE_PHY_DATA); @@ -482,12 +490,11 @@ aue_miibus_writereg(device_t dev, int ph for (i = 0; i != AUE_TIMEOUT; i++) { if (aue_csr_read_1(sc, AUE_PHY_CTL) & AUE_PHYCTL_DONE) break; - if (uether_pause(&sc->sc_ue, hz / 100)) - break; + aue_pause(sc, hz / 100); } if (i == AUE_TIMEOUT) - device_printf(sc->sc_ue.ue_dev, "MII write timed out\n"); + device_printf(sc->sc_dev, "MII write timed out\n"); if (!locked) AUE_UNLOCK(sc); @@ -533,12 +540,21 @@ aue_miibus_statchg(device_t dev) AUE_UNLOCK(sc); } +static void +aue_setmulti(void *arg, int npending) +{ + struct aue_softc *sc = arg; + + AUE_LOCK(sc); + aue_setmulti_locked(sc); + AUE_UNLOCK(sc); +} + #define AUE_BITS 6 static void -aue_setmulti(struct usb_ether *ue) +aue_setmulti_locked(struct aue_softc *sc) { - struct aue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; struct ifmultiaddr *ifma; uint32_t h = 0; uint32_t i; @@ -593,12 +609,11 @@ aue_reset(struct aue_softc *sc) for (i = 0; i != AUE_TIMEOUT; i++) { if (!(aue_csr_read_1(sc, AUE_CTL1) & AUE_CTL1_RESETMAC)) break; - if (uether_pause(&sc->sc_ue, hz / 100)) - break; + aue_pause(sc, hz / 100); } if (i == AUE_TIMEOUT) - device_printf(sc->sc_ue.ue_dev, "reset failed\n"); + device_printf(sc->sc_dev, "reset failed\n"); /* * The PHY(s) attached to the Pegasus chip may be held @@ -625,19 +640,18 @@ aue_reset(struct aue_softc *sc) aue_reset_pegasus_II(sc); /* Wait a little while for the chip to get its brains in order: */ - uether_pause(&sc->sc_ue, hz / 100); + aue_pause(sc, hz / 100); } static void -aue_attach_post(struct usb_ether *ue) +aue_attach_post(struct aue_softc *sc) { - struct aue_softc *sc = uether_getsc(ue); /* reset the adapter */ aue_reset(sc); /* get station address from the EEPROM */ - aue_read_eeprom(sc, ue->ue_eaddr, 0, 3); + aue_read_eeprom(sc, sc->sc_eaddr, 0, 3); } /* @@ -676,19 +690,25 @@ aue_attach(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); struct aue_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp; uint8_t iface_index; int error; - sc->sc_flags = USB_GET_DRIVER_INFO(uaa); + device_set_usb_desc(dev); + sc->sc_flags = USB_GET_DRIVER_INFO(uaa); if (uaa->info.bcdDevice >= 0x0201) { /* XXX currently undocumented */ sc->sc_flags |= AUE_FLAG_VER_2; } - device_set_usb_desc(dev); + sc->sc_dev = dev; + sc->sc_udev = uaa->device; + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sleepout_create(&sc->sc_sleepout, "aue sleepout"); + sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_setmulti, 0, aue_setmulti, sc); iface_index = AUE_IFACE_IDX; error = usbd_transfer_setup(uaa->device, &iface_index, @@ -699,19 +719,39 @@ aue_attach(device_t dev) goto detach; } - ue->ue_sc = sc; - ue->ue_dev = dev; - ue->ue_udev = uaa->device; - ue->ue_mtx = &sc->sc_mtx; - ue->ue_methods = &aue_ue_methods; + AUE_LOCK(sc); + aue_attach_post(sc); + AUE_UNLOCK(sc); + + sc->sc_ifp = ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(sc->sc_dev, "could not allocate ifnet\n"); + goto detach; + } + + ifp->if_softc = sc; + if_initname(ifp, device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev)); + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = aue_ioctl; + ifp->if_start = aue_start; + ifp->if_init = aue_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); - error = uether_ifattach(ue); + error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, + aue_ifmedia_upd, aue_ifmedia_sts); if (error) { - device_printf(dev, "could not attach interface\n"); + device_printf(sc->sc_dev, "MII without any PHY\n"); goto detach; } - return (0); /* success */ + if_printf(ifp, " on %s\n", + device_get_nameunit(sc->sc_dev)); + ether_ifattach(ifp, sc->sc_eaddr); + return (0); detach: aue_detach(dev); return (ENXIO); /* failure */ @@ -721,10 +761,22 @@ static int aue_detach(device_t dev) { struct aue_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp = sc->sc_ifp; + sleepout_drain(&sc->sc_watchdog); + taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER); - uether_ifdetach(ue); + + if (sc->sc_miibus != NULL) + device_delete_child(sc->sc_dev, sc->sc_miibus); + if (ifp != NULL) { + AUE_LOCK(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + AUE_UNLOCK(sc); + ether_ifdetach(ifp); + if_free(ifp); + } + sleepout_free(&sc->sc_sleepout); mtx_destroy(&sc->sc_mtx); return (0); @@ -734,7 +786,7 @@ static void aue_intr_callback(struct usb_xfer *xfer, usb_error_t error) { struct aue_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct aue_intrpkt pkt; struct usb_page_cache *pc; int actlen; @@ -777,8 +829,7 @@ static void aue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct aue_softc *sc = usbd_xfer_softc(xfer); - struct usb_ether *ue = &sc->sc_ue; - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; struct aue_rxpkt stat; struct usb_page_cache *pc; int actlen; @@ -817,14 +868,14 @@ aue_bulk_read_callback(struct usb_xfer * /* No errors; receive the packet. */ actlen -= (sizeof(stat) + ETHER_CRC_LEN); } - uether_rxbuf(ue, pc, 0, actlen); + aue_rxbuf(sc, pc, 0, actlen); /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - uether_rxflush(ue); + aue_rxflush(sc); return; default: /* Error */ @@ -844,7 +895,7 @@ static void aue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { struct aue_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; struct mbuf *m; uint8_t buf[2]; @@ -925,9 +976,8 @@ tr_setup: } static void -aue_tick(struct usb_ether *ue) +aue_tick(struct aue_softc *sc) { - struct aue_softc *sc = uether_getsc(ue); struct mii_data *mii = GET_MII(sc); AUE_LOCK_ASSERT(sc, MA_OWNED); @@ -937,14 +987,14 @@ aue_tick(struct usb_ether *ue) && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { sc->sc_flags |= AUE_FLAG_LINK; - aue_start(ue); + aue_start(sc->sc_ifp); } } static void -aue_start(struct usb_ether *ue) +aue_start(struct ifnet *ifp) { - struct aue_softc *sc = uether_getsc(ue); + struct aue_softc *sc = ifp->if_softc; /* * start the USB transfers, if not already started: @@ -955,10 +1005,19 @@ aue_start(struct usb_ether *ue) } static void -aue_init(struct usb_ether *ue) +aue_init(void *arg) { - struct aue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct aue_softc *sc = arg; + + AUE_LOCK(sc); + aue_init_locked(sc); + AUE_UNLOCK(sc); +} + +static void +aue_init_locked(struct aue_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; int i; AUE_LOCK_ASSERT(sc, MA_OWNED); @@ -973,10 +1032,10 @@ aue_init(struct usb_ether *ue) aue_csr_write_1(sc, AUE_PAR0 + i, IF_LLADDR(ifp)[i]); /* update promiscuous setting */ - aue_setpromisc(ue); + aue_setpromisc(sc); /* Load the multicast filter. */ - aue_setmulti(ue); + aue_setmulti_locked(sc); /* Enable RX and TX */ aue_csr_write_1(sc, AUE_CTL0, AUE_CTL0_RXSTAT_APPEND | AUE_CTL0_RX_ENB); @@ -986,14 +1045,14 @@ aue_init(struct usb_ether *ue) usbd_xfer_set_stall(sc->sc_xfer[AUE_BULK_DT_WR]); ifp->if_drv_flags |= IFF_DRV_RUNNING; - aue_start(ue); + sleepout_reset(&sc->sc_watchdog, hz, aue_watchdog, sc); + aue_start(sc->sc_ifp); } static void -aue_setpromisc(struct usb_ether *ue) +aue_setpromisc(struct aue_softc *sc) { - struct aue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; AUE_LOCK_ASSERT(sc, MA_OWNED); @@ -1013,8 +1072,7 @@ aue_ifmedia_upd(struct ifnet *ifp) struct aue_softc *sc = ifp->if_softc; struct mii_data *mii = GET_MII(sc); - AUE_LOCK_ASSERT(sc, MA_OWNED); - + AUE_LOCK(sc); sc->sc_flags &= ~AUE_FLAG_LINK; if (mii->mii_instance) { struct mii_softc *miisc; @@ -1023,6 +1081,7 @@ aue_ifmedia_upd(struct ifnet *ifp) mii_phy_reset(miisc); } mii_mediachg(mii); + AUE_UNLOCK(sc); return (0); } @@ -1047,10 +1106,9 @@ aue_ifmedia_sts(struct ifnet *ifp, struc * RX and TX lists. */ static void -aue_stop(struct usb_ether *ue) +aue_stop(struct aue_softc *sc) { - struct aue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; AUE_LOCK_ASSERT(sc, MA_OWNED); @@ -1068,3 +1126,120 @@ aue_stop(struct usb_ether *ue) aue_csr_write_1(sc, AUE_CTL1, 0); aue_reset(sc); } + +static int +aue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct aue_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *)data; + struct mii_data *mii = GET_MII(sc); + int error = 0; + + switch (command) { + case SIOCSIFFLAGS: + AUE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + aue_setpromisc(sc); + else + aue_init_locked(sc); + } else + aue_stop(sc); + AUE_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifp->if_flags & IFF_UP && + ifp->if_drv_flags & IFF_DRV_RUNNING) + taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, + &sc->sc_setmulti); + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + return (error); +} + +static void +aue_rxflush(struct aue_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + AUE_LOCK_ASSERT(sc, MA_OWNED); + + for (;;) { + _IF_DEQUEUE(&sc->sc_rxq, m); + if (m == NULL) + break; + + /* + * The USB xfer has been resubmitted so its safe to unlock now. + */ + AUE_UNLOCK(sc); + ifp->if_input(ifp, m); + AUE_LOCK(sc); + } +} + +static struct mbuf * +aue_newbuf(void) +{ + struct mbuf *m_new; + + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new == NULL) + return (NULL); + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, ETHER_ALIGN); + return (m_new); +} + +static int +aue_rxbuf(struct aue_softc *sc, struct usb_page_cache *pc, + unsigned int offset, unsigned int len) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + AUE_LOCK_ASSERT(sc, MA_OWNED); + + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) + return (1); + + m = aue_newbuf(); + if (m == NULL) { + ifp->if_ierrors++; + return (ENOMEM); + } + + usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); + + /* finalize mbuf */ + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + /* enqueue for later when the lock can be released */ + _IF_ENQUEUE(&sc->sc_rxq, m); + return (0); +} + +static void +aue_watchdog(void *arg) +{ + struct aue_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + aue_tick(sc); + sleepout_reset(&sc->sc_watchdog, hz, aue_watchdog, sc); +} Modified: user/weongyo/usb/sys/dev/usb/net/if_auereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_auereg.h Wed Sep 8 21:08:54 2010 (r212342) +++ user/weongyo/usb/sys/dev/usb/net/if_auereg.h Thu Sep 9 00:31:23 2010 (r212343) @@ -183,7 +183,7 @@ enum { #define AUE_RXSTAT_DRIBBLE 0x10 #define AUE_RXSTAT_MASK 0x1E -#define GET_MII(sc) uether_getmii(&(sc)->sc_ue) +#define GET_MII(sc) (device_get_softc(sc->sc_miibus)) struct aue_intrpkt { uint8_t aue_txstat0; @@ -202,10 +202,15 @@ struct aue_rxpkt { } __packed; struct aue_softc { - struct usb_ether sc_ue; + struct ifnet *sc_ifp; + device_t sc_dev; + device_t sc_miibus; + struct usb_device *sc_udev; /* used by uether_do_request() */ + struct usb_xfer *sc_xfer[AUE_N_TRANSFER]; struct mtx sc_mtx; - struct usb_xfer *sc_xfer[AUE_N_TRANSFER]; - + struct ifqueue sc_rxq; + /* ethernet address from eeprom */ + uint8_t sc_eaddr[ETHER_ADDR_LEN]; int sc_flags; #define AUE_FLAG_LSYS 0x0001 /* use Linksys reset */ #define AUE_FLAG_PNA 0x0002 /* has Home PNA */ @@ -213,6 +218,10 @@ struct aue_softc { #define AUE_FLAG_LINK 0x0008 /* wait for link to come up */ #define AUE_FLAG_VER_2 0x0200 /* chip is version 2 */ #define AUE_FLAG_DUAL_PHY 0x0400 /* chip has two transcivers */ + + struct sleepout sc_sleepout; + struct sleepout_task sc_watchdog; + struct task sc_setmulti; }; #define AUE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 00:34:55 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD4B910656EB; Thu, 9 Sep 2010 00:34:55 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC9EB8FC0A; Thu, 9 Sep 2010 00:34:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o890YtM3006118; Thu, 9 Sep 2010 00:34:55 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o890Yt4R006115; Thu, 9 Sep 2010 00:34:55 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009090034.o890Yt4R006115@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 00:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212344 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 00:34:55 -0000 Author: weongyo Date: Thu Sep 9 00:34:55 2010 New Revision: 212344 URL: http://svn.freebsd.org/changeset/base/212344 Log: Detaching the miibus child should be happen after draining all parent tasks because it could access miibus API (e.g. calling mii_tick()). Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Thu Sep 9 00:31:23 2010 (r212343) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Thu Sep 9 00:34:55 2010 (r212344) @@ -847,13 +847,12 @@ axe_detach(device_t dev) struct axe_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->sc_ifp; - if (sc->sc_miibus != NULL) - device_delete_child(sc->sc_dev, sc->sc_miibus); - sleepout_drain(&sc->sc_watchdog); taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER); + if (sc->sc_miibus != NULL) + device_delete_child(sc->sc_dev, sc->sc_miibus); if (ifp != NULL) { AXE_LOCK(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 00:39:25 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 431CD1065674; Thu, 9 Sep 2010 00:39:25 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 329E58FC15; Thu, 9 Sep 2010 00:39:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o890dPfc006503; Thu, 9 Sep 2010 00:39:25 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o890dP0p006501; Thu, 9 Sep 2010 00:39:25 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009090039.o890dP0p006501@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 00:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212345 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 00:39:25 -0000 Author: weongyo Date: Thu Sep 9 00:39:24 2010 New Revision: 212345 URL: http://svn.freebsd.org/changeset/base/212345 Log: Should call axe_start() at axe_init*() routines to start USB transfers on each endpoints. Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Thu Sep 9 00:34:55 2010 (r212344) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Thu Sep 9 00:39:24 2010 (r212345) @@ -1229,6 +1229,7 @@ axe_init_locked(struct axe_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; sleepout_reset(&sc->sc_watchdog, hz, axe_watchdog, sc); + axe_start(sc->sc_ifp); } static void From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 02:29:40 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DBF810656A4; Thu, 9 Sep 2010 02:29:40 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B4998FC18; Thu, 9 Sep 2010 02:29:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o892TeTv018064; Thu, 9 Sep 2010 02:29:40 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o892TeVO018061; Thu, 9 Sep 2010 02:29:40 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009090229.o892TeVO018061@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 02:29:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212346 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 02:29:40 -0000 Author: weongyo Date: Thu Sep 9 02:29:40 2010 New Revision: 212346 URL: http://svn.freebsd.org/changeset/base/212346 Log: cdce(4) doesn't depend on uether module anymore. But it's not tested because I don't have a device working with cdce(4). Modified: user/weongyo/usb/sys/dev/usb/net/if_cdce.c user/weongyo/usb/sys/dev/usb/net/if_cdcereg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_cdce.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cdce.c Thu Sep 9 00:39:24 2010 (r212345) +++ user/weongyo/usb/sys/dev/usb/net/if_cdce.c Thu Sep 9 02:29:40 2010 (r212346) @@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -68,6 +70,19 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include +#include + +#include "miibus_if.h" + +#include +#include + #include #include #include @@ -76,17 +91,13 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR cdce_debug #include -#include +#include #include "usb_if.h" - -#include #include static device_probe_t cdce_probe; static device_attach_t cdce_attach; static device_detach_t cdce_detach; -static device_suspend_t cdce_suspend; -static device_resume_t cdce_resume; static usb_handle_request_t cdce_handle_request; static usb_callback_t cdce_bulk_write_callback; @@ -99,14 +110,14 @@ static usb_callback_t cdce_ncm_bulk_writ static usb_callback_t cdce_ncm_bulk_read_callback; #endif -static uether_fn_t cdce_attach_post; -static uether_fn_t cdce_init; -static uether_fn_t cdce_stop; -static uether_fn_t cdce_start; -static uether_fn_t cdce_setmulti; -static uether_fn_t cdce_setpromisc; - static uint32_t cdce_m_crc32(struct mbuf *, uint32_t, uint32_t); +static int cdce_ioctl(struct ifnet *, u_long, caddr_t); +static void cdce_start(struct ifnet *); +static void cdce_init(void *); +static void cdce_init_locked(struct cdce_softc *); +static int cdce_rxmbuf(struct cdce_softc *, struct mbuf *, unsigned int); +static struct mbuf *cdce_newbuf(void); +static void cdce_rxflush(struct cdce_softc *); #ifdef USB_DEBUG static int cdce_debug = 0; @@ -232,8 +243,6 @@ static device_method_t cdce_methods[] = DEVMETHOD(device_probe, cdce_probe), DEVMETHOD(device_attach, cdce_attach), DEVMETHOD(device_detach, cdce_detach), - DEVMETHOD(device_suspend, cdce_suspend), - DEVMETHOD(device_resume, cdce_resume), {0, 0} }; @@ -248,33 +257,24 @@ static devclass_t cdce_devclass; DRIVER_MODULE(cdce, uhub, cdce_driver, cdce_devclass, NULL, 0); MODULE_VERSION(cdce, 1); -MODULE_DEPEND(cdce, uether, 1, 1, 1); MODULE_DEPEND(cdce, usb, 1, 1, 1); MODULE_DEPEND(cdce, ether, 1, 1, 1); -static const struct usb_ether_methods cdce_ue_methods = { - .ue_attach_post = cdce_attach_post, - .ue_start = cdce_start, - .ue_init = cdce_init, - .ue_stop = cdce_stop, - .ue_setmulti = cdce_setmulti, - .ue_setpromisc = cdce_setpromisc, -}; - static const struct usb_device_id cdce_devs[] = { - {USB_VPI(USB_VENDOR_ACERLABS, USB_PRODUCT_ACERLABS_M5632, CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250, CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX, CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_GMATE, USB_PRODUCT_GMATE_YP3X00, CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN2, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_ETHERNETGADGET, CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2501, CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5500, CDCE_FLAG_ZAURUS)}, - {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5600, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLA300, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC700, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, - {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC750, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, +#define CDCE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + CDCE_DEV(ACERLABS, M5632, CDCE_FLAG_NO_UNION), + CDCE_DEV(AMBIT, NTL_250, CDCE_FLAG_NO_UNION), + CDCE_DEV(COMPAQ, IPAQLINUX, CDCE_FLAG_NO_UNION), + CDCE_DEV(GMATE, YP3X00, CDCE_FLAG_NO_UNION), + CDCE_DEV(MOTOROLA2, USBLAN, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION), + CDCE_DEV(MOTOROLA2, USBLAN2, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION), + CDCE_DEV(NETCHIP, ETHERNETGADGET, CDCE_FLAG_NO_UNION), + CDCE_DEV(PROLIFIC, PL2501, CDCE_FLAG_NO_UNION), + CDCE_DEV(SHARP, SL5500, CDCE_FLAG_ZAURUS), + CDCE_DEV(SHARP, SL5600, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION), + CDCE_DEV(SHARP, SLA300, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION), + CDCE_DEV(SHARP, SLC700, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION), + CDCE_DEV(SHARP, SLC750, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION), {USB_IF_CSI(UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0)}, {USB_IF_CSI(UICLASS_CDC, UISUBCLASS_MOBILE_DIRECT_LINE_MODEL, 0)}, @@ -304,14 +304,14 @@ cdce_ncm_init(struct cdce_softc *sc) req.wIndex[1] = 0; USETW(req.wLength, sizeof(temp)); - err = usbd_do_request_flags(sc->sc_ue.ue_udev, NULL, &req, + err = usbd_do_request_flags(sc->sc_udev, NULL, &req, &temp, 0, NULL, 1000 /* ms */); if (err) return (1); /* Read correct set of parameters according to device mode */ - if (usbd_get_mode(sc->sc_ue.ue_udev) == USB_MODE_HOST) { + if (usbd_get_mode(sc->sc_udev) == USB_MODE_HOST) { sc->sc_ncm.rx_max = UGETDW(temp.dwNtbInMaxSize); sc->sc_ncm.tx_max = UGETDW(temp.dwNtbOutMaxSize); sc->sc_ncm.tx_remainder = UGETW(temp.wNdpOutPayloadRemainder); @@ -386,7 +386,7 @@ cdce_ncm_init(struct cdce_softc *sc) USETW(req.wLength, 4); USETDW(value, sc->sc_ncm.rx_max); - err = usbd_do_request_flags(sc->sc_ue.ue_udev, NULL, &req, + err = usbd_do_request_flags(sc->sc_udev, NULL, &req, &value, 0, NULL, 1000 /* ms */); if (err) { DPRINTFN(1, "Setting input size " @@ -400,7 +400,7 @@ cdce_ncm_init(struct cdce_softc *sc) req.wIndex[1] = 0; USETW(req.wLength, 0); - err = usbd_do_request_flags(sc->sc_ue.ue_udev, NULL, &req, + err = usbd_do_request_flags(sc->sc_udev, NULL, &req, NULL, 0, NULL, 1000 /* ms */); if (err) { DPRINTFN(1, "Setting CRC mode to off failed.\n"); @@ -413,7 +413,7 @@ cdce_ncm_init(struct cdce_softc *sc) req.wIndex[1] = 0; USETW(req.wLength, 0); - err = usbd_do_request_flags(sc->sc_ue.ue_udev, NULL, &req, + err = usbd_do_request_flags(sc->sc_udev, NULL, &req, NULL, 0, NULL, 1000 /* ms */); if (err) { DPRINTFN(1, "Setting NTB format to 16-bit failed.\n"); @@ -431,18 +431,11 @@ cdce_probe(device_t dev) return (usbd_lookup_id_by_uaa(cdce_devs, sizeof(cdce_devs), uaa)); } -static void -cdce_attach_post(struct usb_ether *ue) -{ - /* no-op */ - return; -} - static int cdce_attach(device_t dev) { struct cdce_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp; struct usb_attach_arg *uaa = device_get_ivars(dev); struct usb_interface *iface; const struct usb_cdc_union_descriptor *ud; @@ -454,8 +447,9 @@ cdce_attach(device_t dev) uint8_t data_iface_no; char eaddr_str[5 * ETHER_ADDR_LEN]; /* approx */ + sc->sc_dev = dev; + sc->sc_udev = uaa->device; sc->sc_flags = USB_GET_DRIVER_INFO(uaa); - sc->sc_ue.ue_udev = uaa->device; device_set_usb_desc(dev); @@ -485,7 +479,8 @@ cdce_attach(device_t dev) if (id && (id->bInterfaceNumber == data_iface_no)) { sc->sc_ifaces_index[0] = i; sc->sc_ifaces_index[1] = uaa->info.bIfaceIndex; - usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex); + usbd_set_parent_iface(uaa->device, i, + uaa->info.bIfaceIndex); break; } } else { @@ -561,13 +556,13 @@ alloc_transfers: /* fake MAC address */ device_printf(dev, "faking MAC address\n"); - sc->sc_ue.ue_eaddr[0] = 0x2a; - memcpy(&sc->sc_ue.ue_eaddr[1], &ticks, sizeof(uint32_t)); - sc->sc_ue.ue_eaddr[5] = device_get_unit(dev); + sc->sc_eaddr[0] = 0x2a; + memcpy(&sc->sc_eaddr[1], &ticks, sizeof(uint32_t)); + sc->sc_eaddr[5] = device_get_unit(dev); } else { - bzero(sc->sc_ue.ue_eaddr, sizeof(sc->sc_ue.ue_eaddr)); + bzero(sc->sc_eaddr, sizeof(sc->sc_eaddr)); for (i = 0; i != (ETHER_ADDR_LEN * 2); i++) { @@ -584,30 +579,39 @@ alloc_transfers: if ((i & 1) == 0) c <<= 4; - sc->sc_ue.ue_eaddr[i / 2] |= c; + sc->sc_eaddr[i / 2] |= c; } if (uaa->usb_mode == USB_MODE_DEVICE) { /* * Do not use the same MAC address like the peer ! */ - sc->sc_ue.ue_eaddr[5] ^= 0xFF; + sc->sc_eaddr[5] ^= 0xFF; } } - ue->ue_sc = sc; - ue->ue_dev = dev; - ue->ue_udev = uaa->device; - ue->ue_mtx = &sc->sc_mtx; - ue->ue_methods = &cdce_ue_methods; - - error = uether_ifattach(ue); - if (error) { - device_printf(dev, "could not attach interface\n"); + sc->sc_ifp = ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(sc->sc_dev, "could not allocate ifnet\n"); goto detach; } - return (0); /* success */ + ifp->if_softc = sc; + if_initname(ifp, device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev)); + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = cdce_ioctl; + ifp->if_start = cdce_start; + ifp->if_init = cdce_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + if_printf(ifp, " on %s\n", + device_get_nameunit(sc->sc_dev)); + ether_ifattach(ifp, sc->sc_eaddr); + return (0); detach: cdce_detach(dev); return (ENXIO); /* failure */ @@ -617,20 +621,24 @@ static int cdce_detach(device_t dev) { struct cdce_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp = sc->sc_ifp; - /* stop all USB transfers first */ usbd_transfer_unsetup(sc->sc_xfer, CDCE_N_TRANSFER); - uether_ifdetach(ue); + if (ifp != NULL) { + CDCE_LOCK(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + CDCE_UNLOCK(sc); + ether_ifdetach(ifp); + if_free(ifp); + } mtx_destroy(&sc->sc_mtx); - return (0); } static void -cdce_start(struct usb_ether *ue) +cdce_start(struct ifnet *ifp) { - struct cdce_softc *sc = uether_getsc(ue); + struct cdce_softc *sc = ifp->if_softc; /* * Start the USB transfers, if not already started: @@ -655,7 +663,7 @@ static void cdce_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { struct cdce_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct mbuf *m; struct mbuf *mt; uint32_t crc; @@ -768,10 +776,19 @@ cdce_m_crc32(struct mbuf *m, uint32_t sr } static void -cdce_init(struct usb_ether *ue) +cdce_init(void *arg) +{ + struct cdce_softc *sc = arg; + + CDCE_LOCK(sc); + cdce_init_locked(sc); + CDCE_UNLOCK(sc); +} + +static void +cdce_init_locked(struct cdce_softc *sc) { - struct cdce_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; CDCE_LOCK_ASSERT(sc, MA_OWNED); @@ -785,14 +802,13 @@ cdce_init(struct usb_ether *ue) usbd_xfer_set_stall(sc->sc_xfer[CDCE_BULK_TX]); /* start data transfers */ - cdce_start(ue); + cdce_start(sc->sc_ifp); } static void -cdce_stop(struct usb_ether *ue) +cdce_stop(struct cdce_softc *sc) { - struct cdce_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; CDCE_LOCK_ASSERT(sc, MA_OWNED); @@ -808,34 +824,6 @@ cdce_stop(struct usb_ether *ue) } static void -cdce_setmulti(struct usb_ether *ue) -{ - /* no-op */ - return; -} - -static void -cdce_setpromisc(struct usb_ether *ue) -{ - /* no-op */ - return; -} - -static int -cdce_suspend(device_t dev) -{ - device_printf(dev, "Suspending\n"); - return (0); -} - -static int -cdce_resume(device_t dev) -{ - device_printf(dev, "Resuming\n"); - return (0); -} - -static void cdce_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct cdce_softc *sc = usbd_xfer_softc(xfer); @@ -865,7 +853,7 @@ cdce_bulk_read_callback(struct usb_xfer continue; } /* queue up mbuf */ - uether_rxmbuf(&sc->sc_ue, m, len); + cdce_rxmbuf(sc, m, len); } /* FALLTHROUGH */ @@ -876,7 +864,7 @@ cdce_bulk_read_callback(struct usb_xfer */ for (x = 0; x != 1; x++) { if (sc->sc_rx_buf[x] == NULL) { - m = uether_newbuf(); + m = cdce_newbuf(); if (m == NULL) goto tr_stall; sc->sc_rx_buf[x] = m; @@ -890,7 +878,7 @@ cdce_bulk_read_callback(struct usb_xfer usbd_xfer_set_frames(xfer, x); usbd_transfer_submit(xfer); /* flush any received frames */ - uether_rxflush(&sc->sc_ue); + cdce_rxflush(sc); break; default: /* Error */ @@ -987,7 +975,7 @@ static uint8_t cdce_ncm_fill_tx_frames(struct usb_xfer *xfer, uint8_t index) { struct cdce_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc = usbd_xfer_get_frame(xfer, index); struct mbuf *m; uint32_t rem; @@ -1113,7 +1101,7 @@ static void cdce_ncm_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { struct cdce_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; uint16_t x; int actlen; int aframes; @@ -1160,7 +1148,7 @@ cdce_ncm_bulk_read_callback(struct usb_x { struct cdce_softc *sc = usbd_xfer_softc(xfer); struct usb_page_cache *pc = usbd_xfer_get_frame(xfer, 0); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct mbuf *m; int sumdata; int sumlen; @@ -1283,7 +1271,7 @@ cdce_ncm_bulk_read_callback(struct usb_x usbd_copy_out(pc, offset, m->m_data, temp); /* enqueue */ - uether_rxmbuf(&sc->sc_ue, m, temp); + cdce_rxmbuf(sc, m, temp); sumdata += temp; } else { @@ -1298,7 +1286,7 @@ tr_setup: usbd_xfer_set_frame_len(xfer, 0, sc->sc_ncm.rx_max); usbd_xfer_set_frames(xfer, 1); usbd_transfer_submit(xfer); - uether_rxflush(&sc->sc_ue); /* must be last */ + cdce_rxflush(sc); /* must be last */ break; default: /* Error */ @@ -1316,3 +1304,79 @@ tr_stall: } } #endif + +static int +cdce_rxmbuf(struct cdce_softc *sc, struct mbuf *m, unsigned int len) +{ + struct ifnet *ifp = sc->sc_ifp; + + CDCE_LOCK_ASSERT(sc, MA_OWNED); + + /* finalize mbuf */ + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + /* enqueue for later when the lock can be released */ + _IF_ENQUEUE(&sc->sc_rxq, m); + return (0); +} + +static struct mbuf * +cdce_newbuf(void) +{ + struct mbuf *m_new; + + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new == NULL) + return (NULL); + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, ETHER_ALIGN); + return (m_new); +} + +static void +cdce_rxflush(struct cdce_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + CDCE_LOCK_ASSERT(sc, MA_OWNED); + + for (;;) { + _IF_DEQUEUE(&sc->sc_rxq, m); + if (m == NULL) + break; + + /* + * The USB xfer has been resubmitted so its safe to unlock now. + */ + CDCE_UNLOCK(sc); + ifp->if_input(ifp, m); + CDCE_LOCK(sc); + } +} + +static int +cdce_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct cdce_softc *sc = ifp->if_softc; + int error = 0; + + switch (command) { + case SIOCSIFFLAGS: + CDCE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + cdce_init_locked(sc); + } else + cdce_stop(sc); + CDCE_UNLOCK(sc); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + return (error); +} Modified: user/weongyo/usb/sys/dev/usb/net/if_cdcereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cdcereg.h Thu Sep 9 00:39:24 2010 (r212345) +++ user/weongyo/usb/sys/dev/usb/net/if_cdcereg.h Thu Sep 9 02:29:40 2010 (r212346) @@ -71,22 +71,25 @@ struct cdce_ncm { }; struct cdce_softc { - struct usb_ether sc_ue; + struct ifnet *sc_ifp; + device_t sc_dev; + struct usb_device *sc_udev; /* used by uether_do_request() */ struct mtx sc_mtx; + struct usb_xfer *sc_xfer[CDCE_N_TRANSFER]; + struct ifqueue sc_rxq; + /* ethernet address from eeprom */ + uint8_t sc_eaddr[ETHER_ADDR_LEN]; #if CDCE_HAVE_NCM struct cdce_ncm sc_ncm; #endif - struct usb_xfer *sc_xfer[CDCE_N_TRANSFER]; struct mbuf *sc_rx_buf[CDCE_FRAMES_MAX]; struct mbuf *sc_tx_buf[CDCE_FRAMES_MAX]; - int sc_flags; #define CDCE_FLAG_ZAURUS 0x0001 #define CDCE_FLAG_NO_UNION 0x0002 #define CDCE_FLAG_RX_DATA 0x0010 - - uint8_t sc_eaddr_str_index; - uint8_t sc_ifaces_index[2]; + uint8_t sc_eaddr_str_index; + uint8_t sc_ifaces_index[2]; }; #define CDCE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 03:07:39 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79A891065698; Thu, 9 Sep 2010 03:07:39 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 679BD8FC08; Thu, 9 Sep 2010 03:07:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8937dob020745; Thu, 9 Sep 2010 03:07:39 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8937d8B020742; Thu, 9 Sep 2010 03:07:39 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009090307.o8937d8B020742@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 03:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212348 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 03:07:39 -0000 Author: weongyo Date: Thu Sep 9 03:07:39 2010 New Revision: 212348 URL: http://svn.freebsd.org/changeset/base/212348 Log: cue(4) don't depend on uether module anymore though it's not tested due to lack of H/W device. Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cue.c Thu Sep 9 02:52:44 2010 (r212347) +++ user/weongyo/usb/sys/dev/usb/net/if_cue.c Thu Sep 9 03:07:39 2010 (r212348) @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -71,6 +73,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -78,9 +88,7 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR cue_debug #include -#include - -#include +#include #include /* @@ -106,14 +114,6 @@ static device_detach_t cue_detach; static usb_callback_t cue_bulk_read_callback; static usb_callback_t cue_bulk_write_callback; -static uether_fn_t cue_attach_post; -static uether_fn_t cue_init; -static uether_fn_t cue_stop; -static uether_fn_t cue_start; -static uether_fn_t cue_tick; -static uether_fn_t cue_setmulti; -static uether_fn_t cue_setpromisc; - static uint8_t cue_csr_read_1(struct cue_softc *, uint16_t); static uint16_t cue_csr_read_2(struct cue_softc *, uint8_t); static int cue_csr_write_1(struct cue_softc *, uint16_t, uint16_t); @@ -121,6 +121,17 @@ static int cue_mem(struct cue_softc *, u static int cue_getmac(struct cue_softc *, void *); static uint32_t cue_mchash(const uint8_t *); static void cue_reset(struct cue_softc *); +static void cue_setmulti(void *, int); +static void cue_setmulti_locked(struct cue_softc *); +static void cue_init(void *); +static void cue_init_locked(struct cue_softc *); +static int cue_ioctl(struct ifnet *, u_long, caddr_t); +static void cue_start(struct ifnet *); +static int cue_rxbuf(struct cue_softc *, struct usb_page_cache *, + unsigned int, unsigned int); +static void cue_rxflush(struct cue_softc *); +static void cue_stop(struct cue_softc *); +static void cue_watchdog(void *); #ifdef USB_DEBUG static int cue_debug = 0; @@ -131,7 +142,6 @@ SYSCTL_INT(_hw_usb_cue, OID_AUTO, debug, #endif static const struct usb_config cue_config[CUE_N_TRANSFER] = { - [CUE_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -141,7 +151,6 @@ static const struct usb_config cue_confi .callback = cue_bulk_write_callback, .timeout = 10000, /* 10 seconds */ }, - [CUE_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -170,21 +179,10 @@ static driver_t cue_driver = { static devclass_t cue_devclass; DRIVER_MODULE(cue, uhub, cue_driver, cue_devclass, NULL, 0); -MODULE_DEPEND(cue, uether, 1, 1, 1); MODULE_DEPEND(cue, usb, 1, 1, 1); MODULE_DEPEND(cue, ether, 1, 1, 1); MODULE_VERSION(cue, 1); -static const struct usb_ether_methods cue_ue_methods = { - .ue_attach_post = cue_attach_post, - .ue_start = cue_start, - .ue_init = cue_init, - .ue_stop = cue_stop, - .ue_tick = cue_tick, - .ue_setmulti = cue_setmulti, - .ue_setpromisc = cue_setpromisc, -}; - #define CUE_SETBIT(sc, reg, x) \ cue_csr_write_1(sc, reg, cue_csr_read_1(sc, reg) | (x)) @@ -203,9 +201,9 @@ cue_csr_read_1(struct cue_softc *sc, uin USETW(req.wIndex, reg); USETW(req.wLength, 1); - if (uether_do_request(&sc->sc_ue, &req, &val, 1000)) { - /* ignore any errors */ - } + /* XXX ignore any errors */ + (void)usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, &val, 0, + NULL, 1000); return (val); } @@ -221,7 +219,9 @@ cue_csr_read_2(struct cue_softc *sc, uin USETW(req.wIndex, reg); USETW(req.wLength, 2); - (void)uether_do_request(&sc->sc_ue, &req, &val, 1000); + /* XXX ignore any errors */ + (void)usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, &val, 0, + NULL, 1000); return (le16toh(val)); } @@ -236,7 +236,8 @@ cue_csr_write_1(struct cue_softc *sc, ui USETW(req.wIndex, reg); USETW(req.wLength, 0); - return (uether_do_request(&sc->sc_ue, &req, NULL, 1000)); + return (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, NULL, 0, + NULL, 1000)); } static int @@ -253,7 +254,8 @@ cue_mem(struct cue_softc *sc, uint8_t cm USETW(req.wIndex, addr); USETW(req.wLength, len); - return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); + return (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, buf, 0, + NULL, 1000)); } static int @@ -267,7 +269,8 @@ cue_getmac(struct cue_softc *sc, void *b USETW(req.wIndex, 0); USETW(req.wLength, ETHER_ADDR_LEN); - return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); + return (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, buf, 0, + NULL, 1000)); } #define CUE_BITS 9 @@ -284,10 +287,9 @@ cue_mchash(const uint8_t *addr) } static void -cue_setpromisc(struct usb_ether *ue) +cue_setpromisc(struct cue_softc *sc) { - struct cue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; CUE_LOCK_ASSERT(sc, MA_OWNED); @@ -298,14 +300,23 @@ cue_setpromisc(struct usb_ether *ue) CUE_CLRBIT(sc, CUE_ETHCTL, CUE_ETHCTL_PROMISC); /* write multicast hash-bits */ - cue_setmulti(ue); + cue_setmulti_locked(sc); } static void -cue_setmulti(struct usb_ether *ue) +cue_setmulti(void *arg, int npending) { - struct cue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct cue_softc *sc = arg; + + CUE_LOCK(sc); + cue_setmulti_locked(sc); + CUE_UNLOCK(sc); +} + +static void +cue_setmulti_locked(struct cue_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; struct ifmultiaddr *ifma; uint32_t h = 0, i; uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -354,22 +365,13 @@ cue_reset(struct cue_softc *sc) USETW(req.wIndex, 0); USETW(req.wLength, 0); - if (uether_do_request(&sc->sc_ue, &req, NULL, 1000)) { - /* ignore any errors */ - } - + /* XXX ignore any errors */ + (void)usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, NULL, 0, + NULL, 1000); /* * wait a little while for the chip to get its brains in order: */ - uether_pause(&sc->sc_ue, hz / 100); -} - -static void -cue_attach_post(struct usb_ether *ue) -{ - struct cue_softc *sc = uether_getsc(ue); - - cue_getmac(sc, ue->ue_eaddr); + usb_pause_mtx(&sc->sc_mtx, hz / 100); } static int @@ -396,12 +398,18 @@ cue_attach(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); struct cue_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp; uint8_t iface_index; int error; device_set_usb_desc(dev); + + sc->sc_dev = dev; + sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sleepout_create(&sc->sc_sleepout, "cue sleepout"); + sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_setmulti, 0, cue_setmulti, sc); iface_index = CUE_IFACE_IDX; error = usbd_transfer_setup(uaa->device, &iface_index, @@ -411,19 +419,32 @@ cue_attach(device_t dev) goto detach; } - ue->ue_sc = sc; - ue->ue_dev = dev; - ue->ue_udev = uaa->device; - ue->ue_mtx = &sc->sc_mtx; - ue->ue_methods = &cue_ue_methods; - - error = uether_ifattach(ue); - if (error) { - device_printf(dev, "could not attach interface\n"); + CUE_LOCK(sc); + cue_getmac(sc, sc->sc_eaddr); + CUE_UNLOCK(sc); + + sc->sc_ifp = ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(sc->sc_dev, "could not allocate ifnet\n"); goto detach; } - return (0); /* success */ + ifp->if_softc = sc; + if_initname(ifp, device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev)); + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = cue_ioctl; + ifp->if_start = cue_start; + ifp->if_init = cue_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + if_printf(ifp, " on %s\n", + device_get_nameunit(sc->sc_dev)); + ether_ifattach(ifp, sc->sc_eaddr); + return (0); detach: cue_detach(dev); return (ENXIO); /* failure */ @@ -433,10 +454,19 @@ static int cue_detach(device_t dev) { struct cue_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp = sc->sc_ifp; + sleepout_drain(&sc->sc_watchdog); + taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER); - uether_ifdetach(ue); + if (ifp != NULL) { + CUE_LOCK(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + CUE_UNLOCK(sc); + ether_ifdetach(ifp); + if_free(ifp); + } + sleepout_free(&sc->sc_sleepout); mtx_destroy(&sc->sc_mtx); return (0); @@ -446,8 +476,7 @@ static void cue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct cue_softc *sc = usbd_xfer_softc(xfer); - struct usb_ether *ue = &sc->sc_ue; - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; uint8_t buf[2]; int len; @@ -468,13 +497,13 @@ cue_bulk_read_callback(struct usb_xfer * len = buf[0] | (buf[1] << 8); len = min(actlen, len); - uether_rxbuf(ue, pc, 2, len); + cue_rxbuf(sc, pc, 2, len); /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - uether_rxflush(ue); + cue_rxflush(sc); return; default: /* Error */ @@ -495,7 +524,7 @@ static void cue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { struct cue_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; struct mbuf *m; uint8_t buf[2]; @@ -553,10 +582,9 @@ tr_setup: } static void -cue_tick(struct usb_ether *ue) +cue_tick(struct cue_softc *sc) { - struct cue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; CUE_LOCK_ASSERT(sc, MA_OWNED); @@ -569,9 +597,9 @@ cue_tick(struct usb_ether *ue) } static void -cue_start(struct usb_ether *ue) +cue_start(struct ifnet *ifp) { - struct cue_softc *sc = uether_getsc(ue); + struct cue_softc *sc = ifp->if_softc; /* * start the USB transfers, if not already started: @@ -581,10 +609,19 @@ cue_start(struct usb_ether *ue) } static void -cue_init(struct usb_ether *ue) +cue_init(void *arg) { - struct cue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct cue_softc *sc = arg; + + CUE_LOCK(sc); + cue_init_locked(sc); + CUE_UNLOCK(sc); +} + +static void +cue_init_locked(struct cue_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; int i; CUE_LOCK_ASSERT(sc, MA_OWNED); @@ -592,7 +629,7 @@ cue_init(struct usb_ether *ue) /* * Cancel pending I/O and free all RX/TX buffers. */ - cue_stop(ue); + cue_stop(sc); #if 0 cue_reset(sc); #endif @@ -604,7 +641,7 @@ cue_init(struct usb_ether *ue) cue_csr_write_1(sc, CUE_ETHCTL, CUE_ETHCTL_RX_ON | CUE_ETHCTL_MCAST_ON); /* Load the multicast filter */ - cue_setpromisc(ue); + cue_setpromisc(sc); /* * Set the number of RX and TX buffers that we want @@ -623,7 +660,8 @@ cue_init(struct usb_ether *ue) usbd_xfer_set_stall(sc->sc_xfer[CUE_BULK_DT_WR]); ifp->if_drv_flags |= IFF_DRV_RUNNING; - cue_start(ue); + sleepout_reset(&sc->sc_watchdog, hz, cue_watchdog, sc); + cue_start(sc->sc_ifp); } /* @@ -631,10 +669,9 @@ cue_init(struct usb_ether *ue) * RX and TX lists. */ static void -cue_stop(struct usb_ether *ue) +cue_stop(struct cue_softc *sc) { - struct cue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; CUE_LOCK_ASSERT(sc, MA_OWNED); @@ -649,3 +686,114 @@ cue_stop(struct usb_ether *ue) cue_csr_write_1(sc, CUE_ETHCTL, 0); cue_reset(sc); } + +static struct mbuf * +cue_newbuf(void) +{ + struct mbuf *m_new; + + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new == NULL) + return (NULL); + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, ETHER_ALIGN); + return (m_new); +} + +static int +cue_rxbuf(struct cue_softc *sc, struct usb_page_cache *pc, + unsigned int offset, unsigned int len) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + CUE_LOCK_ASSERT(sc, MA_OWNED); + + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) + return (1); + + m = cue_newbuf(); + if (m == NULL) { + ifp->if_ierrors++; + return (ENOMEM); + } + + usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); + + /* finalize mbuf */ + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + /* enqueue for later when the lock can be released */ + _IF_ENQUEUE(&sc->sc_rxq, m); + return (0); +} + +static void +cue_rxflush(struct cue_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + CUE_LOCK_ASSERT(sc, MA_OWNED); + + for (;;) { + _IF_DEQUEUE(&sc->sc_rxq, m); + if (m == NULL) + break; + + /* + * The USB xfer has been resubmitted so its safe to unlock now. + */ + CUE_UNLOCK(sc); + ifp->if_input(ifp, m); + CUE_LOCK(sc); + } +} + +static int +cue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct cue_softc *sc = ifp->if_softc; + int error = 0; + + switch (command) { + case SIOCSIFFLAGS: + CUE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + cue_setpromisc(sc); + else + cue_init_locked(sc); + } else + cue_stop(sc); + CUE_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifp->if_flags & IFF_UP && + ifp->if_drv_flags & IFF_DRV_RUNNING) + taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, + &sc->sc_setmulti); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + return (error); +} + +static void +cue_watchdog(void *arg) +{ + struct cue_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + cue_tick(sc); + sleepout_reset(&sc->sc_watchdog, hz, cue_watchdog, sc); +} Modified: user/weongyo/usb/sys/dev/usb/net/if_cuereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Thu Sep 9 02:52:44 2010 (r212347) +++ user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Thu Sep 9 03:07:39 2010 (r212348) @@ -119,10 +119,18 @@ enum { }; struct cue_softc { - struct usb_ether sc_ue; + struct ifnet *sc_ifp; struct mtx sc_mtx; - struct usb_xfer *sc_xfer[CUE_N_TRANSFER]; - + device_t sc_dev; + device_t sc_miibus; + struct usb_device *sc_udev; /* used by uether_do_request() */ + struct usb_xfer *sc_xfer[CUE_N_TRANSFER]; + struct sleepout sc_sleepout; + struct sleepout_task sc_watchdog; + struct task sc_setmulti; + struct ifqueue sc_rxq; + /* ethernet address from eeprom */ + uint8_t sc_eaddr[ETHER_ADDR_LEN]; int sc_flags; #define CUE_FLAG_LINK 0x0001 /* got a link */ }; From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 03:12:20 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9DD71065696; Thu, 9 Sep 2010 03:12:20 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 991028FC08; Thu, 9 Sep 2010 03:12:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o893CKfJ021247; Thu, 9 Sep 2010 03:12:20 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o893CK5D021244; Thu, 9 Sep 2010 03:12:20 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009090312.o893CK5D021244@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 03:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212349 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 03:12:20 -0000 Author: weongyo Date: Thu Sep 9 03:12:20 2010 New Revision: 212349 URL: http://svn.freebsd.org/changeset/base/212349 Log: Removes headers for miibus interface because cdce(4) don't use it. Modified: user/weongyo/usb/sys/dev/usb/net/if_cdce.c Modified: user/weongyo/usb/sys/dev/usb/net/if_cdce.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cdce.c Thu Sep 9 03:07:39 2010 (r212348) +++ user/weongyo/usb/sys/dev/usb/net/if_cdce.c Thu Sep 9 03:12:20 2010 (r212349) @@ -78,11 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "miibus_if.h" - -#include -#include - #include #include #include From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 13:38:37 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BBCE10656BA; Thu, 9 Sep 2010 13:38:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37BDC8FC1A; Thu, 9 Sep 2010 13:38:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89Dcbqm088152; Thu, 9 Sep 2010 13:38:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89DcaZt088137; Thu, 9 Sep 2010 13:38:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009091338.o89DcaZt088137@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 9 Sep 2010 13:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212361 - in user/nwhitehorn/ps3: arm/conf boot/fdt/dts boot/forth cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/sys dev/acpica dev/ata dev/ata/chipsets... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 13:38:37 -0000 Author: nwhitehorn Date: Thu Sep 9 13:38:36 2010 New Revision: 212361 URL: http://svn.freebsd.org/changeset/base/212361 Log: IFC @ r212360 to pick up recent PowerPC-related memory management and VM fixes. Added: user/nwhitehorn/ps3/arm/conf/DOCKSTAR - copied unchanged from r212360, head/sys/arm/conf/DOCKSTAR user/nwhitehorn/ps3/boot/fdt/dts/dockstar.dts - copied unchanged from r212360, head/sys/boot/fdt/dts/dockstar.dts Modified: user/nwhitehorn/ps3/boot/forth/beastie.4th user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/sys/dtrace.h user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c user/nwhitehorn/ps3/dev/ata/ata-all.h user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c user/nwhitehorn/ps3/dev/ata/chipsets/ata-serverworks.c user/nwhitehorn/ps3/dev/atkbdc/psm.c user/nwhitehorn/ps3/dev/bge/if_bge.c user/nwhitehorn/ps3/dev/e1000/if_em.c user/nwhitehorn/ps3/dev/e1000/if_em.h user/nwhitehorn/ps3/dev/mii/brgphy.c user/nwhitehorn/ps3/dev/mii/brgphyreg.h user/nwhitehorn/ps3/dev/pci/pcireg.h user/nwhitehorn/ps3/fs/nfsclient/nfs_clrpcops.c user/nwhitehorn/ps3/fs/nfsclient/nfs_clvnops.c user/nwhitehorn/ps3/fs/nfsclient/nfsnode.h user/nwhitehorn/ps3/fs/tmpfs/tmpfs_vnops.c user/nwhitehorn/ps3/kern/kern_fork.c user/nwhitehorn/ps3/kern/subr_bus.c user/nwhitehorn/ps3/kern/vfs_mount.c user/nwhitehorn/ps3/mips/mips/busdma_machdep.c user/nwhitehorn/ps3/mips/rmi/dev/nlge/if_nlge.c user/nwhitehorn/ps3/mips/rmi/dev/xlr/rge.c user/nwhitehorn/ps3/mips/rmi/fmn.c user/nwhitehorn/ps3/mips/rmi/msgring.h user/nwhitehorn/ps3/mips/rmi/xlr_pci.c user/nwhitehorn/ps3/nfsclient/nfs_vnops.c user/nwhitehorn/ps3/nfsclient/nfsnode.h user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c user/nwhitehorn/ps3/sys/time.h user/nwhitehorn/ps3/vm/vm_mmap.c user/nwhitehorn/ps3/vm/vm_pageout.c user/nwhitehorn/ps3/x86/pci/qpi.c Directory Properties: user/nwhitehorn/ps3/ (props changed) user/nwhitehorn/ps3/amd64/include/xen/ (props changed) user/nwhitehorn/ps3/boot/powerpc/ps3/ (props changed) user/nwhitehorn/ps3/cddl/contrib/opensolaris/ (props changed) user/nwhitehorn/ps3/contrib/dev/acpica/ (props changed) user/nwhitehorn/ps3/contrib/pf/ (props changed) user/nwhitehorn/ps3/contrib/x86emu/ (props changed) user/nwhitehorn/ps3/dev/xen/xenpci/ (props changed) user/nwhitehorn/ps3/powerpc/ps3/ (props changed) Copied: user/nwhitehorn/ps3/arm/conf/DOCKSTAR (from r212360, head/sys/arm/conf/DOCKSTAR) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/arm/conf/DOCKSTAR Thu Sep 9 13:38:36 2010 (r212361, copy of r212360, head/sys/arm/conf/DOCKSTAR) @@ -0,0 +1,76 @@ +# +# Custom kernel for Seagate DockStar (Marvell SheevaPlug based) devices. +# +# $FreeBSD$ +# + +ident DOCKSTAR +include "../mv/kirkwood/std.sheevaplug" + +options SOC_MV_KIRKWOOD +makeoptions MODULES_OVERRIDE="" + +#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options NFSCLIENT #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_COMPAT +options BOOTP_WIRED_TO=mge0 + +# Root fs on USB device +#options ROOTDEVNAME=\"ufs:/dev/da0a\" + +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options MUTEX_NOINLINE +options RWLOCK_NOINLINE +options NO_FFS_SNAPSHOT +options NO_SWAPPING + +# Debugging +options ALT_BREAK_TO_DEBUGGER +options DDB +options KDB + +# Pseudo devices +device md +device random +device pty +device loop + +# Serial ports +device uart + +# Networking +device ether +device mge # Marvell Gigabit Ethernet controller +device mii +device bpf +options HZ=1000 +options DEVICE_POLLING +device vlan + +# USB +options USB_DEBUG # enable debug msgs +device usb +device ehci +device umass +device scbus +device pass +device da + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=dockstar.dts Copied: user/nwhitehorn/ps3/boot/fdt/dts/dockstar.dts (from r212360, head/sys/boot/fdt/dts/dockstar.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nwhitehorn/ps3/boot/fdt/dts/dockstar.dts Thu Sep 9 13:38:36 2010 (r212361, copy of r212360, head/sys/boot/fdt/dts/dockstar.dts) @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Seagate DockStar (Marvell SheevaPlug based) Device Tree Source. + * + * $FreeBSD$ + */ + +/dts-v1/; + +/ { + model = "seagate,DockStar"; + compatible = "DockStar"; + #address-cells = <1>; + #size-cells = <1>; + + aliases { + ethernet0 = &enet0; + mpp = &MPP; + serial0 = &serial0; + serial1 = &serial1; + soc = &SOC; + sram = &SRAM; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "ARM,88FR131"; + reg = <0x0>; + d-cache-line-size = <32>; // 32 bytes + i-cache-line-size = <32>; // 32 bytes + d-cache-size = <0x4000>; // L1, 16K + i-cache-size = <0x4000>; // L1, 16K + timebase-frequency = <0>; + bus-frequency = <0>; + clock-frequency = <0>; + }; + }; + + memory { + device_type = "memory"; + reg = <0x0 0x8000000>; // 128M at 0x0 + }; + + localbus@f1000000 { + #address-cells = <2>; + #size-cells = <1>; + compatible = "mrvl,lbc"; + + /* This reflects CPU decode windows setup. */ + ranges = <0x0 0x0f 0xf9300000 0x00100000 + 0x1 0x1e 0xfa000000 0x00100000 + 0x2 0x1d 0xfa100000 0x02000000 + 0x3 0x1b 0xfc100000 0x00000400>; + + nor@0,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; + reg = <0x0 0x0 0x00100000>; + bank-width = <2>; + device-width = <1>; + }; + + led@1,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "led"; + reg = <0x1 0x0 0x00100000>; + }; + + nor@2,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; + reg = <0x2 0x0 0x02000000>; + bank-width = <2>; + device-width = <1>; + }; + + nand@3,0 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0x3 0x0 0x00100000>; + bank-width = <2>; + device-width = <1>; + }; + }; + + SOC: soc88f6281@f1000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges = <0x0 0xf1000000 0x00100000>; + bus-frequency = <0>; + + PIC: pic@20200 { + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + reg = <0x20200 0x3c>; + compatible = "mrvl,pic"; + }; + + timer@20300 { + compatible = "mrvl,timer"; + reg = <0x20300 0x30>; + interrupts = <1>; + interrupt-parent = <&PIC>; + mrvl,has-wdt; + }; + + MPP: mpp@10000 { + #pin-cells = <2>; + compatible = "mrvl,mpp"; + reg = <0x10000 0x34>; + pin-count = <50>; + pin-map = < + 0 1 /* MPP[0]: NF_IO[2] */ + 1 1 /* MPP[1]: NF_IO[3] */ + 2 1 /* MPP[2]: NF_IO[4] */ + 3 1 /* MPP[3]: NF_IO[5] */ + 4 1 /* MPP[4]: NF_IO[6] */ + 5 1 /* MPP[5]: NF_IO[7] */ + 6 1 /* MPP[6]: SYSRST_OUTn */ + 8 2 /* MPP[8]: UA0_RTS */ + 9 2 /* MPP[9]: UA0_CTS */ + 10 3 /* MPP[10]: UA0_TXD */ + 11 3 /* MPP[11]: UA0_RXD */ + 12 1 /* MPP[12]: SD_CLK */ + 13 1 /* MPP[13]: SD_CMD */ + 14 1 /* MPP[14]: SD_D[0] */ + 15 1 /* MPP[15]: SD_D[1] */ + 16 1 /* MPP[16]: SD_D[2] */ + 17 1 /* MPP[17]: SD_D[3] */ + 18 1 /* MPP[18]: NF_IO[0] */ + 19 1 /* MPP[19]: NF_IO[1] */ + 29 1 >; /* MPP[29]: TSMP[9] */ + }; + + GPIO: gpio@10100 { + #gpio-cells = <3>; + compatible = "mrvl,gpio"; + reg = <0x10100 0x20>; + gpio-controller; + interrupts = <35 36 37 38 39 40 41>; + interrupt-parent = <&PIC>; + }; + + rtc@10300 { + compatible = "mrvl,rtc"; + reg = <0x10300 0x08>; + }; + + twsi@11000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mrvl,twsi"; + reg = <0x11000 0x20>; + interrupts = <43>; + interrupt-parent = <&PIC>; + }; + + enet0: ethernet@72000 { + #address-cells = <1>; + #size-cells = <1>; + model = "V2"; + compatible = "mrvl,ge"; + reg = <0x72000 0x2000>; + ranges = <0x0 0x72000 0x2000>; + local-mac-address = [ 00 00 00 00 00 00 ]; + interrupts = <12 13 14 11 46>; + interrupt-parent = <&PIC>; + phy-handle = <&phy0>; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mrvl,mdio"; + + phy0: ethernet-phy@0 { + reg = <0x0>; + }; + }; + }; + + serial0: serial@12000 { + compatible = "ns16550"; + reg = <0x12000 0x20>; + reg-shift = <2>; + clock-frequency = <0>; + interrupts = <33>; + interrupt-parent = <&PIC>; + }; + + serial1: serial@12100 { + compatible = "ns16550"; + reg = <0x12100 0x20>; + reg-shift = <2>; + clock-frequency = <0>; + interrupts = <34>; + interrupt-parent = <&PIC>; + }; + + crypto@30000 { + compatible = "mrvl,cesa"; + reg = <0x30000 0x10000>; + interrupts = <22>; + interrupt-parent = <&PIC>; + }; + + usb@50000 { + compatible = "mrvl,usb-ehci", "usb-ehci"; + reg = <0x50000 0x1000>; + interrupts = <48 19>; + interrupt-parent = <&PIC>; + }; + + xor@60000 { + compatible = "mrvl,xor"; + reg = <0x60000 0x1000>; + interrupts = <5 6 7 8>; + interrupt-parent = <&PIC>; + }; + }; + + SRAM: sram@fd000000 { + compatible = "mrvl,cesa-sram"; + reg = <0xfd000000 0x00100000>; + }; + + chosen { + stdin = "serial0"; + stdout = "serial0"; + }; +}; Modified: user/nwhitehorn/ps3/boot/forth/beastie.4th ============================================================================== --- user/nwhitehorn/ps3/boot/forth/beastie.4th Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/boot/forth/beastie.4th Thu Sep 9 13:38:36 2010 (r212361) @@ -240,7 +240,10 @@ set-current drop 10 else - 0 0 2swap >number drop drop drop + 2dup s" -1" compare 0= if + 0 boot + then + 0 s>d 2swap >number 2drop drop then begin dup tkey Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Thu Sep 9 13:38:36 2010 (r212361) @@ -9218,7 +9218,6 @@ dtrace_difo_init(dtrace_difo_t *dp, dtra dtrace_difo_hold(dp); } -#if defined(sun) static dtrace_difo_t * dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate) { @@ -9262,7 +9261,6 @@ dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_difo_init(new, vstate); return (new); } -#endif static void dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate) @@ -14615,12 +14613,16 @@ dtrace_helpers_create(proc_t *p) } #if defined(sun) -static void -dtrace_helpers_destroy(void) +static +#endif +void +dtrace_helpers_destroy(proc_t *p) { dtrace_helpers_t *help; dtrace_vstate_t *vstate; +#if defined(sun) proc_t *p = curproc; +#endif int i; mutex_enter(&dtrace_lock); @@ -14707,7 +14709,10 @@ dtrace_helpers_destroy(void) mutex_exit(&dtrace_lock); } -static void +#if defined(sun) +static +#endif +void dtrace_helpers_duplicate(proc_t *from, proc_t *to) { dtrace_helpers_t *help, *newhelp; @@ -14788,7 +14793,6 @@ dtrace_helpers_duplicate(proc_t *from, p if (hasprovs) dtrace_helper_provider_register(to, newhelp, NULL); } -#endif #if defined(sun) /* Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Sep 9 13:38:36 2010 (r212361) @@ -456,6 +456,16 @@ fasttrap_fork(proc_t *p, proc_t *cp) #if defined(sun) ASSERT(p->p_dtrace_count > 0); #else + if (p->p_dtrace_helpers) { + /* + * dtrace_helpers_duplicate() allocates memory. + */ + PROC_UNLOCK(p); + PROC_UNLOCK(cp); + dtrace_helpers_duplicate(p, cp); + PROC_LOCK(cp); + PROC_LOCK(p); + } /* * This check is purposely here instead of in kern_fork.c because, * for legal resons, we cannot include the dtrace_cddl.h header @@ -539,6 +549,10 @@ fasttrap_exec_exit(proc_t *p) * static probes are handled by the meta-provider remove entry point. */ fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0); +#if !defined(sun) + if (p->p_dtrace_helpers) + dtrace_helpers_destroy(p); +#endif PROC_LOCK(p); } Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Thu Sep 9 13:38:36 2010 (r212361) @@ -2289,6 +2289,11 @@ extern int dtrace_blksuword32(uintptr_t, extern void dtrace_getfsr(uint64_t *); #endif +#if !defined(sun) +extern void dtrace_helpers_duplicate(proc_t *, proc_t *); +extern void dtrace_helpers_destroy(proc_t *); +#endif + #define DTRACE_CPUFLAG_ISSET(flag) \ (cpu_core[curcpu].cpuc_dtrace_flags & (flag)) Modified: user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c ============================================================================== --- user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c Thu Sep 9 13:38:36 2010 (r212361) @@ -89,6 +89,8 @@ struct hpet_softc { int mode; int intr_rid; int irq; + int pcpu_cpu; + int pcpu_misrouted; int pcpu_master; int pcpu_slaves[MAXCPU]; struct resource *intr_res; @@ -185,7 +187,7 @@ restart: if (fdiv < 5000) { bus_read_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num)); t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); - if ((int32_t)(t->last - cmp) < 0) { + if ((int32_t)(t->last - cmp) >= 0) { fdiv *= 2; goto restart; } @@ -215,6 +217,26 @@ hpet_intr_single(void *arg) struct hpet_softc *sc = t->sc; uint32_t now; + /* Check that per-CPU timer interrupt reached right CPU. */ + if (t->pcpu_cpu >= 0 && t->pcpu_cpu != curcpu) { + if ((++t->pcpu_misrouted) % 32 == 0) { + printf("HPET interrupt routed to the wrong CPU" + " (timer %d CPU %d -> %d)!\n", + t->num, t->pcpu_cpu, curcpu); + } + + /* + * Reload timer, hoping that next time may be more lucky + * (system will manage proper interrupt binding). + */ + if ((t->mode == 1 && (t->caps & HPET_TCAP_PER_INT) == 0) || + t->mode == 2) { + t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), + t->last + sc->freq / 8); + } + return (FILTER_HANDLED); + } if (t->mode == 1 && (t->caps & HPET_TCAP_PER_INT) == 0) { t->last += t->div; @@ -394,6 +416,8 @@ hpet_attach(device_t dev) t->mode = 0; t->intr_rid = -1; t->irq = -1; + t->pcpu_cpu = -1; + t->pcpu_misrouted = 0; t->pcpu_master = -1; t->caps = bus_read_4(sc->mem_res, HPET_TIMER_CAP_CNF(i)); t->vectors = bus_read_4(sc->mem_res, HPET_TIMER_CAP_CNF(i) + 4); @@ -534,6 +558,7 @@ hpet_attach(device_t dev) if (t->irq >= 0 && num_percpu_t > 0) { if (cur_cpu == CPU_FIRST()) pcpu_master = i; + t->pcpu_cpu = cur_cpu; t->pcpu_master = pcpu_master; sc->t[pcpu_master]. pcpu_slaves[cur_cpu] = i; Modified: user/nwhitehorn/ps3/dev/ata/ata-all.h ============================================================================== --- user/nwhitehorn/ps3/dev/ata/ata-all.h Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/ata/ata-all.h Thu Sep 9 13:38:36 2010 (r212361) @@ -566,6 +566,7 @@ struct ata_channel { #define ATA_SATA 0x80 #define ATA_DMA_BEFORE_CMD 0x100 #define ATA_KNOWN_PRESENCE 0x200 +#define ATA_STATUS_IS_LONG 0x400 int pm_level; /* power management level */ int devices; /* what is present */ Modified: user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c ============================================================================== --- user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/ata/ata-lowlevel.c Thu Sep 9 13:38:36 2010 (r212361) @@ -516,10 +516,13 @@ ata_generic_reset(device_t dev) if ((mask & 0x01) && (stat0 & ATA_S_BUSY)) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_MASTER)); DELAY(10); + if (ch->flags & ATA_STATUS_IS_LONG) + stat0 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff; + else + stat0 = ATA_IDX_INB(ch, ATA_STATUS); err = ATA_IDX_INB(ch, ATA_ERROR); lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); - stat0 = ATA_IDX_INB(ch, ATA_STATUS); if (bootverbose) device_printf(dev, "stat0=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n", @@ -546,10 +549,13 @@ ata_generic_reset(device_t dev) !((mask & 0x01) && (stat0 & ATA_S_BUSY))) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_SLAVE)); DELAY(10); + if (ch->flags & ATA_STATUS_IS_LONG) + stat1 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff; + else + stat1 = ATA_IDX_INB(ch, ATA_STATUS); err = ATA_IDX_INB(ch, ATA_ERROR); lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); - stat1 = ATA_IDX_INB(ch, ATA_STATUS); if (bootverbose) device_printf(dev, "stat1=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n", Modified: user/nwhitehorn/ps3/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- user/nwhitehorn/ps3/dev/ata/chipsets/ata-serverworks.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/ata/chipsets/ata-serverworks.c Thu Sep 9 13:38:36 2010 (r212361) @@ -58,9 +58,8 @@ static int ata_serverworks_ch_detach(dev static void ata_serverworks_tf_read(struct ata_request *request); static void ata_serverworks_tf_write(struct ata_request *request); static int ata_serverworks_setmode(device_t dev, int target, int mode); -#ifdef __powerpc__ +static void ata_serverworks_sata_reset(device_t dev); static int ata_serverworks_status(device_t dev); -#endif /* misc defines */ #define SWKS_33 0 @@ -101,7 +100,6 @@ ata_serverworks_probe(device_t dev) return (BUS_PROBE_DEFAULT); } -#ifdef __powerpc__ static int ata_serverworks_status(device_t dev) { @@ -123,7 +121,6 @@ ata_serverworks_status(device_t dev) return ata_pci_status(dev); } -#endif static int ata_serverworks_chipinit(device_t dev) @@ -145,6 +142,7 @@ ata_serverworks_chipinit(device_t dev) ctlr->ch_detach = ata_serverworks_ch_detach; ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; + ctlr->reset = ata_serverworks_sata_reset; return 0; } else if (ctlr->chip->cfg1 == SWKS_33) { @@ -210,30 +208,20 @@ ata_serverworks_ch_attach(device_t dev) ch->r_io[ATA_SERROR].offset = ch_offset + 0x44; ch->r_io[ATA_SCONTROL].offset = ch_offset + 0x48; - ch->flags |= ATA_NO_SLAVE; - ch->flags |= ATA_SATA; + ch->flags |= ATA_NO_SLAVE | ATA_SATA | ATA_KNOWN_PRESENCE; ata_pci_hw(dev); ch->hw.tf_read = ata_serverworks_tf_read; ch->hw.tf_write = ata_serverworks_tf_write; -#ifdef __powerpc__ - ch->hw.status = ata_serverworks_status; -#endif if (ctlr->chip->chipid == ATA_K2) { /* - * The revision 1 K2 SATA controller has interesting bugs. Patch them. - * These magic numbers regulate interrupt delivery in the first few - * cases and are pure magic in the last case. - * - * Values obtained from the Darwin driver. + * Set SICR registers to turn off waiting for a status message + * before sending FIS. Values obtained from the Darwin driver. */ - ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, 0x04); - ATA_IDX_OUTL(ch, ATA_SERROR, 0xffffffff); - ATA_IDX_OUTL(ch, ATA_SCONTROL, 0x00000300); - ATA_OUTL(ctlr->r_res2, ch_offset + 0x88, 0); ATA_OUTL(ctlr->r_res2, ch_offset + 0x80, ATA_INL(ctlr->r_res2, ch_offset + 0x80) & ~0x00040000); + ATA_OUTL(ctlr->r_res2, ch_offset + 0x88, 0); /* * Some controllers have a bug where they will send the command @@ -244,6 +232,14 @@ ata_serverworks_ch_attach(device_t dev) */ ch->flags |= ATA_DMA_BEFORE_CMD; + + /* + * The status register must be read as a long to fill the other + * registers. + */ + + ch->hw.status = ata_serverworks_status; + ch->flags |= ATA_STATUS_IS_LONG; } /* chip does not reliably do 64K DMA transfers */ @@ -404,4 +400,15 @@ ata_serverworks_setmode(device_t dev, in return (mode); } +static void +ata_serverworks_sata_reset(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ata_sata_phy_reset(dev, -1, 1)) + ata_generic_reset(dev); + else + ch->devices = 0; +} + ATA_DECLARE_DRIVER(ata_serverworks); Modified: user/nwhitehorn/ps3/dev/atkbdc/psm.c ============================================================================== --- user/nwhitehorn/ps3/dev/atkbdc/psm.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/atkbdc/psm.c Thu Sep 9 13:38:36 2010 (r212361) @@ -143,11 +143,6 @@ __FBSDID("$FreeBSD$"); #define MOUSE_PS2PLUS_PACKET_TYPE(b) \ (((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4)) -/* some macros */ -#define PSM_UNIT(dev) (dev2unit(dev) >> 1) -#define PSM_NBLOCKIO(dev) (dev2unit(dev) & 1) -#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1)) - /* ring buffer */ typedef struct ringbuf { int count; /* # of valid elements in the buffer */ @@ -305,8 +300,6 @@ struct psm_softc { /* Driver status inf struct sigio *async; /* Processes waiting for SIGIO */ }; static devclass_t psm_devclass; -#define PSM_SOFTC(unit) \ - ((struct psm_softc*)devclass_get_softc(psm_devclass, unit)) /* driver state flags (state) */ #define PSM_VALID 0x80 @@ -1457,10 +1450,10 @@ psmattach(device_t dev) } /* Done */ - sc->dev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, FALSE), 0, 0, 0666, - "psm%d", unit); - sc->bdev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, TRUE), 0, 0, 0666, - "bpsm%d", unit); + sc->dev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "psm%d", unit); + sc->dev->si_drv1 = sc; + sc->bdev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "bpsm%d", unit); + sc->bdev->si_drv1 = sc; if (!verbose) printf("psm%d: model %s, device ID %d\n", @@ -1504,14 +1497,13 @@ psmdetach(device_t dev) static int psmopen(struct cdev *dev, int flag, int fmt, struct thread *td) { - int unit = PSM_UNIT(dev); struct psm_softc *sc; int command_byte; int err; int s; /* Get device data */ - sc = PSM_SOFTC(unit); + sc = dev->si_drv1; if ((sc == NULL) || (sc->state & PSM_VALID) == 0) { /* the device is no longer valid/functioning */ return (ENXIO); @@ -1521,7 +1513,7 @@ psmopen(struct cdev *dev, int flag, int if (sc->state & PSM_OPEN) return (EBUSY); - device_busy(devclass_get_device(psm_devclass, unit)); + device_busy(devclass_get_device(psm_devclass, sc->unit)); /* Initialize state */ sc->mode.level = sc->dflt_mode.level; @@ -1565,7 +1557,8 @@ psmopen(struct cdev *dev, int flag, int kbdc_lock(sc->kbdc, FALSE); splx(s); log(LOG_ERR, - "psm%d: unable to set the command byte (psmopen).\n", unit); + "psm%d: unable to set the command byte (psmopen).\n", + sc->unit); return (EIO); } /* @@ -1590,8 +1583,7 @@ psmopen(struct cdev *dev, int flag, int static int psmclose(struct cdev *dev, int flag, int fmt, struct thread *td) { - int unit = PSM_UNIT(dev); - struct psm_softc *sc = PSM_SOFTC(unit); + struct psm_softc *sc = dev->si_drv1; int stat[3]; int command_byte; int s; @@ -1615,7 +1607,8 @@ psmclose(struct cdev *dev, int flag, int KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_ENABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { log(LOG_ERR, - "psm%d: failed to disable the aux int (psmclose).\n", unit); + "psm%d: failed to disable the aux int (psmclose).\n", + sc->unit); /* CONTROLLER ERROR; * NOTE: we shall force our way through. Because the only * ill effect we shall see is that we may not be able @@ -1643,12 +1636,13 @@ psmclose(struct cdev *dev, int flag, int */ log(LOG_ERR, "psm%d: failed to disable the device (psmclose).\n", - unit); + sc->unit); } if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3) log(LOG_DEBUG, - "psm%d: failed to get status (psmclose).\n", unit); + "psm%d: failed to get status (psmclose).\n", + sc->unit); } if (!set_controller_command_byte(sc->kbdc, @@ -1661,7 +1655,7 @@ psmclose(struct cdev *dev, int flag, int */ log(LOG_ERR, "psm%d: failed to disable the aux port (psmclose).\n", - unit); + sc->unit); } /* remove anything left in the output buffer */ @@ -1676,7 +1670,7 @@ psmclose(struct cdev *dev, int flag, int /* close is almost always successful */ sc->state &= ~PSM_OPEN; kbdc_lock(sc->kbdc, FALSE); - device_unbusy(devclass_get_device(psm_devclass, unit)); + device_unbusy(devclass_get_device(psm_devclass, sc->unit)); return (0); } @@ -1745,7 +1739,7 @@ tame_mouse(struct psm_softc *sc, packetb static int psmread(struct cdev *dev, struct uio *uio, int flag) { - register struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; u_char buf[PSM_SMALLBUFSIZE]; int error = 0; int s; @@ -1757,7 +1751,7 @@ psmread(struct cdev *dev, struct uio *ui /* block until mouse activity occured */ s = spltty(); while (sc->queue.count <= 0) { - if (PSM_NBLOCKIO(dev)) { + if (dev != sc->bdev) { splx(s); return (EWOULDBLOCK); } @@ -1892,7 +1886,7 @@ unblock_mouse_data(struct psm_softc *sc, static int psmwrite(struct cdev *dev, struct uio *uio, int flag) { - register struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; u_char buf[PSM_SMALLBUFSIZE]; int error = 0, i, l; @@ -1925,7 +1919,7 @@ static int psmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { - struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; mousemode_t mode; mousestatus_t status; #if (defined(MOUSE_GETVARS)) @@ -3270,7 +3264,7 @@ psmsoftintr(void *arg) MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN, MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN }; - register struct psm_softc *sc = arg; + struct psm_softc *sc = arg; mousestatus_t ms; packetbuf_t *pb; int x, y, z, c, l, s; @@ -3519,7 +3513,7 @@ next: static int psmpoll(struct cdev *dev, int events, struct thread *td) { - struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; int s; int revents = 0; Modified: user/nwhitehorn/ps3/dev/bge/if_bge.c ============================================================================== --- user/nwhitehorn/ps3/dev/bge/if_bge.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/bge/if_bge.c Thu Sep 9 13:38:36 2010 (r212361) @@ -2258,6 +2258,15 @@ bge_dma_alloc(struct bge_softc *sc) if (error) return (error); + /* Create tag for statistics block. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_STATS_SZ, + &sc->bge_cdata.bge_stats_tag, + (uint8_t **)&sc->bge_ldata.bge_stats, + &sc->bge_cdata.bge_stats_map, + &sc->bge_ldata.bge_stats_paddr, "statistics block"); + if (error) + return (error); + /* Create tag for jumbo RX ring. */ if (BGE_IS_JUMBO_CAPABLE(sc)) { error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_JUMBO_RX_RING_SZ, Modified: user/nwhitehorn/ps3/dev/e1000/if_em.c ============================================================================== --- user/nwhitehorn/ps3/dev/e1000/if_em.c Thu Sep 9 13:32:58 2010 (r212360) +++ user/nwhitehorn/ps3/dev/e1000/if_em.c Thu Sep 9 13:38:36 2010 (r212361) @@ -93,7 +93,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.0.5"; +char em_driver_version[] = "7.0.6"; /********************************************************************* @@ -281,6 +281,8 @@ static void em_handle_link(void *context static void em_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); +static __inline void em_rx_discard(struct rx_ring *, int); + #ifdef DEVICE_POLLING static poll_handler_t em_poll; #endif /* POLLING */ @@ -2563,11 +2565,11 @@ msi: val = pci_msi_count(dev); if (val == 1 && pci_alloc_msi(dev, &val) == 0) { adapter->msix = 1; - device_printf(adapter->dev,"Using MSI interrupt\n"); + device_printf(adapter->dev,"Using an MSI interrupt\n"); return (val); } - /* Should only happen due to manual invention */ - device_printf(adapter->dev,"Setup MSIX failure\n"); + /* Should only happen due to manual configuration */ + device_printf(adapter->dev,"No MSI/MSIX using a Legacy IRQ\n"); return (0); } @@ -3681,14 +3683,27 @@ em_refresh_mbufs(struct rx_ring *rxr, in struct adapter *adapter = rxr->adapter; struct mbuf *m; bus_dma_segment_t segs[1]; - bus_dmamap_t map; struct em_buffer *rxbuf; int i, error, nsegs, cleaned; i = rxr->next_to_refresh; cleaned = -1; while (i != limit) { + rxbuf = &rxr->rx_buffers[i]; + /* + ** Just skip entries with a buffer, + ** they can only be due to an error + ** and are to be reused. + */ + if (rxbuf->m_head != NULL) + goto reuse; m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + /* + ** If we have a temporary resource shortage + ** that causes a failure, just abort refresh + ** for now, we will return to this point when + ** reinvoked from em_rxeof. + */ if (m == NULL) goto update; m->m_len = m->m_pkthdr.len = MCLBYTES; @@ -3696,11 +3711,8 @@ em_refresh_mbufs(struct rx_ring *rxr, in if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) m_adj(m, ETHER_ALIGN); - /* - * Using memory from the mbuf cluster pool, invoke the - * bus_dma machinery to arrange the memory mapping. - */ - error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxr->rx_sparemap, + /* Use bus_dma machinery to setup the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { m_free(m); @@ -3710,18 +3722,11 @@ em_refresh_mbufs(struct rx_ring *rxr, in /* If nsegs is wrong then the stack is corrupt. */ KASSERT(nsegs == 1, ("Too many segments returned!")); - rxbuf = &rxr->rx_buffers[i]; - if (rxbuf->m_head != NULL) - bus_dmamap_unload(rxr->rxtag, rxbuf->map); - - map = rxbuf->map; - rxbuf->map = rxr->rx_sparemap; - rxr->rx_sparemap = map; bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); rxbuf->m_head = m; rxr->rx_base[i].buffer_addr = htole64(segs[0].ds_addr); - +reuse: cleaned = i; /* Calculate next index */ if (++i == adapter->num_rx_desc) @@ -3730,8 +3735,10 @@ em_refresh_mbufs(struct rx_ring *rxr, in rxr->next_to_refresh = i; } update: - bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* + ** Update the tail pointer only if, + ** and as far as we have refreshed. + */ if (cleaned != -1) /* Update tail index */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), cleaned); @@ -3781,15 +3788,6 @@ em_allocate_receive_buffers(struct rx_ri goto fail; } - /* Create the spare map (used by getbuf) */ - error = bus_dmamap_create(rxr->rxtag, BUS_DMA_NOWAIT, - &rxr->rx_sparemap); - if (error) { - device_printf(dev, "%s: bus_dmamap_create failed: %d\n", - __func__, error); - goto fail; - } - rxbuf = rxr->rx_buffers; for (int i = 0; i < adapter->num_rx_desc; i++, rxbuf++) { rxbuf = &rxr->rx_buffers[i]; @@ -3956,11 +3954,6 @@ em_free_receive_buffers(struct rx_ring * INIT_DEBUGOUT("free_receive_buffers: begin"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 19:51:54 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4165510657CB; Thu, 9 Sep 2010 19:51:54 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B93F8FC20; Thu, 9 Sep 2010 19:51:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89Jpkgr024732; Thu, 9 Sep 2010 19:51:46 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89Jpk6g024728; Thu, 9 Sep 2010 19:51:46 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009091951.o89Jpk6g024728@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 19:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212375 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 19:51:54 -0000 Author: weongyo Date: Thu Sep 9 19:51:46 2010 New Revision: 212375 URL: http://svn.freebsd.org/changeset/base/212375 Log: kue(4) don't depend on uther module anymore that it's not tested due to lack of H/W. Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c user/weongyo/usb/sys/dev/usb/net/if_kuereg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kue.c Thu Sep 9 19:27:40 2010 (r212374) +++ user/weongyo/usb/sys/dev/usb/net/if_kue.c Thu Sep 9 19:51:46 2010 (r212375) @@ -78,6 +78,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -85,6 +87,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -92,9 +102,8 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR kue_debug #include -#include +#include -#include #include #include @@ -148,13 +157,6 @@ static device_detach_t kue_detach; static usb_callback_t kue_bulk_read_callback; static usb_callback_t kue_bulk_write_callback; -static uether_fn_t kue_attach_post; -static uether_fn_t kue_init; -static uether_fn_t kue_stop; -static uether_fn_t kue_start; -static uether_fn_t kue_setmulti; -static uether_fn_t kue_setpromisc; - static int kue_do_request(struct kue_softc *, struct usb_device_request *, void *); static int kue_setword(struct kue_softc *, uint8_t, uint16_t); @@ -162,6 +164,10 @@ static int kue_ctl(struct kue_softc *, u void *, int); static int kue_load_fw(struct kue_softc *); static void kue_reset(struct kue_softc *); +static void kue_init(void *); +static void kue_init_locked(struct kue_softc *); +static int kue_ioctl(struct ifnet *, u_long, caddr_t); +static void kue_start(struct ifnet *); #ifdef USB_DEBUG static int kue_debug = 0; @@ -212,20 +218,10 @@ static driver_t kue_driver = { static devclass_t kue_devclass; DRIVER_MODULE(kue, uhub, kue_driver, kue_devclass, NULL, 0); -MODULE_DEPEND(kue, uether, 1, 1, 1); MODULE_DEPEND(kue, usb, 1, 1, 1); MODULE_DEPEND(kue, ether, 1, 1, 1); MODULE_VERSION(kue, 1); -static const struct usb_ether_methods kue_ue_methods = { - .ue_attach_post = kue_attach_post, - .ue_start = kue_start, - .ue_init = kue_init, - .ue_stop = kue_stop, - .ue_setmulti = kue_setmulti, - .ue_setpromisc = kue_setpromisc, -}; - /* * We have a custom do_request function which is almost like the * regular do_request function, except it has a much longer timeout. @@ -239,7 +235,8 @@ kue_do_request(struct kue_softc *sc, str { usb_error_t err; - err = uether_do_request(&sc->sc_ue, req, data, 60000); + err = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, req, data, 0, + NULL, 60000); return (err); } @@ -269,7 +266,6 @@ kue_ctl(struct kue_softc *sc, uint8_t rw else req.bmRequestType = UT_READ_VENDOR_DEVICE; - req.bRequest = breq; USETW(req.wValue, val); USETW(req.wIndex, 0); @@ -285,7 +281,7 @@ kue_load_fw(struct kue_softc *sc) uint16_t hwrev; usb_error_t err; - dd = usbd_get_device_descriptor(sc->sc_ue.ue_udev); + dd = usbd_get_device_descriptor(sc->sc_udev); hwrev = UGETW(dd->bcdDevice); /* @@ -309,7 +305,7 @@ kue_load_fw(struct kue_softc *sc) err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN, 0, kue_code_seg, sizeof(kue_code_seg)); if (err) { - device_printf(sc->sc_ue.ue_dev, "failed to load code segment: %s\n", + device_printf(sc->sc_dev, "failed to load code segment: %s\n", usbd_errstr(err)); return(ENXIO); } @@ -318,7 +314,7 @@ kue_load_fw(struct kue_softc *sc) err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN, 0, kue_fix_seg, sizeof(kue_fix_seg)); if (err) { - device_printf(sc->sc_ue.ue_dev, "failed to load fixup segment: %s\n", + device_printf(sc->sc_dev, "failed to load fixup segment: %s\n", usbd_errstr(err)); return(ENXIO); } @@ -327,8 +323,8 @@ kue_load_fw(struct kue_softc *sc) err = kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SEND_SCAN, 0, kue_trig_seg, sizeof(kue_trig_seg)); if (err) { - device_printf(sc->sc_ue.ue_dev, "failed to load trigger segment: %s\n", - usbd_errstr(err)); + device_printf(sc->sc_dev, + "failed to load trigger segment: %s\n", usbd_errstr(err)); return(ENXIO); } @@ -336,10 +332,9 @@ kue_load_fw(struct kue_softc *sc) } static void -kue_setpromisc(struct usb_ether *ue) +kue_setpromisc(struct kue_softc *sc) { - struct kue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; KUE_LOCK_ASSERT(sc, MA_OWNED); @@ -352,10 +347,10 @@ kue_setpromisc(struct usb_ether *ue) } static void -kue_setmulti(struct usb_ether *ue) +kue_setmulti(void *arg, int npending) { - struct kue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct kue_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; struct ifmultiaddr *ifma; int i = 0; @@ -409,27 +404,26 @@ kue_reset(struct kue_softc *sc) struct usb_config_descriptor *cd; usb_error_t err; - cd = usbd_get_config_descriptor(sc->sc_ue.ue_udev); + cd = usbd_get_config_descriptor(sc->sc_udev); - err = usbd_req_set_config(sc->sc_ue.ue_udev, &sc->sc_mtx, + err = usbd_req_set_config(sc->sc_udev, &sc->sc_mtx, cd->bConfigurationValue); if (err) DPRINTF("reset failed (ignored)\n"); /* wait a little while for the chip to get its brains in order */ - uether_pause(&sc->sc_ue, hz / 100); + usb_pause_mtx(&sc->sc_mtx, hz / 100); } static void -kue_attach_post(struct usb_ether *ue) +kue_attach_post(struct kue_softc *sc) { - struct kue_softc *sc = uether_getsc(ue); int error; /* load the firmware into the NIC */ error = kue_load_fw(sc); if (error) { - device_printf(sc->sc_ue.ue_dev, "could not load firmware\n"); + device_printf(sc->sc_dev, "could not load firmware\n"); /* ignore the error */ } @@ -441,7 +435,7 @@ kue_attach_post(struct usb_ether *ue) 0, &sc->sc_desc, sizeof(sc->sc_desc)); /* copy in ethernet address */ - memcpy(ue->ue_eaddr, sc->sc_desc.kue_macaddr, sizeof(ue->ue_eaddr)); + memcpy(sc->sc_eaddr, sc->sc_desc.kue_macaddr, sizeof(sc->sc_eaddr)); } /* @@ -471,12 +465,16 @@ kue_attach(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); struct kue_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp; uint8_t iface_index; int error; device_set_usb_desc(dev); + sc->sc_dev = dev; + sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sleepout_create(&sc->sc_sleepout, "kue sleepout"); + TASK_INIT(&sc->sc_setmulti, 0, kue_setmulti, sc); iface_index = KUE_IFACE_IDX; error = usbd_transfer_setup(uaa->device, &iface_index, @@ -493,19 +491,32 @@ kue_attach(device_t dev) goto detach; } - ue->ue_sc = sc; - ue->ue_dev = dev; - ue->ue_udev = uaa->device; - ue->ue_mtx = &sc->sc_mtx; - ue->ue_methods = &kue_ue_methods; - - error = uether_ifattach(ue); - if (error) { - device_printf(dev, "could not attach interface\n"); + KUE_LOCK(sc); + kue_attach_post(sc); + KUE_UNLOCK(sc); + + sc->sc_ifp = ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(sc->sc_dev, "could not allocate ifnet\n"); goto detach; } - return (0); /* success */ + ifp->if_softc = sc; + if_initname(ifp, device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev)); + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = kue_ioctl; + ifp->if_start = kue_start; + ifp->if_init = kue_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + if_printf(ifp, " on %s\n", + device_get_nameunit(sc->sc_dev)); + ether_ifattach(ifp, sc->sc_eaddr); + return (0); detach: kue_detach(dev); return (ENXIO); /* failure */ @@ -515,16 +526,90 @@ static int kue_detach(device_t dev) { struct kue_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp = sc->sc_ifp; + taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, KUE_N_TRANSFER); - uether_ifdetach(ue); + if (ifp != NULL) { + KUE_LOCK(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + KUE_UNLOCK(sc); + ether_ifdetach(ifp); + if_free(ifp); + } + sleepout_free(&sc->sc_sleepout); mtx_destroy(&sc->sc_mtx); free(sc->sc_mcfilters, M_USBDEV); return (0); } +static void +kue_rxflush(struct kue_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + KUE_LOCK_ASSERT(sc, MA_OWNED); + + for (;;) { + _IF_DEQUEUE(&sc->sc_rxq, m); + if (m == NULL) + break; + + /* + * The USB xfer has been resubmitted so its safe to unlock now. + */ + KUE_UNLOCK(sc); + ifp->if_input(ifp, m); + KUE_LOCK(sc); + } +} + +static struct mbuf * +kue_newbuf(void) +{ + struct mbuf *m_new; + + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new == NULL) + return (NULL); + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, ETHER_ALIGN); + return (m_new); +} + +static int +kue_rxbuf(struct kue_softc *sc, struct usb_page_cache *pc, + unsigned int offset, unsigned int len) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + KUE_LOCK_ASSERT(sc, MA_OWNED); + + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) + return (1); + + m = kue_newbuf(); + if (m == NULL) { + ifp->if_ierrors++; + return (ENOMEM); + } + + usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); + + /* finalize mbuf */ + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + /* enqueue for later when the lock can be released */ + _IF_ENQUEUE(&sc->sc_rxq, m); + return (0); +} + /* * A frame has been uploaded: pass the resulting mbuf chain up to * the higher level protocols. @@ -533,8 +618,7 @@ static void kue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct kue_softc *sc = usbd_xfer_softc(xfer); - struct usb_ether *ue = &sc->sc_ue; - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; uint8_t buf[2]; int len; @@ -555,13 +639,13 @@ kue_bulk_read_callback(struct usb_xfer * len = buf[0] | (buf[1] << 8); len = min(actlen, len); - uether_rxbuf(ue, pc, 2, len); + kue_rxbuf(sc, pc, 2, len); /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - uether_rxflush(ue); + kue_rxflush(sc); return; default: /* Error */ @@ -582,7 +666,7 @@ static void kue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { struct kue_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; struct mbuf *m; int total_len; @@ -647,9 +731,9 @@ tr_setup: } static void -kue_start(struct usb_ether *ue) +kue_start(struct ifnet *ifp) { - struct kue_softc *sc = uether_getsc(ue); + struct kue_softc *sc = ifp->if_softc; /* * start the USB transfers, if not already started: @@ -659,10 +743,19 @@ kue_start(struct usb_ether *ue) } static void -kue_init(struct usb_ether *ue) +kue_init(void *arg) +{ + struct kue_softc *sc = arg; + + KUE_LOCK(sc); + kue_init_locked(sc); + KUE_UNLOCK(sc); +} + +static void +kue_init_locked(struct kue_softc *sc) { - struct kue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; KUE_LOCK_ASSERT(sc, MA_OWNED); @@ -681,19 +774,18 @@ kue_init(struct usb_ether *ue) kue_setword(sc, KUE_CMD_SET_URB_SIZE, 64); /* load the multicast filter */ - kue_setpromisc(ue); + kue_setpromisc(sc); usbd_xfer_set_stall(sc->sc_xfer[KUE_BULK_DT_WR]); ifp->if_drv_flags |= IFF_DRV_RUNNING; - kue_start(ue); + kue_start(sc->sc_ifp); } static void -kue_stop(struct usb_ether *ue) +kue_stop(struct kue_softc *sc) { - struct kue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; KUE_LOCK_ASSERT(sc, MA_OWNED); @@ -705,3 +797,33 @@ kue_stop(struct usb_ether *ue) usbd_transfer_stop(sc->sc_xfer[KUE_BULK_DT_WR]); usbd_transfer_stop(sc->sc_xfer[KUE_BULK_DT_RD]); } + +static int +kue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct kue_softc *sc = ifp->if_softc; + int error = 0; + + switch (command) { + case SIOCSIFFLAGS: + KUE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + kue_init_locked(sc); + } else + kue_stop(sc); + KUE_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifp->if_flags & IFF_UP && + ifp->if_drv_flags & IFF_DRV_RUNNING) + taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, + &sc->sc_setmulti); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + return (error); +} Modified: user/weongyo/usb/sys/dev/usb/net/if_kuereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kuereg.h Thu Sep 9 19:27:40 2010 (r212374) +++ user/weongyo/usb/sys/dev/usb/net/if_kuereg.h Thu Sep 9 19:51:46 2010 (r212375) @@ -124,15 +124,21 @@ enum { }; struct kue_softc { - struct usb_ether sc_ue; + struct ifnet *sc_ifp; + device_t sc_dev; + device_t sc_miibus; + struct usb_device *sc_udev; /* used by uether_do_request() */ + struct usb_xfer *sc_xfer[KUE_N_TRANSFER]; struct mtx sc_mtx; + struct sleepout sc_sleepout; + struct task sc_setmulti; + struct ifqueue sc_rxq; + /* ethernet address from eeprom */ + uint8_t sc_eaddr[ETHER_ADDR_LEN]; struct kue_ether_desc sc_desc; - struct usb_xfer *sc_xfer[KUE_N_TRANSFER]; uint8_t *sc_mcfilters; - int sc_flags; #define KUE_FLAG_LINK 0x0001 - uint16_t sc_rxfilt; }; From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 20:11:41 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 785A21065706; Thu, 9 Sep 2010 20:11:41 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 671E88FC12; Thu, 9 Sep 2010 20:11:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89KBf5P027245; Thu, 9 Sep 2010 20:11:41 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89KBfdV027242; Thu, 9 Sep 2010 20:11:41 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009092011.o89KBfdV027242@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 20:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212377 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 20:11:41 -0000 Author: weongyo Date: Thu Sep 9 20:11:41 2010 New Revision: 212377 URL: http://svn.freebsd.org/changeset/base/212377 Log: rue(4) don't depend on uether module anymore that it's not tested due to lack of H/W. Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_rue.c Thu Sep 9 20:07:40 2010 (r212376) +++ user/weongyo/usb/sys/dev/usb/net/if_rue.c Thu Sep 9 20:11:41 2010 (r212377) @@ -78,6 +78,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -85,6 +87,19 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include +#include + +#include "miibus_if.h" + +#include +#include + #include #include #include @@ -92,9 +107,8 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR rue_debug #include -#include +#include -#include #include #ifdef USB_DEBUG @@ -129,14 +143,6 @@ static usb_callback_t rue_intr_callback; static usb_callback_t rue_bulk_read_callback; static usb_callback_t rue_bulk_write_callback; -static uether_fn_t rue_attach_post; -static uether_fn_t rue_init; -static uether_fn_t rue_stop; -static uether_fn_t rue_start; -static uether_fn_t rue_tick; -static uether_fn_t rue_setmulti; -static uether_fn_t rue_setpromisc; - static int rue_read_mem(struct rue_softc *, uint16_t, void *, int); static int rue_write_mem(struct rue_softc *, uint16_t, void *, int); static uint8_t rue_csr_read_1(struct rue_softc *, uint16_t); @@ -144,10 +150,15 @@ static uint16_t rue_csr_read_2(struct ru static int rue_csr_write_1(struct rue_softc *, uint16_t, uint8_t); static int rue_csr_write_2(struct rue_softc *, uint16_t, uint16_t); static int rue_csr_write_4(struct rue_softc *, int, uint32_t); - static void rue_reset(struct rue_softc *); static int rue_ifmedia_upd(struct ifnet *); static void rue_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static void rue_init(void *); +static void rue_init_locked(struct rue_softc *); +static int rue_ioctl(struct ifnet *, u_long, caddr_t); +static void rue_start(struct ifnet *); +static void rue_stop(struct rue_softc *); +static void rue_watchdog(void *); static const struct usb_config rue_config[RUE_N_TRANSFER] = { @@ -209,24 +220,11 @@ static devclass_t rue_devclass; DRIVER_MODULE(rue, uhub, rue_driver, rue_devclass, NULL, 0); DRIVER_MODULE(miibus, rue, miibus_driver, miibus_devclass, 0, 0); -MODULE_DEPEND(rue, uether, 1, 1, 1); MODULE_DEPEND(rue, usb, 1, 1, 1); MODULE_DEPEND(rue, ether, 1, 1, 1); MODULE_DEPEND(rue, miibus, 1, 1, 1); MODULE_VERSION(rue, 1); -static const struct usb_ether_methods rue_ue_methods = { - .ue_attach_post = rue_attach_post, - .ue_start = rue_start, - .ue_init = rue_init, - .ue_stop = rue_stop, - .ue_tick = rue_tick, - .ue_setmulti = rue_setmulti, - .ue_setpromisc = rue_setpromisc, - .ue_mii_upd = rue_ifmedia_upd, - .ue_mii_sts = rue_ifmedia_sts, -}; - #define RUE_SETBIT(sc, reg, x) \ rue_csr_write_1(sc, reg, rue_csr_read_1(sc, reg) | (x)) @@ -244,7 +242,8 @@ rue_read_mem(struct rue_softc *sc, uint1 USETW(req.wIndex, 0); USETW(req.wLength, len); - return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); + return (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, buf, + 0, NULL, 1000)); } static int @@ -258,7 +257,8 @@ rue_write_mem(struct rue_softc *sc, uint USETW(req.wIndex, 0); USETW(req.wLength, len); - return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); + return (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, buf, + 0, NULL, 1000)); } static uint8_t @@ -343,7 +343,7 @@ rue_miibus_readreg(device_t dev, int phy rval = rue_csr_read_1(sc, reg); goto done; } - device_printf(sc->sc_ue.ue_dev, "bad phy register\n"); + device_printf(sc->sc_dev, "bad phy register\n"); rval = 0; goto done; } @@ -393,7 +393,7 @@ rue_miibus_writereg(device_t dev, int ph rue_csr_write_1(sc, reg, data); goto done; } - device_printf(sc->sc_ue.ue_dev, " bad phy register\n"); + device_printf(sc->sc_dev, " bad phy register\n"); goto done; } rue_csr_write_2(sc, ruereg, data); @@ -450,10 +450,9 @@ rue_miibus_statchg(device_t dev) } static void -rue_setpromisc(struct usb_ether *ue) +rue_setpromisc(struct rue_softc *sc) { - struct rue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; RUE_LOCK_ASSERT(sc, MA_OWNED); @@ -468,10 +467,10 @@ rue_setpromisc(struct usb_ether *ue) * Program the 64-bit multicast hash filter. */ static void -rue_setmulti(struct usb_ether *ue) +rue_setmulti(void *arg, int npending) { - struct rue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct rue_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; uint16_t rxcfg; int h = 0; uint32_t hashes[2] = { 0, 0 }; @@ -531,27 +530,25 @@ rue_reset(struct rue_softc *sc) rue_csr_write_1(sc, RUE_CR, RUE_CR_SOFT_RST); for (i = 0; i != RUE_TIMEOUT; i++) { - if (uether_pause(&sc->sc_ue, hz / 1000)) - break; if (!(rue_csr_read_1(sc, RUE_CR) & RUE_CR_SOFT_RST)) break; + usb_pause_mtx(&sc->sc_mtx, hz / 1000); } if (i == RUE_TIMEOUT) - device_printf(sc->sc_ue.ue_dev, "reset never completed\n"); + device_printf(sc->sc_dev, "reset never completed\n"); - uether_pause(&sc->sc_ue, hz / 100); + usb_pause_mtx(&sc->sc_mtx, hz / 100); } static void -rue_attach_post(struct usb_ether *ue) +rue_attach_post(struct rue_softc *sc) { - struct rue_softc *sc = uether_getsc(ue); /* reset the adapter */ rue_reset(sc); /* get station address from the EEPROM */ - rue_read_mem(sc, RUE_EEPROM_IDR0, ue->ue_eaddr, ETHER_ADDR_LEN); + rue_read_mem(sc, RUE_EEPROM_IDR0, sc->sc_eaddr, ETHER_ADDR_LEN); } /* @@ -581,12 +578,17 @@ rue_attach(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); struct rue_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp; uint8_t iface_index; int error; device_set_usb_desc(dev); + sc->sc_dev = dev; + sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sleepout_create(&sc->sc_sleepout, "rue sleepout"); + sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_setmulti, 0, rue_setmulti, sc); iface_index = RUE_IFACE_IDX; error = usbd_transfer_setup(uaa->device, &iface_index, @@ -597,19 +599,39 @@ rue_attach(device_t dev) goto detach; } - ue->ue_sc = sc; - ue->ue_dev = dev; - ue->ue_udev = uaa->device; - ue->ue_mtx = &sc->sc_mtx; - ue->ue_methods = &rue_ue_methods; + RUE_LOCK(sc); + rue_attach_post(sc); + RUE_UNLOCK(sc); - error = uether_ifattach(ue); + sc->sc_ifp = ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(sc->sc_dev, "could not allocate ifnet\n"); + goto detach; + } + + ifp->if_softc = sc; + if_initname(ifp, device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev)); + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = rue_ioctl; + ifp->if_start = rue_start; + ifp->if_init = rue_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, + rue_ifmedia_upd, rue_ifmedia_sts); if (error) { - device_printf(dev, "could not attach interface\n"); + device_printf(sc->sc_dev, "MII without any PHY\n"); goto detach; } - return (0); /* success */ + if_printf(ifp, " on %s\n", + device_get_nameunit(sc->sc_dev)); + ether_ifattach(ifp, sc->sc_eaddr); + return (0); detach: rue_detach(dev); return (ENXIO); /* failure */ @@ -619,12 +641,22 @@ static int rue_detach(device_t dev) { struct rue_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp = sc->sc_ifp; + sleepout_drain(&sc->sc_watchdog); + taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, RUE_N_TRANSFER); - uether_ifdetach(ue); + if (sc->sc_miibus != NULL) + device_delete_child(sc->sc_dev, sc->sc_miibus); + if (ifp != NULL) { + RUE_LOCK(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + RUE_UNLOCK(sc); + ether_ifdetach(ifp); + if_free(ifp); + } + sleepout_free(&sc->sc_sleepout); mtx_destroy(&sc->sc_mtx); - return (0); } @@ -632,7 +664,7 @@ static void rue_intr_callback(struct usb_xfer *xfer, usb_error_t error) { struct rue_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct rue_intrpkt pkt; struct usb_page_cache *pc; int actlen; @@ -670,11 +702,76 @@ tr_setup: } static void +rue_rxflush(struct rue_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + RUE_LOCK_ASSERT(sc, MA_OWNED); + + for (;;) { + _IF_DEQUEUE(&sc->sc_rxq, m); + if (m == NULL) + break; + + /* + * The USB xfer has been resubmitted so its safe to unlock now. + */ + RUE_UNLOCK(sc); + ifp->if_input(ifp, m); + RUE_LOCK(sc); + } +} + +static struct mbuf * +rue_newbuf(void) +{ + struct mbuf *m_new; + + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new == NULL) + return (NULL); + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, ETHER_ALIGN); + return (m_new); +} + +static int +rue_rxbuf(struct rue_softc *sc, struct usb_page_cache *pc, + unsigned int offset, unsigned int len) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + RUE_LOCK_ASSERT(sc, MA_OWNED); + + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) + return (1); + + m = rue_newbuf(); + if (m == NULL) { + ifp->if_ierrors++; + return (ENOMEM); + } + + usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); + + /* finalize mbuf */ + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + /* enqueue for later when the lock can be released */ + _IF_ENQUEUE(&sc->sc_rxq, m); + return (0); +} + +static void rue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct rue_softc *sc = usbd_xfer_softc(xfer); - struct usb_ether *ue = &sc->sc_ue; - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; uint16_t status; int actlen; @@ -698,13 +795,13 @@ rue_bulk_read_callback(struct usb_xfer * ifp->if_ierrors++; goto tr_setup; } - uether_rxbuf(ue, pc, 0, actlen); + rue_rxbuf(sc, pc, 0, actlen); /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - uether_rxflush(ue); + rue_rxflush(sc); return; default: /* Error */ @@ -724,7 +821,7 @@ static void rue_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { struct rue_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; struct mbuf *m; int temp_len; @@ -794,9 +891,8 @@ tr_setup: } static void -rue_tick(struct usb_ether *ue) +rue_tick(struct rue_softc *sc) { - struct rue_softc *sc = uether_getsc(ue); struct mii_data *mii = GET_MII(sc); RUE_LOCK_ASSERT(sc, MA_OWNED); @@ -806,14 +902,14 @@ rue_tick(struct usb_ether *ue) && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { sc->sc_flags |= RUE_FLAG_LINK; - rue_start(ue); + rue_start(sc->sc_ifp); } } static void -rue_start(struct usb_ether *ue) +rue_start(struct ifnet *ifp) { - struct rue_softc *sc = uether_getsc(ue); + struct rue_softc *sc = ifp->if_softc; /* * start the USB transfers, if not already started: @@ -824,10 +920,19 @@ rue_start(struct usb_ether *ue) } static void -rue_init(struct usb_ether *ue) +rue_init(void *arg) +{ + struct rue_softc *sc = arg; + + RUE_LOCK(sc); + rue_init_locked(sc); + RUE_UNLOCK(sc); +} + +static void +rue_init_locked(struct rue_softc *sc) { - struct rue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; RUE_LOCK_ASSERT(sc, MA_OWNED); @@ -839,7 +944,7 @@ rue_init(struct usb_ether *ue) /* Set MAC address */ rue_write_mem(sc, RUE_IDR0, IF_LLADDR(ifp), ETHER_ADDR_LEN); - rue_stop(ue); + rue_stop(sc); /* * Set the initial TX and RX configuration. @@ -848,9 +953,9 @@ rue_init(struct usb_ether *ue) rue_csr_write_2(sc, RUE_RCR, RUE_RCR_CONFIG|RUE_RCR_AB); /* Load the multicast filter */ - rue_setpromisc(ue); + rue_setpromisc(sc); /* Load the multicast filter. */ - rue_setmulti(ue); + rue_setmulti(sc, 0); /* Enable RX and TX */ rue_csr_write_1(sc, RUE_CR, (RUE_CR_TE | RUE_CR_RE | RUE_CR_EP3CLREN)); @@ -858,7 +963,8 @@ rue_init(struct usb_ether *ue) usbd_xfer_set_stall(sc->sc_xfer[RUE_BULK_DT_WR]); ifp->if_drv_flags |= IFF_DRV_RUNNING; - rue_start(ue); + sleepout_reset(&sc->sc_watchdog, hz, rue_watchdog, sc); + rue_start(sc->sc_ifp); } /* @@ -900,10 +1006,9 @@ rue_ifmedia_sts(struct ifnet *ifp, struc } static void -rue_stop(struct usb_ether *ue) +rue_stop(struct rue_softc *sc) { - struct rue_softc *sc = uether_getsc(ue); - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; RUE_LOCK_ASSERT(sc, MA_OWNED); @@ -921,3 +1026,54 @@ rue_stop(struct usb_ether *ue) rue_reset(sc); } + +static int +rue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct rue_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *)data; + struct mii_data *mii = GET_MII(sc); + int error = 0; + + switch (command) { + case SIOCSIFFLAGS: + RUE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + rue_setpromisc(sc); + else + rue_init_locked(sc); + } else + rue_stop(sc); + RUE_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifp->if_flags & IFF_UP && + ifp->if_drv_flags & IFF_DRV_RUNNING) + taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, + &sc->sc_setmulti); + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + return (error); +} + +static void +rue_watchdog(void *arg) +{ + struct rue_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + rue_tick(sc); + sleepout_reset(&sc->sc_watchdog, hz, rue_watchdog, sc); +} Modified: user/weongyo/usb/sys/dev/usb/net/if_ruereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Thu Sep 9 20:07:40 2010 (r212376) +++ user/weongyo/usb/sys/dev/usb/net/if_ruereg.h Thu Sep 9 20:11:41 2010 (r212377) @@ -144,7 +144,7 @@ #define RUE_RXSTAT_PMATCH (0x04 << 12) #define RUE_RXSTAT_MCAST (0x08 << 12) -#define GET_MII(sc) uether_getmii(&(sc)->sc_ue) +#define GET_MII(sc) (device_get_softc(sc->sc_miibus)) struct rue_intrpkt { uint8_t rue_tsr; @@ -170,10 +170,18 @@ enum { }; struct rue_softc { - struct usb_ether sc_ue; + struct ifnet *sc_ifp; + device_t sc_dev; + device_t sc_miibus; struct mtx sc_mtx; - struct usb_xfer *sc_xfer[RUE_N_TRANSFER]; - + struct usb_device *sc_udev; /* used by uether_do_request() */ + struct usb_xfer *sc_xfer[RUE_N_TRANSFER]; + struct sleepout sc_sleepout; + struct sleepout_task sc_watchdog; + struct task sc_setmulti; + struct ifqueue sc_rxq; + /* ethernet address from eeprom */ + uint8_t sc_eaddr[ETHER_ADDR_LEN]; int sc_flags; #define RUE_FLAG_LINK 0x0001 }; From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:17:25 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B484B1065670; Thu, 9 Sep 2010 23:17:25 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A26C58FC08; Thu, 9 Sep 2010 23:17:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NHPWb047681; Thu, 9 Sep 2010 23:17:25 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NHPJM047678; Thu, 9 Sep 2010 23:17:25 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009092317.o89NHPJM047678@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 23:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212391 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:17:25 -0000 Author: weongyo Date: Thu Sep 9 23:17:25 2010 New Revision: 212391 URL: http://svn.freebsd.org/changeset/base/212391 Log: udav(4) now doesn't depend on uether module though it's tested due to lack of H/W. Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udav.c Thu Sep 9 21:59:53 2010 (r212390) +++ user/weongyo/usb/sys/dev/usb/net/if_udav.c Thu Sep 9 23:17:25 2010 (r212391) @@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -66,6 +68,19 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include +#include + +#include "miibus_if.h" + +#include +#include + #include #include #include @@ -73,9 +88,8 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR udav_debug #include -#include +#include -#include #include /* prototypes */ @@ -88,14 +102,6 @@ static usb_callback_t udav_bulk_write_ca static usb_callback_t udav_bulk_read_callback; static usb_callback_t udav_intr_callback; -static uether_fn_t udav_attach_post; -static uether_fn_t udav_init; -static uether_fn_t udav_stop; -static uether_fn_t udav_start; -static uether_fn_t udav_tick; -static uether_fn_t udav_setmulti; -static uether_fn_t udav_setpromisc; - static int udav_csr_read(struct udav_softc *, uint16_t, void *, int); static int udav_csr_write(struct udav_softc *, uint16_t, void *, int); static uint8_t udav_csr_read1(struct udav_softc *, uint16_t); @@ -103,13 +109,20 @@ static int udav_csr_write1(struct udav_s static void udav_reset(struct udav_softc *); static int udav_ifmedia_upd(struct ifnet *); static void udav_ifmedia_status(struct ifnet *, struct ifmediareq *); +static void udav_init(void *); +static void udav_init_locked(struct udav_softc *); +static int udav_ioctl(struct ifnet *, u_long, caddr_t); +static void udav_start(struct ifnet *); +static void udav_setmulti(void *, int); +static void udav_stop(struct udav_softc *); +static void udav_setpromisc(struct udav_softc *); +static void udav_watchdog(void *); static miibus_readreg_t udav_miibus_readreg; static miibus_writereg_t udav_miibus_writereg; static miibus_statchg_t udav_miibus_statchg; static const struct usb_config udav_config[UDAV_N_TRANSFER] = { - [UDAV_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -119,7 +132,6 @@ static const struct usb_config udav_conf .callback = udav_bulk_write_callback, .timeout = 10000, /* 10 seconds */ }, - [UDAV_BULK_DT_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -129,7 +141,6 @@ static const struct usb_config udav_conf .callback = udav_bulk_read_callback, .timeout = 0, /* no timeout */ }, - [UDAV_INTR_DT_RD] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -168,24 +179,11 @@ static devclass_t udav_devclass; DRIVER_MODULE(udav, uhub, udav_driver, udav_devclass, NULL, 0); DRIVER_MODULE(miibus, udav, miibus_driver, miibus_devclass, 0, 0); -MODULE_DEPEND(udav, uether, 1, 1, 1); MODULE_DEPEND(udav, usb, 1, 1, 1); MODULE_DEPEND(udav, ether, 1, 1, 1); MODULE_DEPEND(udav, miibus, 1, 1, 1); MODULE_VERSION(udav, 1); -static const struct usb_ether_methods udav_ue_methods = { - .ue_attach_post = udav_attach_post, - .ue_start = udav_start, - .ue_init = udav_init, - .ue_stop = udav_stop, - .ue_tick = udav_tick, - .ue_setmulti = udav_setmulti, - .ue_setpromisc = udav_setpromisc, - .ue_mii_upd = udav_ifmedia_upd, - .ue_mii_sts = udav_ifmedia_status, -}; - #ifdef USB_DEBUG static int udav_debug = 0; @@ -210,15 +208,14 @@ static const struct usb_device_id udav_d }; static void -udav_attach_post(struct usb_ether *ue) +udav_attach_post(struct udav_softc *sc) { - struct udav_softc *sc = uether_getsc(ue); /* reset the adapter */ udav_reset(sc); /* Get Ethernet Address */ - udav_csr_read(sc, UDAV_PAR, ue->ue_eaddr, ETHER_ADDR_LEN); + udav_csr_read(sc, UDAV_PAR, sc->sc_eaddr, ETHER_ADDR_LEN); } static int @@ -241,16 +238,20 @@ udav_attach(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); struct udav_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp; uint8_t iface_index; int error; + sc->sc_dev = dev; + sc->sc_udev = uaa->device; sc->sc_flags = USB_GET_DRIVER_INFO(uaa); + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); + sleepout_create(&sc->sc_sleepout, "axe sleepout"); + sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_setmulti, 0, udav_setmulti, sc); device_set_usb_desc(dev); - mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); - iface_index = UDAV_IFACE_INDEX; error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, udav_config, UDAV_N_TRANSFER, sc, &sc->sc_mtx); @@ -259,20 +260,39 @@ udav_attach(device_t dev) goto detach; } - ue->ue_sc = sc; - ue->ue_dev = dev; - ue->ue_udev = uaa->device; - ue->ue_mtx = &sc->sc_mtx; - ue->ue_methods = &udav_ue_methods; + UDAV_LOCK(sc); + udav_attach_post(sc); + UDAV_UNLOCK(sc); - error = uether_ifattach(ue); - if (error) { - device_printf(dev, "could not attach interface\n"); + sc->sc_ifp = ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(sc->sc_dev, "could not allocate ifnet\n"); goto detach; } - return (0); /* success */ + ifp->if_softc = sc; + if_initname(ifp, device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev)); + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = udav_ioctl; + ifp->if_start = udav_start; + ifp->if_init = udav_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, + udav_ifmedia_upd, udav_ifmedia_status); + if (error) { + device_printf(sc->sc_dev, "MII without any PHY\n"); + goto detach; + } + + if_printf(ifp, " on %s\n", + device_get_nameunit(sc->sc_dev)); + ether_ifattach(ifp, sc->sc_eaddr); + return (0); detach: udav_detach(dev); return (ENXIO); /* failure */ @@ -282,10 +302,22 @@ static int udav_detach(device_t dev) { struct udav_softc *sc = device_get_softc(dev); - struct usb_ether *ue = &sc->sc_ue; + struct ifnet *ifp = sc->sc_ifp; + sleepout_drain(&sc->sc_watchdog); + taskqueue_drain(sc->sc_sleepout.s_taskqueue, &sc->sc_setmulti); usbd_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER); - uether_ifdetach(ue); + + if (sc->sc_miibus != NULL) + device_delete_child(sc->sc_dev, sc->sc_miibus); + if (ifp != NULL) { + UDAV_LOCK(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + UDAV_UNLOCK(sc); + ether_ifdetach(ifp); + if_free(ifp); + } + sleepout_free(&sc->sc_sleepout); mtx_destroy(&sc->sc_mtx); return (0); @@ -355,7 +387,8 @@ udav_csr_read(struct udav_softc *sc, uin USETW(req.wIndex, offset); USETW(req.wLength, len); - return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); + return (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, buf, 0, + NULL, 1000)); } static int @@ -372,7 +405,8 @@ udav_csr_write(struct udav_softc *sc, ui USETW(req.wIndex, offset); USETW(req.wLength, len); - return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); + return (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, buf, + 0, NULL, 1000)); } static uint8_t @@ -398,21 +432,31 @@ udav_csr_write1(struct udav_softc *sc, u USETW(req.wIndex, offset); USETW(req.wLength, 0x0000); - return (uether_do_request(&sc->sc_ue, &req, NULL, 1000)); + return (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, NULL, + 0, NULL, 1000)); +} + +static void +udav_init(void *arg) +{ + struct udav_softc *sc = arg; + + UDAV_LOCK(sc); + udav_init_locked(sc); + UDAV_UNLOCK(sc); } static void -udav_init(struct usb_ether *ue) +udav_init_locked(struct udav_softc *sc) { - struct udav_softc *sc = ue->ue_sc; - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; UDAV_LOCK_ASSERT(sc, MA_OWNED); /* * Cancel pending I/O */ - udav_stop(ue); + udav_stop(sc); /* set MAC address */ udav_csr_write(sc, UDAV_PAR, IF_LLADDR(ifp), ETHER_ADDR_LEN); @@ -426,7 +470,7 @@ udav_init(struct usb_ether *ue) UDAV_SETBIT(sc, UDAV_RCR, UDAV_RCR_DIS_LONG | UDAV_RCR_DIS_CRC); /* load multicast filter and update promiscious mode bit */ - udav_setpromisc(ue); + udav_setpromisc(sc); /* enable RX */ UDAV_SETBIT(sc, UDAV_RCR, UDAV_RCR_RXEN); @@ -438,7 +482,8 @@ udav_init(struct usb_ether *ue) usbd_xfer_set_stall(sc->sc_xfer[UDAV_BULK_DT_WR]); ifp->if_drv_flags |= IFF_DRV_RUNNING; - udav_start(ue); + sleepout_reset(&sc->sc_watchdog, hz, udav_watchdog, sc); + udav_start(sc->sc_ifp); } static void @@ -465,19 +510,18 @@ udav_reset(struct udav_softc *sc) for (i = 0; i < UDAV_TX_TIMEOUT; i++) { if (!(udav_csr_read1(sc, UDAV_NCR) & UDAV_NCR_RST)) break; - if (uether_pause(&sc->sc_ue, hz / 100)) - break; + usb_pause_mtx(&sc->sc_mtx, hz / 100); } - uether_pause(&sc->sc_ue, hz / 100); + usb_pause_mtx(&sc->sc_mtx, hz / 100); } #define UDAV_BITS 6 static void -udav_setmulti(struct usb_ether *ue) +udav_setmulti(void *arg, int npending) { - struct udav_softc *sc = ue->ue_sc; - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct udav_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; struct ifmultiaddr *ifma; uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; int h = 0; @@ -514,10 +558,9 @@ udav_setmulti(struct usb_ether *ue) } static void -udav_setpromisc(struct usb_ether *ue) +udav_setpromisc(struct udav_softc *sc) { - struct udav_softc *sc = ue->ue_sc; - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; uint8_t rxmode; rxmode = udav_csr_read1(sc, UDAV_RCR); @@ -533,9 +576,9 @@ udav_setpromisc(struct usb_ether *ue) } static void -udav_start(struct usb_ether *ue) +udav_start(struct ifnet *ifp) { - struct udav_softc *sc = ue->ue_sc; + struct udav_softc *sc = ifp->if_softc; /* * start the USB transfers, if not already started: @@ -549,7 +592,7 @@ static void udav_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { struct udav_softc *sc = usbd_xfer_softc(xfer); - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; struct mbuf *m; int extra_len; @@ -627,11 +670,76 @@ tr_setup: } static void +udav_rxflush(struct udav_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + UDAV_LOCK_ASSERT(sc, MA_OWNED); + + for (;;) { + _IF_DEQUEUE(&sc->sc_rxq, m); + if (m == NULL) + break; + + /* + * The USB xfer has been resubmitted so its safe to unlock now. + */ + UDAV_UNLOCK(sc); + ifp->if_input(ifp, m); + UDAV_LOCK(sc); + } +} + +static struct mbuf * +udav_newbuf(void) +{ + struct mbuf *m_new; + + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new == NULL) + return (NULL); + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, ETHER_ALIGN); + return (m_new); +} + +static int +udav_rxbuf(struct udav_softc *sc, struct usb_page_cache *pc, + unsigned int offset, unsigned int len) +{ + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + UDAV_LOCK_ASSERT(sc, MA_OWNED); + + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) + return (1); + + m = udav_newbuf(); + if (m == NULL) { + ifp->if_ierrors++; + return (ENOMEM); + } + + usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); + + /* finalize mbuf */ + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + /* enqueue for later when the lock can be released */ + _IF_ENQUEUE(&sc->sc_rxq, m); + return (0); +} + +static void udav_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { struct udav_softc *sc = usbd_xfer_softc(xfer); - struct usb_ether *ue = &sc->sc_ue; - struct ifnet *ifp = uether_getifp(ue); + struct ifnet *ifp = sc->sc_ifp; struct usb_page_cache *pc; struct udav_rxpkt stat; int len; @@ -660,13 +768,13 @@ udav_bulk_read_callback(struct usb_xfer ifp->if_ierrors++; goto tr_setup; } - uether_rxbuf(ue, pc, sizeof(stat), len); + udav_rxbuf(sc, pc, sizeof(stat), len); /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); - uether_rxflush(ue); + udav_rxflush(sc); return; default: /* Error */ @@ -704,10 +812,9 @@ tr_setup: } static void -udav_stop(struct usb_ether *ue) +udav_stop(struct udav_softc *sc) { - struct udav_softc *sc = ue->ue_sc; - struct ifnet *ifp = uether_getifp(&sc->sc_ue); + struct ifnet *ifp = sc->sc_ifp; UDAV_LOCK_ASSERT(sc, MA_OWNED); @@ -757,9 +864,8 @@ udav_ifmedia_status(struct ifnet *ifp, s } static void -udav_tick(struct usb_ether *ue) +udav_tick(struct udav_softc *sc) { - struct udav_softc *sc = ue->ue_sc; struct mii_data *mii = GET_MII(sc); UDAV_LOCK_ASSERT(sc, MA_OWNED); @@ -769,7 +875,7 @@ udav_tick(struct usb_ether *ue) && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { sc->sc_flags |= UDAV_FLAG_LINK; - udav_start(ue); + udav_start(sc->sc_ifp); } } @@ -856,3 +962,54 @@ udav_miibus_statchg(device_t dev) { /* nothing to do */ } + +static int +udav_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct udav_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *)data; + struct mii_data *mii = GET_MII(sc); + int error = 0; + + switch (command) { + case SIOCSIFFLAGS: + UDAV_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + udav_setpromisc(sc); + else + udav_init_locked(sc); + } else + udav_stop(sc); + UDAV_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifp->if_flags & IFF_UP && + ifp->if_drv_flags & IFF_DRV_RUNNING) + taskqueue_enqueue(sc->sc_sleepout.s_taskqueue, + &sc->sc_setmulti); + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); + break; + default: + error = ether_ioctl(ifp, command, data); + break; + } + return (error); +} + +static void +udav_watchdog(void *arg) +{ + struct udav_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + udav_tick(sc); + sleepout_reset(&sc->sc_watchdog, hz, udav_watchdog, sc); +} Modified: user/weongyo/usb/sys/dev/usb/net/if_udavreg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Thu Sep 9 21:59:53 2010 (r212390) +++ user/weongyo/usb/sys/dev/usb/net/if_udavreg.h Thu Sep 9 23:17:25 2010 (r212391) @@ -137,7 +137,7 @@ #define UDAV_GPR_GEPIO1 (1<<1) /* General purpose 1 */ #define UDAV_GPR_GEPIO0 (1<<0) /* General purpose 0 */ -#define GET_MII(sc) uether_getmii(&(sc)->sc_ue) +#define GET_MII(sc) (device_get_softc(sc->sc_miibus)) struct udav_rxpkt { uint8_t rxstat; @@ -152,10 +152,18 @@ enum { }; struct udav_softc { - struct usb_ether sc_ue; + struct ifnet *sc_ifp; + device_t sc_dev; + device_t sc_miibus; + struct usb_device *sc_udev; + struct usb_xfer *sc_xfer[UDAV_N_TRANSFER]; struct mtx sc_mtx; - struct usb_xfer *sc_xfer[UDAV_N_TRANSFER]; - + struct sleepout sc_sleepout; + struct sleepout_task sc_watchdog; + struct task sc_setmulti; + struct ifqueue sc_rxq; + /* ethernet address from eeprom */ + uint8_t sc_eaddr[ETHER_ADDR_LEN]; int sc_flags; #define UDAV_FLAG_LINK 0x0001 #define UDAV_FLAG_EXT_PHY 0x0040 From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:21:16 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44559106566B; Thu, 9 Sep 2010 23:21:16 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33B3C8FC08; Thu, 9 Sep 2010 23:21:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NLGwE048232; Thu, 9 Sep 2010 23:21:16 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NLG3H048229; Thu, 9 Sep 2010 23:21:16 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009092321.o89NLG3H048229@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 23:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212392 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:21:16 -0000 Author: weongyo Date: Thu Sep 9 23:21:15 2010 New Revision: 212392 URL: http://svn.freebsd.org/changeset/base/212392 Log: Removes unused variables that drivers don't use MII bus interface. Modified: user/weongyo/usb/sys/dev/usb/net/if_cuereg.h user/weongyo/usb/sys/dev/usb/net/if_kuereg.h Modified: user/weongyo/usb/sys/dev/usb/net/if_cuereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Thu Sep 9 23:17:25 2010 (r212391) +++ user/weongyo/usb/sys/dev/usb/net/if_cuereg.h Thu Sep 9 23:21:15 2010 (r212392) @@ -122,7 +122,6 @@ struct cue_softc { struct ifnet *sc_ifp; struct mtx sc_mtx; device_t sc_dev; - device_t sc_miibus; struct usb_device *sc_udev; /* used by uether_do_request() */ struct usb_xfer *sc_xfer[CUE_N_TRANSFER]; struct sleepout sc_sleepout; Modified: user/weongyo/usb/sys/dev/usb/net/if_kuereg.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kuereg.h Thu Sep 9 23:17:25 2010 (r212391) +++ user/weongyo/usb/sys/dev/usb/net/if_kuereg.h Thu Sep 9 23:21:15 2010 (r212392) @@ -126,7 +126,6 @@ enum { struct kue_softc { struct ifnet *sc_ifp; device_t sc_dev; - device_t sc_miibus; struct usb_device *sc_udev; /* used by uether_do_request() */ struct usb_xfer *sc_xfer[KUE_N_TRANSFER]; struct mtx sc_mtx; From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:27:07 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87FCF106566B; Thu, 9 Sep 2010 23:27:07 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D0C28FC12; Thu, 9 Sep 2010 23:27:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NR7oO049213; Thu, 9 Sep 2010 23:27:07 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NR7gt049212; Thu, 9 Sep 2010 23:27:07 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092327.o89NR7gt049212@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:27:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212393 - user/pgollucci/portupgrade X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:27:07 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:27:07 2010 New Revision: 212393 URL: http://svn.freebsd.org/changeset/base/212393 Log: Initialize portupgrade repository Added: user/pgollucci/portupgrade/ From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:27:30 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D65AA1065670; Thu, 9 Sep 2010 23:27:30 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB00D8FC0C; Thu, 9 Sep 2010 23:27:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NRUh9049297; Thu, 9 Sep 2010 23:27:30 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NRUPJ049296; Thu, 9 Sep 2010 23:27:30 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092327.o89NRUPJ049296@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212394 - in user/pgollucci/portupgrade: branches tags trunk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:27:30 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:27:30 2010 New Revision: 212394 URL: http://svn.freebsd.org/changeset/base/212394 Log: create structure Added: user/pgollucci/portupgrade/branches/ user/pgollucci/portupgrade/tags/ user/pgollucci/portupgrade/trunk/ From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:28:13 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 149921065695; Thu, 9 Sep 2010 23:28:13 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 004B78FC12; Thu, 9 Sep 2010 23:28:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NSCjG049440; Thu, 9 Sep 2010 23:28:12 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NSChx049436; Thu, 9 Sep 2010 23:28:12 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092328.o89NSChx049436@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:28:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212395 - in user/pgollucci/portupgrade/trunk: . bin etc lib man misc misc/bash misc/tcsh misc/zsh tests X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:28:13 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:28:12 2010 New Revision: 212395 URL: http://svn.freebsd.org/changeset/base/212395 Log: 'import 2.4.6' Added: user/pgollucci/portupgrade/trunk/COPYING user/pgollucci/portupgrade/trunk/ChangeLog user/pgollucci/portupgrade/trunk/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/Makefile.compat (contents, props changed) user/pgollucci/portupgrade/trunk/Makefile.inc (contents, props changed) user/pgollucci/portupgrade/trunk/NEWS user/pgollucci/portupgrade/trunk/README user/pgollucci/portupgrade/trunk/bin/ user/pgollucci/portupgrade/trunk/bin/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/bin/pkg_fetch (contents, props changed) user/pgollucci/portupgrade/trunk/bin/pkg_glob (contents, props changed) user/pgollucci/portupgrade/trunk/bin/pkg_sort (contents, props changed) user/pgollucci/portupgrade/trunk/bin/pkgdb (contents, props changed) user/pgollucci/portupgrade/trunk/bin/pkgdu (contents, props changed) user/pgollucci/portupgrade/trunk/bin/portcvsweb (contents, props changed) user/pgollucci/portupgrade/trunk/bin/portsclean (contents, props changed) user/pgollucci/portupgrade/trunk/bin/portsdb (contents, props changed) user/pgollucci/portupgrade/trunk/bin/portupgrade (contents, props changed) user/pgollucci/portupgrade/trunk/bin/portversion (contents, props changed) user/pgollucci/portupgrade/trunk/etc/ user/pgollucci/portupgrade/trunk/etc/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/etc/pkgtools.conf (contents, props changed) user/pgollucci/portupgrade/trunk/etc/pkgtools.sh (contents, props changed) user/pgollucci/portupgrade/trunk/etc/status-pkg.sh (contents, props changed) user/pgollucci/portupgrade/trunk/lib/ user/pgollucci/portupgrade/trunk/lib/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/lib/pkg.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/pkgdb.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/pkgdbtools.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/pkginfo.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/pkgmisc.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/pkgtools.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/pkgtsort.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/pkgversion.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/portinfo.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/ports.rb (contents, props changed) user/pgollucci/portupgrade/trunk/lib/portsdb.rb (contents, props changed) user/pgollucci/portupgrade/trunk/man/ user/pgollucci/portupgrade/trunk/man/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/man/pkg_deinstall.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/pkg_fetch.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/pkg_glob.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/pkg_sort.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/pkgdb.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/pkgdu.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/pkgtools.conf.5 (contents, props changed) user/pgollucci/portupgrade/trunk/man/portcvsweb.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/portsclean.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/portsdb.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/portupgrade.1 (contents, props changed) user/pgollucci/portupgrade/trunk/man/portversion.1 (contents, props changed) user/pgollucci/portupgrade/trunk/misc/ user/pgollucci/portupgrade/trunk/misc/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/misc/Makefile.inc (contents, props changed) user/pgollucci/portupgrade/trunk/misc/bash/ user/pgollucci/portupgrade/trunk/misc/bash/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/misc/bash/complete.sample user/pgollucci/portupgrade/trunk/misc/tcsh/ user/pgollucci/portupgrade/trunk/misc/tcsh/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/misc/tcsh/complete.sample user/pgollucci/portupgrade/trunk/misc/zsh/ user/pgollucci/portupgrade/trunk/misc/zsh/Makefile (contents, props changed) user/pgollucci/portupgrade/trunk/misc/zsh/_pkgtools user/pgollucci/portupgrade/trunk/tests/ user/pgollucci/portupgrade/trunk/tests/test_all.rb (contents, props changed) user/pgollucci/portupgrade/trunk/tests/test_pkgdb.rb (contents, props changed) user/pgollucci/portupgrade/trunk/tests/test_pkginfo.rb (contents, props changed) user/pgollucci/portupgrade/trunk/tests/test_pkgtsort.rb (contents, props changed) user/pgollucci/portupgrade/trunk/tests/test_pkgversion.rb (contents, props changed) user/pgollucci/portupgrade/trunk/tests/test_portinfo.rb (contents, props changed) user/pgollucci/portupgrade/trunk/tests/test_portsdb.rb (contents, props changed) Added: user/pgollucci/portupgrade/trunk/COPYING ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/trunk/COPYING Thu Sep 9 23:28:12 2010 (r212395) @@ -0,0 +1,32 @@ +Copyright (c) 2000, 2001, 2002, 2003, 2004 by Akinori MUSHA. +Copyright (c) 2005, 2006 by KOMATSU Shinichiro. +Copyright (c) 2006, 2007 by Sergey Matveychuk. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the organizations nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Added: user/pgollucci/portupgrade/trunk/ChangeLog ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/trunk/ChangeLog Thu Sep 9 23:28:12 2010 (r212395) @@ -0,0 +1,9849 @@ +------------------------------------------------------------------------ +r1049 | knu | 2004-12-26 06:08:29 +0900 (Sun, 26 Dec 2004) | 4 lines +Changed paths: + M /trunk/bin/portupgrade + +Reverse the condition to check if custom MAKE_ARGS is specified. + +Submitted by: Max Laier + +------------------------------------------------------------------------ +r1048 | knu | 2004-12-26 00:54:12 +0900 (Sun, 26 Dec 2004) | 3 lines +Changed paths: + M /trunk/lib/portsdb.rb + +When INDEX is not found, try "make fetchindex" first, then try "make +index". + +------------------------------------------------------------------------ +r1047 | knu | 2004-12-26 00:35:21 +0900 (Sun, 26 Dec 2004) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.sh + +s/echo // + +------------------------------------------------------------------------ +r1046 | knu | 2004-12-24 05:11:54 +0900 (Fri, 24 Dec 2004) | 1 line +Changed paths: + M /trunk/Makefile + +Fix ChangeLog generation, this time. +------------------------------------------------------------------------ +r1045 | knu | 2004-12-24 05:07:40 +0900 (Fri, 24 Dec 2004) | 1 line +Changed paths: + M /trunk/Makefile + +Fix ChangeLog generation. +------------------------------------------------------------------------ +r1044 | knu | 2004-12-24 05:00:31 +0900 (Fri, 24 Dec 2004) | 1 line +Changed paths: + M /trunk/Makefile + +Generate ChangeLog in English. +------------------------------------------------------------------------ +r1043 | knu | 2004-12-24 03:50:36 +0900 (Fri, 24 Dec 2004) | 3 lines +Changed paths: + M /trunk/bin/portsdb + M /trunk/bin/portsdb.1 + M /trunk/lib/portsdb.rb + +Add portsdb -F, which calls make fetchindex internally to update the +ports index file. + +------------------------------------------------------------------------ +r1042 | knu | 2004-12-20 05:34:46 +0900 (Mon, 20 Dec 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgmisc.rb + +Fix double free. + +------------------------------------------------------------------------ +r1041 | knu | 2004-12-14 08:59:06 +0900 (Tue, 14 Dec 2004) | 6 lines +Changed paths: + M /trunk/bin/portupgrade + +- Make -fP properly reinstall an installed package using a binary + package. + +- Do not use a binary package when custom MAKE_ARGS or -m option is + defined, unless -PP is specified. + +------------------------------------------------------------------------ +r1040 | knu | 2004-12-14 08:55:47 +0900 (Tue, 14 Dec 2004) | 1 line +Changed paths: + M /trunk/bin/pkg_glob.1 + +Fix a typo. +------------------------------------------------------------------------ +r1039 | knu | 2004-12-14 08:55:06 +0900 (Tue, 14 Dec 2004) | 2 lines +Changed paths: + M /trunk/bin/portsclean + +Make sure that a library does not shadow itself. + +------------------------------------------------------------------------ +r1038 | knu | 2004-10-18 23:59:09 +0900 (Mon, 18 Oct 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgdb.rb + +Use Object#class instead of Object#type. + +------------------------------------------------------------------------ +r1037 | knu | 2004-08-08 03:47:36 +0900 (Sun, 08 Aug 2004) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.sh + +rcNG'ify. + +------------------------------------------------------------------------ +r1036 | knu | 2004-07-20 20:53:06 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + D /trunk/.cvsignore + D /trunk/bin/.cvsignore + D /trunk/etc/.cvsignore + D /trunk/lib/.cvsignore + +Remove obsolete .cvsignore files. + +------------------------------------------------------------------------ +r1035 | knu | 2004-07-20 20:52:37 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/Makefile + +Clean up ChangeLog stuff. + +------------------------------------------------------------------------ +r1034 | knu | 2004-07-20 20:46:12 +0900 (Tue, 20 Jul 2004) | 3 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix a regex pattern for `uname -rm'. \D* does not work as expected in +this case. + +------------------------------------------------------------------------ +r1033 | knu | 2004-07-20 20:42:08 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib + +Add ignore patterns. + +------------------------------------------------------------------------ +r1032 | knu | 2004-07-20 20:41:48 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/bin + M /trunk/etc + +Add ignore patterns. + +------------------------------------------------------------------------ +r1031 | knu | 2004-07-20 20:40:51 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/bin + +Add ignore patterns. + +------------------------------------------------------------------------ +r1030 | knu | 2004-07-20 20:39:35 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk + +Add ignore patterns. + +------------------------------------------------------------------------ +r1029 | knu | 2004-07-20 20:38:57 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/Makefile + +Switch over to Subversion. + +------------------------------------------------------------------------ +r1028 | knu | 2004-07-20 20:14:02 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/Makefile + M /trunk/Makefile.compat + M /trunk/Makefile.inc + M /trunk/README + M /trunk/bin/Makefile + M /trunk/bin/pkg_deinstall.1 + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_fetch.1 + M /trunk/bin/pkg_glob + M /trunk/bin/pkg_glob.1 + M /trunk/bin/pkg_sort + M /trunk/bin/pkg_sort.1 + M /trunk/bin/pkgdb + M /trunk/bin/pkgdb.1 + M /trunk/bin/portcvsweb + M /trunk/bin/portcvsweb.1 + M /trunk/bin/portsclean + M /trunk/bin/portsclean.1 + M /trunk/bin/portsdb + M /trunk/bin/portsdb.1 + M /trunk/bin/portupgrade + M /trunk/bin/portupgrade.1 + M /trunk/bin/portversion + M /trunk/bin/portversion.1 + M /trunk/etc/Makefile + M /trunk/etc/pkgtools.conf + M /trunk/etc/pkgtools.conf.5 + M /trunk/etc/pkgtools.sh + M /trunk/etc/status-pkg.sh + M /trunk/lib/Makefile + M /trunk/lib/pkg.rb + M /trunk/lib/pkgdb.rb + M /trunk/lib/pkginfo.rb + M /trunk/lib/pkgmisc.rb + M /trunk/lib/pkgsqldb.rb + M /trunk/lib/pkgtools.rb + M /trunk/lib/pkgtsort.rb + M /trunk/lib/pkgversion.rb + M /trunk/lib/portinfo.rb + M /trunk/lib/ports.rb + M /trunk/lib/portsdb.rb + M /trunk/misc/Makefile + M /trunk/misc/Makefile.inc + M /trunk/misc/bash/Makefile + M /trunk/misc/bash/complete.sample + M /trunk/misc/tcsh/Makefile + M /trunk/misc/tcsh/complete.sample + M /trunk/misc/zsh/Makefile + M /trunk/tests/test_pkgdb.rb + M /trunk/tests/test_pkginfo.rb + M /trunk/tests/test_pkgtsort.rb + M /trunk/tests/test_pkgversion.rb + M /trunk/tests/test_portinfo.rb + M /trunk/tests/test_portsdb.rb + +Switch over to Subversion keyword tag expansion. + +------------------------------------------------------------------------ +r1027 | knu | 2004-07-15 21:20:03 +0900 (Thu, 15 Jul 2004) | 4 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix the regexp for uname(1) output to support DragonFly BSD. + +Submitted by: Hiten Pandya (slightly modified) + +------------------------------------------------------------------------ +r1026 | knu | 2004-07-15 21:15:11 +0900 (Thu, 15 Jul 2004) | 4 lines +Changed paths: + M /trunk/bin/pkg_deinstall.1 + +Fix a punctuation typo. + +Submitted by: Guido Falsi + +------------------------------------------------------------------------ +r1025 | knu | 2004-07-13 01:29:33 +0900 (Tue, 13 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib/portsdb.rb + +Work around the bdb bug. + +------------------------------------------------------------------------ +r1024 | knu | 2004-07-07 04:58:15 +0900 (Wed, 07 Jul 2004) | 7 lines +Changed paths: + M /trunk/bin/portupgrade + +Fix a bug with -P when there are more than one binary package file for +a package to install or upgrade. + +PR: ports/68598 +Submitted by: Victor Prylipko +Bug traced by: Andrew Bliznak + +------------------------------------------------------------------------ +r1023 | knu | 2004-07-02 13:24:28 +0900 (Fri, 02 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Make sure that hash is not nil before calling each(). + +------------------------------------------------------------------------ +r1022 | knu | 2004-07-01 01:51:46 +0900 (Thu, 01 Jul 2004) | 5 lines +Changed paths: + M /trunk/bin/portupgrade + +Make -PP/--use-packages-only work better, just as I originally +intended. Now packages are correctly identified using pkg_info(1), +"LATEST_LINK" files are also detected. Related informational messages +have also been improved. + +------------------------------------------------------------------------ +r1021 | knu | 2004-07-01 01:40:54 +0900 (Thu, 01 Jul 2004) | 3 lines +Changed paths: + M /trunk/bin/pkg_fetch + +Properly rename a "latest link" file with a full package name with +version part. + +------------------------------------------------------------------------ +r1020 | knu | 2004-07-01 01:24:12 +0900 (Thu, 01 Jul 2004) | 2 lines +Changed paths: + M /trunk/bin/pkg_fetch + M /trunk/lib/pkgtools.rb + +Move identify_pkg() to pkgtools.rb. + +------------------------------------------------------------------------ +r1019 | knu | 2004-07-01 01:23:35 +0900 (Thu, 01 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib/portinfo.rb + +Permit extra fields of INDEX. + +------------------------------------------------------------------------ +r1018 | knu | 2004-07-01 01:22:35 +0900 (Thu, 01 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib/portsdb.rb + +Fix latest_link(). The condition was reversed! + +------------------------------------------------------------------------ +r1017 | knu | 2004-06-14 22:03:23 +0900 (Mon, 14 Jun 2004) | 6 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Improve and unify the method for pattern matching in MAKE_ARGS, +BEFOREBUILD, BEFOREDEINSTALL and AFTERINSTALL variables. + +This should fix some cases where it looks like MAKE_ARGS entries are +ignored. + +------------------------------------------------------------------------ +r1016 | knu | 2004-05-29 05:28:43 +0900 (Sat, 29 May 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgversion.rb + +Fix handling of padded zero's. + +------------------------------------------------------------------------ +r1015 | knu | 2004-05-27 15:00:51 +0900 (Thu, 27 May 2004) | 3 lines +Changed paths: + M /trunk/bin/portupgrade + +Indicate some pieces of information on what is going on in the process +title. + +------------------------------------------------------------------------ +r1014 | knu | 2004-05-27 14:59:32 +0900 (Thu, 27 May 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Add setproctitle(). + +------------------------------------------------------------------------ +r1013 | knu | 2004-05-27 14:26:53 +0900 (Thu, 27 May 2004) | 2 lines +Changed paths: + M /trunk/bin/portversion + +Make a generated script accept additional arguments for portupgrade(1). + +------------------------------------------------------------------------ +r1012 | knu | 2004-05-27 14:05:33 +0900 (Thu, 27 May 2004) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + M /trunk/bin/portversion + +Massive message improvement. (I hope..) + +------------------------------------------------------------------------ +r1011 | knu | 2004-05-27 13:08:35 +0900 (Thu, 27 May 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +pkg_site_mirror(): Use pointyhat.FreeBSD.org instead of bento and beta. + +------------------------------------------------------------------------ +r1010 | knu | 2004-05-15 02:22:09 +0900 (Sat, 15 May 2004) | 2 lines +Changed paths: + M /trunk/COPYING + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_glob + M /trunk/bin/pkg_sort + M /trunk/bin/pkgdb + M /trunk/bin/portcvsweb + M /trunk/bin/portsclean + M /trunk/bin/portsdb + M /trunk/bin/portupgrade + M /trunk/bin/portversion + M /trunk/lib/pkgtsort.rb + +Update Copyright years. + +------------------------------------------------------------------------ +r1009 | knu | 2004-03-25 06:46:49 +0900 (Thu, 25 Mar 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix a leftover Fixnum. + +------------------------------------------------------------------------ +r1008 | knu | 2004-03-25 06:28:45 +0900 (Thu, 25 Mar 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgversion.rb + M /trunk/tests/test_pkgversion.rb + +Ignore padded 0's. + +------------------------------------------------------------------------ +r1007 | knu | 2004-03-25 06:11:48 +0900 (Thu, 25 Mar 2004) | 7 lines +Changed paths: + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_glob + M /trunk/bin/portupgrade + M /trunk/lib/pkgtools.rb + +- Replace the PkgResult constants with symbols. + +- Show a summary of how many packages were upgraded, ignored, skipped + and failed after listing results. + + Requested by: netchild + +------------------------------------------------------------------------ +r1006 | knu | 2004-03-25 05:11:08 +0900 (Thu, 25 Mar 2004) | 4 lines +Changed paths: + M /trunk/lib/pkginfo.rb + M /trunk/lib/pkgversion.rb + M /trunk/tests/test_pkgversion.rb + +Ruby 1.8-ism. + - Object#type -> Object#class + - TypeError -> ArgumentError (partially) + +------------------------------------------------------------------------ +r1005 | knu | 2004-03-25 05:09:30 +0900 (Thu, 25 Mar 2004) | 2 lines +Changed paths: + M /trunk/tests/test_pkgdb.rb + +Update libtool_pkgname. + +------------------------------------------------------------------------ +r1004 | knu | 2004-02-08 17:22:23 +0900 (Sun, 08 Feb 2004) | 3 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Use stdout/stderr redirection rather than calling script(1) when stdin +is not a tty. + +------------------------------------------------------------------------ +r1003 | knu | 2004-02-08 17:21:57 +0900 (Sun, 08 Feb 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgdb.rb + +make_describe_pass[12] were obsoleted. + +------------------------------------------------------------------------ +r1002 | knu | 2004-02-08 17:21:28 +0900 (Sun, 08 Feb 2004) | 3 lines +Changed paths: + M /trunk/bin/Makefile + D /trunk/bin/make_describe_pass1 + D /trunk/bin/make_describe_pass2 + M /trunk/lib/portsdb.rb + +Use the canonical way to generate INDEX now that "make index" is fast +enough and the alternative method now does not work properly. + +------------------------------------------------------------------------ +r1001 | knu | 2004-02-08 17:19:15 +0900 (Sun, 08 Feb 2004) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Properly pass logfile to uninstall_pkg(). + +------------------------------------------------------------------------ +r1000 | knu | 2004-01-13 11:51:35 +0900 (Tue, 13 Jan 2004) | 2 lines +Changed paths: + M /trunk/bin/make_describe_pass1 + M /trunk/bin/make_describe_pass2 + +Take EXTRACT_DEPENDS into account. + +------------------------------------------------------------------------ +r999 | knu | 2004-01-13 11:50:48 +0900 (Tue, 13 Jan 2004) | 4 lines +Changed paths: + M /trunk/bin/pkgdb.1 + +Fix typos and grammos. + +Submitted by: Jens Schweikhardt + +------------------------------------------------------------------------ +r998 | knu | 2003-10-25 19:41:18 +0900 (Sat, 25 Oct 2003) | 2 lines +Changed paths: + M /trunk/misc/zsh/_pkgtools + +Fix another occurrence of "pacakge". + +------------------------------------------------------------------------ +r997 | knu | 2003-10-25 18:42:46 +0900 (Sat, 25 Oct 2003) | 5 lines +Changed paths: + M /trunk/README + M /trunk/etc/pkgtools.conf.5 + +More typo fixes. + +FreeBSD PR: ports/57349 +Submitted by: Oliver Eikemeier + +------------------------------------------------------------------------ +r996 | knu | 2003-10-19 20:56:34 +0900 (Sun, 19 Oct 2003) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + M /trunk/lib/pkgtools.rb + +Sleep for 3 seconds between stop and start in restart. + +------------------------------------------------------------------------ +r995 | knu | 2003-08-31 23:04:48 +0900 (Sun, 31 Aug 2003) | 4 lines +Changed paths: + M /trunk/bin/pkg_glob.1 + M /trunk/bin/pkgdb.1 + +Fix typos: pacakges -> packages + +Submitted by: Oliver Eikemeier + +------------------------------------------------------------------------ +r994 | knu | 2003-07-23 21:23:05 +0900 (Wed, 23 Jul 2003) | 3 lines +Changed paths: + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_glob + M /trunk/bin/pkgdb + M /trunk/bin/portsclean + M /trunk/bin/portupgrade + M /trunk/lib/pkgdb.rb + M /trunk/lib/pkginfo.rb + M /trunk/lib/portsdb.rb + +If pkg_* is found in $PREFIX/sbin, use them instead of ones in +/usr/sbin. + +------------------------------------------------------------------------ +r993 | knu | 2003-07-22 14:25:24 +0900 (Tue, 22 Jul 2003) | 3 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix -q by properly initializing necessary variables in +init_pkgtools_global() instead of load_config(). + +------------------------------------------------------------------------ +r992 | knu | 2003-07-22 14:15:35 +0900 (Tue, 22 Jul 2003) | 3 lines +Changed paths: + M /trunk/lib/portsdb.rb + +As the MOVED file is getting bigger and bigger, do not cache the +entries in memory but look it up every time needed. + +------------------------------------------------------------------------ +r991 | knu | 2003-07-20 06:39:31 +0900 (Sun, 20 Jul 2003) | 5 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Show how to specify multipart arguments in one MAKE_ARG entry. + +FreeBSD PR: ports/54631 +Submitted by: Bruce M Simpson + +------------------------------------------------------------------------ +r990 | knu | 2003-07-20 06:18:48 +0900 (Sun, 20 Jul 2003) | 3 lines +Changed paths: + M /trunk/bin/pkg_fetch + +Some servers like bento transfer packages files uncompressed, so add a +workaround for this. + +------------------------------------------------------------------------ +r989 | knu | 2003-04-27 06:22:47 +0900 (Sun, 27 Apr 2003) | 3 lines +Changed paths: + M /trunk/bin/portsclean + +Ruby 1.8's open() {} fails in error if the stream is closed when the +block ends. I just hope that the zombie problem is already gone. + +------------------------------------------------------------------------ +r988 | knu | 2003-04-27 06:20:37 +0900 (Sun, 27 Apr 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +The variable "line" should be defined outside the block. + +------------------------------------------------------------------------ +r987 | knu | 2003-04-27 06:19:44 +0900 (Sun, 27 Apr 2003) | 5 lines +Changed paths: + M /trunk/bin/make_describe_pass1 + +COMMENTFILE is deprecated. Weird. I thought I committed these +changes long long ago. + +Submitted by: Jean-Yves Lefort . + +------------------------------------------------------------------------ +r986 | knu | 2003-04-22 14:35:20 +0900 (Tue, 22 Apr 2003) | 2 lines +Changed paths: + M /trunk/bin/make_describe_pass1 + M /trunk/bin/pkgdb + M /trunk/bin/portupgrade + M /trunk/lib/pkgdb.rb + M /trunk/lib/pkgtools.rb + +Do not explicitly close streams when open(){} automatically does it. + +------------------------------------------------------------------------ +r985 | knu | 2003-04-22 14:05:59 +0900 (Tue, 22 Apr 2003) | 4 lines +Changed paths: + M /trunk/bin/portsclean + +Fix a typo and unbreak portsclean -P. + +Submitted by: Olivier Tharan + +------------------------------------------------------------------------ +r984 | knu | 2003-04-20 07:11:18 +0900 (Sun, 20 Apr 2003) | 4 lines +Changed paths: + M /trunk/bin/make_describe_pass2 + +Fix the COMMENT support. + +Submitted by: Frerich Raabe + +------------------------------------------------------------------------ +r983 | knu | 2003-03-28 17:26:54 +0900 (Fri, 28 Mar 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_fetch + +Fix a missing assignment. + +------------------------------------------------------------------------ +r982 | knu | 2003-03-23 17:17:27 +0900 (Sun, 23 Mar 2003) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Fix a finger'o. + +------------------------------------------------------------------------ +r981 | knu | 2003-03-10 17:51:18 +0900 (Mon, 10 Mar 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Set OS_PKGBRANCH to "-stable" for PRERELEASE, RC, ALPHA, BETA, etc. + +------------------------------------------------------------------------ +r980 | knu | 2003-03-10 02:20:51 +0900 (Mon, 10 Mar 2003) | 5 lines +Changed paths: + M /trunk/etc/pkgtools.conf.5 + +Rephrase a paragraph. + +PR: ports/49042 +Submitted by: Chris Pepper + +------------------------------------------------------------------------ +r979 | knu | 2003-03-09 16:09:20 +0900 (Sun, 09 Mar 2003) | 5 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Apply grammar fixes. + +PR: ports/49041 +Submitted by: Chris Pepper + +------------------------------------------------------------------------ +r978 | knu | 2003-03-08 15:55:50 +0900 (Sat, 08 Mar 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_glob + +Fix BEFOREDEINSTALL facilities. + +------------------------------------------------------------------------ +r977 | knu | 2003-03-08 15:15:26 +0900 (Sat, 08 Mar 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Require "features/ruby18/enumerable", for any? is a ruby 1.8 feature. + +------------------------------------------------------------------------ +r976 | knu | 2003-03-06 14:56:03 +0900 (Thu, 06 Mar 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Run AFTERINSTALL commands after restoring a failed upgrade. + +------------------------------------------------------------------------ +r975 | knu | 2003-03-05 12:24:03 +0900 (Wed, 05 Mar 2003) | 8 lines +Changed paths: + M /trunk/etc/pkgtools.conf + M /trunk/lib/pkgtools.rb + +Introduce a BEFOREDEINSTALL knob. + +Deprecate rc_file() and rc_files(), and provide enabled_rc_scripts() +and disabled_rc_scripts() instead. + +Provide cmd_start_rc(), cmd_stop_rc(), and cmd_enable_rc() in addition +to cmd_restart_rc() and cmd_disable_rc(). + +------------------------------------------------------------------------ +r974 | knu | 2003-03-05 12:21:53 +0900 (Wed, 05 Mar 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_glob + +Introduce a BEFOREDEINSTALL knob. + +------------------------------------------------------------------------ +r973 | knu | 2003-03-03 03:02:52 +0900 (Mon, 03 Mar 2003) | 5 lines +Changed paths: + M /trunk/etc/pkgtools.conf + M /trunk/lib/pkgtools.rb + +Add new utility functions: startup_files(), cmd_restart_rc() and +cmd_disable_rc(). rc_file() is being obsoleted. (still available) + +Update examples. + +------------------------------------------------------------------------ +r972 | knu | 2003-03-03 03:00:52 +0900 (Mon, 03 Mar 2003) | 5 lines +Changed paths: + M /trunk/bin/portupgrade + +-A/-B: Remove ;'s and spaces at the beginning of each command line to +stop sh(1) from issuing a syntax error. + +-A/-B: Omit running null commands. + +------------------------------------------------------------------------ +r971 | knu | 2003-02-28 04:20:50 +0900 (Fri, 28 Feb 2003) | 4 lines +Changed paths: + M /trunk/bin/pkgdb + +Add a missing comma and unbreak the cyclic dependency fixer. + +Submitted by: ITO Tsuyoshi + +------------------------------------------------------------------------ +r970 | knu | 2003-02-26 14:45:07 +0900 (Wed, 26 Feb 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgdb.rb + +Always skip '.' and '..'. + +------------------------------------------------------------------------ +r969 | knu | 2003-02-26 14:44:47 +0900 (Wed, 26 Feb 2003) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +INDEX.local would be a better name for a locally generated INDEX. + +------------------------------------------------------------------------ +r968 | knu | 2003-02-18 11:33:59 +0900 (Tue, 18 Feb 2003) | 4 lines +Changed paths: + M /trunk/bin/pkgdb + +PortsDB#glob() can return an empty array. + +Reported by: "Daniel M. Zimmerman" + +------------------------------------------------------------------------ +r967 | knu | 2003-02-18 05:41:24 +0900 (Tue, 18 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade.1 + +Update the WARNINGS section to match the reality. + +------------------------------------------------------------------------ +r966 | knu | 2003-02-18 05:00:57 +0900 (Tue, 18 Feb 2003) | 4 lines +Changed paths: + M /trunk/bin/portupgrade + +Fix bogus next's. + +Reported by: Larry Rosenman + +------------------------------------------------------------------------ +r965 | knu | 2003-02-17 01:23:57 +0900 (Mon, 17 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Make a forgotten replacement of variables. + +------------------------------------------------------------------------ +r964 | knu | 2003-02-17 00:11:32 +0900 (Mon, 17 Feb 2003) | 5 lines +Changed paths: + M /trunk/bin/pkgdb + +Treat bsdpan-* packages specially; set their origins to those of p5-* +where possible. + +Requested by: nik + +------------------------------------------------------------------------ +r963 | knu | 2003-02-17 00:10:21 +0900 (Mon, 17 Feb 2003) | 3 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix modify_origin(): Properly add a new origin line if no origin is +recorded. + +------------------------------------------------------------------------ +r962 | knu | 2003-02-16 20:31:02 +0900 (Sun, 16 Feb 2003) | 3 lines +Changed paths: + M /trunk/bin/portupgrade + +Improve the packages support: When installing a binary package, +automatically detect and install ports/packages it depends on. + +------------------------------------------------------------------------ +r961 | knu | 2003-02-16 02:24:15 +0900 (Sun, 16 Feb 2003) | 4 lines +Changed paths: + M /trunk/bin/make_describe_pass1 + +Replace COMMENT with COMMENTFILE. + +Submitted by: Jean-Yves Lefort + +------------------------------------------------------------------------ +r960 | knu | 2003-02-04 15:20:35 +0900 (Tue, 04 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Update the usage: add -l and -L. + +------------------------------------------------------------------------ +r959 | knu | 2003-02-04 15:18:24 +0900 (Tue, 04 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade.1 + +Catch up with the change of -L. + +------------------------------------------------------------------------ +r958 | knu | 2003-02-01 07:44:57 +0900 (Sat, 01 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_glob + M /trunk/bin/portupgrade + M /trunk/lib/pkgmisc.rb + M /trunk/lib/pkgtools.rb + +Introduce PkgResult and PkgResultSet classes. + +------------------------------------------------------------------------ +r957 | knu | 2003-01-30 12:01:21 +0900 (Thu, 30 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Chase the bento site hierarchy change. + +------------------------------------------------------------------------ +r956 | knu | 2003-01-27 03:37:36 +0900 (Mon, 27 Jan 2003) | 4 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Update the description of MAKE_ARGS. + +Replace an obsolete example with a new one. + +------------------------------------------------------------------------ +r955 | knu | 2003-01-27 03:21:02 +0900 (Mon, 27 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Clean up config_commandtable(). + +------------------------------------------------------------------------ +r954 | knu | 2003-01-26 21:32:18 +0900 (Sun, 26 Jan 2003) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Update examples. + +------------------------------------------------------------------------ +r953 | knu | 2003-01-26 21:32:02 +0900 (Sun, 26 Jan 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Utilize the optional second argument of config_make_args(). + +------------------------------------------------------------------------ +r952 | knu | 2003-01-26 21:30:47 +0900 (Sun, 26 Jan 2003) | 5 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +- Use Set where convenient. + +- Make MAKE_ARGS more intelligent. Now understands something like + 'ruby18-*' => 'RUBY_VER=1.8'. + +------------------------------------------------------------------------ +r951 | knu | 2003-01-23 23:10:43 +0900 (Thu, 23 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgmisc.rb + +Enumerable#partition is not used any more. + +------------------------------------------------------------------------ +r950 | knu | 2003-01-20 07:03:12 +0900 (Mon, 20 Jan 2003) | 2 lines +Changed paths: + A /trunk/lib/pkgsqldb.rb + +Prototype implementation of SQLite backed pkgdb. + +------------------------------------------------------------------------ +r949 | knu | 2003-01-20 02:27:17 +0900 (Mon, 20 Jan 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_fetch + +Switch from ftools to fileutils. + +------------------------------------------------------------------------ +r948 | knu | 2003-01-15 16:36:12 +0900 (Wed, 15 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgdb.rb + +Fix a trivial and harmless typo. + +------------------------------------------------------------------------ +r947 | knu | 2003-01-15 16:35:39 +0900 (Wed, 15 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgmisc.rb + +Use ruby-shim's implementation. + +------------------------------------------------------------------------ +r946 | knu | 2002-12-31 05:06:49 +0900 (Tue, 31 Dec 2002) | 2 lines +Changed paths: + M /trunk/bin/pkg_deinstall.1 + M /trunk/bin/pkg_glob.1 + M /trunk/bin/pkgdb.1 + M /trunk/bin/portsclean.1 + M /trunk/bin/portupgrade.1 + M /trunk/bin/portversion.1 + +Fix tag misuses. + +------------------------------------------------------------------------ +r945 | knu | 2002-12-31 02:29:06 +0900 (Tue, 31 Dec 2002) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Fix a typo. + +------------------------------------------------------------------------ +r944 | knu | 2002-12-24 22:08:13 +0900 (Tue, 24 Dec 2002) | 3 lines +Changed paths: + M /trunk/lib/pkgmisc.rb + +realpath(3) may return NULL, so delegate to File.expand_path() in such +a case. + +------------------------------------------------------------------------ +r943 | knu | 2002-12-23 03:51:04 +0900 (Mon, 23 Dec 2002) | 3 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Rename -L/--log-prefix to -L/--log-file and make it accept a printf(3) +style format. + +------------------------------------------------------------------------ +r942 | knu | 2002-12-23 03:50:57 +0900 (Mon, 23 Dec 2002) | 12 lines +Changed paths: + M /trunk/bin/portupgrade + M /trunk/bin/portupgrade.1 + +Change the meaning of -D/--distclean. When specified once, delete +failed distfiles and retry if checksum fails. When specified twice, +do "make distclean" before each fetch or build. + +Make -F/--fetch-only call make checksum/checksum-recursive instead of +make fetch/fetch-recursive. + +Rename -l/--log-results to -l/--results-file. + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:28:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B87F10656AC; Thu, 9 Sep 2010 23:28:35 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8825C8FC0C; Thu, 9 Sep 2010 23:28:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NSZ8X049525; Thu, 9 Sep 2010 23:28:35 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NSZq7049522; Thu, 9 Sep 2010 23:28:35 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092328.o89NSZq7049522@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212396 - in user/pgollucci/portupgrade/branches/2.4.6: . bin etc lib man misc tests X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:28:35 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:28:35 2010 New Revision: 212396 URL: http://svn.freebsd.org/changeset/base/212396 Log: tag 2.4.6 Added: user/pgollucci/portupgrade/branches/2.4.6/ - copied from r212394, user/pgollucci/portupgrade/trunk/ user/pgollucci/portupgrade/branches/2.4.6/COPYING - copied unchanged from r212395, user/pgollucci/portupgrade/trunk/COPYING user/pgollucci/portupgrade/branches/2.4.6/ChangeLog - copied unchanged from r212395, user/pgollucci/portupgrade/trunk/ChangeLog user/pgollucci/portupgrade/branches/2.4.6/Makefile - copied unchanged from r212395, user/pgollucci/portupgrade/trunk/Makefile user/pgollucci/portupgrade/branches/2.4.6/Makefile.compat - copied unchanged from r212395, user/pgollucci/portupgrade/trunk/Makefile.compat user/pgollucci/portupgrade/branches/2.4.6/Makefile.inc - copied unchanged from r212395, user/pgollucci/portupgrade/trunk/Makefile.inc user/pgollucci/portupgrade/branches/2.4.6/NEWS - copied unchanged from r212395, user/pgollucci/portupgrade/trunk/NEWS user/pgollucci/portupgrade/branches/2.4.6/README - copied unchanged from r212395, user/pgollucci/portupgrade/trunk/README user/pgollucci/portupgrade/branches/2.4.6/bin/ - copied from r212395, user/pgollucci/portupgrade/trunk/bin/ user/pgollucci/portupgrade/branches/2.4.6/etc/ - copied from r212395, user/pgollucci/portupgrade/trunk/etc/ user/pgollucci/portupgrade/branches/2.4.6/lib/ - copied from r212395, user/pgollucci/portupgrade/trunk/lib/ user/pgollucci/portupgrade/branches/2.4.6/man/ - copied from r212395, user/pgollucci/portupgrade/trunk/man/ user/pgollucci/portupgrade/branches/2.4.6/misc/ - copied from r212395, user/pgollucci/portupgrade/trunk/misc/ user/pgollucci/portupgrade/branches/2.4.6/tests/ - copied from r212395, user/pgollucci/portupgrade/trunk/tests/ Copied: user/pgollucci/portupgrade/branches/2.4.6/COPYING (from r212395, user/pgollucci/portupgrade/trunk/COPYING) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/branches/2.4.6/COPYING Thu Sep 9 23:28:35 2010 (r212396, copy of r212395, user/pgollucci/portupgrade/trunk/COPYING) @@ -0,0 +1,32 @@ +Copyright (c) 2000, 2001, 2002, 2003, 2004 by Akinori MUSHA. +Copyright (c) 2005, 2006 by KOMATSU Shinichiro. +Copyright (c) 2006, 2007 by Sergey Matveychuk. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the organizations nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copied: user/pgollucci/portupgrade/branches/2.4.6/ChangeLog (from r212395, user/pgollucci/portupgrade/trunk/ChangeLog) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/branches/2.4.6/ChangeLog Thu Sep 9 23:28:35 2010 (r212396, copy of r212395, user/pgollucci/portupgrade/trunk/ChangeLog) @@ -0,0 +1,9849 @@ +------------------------------------------------------------------------ +r1049 | knu | 2004-12-26 06:08:29 +0900 (Sun, 26 Dec 2004) | 4 lines +Changed paths: + M /trunk/bin/portupgrade + +Reverse the condition to check if custom MAKE_ARGS is specified. + +Submitted by: Max Laier + +------------------------------------------------------------------------ +r1048 | knu | 2004-12-26 00:54:12 +0900 (Sun, 26 Dec 2004) | 3 lines +Changed paths: + M /trunk/lib/portsdb.rb + +When INDEX is not found, try "make fetchindex" first, then try "make +index". + +------------------------------------------------------------------------ +r1047 | knu | 2004-12-26 00:35:21 +0900 (Sun, 26 Dec 2004) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.sh + +s/echo // + +------------------------------------------------------------------------ +r1046 | knu | 2004-12-24 05:11:54 +0900 (Fri, 24 Dec 2004) | 1 line +Changed paths: + M /trunk/Makefile + +Fix ChangeLog generation, this time. +------------------------------------------------------------------------ +r1045 | knu | 2004-12-24 05:07:40 +0900 (Fri, 24 Dec 2004) | 1 line +Changed paths: + M /trunk/Makefile + +Fix ChangeLog generation. +------------------------------------------------------------------------ +r1044 | knu | 2004-12-24 05:00:31 +0900 (Fri, 24 Dec 2004) | 1 line +Changed paths: + M /trunk/Makefile + +Generate ChangeLog in English. +------------------------------------------------------------------------ +r1043 | knu | 2004-12-24 03:50:36 +0900 (Fri, 24 Dec 2004) | 3 lines +Changed paths: + M /trunk/bin/portsdb + M /trunk/bin/portsdb.1 + M /trunk/lib/portsdb.rb + +Add portsdb -F, which calls make fetchindex internally to update the +ports index file. + +------------------------------------------------------------------------ +r1042 | knu | 2004-12-20 05:34:46 +0900 (Mon, 20 Dec 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgmisc.rb + +Fix double free. + +------------------------------------------------------------------------ +r1041 | knu | 2004-12-14 08:59:06 +0900 (Tue, 14 Dec 2004) | 6 lines +Changed paths: + M /trunk/bin/portupgrade + +- Make -fP properly reinstall an installed package using a binary + package. + +- Do not use a binary package when custom MAKE_ARGS or -m option is + defined, unless -PP is specified. + +------------------------------------------------------------------------ +r1040 | knu | 2004-12-14 08:55:47 +0900 (Tue, 14 Dec 2004) | 1 line +Changed paths: + M /trunk/bin/pkg_glob.1 + +Fix a typo. +------------------------------------------------------------------------ +r1039 | knu | 2004-12-14 08:55:06 +0900 (Tue, 14 Dec 2004) | 2 lines +Changed paths: + M /trunk/bin/portsclean + +Make sure that a library does not shadow itself. + +------------------------------------------------------------------------ +r1038 | knu | 2004-10-18 23:59:09 +0900 (Mon, 18 Oct 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgdb.rb + +Use Object#class instead of Object#type. + +------------------------------------------------------------------------ +r1037 | knu | 2004-08-08 03:47:36 +0900 (Sun, 08 Aug 2004) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.sh + +rcNG'ify. + +------------------------------------------------------------------------ +r1036 | knu | 2004-07-20 20:53:06 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + D /trunk/.cvsignore + D /trunk/bin/.cvsignore + D /trunk/etc/.cvsignore + D /trunk/lib/.cvsignore + +Remove obsolete .cvsignore files. + +------------------------------------------------------------------------ +r1035 | knu | 2004-07-20 20:52:37 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/Makefile + +Clean up ChangeLog stuff. + +------------------------------------------------------------------------ +r1034 | knu | 2004-07-20 20:46:12 +0900 (Tue, 20 Jul 2004) | 3 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix a regex pattern for `uname -rm'. \D* does not work as expected in +this case. + +------------------------------------------------------------------------ +r1033 | knu | 2004-07-20 20:42:08 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib + +Add ignore patterns. + +------------------------------------------------------------------------ +r1032 | knu | 2004-07-20 20:41:48 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/bin + M /trunk/etc + +Add ignore patterns. + +------------------------------------------------------------------------ +r1031 | knu | 2004-07-20 20:40:51 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/bin + +Add ignore patterns. + +------------------------------------------------------------------------ +r1030 | knu | 2004-07-20 20:39:35 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk + +Add ignore patterns. + +------------------------------------------------------------------------ +r1029 | knu | 2004-07-20 20:38:57 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/Makefile + +Switch over to Subversion. + +------------------------------------------------------------------------ +r1028 | knu | 2004-07-20 20:14:02 +0900 (Tue, 20 Jul 2004) | 2 lines +Changed paths: + M /trunk/Makefile + M /trunk/Makefile.compat + M /trunk/Makefile.inc + M /trunk/README + M /trunk/bin/Makefile + M /trunk/bin/pkg_deinstall.1 + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_fetch.1 + M /trunk/bin/pkg_glob + M /trunk/bin/pkg_glob.1 + M /trunk/bin/pkg_sort + M /trunk/bin/pkg_sort.1 + M /trunk/bin/pkgdb + M /trunk/bin/pkgdb.1 + M /trunk/bin/portcvsweb + M /trunk/bin/portcvsweb.1 + M /trunk/bin/portsclean + M /trunk/bin/portsclean.1 + M /trunk/bin/portsdb + M /trunk/bin/portsdb.1 + M /trunk/bin/portupgrade + M /trunk/bin/portupgrade.1 + M /trunk/bin/portversion + M /trunk/bin/portversion.1 + M /trunk/etc/Makefile + M /trunk/etc/pkgtools.conf + M /trunk/etc/pkgtools.conf.5 + M /trunk/etc/pkgtools.sh + M /trunk/etc/status-pkg.sh + M /trunk/lib/Makefile + M /trunk/lib/pkg.rb + M /trunk/lib/pkgdb.rb + M /trunk/lib/pkginfo.rb + M /trunk/lib/pkgmisc.rb + M /trunk/lib/pkgsqldb.rb + M /trunk/lib/pkgtools.rb + M /trunk/lib/pkgtsort.rb + M /trunk/lib/pkgversion.rb + M /trunk/lib/portinfo.rb + M /trunk/lib/ports.rb + M /trunk/lib/portsdb.rb + M /trunk/misc/Makefile + M /trunk/misc/Makefile.inc + M /trunk/misc/bash/Makefile + M /trunk/misc/bash/complete.sample + M /trunk/misc/tcsh/Makefile + M /trunk/misc/tcsh/complete.sample + M /trunk/misc/zsh/Makefile + M /trunk/tests/test_pkgdb.rb + M /trunk/tests/test_pkginfo.rb + M /trunk/tests/test_pkgtsort.rb + M /trunk/tests/test_pkgversion.rb + M /trunk/tests/test_portinfo.rb + M /trunk/tests/test_portsdb.rb + +Switch over to Subversion keyword tag expansion. + +------------------------------------------------------------------------ +r1027 | knu | 2004-07-15 21:20:03 +0900 (Thu, 15 Jul 2004) | 4 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix the regexp for uname(1) output to support DragonFly BSD. + +Submitted by: Hiten Pandya (slightly modified) + +------------------------------------------------------------------------ +r1026 | knu | 2004-07-15 21:15:11 +0900 (Thu, 15 Jul 2004) | 4 lines +Changed paths: + M /trunk/bin/pkg_deinstall.1 + +Fix a punctuation typo. + +Submitted by: Guido Falsi + +------------------------------------------------------------------------ +r1025 | knu | 2004-07-13 01:29:33 +0900 (Tue, 13 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib/portsdb.rb + +Work around the bdb bug. + +------------------------------------------------------------------------ +r1024 | knu | 2004-07-07 04:58:15 +0900 (Wed, 07 Jul 2004) | 7 lines +Changed paths: + M /trunk/bin/portupgrade + +Fix a bug with -P when there are more than one binary package file for +a package to install or upgrade. + +PR: ports/68598 +Submitted by: Victor Prylipko +Bug traced by: Andrew Bliznak + +------------------------------------------------------------------------ +r1023 | knu | 2004-07-02 13:24:28 +0900 (Fri, 02 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Make sure that hash is not nil before calling each(). + +------------------------------------------------------------------------ +r1022 | knu | 2004-07-01 01:51:46 +0900 (Thu, 01 Jul 2004) | 5 lines +Changed paths: + M /trunk/bin/portupgrade + +Make -PP/--use-packages-only work better, just as I originally +intended. Now packages are correctly identified using pkg_info(1), +"LATEST_LINK" files are also detected. Related informational messages +have also been improved. + +------------------------------------------------------------------------ +r1021 | knu | 2004-07-01 01:40:54 +0900 (Thu, 01 Jul 2004) | 3 lines +Changed paths: + M /trunk/bin/pkg_fetch + +Properly rename a "latest link" file with a full package name with +version part. + +------------------------------------------------------------------------ +r1020 | knu | 2004-07-01 01:24:12 +0900 (Thu, 01 Jul 2004) | 2 lines +Changed paths: + M /trunk/bin/pkg_fetch + M /trunk/lib/pkgtools.rb + +Move identify_pkg() to pkgtools.rb. + +------------------------------------------------------------------------ +r1019 | knu | 2004-07-01 01:23:35 +0900 (Thu, 01 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib/portinfo.rb + +Permit extra fields of INDEX. + +------------------------------------------------------------------------ +r1018 | knu | 2004-07-01 01:22:35 +0900 (Thu, 01 Jul 2004) | 2 lines +Changed paths: + M /trunk/lib/portsdb.rb + +Fix latest_link(). The condition was reversed! + +------------------------------------------------------------------------ +r1017 | knu | 2004-06-14 22:03:23 +0900 (Mon, 14 Jun 2004) | 6 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Improve and unify the method for pattern matching in MAKE_ARGS, +BEFOREBUILD, BEFOREDEINSTALL and AFTERINSTALL variables. + +This should fix some cases where it looks like MAKE_ARGS entries are +ignored. + +------------------------------------------------------------------------ +r1016 | knu | 2004-05-29 05:28:43 +0900 (Sat, 29 May 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgversion.rb + +Fix handling of padded zero's. + +------------------------------------------------------------------------ +r1015 | knu | 2004-05-27 15:00:51 +0900 (Thu, 27 May 2004) | 3 lines +Changed paths: + M /trunk/bin/portupgrade + +Indicate some pieces of information on what is going on in the process +title. + +------------------------------------------------------------------------ +r1014 | knu | 2004-05-27 14:59:32 +0900 (Thu, 27 May 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Add setproctitle(). + +------------------------------------------------------------------------ +r1013 | knu | 2004-05-27 14:26:53 +0900 (Thu, 27 May 2004) | 2 lines +Changed paths: + M /trunk/bin/portversion + +Make a generated script accept additional arguments for portupgrade(1). + +------------------------------------------------------------------------ +r1012 | knu | 2004-05-27 14:05:33 +0900 (Thu, 27 May 2004) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + M /trunk/bin/portversion + +Massive message improvement. (I hope..) + +------------------------------------------------------------------------ +r1011 | knu | 2004-05-27 13:08:35 +0900 (Thu, 27 May 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +pkg_site_mirror(): Use pointyhat.FreeBSD.org instead of bento and beta. + +------------------------------------------------------------------------ +r1010 | knu | 2004-05-15 02:22:09 +0900 (Sat, 15 May 2004) | 2 lines +Changed paths: + M /trunk/COPYING + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_glob + M /trunk/bin/pkg_sort + M /trunk/bin/pkgdb + M /trunk/bin/portcvsweb + M /trunk/bin/portsclean + M /trunk/bin/portsdb + M /trunk/bin/portupgrade + M /trunk/bin/portversion + M /trunk/lib/pkgtsort.rb + +Update Copyright years. + +------------------------------------------------------------------------ +r1009 | knu | 2004-03-25 06:46:49 +0900 (Thu, 25 Mar 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix a leftover Fixnum. + +------------------------------------------------------------------------ +r1008 | knu | 2004-03-25 06:28:45 +0900 (Thu, 25 Mar 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgversion.rb + M /trunk/tests/test_pkgversion.rb + +Ignore padded 0's. + +------------------------------------------------------------------------ +r1007 | knu | 2004-03-25 06:11:48 +0900 (Thu, 25 Mar 2004) | 7 lines +Changed paths: + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_glob + M /trunk/bin/portupgrade + M /trunk/lib/pkgtools.rb + +- Replace the PkgResult constants with symbols. + +- Show a summary of how many packages were upgraded, ignored, skipped + and failed after listing results. + + Requested by: netchild + +------------------------------------------------------------------------ +r1006 | knu | 2004-03-25 05:11:08 +0900 (Thu, 25 Mar 2004) | 4 lines +Changed paths: + M /trunk/lib/pkginfo.rb + M /trunk/lib/pkgversion.rb + M /trunk/tests/test_pkgversion.rb + +Ruby 1.8-ism. + - Object#type -> Object#class + - TypeError -> ArgumentError (partially) + +------------------------------------------------------------------------ +r1005 | knu | 2004-03-25 05:09:30 +0900 (Thu, 25 Mar 2004) | 2 lines +Changed paths: + M /trunk/tests/test_pkgdb.rb + +Update libtool_pkgname. + +------------------------------------------------------------------------ +r1004 | knu | 2004-02-08 17:22:23 +0900 (Sun, 08 Feb 2004) | 3 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Use stdout/stderr redirection rather than calling script(1) when stdin +is not a tty. + +------------------------------------------------------------------------ +r1003 | knu | 2004-02-08 17:21:57 +0900 (Sun, 08 Feb 2004) | 2 lines +Changed paths: + M /trunk/lib/pkgdb.rb + +make_describe_pass[12] were obsoleted. + +------------------------------------------------------------------------ +r1002 | knu | 2004-02-08 17:21:28 +0900 (Sun, 08 Feb 2004) | 3 lines +Changed paths: + M /trunk/bin/Makefile + D /trunk/bin/make_describe_pass1 + D /trunk/bin/make_describe_pass2 + M /trunk/lib/portsdb.rb + +Use the canonical way to generate INDEX now that "make index" is fast +enough and the alternative method now does not work properly. + +------------------------------------------------------------------------ +r1001 | knu | 2004-02-08 17:19:15 +0900 (Sun, 08 Feb 2004) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Properly pass logfile to uninstall_pkg(). + +------------------------------------------------------------------------ +r1000 | knu | 2004-01-13 11:51:35 +0900 (Tue, 13 Jan 2004) | 2 lines +Changed paths: + M /trunk/bin/make_describe_pass1 + M /trunk/bin/make_describe_pass2 + +Take EXTRACT_DEPENDS into account. + +------------------------------------------------------------------------ +r999 | knu | 2004-01-13 11:50:48 +0900 (Tue, 13 Jan 2004) | 4 lines +Changed paths: + M /trunk/bin/pkgdb.1 + +Fix typos and grammos. + +Submitted by: Jens Schweikhardt + +------------------------------------------------------------------------ +r998 | knu | 2003-10-25 19:41:18 +0900 (Sat, 25 Oct 2003) | 2 lines +Changed paths: + M /trunk/misc/zsh/_pkgtools + +Fix another occurrence of "pacakge". + +------------------------------------------------------------------------ +r997 | knu | 2003-10-25 18:42:46 +0900 (Sat, 25 Oct 2003) | 5 lines +Changed paths: + M /trunk/README + M /trunk/etc/pkgtools.conf.5 + +More typo fixes. + +FreeBSD PR: ports/57349 +Submitted by: Oliver Eikemeier + +------------------------------------------------------------------------ +r996 | knu | 2003-10-19 20:56:34 +0900 (Sun, 19 Oct 2003) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + M /trunk/lib/pkgtools.rb + +Sleep for 3 seconds between stop and start in restart. + +------------------------------------------------------------------------ +r995 | knu | 2003-08-31 23:04:48 +0900 (Sun, 31 Aug 2003) | 4 lines +Changed paths: + M /trunk/bin/pkg_glob.1 + M /trunk/bin/pkgdb.1 + +Fix typos: pacakges -> packages + +Submitted by: Oliver Eikemeier + +------------------------------------------------------------------------ +r994 | knu | 2003-07-23 21:23:05 +0900 (Wed, 23 Jul 2003) | 3 lines +Changed paths: + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_glob + M /trunk/bin/pkgdb + M /trunk/bin/portsclean + M /trunk/bin/portupgrade + M /trunk/lib/pkgdb.rb + M /trunk/lib/pkginfo.rb + M /trunk/lib/portsdb.rb + +If pkg_* is found in $PREFIX/sbin, use them instead of ones in +/usr/sbin. + +------------------------------------------------------------------------ +r993 | knu | 2003-07-22 14:25:24 +0900 (Tue, 22 Jul 2003) | 3 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix -q by properly initializing necessary variables in +init_pkgtools_global() instead of load_config(). + +------------------------------------------------------------------------ +r992 | knu | 2003-07-22 14:15:35 +0900 (Tue, 22 Jul 2003) | 3 lines +Changed paths: + M /trunk/lib/portsdb.rb + +As the MOVED file is getting bigger and bigger, do not cache the +entries in memory but look it up every time needed. + +------------------------------------------------------------------------ +r991 | knu | 2003-07-20 06:39:31 +0900 (Sun, 20 Jul 2003) | 5 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Show how to specify multipart arguments in one MAKE_ARG entry. + +FreeBSD PR: ports/54631 +Submitted by: Bruce M Simpson + +------------------------------------------------------------------------ +r990 | knu | 2003-07-20 06:18:48 +0900 (Sun, 20 Jul 2003) | 3 lines +Changed paths: + M /trunk/bin/pkg_fetch + +Some servers like bento transfer packages files uncompressed, so add a +workaround for this. + +------------------------------------------------------------------------ +r989 | knu | 2003-04-27 06:22:47 +0900 (Sun, 27 Apr 2003) | 3 lines +Changed paths: + M /trunk/bin/portsclean + +Ruby 1.8's open() {} fails in error if the stream is closed when the +block ends. I just hope that the zombie problem is already gone. + +------------------------------------------------------------------------ +r988 | knu | 2003-04-27 06:20:37 +0900 (Sun, 27 Apr 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +The variable "line" should be defined outside the block. + +------------------------------------------------------------------------ +r987 | knu | 2003-04-27 06:19:44 +0900 (Sun, 27 Apr 2003) | 5 lines +Changed paths: + M /trunk/bin/make_describe_pass1 + +COMMENTFILE is deprecated. Weird. I thought I committed these +changes long long ago. + +Submitted by: Jean-Yves Lefort . + +------------------------------------------------------------------------ +r986 | knu | 2003-04-22 14:35:20 +0900 (Tue, 22 Apr 2003) | 2 lines +Changed paths: + M /trunk/bin/make_describe_pass1 + M /trunk/bin/pkgdb + M /trunk/bin/portupgrade + M /trunk/lib/pkgdb.rb + M /trunk/lib/pkgtools.rb + +Do not explicitly close streams when open(){} automatically does it. + +------------------------------------------------------------------------ +r985 | knu | 2003-04-22 14:05:59 +0900 (Tue, 22 Apr 2003) | 4 lines +Changed paths: + M /trunk/bin/portsclean + +Fix a typo and unbreak portsclean -P. + +Submitted by: Olivier Tharan + +------------------------------------------------------------------------ +r984 | knu | 2003-04-20 07:11:18 +0900 (Sun, 20 Apr 2003) | 4 lines +Changed paths: + M /trunk/bin/make_describe_pass2 + +Fix the COMMENT support. + +Submitted by: Frerich Raabe + +------------------------------------------------------------------------ +r983 | knu | 2003-03-28 17:26:54 +0900 (Fri, 28 Mar 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_fetch + +Fix a missing assignment. + +------------------------------------------------------------------------ +r982 | knu | 2003-03-23 17:17:27 +0900 (Sun, 23 Mar 2003) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Fix a finger'o. + +------------------------------------------------------------------------ +r981 | knu | 2003-03-10 17:51:18 +0900 (Mon, 10 Mar 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Set OS_PKGBRANCH to "-stable" for PRERELEASE, RC, ALPHA, BETA, etc. + +------------------------------------------------------------------------ +r980 | knu | 2003-03-10 02:20:51 +0900 (Mon, 10 Mar 2003) | 5 lines +Changed paths: + M /trunk/etc/pkgtools.conf.5 + +Rephrase a paragraph. + +PR: ports/49042 +Submitted by: Chris Pepper + +------------------------------------------------------------------------ +r979 | knu | 2003-03-09 16:09:20 +0900 (Sun, 09 Mar 2003) | 5 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Apply grammar fixes. + +PR: ports/49041 +Submitted by: Chris Pepper + +------------------------------------------------------------------------ +r978 | knu | 2003-03-08 15:55:50 +0900 (Sat, 08 Mar 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_glob + +Fix BEFOREDEINSTALL facilities. + +------------------------------------------------------------------------ +r977 | knu | 2003-03-08 15:15:26 +0900 (Sat, 08 Mar 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Require "features/ruby18/enumerable", for any? is a ruby 1.8 feature. + +------------------------------------------------------------------------ +r976 | knu | 2003-03-06 14:56:03 +0900 (Thu, 06 Mar 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Run AFTERINSTALL commands after restoring a failed upgrade. + +------------------------------------------------------------------------ +r975 | knu | 2003-03-05 12:24:03 +0900 (Wed, 05 Mar 2003) | 8 lines +Changed paths: + M /trunk/etc/pkgtools.conf + M /trunk/lib/pkgtools.rb + +Introduce a BEFOREDEINSTALL knob. + +Deprecate rc_file() and rc_files(), and provide enabled_rc_scripts() +and disabled_rc_scripts() instead. + +Provide cmd_start_rc(), cmd_stop_rc(), and cmd_enable_rc() in addition +to cmd_restart_rc() and cmd_disable_rc(). + +------------------------------------------------------------------------ +r974 | knu | 2003-03-05 12:21:53 +0900 (Wed, 05 Mar 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_glob + +Introduce a BEFOREDEINSTALL knob. + +------------------------------------------------------------------------ +r973 | knu | 2003-03-03 03:02:52 +0900 (Mon, 03 Mar 2003) | 5 lines +Changed paths: + M /trunk/etc/pkgtools.conf + M /trunk/lib/pkgtools.rb + +Add new utility functions: startup_files(), cmd_restart_rc() and +cmd_disable_rc(). rc_file() is being obsoleted. (still available) + +Update examples. + +------------------------------------------------------------------------ +r972 | knu | 2003-03-03 03:00:52 +0900 (Mon, 03 Mar 2003) | 5 lines +Changed paths: + M /trunk/bin/portupgrade + +-A/-B: Remove ;'s and spaces at the beginning of each command line to +stop sh(1) from issuing a syntax error. + +-A/-B: Omit running null commands. + +------------------------------------------------------------------------ +r971 | knu | 2003-02-28 04:20:50 +0900 (Fri, 28 Feb 2003) | 4 lines +Changed paths: + M /trunk/bin/pkgdb + +Add a missing comma and unbreak the cyclic dependency fixer. + +Submitted by: ITO Tsuyoshi + +------------------------------------------------------------------------ +r970 | knu | 2003-02-26 14:45:07 +0900 (Wed, 26 Feb 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgdb.rb + +Always skip '.' and '..'. + +------------------------------------------------------------------------ +r969 | knu | 2003-02-26 14:44:47 +0900 (Wed, 26 Feb 2003) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +INDEX.local would be a better name for a locally generated INDEX. + +------------------------------------------------------------------------ +r968 | knu | 2003-02-18 11:33:59 +0900 (Tue, 18 Feb 2003) | 4 lines +Changed paths: + M /trunk/bin/pkgdb + +PortsDB#glob() can return an empty array. + +Reported by: "Daniel M. Zimmerman" + +------------------------------------------------------------------------ +r967 | knu | 2003-02-18 05:41:24 +0900 (Tue, 18 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade.1 + +Update the WARNINGS section to match the reality. + +------------------------------------------------------------------------ +r966 | knu | 2003-02-18 05:00:57 +0900 (Tue, 18 Feb 2003) | 4 lines +Changed paths: + M /trunk/bin/portupgrade + +Fix bogus next's. + +Reported by: Larry Rosenman + +------------------------------------------------------------------------ +r965 | knu | 2003-02-17 01:23:57 +0900 (Mon, 17 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Make a forgotten replacement of variables. + +------------------------------------------------------------------------ +r964 | knu | 2003-02-17 00:11:32 +0900 (Mon, 17 Feb 2003) | 5 lines +Changed paths: + M /trunk/bin/pkgdb + +Treat bsdpan-* packages specially; set their origins to those of p5-* +where possible. + +Requested by: nik + +------------------------------------------------------------------------ +r963 | knu | 2003-02-17 00:10:21 +0900 (Mon, 17 Feb 2003) | 3 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Fix modify_origin(): Properly add a new origin line if no origin is +recorded. + +------------------------------------------------------------------------ +r962 | knu | 2003-02-16 20:31:02 +0900 (Sun, 16 Feb 2003) | 3 lines +Changed paths: + M /trunk/bin/portupgrade + +Improve the packages support: When installing a binary package, +automatically detect and install ports/packages it depends on. + +------------------------------------------------------------------------ +r961 | knu | 2003-02-16 02:24:15 +0900 (Sun, 16 Feb 2003) | 4 lines +Changed paths: + M /trunk/bin/make_describe_pass1 + +Replace COMMENT with COMMENTFILE. + +Submitted by: Jean-Yves Lefort + +------------------------------------------------------------------------ +r960 | knu | 2003-02-04 15:20:35 +0900 (Tue, 04 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Update the usage: add -l and -L. + +------------------------------------------------------------------------ +r959 | knu | 2003-02-04 15:18:24 +0900 (Tue, 04 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade.1 + +Catch up with the change of -L. + +------------------------------------------------------------------------ +r958 | knu | 2003-02-01 07:44:57 +0900 (Sat, 01 Feb 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_fetch + M /trunk/bin/pkg_glob + M /trunk/bin/portupgrade + M /trunk/lib/pkgmisc.rb + M /trunk/lib/pkgtools.rb + +Introduce PkgResult and PkgResultSet classes. + +------------------------------------------------------------------------ +r957 | knu | 2003-01-30 12:01:21 +0900 (Thu, 30 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Chase the bento site hierarchy change. + +------------------------------------------------------------------------ +r956 | knu | 2003-01-27 03:37:36 +0900 (Mon, 27 Jan 2003) | 4 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Update the description of MAKE_ARGS. + +Replace an obsolete example with a new one. + +------------------------------------------------------------------------ +r955 | knu | 2003-01-27 03:21:02 +0900 (Mon, 27 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +Clean up config_commandtable(). + +------------------------------------------------------------------------ +r954 | knu | 2003-01-26 21:32:18 +0900 (Sun, 26 Jan 2003) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Update examples. + +------------------------------------------------------------------------ +r953 | knu | 2003-01-26 21:32:02 +0900 (Sun, 26 Jan 2003) | 2 lines +Changed paths: + M /trunk/bin/portupgrade + +Utilize the optional second argument of config_make_args(). + +------------------------------------------------------------------------ +r952 | knu | 2003-01-26 21:30:47 +0900 (Sun, 26 Jan 2003) | 5 lines +Changed paths: + M /trunk/lib/pkgtools.rb + +- Use Set where convenient. + +- Make MAKE_ARGS more intelligent. Now understands something like + 'ruby18-*' => 'RUBY_VER=1.8'. + +------------------------------------------------------------------------ +r951 | knu | 2003-01-23 23:10:43 +0900 (Thu, 23 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgmisc.rb + +Enumerable#partition is not used any more. + +------------------------------------------------------------------------ +r950 | knu | 2003-01-20 07:03:12 +0900 (Mon, 20 Jan 2003) | 2 lines +Changed paths: + A /trunk/lib/pkgsqldb.rb + +Prototype implementation of SQLite backed pkgdb. + +------------------------------------------------------------------------ +r949 | knu | 2003-01-20 02:27:17 +0900 (Mon, 20 Jan 2003) | 2 lines +Changed paths: + M /trunk/bin/pkg_fetch + +Switch from ftools to fileutils. + +------------------------------------------------------------------------ +r948 | knu | 2003-01-15 16:36:12 +0900 (Wed, 15 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgdb.rb + +Fix a trivial and harmless typo. + +------------------------------------------------------------------------ +r947 | knu | 2003-01-15 16:35:39 +0900 (Wed, 15 Jan 2003) | 2 lines +Changed paths: + M /trunk/lib/pkgmisc.rb + +Use ruby-shim's implementation. + +------------------------------------------------------------------------ +r946 | knu | 2002-12-31 05:06:49 +0900 (Tue, 31 Dec 2002) | 2 lines +Changed paths: + M /trunk/bin/pkg_deinstall.1 + M /trunk/bin/pkg_glob.1 + M /trunk/bin/pkgdb.1 + M /trunk/bin/portsclean.1 + M /trunk/bin/portupgrade.1 + M /trunk/bin/portversion.1 + +Fix tag misuses. + +------------------------------------------------------------------------ +r945 | knu | 2002-12-31 02:29:06 +0900 (Tue, 31 Dec 2002) | 2 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Fix a typo. + +------------------------------------------------------------------------ +r944 | knu | 2002-12-24 22:08:13 +0900 (Tue, 24 Dec 2002) | 3 lines +Changed paths: + M /trunk/lib/pkgmisc.rb + +realpath(3) may return NULL, so delegate to File.expand_path() in such +a case. + +------------------------------------------------------------------------ +r943 | knu | 2002-12-23 03:51:04 +0900 (Mon, 23 Dec 2002) | 3 lines +Changed paths: + M /trunk/etc/pkgtools.conf + +Rename -L/--log-prefix to -L/--log-file and make it accept a printf(3) +style format. + +------------------------------------------------------------------------ +r942 | knu | 2002-12-23 03:50:57 +0900 (Mon, 23 Dec 2002) | 12 lines +Changed paths: + M /trunk/bin/portupgrade + M /trunk/bin/portupgrade.1 + +Change the meaning of -D/--distclean. When specified once, delete +failed distfiles and retry if checksum fails. When specified twice, +do "make distclean" before each fetch or build. + +Make -F/--fetch-only call make checksum/checksum-recursive instead of +make fetch/fetch-recursive. + +Rename -l/--log-results to -l/--results-file. + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:30:30 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6D11106564A; Thu, 9 Sep 2010 23:30:30 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B5D58FC15; Thu, 9 Sep 2010 23:30:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NUUA4049810; Thu, 9 Sep 2010 23:30:30 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NUUvk049809; Thu, 9 Sep 2010 23:30:30 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092330.o89NUUvk049809@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212397 - in user/pgollucci/portupgrade: branches/2.4.6 tags/2.4.6 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:30:30 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:30:30 2010 New Revision: 212397 URL: http://svn.freebsd.org/changeset/base/212397 Log: put tag in tags Added: user/pgollucci/portupgrade/tags/2.4.6/ - copied from r212396, user/pgollucci/portupgrade/branches/2.4.6/ Deleted: user/pgollucci/portupgrade/branches/2.4.6/ From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:31:23 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D2281065672; Thu, 9 Sep 2010 23:31:23 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C4408FC08; Thu, 9 Sep 2010 23:31:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NVNed049949; Thu, 9 Sep 2010 23:31:23 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NVNY2049947; Thu, 9 Sep 2010 23:31:23 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009092331.o89NVNY2049947@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 9 Sep 2010 23:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212398 - in user/weongyo/usb/sys: dev/usb/net modules/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:31:23 -0000 Author: weongyo Date: Thu Sep 9 23:31:22 2010 New Revision: 212398 URL: http://svn.freebsd.org/changeset/base/212398 Log: No more uether module that all USB ethernet drivers uses their own routines. Deleted: user/weongyo/usb/sys/dev/usb/net/usb_ethernet.c user/weongyo/usb/sys/dev/usb/net/usb_ethernet.h Modified: user/weongyo/usb/sys/modules/usb/Makefile Modified: user/weongyo/usb/sys/modules/usb/Makefile ============================================================================== --- user/weongyo/usb/sys/modules/usb/Makefile Thu Sep 9 23:30:30 2010 (r212397) +++ user/weongyo/usb/sys/modules/usb/Makefile Thu Sep 9 23:31:22 2010 (r212398) @@ -31,7 +31,7 @@ SUBDIR += rum run uath upgt ural zyd ${_ SUBDIR += atp uhid ukbd ums udbp ufm SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt \ umct umodem umoscom uplcom uslcom uvisor uvscom -SUBDIR += uether aue axe cdce cue kue rue udav uhso +SUBDIR += aue axe cdce cue kue rue udav uhso SUBDIR += usfs umass urio SUBDIR += quirk template From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:37:55 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 275E31065670; Thu, 9 Sep 2010 23:37:55 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13A5F8FC1A; Thu, 9 Sep 2010 23:37:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89Nbtu9050941; Thu, 9 Sep 2010 23:37:55 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89Nbsk0050923; Thu, 9 Sep 2010 23:37:54 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092337.o89Nbsk0050923@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212399 - in user/pgollucci/portupgrade/trunk: . bin etc lib man misc misc/bash misc/tcsh misc/zsh tests X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:37:55 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:37:54 2010 New Revision: 212399 URL: http://svn.freebsd.org/changeset/base/212399 Log: - Update to ports-mgmt/portupgrade-devel@20091221_1 Modified: user/pgollucci/portupgrade/trunk/Makefile user/pgollucci/portupgrade/trunk/Makefile.compat user/pgollucci/portupgrade/trunk/Makefile.inc user/pgollucci/portupgrade/trunk/NEWS user/pgollucci/portupgrade/trunk/README user/pgollucci/portupgrade/trunk/bin/Makefile user/pgollucci/portupgrade/trunk/bin/pkg_fetch user/pgollucci/portupgrade/trunk/bin/pkg_glob user/pgollucci/portupgrade/trunk/bin/pkg_sort user/pgollucci/portupgrade/trunk/bin/pkgdb user/pgollucci/portupgrade/trunk/bin/pkgdu user/pgollucci/portupgrade/trunk/bin/portcvsweb user/pgollucci/portupgrade/trunk/bin/portsclean user/pgollucci/portupgrade/trunk/bin/portsdb user/pgollucci/portupgrade/trunk/bin/portupgrade user/pgollucci/portupgrade/trunk/bin/portversion user/pgollucci/portupgrade/trunk/etc/Makefile user/pgollucci/portupgrade/trunk/etc/pkgtools.conf user/pgollucci/portupgrade/trunk/etc/pkgtools.sh user/pgollucci/portupgrade/trunk/etc/status-pkg.sh user/pgollucci/portupgrade/trunk/lib/Makefile user/pgollucci/portupgrade/trunk/lib/pkg.rb user/pgollucci/portupgrade/trunk/lib/pkgdb.rb user/pgollucci/portupgrade/trunk/lib/pkgdbtools.rb user/pgollucci/portupgrade/trunk/lib/pkginfo.rb user/pgollucci/portupgrade/trunk/lib/pkgmisc.rb user/pgollucci/portupgrade/trunk/lib/pkgtools.rb user/pgollucci/portupgrade/trunk/lib/pkgtsort.rb user/pgollucci/portupgrade/trunk/lib/pkgversion.rb user/pgollucci/portupgrade/trunk/lib/portinfo.rb user/pgollucci/portupgrade/trunk/lib/ports.rb user/pgollucci/portupgrade/trunk/lib/portsdb.rb user/pgollucci/portupgrade/trunk/man/Makefile user/pgollucci/portupgrade/trunk/man/pkg_deinstall.1 user/pgollucci/portupgrade/trunk/man/pkg_fetch.1 user/pgollucci/portupgrade/trunk/man/pkg_glob.1 user/pgollucci/portupgrade/trunk/man/pkg_sort.1 user/pgollucci/portupgrade/trunk/man/pkgdb.1 user/pgollucci/portupgrade/trunk/man/pkgdu.1 user/pgollucci/portupgrade/trunk/man/pkgtools.conf.5 user/pgollucci/portupgrade/trunk/man/portcvsweb.1 user/pgollucci/portupgrade/trunk/man/portsclean.1 user/pgollucci/portupgrade/trunk/man/portsdb.1 user/pgollucci/portupgrade/trunk/man/portupgrade.1 user/pgollucci/portupgrade/trunk/man/portversion.1 user/pgollucci/portupgrade/trunk/misc/Makefile user/pgollucci/portupgrade/trunk/misc/Makefile.inc user/pgollucci/portupgrade/trunk/misc/bash/Makefile user/pgollucci/portupgrade/trunk/misc/bash/complete.sample user/pgollucci/portupgrade/trunk/misc/tcsh/Makefile user/pgollucci/portupgrade/trunk/misc/tcsh/complete.sample user/pgollucci/portupgrade/trunk/misc/zsh/Makefile user/pgollucci/portupgrade/trunk/tests/test_all.rb user/pgollucci/portupgrade/trunk/tests/test_pkgdb.rb user/pgollucci/portupgrade/trunk/tests/test_pkginfo.rb user/pgollucci/portupgrade/trunk/tests/test_pkgtsort.rb user/pgollucci/portupgrade/trunk/tests/test_pkgversion.rb user/pgollucci/portupgrade/trunk/tests/test_portinfo.rb user/pgollucci/portupgrade/trunk/tests/test_portsdb.rb Modified: user/pgollucci/portupgrade/trunk/Makefile ============================================================================== --- user/pgollucci/portupgrade/trunk/Makefile Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/Makefile Thu Sep 9 23:37:54 2010 (r212399) @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.2 2006/07/02 15:23:35 sem_prg Exp $ +# $Id: Makefile,v 1.1.1.1 2006/06/13 12:58:59 sem Exp $ SUBDIR= bin \ etc \ Modified: user/pgollucci/portupgrade/trunk/Makefile.compat ============================================================================== --- user/pgollucci/portupgrade/trunk/Makefile.compat Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/Makefile.compat Thu Sep 9 23:37:54 2010 (r212399) @@ -1,4 +1,4 @@ -# $Id: Makefile.compat,v 1.1.1.1 2006/06/13 12:58:59 sem_prg Exp $ +# $Id: Makefile.compat 52 2006-01-01 06:26:59Z koma2 $ .if defined(SCRIPTS) && !empty(SCRIPTS) && !target(_scriptsinstall) Modified: user/pgollucci/portupgrade/trunk/Makefile.inc ============================================================================== --- user/pgollucci/portupgrade/trunk/Makefile.inc Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/Makefile.inc Thu Sep 9 23:37:54 2010 (r212399) @@ -1,4 +1,4 @@ -# $Id: Makefile.inc,v 1.1.1.1 2006/06/13 12:58:59 sem_prg Exp $ +# $Id: Makefile.inc 52 2006-01-01 06:26:59Z koma2 $ PREFIX?= /usr/local Modified: user/pgollucci/portupgrade/trunk/NEWS ============================================================================== --- user/pgollucci/portupgrade/trunk/NEWS Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/NEWS Thu Sep 9 23:37:54 2010 (r212399) @@ -349,3 +349,5 @@ portupgrade 2.0.0 (released 2006-01-01): instead of "portsdb -U" (make INDEX by yourself) in portsdb(1). [1] Pointed out by: Enrique Matias [1] + +$FreeBSD: projects/pkgtools/NEWS,v 1.27 2009-10-27 23:31:09 stas Exp $ Modified: user/pgollucci/portupgrade/trunk/README ============================================================================== --- user/pgollucci/portupgrade/trunk/README Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/README Thu Sep 9 23:37:54 2010 (r212399) @@ -1,4 +1,4 @@ -$Id: README,v 1.1.1.1 2006/06/13 12:58:59 sem_prg Exp $ +$Id: README 52 2006-01-01 06:26:59Z koma2 $ You need to install the following ports to use these pkgtools. Modified: user/pgollucci/portupgrade/trunk/bin/Makefile ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/Makefile Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/Makefile Thu Sep 9 23:37:54 2010 (r212399) @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.3 2008/07/10 13:17:02 sem_prg Exp $ +# $Id: Makefile,v 1.3 2008/07/10 13:17:02 sem Exp $ SCRIPTSDIR?= ${PREFIX}/sbin @@ -28,7 +28,7 @@ ${script}: ${script:T} ${RUBY} -pe ' \ if $$. == 1; \ if /^#!/; \ - sub /^#!\s*\S*(\benv\s+)?\bruby/, "#!${RUBY}"; \ + $$_.sub(/^#!\s*\S*(\benv\s+)?\bruby/, "#!${RUBY}"); \ else; \ $$_ = "#!${RUBY}\n" + $$_; \ end; \ Modified: user/pgollucci/portupgrade/trunk/bin/pkg_fetch ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/pkg_fetch Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/pkg_fetch Thu Sep 9 23:37:54 2010 (r212399) @@ -73,24 +73,24 @@ usage: #{MYNAME} [-hfqRv] {pkgname|URI} exit 0 } - opts.def_option("-f", "--force", "Download a package even if recorded as installed;#{NEXTLINE}Remove existing packages if they are corrupt") { - |$force| + opts.def_option("-f", "--force", "Download a package even if recorded as installed;#{NEXTLINE}Remove existing packages if they are corrupt") { |v| + $force = v } # opts.def_option("-O", "--omit-check", "Omit sanity checks for dependencies.") { # $sanity_check = false # } - opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { - |$noconfig| + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v } - opts.def_option("-R", "--upward-recursive", "Download the packages required by the given#{NEXTLINE}packages as well") { - |$upward_recursive| + opts.def_option("-R", "--upward-recursive", "Download the packages required by the given#{NEXTLINE}packages as well") { |v| + $upward_recursive = v } - opts.def_option("-v", "--verbose", "Be verbose") { - |$verbose| + opts.def_option("-v", "--verbose", "Be verbose") { |v| + $verbose = v } opts.def_tail_option ' Modified: user/pgollucci/portupgrade/trunk/bin/pkg_glob ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/pkg_glob Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/pkg_glob Thu Sep 9 23:37:54 2010 (r212399) @@ -90,8 +90,8 @@ usage: #{MYNAME} [-haOqrR] [-x pkgname_g exit 0 } - opts.def_option("-a", "--all", "#{$service_verb.capitalize} all the installed packages") { - |$all| + opts.def_option("-a", "--all", "#{$service_verb.capitalize} all the installed packages") { |v| + $all = v $recursive = false $upward_recursive = false } @@ -108,14 +108,14 @@ usage: #{MYNAME} [-haOqrR] [-x pkgname_g $pkg_delete_args.push '-D' } if $service == :deinstall - opts.def_option("-f", "--force", "Force removal of the packages [*]") { - |$force| + opts.def_option("-f", "--force", "Force removal of the packages [*]") { |v| + $force = v $pkg_delete_args.push '-f' $collate = false } if $service == :deinstall - opts.def_option("-i", "--interactive", "Request confirmation for each package removal [*]") { - |$interactive| + opts.def_option("-i", "--interactive", "Request confirmation for each package removal [*]") { |v| + $interactive = v if $interactive $verbose = true end @@ -123,8 +123,8 @@ usage: #{MYNAME} [-haOqrR] [-x pkgname_g $pkg_delete_args.push '-i' } if $service == :deinstall - opts.def_option("-n", "--noexecute", "Do not actually deinstall a package, just report the#{NEXTLINE}steps that would be taken if it were [*]") { - |$noexecute| + opts.def_option("-n", "--noexecute", "Do not actually deinstall a package, just report the#{NEXTLINE}steps that would be taken if it were [*]") { |v| + $noexecute = v if $noexecute $verbose = true $interactive = false @@ -137,17 +137,16 @@ usage: #{MYNAME} [-haOqrR] [-x pkgname_g $sanity_check = false } - opts.def_option("-p", "--prefix=PREFIX", "Set prefix [*]") { - |prefix| + opts.def_option("-p", "--prefix=PREFIX", "Set prefix [*]") { |prefix| $pkg_delete_args.push '-p', prefix } if $service == :deinstall - opts.def_option("-P", "--preserve", "Preserve shared libraries (Save *.so.n)") { - |$preserve_shlib| + opts.def_option("-P", "--preserve", "Preserve shared libraries (Save *.so.n)") { |v| + $preserve_shlib = v } if $service == :deinstall - opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { - |$noconfig| + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v } opts.def_option("-r", "--recursive", "#{$service_verb.capitalize} all those depending on the given#{NEXTLINE}packages as well") { @@ -158,8 +157,8 @@ usage: #{MYNAME} [-haOqrR] [-x pkgname_g $upward_recursive = true unless $all } - opts.def_option("-v", "--verbose", "Turn on verbose output [*]") { - |$verbose| + opts.def_option("-v", "--verbose", "Turn on verbose output [*]") { |v| + $verbose = v $pkg_delete_args.push '-v' } if $service == :deinstall @@ -168,8 +167,7 @@ usage: #{MYNAME} [-haOqrR] [-x pkgname_g [*] These options are transparently passed to pkg_delete(1). EOF - opts.def_option("-x", "--exclude=GLOB", "Exclude packages matching the specified glob#{NEXTLINE}pattern") { - |arg| + opts.def_option("-x", "--exclude=GLOB", "Exclude packages matching the specified glob#{NEXTLINE}pattern") { |arg| begin pattern = parse_pattern(arg) rescue RegexpError => e @@ -299,8 +297,8 @@ def get_beforedeinstall_command(origin) commands[commands.size, 0] = config_beforedeinstall(origin) # maybe nil commands.uniq! - commands.each { |cmd| cmd.sub!(/^[;\s]+/, '') } - commands.reject! { |cmd| cmd.empty? } + commands.each { |cmd| cmd.sub!(/^[;\s]+/, '') if !cmd.nil } + commands.reject! { |cmd| cmd.nil? || cmd.empty? } if commands.empty? nil Modified: user/pgollucci/portupgrade/trunk/bin/pkg_sort ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/pkg_sort Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/pkg_sort Thu Sep 9 23:37:54 2010 (r212399) @@ -62,8 +62,8 @@ usage: #{MYNAME} [-hq] exit 0 } - opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { - |$noconfig| + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v } opts.def_tail_option ' Modified: user/pgollucci/portupgrade/trunk/bin/pkgdb ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/pkgdb Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/pkgdb Thu Sep 9 23:37:54 2010 (r212399) @@ -28,6 +28,8 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # +# $FreeBSD: projects/pkgtools/bin/pkgdb,v 1.25 2009-10-26 12:26:10 stas Exp $ +# MYREVISION = %w$Rev: 52 $[1] MYDATE = %w$Date: 2008/07/01 13:32:07 $[1] @@ -74,8 +76,7 @@ usage: #{MYNAME} [-hafFfiLOQQquv] [-c pk exit 0 } - opts.def_option("-c", "--collate=PKGNAME", "Show files installed by the given packge#{NEXTLINE}that have been overwritten by other packages") { - |pkgname| + opts.def_option("-c", "--collate=PKGNAME", "Show files installed by the given packge#{NEXTLINE}that have been overwritten by other packages") { |pkgname| pkgname = $pkgdb.strip(pkgname, true) begin @@ -99,17 +100,17 @@ usage: #{MYNAME} [-hafFfiLOQQquv] [-c pk end unless dry_parse } - opts.def_option("-f", "--force", "Force;#{NEXTLINE}Specified with -u, update database#{NEXTLINE}regardless of timestamps#{NEXTLINE}Specified with -F, fix held packages too") { - |$force| + opts.def_option("-f", "--force", "Force;#{NEXTLINE}Specified with -u, update database#{NEXTLINE}regardless of timestamps#{NEXTLINE}Specified with -F, fix held packages too") { |v| + $force = v } - opts.def_option("-F", "--fix", "Fix the package database interactively") { - |$fix_db| + opts.def_option("-F", "--fix", "Fix the package database interactively") { |v| + $fix_db = v $interactive = true if ! $automatic } - opts.def_option("-a", "--auto", "Turn on automatic mode when -F is also specified") { - |$automatic| + opts.def_option("-a", "--auto", "Turn on automatic mode when -F is also specified") { |v| + $automatic = v $interactive = false if $fix_db } @@ -118,16 +119,15 @@ usage: #{MYNAME} [-hafFfiLOQQquv] [-c pk } opts.def_option("-i", "--interactive", - "Turn on interactive mode") { - |$interactive| + "Turn on interactive mode") { |v| + $interactive = v } - opts.def_option("-L", "--fix-lost", "Check and restore lost dependencies#{NEXTLINE}against the ports tree") { - |$check_lost| + opts.def_option("-L", "--fix-lost", "Check and restore lost dependencies#{NEXTLINE}against the ports tree") { |v| + $check_lost = v } - opts.def_option("-o", "--origin=PKGNAME[=ORIGIN]", "Look up or change the origin of the given#{NEXTLINE}package") { - |arg| + opts.def_option("-o", "--origin=PKGNAME[=ORIGIN]", "Look up or change the origin of the given#{NEXTLINE}package") { |arg| pkgname, origin = arg.split('=', 2) spkgname = $pkgdb.strip(pkgname, true) unless dry_parse @@ -149,8 +149,8 @@ usage: #{MYNAME} [-hafFfiLOQQquv] [-c pk end } - opts.def_option("-O", "--omit-check", "Specified with -F, turn off checks#{NEXTLINE}dependencies against the ports tree. Useful#{NEXTLINE}if you need a speed-up") { - |$omit_check| + opts.def_option("-O", "--omit-check", "Specified with -F, turn off checks#{NEXTLINE}dependencies against the ports tree. Useful#{NEXTLINE}if you need a speed-up") { |v| + $omit_check = v } opts.def_option("-Q", "--quiet", "Do not write anything to stdout;#{NEXTLINE}Specified twice, stderr neither") { @@ -163,12 +163,11 @@ usage: #{MYNAME} [-hafFfiLOQQquv] [-c pk end } - opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { - |$noconfig| + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v } - opts.def_option("-s", "--substitute=/OLD/NEW/", "Substitute all the dependencies recorded#{NEXTLINE}as OLD with NEW") { - |expr| + opts.def_option("-s", "--substitute=/OLD/NEW/", "Substitute all the dependencies recorded#{NEXTLINE}as OLD with NEW") { |expr| if expr.empty? warning_message "Illegal expression: " + expr print opts @@ -201,12 +200,12 @@ usage: #{MYNAME} [-hafFfiLOQQquv] [-c pk $automatic = automatic } - opts.def_option("-u", "--update", "Update the package database") { - |$update_db| + opts.def_option("-u", "--update", "Update the package database") { |v| + $update_db = v } - opts.def_option("-v", "--verbose", "Be verbose") { - |$verbose| + opts.def_option("-v", "--verbose", "Be verbose") { |v| + $verbose = v } opts.def_tail_option ' @@ -647,11 +646,11 @@ def fix_dependencies(pkgname) puts "Stale dependency: #{pkgname} -> #{dep} (#{origin}):" if !$omit_check && !get_real_run_deps(pkgname).values.include?(origin) # Ignore dependencies which exist in ALG_PKGDEP - next if alt_dep(dep) - - puts "-> Deleted. (irrelevant)" - modify_pkgdep(pkgname, dep, :delete) - next + unless alt_dep(dep, origin) + puts "-> Deleted. (irrelevant)" + modify_pkgdep(pkgname, dep, :delete) + next + end end if config_held?(pkgname) && !$force Modified: user/pgollucci/portupgrade/trunk/bin/pkgdu ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/pkgdu Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/pkgdu Thu Sep 9 23:37:54 2010 (r212399) @@ -77,25 +77,24 @@ usage: #{MYNAME} [-hbkmRrqs] [pkgname_gl $divider = 1024*1024 } - opts.def_option("-t", "--total", "Display a grand total") { - |$total| + opts.def_option("-t", "--total", "Display a grand total") { |v| + $total = v } - opts.def_option("-q", "--quiet", "Display only grand total") { - |$quiet| + opts.def_option("-q", "--quiet", "Display only grand total") { |v| + $quiet = v $total = true } - opts.def_option("-r", "--recursive", "Check for all those depending on the given#{NEXTLINE}packages as well") { - |$recursive| + opts.def_option("-r", "--recursive", "Check for all those depending on the given#{NEXTLINE}packages as well") { |v| + $recursive = v } - opts.def_option("-R", "--upward-recursive", "Check for all those required by the given#{NEXTLINE}packages as well") { - |$upward_recursive| + opts.def_option("-R", "--upward-recursive", "Check for all those required by the given#{NEXTLINE}packages as well") { |v| + $upward_recursive = v } - opts.def_option("-x", "--exclude=GLOB", "Exclude packages matching the specified glob#{NEXTLINE}pattern") { - |arg| + opts.def_option("-x", "--exclude=GLOB", "Exclude packages matching the specified glob#{NEXTLINE}pattern") { |arg| begin pattern = parse_pattern(arg) rescue RegexpError => e Modified: user/pgollucci/portupgrade/trunk/bin/portcvsweb ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/portcvsweb Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/portcvsweb Thu Sep 9 23:37:54 2010 (r212399) @@ -418,22 +418,20 @@ usage: #{MYNAME} [-hqv] {pkgname_glob|po exit 0 } - opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { - |$noconfig| + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v } - opts.def_option("-v", "--verbose", "Be verbose") { - |$verbose| + opts.def_option("-v", "--verbose", "Be verbose") { |v| + $verbose = v } opts.def_option("-F", "--freshports", - "View FreshPorts.org instead of cvsweb") { - |freshports| + "View FreshPorts.org instead of cvsweb") { |freshports| } opts.def_option("-D [DATE]", "--datespec [DATE]", - "View the FreshPorts.org of DAYBACK days ago.") { - |datespec| + "View the FreshPorts.org of DAYBACK days ago.") { |datespec| if datespec == nil datespec = "0" end Modified: user/pgollucci/portupgrade/trunk/bin/portsclean ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/portsclean Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/portsclean Thu Sep 9 23:37:54 2010 (r212399) @@ -72,8 +72,8 @@ usage: #{MYNAME} [-hCDDiLnPPQQq] exit 0 } - opts.def_option("-C", "--workclean", "Clean up working directories") { - |$workclean| + opts.def_option("-C", "--workclean", "Clean up working directories") { |v| + $workclean = v } opts.def_option("-D", "--distclean", "Clean up distfiles which are not referenced from any#{NEXTLINE}port in the ports tree;#{NEXTLINE}Specified twice, clean up distfiles which are not#{NEXTLINE}referenced from any port that is currently installed") { @@ -86,12 +86,12 @@ usage: #{MYNAME} [-hCDDiLnPPQQq] end } - opts.def_option("-L", "--libclean", "Clean up old shared libraries") { - |$libclean| + opts.def_option("-L", "--libclean", "Clean up old shared libraries") { |v| + $libclean = v } - opts.def_option("-n", "--noexecute", "Do not actually delete files") { - |$noexecute| + opts.def_option("-n", "--noexecute", "Do not actually delete files") { |v| + $noexecute = v if $noexecute $interactive = false end @@ -115,8 +115,8 @@ usage: #{MYNAME} [-hCDDiLnPPQQq] end } - opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { - |$noconfig| + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v } opts.def_tail_option ' @@ -310,7 +310,7 @@ def libclean() libtable = {} - `/sbin/ldconfig -elf -r`.each do |line| + `/sbin/ldconfig -elf -r`.each_line do |line| line.strip! case line Modified: user/pgollucci/portupgrade/trunk/bin/portsdb ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/portsdb Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/portsdb Thu Sep 9 23:37:54 2010 (r212399) @@ -72,49 +72,47 @@ usage: #{MYNAME} [-hfFMqrRuU] [-x port_g exit 0 } - opts.def_option("-f", "--force", "Force to update database regardless of timestamps") { - |$force| + opts.def_option("-f", "--force", "Force to update database regardless of timestamps") { |v| + $force = v } - opts.def_option("-F", "--fetchindex", "Fetch INDEX") { - |b| + opts.def_option("-F", "--fetchindex", "Fetch INDEX") { |b| $update_index = $fetch_index = b } - opts.def_option("-M", "--master-recursive", "List all the master ports of the given packages#{NEXTLINE}as well") { - |$master_recursive| + opts.def_option("-M", "--master-recursive", "List all the master ports of the given packages#{NEXTLINE}as well") { |v| + $master_recursive = v } # opts.def_option("-O", "--omit-check", "Omit sanity checks for dependencies.") { # $sanity_check = false # } - opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { - |$noconfig| + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v } - opts.def_option("-r", "--recursive", "List all those depending on the given packages#{NEXTLINE}as well") { - |$recursive| + opts.def_option("-r", "--recursive", "List all those depending on the given packages#{NEXTLINE}as well") { |v| + $recursive = v } - opts.def_option("-R", "--upward-recursive", "List all those required by the given packages#{NEXTLINE}as well") { - |$upward_recursive| + opts.def_option("-R", "--upward-recursive", "List all those required by the given packages#{NEXTLINE}as well") { |v| + $upward_recursive = v } -# opts.def_option("-S", "--slave-recursive", "List all the slave ports of the given packages#{NEXTLINE}as well") { -# |$slave_recursive| +# opts.def_option("-S", "--slave-recursive", "List all the slave ports of the given packages#{NEXTLINE}as well") { |v| +# $slave_recursive = v # } - opts.def_option("-u", "--update", "Update INDEX.db") { - |$update_db| + opts.def_option("-u", "--update", "Update INDEX.db") { |v| + $update_db = v } - opts.def_option("-U", "--updateindex", "Update INDEX") { - |$update_index| + opts.def_option("-U", "--updateindex", "Update INDEX") { |v| + $update_index = v } - opts.def_option("-x", "--exclude=GLOB", "Exclude ports matching the specified glob#{NEXTLINE}pattern") { - |arg| + opts.def_option("-x", "--exclude=GLOB", "Exclude ports matching the specified glob#{NEXTLINE}pattern") { |arg| begin pattern = parse_pattern(arg) rescue RegexpError => e Modified: user/pgollucci/portupgrade/trunk/bin/portupgrade ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/portupgrade Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/portupgrade Thu Sep 9 23:37:54 2010 (r212399) @@ -28,6 +28,8 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # +# $FreeBSD: projects/pkgtools/bin/portupgrade,v 1.67 2009-12-22 01:24:51 stas Exp $ +# MYREVISION = %w$Rev: 71 $[1] MYDATE = %w$Date: 2008/07/01 11:32:25 $[1] @@ -234,44 +236,44 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR } opts.def_option("-a", "--all", - "Do with all the installed packages") { - |$all| + "Do with all the installed packages") { |v| + $all = v $recursive = false $upward_recursive = false } opts.def_option("-A", "--afterinstall=CMD", - "Run the command after each installation") { - |$afterinstall| + "Run the command after each installation") { |v| + $afterinstall = v $afterinstall.strip! } opts.def_option("-b", "--backup-packages", - "Keep backup packages of the old versions") { - |$backup_packages| + "Keep backup packages of the old versions") { |v| + $backup_packages = v } opts.def_option("--batch", "Run an upgrading process in a batch mode" << NEXTLINE << - "(with BATCH=yes)") { - |$batch_mode| + "(with BATCH=yes)") { |v| + $batch_mode = v } opts.def_option("-B", "--beforebuild=CMD", "Run the command before each build; If the command" << NEXTLINE << - "exits in failure, then the port will be skipped") { - |$beforebuild| + "exits in failure, then the port will be skipped") { |v| + $beforebuild = v $beforebuild.strip! } opts.def_option("-c", "--config", - "Run \"make config-conditional\" before everything for all tasks") { - |$config| + "Run \"make config-conditional\" before everything for all tasks") { |v| + $config = v } opts.def_option("-C", "--force-config", - "Run \"make config\" before everything for all tasks") { - |$force_config| + "Run \"make config\" before everything for all tasks") { |v| + $force_config = v $config = true } @@ -283,43 +285,42 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR } opts.def_option("-e", "--emit-summaries", - "Emit summary info after each port processing" << NEXTLINE ) { - |$emit_summaries| + "Emit summary info after each port processing" << NEXTLINE ) { |v| + $emit_summaries = v } opts.def_option("-f", "--force", "Force the upgrade of a port even if it is to be a" << NEXTLINE << - "downgrade or just a reinstall, or the port is held") { - |$force| + "downgrade or just a reinstall, or the port is held") { |v| + $force = v } opts.def_option("-F", "--fetch-only", "Only fetch distfiles or packages (if -P is given);" << NEXTLINE << - "Do not build or install anything") { - |$fetch_only| + "Do not build or install anything") { |v| + $fetch_only = v } opts.def_option("--ignore-moved", - "Ignore MOVED file") { - |$ignore_moved| + "Ignore MOVED file") { |v| + $ignore_moved = v } opts.def_option("-i", "--interactive", - "Turn on interactive mode") { - |$interactive| + "Turn on interactive mode") { |v| + $interactive = v $verbose = true } opts.def_option("-k", "--keep-going", "Force the upgrade of a port even if some of the" << NEXTLINE << - "requisite ports have failed to upgrade") { - |$keep_going| + "requisite ports have failed to upgrade") { |v| + $keep_going = v } opts.def_option("-l", "--results-file=FILE", "Specify a file name to save the results to" << NEXTLINE << - "(default: do not save results)") { - |resultsfile| + "(default: do not save results)") { |resultsfile| $resultsfile = File.expand_path(resultsfile) } @@ -327,8 +328,7 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR "Specify a printf(3) style format to determine the" << NEXTLINE << "log file name for each port; '%s::%s' is appended" << NEXTLINE << "if it does not contain a %; category and portname" << NEXTLINE << - "are given as arguments (default: do not save logs)") { - |fmt| + "are given as arguments (default: do not save logs)") { |fmt| fmt.include?(?%) or fmt << '%s::%s' $logfilename_format = File.expand_path(fmt) @@ -336,14 +336,13 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR opts.def_option("-m", "--make-args=ARGS", "Specify arguments to append to each make(1)" << NEXTLINE << - "command line") { - |$make_args| - } + "command line") { |v| + $make_args = v + } opts.def_option("-M", "--make-env=ARGS", "Specify arguments to prepend to each make(1)" << NEXTLINE << - "command line") { - |make_env| + "command line") { |make_env| $make_env = shellwords(make_env) unless make_env.empty? if $make_env[0].include?('=') @@ -353,8 +352,8 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR opts.def_option("-n", "--noexecute", "Do not upgrade any ports, but just show what would" << NEXTLINE << - "be done") { - |$noexecute| + "be done") { |v| + $noexecute = v $verbose = true $interactive = true $yestoall = false @@ -363,13 +362,12 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR opts.def_option("-N", "--new", "Install a new one when a specified package is" << NEXTLINE << "not installed, after upgrading all the dependent" << NEXTLINE << - "packages (default: #{MYNAME == 'portinstall' ? 'on' : 'off'})") { - |$new| + "packages (default: #{MYNAME == 'portinstall' ? 'on' : 'off'})") { |v| + $new = v } opts.def_option("-o", "--origin=ORIGIN", - "Specify a port to upgrade the following pkg with") { - |origin| + "Specify a port to upgrade the following pkg with") { |origin| $origin = $portsdb.strip(origin) || origin } @@ -380,8 +378,8 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR } opts.def_option("-p", "--package", - "Build package when each port is installed") { - |$package| + "Build package when each port is installed") { |v| + $package = v } opts.def_option("-P", "--use-packages", @@ -395,19 +393,19 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR } opts.def_option("--use-packages-only", - "Or -PP; Use no ports but packages only") { - |$use_packages_only| + "Or -PP; Use no ports but packages only") { |v| + $use_packages_only = v $use_packages = true } opts.def_option("-q", "--quiet", - "Be quiet when -N option specified and the package already installed") { - |$quiet| + "Be quiet when -N option specified and the package already installed") { |v| + $quiet = v } opts.def_option("--noconfig", - "Do not read pkgtools.conf") { - |$noconfig| + "Do not read pkgtools.conf") { |v| + $noconfig = v } opts.def_option("-r", "--recursive", @@ -424,14 +422,13 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR } opts.def_option("-s", "--sudo", - "Run commands under sudo(8) where needed") { - |$sudo| + "Run commands under sudo(8) where needed") { |v| + $sudo = v } opts.def_option("-S", "--sudo-command=CMD", "Specify an alternative to sudo(8)" << NEXTLINE << - "e.g. 'su root -c \"%s\"' (default: sudo)") { - |sudo_command| + "e.g. 'su root -c \"%s\"' (default: sudo)") { |sudo_command| $sudo_args = shellwords(sudo_command) } @@ -441,31 +438,28 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR } opts.def_option("-v", "--verbose", - "Be verbose") { - |$verbose| + "Be verbose") { |v| + $verbose = v } opts.def_option("-w", "--noclean", - "Do not \"make clean\" before each build") { - |noclean| + "Do not \"make clean\" before each build") { |noclean| $clean = false } opts.def_option("-W", "--nocleanup", - "Do not \"make clean\" after each installation") { - |nocleanup| + "Do not \"make clean\" after each installation") { |nocleanup| $cleanup = false } opts.def_option("--without-env-upgrade", - "Do not set UPGRADE_* environment variables") { - |$without_env_upgrade| + "Do not set UPGRADE_* environment variables") { |v| + $without_env_upgrade = v } opts.def_option("-x", "--exclude=GLOB", "Exclude packages matching the specified glob" << NEXTLINE << - "pattern") { - |arg| + "pattern") { |arg| begin pattern = parse_pattern(arg) rescue RegexpError => e @@ -477,8 +471,8 @@ usage: #{MYNAME} [-habcCDDefFiklnOpPPqrR } opts.def_option("-y", "--yes", - "Answer yes to all the questions") { - |$yestoall| + "Answer yes to all the questions") { |v| + $yestoall = v $verbose = true $noexecute = false } @@ -637,7 +631,10 @@ Environment Variables [default]: if $upward_recursive || $config dep = [] get_all_depends(origin).each do |d| - dep << $pkgdb.deorigin(d).to_s + newdep = $pkgdb.deorigin(d) + unless newdep.nil? then + dep << newdep.to_s + end end depends |= dep if $upward_recursive end @@ -659,7 +656,7 @@ Environment Variables [default]: not_need_upgrade = [] depends.each do |task| STDERR.print '.' - next if task == '' + next if task.nil? or task.empty? begin pkg = PkgInfo.new(task) rescue ArgumentError => e @@ -834,7 +831,7 @@ def get_all_depends(origin, parents_list depends = Set.new portdir = $portsdb.portdir(origin) - return nil if not File.directory?(portdir) + return [] if not File.directory?(portdir) begin run_make_config(portdir, origin) if $config @@ -873,9 +870,7 @@ def get_all_depends(origin, parents_list depends.each do |dep| children_deps.merge(get_all_depends(dep, parents_list)) if !dep.nil? end - if children_deps.nil? - next - else + if !children_deps.nil? depends.merge(children_deps) end @@ -932,7 +927,7 @@ def do_upgrade(pkgname) origin = $task_options[pkgname][:origin] - if !origin || !File.directory?($portsdb.ports_dir()+'/'+origin) + if !origin || !File.directory?($portsdb.ports_dir() + '/' + origin) if !$ignore_moved and \ !config_ignore_moved?(pkg) and \ (moved = $portsdb.moved.trace(pkg.origin)) @@ -942,7 +937,7 @@ def do_upgrade(pkgname) end else warning_message "Package '#{pkg.name}' has been removed from ports tree." - $results << PkgResult.new(origin, :ignored, pkgname) +# $results << PkgResult.new(origin, :ignored, pkgname) return end else @@ -1029,6 +1024,10 @@ def do_upgrade(pkgname) end def do_install(origin) + if origin.nil? then + warning_message "NIL origin passed to do_install" + return + end if result = $results[origin] progress_message "Skipping '#{origin}' because it has already #{result.phrase(true)}" @@ -1147,8 +1146,8 @@ def get_beforebuild_command(origin) commands[commands.size, 0] = config_beforebuild(origin) # maybe nil commands.uniq! - commands.each { |cmd| cmd.sub!(/^[;\s]+/, '') } - commands.reject! { |cmd| cmd.empty? } + commands.each { |cmd| cmd.sub!(/^[;\s]+/, '') if !cmd.nil? } + commands.reject! { |cmd| cmd.nil? || cmd.empty? } if commands.empty? nil @@ -1163,8 +1162,8 @@ def get_afterinstall_command(origin) commands[0, 0] = config_afterinstall(origin) # maybe nil commands.uniq! - commands.each { |cmd| cmd.sub!(/^[;\s]+/, '') } - commands.reject! { |cmd| cmd.empty? } + commands.each { |cmd| cmd.sub!(/^[;\s]+/, '') if !cmd.nil? } + commands.reject! { |cmd| cmd.nil? || cmd.empty? } if commands.empty? nil @@ -1460,18 +1459,24 @@ def get_pkgname(origin) cmdargs.concat(get_make_args(origin)) - output = `cd #{portdir} && #{shelljoin(*cmdargs)} -V PKGNAME -V IGNORE -V NO_IGNORE 2>&1`.to_a + output = `cd #{portdir} && #{shelljoin(*cmdargs)} -V PKGNAME -V IGNORE -V NO_IGNORE -V ECHO_MSG 2>&1`.scan(/.*\n/) - if output.size != 3 + if output.size != 4 warning_message "Makefile possibly broken: #{origin}:" output.each { |line| STDERR.print "\t" + line } raise MakefileBrokenError end - ignore = output[1].chomp + ignore_message = output[1].chomp no_ignore = !output[2].chomp.empty? + echo_cmd = output[3].chomp + ignore = `#{echo_cmd} "#{ignore_message}"` + + # Some packages ouptut a ':\n ' to try to look nice when using the normal + # ports build process. That looks really bad here, so we undo that. + ignore.slice!(0..2) if (ignore.match /^:\n /) - if not ignore.empty? + if not ignore_message.empty? warning_message "Port marked as IGNORE: #{origin}:" STDERR.puts "\t" + ignore raise IgnoreMarkError unless no_ignore @@ -1936,7 +1941,7 @@ def uninstall_pkg(pkgname, logfile = nil if str = backquote!(PkgDB::command(:pkg_create), '-vb', pkgname, File.join($tmpdir, pkgname + $portsdb.pkg_sufx)) - str.each { |line| + str.each_line { |line| if /^Creating .*tar ball in \'(.*)\'/ =~ line backup_pkgfile = $1 break Modified: user/pgollucci/portupgrade/trunk/bin/portversion ============================================================================== --- user/pgollucci/portupgrade/trunk/bin/portversion Thu Sep 9 23:31:22 2010 (r212398) +++ user/pgollucci/portupgrade/trunk/bin/portversion Thu Sep 9 23:37:54 2010 (r212399) @@ -85,12 +85,11 @@ usage: #{MYNAME} [-hOqv] [-l limit_chars exit 0 } - opts.def_option("-c", "--command-output", "Enable command output") { - |$command_output| + opts.def_option("-c", "--command-output", "Enable command output") { |v| + $command_output = v } - opts.def_option("-C", "--command-args=ARGS", "Specify the arguments for portupgrade in command#{NEXTLINE}output (default: none)") { - |command_args| + opts.def_option("-C", "--command-args=ARGS", "Specify the arguments for portupgrade in command#{NEXTLINE}output (default: none)") { |command_args| $command = 'portupgrade ' + command_args } @@ -99,20 +98,20 @@ usage: #{MYNAME} [-hOqv] [-l limit_chars } opts.def_option("--ignore-moved", - "Ignore MOVED file") { - |$ignore_moved| + "Ignore MOVED file") { |v| + $ignore_moved = v } - opts.def_option("-l", "--limit=CHARS", "Only include the packages with the specified#{NEXTLINE}status flags") { - |$limit_chars| + opts.def_option("-l", "--limit=CHARS", "Only include the packages with the specified#{NEXTLINE}status flags") { |v| + $limit_chars = v # XXX: workaround: optparse treats `-l=' as '-l ""' if $limit_chars.empty? $limit_chars = '=' end } - opts.def_option("-L", "--inv-limit=CHARS", "Exclude the packages with the specified#{NEXTLINE}status flags") { - |$inv_limit_chars| + opts.def_option("-L", "--inv-limit=CHARS", "Exclude the packages with the specified#{NEXTLINE}status flags") { |v| + $inv_limit_chars = v # XXX: workaround: optparse treats `-L=' as '-L ""' if $inv_limit_chars.empty? $inv_limit_chars = '=' @@ -127,34 +126,33 @@ usage: #{MYNAME} [-hOqv] [-l limit_chars $sanity_check = false } - opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { - |$noconfig| + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v } opts.def_option("-Q", "--quiet", "Do not display status chars") { $verbose_output = :quiet } - opts.def_option("-r", "--recursive", "Check for all those depending on the given#{NEXTLINE}packages as well") { - |$recursive| + opts.def_option("-r", "--recursive", "Check for all those depending on the given#{NEXTLINE}packages as well") { |v| *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:38:29 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9D9510656C0; Thu, 9 Sep 2010 23:38:29 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B56618FC14; Thu, 9 Sep 2010 23:38:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NcTGS051067; Thu, 9 Sep 2010 23:38:29 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NcTdG051058; Thu, 9 Sep 2010 23:38:29 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092338.o89NcTdG051058@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:38:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212400 - in user/pgollucci/portupgrade/tags/20091221_1: . bin etc lib man misc misc/bash misc/tcsh misc/zsh tests X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:38:29 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:38:29 2010 New Revision: 212400 URL: http://svn.freebsd.org/changeset/base/212400 Log: tag 20091221_1 Added: user/pgollucci/portupgrade/tags/20091221_1/ - copied from r212398, user/pgollucci/portupgrade/trunk/ Replaced: user/pgollucci/portupgrade/tags/20091221_1/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/Makefile user/pgollucci/portupgrade/tags/20091221_1/Makefile.compat - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/Makefile.compat user/pgollucci/portupgrade/tags/20091221_1/Makefile.inc - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/Makefile.inc user/pgollucci/portupgrade/tags/20091221_1/NEWS - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/NEWS user/pgollucci/portupgrade/tags/20091221_1/README - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/README user/pgollucci/portupgrade/tags/20091221_1/bin/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/Makefile user/pgollucci/portupgrade/tags/20091221_1/bin/pkg_fetch - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/pkg_fetch user/pgollucci/portupgrade/tags/20091221_1/bin/pkg_glob - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/pkg_glob user/pgollucci/portupgrade/tags/20091221_1/bin/pkg_sort - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/pkg_sort user/pgollucci/portupgrade/tags/20091221_1/bin/pkgdb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/pkgdb user/pgollucci/portupgrade/tags/20091221_1/bin/pkgdu - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/pkgdu user/pgollucci/portupgrade/tags/20091221_1/bin/portcvsweb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/portcvsweb user/pgollucci/portupgrade/tags/20091221_1/bin/portsclean - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/portsclean user/pgollucci/portupgrade/tags/20091221_1/bin/portsdb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/portsdb user/pgollucci/portupgrade/tags/20091221_1/bin/portupgrade - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/portupgrade user/pgollucci/portupgrade/tags/20091221_1/bin/portversion - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/bin/portversion user/pgollucci/portupgrade/tags/20091221_1/etc/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/etc/Makefile user/pgollucci/portupgrade/tags/20091221_1/etc/pkgtools.conf - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/etc/pkgtools.conf user/pgollucci/portupgrade/tags/20091221_1/etc/pkgtools.sh - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/etc/pkgtools.sh user/pgollucci/portupgrade/tags/20091221_1/etc/status-pkg.sh - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/etc/status-pkg.sh user/pgollucci/portupgrade/tags/20091221_1/lib/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/Makefile user/pgollucci/portupgrade/tags/20091221_1/lib/pkg.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/pkg.rb user/pgollucci/portupgrade/tags/20091221_1/lib/pkgdb.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/pkgdb.rb user/pgollucci/portupgrade/tags/20091221_1/lib/pkgdbtools.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/pkgdbtools.rb user/pgollucci/portupgrade/tags/20091221_1/lib/pkginfo.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/pkginfo.rb user/pgollucci/portupgrade/tags/20091221_1/lib/pkgmisc.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/pkgmisc.rb user/pgollucci/portupgrade/tags/20091221_1/lib/pkgtools.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/pkgtools.rb user/pgollucci/portupgrade/tags/20091221_1/lib/pkgtsort.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/pkgtsort.rb user/pgollucci/portupgrade/tags/20091221_1/lib/pkgversion.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/pkgversion.rb user/pgollucci/portupgrade/tags/20091221_1/lib/portinfo.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/portinfo.rb user/pgollucci/portupgrade/tags/20091221_1/lib/ports.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/ports.rb user/pgollucci/portupgrade/tags/20091221_1/lib/portsdb.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/lib/portsdb.rb user/pgollucci/portupgrade/tags/20091221_1/man/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/Makefile user/pgollucci/portupgrade/tags/20091221_1/man/pkg_deinstall.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/pkg_deinstall.1 user/pgollucci/portupgrade/tags/20091221_1/man/pkg_fetch.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/pkg_fetch.1 user/pgollucci/portupgrade/tags/20091221_1/man/pkg_glob.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/pkg_glob.1 user/pgollucci/portupgrade/tags/20091221_1/man/pkg_sort.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/pkg_sort.1 user/pgollucci/portupgrade/tags/20091221_1/man/pkgdb.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/pkgdb.1 user/pgollucci/portupgrade/tags/20091221_1/man/pkgdu.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/pkgdu.1 user/pgollucci/portupgrade/tags/20091221_1/man/pkgtools.conf.5 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/pkgtools.conf.5 user/pgollucci/portupgrade/tags/20091221_1/man/portcvsweb.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/portcvsweb.1 user/pgollucci/portupgrade/tags/20091221_1/man/portsclean.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/portsclean.1 user/pgollucci/portupgrade/tags/20091221_1/man/portsdb.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/portsdb.1 user/pgollucci/portupgrade/tags/20091221_1/man/portupgrade.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/portupgrade.1 user/pgollucci/portupgrade/tags/20091221_1/man/portversion.1 - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/man/portversion.1 user/pgollucci/portupgrade/tags/20091221_1/misc/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/misc/Makefile user/pgollucci/portupgrade/tags/20091221_1/misc/Makefile.inc - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/misc/Makefile.inc user/pgollucci/portupgrade/tags/20091221_1/misc/bash/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/misc/bash/Makefile user/pgollucci/portupgrade/tags/20091221_1/misc/bash/complete.sample - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/misc/bash/complete.sample user/pgollucci/portupgrade/tags/20091221_1/misc/tcsh/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/misc/tcsh/Makefile user/pgollucci/portupgrade/tags/20091221_1/misc/tcsh/complete.sample - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/misc/tcsh/complete.sample user/pgollucci/portupgrade/tags/20091221_1/misc/zsh/Makefile - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/misc/zsh/Makefile user/pgollucci/portupgrade/tags/20091221_1/tests/test_all.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/tests/test_all.rb user/pgollucci/portupgrade/tags/20091221_1/tests/test_pkgdb.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/tests/test_pkgdb.rb user/pgollucci/portupgrade/tags/20091221_1/tests/test_pkginfo.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/tests/test_pkginfo.rb user/pgollucci/portupgrade/tags/20091221_1/tests/test_pkgtsort.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/tests/test_pkgtsort.rb user/pgollucci/portupgrade/tags/20091221_1/tests/test_pkgversion.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/tests/test_pkgversion.rb user/pgollucci/portupgrade/tags/20091221_1/tests/test_portinfo.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/tests/test_portinfo.rb user/pgollucci/portupgrade/tags/20091221_1/tests/test_portsdb.rb - copied unchanged from r212399, user/pgollucci/portupgrade/trunk/tests/test_portsdb.rb Copied: user/pgollucci/portupgrade/tags/20091221_1/Makefile (from r212399, user/pgollucci/portupgrade/trunk/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/tags/20091221_1/Makefile Thu Sep 9 23:38:29 2010 (r212400, copy of r212399, user/pgollucci/portupgrade/trunk/Makefile) @@ -0,0 +1,91 @@ +# $Id: Makefile,v 1.1.1.1 2006/06/13 12:58:59 sem Exp $ + +SUBDIR= bin \ + etc \ + lib \ + man \ + misc + +.include + +.include "${.CURDIR}/Makefile.inc" + +HOME?= /home/knu +TMPDIR?= /tmp + +REL_DIRS= ${HOME}/freefall/public_distfiles \ + ${HOME}/www.idaemons.org/data/distfiles + +REL_MINOR?= # none +.if !defined(REL_DATE) +REL_DATE!= date '+%Y%m%d' +.endif +.if empty(REL_MINOR) +REL_VERSION= ${REL_DATE} +.else +REL_VERSION= ${REL_DATE}.${REL_MINOR} +.endif + +DISTNAME= pkgtools-${REL_VERSION} +TARBALL= ${DISTNAME}.tar.bz2 +CHANGELOG= ChangeLog NEWS +README= README + +PORTDIR= ${HOME}/work/ports/sysutils/portupgrade + +DOCOWN?= ${BINOWN} +DOCGRP?= ${BINGRP} +DOCMODE?= 444 + +DOCFILES= ${CHANGELOG} ${README} + +CLEANFILES= pkgtools-*.tar.bz2 + +.if 0 +install: install-doc +.endif + +install-doc: ${CHANGELOG} + mkdir -p ${DOCSDIR} + ${INSTALL} -c -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} \ + ${DOCFILES} ${DESTDIR}${DOCSDIR} + +clean: clean-release + +clean-release: + rm -f ${CLEANFILES} + +${CHANGELOG}: + env LANG=C svn log -v > ${CHANGELOG} + +${TARBALL}: ${CHANGELOG} + svn up + svn export svn+ssh://svn.idaemons.org/home/svn/repos/pkgtools/trunk ${TMPDIR}/${DISTNAME} + cp ${CHANGELOG} ${TMPDIR}/${DISTNAME}/ + tar -cf - -C ${TMPDIR} ${DISTNAME} | bzip2 -9c > ${TARBALL} + rm -r ${TMPDIR}/${DISTNAME} + +tarball: ${TARBALL} + +release: ${CHANGELOG} ${TARBALL} +.for d in ${REL_DIRS} + cp -p ${TARBALL} ${d} +.endfor + +upload: + @syncfreefall -f + +port: + @${RUBY} -i -pe \ + "sub /^PORTVERSION=.*/, %{PORTVERSION=\t${REL_VERSION}}" \ + ${PORTDIR}/Makefile + @cd ${PORTDIR}; make MASTER_SORT_REGEX=idaemons distclean makesum + @cd ${PORTDIR}; cvs -d freefall:/home/ncvs di | less + +commit: + @cd ${PORTDIR}; cvs -d freefall:/home/ncvs di | $${PAGER:-more} + @echo -n 'OK? '; read ans; expr "$$ans" : '[Yy]' > /dev/null + @cd ${PORTDIR}; echo cvs -d freefall:/home/ncvs ci + +test: + @env PORTSDIR=/usr/ports ${RUBY} -Ilib tests/test_all.rb Copied: user/pgollucci/portupgrade/tags/20091221_1/Makefile.compat (from r212399, user/pgollucci/portupgrade/trunk/Makefile.compat) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/tags/20091221_1/Makefile.compat Thu Sep 9 23:38:29 2010 (r212400, copy of r212399, user/pgollucci/portupgrade/trunk/Makefile.compat) @@ -0,0 +1,101 @@ +# $Id: Makefile.compat 52 2006-01-01 06:26:59Z koma2 $ + +.if defined(SCRIPTS) && !empty(SCRIPTS) && !target(_scriptsinstall) + +all: ${SCRIPTS} + +realinstall: _scriptsinstall + +SCRIPTSDIR?= ${BINDIR} +SCRIPTSOWN?= ${BINOWN} +SCRIPTSGRP?= ${BINGRP} +SCRIPTSMODE?= ${BINMODE} + +.for script in ${SCRIPTS} +.if defined(SCRIPTSNAME) +SCRIPTSNAME_${script:T}?= ${SCRIPTSNAME} +.else +SCRIPTSNAME_${script:T}?= ${script:T:R} +.endif +SCRIPTSDIR_${script:T}?= ${SCRIPTSDIR} +SCRIPTSOWN_${script:T}?= ${SCRIPTSOWN} +SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP} +SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} +_scriptsinstall: _SCRIPTSINS_${script:T} +_SCRIPTSINS_${script:T}: ${script} + ${INSTALL} ${COPY} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ + -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ + ${_INSTALLFLAGS} ${.ALLSRC} \ + ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}} +.endfor + +.endif + +.if !defined(FILESGROUPS) + +FILESGROUPS?= FILES + +.if !target(buildfiles) +.for group in ${FILESGROUPS} +buildfiles: ${${group}} +.endfor +.endif + +all: buildfiles + +.if !target(installfiles) +.for group in ${FILESGROUPS} +.if defined(${group}) && !empty(${group}) + +${group}OWN?= ${SHAREOWN} +${group}GRP?= ${SHAREGRP} +${group}MODE?= ${SHAREMODE} +${group}DIR?= ${BINDIR} + +_${group}FILES= +.for file in ${${group}} +.if defined(${group}OWN_${file:T}) || defined(${group}GRP_${file:T}) || \ + defined(${group}MODE_${file:T}) || defined(${group}DIR_${file:T}) || \ + defined(${group}NAME_${file:T}) +${group}OWN_${file:T}?= ${${group}OWN} +${group}GRP_${file:T}?= ${${group}GRP} +${group}MODE_${file:T}?= ${${group}MODE} +${group}DIR_${file:T}?= ${${group}DIR} +.if defined(${group}NAME) +${group}NAME_${file:T}?= ${${group}NAME} +.else +${group}NAME_${file:T}?= ${file:T} +.endif +installfiles: _${group}INS_${file:T} +_${group}INS_${file:T}: ${file} + ${INSTALL} ${COPY} -o ${${group}OWN_${.ALLSRC:T}} \ + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ + ${.ALLSRC} \ + ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} +.else +_${group}FILES+= ${file} +.endif +.endfor +.if !empty(_${group}FILES) +installfiles: _${group}INS +_${group}INS: ${_${group}FILES} +.if defined(${group}NAME) + ${INSTALL} ${COPY} -o ${${group}OWN} -g ${${group}GRP} \ + -m ${${group}MODE} ${.ALLSRC} \ + ${DESTDIR}${${group}DIR}/${${group}NAME} +.else + ${INSTALL} ${COPY} -o ${${group}OWN} -g ${${group}GRP} \ + -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR} +.endif +.endif + +.endif # defined(${group}) && !empty(${group}) +.endfor + +.endif + +.if target(installfiles) +realinstall: installfiles +.endif + +.endif Copied: user/pgollucci/portupgrade/tags/20091221_1/Makefile.inc (from r212399, user/pgollucci/portupgrade/trunk/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/tags/20091221_1/Makefile.inc Thu Sep 9 23:38:29 2010 (r212400, copy of r212399, user/pgollucci/portupgrade/trunk/Makefile.inc) @@ -0,0 +1,8 @@ +# $Id: Makefile.inc 52 2006-01-01 06:26:59Z koma2 $ + +PREFIX?= /usr/local + +DOCSDIR?= ${PREFIX}/share/doc/pkgtools +EXAMPLESDIR?= ${PREFIX}/share/examples/pkgtools + +RUBY?= ${PREFIX}/bin/ruby Copied: user/pgollucci/portupgrade/tags/20091221_1/NEWS (from r212399, user/pgollucci/portupgrade/trunk/NEWS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/tags/20091221_1/NEWS Thu Sep 9 23:38:29 2010 (r212400, copy of r212399, user/pgollucci/portupgrade/trunk/NEWS) @@ -0,0 +1,353 @@ + ====================== + NEWS for portupgrade + ====================== + +------------------------------------------------------------------------ + +portupgrade 2.4.6 (released 2008-07-11): + +* Fix man pages install. + +portupgrade 2.4.5 (released 2008-07-10): + +* [portversion, portversion.1] Document new options. + +* [pkgtools.rb] Do not touch +CONTENTS file if it's not necessary. + +* [pkgmisc.rb] Remove temporary dir with `rm -r'. It could be inner dirs there. + +* [pkgdu] A new utility to display disk usage of installed packages. + +portupgrade 2.4.4 (released 2008-07-01): + +* [pkgtools.rb] Close +CONTENTS file. It made a few problems before. + +* [portupgrade.1] Some leftovers removed. Fix .Pp tag. + +* [portupgrade] Fix a failure when -PP specified for some ports. + +* [portversion] Add -F to show a package full name (with a version number) + -o to show an origin of a package and -q for quiet output. + +* [portupgrade, pkgmisc.rb] Fix a bug in make arguments quoting. If you + had an argument with spaces (e.g. WITH_MODULES="module1 module2"), it + was parsed wrong. + +* [portupgrade] Allow upgrade dependencies if -R or -r options specified + but main port is up-to-date. + +* [pkgdb.rb, portsdb.rb] If DB can't be updated, remove it and try again. + +* [portupgrade] setproctitle with a port name when 'make config' runs. + +* [portupgrade] If 'make config' fails, show a warning and ignore it. + +* [pkgdb] Do not show 'You do not own pkgdb dir' for root. + +portupgrade 2.4.3 (released 2008-02-11): + +* [portupgrade] Fix dependencies list after we gather it. So we will not + try to upgrade dependecies when a specified port is up-to-date. + +* [portsclean] Fix a typo in a condition. Now it's work again. + +* [portupgrade] Change a semantic of -q option. Now it means 'quiet'. + Don't show a message when -N specified and there is already installed + package. (For Peter Hofer. DesktopBSD). + +portupgrade 2.4.2 (released 2008-02-04): + +* A few bugs was fixed. + +portupgrade 2.4.1 (released 2008-01-29): + +* Bugs fix releasse. + +* [portupgrade] Throw RecursiveDependencyError exception instead of + plain ruby error. + +portupgrade 2.4.0 (released 2008-01-26): + +* [portupgrade] All dependencies run under portupgrade control now. + +* [portupgrade] -c and -C options was changed. Now portupgrade + run `make config-conditional` and `make config` accordingly. + +* [pkgdb] Bug fix: remove +REQUIRED_BY file if there are no ports + require this one. + +portupgrade 2.3.2 (released 2008-01-13): + +* Bugs fix release + +portupgrade 2.3.1 (released 2007-07-03): + +* [portupgrade] [pkgbd] Many bug fixes related to the last xorg update + to 7.2.0 + +portupgrade 2.3.0 (released 2007-03-01): + +* [portupgrade] At last all dependencies are tracked by portupgrade. + +portupgrade 2.2.6 (released 2007-02-27): + +* [pkgdb] Fix -O option parsing. + +* [portsdb.db] Fix and update language specific categories list. + +* [pkgdb] When run as pkg_which, don't check file existence. It allows to check + against accidently removed files. (Asked by skv@). + +* [pkgdb] Fix a bug when only origins worked in ALT_PKGDEP. pkgname globs + are very helpful there. (e.g. 'mysql*-server' => 'mysql40-server'). + +portupgrade 2.2.5 (released 2007-02-26): + +* [pkgdb] Fix issues with ghostscript-afpl vs. ghostscript-gnu, + apache13 vs. apache13+mod-ssl, etc. when -F or -L. The ports must be + described in ALT_PKGDEP section of pkgtools.conf. + +* [pkgdb] Do not make broken pkgdb.db if no ports installed. nanobsd needs it. + (Asked by Nick Hibma ) + +* [pkgdb.rb] Speed-up autofix() - add -O option for pkgdb -aF execution. + +* [pkgtools.conf] Describe PKG_SUFX variable. (Submitted by Pavel Gubin). + +portupgrade 2.2.4 (released 2007-02-23): + +* [pkgdb] Fix a bug when some dependencies could lost. + +* [pkgdb] -L to allow users fix dependencies those was lost with the bug + mentioned above. + +* [pkgdb] -i turns interactive mode on. + +* [pkgdb] Add -O option to turn off dependencies check instead of + -d option, that turned it on. + +portupgrade 2.2.3 (released 2007-02-16, never released in ports): + +* Fixes reflected last changes in the ports tree. + +* Hide pkgdb -F smartness under -d switch. It makes life harder when + there are a lot of ports with a lot of depends. (Asked by marcus@). + +portupgrade 2.2.2 (released 2006-11-18): + +* Add UPGRADE_PORT_VER environment variable. Discussed with DougB@ and + skv@. + +* Add description of UPGRADE_* environment variables in a portupgrade + man page. + +* Add checking size of a lock file before trying read it. It protects us + from a ruby error if the file is empty by some reason. + (Reported by: Lowell Gilbert ) + +portupgrade 2.2.1 (released 2006-11-12): + +* Raise an error when MOVED file has a wrong format instead of a weird + ruby error. (Reported by kris@FreeBSD.org). + +* Fix a bug when -P always treated as -PP. + +* Change PORT_UPGRADE environment variable with UPGRADE_PORT (contains + a package name for updating port) and UPGRADE_TOOL=portupgrade. + Discussed with skv@FreeBSD.org and DougB@FreeBSD.org. + +portupgrade 2.2.0 (released 2006-11-06): + +* Respect INDEXDIR after fetching INDEX (Andrew Pantyukhin ) + +* Add --batch opition. + +* Add --without-env-upgrade option. + +* Remove -DPACKAGE_BUILDING (it was in fetch-only mode) because it's only + for build cluster, not users. (Pointed out by kris@FreeBSD.org) + +* Add detection of stale lock files. They can stay if one of tools suddenly + terminated. + +* Improve pkgdb -F - respect OPTIONS and pkgtools.conf settings. + +portupgrade 2.1.7 (released 2006-08-14): + +* Make fetch(1) quiet if stdout is not a tty. + +* Highlight summary messages with '**'. + +* Extract common code from pkgdb.rb and portdb.rb in pkgdbtools.rb. + So we have a common open/locking/close etc. procedures for both DBs. + +* Do not remove +REQUIRED_BY files when they are empty. pkg_delete(1) + works this way. (Requested by: Jeremy Messenger , + Doug Barton ) + +* Bugs fixes. + +portupgrade 2.1.6 (released 2006-07-23): + +* Move all man pages into own one directory for easier maintain. + +* Bugs fixes. + +portupgrade 2.1.5 (released 2006-07-01): + +* Try bdb driver first. If it's failed fall back to bdb1 and dbd afterwards. + Before the chain was bdb1->dbd, no bdb driver tried. + +* Disable running config for all ports. It should be moved to after + depedencies parsing and dependencies parsing should be rerun after config. + +* Fix portupgrade work when stdin closed. It allows to run portupgrade from + wrappers. + +* Do not lock pkgdb.db when runned not as root. No writting possible + anyway. + +* Other bugs fixes. + +portupgrade 2.1.4 (released 2006-06-18): + +* Add -e (--emit-summaries) option and show summary messages only when + the option defined or verbose mode is on. + +* Allow origins in ALT_PKGDEP. This announced in pkgtools.conf + but did not work really. + +* Run 'make config' before all operations unless -j (--jet-mode) + option specified. + +* Add lock on operations with pkgdb.db. Now you can safe run a few + portupgrade(1). + +* Bugs fixes. + +portupgrade 2.1.3 (released 2006-06-11): + +* Add ALT_INDEX array to pkgtools.conf. The array holds additional + INDEX files. It's useful for local categories. + +* Add to pkgtools.conf a new dirrective: include_hash('glob'). + It downloads keys and values from files coincided with 'glob' + and returns a filled hash. The glob is related to PREFIX. + +* Add a summary messages on each upgrade/install transaction: + how many tasks and how many task done. + +portupgrade 2.1.2 (released 2006-06-07): + +* Set both make argument and environment variable to PORT_UPGRADE=yes. + It makes possible a port or a package (via install/deinstall scripts) + to detect if it builds/installs/deinstalls under portupgrade(1) + +* Add to pkgtools.conf a new directive: include_eval('file') + The file will included and evaluated in the place where encountered. + The file path looking inside of PREFIX. + +* Add ALT_MOVED array to pkgtools.conf. The array holds alternate MOVED file. + E.g. for files in EXTRA_CATEGORIES. + +* Make pkgdb offer install a stale dependency before selecting it from + installed. + +portupgrade 2.1.1 (released 2006-06-04): + +* Allow set MAKE_ENV in pkgtools.conf. It works like MAKE_ARGS but sets + environment variables. + +* Add firefox in a browser list in portcvsweb(1) + +* Add PKG_BACKUP_DIR environment variable to set a directory where + old package will keep (when '-b' specified). Default: PKG_PATH + +* Other bugs fixes. + +portupgrade 2.1.0 (released 2006-06-01): + +* Rewrite version checking. Now it's complete compliant with pkg_version(1) + Add mode test in tests/test_pkgversion.rb + +* Make tests/test_pkgdb.rb does not depend on libtool with specific version. + Make it depends on ruby port with dynamicaly getting of its full package name. + +* Fix a pointyhat URL. Get rid on bento.freebsd.org URL and alpha platform. + +* Other bugs fixes. + +portupgrade 2.0.1 (released 2006-01-03): + +* portversion(1) also reads MOVED and trace origin change, + and, when invoked with "-v", displays the new origin. + + Example: + + % portversion -v screen + screen-4.0.2_2 < needs updating (port has 4.0.2_3) (=> 'sysutils/screen') + +* Add "--ignore-moved" to portupgrade(1) and portversion(1). + When invoked with this option, both programs totally ignore MOVED. + If you encounter strange behaviour of these programs, try this out. + +* Add IGNORE_MOVED option to pkgtools.conf. + This can be used to selectively ignore MOVED by pkgs. + See pkgtools.conf.sample for details. + +* Keep the order of MOVED entries, and do not trace back to old entries. + Previously, when encounters the following entries, + + editors/emacs|editors/emacs19|2004-03-20|emacs 19.x moved to a non-default port location + editors/emacs21|editors/emacs|2004-03-20|emacs 21.x moved to default port location + + portupgrade traces as "editors/emacs21" -> "editors/emacs" -> "editors/emacs19". + I thought this behavior should not be what we want to, so added this change. + + +------------------------------------------------------------------------ + +portupgrade 2.0.0 (released 2006-01-01): + +* Change the versioning scheme of portupgrade. + portupgrade now becomes 2.0.0! + +* Add FreshPorts support to portcvsweb(1). + You can view CVS history via FreshPorts instead of CVSweb + by using "portcvsweb -F". See the man page of portcvsweb(1) for details. + +* If the change of the origin is written in MOVED, + portupgrade reads and chases it. + You no longer need to supply the origin of the new pkg by "-o" option. + + Example: + + When ftp/wget-devel is moved to ftp/wget, previously you had to run, + % portupgrade -o ftp/wget wget + + Now, just run + + % portupgrade wget + + and portupgrade will do what you want to do. + +* Try to guess the pkg to be upgraded, when no pkgname is supplied + as a command line argument. + This can be done only when the current directory is under $PORTSDIR. + + Example: + + Running + + % cd /usr/ports/ftp/wget + % portupgrade + + will upgrade ftp/wget. + +* The frequency of INDEX generation on official site is now sufficient, + recommend to run "portsdb -F" (fetch INDEX from official site) + instead of "portsdb -U" (make INDEX by yourself) in portsdb(1). [1] + + Pointed out by: Enrique Matias [1] + +$FreeBSD: projects/pkgtools/NEWS,v 1.27 2009-10-27 23:31:09 stas Exp $ Copied: user/pgollucci/portupgrade/tags/20091221_1/README (from r212399, user/pgollucci/portupgrade/trunk/README) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/tags/20091221_1/README Thu Sep 9 23:38:29 2010 (r212400, copy of r212399, user/pgollucci/portupgrade/trunk/README) @@ -0,0 +1,169 @@ +$Id: README 52 2006-01-01 06:26:59Z koma2 $ + +You need to install the following ports to use these pkgtools. + + lang/ruby18 - Ruby 1.8 interpreter + or + lang/ruby16 - Ruby 1.6 interpreter + and + lang/ruby16-shim-ruby18 - Ruby 1.8 features and modules for 1.6 + + and if you want to run tests: + + devel/ruby-testunit - Unit testing framework + +============ +portupgrade +============ + +Portupgrade is a tool to upgrade installed packages via ports or +packages. It allows you to upgrade installed packages without having +to reinstall dependent/required packages by directly adjusting the +package database located under /var/db/pkg, while it can also upgrade +packages recursively. + +e.g. + portupgrade gtk + +============ +portinstall +============ + +Portinstall is equivalent to `portupgrade -N', which means it tries to +install the latest version when a specified package is not installed. +Prior to the installation of a new package, all the required packages +are upgraded. + +e.g. + portinstall shells/zsh + +============ +portversion +============ + +Portversion is a tool to compare the versions of install packages with +those in the ports tree. It is a replacement for pkg_version(1) +cooperative with portupgrade, that is, the command output is optimized +for portupgrade. Besides, it runs much faster than pkg_version(1) +because it utilizes the prebuilt ports database. (See portsdb) + +e.g. + portversion + +============ +portsdb +============ + +Portsdb generates the ports database named INDEX.db from the ports +INDEX file. It is commonly used among the tool suite and +automatically updated on demand when it gets older than the ports +INDEX file. + +e.g. + portsdb -Uu + +============ +ports_glob +============ + +Ports_glob expands ports globs. It understands wildcards and is +capable of listing the required, dependent or master ports of a given +port. It would be handy to use from within a shell script. + +e.g. + portsdb -M japanese/linux-netscape47-navigator + +============ +pkg_fetch +============ + +Pkg_fetch is a tool to download binary packages from remote sites. It +can optionally download packages recursively through dependencies. + +e.g. + pkg_fetch -r sawfish + +============ +pkg_glob +============ + +Pkg_glob expands package globs. It understands wildcards and is +capable of listing the required or dependent packages of a package. +It would be handy to use from within a shell script. + +e.g. + pkg_glob -R gnome + +============ +pkg_deinstall +============ + +Pkg_deinstall is a wrapper/replacement of pkg_delete(1), which +understands wildcards and is capable of recursing through +dependencies. It has an option to preserve shared libraries. + +e.g. + pkg_deinstall -r xmms + +============ +pkgdb +============ + +Pkgdb creates and updates the packages database which is commonly used +among the tool suite. It keeps a hash that maps an installed file to +a package name, a hash that maps a package to an origin, and a list of +installed packages. The database file is automatically updated on +demand when any package is installed or deinstalled after the database +was last updated. + +e.g. + pkgdb -u + +Pkgdb also works as an interactive tool for fixing the package +registry database when -F is specified. It helps you resolve stale +dependencies, unlink cyclic dependencies, complete stale or missing +origins, and remove duplicates. You have to run this periodically so +that portupgrade and other tools can work effectively and unfailingly. + +e.g. + pkgdb -Fv + + +============ +pkg_which +============ + +Pkg_which inquires of the packages database which package each given +file came from. If you do not have permission to update the database +although it is outdated, it delegates tasks to pkg_info(1). + +e.g. + pkg_which patgen + +============ +portsclean +============ + +Portsclean is a tool to clean ports working directories, no longer +referenced distfiles, outdated package files, and/or obsolete and +orphan shared libraries. + +e.g. + portsclean -Di + +============ +portcvsweb +============ + +Portcvsweb is a tool to instantly browse a history of a given file via +CVSweb. It may be more useful than you expect. Try it with src, www, +doc, NetBSD pkgsrc, and OpenBSD ports files. :) + +e.g. + portcvsweb sysutils/portupgrade + +-- + / + /__ __ Akinori.org / MUSHA.org + / ) ) ) ) / FreeBSD.org / Ruby-lang.org +Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp Copied: user/pgollucci/portupgrade/tags/20091221_1/bin/Makefile (from r212399, user/pgollucci/portupgrade/trunk/bin/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/tags/20091221_1/bin/Makefile Thu Sep 9 23:38:29 2010 (r212400, copy of r212399, user/pgollucci/portupgrade/trunk/bin/Makefile) @@ -0,0 +1,41 @@ +# $Id: Makefile,v 1.3 2008/07/10 13:17:02 sem Exp $ + +SCRIPTSDIR?= ${PREFIX}/sbin + +BUILDDIR= .build + +SCRIPTS= ${BUILDDIR}/pkg_fetch \ + ${BUILDDIR}/pkg_glob \ + ${BUILDDIR}/pkg_sort \ + ${BUILDDIR}/pkgdb \ + ${BUILDDIR}/pkgdu \ + ${BUILDDIR}/portcvsweb \ + ${BUILDDIR}/portsclean \ + ${BUILDDIR}/portsdb \ + ${BUILDDIR}/portupgrade \ + ${BUILDDIR}/portversion +LINKS= ${SCRIPTSDIR}/pkg_glob ${SCRIPTSDIR}/pkg_deinstall \ + ${SCRIPTSDIR}/pkgdb ${SCRIPTSDIR}/pkg_which \ + ${SCRIPTSDIR}/portupgrade ${SCRIPTSDIR}/portinstall \ + ${SCRIPTSDIR}/portsdb ${SCRIPTSDIR}/ports_glob + +CLEANDIRS= ${BUILDDIR} + +.for script in ${SCRIPTS} +${script}: ${script:T} + ${RUBY} -wc ${.ALLSRC} + @mkdir -p ${BUILDDIR} + ${RUBY} -pe ' \ + if $$. == 1; \ + if /^#!/; \ + $$_.sub(/^#!\s*\S*(\benv\s+)?\bruby/, "#!${RUBY}"); \ + else; \ + $$_ = "#!${RUBY}\n" + $$_; \ + end; \ + end' \ + ${.ALLSRC} > ${.TARGET} +.endfor + +.include + +.include "${.CURDIR}/../Makefile.compat" Copied: user/pgollucci/portupgrade/tags/20091221_1/bin/pkg_fetch (from r212399, user/pgollucci/portupgrade/trunk/bin/pkg_fetch) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pgollucci/portupgrade/tags/20091221_1/bin/pkg_fetch Thu Sep 9 23:38:29 2010 (r212400, copy of r212399, user/pgollucci/portupgrade/trunk/bin/pkg_fetch) @@ -0,0 +1,365 @@ +#!/usr/bin/env ruby +# -*- ruby -*- +# +# Copyright (c) 2000-2004 Akinori MUSHA +# Copyright (c) 2006-2008 Sergey Matveychuk +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +MYREVISION = %w$Rev: 52 $[1] +MYDATE = %w$Date: 2008/01/08 11:32:27 $[1] +MYNAME = File.basename($0) + +require "fileutils" +require "optparse" +require "pkgtools" +require "uri" + +def init_global + $force = false + $noconfig = false + #$sanity_check = true + $tempdir = "" + $upward_recursive = false +end + +COLUMNSIZE = 24 +NEXTLINE = "\n%*s" % [5 + COLUMNSIZE, ''] + +if PkgConfig::OS_MAJOR.to_i >= 5 + PKG_SUFFIXES = ['.tbz', '.tgz'] +else + PKG_SUFFIXES = ['.tgz', '.tbz'] +end + +def main(argv) + usage = <<-"EOF" +usage: #{MYNAME} [-hfqRv] {pkgname|URI} ... + EOF + + banner = <<-"EOF" +#{MYNAME} #{Version} (#{MYDATE}) + +#{usage} + EOF + + dry_parse = true + + OptionParser.new(banner, COLUMNSIZE) do |opts| + opts.def_option("-h", "--help", "Show this message") { + print opts + exit 0 + } + + opts.def_option("-f", "--force", "Download a package even if recorded as installed;#{NEXTLINE}Remove existing packages if they are corrupt") { |v| + $force = v + } + +# opts.def_option("-O", "--omit-check", "Omit sanity checks for dependencies.") { +# $sanity_check = false +# } + + opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") { |v| + $noconfig = v + } + + opts.def_option("-R", "--upward-recursive", "Download the packages required by the given#{NEXTLINE}packages as well") { |v| + $upward_recursive = v + } + + opts.def_option("-v", "--verbose", "Be verbose") { |v| + $verbose = v + } + + opts.def_tail_option ' +pkgname is a full pkgname, a pkgname w/o version followed by an @, +or a full URI. + +Environment Variables [default]: + PACKAGEROOT URI of the root of the site [ftp://ftp.FreeBSD.org] + PACKAGESITE URI of the directory to fetch packages from [none] + (overrides PACKAGEROOT and PKG_SITES) + PACKAGES packages directory to save files [$PORTSDIR/packages] + PKGTOOLS_CONF configuration file [$PREFIX/etc/pkgtools.conf] + PKG_DBDIR packages DB directory [/var/db/pkg] + PKG_FETCH command to fetch files [/usr/bin/fetch -ao %2$s %1$s] + PKG_SITES list of URIs to fetch packages from [none] + PKG_TMPDIR temporary directory for download [$TMPDIR] + PORTSDIR ports directory [/usr/ports] + TMPDIR temporary directory [/var/tmp]' + + begin + init_global + init_pkgtools_global + + rest = opts.order(*argv) + + unless $noconfig + init_global + load_config + else + argv = rest + end + + dry_parse = false + + opts.order!(argv) + + if argv.empty? + print opts + return 0 + end + + results = PkgResultSet.new + + opts.order(*argv) do |arg| + set_uri_base(arg) + + arg = File.basename(arg).sub(/\.t[bg]z$/, '') + + fetch_pkg(arg, $upward_recursive, results) + end + + return results.show('downloaded') + rescue OptionParser::ParseError => e + STDERR.puts "#{MYNAME}: #{e}", usage + exit 64 + end + end +end + +def fetch_pkg(pkgname, recursive, results) + downloaded, pkgdep = do_fetch_pkg(pkgname) + + $subdir = nil + + results << PkgResult.new(pkgname, downloaded ? :done : :ignored) + + if pkgdep.is_a?(Array) && recursive + pkgdep.each do |dep| + results.include?(dep) or fetch_pkg(dep, true, results) + end + end +rescue => e + results << PkgResult.new(pkgname, e) +end + +def do_fetch_pkg(pkgname) + pkgname = pkgname.dup + + latest = pkgname.chomp!('@') || !pkgname.index(/-\d/) + + if !latest && !$force && $pkgdb.installed?(pkgname) + progress_message "Skipping #{pkgname} (already installed)" + return false, nil + end + + PKG_SUFFIXES.each do |suffix| + pkgfilename = pkgname + suffix + path = File.join($packages_dir, pkgfilename) + + File.exist?(path) or next + + progress_message "Identifying the package #{path}" + + id_pkgname, origin, pkgdep = identify_pkg(path) + + return false, pkgdep if not id_pkgname.nil? + + warning_message "Failed to extract information from #{path}" + + raise "corrupt package" unless $force + + warning_message "Removing the corrupt package #{path}" + + File.unlink(path) + end + + FileUtils.mkdir_p [$tmpdir, $packages_dir] + + progress_message "Fetching #{pkgname}" + + temp_path_base = File.join($tmpdir, pkgname) + + temp_path = real_fetch_pkg(pkgname, temp_path_base, latest) + + if not temp_path + warning_message "Failed to fetch #{pkgname}" + raise "fetch error" + end + + pkgfilename = File.basename(temp_path) + + progress_message "Downloaded as #{pkgfilename}" + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:45:15 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0AE3106564A; Thu, 9 Sep 2010 23:45:15 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF84D8FC17; Thu, 9 Sep 2010 23:45:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89NjFsS051996; Thu, 9 Sep 2010 23:45:15 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89NjF6D051993; Thu, 9 Sep 2010 23:45:15 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092345.o89NjF6D051993@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:45:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212401 - in user/pgollucci/portupgrade/trunk: . etc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:45:15 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:45:15 2010 New Revision: 212401 URL: http://svn.freebsd.org/changeset/base/212401 Log: - yeah right, ruby 1.6 Modified: user/pgollucci/portupgrade/trunk/README user/pgollucci/portupgrade/trunk/etc/pkgtools.conf Modified: user/pgollucci/portupgrade/trunk/README ============================================================================== --- user/pgollucci/portupgrade/trunk/README Thu Sep 9 23:38:29 2010 (r212400) +++ user/pgollucci/portupgrade/trunk/README Thu Sep 9 23:45:15 2010 (r212401) @@ -3,13 +3,7 @@ $Id: README 52 2006-01-01 06:26:59Z koma You need to install the following ports to use these pkgtools. lang/ruby18 - Ruby 1.8 interpreter - or - lang/ruby16 - Ruby 1.6 interpreter - and - lang/ruby16-shim-ruby18 - Ruby 1.8 features and modules for 1.6 - and if you want to run tests: - devel/ruby-testunit - Unit testing framework ============ Modified: user/pgollucci/portupgrade/trunk/etc/pkgtools.conf ============================================================================== --- user/pgollucci/portupgrade/trunk/etc/pkgtools.conf Thu Sep 9 23:38:29 2010 (r212400) +++ user/pgollucci/portupgrade/trunk/etc/pkgtools.conf Thu Sep 9 23:45:15 2010 (r212401) @@ -366,7 +366,6 @@ module PkgConfig # MAKE_ARGS = { # 'databases/mysql323-*' => 'WITH_CHARSET=ujis', # 'ruby18-*' => 'RUBY_VER=1.8', - # 'ruby16-*' => 'RUBY_VER=1.6', # } # # To specify multiple arguments for each port, use one of the From owner-svn-src-user@FreeBSD.ORG Thu Sep 9 23:45:59 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C59F1106566B; Thu, 9 Sep 2010 23:45:59 +0000 (UTC) (envelope-from pgollucci@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4E228FC12; Thu, 9 Sep 2010 23:45:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89Njxmk052140; Thu, 9 Sep 2010 23:45:59 GMT (envelope-from pgollucci@svn.freebsd.org) Received: (from pgollucci@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89Njx8E052138; Thu, 9 Sep 2010 23:45:59 GMT (envelope-from pgollucci@svn.freebsd.org) Message-Id: <201009092345.o89Njx8E052138@svn.freebsd.org> From: "Philip M. Gollucci" Date: Thu, 9 Sep 2010 23:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212402 - user/pgollucci/portupgrade/trunk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 23:45:59 -0000 Author: pgollucci (ports committer) Date: Thu Sep 9 23:45:59 2010 New Revision: 212402 URL: http://svn.freebsd.org/changeset/base/212402 Log: eventually lang/ruby19 Modified: user/pgollucci/portupgrade/trunk/README Modified: user/pgollucci/portupgrade/trunk/README ============================================================================== --- user/pgollucci/portupgrade/trunk/README Thu Sep 9 23:45:15 2010 (r212401) +++ user/pgollucci/portupgrade/trunk/README Thu Sep 9 23:45:59 2010 (r212402) @@ -3,6 +3,8 @@ $Id: README 52 2006-01-01 06:26:59Z koma You need to install the following ports to use these pkgtools. lang/ruby18 - Ruby 1.8 interpreter + or + lang/ruby19 - Ruby 1.9 interpreter and if you want to run tests: devel/ruby-testunit - Unit testing framework From owner-svn-src-user@FreeBSD.ORG Fri Sep 10 00:23:45 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89F40106564A; Fri, 10 Sep 2010 00:23:45 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76F788FC15; Fri, 10 Sep 2010 00:23:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8A0Njns056279; Fri, 10 Sep 2010 00:23:45 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A0NiC0056234; Fri, 10 Sep 2010 00:23:44 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009100023.o8A0NiC0056234@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 10 Sep 2010 00:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212404 - in user/weongyo/usb/sys/dev/usb: . input misc net serial storage wlan X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 00:23:45 -0000 Author: weongyo Date: Fri Sep 10 00:23:44 2010 New Revision: 212404 URL: http://svn.freebsd.org/changeset/base/212404 Log: device_set_usb_desc() would be called whenever the USB device is tried to attach if the probe was good. This behaviour was a change between old USB stack and new USB stack. I could not find a reason why it's not called automatically. Modified: user/weongyo/usb/sys/dev/usb/input/atp.c user/weongyo/usb/sys/dev/usb/input/uep.c user/weongyo/usb/sys/dev/usb/input/uhid.c user/weongyo/usb/sys/dev/usb/input/ukbd.c user/weongyo/usb/sys/dev/usb/input/ums.c user/weongyo/usb/sys/dev/usb/misc/udbp.c user/weongyo/usb/sys/dev/usb/misc/ufm.c user/weongyo/usb/sys/dev/usb/net/if_aue.c user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/if_cdce.c user/weongyo/usb/sys/dev/usb/net/if_cue.c user/weongyo/usb/sys/dev/usb/net/if_kue.c user/weongyo/usb/sys/dev/usb/net/if_rue.c user/weongyo/usb/sys/dev/usb/net/if_udav.c user/weongyo/usb/sys/dev/usb/serial/u3g.c user/weongyo/usb/sys/dev/usb/serial/uark.c user/weongyo/usb/sys/dev/usb/serial/ubsa.c user/weongyo/usb/sys/dev/usb/serial/ubser.c user/weongyo/usb/sys/dev/usb/serial/uchcom.c user/weongyo/usb/sys/dev/usb/serial/ucycom.c user/weongyo/usb/sys/dev/usb/serial/ufoma.c user/weongyo/usb/sys/dev/usb/serial/uftdi.c user/weongyo/usb/sys/dev/usb/serial/ugensa.c user/weongyo/usb/sys/dev/usb/serial/uipaq.c user/weongyo/usb/sys/dev/usb/serial/ulpt.c user/weongyo/usb/sys/dev/usb/serial/umct.c user/weongyo/usb/sys/dev/usb/serial/umodem.c user/weongyo/usb/sys/dev/usb/serial/uplcom.c user/weongyo/usb/sys/dev/usb/serial/uslcom.c user/weongyo/usb/sys/dev/usb/serial/uvisor.c user/weongyo/usb/sys/dev/usb/serial/uvscom.c user/weongyo/usb/sys/dev/usb/storage/umass.c user/weongyo/usb/sys/dev/usb/storage/urio.c user/weongyo/usb/sys/dev/usb/storage/ustorage_fs.c user/weongyo/usb/sys/dev/usb/usb_compat_linux.c user/weongyo/usb/sys/dev/usb/usb_device.c user/weongyo/usb/sys/dev/usb/usb_hub.c user/weongyo/usb/sys/dev/usb/wlan/if_rum.c user/weongyo/usb/sys/dev/usb/wlan/if_run.c user/weongyo/usb/sys/dev/usb/wlan/if_uath.c user/weongyo/usb/sys/dev/usb/wlan/if_upgt.c user/weongyo/usb/sys/dev/usb/wlan/if_ural.c user/weongyo/usb/sys/dev/usb/wlan/if_urtw.c user/weongyo/usb/sys/dev/usb/wlan/if_zyd.c Modified: user/weongyo/usb/sys/dev/usb/input/atp.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/atp.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/input/atp.c Fri Sep 10 00:23:44 2010 (r212404) @@ -1695,8 +1695,6 @@ atp_attach(device_t dev) goto detach; } - device_set_usb_desc(dev); - sc->sc_params = &atp_dev_params[uaa->driver_info]; sc->sc_hw.buttons = 3; Modified: user/weongyo/usb/sys/dev/usb/input/uep.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/uep.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/input/uep.c Fri Sep 10 00:23:44 2010 (r212404) @@ -315,8 +315,6 @@ uep_attach(device_t dev) struct uep_softc *sc = device_get_softc(dev); int error; - device_set_usb_desc(dev); - mtx_init(&sc->mtx, "uep lock", NULL, MTX_DEF); error = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, Modified: user/weongyo/usb/sys/dev/usb/input/uhid.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/uhid.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/input/uhid.c Fri Sep 10 00:23:44 2010 (r212404) @@ -648,8 +648,6 @@ uhid_attach(device_t dev) DPRINTFN(10, "sc=%p\n", sc); - device_set_usb_desc(dev); - mtx_init(&sc->sc_mtx, "uhid lock", NULL, MTX_DEF | MTX_RECURSE); sc->sc_udev = uaa->device; Modified: user/weongyo/usb/sys/dev/usb/input/ukbd.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/ukbd.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/input/ukbd.c Fri Sep 10 00:23:44 2010 (r212404) @@ -819,8 +819,6 @@ ukbd_attach(device_t dev) kbd->kb_data = (void *)sc; - device_set_usb_desc(dev); - sc->sc_udev = uaa->device; sc->sc_iface = uaa->iface; sc->sc_iface_index = uaa->info.bIfaceIndex; Modified: user/weongyo/usb/sys/dev/usb/input/ums.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/input/ums.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/input/ums.c Fri Sep 10 00:23:44 2010 (r212404) @@ -524,8 +524,6 @@ ums_attach(device_t dev) DPRINTFN(11, "sc=%p\n", sc); - device_set_usb_desc(dev); - mtx_init(&sc->sc_mtx, "ums lock", NULL, MTX_DEF | MTX_RECURSE); usb_callout_init_mtx(&sc->sc_callout, &sc->sc_mtx, 0); Modified: user/weongyo/usb/sys/dev/usb/misc/udbp.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/misc/udbp.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/misc/udbp.c Fri Sep 10 00:23:44 2010 (r212404) @@ -332,8 +332,6 @@ udbp_attach(device_t dev) struct udbp_softc *sc = device_get_softc(dev); int error; - device_set_usb_desc(dev); - snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); Modified: user/weongyo/usb/sys/dev/usb/misc/ufm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/misc/ufm.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/misc/ufm.c Fri Sep 10 00:23:44 2010 (r212404) @@ -149,8 +149,6 @@ ufm_attach(device_t dev) mtx_init(&sc->sc_mtx, "ufm lock", NULL, MTX_DEF | MTX_RECURSE); - device_set_usb_desc(dev); - error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx, &ufm_fifo_methods, &sc->sc_fifo, device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex, Modified: user/weongyo/usb/sys/dev/usb/net/if_aue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/net/if_aue.c Fri Sep 10 00:23:44 2010 (r212404) @@ -694,8 +694,6 @@ aue_attach(device_t dev) uint8_t iface_index; int error; - device_set_usb_desc(dev); - sc->sc_flags = USB_GET_DRIVER_INFO(uaa); if (uaa->info.bcdDevice >= 0x0201) { /* XXX currently undocumented */ Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Sep 10 00:23:44 2010 (r212404) @@ -779,8 +779,6 @@ axe_attach(device_t dev) uint8_t iface_index; int error; - device_set_usb_desc(dev); - sc->sc_flags = USB_GET_DRIVER_INFO(uaa); sc->sc_dev = dev; sc->sc_udev = uaa->device; Modified: user/weongyo/usb/sys/dev/usb/net/if_cdce.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cdce.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/net/if_cdce.c Fri Sep 10 00:23:44 2010 (r212404) @@ -446,8 +446,6 @@ cdce_attach(device_t dev) sc->sc_udev = uaa->device; sc->sc_flags = USB_GET_DRIVER_INFO(uaa); - device_set_usb_desc(dev); - mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); ud = usbd_find_descriptor Modified: user/weongyo/usb/sys/dev/usb/net/if_cue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/net/if_cue.c Fri Sep 10 00:23:44 2010 (r212404) @@ -402,8 +402,6 @@ cue_attach(device_t dev) uint8_t iface_index; int error; - device_set_usb_desc(dev); - sc->sc_dev = dev; sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); Modified: user/weongyo/usb/sys/dev/usb/net/if_kue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/net/if_kue.c Fri Sep 10 00:23:44 2010 (r212404) @@ -469,7 +469,6 @@ kue_attach(device_t dev) uint8_t iface_index; int error; - device_set_usb_desc(dev); sc->sc_dev = dev; sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); Modified: user/weongyo/usb/sys/dev/usb/net/if_rue.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/net/if_rue.c Fri Sep 10 00:23:44 2010 (r212404) @@ -582,7 +582,6 @@ rue_attach(device_t dev) uint8_t iface_index; int error; - device_set_usb_desc(dev); sc->sc_dev = dev; sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); Modified: user/weongyo/usb/sys/dev/usb/net/if_udav.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/net/if_udav.c Fri Sep 10 00:23:44 2010 (r212404) @@ -250,8 +250,6 @@ udav_attach(device_t dev) sleepout_init_mtx(&sc->sc_sleepout, &sc->sc_watchdog, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_setmulti, 0, udav_setmulti, sc); - device_set_usb_desc(dev); - iface_index = UDAV_IFACE_INDEX; error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, udav_config, UDAV_N_TRANSFER, sc, &sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/u3g.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/u3g.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/u3g.c Fri Sep 10 00:23:44 2010 (r212404) @@ -745,7 +745,6 @@ u3g_attach(device_t dev) for (n = 0; n != U3G_N_TRANSFER; n++) u3g_config_tmp[n] = u3g_config[n]; - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "u3g", NULL, MTX_DEF); sc->sc_udev = uaa->device; Modified: user/weongyo/usb/sys/dev/usb/serial/uark.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uark.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/uark.c Fri Sep 10 00:23:44 2010 (r212404) @@ -200,7 +200,6 @@ uark_attach(device_t dev) int32_t error; uint8_t iface_index; - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uark", NULL, MTX_DEF); sc->sc_udev = uaa->device; Modified: user/weongyo/usb/sys/dev/usb/serial/ubsa.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ubsa.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/ubsa.c Fri Sep 10 00:23:44 2010 (r212404) @@ -305,7 +305,6 @@ ubsa_attach(device_t dev) DPRINTF("sc=%p\n", sc); - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ubsa", NULL, MTX_DEF); sc->sc_udev = uaa->device; Modified: user/weongyo/usb/sys/dev/usb/serial/ubser.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ubser.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/ubser.c Fri Sep 10 00:23:44 2010 (r212404) @@ -242,7 +242,6 @@ ubser_attach(device_t dev) uint8_t n; int error; - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ubser", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", Modified: user/weongyo/usb/sys/dev/usb/serial/uchcom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uchcom.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/uchcom.c Fri Sep 10 00:23:44 2010 (r212404) @@ -318,7 +318,6 @@ uchcom_attach(device_t dev) DPRINTFN(11, "\n"); - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uchcom", NULL, MTX_DEF); sc->sc_udev = uaa->device; Modified: user/weongyo/usb/sys/dev/usb/serial/ucycom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ucycom.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/ucycom.c Fri Sep 10 00:23:44 2010 (r212404) @@ -217,7 +217,6 @@ ucycom_attach(device_t dev) sc->sc_udev = uaa->device; - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ucycom", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), Modified: user/weongyo/usb/sys/dev/usb/serial/ufoma.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ufoma.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/ufoma.c Fri Sep 10 00:23:44 2010 (r212404) @@ -382,8 +382,6 @@ ufoma_attach(device_t dev) mtx_init(&sc->sc_mtx, "ufoma", NULL, MTX_DEF); cv_init(&sc->sc_cv, "CWAIT"); - device_set_usb_desc(dev); - snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); Modified: user/weongyo/usb/sys/dev/usb/serial/uftdi.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uftdi.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/uftdi.c Fri Sep 10 00:23:44 2010 (r212404) @@ -280,7 +280,6 @@ uftdi_attach(device_t dev) sc->sc_dev = dev; sc->sc_unit = device_get_unit(dev); - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uftdi", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), Modified: user/weongyo/usb/sys/dev/usb/serial/ugensa.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ugensa.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/ugensa.c Fri Sep 10 00:23:44 2010 (r212404) @@ -191,7 +191,6 @@ ugensa_attach(device_t dev) uint8_t iface_index; int x, cnt; - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ugensa", NULL, MTX_DEF); /* Figure out how many interfaces this device has got */ Modified: user/weongyo/usb/sys/dev/usb/serial/uipaq.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uipaq.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/uipaq.c Fri Sep 10 00:23:44 2010 (r212404) @@ -1120,7 +1120,6 @@ uipaq_attach(device_t dev) sc->sc_udev = uaa->device; - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uipaq", NULL, MTX_DEF); /* Modified: user/weongyo/usb/sys/dev/usb/serial/ulpt.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ulpt.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/ulpt.c Fri Sep 10 00:23:44 2010 (r212404) @@ -520,8 +520,6 @@ ulpt_attach(device_t dev) sc->sc_dev = dev; sc->sc_udev = uaa->device; - device_set_usb_desc(dev); - mtx_init(&sc->sc_mtx, "ulpt lock", NULL, MTX_DEF | MTX_RECURSE); usb_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); Modified: user/weongyo/usb/sys/dev/usb/serial/umct.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/umct.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/umct.c Fri Sep 10 00:23:44 2010 (r212404) @@ -250,7 +250,6 @@ umct_attach(device_t dev) sc->sc_udev = uaa->device; sc->sc_unit = device_get_unit(dev); - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "umct", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), Modified: user/weongyo/usb/sys/dev/usb/serial/umodem.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/umodem.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/umodem.c Fri Sep 10 00:23:44 2010 (r212404) @@ -292,7 +292,6 @@ umodem_attach(device_t dev) uint8_t i; int error; - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "umodem", NULL, MTX_DEF); sc->sc_ctrl_iface_no = uaa->info.bIfaceNum; Modified: user/weongyo/usb/sys/dev/usb/serial/uplcom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uplcom.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/uplcom.c Fri Sep 10 00:23:44 2010 (r212404) @@ -360,7 +360,6 @@ uplcom_attach(device_t dev) DPRINTFN(11, "\n"); - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uplcom", NULL, MTX_DEF); DPRINTF("sc = %p\n", sc); Modified: user/weongyo/usb/sys/dev/usb/serial/uslcom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uslcom.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/uslcom.c Fri Sep 10 00:23:44 2010 (r212404) @@ -300,7 +300,6 @@ uslcom_attach(device_t dev) DPRINTFN(11, "\n"); - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uslcom", NULL, MTX_DEF); sc->sc_udev = uaa->device; Modified: user/weongyo/usb/sys/dev/usb/serial/uvisor.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uvisor.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/uvisor.c Fri Sep 10 00:23:44 2010 (r212404) @@ -314,7 +314,6 @@ uvisor_attach(device_t dev) DPRINTF("sc=%p\n", sc); bcopy(uvisor_config, uvisor_config_copy, sizeof(uvisor_config_copy)); - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uvisor", NULL, MTX_DEF); Modified: user/weongyo/usb/sys/dev/usb/serial/uvscom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uvscom.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/serial/uvscom.c Fri Sep 10 00:23:44 2010 (r212404) @@ -291,7 +291,6 @@ uvscom_attach(device_t dev) struct uvscom_softc *sc = device_get_softc(dev); int error; - device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "uvscom", NULL, MTX_DEF); sc->sc_udev = uaa->device; Modified: user/weongyo/usb/sys/dev/usb/storage/umass.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/storage/umass.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/storage/umass.c Fri Sep 10 00:23:44 2010 (r212404) @@ -903,8 +903,6 @@ umass_attach(device_t dev) snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); - device_set_usb_desc(dev); - mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF | MTX_RECURSE); Modified: user/weongyo/usb/sys/dev/usb/storage/urio.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/storage/urio.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/storage/urio.c Fri Sep 10 00:23:44 2010 (r212404) @@ -224,8 +224,6 @@ urio_attach(device_t dev) struct urio_softc *sc = device_get_softc(dev); int error; - device_set_usb_desc(dev); - sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, "urio lock", NULL, MTX_DEF | MTX_RECURSE); Modified: user/weongyo/usb/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/storage/ustorage_fs.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/storage/ustorage_fs.c Fri Sep 10 00:23:44 2010 (r212404) @@ -386,8 +386,6 @@ ustorage_fs_attach(device_t dev) sc->sc_lun[0].removable = 1; } - device_set_usb_desc(dev); - mtx_init(&sc->sc_mtx, "USTORAGE_FS lock", NULL, (MTX_DEF | MTX_RECURSE)); Modified: user/weongyo/usb/sys/dev/usb/usb_compat_linux.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_compat_linux.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/usb_compat_linux.c Fri Sep 10 00:23:44 2010 (r212404) @@ -274,7 +274,6 @@ usb_linux_attach(device_t dev) } if (usb_linux_create_usb_device(uaa->device, dev) != 0) return (ENOMEM); - device_set_usb_desc(dev); sc->sc_fbsd_udev = uaa->device; sc->sc_fbsd_dev = dev; Modified: user/weongyo/usb/sys/dev/usb/usb_device.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_device.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/usb_device.c Fri Sep 10 00:23:44 2010 (r212404) @@ -1170,7 +1170,14 @@ usb_probe_and_attach_sub(struct usb_devi */ iface->subdev = uaa->temp_dev; - if (device_probe_and_attach(iface->subdev) == 0) { + err = device_probe(iface->subdev); + if (err == -1) + goto attached; + else if (err != 0) + goto fail; + device_set_usb_desc(iface->subdev); + if (device_attach(iface->subdev) == 0) { +attached: /* * The USB attach arguments are only available during probe * and attach ! @@ -1184,10 +1191,10 @@ usb_probe_and_attach_sub(struct usb_devi device_printf(iface->subdev, "Suspend failed\n"); } return (0); /* success */ - } else { - /* No USB driver found */ - iface->subdev = NULL; } +fail: + /* No USB driver found */ + iface->subdev = NULL; return (1); /* failure */ } Modified: user/weongyo/usb/sys/dev/usb/usb_hub.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_hub.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/usb_hub.c Fri Sep 10 00:23:44 2010 (r212404) @@ -703,8 +703,6 @@ uhub_attach(device_t dev) snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); - device_set_usb_desc(dev); - DPRINTFN(2, "depth=%d selfpowered=%d, parent=%p, " "parent->selfpowered=%d\n", udev->depth, Modified: user/weongyo/usb/sys/dev/usb/wlan/if_rum.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_rum.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/wlan/if_rum.c Fri Sep 10 00:23:44 2010 (r212404) @@ -424,7 +424,6 @@ rum_attach(device_t self) uint32_t tmp; int error, ntries; - device_set_usb_desc(self); sc->sc_udev = uaa->device; sc->sc_dev = self; Modified: user/weongyo/usb/sys/dev/usb/wlan/if_run.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_run.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/wlan/if_run.c Fri Sep 10 00:23:44 2010 (r212404) @@ -546,7 +546,6 @@ run_attach(device_t self) int i, ntries, error; uint8_t iface_index, bands; - device_set_usb_desc(self); sc->sc_udev = uaa->device; sc->sc_dev = self; Modified: user/weongyo/usb/sys/dev/usb/wlan/if_uath.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_uath.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/wlan/if_uath.c Fri Sep 10 00:23:44 2010 (r212404) @@ -353,7 +353,6 @@ uath_attach(device_t dev) #ifdef UATH_DEBUG sc->sc_debug = uath_debug; #endif - device_set_usb_desc(dev); /* * Only post-firmware devices here. Modified: user/weongyo/usb/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_upgt.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/wlan/if_upgt.c Fri Sep 10 00:23:44 2010 (r212404) @@ -253,8 +253,6 @@ upgt_attach(device_t dev) #ifdef UPGT_DEBUG sc->sc_debug = upgt_debug; #endif - device_set_usb_desc(dev); - mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK, MTX_DEF); callout_init(&sc->sc_led_ch, 0); Modified: user/weongyo/usb/sys/dev/usb/wlan/if_ural.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_ural.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/wlan/if_ural.c Fri Sep 10 00:23:44 2010 (r212404) @@ -427,7 +427,6 @@ ural_attach(device_t self) uint8_t iface_index, bands; int error; - device_set_usb_desc(self); sc->sc_udev = uaa->device; sc->sc_dev = self; Modified: user/weongyo/usb/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_urtw.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/wlan/if_urtw.c Fri Sep 10 00:23:44 2010 (r212404) @@ -793,8 +793,6 @@ urtw_attach(device_t dev) uint32_t data; usb_error_t error; - device_set_usb_desc(dev); - sc->sc_dev = dev; sc->sc_udev = uaa->device; if (USB_GET_DRIVER_INFO(uaa) == URTW_REV_RTL8187B) Modified: user/weongyo/usb/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/wlan/if_zyd.c Fri Sep 10 00:00:06 2010 (r212403) +++ user/weongyo/usb/sys/dev/usb/wlan/if_zyd.c Fri Sep 10 00:23:44 2010 (r212404) @@ -343,7 +343,6 @@ zyd_attach(device_t dev) return (EINVAL); } - device_set_usb_desc(dev); sc->sc_dev = dev; sc->sc_udev = uaa->device; sc->sc_macrev = USB_GET_DRIVER_INFO(uaa); From owner-svn-src-user@FreeBSD.ORG Fri Sep 10 18:48:26 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D79D7106564A; Fri, 10 Sep 2010 18:48:26 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC0A38FC16; Fri, 10 Sep 2010 18:48:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8AImQrd077111; Fri, 10 Sep 2010 18:48:26 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AImQT1077107; Fri, 10 Sep 2010 18:48:26 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009101848.o8AImQT1077107@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 10 Sep 2010 18:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212430 - user/weongyo/usb/sys/dev/usb/serial X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 18:48:27 -0000 Author: weongyo Date: Fri Sep 10 18:48:26 2010 New Revision: 212430 URL: http://svn.freebsd.org/changeset/base/212430 Log: Defines UCOM_LOCK and UCOM_UNLOCK macros and uses it. Modified: user/weongyo/usb/sys/dev/usb/serial/usb_serial.c user/weongyo/usb/sys/dev/usb/serial/usb_serial.h Modified: user/weongyo/usb/sys/dev/usb/serial/usb_serial.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/usb_serial.c Fri Sep 10 18:19:38 2010 (r212429) +++ user/weongyo/usb/sys/dev/usb/serial/usb_serial.c Fri Sep 10 18:48:26 2010 (r212430) @@ -418,10 +418,10 @@ ucom_detach_tty(struct ucom_softc *sc) /* the config thread has been stopped when we get here */ - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); sc->sc_flag |= UCOM_FLAG_GONE; sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_LL_READY); - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); if (tp) { tty_lock(tp); @@ -429,7 +429,7 @@ ucom_detach_tty(struct ucom_softc *sc) tty_rel_gone(tp); - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); /* Wait for the callback after the TTY is torn down */ while (sc->sc_ttyfreed == 0) cv_wait(&sc->sc_cv, sc->sc_mtx); @@ -442,7 +442,7 @@ ucom_detach_tty(struct ucom_softc *sc) if (sc->sc_callback->ucom_stop_write) { (sc->sc_callback->ucom_stop_write) (sc); } - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); } cv_destroy(&sc->sc_cv); } @@ -1283,10 +1283,10 @@ ucom_free(void *xsc) { struct ucom_softc *sc = xsc; - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); sc->sc_ttyfreed = 1; cv_signal(&sc->sc_cv); - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); } static cn_probe_t ucom_cnprobe; @@ -1327,7 +1327,7 @@ ucom_cngetc(struct consdev *cd) if (sc == NULL) return (-1); - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); if (ucom_cons_rx_low != ucom_cons_rx_high) { c = ucom_cons_rx_buf[ucom_cons_rx_low]; @@ -1340,7 +1340,7 @@ ucom_cngetc(struct consdev *cd) /* start USB transfers */ ucom_outwakeup(sc->sc_tty); - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); /* poll if necessary */ if (kdb_active && sc->sc_callback->ucom_poll) @@ -1360,7 +1360,7 @@ ucom_cnputc(struct consdev *cd, int c) repeat: - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); /* compute maximum TX length */ @@ -1376,7 +1376,7 @@ ucom_cnputc(struct consdev *cd, int c) /* start USB transfers */ ucom_outwakeup(sc->sc_tty); - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); /* poll if necessary */ if (kdb_active && sc->sc_callback->ucom_poll) { Modified: user/weongyo/usb/sys/dev/usb/serial/usb_serial.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/usb_serial.h Fri Sep 10 18:19:38 2010 (r212429) +++ user/weongyo/usb/sys/dev/usb/serial/usb_serial.h Fri Sep 10 18:48:26 2010 (r212430) @@ -185,6 +185,9 @@ struct ucom_softc { #define UCOM_LS_RING 0x08 }; +#define UCOM_LOCK(sc) mtx_lock(sc->sc_mtx) +#define UCOM_UNLOCK(sc) mtx_unlock(sc->sc_mtx) + #define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \ usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) From owner-svn-src-user@FreeBSD.ORG Fri Sep 10 19:34:00 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73B1F106564A; Fri, 10 Sep 2010 19:34:00 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6213E8FC0C; Fri, 10 Sep 2010 19:34:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8AJY0ah080793; Fri, 10 Sep 2010 19:34:00 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AJY0SX080790; Fri, 10 Sep 2010 19:34:00 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009101934.o8AJY0SX080790@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 10 Sep 2010 19:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212433 - user/weongyo/usb/sys/dev/usb/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 19:34:00 -0000 Author: weongyo Date: Fri Sep 10 19:34:00 2010 New Revision: 212433 URL: http://svn.freebsd.org/changeset/base/212433 Log: Removes unused header "usb_process.h". Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c user/weongyo/usb/sys/dev/usb/net/uhso.c Modified: user/weongyo/usb/sys/dev/usb/net/if_axe.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Sep 10 19:23:59 2010 (r212432) +++ user/weongyo/usb/sys/dev/usb/net/if_axe.c Fri Sep 10 19:34:00 2010 (r212433) @@ -118,7 +118,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR axe_debug #include -#include #include #include Modified: user/weongyo/usb/sys/dev/usb/net/uhso.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/uhso.c Fri Sep 10 19:23:59 2010 (r212432) +++ user/weongyo/usb/sys/dev/usb/net/uhso.c Fri Sep 10 19:34:00 2010 (r212433) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include "usbdevs.h" #define USB_DEBUG_VAR uhso_debug #include -#include #include #include From owner-svn-src-user@FreeBSD.ORG Fri Sep 10 23:38:18 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 977CC106564A; Fri, 10 Sep 2010 23:38:18 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 856C08FC0C; Fri, 10 Sep 2010 23:38:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ANcIq6000953; Fri, 10 Sep 2010 23:38:18 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANcIRq000930; Fri, 10 Sep 2010 23:38:18 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009102338.o8ANcIRq000930@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 10 Sep 2010 23:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212442 - in user/weongyo/usb/sys/dev/usb: net serial X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:38:18 -0000 Author: weongyo Date: Fri Sep 10 23:38:18 2010 New Revision: 212442 URL: http://svn.freebsd.org/changeset/base/212442 Log: Made the following experimental changes on ucom module: o Removes struct ucom_super_softc that contains only `struct usb_process' variable. I could not find a reason why it's separated from `struct ucom_softc' and what it's for. o No more `struct usb_process' that menas ucom module doesn't create its own process context to serialize the USB commands. If it really need to be serialized I'd use sx(9) lock instead of the process context. Currently it'd call the callback functions directly on caller context. Modified: user/weongyo/usb/sys/dev/usb/net/uhso.c user/weongyo/usb/sys/dev/usb/serial/u3g.c user/weongyo/usb/sys/dev/usb/serial/uark.c user/weongyo/usb/sys/dev/usb/serial/ubsa.c user/weongyo/usb/sys/dev/usb/serial/ubser.c user/weongyo/usb/sys/dev/usb/serial/uchcom.c user/weongyo/usb/sys/dev/usb/serial/ucycom.c user/weongyo/usb/sys/dev/usb/serial/ufoma.c user/weongyo/usb/sys/dev/usb/serial/uftdi.c user/weongyo/usb/sys/dev/usb/serial/ugensa.c user/weongyo/usb/sys/dev/usb/serial/uipaq.c user/weongyo/usb/sys/dev/usb/serial/ulpt.c user/weongyo/usb/sys/dev/usb/serial/umct.c user/weongyo/usb/sys/dev/usb/serial/umodem.c user/weongyo/usb/sys/dev/usb/serial/umoscom.c user/weongyo/usb/sys/dev/usb/serial/uplcom.c user/weongyo/usb/sys/dev/usb/serial/usb_serial.c user/weongyo/usb/sys/dev/usb/serial/usb_serial.h user/weongyo/usb/sys/dev/usb/serial/uslcom.c user/weongyo/usb/sys/dev/usb/serial/uvisor.c user/weongyo/usb/sys/dev/usb/serial/uvscom.c Modified: user/weongyo/usb/sys/dev/usb/net/uhso.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/net/uhso.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/net/uhso.c Fri Sep 10 23:38:18 2010 (r212442) @@ -98,7 +98,6 @@ struct uhso_softc { struct callout sc_c; /* TTY related structures */ - struct ucom_super_softc sc_super_ucom; int sc_ttys; struct uhso_tty *sc_tty; struct ucom_softc *sc_ucom; @@ -665,7 +664,7 @@ uhso_detach(device_t self) usbd_transfer_unsetup(sc->sc_xfer, 3); usbd_transfer_unsetup(sc->sc_ctrl_xfer, UHSO_CTRL_MAX); if (sc->sc_ttys > 0) { - ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_ttys); + ucom_detach(sc->sc_ucom, sc->sc_ttys); for (i = 0; i < sc->sc_ttys; i++) { if (sc->sc_tty[i].ht_muxport != -1) { @@ -896,8 +895,8 @@ uhso_probe_iface(struct uhso_softc *sc, UHSO_DPRINTF(1, "Trying to attach mux. serial\n"); error = uhso_attach_muxserial(sc, iface, type); if (error == 0 && sc->sc_ttys > 0) { - error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, - sc->sc_ttys, sc, &uhso_ucom_callback, &sc->sc_mtx); + error = ucom_attach(sc->sc_ucom, sc->sc_ttys, sc, + &uhso_ucom_callback, &sc->sc_mtx); if (error) { device_printf(sc->sc_dev, "ucom_attach failed\n"); return (ENXIO); @@ -914,8 +913,8 @@ uhso_probe_iface(struct uhso_softc *sc, if (error) return (ENXIO); - error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, - sc->sc_ttys, sc, &uhso_ucom_callback, &sc->sc_mtx); + error = ucom_attach(sc->sc_ucom, sc->sc_ttys, sc, + &uhso_ucom_callback, &sc->sc_mtx); if (error) { device_printf(sc->sc_dev, "ucom_attach failed\n"); return (ENXIO); Modified: user/weongyo/usb/sys/dev/usb/serial/u3g.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/u3g.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/u3g.c Fri Sep 10 23:38:18 2010 (r212442) @@ -58,7 +58,6 @@ #define USB_DEBUG_VAR u3g_debug #include -#include #include #include @@ -101,7 +100,6 @@ enum { }; struct u3g_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom[U3G_MAXPORTS]; struct usb_xfer *sc_xfer[U3G_MAXPORTS][U3G_N_TRANSFER]; @@ -803,8 +801,8 @@ u3g_attach(device_t dev) } sc->sc_numports = nports; - error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, - sc->sc_numports, sc, &u3g_callback, &sc->sc_mtx); + error = ucom_attach(sc->sc_ucom, sc->sc_numports, sc, &u3g_callback, + &sc->sc_mtx); if (error) { DPRINTF("ucom_attach failed\n"); goto detach; @@ -827,7 +825,7 @@ u3g_detach(device_t dev) DPRINTF("sc=%p\n", sc); /* NOTE: It is not dangerous to detach more ports than attached! */ - ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, U3G_MAXPORTS); + ucom_detach(sc->sc_ucom, U3G_MAXPORTS); for (m = 0; m != U3G_MAXPORTS; m++) usbd_transfer_unsetup(sc->sc_xfer[m], U3G_N_TRANSFER); Modified: user/weongyo/usb/sys/dev/usb/serial/uark.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uark.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/uark.c Fri Sep 10 23:38:18 2010 (r212442) @@ -52,7 +52,6 @@ #define USB_DEBUG_VAR usb_debug #include -#include #include @@ -84,7 +83,6 @@ enum { }; struct uark_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[UARK_N_TRANSFER]; @@ -220,8 +218,7 @@ uark_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uark_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &uark_callback, &sc->sc_mtx); if (error) { DPRINTF("ucom_attach failed\n"); goto detach; @@ -238,7 +235,7 @@ uark_detach(device_t dev) { struct uark_softc *sc = device_get_softc(dev); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UARK_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/ubsa.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ubsa.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/ubsa.c Fri Sep 10 23:38:18 2010 (r212442) @@ -89,7 +89,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR ubsa_debug #include -#include #include @@ -161,7 +160,6 @@ enum { }; struct ubsa_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[UBSA_N_TRANSFER]; @@ -324,8 +322,7 @@ ubsa_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ubsa_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &ubsa_callback, &sc->sc_mtx); if (error) { DPRINTF("ucom_attach failed\n"); goto detach; @@ -344,7 +341,7 @@ ubsa_detach(device_t dev) DPRINTF("sc=%p\n", sc); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UBSA_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/ubser.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ubser.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/ubser.c Fri Sep 10 23:38:18 2010 (r212442) @@ -103,7 +103,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR ubser_debug #include -#include #include @@ -129,7 +128,6 @@ enum { }; struct ubser_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom[UBSER_UNIT_MAX]; struct usb_xfer *sc_xfer[UBSER_N_TRANSFER]; @@ -290,8 +288,8 @@ ubser_attach(device_t dev) sc->sc_ucom[n].sc_portno = n; } - error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, - sc->sc_numser, sc, &ubser_callback, &sc->sc_mtx); + error = ucom_attach(sc->sc_ucom, sc->sc_numser, sc, &ubser_callback, + &sc->sc_mtx); if (error) { goto detach; } @@ -316,7 +314,7 @@ ubser_detach(device_t dev) DPRINTF("\n"); - ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_numser); + ucom_detach(sc->sc_ucom, sc->sc_numser); usbd_transfer_unsetup(sc->sc_xfer, UBSER_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/uchcom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uchcom.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/uchcom.c Fri Sep 10 23:38:18 2010 (r212442) @@ -97,7 +97,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR uchcom_debug #include -#include #include @@ -166,7 +165,6 @@ enum { }; struct uchcom_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[UCHCOM_N_TRANSFER]; @@ -348,8 +346,7 @@ uchcom_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uchcom_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &uchcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -367,7 +364,7 @@ uchcom_detach(device_t dev) DPRINTFN(11, "\n"); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UCHCOM_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/ucycom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ucycom.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/ucycom.c Fri Sep 10 23:38:18 2010 (r212442) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR usb_debug #include -#include #include @@ -77,7 +76,6 @@ enum { }; struct ucycom_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_device *sc_udev; @@ -269,8 +267,7 @@ ucycom_attach(device_t dev) "transfers failed\n"); goto detach; } - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ucycom_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &ucycom_callback, &sc->sc_mtx); if (error) { goto detach; @@ -293,7 +290,7 @@ ucycom_detach(device_t dev) { struct ucycom_softc *sc = device_get_softc(dev); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UCYCOM_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/ufoma.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ufoma.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/ufoma.c Fri Sep 10 23:38:18 2010 (r212442) @@ -111,7 +111,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR usb_debug #include -#include #include @@ -169,7 +168,6 @@ enum { }; struct ufoma_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct cv sc_cv; struct mtx sc_mtx; @@ -442,8 +440,7 @@ ufoma_attach(device_t dev) usbd_xfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ufoma_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &ufoma_callback, &sc->sc_mtx); if (error) { DPRINTF("ucom_attach failed\n"); goto detach; @@ -479,7 +476,7 @@ ufoma_detach(device_t dev) { struct ufoma_softc *sc = device_get_softc(dev); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_ctrl_xfer, UFOMA_CTRL_ENDPT_MAX); usbd_transfer_unsetup(sc->sc_bulk_xfer, UFOMA_BULK_ENDPT_MAX); Modified: user/weongyo/usb/sys/dev/usb/serial/uftdi.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uftdi.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/uftdi.c Fri Sep 10 23:38:18 2010 (r212442) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR uftdi_debug #include -#include #include #include @@ -94,7 +93,6 @@ enum { }; struct uftdi_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_device *sc_udev; @@ -324,8 +322,7 @@ uftdi_attach(device_t dev) FTDI_SIO_SET_DATA_PARITY_NONE | FTDI_SIO_SET_DATA_BITS(8)); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uftdi_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &uftdi_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -341,7 +338,7 @@ uftdi_detach(device_t dev) { struct uftdi_softc *sc = device_get_softc(dev); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UFTDI_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/ugensa.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ugensa.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/ugensa.c Fri Sep 10 23:38:18 2010 (r212442) @@ -61,7 +61,6 @@ #define USB_DEBUG_VAR usb_debug #include -#include #include @@ -82,7 +81,6 @@ struct ugensa_sub_softc { }; struct ugensa_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom[UGENSA_IFACE_MAX]; struct ugensa_sub_softc sc_sub[UGENSA_IFACE_MAX]; @@ -240,7 +238,7 @@ ugensa_attach(device_t dev) } device_printf(dev, "Found %d interfaces.\n", sc->sc_niface); - error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface, sc, + error = ucom_attach(sc->sc_ucom, sc->sc_niface, sc, &ugensa_callback, &sc->sc_mtx); if (error) { DPRINTF("attach failed\n"); @@ -259,7 +257,7 @@ ugensa_detach(device_t dev) struct ugensa_softc *sc = device_get_softc(dev); uint8_t x; - ucom_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface); + ucom_detach(sc->sc_ucom, sc->sc_niface); for (x = 0; x < sc->sc_niface; x++) { usbd_transfer_unsetup(sc->sc_sub[x].sc_xfer, UGENSA_N_TRANSFER); Modified: user/weongyo/usb/sys/dev/usb/serial/uipaq.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uipaq.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/uipaq.c Fri Sep 10 23:38:18 2010 (r212442) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR usb_debug #include -#include #include @@ -88,7 +87,6 @@ enum { }; struct uipaq_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[UIPAQ_N_TRANSFER]; @@ -1155,8 +1153,7 @@ uipaq_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uipaq_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &uipaq_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -1172,7 +1169,7 @@ uipaq_detach(device_t dev) { struct uipaq_softc *sc = device_get_softc(dev); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/ulpt.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/ulpt.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/ulpt.c Fri Sep 10 23:38:18 2010 (r212442) @@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR ulpt_debug #include -#include #ifdef USB_DEBUG static int ulpt_debug = 0; Modified: user/weongyo/usb/sys/dev/usb/serial/umct.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/umct.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/umct.c Fri Sep 10 23:38:18 2010 (r212442) @@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR usb_debug #include -#include #include @@ -99,7 +98,6 @@ enum { }; struct umct_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_device *sc_udev; @@ -291,8 +289,7 @@ umct_attach(device_t dev) sc->sc_obufsize = 16; } } - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umct_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &umct_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -308,7 +305,7 @@ umct_detach(device_t dev) { struct umct_softc *sc = device_get_softc(dev); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UMCT_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/umodem.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/umodem.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/umodem.c Fri Sep 10 23:38:18 2010 (r212442) @@ -111,7 +111,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR umodem_debug #include -#include #include #include @@ -153,7 +152,6 @@ enum { #define UMODEM_MODVER 1 /* module version */ struct umodem_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[UMODEM_N_TRANSFER]; @@ -383,8 +381,7 @@ umodem_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UMODEM_BULK_RD]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umodem_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &umodem_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -815,7 +812,7 @@ umodem_detach(device_t dev) DPRINTF("sc=%p\n", sc); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UMODEM_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/umoscom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/umoscom.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/umoscom.c Fri Sep 10 23:38:18 2010 (r212442) @@ -44,7 +44,6 @@ #define USB_DEBUG_VAR umoscom_debug #include -#include #include @@ -174,7 +173,6 @@ enum { }; struct umoscom_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[UMOSCOM_N_TRANSFER]; @@ -333,8 +331,8 @@ umoscom_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umoscom_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &umoscom_callback, + &sc->sc_mtx); if (error) { goto detach; } @@ -351,7 +349,7 @@ umoscom_detach(device_t dev) { struct umoscom_softc *sc = device_get_softc(dev); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UMOSCOM_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/uplcom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uplcom.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/uplcom.c Fri Sep 10 23:38:18 2010 (r212442) @@ -112,7 +112,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR uplcom_debug #include -#include #include @@ -154,7 +153,6 @@ enum { }; struct uplcom_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[UPLCOM_N_TRANSFER]; @@ -431,8 +429,7 @@ uplcom_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uplcom_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &uplcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -458,7 +455,7 @@ uplcom_detach(device_t dev) DPRINTF("sc=%p\n", sc); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, UPLCOM_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/usb_serial.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/usb_serial.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/usb_serial.c Fri Sep 10 23:38:18 2010 (r212442) @@ -96,7 +96,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR ucom_debug #include #include -#include #include @@ -134,20 +133,10 @@ TUNABLE_INT("hw.usb.ucom.cons_baud", &uc SYSCTL_INT(_hw_usb_ucom, OID_AUTO, cons_baud, CTLFLAG_RW, &ucom_cons_baud, 0, "console baud rate"); -static usb_proc_callback_t ucom_cfg_start_transfers; -static usb_proc_callback_t ucom_cfg_open; -static usb_proc_callback_t ucom_cfg_close; -static usb_proc_callback_t ucom_cfg_line_state; -static usb_proc_callback_t ucom_cfg_status_change; -static usb_proc_callback_t ucom_cfg_param; - static uint8_t ucom_units_alloc(uint32_t, uint32_t *); static void ucom_units_free(uint32_t, uint32_t); static int ucom_attach_tty(struct ucom_softc *, uint32_t); static void ucom_detach_tty(struct ucom_softc *); -static void ucom_queue_command(struct ucom_softc *, - usb_proc_callback_t *, struct termios *pt, - struct usb_proc_msg *t0, struct usb_proc_msg *t1); static void ucom_shutdown(struct ucom_softc *); static void ucom_ring(struct ucom_softc *, uint8_t); static void ucom_break(struct ucom_softc *, uint8_t); @@ -260,8 +249,7 @@ ucom_units_free(uint32_t root_unit, uint * before calling into the ucom-layer! */ int -ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, - uint32_t sub_units, void *parent, +ucom_attach(struct ucom_softc *sc, uint32_t sub_units, void *parent, const struct ucom_callback *callback, struct mtx *mtx) { uint32_t n; @@ -280,23 +268,16 @@ ucom_attach(struct ucom_super_softc *ssc return (ENOMEM); } - error = usb_proc_create(&ssc->sc_tq, mtx, "ucom", USB_PRI_MED); - if (error) { - ucom_units_free(root_unit, sub_units); - return (error); - } - for (n = 0; n != sub_units; n++, sc++) { sc->sc_unit = root_unit + n; sc->sc_local_unit = n; - sc->sc_super = ssc; sc->sc_mtx = mtx; sc->sc_parent = parent; sc->sc_callback = callback; error = ucom_attach_tty(sc, sub_units); if (error) { - ucom_detach(ssc, sc - n, n); + ucom_detach(sc - n, n); ucom_units_free(root_unit + n, sub_units - n); return (error); } @@ -310,13 +291,10 @@ ucom_attach(struct ucom_super_softc *ssc * the structure pointed to by "ssc" and "sc" is zero. */ void -ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc, - uint32_t sub_units) +ucom_detach(struct ucom_softc *sc, uint32_t sub_units) { uint32_t n; - usb_proc_drain(&ssc->sc_tq); - for (n = 0; n != sub_units; n++, sc++) { if (sc->sc_flag & UCOM_FLAG_ATTACHED) { @@ -328,7 +306,6 @@ ucom_detach(struct ucom_super_softc *ssc sc->sc_flag &= ~UCOM_FLAG_ATTACHED; } } - usb_proc_free(&ssc->sc_tq); } static int @@ -448,53 +425,6 @@ ucom_detach_tty(struct ucom_softc *sc) } static void -ucom_queue_command(struct ucom_softc *sc, - usb_proc_callback_t *fn, struct termios *pt, - struct usb_proc_msg *t0, struct usb_proc_msg *t1) -{ - struct ucom_super_softc *ssc = sc->sc_super; - struct ucom_param_task *task; - - mtx_assert(sc->sc_mtx, MA_OWNED); - - if (usb_proc_is_gone(&ssc->sc_tq)) { - DPRINTF("proc is gone\n"); - return; /* nothing to do */ - } - /* - * NOTE: The task cannot get executed before we drop the - * "sc_mtx" mutex. It is safe to update fields in the message - * structure after that the message got queued. - */ - task = (struct ucom_param_task *) - usb_proc_msignal(&ssc->sc_tq, t0, t1); - - /* Setup callback and softc pointers */ - task->hdr.pm_callback = fn; - task->sc = sc; - - /* - * Make a copy of the termios. This field is only present if - * the "pt" field is not NULL. - */ - if (pt != NULL) - task->termios_copy = *pt; - - /* - * Closing the device should be synchronous. - */ - if (fn == ucom_cfg_close) - usb_proc_mwait(&ssc->sc_tq, t0, t1); - - /* - * In case of multiple configure requests, - * keep track of the last one! - */ - if (fn == ucom_cfg_start_transfers) - sc->sc_last_start_xfer = &task->hdr; -} - -static void ucom_shutdown(struct ucom_softc *sc) { struct tty *tp = sc->sc_tty; @@ -511,25 +441,9 @@ ucom_shutdown(struct ucom_softc *sc) } } -/* - * Return values: - * 0: normal - * else: taskqueue is draining or gone - */ -uint8_t -ucom_cfg_is_gone(struct ucom_softc *sc) -{ - struct ucom_super_softc *ssc = sc->sc_super; - - return (usb_proc_is_gone(&ssc->sc_tq)); -} - static void -ucom_cfg_start_transfers(struct usb_proc_msg *_task) +ucom_cfg_start_transfers(struct ucom_softc *sc) { - struct ucom_cfg_task *task = - (struct ucom_cfg_task *)_task; - struct ucom_softc *sc = task->sc; if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) { return; @@ -539,9 +453,7 @@ ucom_cfg_start_transfers(struct usb_proc return; } - if (_task == sc->sc_last_start_xfer) - sc->sc_flag |= UCOM_FLAG_GP_DATA; - + sc->sc_flag |= UCOM_FLAG_GP_DATA; if (sc->sc_callback->ucom_start_read) { (sc->sc_callback->ucom_start_read) (sc); } @@ -569,11 +481,8 @@ ucom_start_transfers(struct ucom_softc * } static void -ucom_cfg_open(struct usb_proc_msg *_task) +ucom_cfg_open(struct ucom_softc *sc) { - struct ucom_cfg_task *task = - (struct ucom_cfg_task *)_task; - struct ucom_softc *sc = task->sc; DPRINTF("\n"); @@ -635,14 +544,8 @@ ucom_open(struct tty *tp) sc->sc_pls_set = 0; sc->sc_pls_clr = 0; - ucom_queue_command(sc, ucom_cfg_open, NULL, - &sc->sc_open_task[0].hdr, - &sc->sc_open_task[1].hdr); - - /* Queue transfer enable command last */ - ucom_queue_command(sc, ucom_cfg_start_transfers, NULL, - &sc->sc_start_task[0].hdr, - &sc->sc_start_task[1].hdr); + ucom_cfg_open(sc); + ucom_cfg_start_transfers(sc); ucom_modem(tp, SER_DTR | SER_RTS, 0); @@ -656,11 +559,8 @@ ucom_open(struct tty *tp) } static void -ucom_cfg_close(struct usb_proc_msg *_task) +ucom_cfg_close(struct ucom_softc *sc) { - struct ucom_cfg_task *task = - (struct ucom_cfg_task *)_task; - struct ucom_softc *sc = task->sc; DPRINTF("\n"); @@ -687,10 +587,7 @@ ucom_close(struct tty *tp) return; } ucom_shutdown(sc); - - ucom_queue_command(sc, ucom_cfg_close, NULL, - &sc->sc_close_task[0].hdr, - &sc->sc_close_task[1].hdr); + ucom_cfg_close(sc); sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_RTS_IFLOW); @@ -798,11 +695,8 @@ ucom_modem(struct tty *tp, int sigon, in } static void -ucom_cfg_line_state(struct usb_proc_msg *_task) +ucom_cfg_line_state(struct ucom_softc *sc) { - struct ucom_cfg_task *task = - (struct ucom_cfg_task *)_task; - struct ucom_softc *sc = task->sc; uint8_t notch_bits; uint8_t any_bits; uint8_t prev_value; @@ -882,10 +776,7 @@ ucom_line_state(struct ucom_softc *sc, sc->sc_pls_set |= set_bits; sc->sc_pls_clr |= clear_bits; - /* defer driver programming */ - ucom_queue_command(sc, ucom_cfg_line_state, NULL, - &sc->sc_line_state_task[0].hdr, - &sc->sc_line_state_task[1].hdr); + ucom_cfg_line_state(sc); } static void @@ -933,11 +824,8 @@ ucom_rts(struct ucom_softc *sc, uint8_t } static void -ucom_cfg_status_change(struct usb_proc_msg *_task) +ucom_cfg_status_change(struct ucom_softc *sc) { - struct ucom_cfg_task *task = - (struct ucom_cfg_task *)_task; - struct ucom_softc *sc = task->sc; struct tty *tp; uint8_t new_msr; uint8_t new_lsr; @@ -992,17 +880,12 @@ ucom_status_change(struct ucom_softc *sc } DPRINTF("\n"); - ucom_queue_command(sc, ucom_cfg_status_change, NULL, - &sc->sc_status_task[0].hdr, - &sc->sc_status_task[1].hdr); + ucom_cfg_status_change(sc); } static void -ucom_cfg_param(struct usb_proc_msg *_task) +ucom_cfg_param(struct ucom_softc *sc, struct termios *t) { - struct ucom_param_task *task = - (struct ucom_param_task *)_task; - struct ucom_softc *sc = task->sc; if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) { return; @@ -1011,7 +894,7 @@ ucom_cfg_param(struct usb_proc_msg *_tas return; } - (sc->sc_callback->ucom_cfg_param) (sc, &task->termios_copy); + (sc->sc_callback->ucom_cfg_param) (sc, t); /* wait a little */ usb_pause_mtx(sc->sc_mtx, hz / 10); @@ -1066,15 +949,8 @@ ucom_param(struct tty *tp, struct termio /* Disable transfers */ sc->sc_flag &= ~UCOM_FLAG_GP_DATA; - /* Queue baud rate programming command first */ - ucom_queue_command(sc, ucom_cfg_param, t, - &sc->sc_param_task[0].hdr, - &sc->sc_param_task[1].hdr); - - /* Queue transfer enable command last */ - ucom_queue_command(sc, ucom_cfg_start_transfers, NULL, - &sc->sc_start_task[0].hdr, - &sc->sc_start_task[1].hdr); + ucom_cfg_param(sc, t); + ucom_cfg_start_transfers(sc); if (t->c_cflag & CRTS_IFLOW) { sc->sc_flag |= UCOM_FLAG_RTS_IFLOW; Modified: user/weongyo/usb/sys/dev/usb/serial/usb_serial.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/usb_serial.h Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/usb_serial.h Fri Sep 10 23:38:18 2010 (r212442) @@ -119,44 +119,11 @@ struct ucom_callback { #define ULSR_RXRDY 0x01 /* Byte ready in Receive Buffer */ #define ULSR_RCV_MASK 0x1f /* Mask for incoming data or error */ -struct ucom_cfg_task { - struct usb_proc_msg hdr; - struct ucom_softc *sc; -}; - -struct ucom_param_task { - struct usb_proc_msg hdr; - struct ucom_softc *sc; - struct termios termios_copy; -}; - -struct ucom_super_softc { - struct usb_process sc_tq; -}; - struct ucom_softc { - /* - * NOTE: To avoid loosing level change information we use two - * tasks instead of one for all commands. - * - * Level changes are transitions like: - * - * ON->OFF - * OFF->ON - * OPEN->CLOSE - * CLOSE->OPEN - */ - struct ucom_cfg_task sc_start_task[2]; - struct ucom_cfg_task sc_open_task[2]; - struct ucom_cfg_task sc_close_task[2]; - struct ucom_cfg_task sc_line_state_task[2]; - struct ucom_cfg_task sc_status_task[2]; - struct ucom_param_task sc_param_task[2]; struct cv sc_cv; /* Used to set "UCOM_FLAG_GP_DATA" flag: */ struct usb_proc_msg *sc_last_start_xfer; const struct ucom_callback *sc_callback; - struct ucom_super_softc *sc_super; struct tty *sc_tty; struct mtx *sc_mtx; void *sc_parent; @@ -188,14 +155,13 @@ struct ucom_softc { #define UCOM_LOCK(sc) mtx_lock(sc->sc_mtx) #define UCOM_UNLOCK(sc) mtx_unlock(sc->sc_mtx) -#define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \ - usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) +#define ucom_cfg_do_request(udev, com, req, ptr, flags, timo) \ + usbd_do_request_flags(udev, (com)->sc_mtx, req, ptr, \ + flags, NULL, timo) -int ucom_attach(struct ucom_super_softc *, - struct ucom_softc *, uint32_t, void *, +int ucom_attach(struct ucom_softc *, uint32_t, void *, const struct ucom_callback *callback, struct mtx *); -void ucom_detach(struct ucom_super_softc *, - struct ucom_softc *, uint32_t); +void ucom_detach(struct ucom_softc *, uint32_t); void ucom_status_change(struct ucom_softc *); uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache *, uint32_t, uint32_t, uint32_t *); Modified: user/weongyo/usb/sys/dev/usb/serial/uslcom.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uslcom.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/uslcom.c Fri Sep 10 23:38:18 2010 (r212442) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR uslcom_debug #include -#include #include @@ -105,7 +104,6 @@ enum { }; struct uslcom_softc { - struct ucom_super_softc sc_super_ucom; struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[USLCOM_N_TRANSFER]; @@ -318,8 +316,7 @@ uslcom_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uslcom_callback, &sc->sc_mtx); + error = ucom_attach(&sc->sc_ucom, 1, sc, &uslcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -337,7 +334,7 @@ uslcom_detach(device_t dev) DPRINTF("sc=%p\n", sc); - ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + ucom_detach(&sc->sc_ucom, 1); usbd_transfer_unsetup(sc->sc_xfer, USLCOM_N_TRANSFER); mtx_destroy(&sc->sc_mtx); Modified: user/weongyo/usb/sys/dev/usb/serial/uvisor.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/uvisor.c Fri Sep 10 23:24:55 2010 (r212441) +++ user/weongyo/usb/sys/dev/usb/serial/uvisor.c Fri Sep 10 23:38:18 2010 (r212442) @@ -74,7 +74,6 @@ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Sep 10 23:55:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 405EA106564A; Fri, 10 Sep 2010 23:55:28 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E0E68FC0A; Fri, 10 Sep 2010 23:55:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ANtSl6002339; Fri, 10 Sep 2010 23:55:28 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANtSnL002337; Fri, 10 Sep 2010 23:55:28 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009102355.o8ANtSnL002337@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 10 Sep 2010 23:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212444 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:55:28 -0000 Author: weongyo Date: Fri Sep 10 23:55:27 2010 New Revision: 212444 URL: http://svn.freebsd.org/changeset/base/212444 Log: Uses mtx_sleep(9) instead of explicitly dropping the lock that it'll do the samething what we want to do. Modified: user/weongyo/usb/sys/dev/usb/usb_util.c Modified: user/weongyo/usb/sys/dev/usb/usb_util.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_util.c Fri Sep 10 23:49:33 2010 (r212443) +++ user/weongyo/usb/sys/dev/usb/usb_util.c Fri Sep 10 23:55:27 2010 (r212444) @@ -146,8 +146,7 @@ device_set_usb_desc(device_t dev) void usb_pause_mtx(struct mtx *mtx, int _ticks) { - if (mtx != NULL) - mtx_unlock(mtx); + int tmpchan; if (cold) { /* convert to milliseconds */ @@ -163,13 +162,12 @@ usb_pause_mtx(struct mtx *mtx, int _tick * too early! */ _ticks++; - - if (pause("USBWAIT", _ticks)) { - /* ignore */ - } + if (mtx != NULL) + (void)mtx_sleep(&tmpchan, mtx, USB_PRI_MED, "USBWAIT", + _ticks); + else + (void)pause("USBWAIT", _ticks); } - if (mtx != NULL) - mtx_lock(mtx); } /*------------------------------------------------------------------------* From owner-svn-src-user@FreeBSD.ORG Fri Sep 10 23:55:47 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 575C4106566C; Fri, 10 Sep 2010 23:55:47 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CE8D8FC0A; Fri, 10 Sep 2010 23:55:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ANtlFp002403; Fri, 10 Sep 2010 23:55:47 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANtlIs002401; Fri, 10 Sep 2010 23:55:47 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009102355.o8ANtlIs002401@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 10 Sep 2010 23:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212445 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:55:47 -0000 Author: weongyo Date: Fri Sep 10 23:55:46 2010 New Revision: 212445 URL: http://svn.freebsd.org/changeset/base/212445 Log: style(9) Modified: user/weongyo/usb/sys/dev/usb/usb_util.c Modified: user/weongyo/usb/sys/dev/usb/usb_util.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_util.c Fri Sep 10 23:55:27 2010 (r212444) +++ user/weongyo/usb/sys/dev/usb/usb_util.c Fri Sep 10 23:55:46 2010 (r212445) @@ -154,7 +154,6 @@ usb_pause_mtx(struct mtx *mtx, int _tick /* convert to microseconds, rounded up */ _ticks = (_ticks + 1) * 1000; DELAY(_ticks); - } else { /* From owner-svn-src-user@FreeBSD.ORG Sat Sep 11 01:23:25 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34B37106566B; Sat, 11 Sep 2010 01:23:25 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22EF88FC0A; Sat, 11 Sep 2010 01:23:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8B1NPW0010761; Sat, 11 Sep 2010 01:23:25 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B1NOW6010745; Sat, 11 Sep 2010 01:23:24 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009110123.o8B1NOW6010745@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 11 Sep 2010 01:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212447 - in user/weongyo/usb/sys/dev/usb: . controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 01:23:25 -0000 Author: weongyo Date: Sat Sep 11 01:23:24 2010 New Revision: 212447 URL: http://svn.freebsd.org/changeset/base/212447 Log: Generalizes the usage of function pointer like BSD's other sources. While I'm here changes the variable name from `cb' to `func' which is one of confusing. Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c user/weongyo/usb/sys/dev/usb/controller/ehci.h user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c user/weongyo/usb/sys/dev/usb/controller/ohci.c user/weongyo/usb/sys/dev/usb/controller/ohci.h user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c user/weongyo/usb/sys/dev/usb/controller/uhci.c user/weongyo/usb/sys/dev/usb/controller/uhci.h user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/usb_controller.h Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Sat Sep 11 01:23:24 2010 (r212447) @@ -149,31 +149,31 @@ struct ehci_std_temp { }; void -ehci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb) +ehci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_callback_t *func) { ehci_softc_t *sc = EHCI_BUS2SC(bus); uint32_t i; - cb(bus, &sc->sc_hw.pframes_pc, &sc->sc_hw.pframes_pg, + (*func)(bus, &sc->sc_hw.pframes_pc, &sc->sc_hw.pframes_pg, sizeof(uint32_t) * EHCI_FRAMELIST_COUNT, EHCI_FRAMELIST_ALIGN); - cb(bus, &sc->sc_hw.async_start_pc, &sc->sc_hw.async_start_pg, + (*func)(bus, &sc->sc_hw.async_start_pc, &sc->sc_hw.async_start_pg, sizeof(ehci_qh_t), EHCI_QH_ALIGN); for (i = 0; i != EHCI_VIRTUAL_FRAMELIST_COUNT; i++) { - cb(bus, sc->sc_hw.intr_start_pc + i, + (*func)(bus, sc->sc_hw.intr_start_pc + i, sc->sc_hw.intr_start_pg + i, sizeof(ehci_qh_t), EHCI_QH_ALIGN); } for (i = 0; i != EHCI_VIRTUAL_FRAMELIST_COUNT; i++) { - cb(bus, sc->sc_hw.isoc_hs_start_pc + i, + (*func)(bus, sc->sc_hw.isoc_hs_start_pc + i, sc->sc_hw.isoc_hs_start_pg + i, sizeof(ehci_itd_t), EHCI_ITD_ALIGN); } for (i = 0; i != EHCI_VIRTUAL_FRAMELIST_COUNT; i++) { - cb(bus, sc->sc_hw.isoc_fs_start_pc + i, + (*func)(bus, sc->sc_hw.isoc_fs_start_pc + i, sc->sc_hw.isoc_fs_start_pg + i, sizeof(ehci_sitd_t), EHCI_SITD_ALIGN); } @@ -484,7 +484,7 @@ ehci_init(ehci_softc_t *sc) } /* flush all cache into memory */ - usb_bus_mem_flush_all(&sc->sc_bus, &ehci_iterate_hw_softc); + usb_bus_mem_flush_all(&sc->sc_bus, ehci_iterate_hw_softc); #ifdef USB_DEBUG if (ehcidebug) { Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.h Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.h Sat Sep 11 01:23:24 2010 (r212447) @@ -437,7 +437,7 @@ hc16toh(const struct ehci_softc *sc, con } #endif -usb_bus_mem_cb_t ehci_iterate_hw_softc; +usb_bus_mem_callback_t ehci_iterate_hw_softc; usb_error_t ehci_reset(ehci_softc_t *sc); usb_error_t ehci_init(ehci_softc_t *sc); Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c Sat Sep 11 01:23:24 2010 (r212447) @@ -153,7 +153,7 @@ ehci_ixp_attach(device_t self) /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, - USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) { + USB_GET_DMA_TAG(self), ehci_iterate_hw_softc)) { return (ENOMEM); } @@ -291,7 +291,7 @@ ehci_ixp_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus, ehci_iterate_hw_softc); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c Sat Sep 11 01:23:24 2010 (r212447) @@ -168,7 +168,7 @@ mv_ehci_attach(device_t self) /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, - USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) { + USB_GET_DMA_TAG(self), ehci_iterate_hw_softc)) { return (ENOMEM); } @@ -333,7 +333,7 @@ mv_ehci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus, ehci_iterate_hw_softc); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sat Sep 11 01:23:24 2010 (r212447) @@ -308,7 +308,7 @@ ehci_pci_attach(device_t self) /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, - USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) { + USB_GET_DMA_TAG(self), ehci_iterate_hw_softc)) { return (ENOMEM); } @@ -534,7 +534,7 @@ ehci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus, ehci_iterate_hw_softc); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.c Sat Sep 11 01:23:24 2010 (r212447) @@ -143,25 +143,26 @@ ohci_get_hcca(ohci_softc_t *sc) } void -ohci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb) +ohci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_callback_t *func) { struct ohci_softc *sc = OHCI_BUS2SC(bus); uint32_t i; - cb(bus, &sc->sc_hw.hcca_pc, &sc->sc_hw.hcca_pg, + (*func)(bus, &sc->sc_hw.hcca_pc, &sc->sc_hw.hcca_pg, sizeof(ohci_hcca_t), OHCI_HCCA_ALIGN); - cb(bus, &sc->sc_hw.ctrl_start_pc, &sc->sc_hw.ctrl_start_pg, + (*func)(bus, &sc->sc_hw.ctrl_start_pc, &sc->sc_hw.ctrl_start_pg, sizeof(ohci_ed_t), OHCI_ED_ALIGN); - cb(bus, &sc->sc_hw.bulk_start_pc, &sc->sc_hw.bulk_start_pg, + (*func)(bus, &sc->sc_hw.bulk_start_pc, &sc->sc_hw.bulk_start_pg, sizeof(ohci_ed_t), OHCI_ED_ALIGN); - cb(bus, &sc->sc_hw.isoc_start_pc, &sc->sc_hw.isoc_start_pg, + (*func)(bus, &sc->sc_hw.isoc_start_pc, &sc->sc_hw.isoc_start_pg, sizeof(ohci_ed_t), OHCI_ED_ALIGN); for (i = 0; i != OHCI_NO_EDS; i++) { - cb(bus, sc->sc_hw.intr_start_pc + i, sc->sc_hw.intr_start_pg + i, + (*func)(bus, sc->sc_hw.intr_start_pc + i, + sc->sc_hw.intr_start_pg + i, sizeof(ohci_ed_t), OHCI_ED_ALIGN); } } @@ -396,7 +397,7 @@ ohci_init(ohci_softc_t *sc) } /* flush all cache into memory */ - usb_bus_mem_flush_all(&sc->sc_bus, &ohci_iterate_hw_softc); + usb_bus_mem_flush_all(&sc->sc_bus, ohci_iterate_hw_softc); /* set up the bus struct */ sc->sc_bus.methods = &ohci_bus_methods; Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.h Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.h Sat Sep 11 01:23:24 2010 (r212447) @@ -256,7 +256,7 @@ typedef struct ohci_softc { } ohci_softc_t; -usb_bus_mem_cb_t ohci_iterate_hw_softc; +usb_bus_mem_callback_t ohci_iterate_hw_softc; usb_error_t ohci_init(ohci_softc_t *sc); void ohci_detach(struct ohci_softc *sc); Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c Sat Sep 11 01:23:24 2010 (r212447) @@ -95,7 +95,7 @@ ohci_atmelarm_attach(device_t dev) /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_ohci.sc_bus, - USB_GET_DMA_TAG(dev), &ohci_iterate_hw_softc)) { + USB_GET_DMA_TAG(dev), ohci_iterate_hw_softc)) { return (ENOMEM); } sc->iclk = at91_pmc_clock_ref("ohci_clk"); @@ -212,7 +212,7 @@ ohci_atmelarm_detach(device_t dev) sc->sc_ohci.sc_io_res); sc->sc_ohci.sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_ohci.sc_bus, &ohci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_ohci.sc_bus, ohci_iterate_hw_softc); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c Sat Sep 11 01:23:24 2010 (r212447) @@ -224,7 +224,7 @@ ohci_pci_attach(device_t self) /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), - &ohci_iterate_hw_softc)) { + ohci_iterate_hw_softc)) { return (ENOMEM); } sc->sc_dev = self; @@ -377,7 +377,7 @@ ohci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, &ohci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus, ohci_iterate_hw_softc); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c Sat Sep 11 01:23:24 2010 (r212447) @@ -88,7 +88,7 @@ ohci_s3c24x0_attach(device_t dev) /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev), - &ohci_iterate_hw_softc)) { + ohci_iterate_hw_softc)) { return (ENOMEM); } @@ -189,7 +189,7 @@ ohci_s3c24x0_detach(device_t dev) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, &ohci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus, ohci_iterate_hw_softc); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.c Sat Sep 11 01:23:24 2010 (r212447) @@ -165,37 +165,37 @@ static uint8_t uhci_check_transfer(struc static void uhci_root_intr(uhci_softc_t *sc); void -uhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb) +uhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_callback_t *func) { struct uhci_softc *sc = UHCI_BUS2SC(bus); uint32_t i; - cb(bus, &sc->sc_hw.pframes_pc, &sc->sc_hw.pframes_pg, + (*func)(bus, &sc->sc_hw.pframes_pc, &sc->sc_hw.pframes_pg, sizeof(uint32_t) * UHCI_FRAMELIST_COUNT, UHCI_FRAMELIST_ALIGN); - cb(bus, &sc->sc_hw.ls_ctl_start_pc, &sc->sc_hw.ls_ctl_start_pg, + (*func)(bus, &sc->sc_hw.ls_ctl_start_pc, &sc->sc_hw.ls_ctl_start_pg, sizeof(uhci_qh_t), UHCI_QH_ALIGN); - cb(bus, &sc->sc_hw.fs_ctl_start_pc, &sc->sc_hw.fs_ctl_start_pg, + (*func)(bus, &sc->sc_hw.fs_ctl_start_pc, &sc->sc_hw.fs_ctl_start_pg, sizeof(uhci_qh_t), UHCI_QH_ALIGN); - cb(bus, &sc->sc_hw.bulk_start_pc, &sc->sc_hw.bulk_start_pg, + (*func)(bus, &sc->sc_hw.bulk_start_pc, &sc->sc_hw.bulk_start_pg, sizeof(uhci_qh_t), UHCI_QH_ALIGN); - cb(bus, &sc->sc_hw.last_qh_pc, &sc->sc_hw.last_qh_pg, + (*func)(bus, &sc->sc_hw.last_qh_pc, &sc->sc_hw.last_qh_pg, sizeof(uhci_qh_t), UHCI_QH_ALIGN); - cb(bus, &sc->sc_hw.last_td_pc, &sc->sc_hw.last_td_pg, + (*func)(bus, &sc->sc_hw.last_td_pc, &sc->sc_hw.last_td_pg, sizeof(uhci_td_t), UHCI_TD_ALIGN); for (i = 0; i != UHCI_VFRAMELIST_COUNT; i++) { - cb(bus, sc->sc_hw.isoc_start_pc + i, + (*func)(bus, sc->sc_hw.isoc_start_pc + i, sc->sc_hw.isoc_start_pg + i, sizeof(uhci_td_t), UHCI_TD_ALIGN); } for (i = 0; i != UHCI_IFRAMELIST_COUNT; i++) { - cb(bus, sc->sc_hw.intr_start_pc + i, + (*func)(bus, sc->sc_hw.intr_start_pc + i, sc->sc_hw.intr_start_pg + i, sizeof(uhci_qh_t), UHCI_QH_ALIGN); } @@ -640,7 +640,7 @@ uhci_init(uhci_softc_t *sc) } /* flush all cache into memory */ - usb_bus_mem_flush_all(&sc->sc_bus, &uhci_iterate_hw_softc); + usb_bus_mem_flush_all(&sc->sc_bus, uhci_iterate_hw_softc); /* set up the bus struct */ sc->sc_bus.methods = &uhci_bus_methods; Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.h Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.h Sat Sep 11 01:23:24 2010 (r212447) @@ -242,7 +242,7 @@ typedef struct uhci_softc { char sc_vendor[16]; /* vendor string for root hub */ } uhci_softc_t; -usb_bus_mem_cb_t uhci_iterate_hw_softc; +usb_bus_mem_callback_t uhci_iterate_hw_softc; usb_error_t uhci_init(uhci_softc_t *sc); void uhci_suspend(uhci_softc_t *sc); Modified: user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c Sat Sep 11 01:23:24 2010 (r212447) @@ -284,7 +284,7 @@ uhci_pci_attach(device_t self) /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), - &uhci_iterate_hw_softc)) { + uhci_iterate_hw_softc)) { return ENOMEM; } sc->sc_dev = self; @@ -442,7 +442,7 @@ uhci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, &uhci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus, uhci_iterate_hw_softc); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 01:23:24 2010 (r212447) @@ -485,10 +485,10 @@ usb_bus_mem_flush_all_cb(struct usb_bus *------------------------------------------------------------------------*/ #if USB_HAVE_BUSDMA void -usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb) +usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_callback_t *func) { - if (cb) { - cb(bus, &usb_bus_mem_flush_all_cb); + if (func != NULL) { + (*func)(bus, usb_bus_mem_flush_all_cb); } } #endif @@ -519,7 +519,7 @@ usb_bus_mem_alloc_all_cb(struct usb_bus *------------------------------------------------------------------------*/ uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, - usb_bus_mem_cb_t *cb) + usb_bus_mem_callback_t *func) { bus->alloc_failed = 0; @@ -543,12 +543,12 @@ usb_bus_mem_alloc_all(struct usb_bus *bu bus->alloc_failed = 1; /* failure */ } #if USB_HAVE_BUSDMA - if (cb) { - cb(bus, &usb_bus_mem_alloc_all_cb); + if (func != NULL) { + (*func)(bus, usb_bus_mem_alloc_all_cb); } #endif if (bus->alloc_failed) { - usb_bus_mem_free_all(bus, cb); + usb_bus_mem_free_all(bus, func); } return (bus->alloc_failed); } @@ -569,11 +569,11 @@ usb_bus_mem_free_all_cb(struct usb_bus * * usb_bus_mem_free_all - factored out code *------------------------------------------------------------------------*/ void -usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb) +usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_callback_t *func) { #if USB_HAVE_BUSDMA - if (cb) { - cb(bus, &usb_bus_mem_free_all_cb); + if (func != NULL) { + (*func)(bus, usb_bus_mem_free_all_cb); } usb_dma_tag_unsetup(bus->dma_parent_tag); #endif Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 01:08:16 2010 (r212446) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 01:23:24 2010 (r212447) @@ -45,8 +45,11 @@ struct usb_endpoint_descriptor; /* typedefs */ -typedef void (usb_bus_mem_sub_cb_t)(struct usb_bus *bus, struct usb_page_cache *pc, struct usb_page *pg, usb_size_t size, usb_size_t align); -typedef void (usb_bus_mem_cb_t)(struct usb_bus *bus, usb_bus_mem_sub_cb_t *scb); +typedef void (usb_bus_mem_sub_callback_t)(struct usb_bus *, + struct usb_page_cache *, struct usb_page *, usb_size_t, + usb_size_t); +typedef void (usb_bus_mem_callback_t)(struct usb_bus *, + usb_bus_mem_sub_callback_t *); /* * The following structure is used to define all the USB BUS @@ -190,9 +193,10 @@ struct usb_temp_setup { /* prototypes */ -void usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb); -uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb_bus_mem_cb_t *cb); -void usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb); +void usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_callback_t *cb); +uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, + usb_bus_mem_callback_t *cb); +void usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_callback_t *cb); uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); uint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time); uint8_t usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); From owner-svn-src-user@FreeBSD.ORG Sat Sep 11 01:26:41 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07B8C106566C; Sat, 11 Sep 2010 01:26:41 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBE708FC0A; Sat, 11 Sep 2010 01:26:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8B1Qej3011068; Sat, 11 Sep 2010 01:26:40 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B1QeeX011066; Sat, 11 Sep 2010 01:26:40 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009110126.o8B1QeeX011066@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 11 Sep 2010 01:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212448 - user/weongyo/usb/sys/dev/usb/controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 01:26:41 -0000 Author: weongyo Date: Sat Sep 11 01:26:40 2010 New Revision: 212448 URL: http://svn.freebsd.org/changeset/base/212448 Log: style(9) Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 01:23:24 2010 (r212447) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 01:26:40 2010 (r212448) @@ -487,9 +487,8 @@ usb_bus_mem_flush_all_cb(struct usb_bus void usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_callback_t *func) { - if (func != NULL) { + if (func != NULL) (*func)(bus, usb_bus_mem_flush_all_cb); - } } #endif @@ -504,9 +503,8 @@ usb_bus_mem_alloc_all_cb(struct usb_bus /* need to initialize the page cache */ pc->tag_parent = bus->dma_parent_tag; - if (usb_pc_alloc_mem(pc, pg, size, align)) { + if (usb_pc_alloc_mem(pc, pg, size, align)) bus->alloc_failed = 1; - } } #endif @@ -526,8 +524,7 @@ usb_bus_mem_alloc_all(struct usb_bus *bu mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent), NULL, MTX_DEF | MTX_RECURSE); - usb_callout_init_mtx(&bus->power_wdog, - &bus->bus_mtx, 0); + usb_callout_init_mtx(&bus->power_wdog, &bus->bus_mtx, 0); TAILQ_INIT(&bus->intr_q.head); @@ -543,13 +540,11 @@ usb_bus_mem_alloc_all(struct usb_bus *bu bus->alloc_failed = 1; /* failure */ } #if USB_HAVE_BUSDMA - if (func != NULL) { + if (func != NULL) (*func)(bus, usb_bus_mem_alloc_all_cb); - } #endif - if (bus->alloc_failed) { + if (bus->alloc_failed) usb_bus_mem_free_all(bus, func); - } return (bus->alloc_failed); } @@ -572,9 +567,8 @@ void usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_callback_t *func) { #if USB_HAVE_BUSDMA - if (func != NULL) { + if (func != NULL) (*func)(bus, usb_bus_mem_free_all_cb); - } usb_dma_tag_unsetup(bus->dma_parent_tag); #endif From owner-svn-src-user@FreeBSD.ORG Sat Sep 11 01:27:11 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C35A1065693; Sat, 11 Sep 2010 01:27:11 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F08C28FC08; Sat, 11 Sep 2010 01:27:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8B1RAVQ011157; Sat, 11 Sep 2010 01:27:10 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B1RAel011155; Sat, 11 Sep 2010 01:27:10 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009110127.o8B1RAel011155@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 11 Sep 2010 01:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212449 - user/weongyo/usb/sys/dev/usb/controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 01:27:11 -0000 Author: weongyo Date: Sat Sep 11 01:27:10 2010 New Revision: 212449 URL: http://svn.freebsd.org/changeset/base/212449 Log: style(9) Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 01:26:40 2010 (r212448) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 01:27:10 2010 (r212449) @@ -476,6 +476,7 @@ static void usb_bus_mem_flush_all_cb(struct usb_bus *bus, struct usb_page_cache *pc, struct usb_page *pg, usb_size_t size, usb_size_t align) { + usb_pc_cpu_flush(pc); } #endif @@ -487,6 +488,7 @@ usb_bus_mem_flush_all_cb(struct usb_bus void usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_callback_t *func) { + if (func != NULL) (*func)(bus, usb_bus_mem_flush_all_cb); } @@ -500,6 +502,7 @@ static void usb_bus_mem_alloc_all_cb(struct usb_bus *bus, struct usb_page_cache *pc, struct usb_page *pg, usb_size_t size, usb_size_t align) { + /* need to initialize the page cache */ pc->tag_parent = bus->dma_parent_tag; @@ -519,6 +522,7 @@ uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb_bus_mem_callback_t *func) { + bus->alloc_failed = 0; mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent), @@ -556,6 +560,7 @@ static void usb_bus_mem_free_all_cb(struct usb_bus *bus, struct usb_page_cache *pc, struct usb_page *pg, usb_size_t size, usb_size_t align) { + usb_pc_free_mem(pc); } #endif @@ -566,6 +571,7 @@ usb_bus_mem_free_all_cb(struct usb_bus * void usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_callback_t *func) { + #if USB_HAVE_BUSDMA if (func != NULL) (*func)(bus, usb_bus_mem_free_all_cb); From owner-svn-src-user@FreeBSD.ORG Sat Sep 11 01:49:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71187106566C; Sat, 11 Sep 2010 01:49:06 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FEEE8FC08; Sat, 11 Sep 2010 01:49:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8B1n6ZO014218; Sat, 11 Sep 2010 01:49:06 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B1n6f7014201; Sat, 11 Sep 2010 01:49:06 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009110149.o8B1n6f7014201@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 11 Sep 2010 01:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212450 - in user/weongyo/usb/sys/dev/usb: . controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 01:49:06 -0000 Author: weongyo Date: Sat Sep 11 01:49:05 2010 New Revision: 212450 URL: http://svn.freebsd.org/changeset/base/212450 Log: Removes `usb_bus_mem_callback_t' and simplifies the logic passing the callback pointer. As a refection by this change the following prototype of functions are changed: o usb_bus_mem_flush_all o usb_bus_mem_free_all o usb_bus_mem_alloc_all Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c user/weongyo/usb/sys/dev/usb/controller/ehci.h user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c user/weongyo/usb/sys/dev/usb/controller/ohci.c user/weongyo/usb/sys/dev/usb/controller/ohci.h user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c user/weongyo/usb/sys/dev/usb/controller/uhci.c user/weongyo/usb/sys/dev/usb/controller/uhci.h user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/usb_bus.h user/weongyo/usb/sys/dev/usb/usb_controller.h Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Sat Sep 11 01:49:05 2010 (r212450) @@ -482,9 +482,9 @@ ehci_init(ehci_softc_t *sc) qh->qh_qtd.qtd_altnext = htohc32(sc, EHCI_LINK_TERMINATE); qh->qh_qtd.qtd_status = htohc32(sc, EHCI_QTD_HALTED); } - /* flush all cache into memory */ - usb_bus_mem_flush_all(&sc->sc_bus, ehci_iterate_hw_softc); + /* flush all cache into memory */ + usb_bus_mem_flush_all(&sc->sc_bus); #ifdef USB_DEBUG if (ehcidebug) { Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.h Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.h Sat Sep 11 01:49:05 2010 (r212450) @@ -437,8 +437,6 @@ hc16toh(const struct ehci_softc *sc, con } #endif -usb_bus_mem_callback_t ehci_iterate_hw_softc; - usb_error_t ehci_reset(ehci_softc_t *sc); usb_error_t ehci_init(ehci_softc_t *sc); void ehci_detach(struct ehci_softc *sc); @@ -446,5 +444,6 @@ void ehci_suspend(struct ehci_softc *sc) void ehci_resume(struct ehci_softc *sc); void ehci_shutdown(ehci_softc_t *sc); void ehci_interrupt(ehci_softc_t *sc); +void ehci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_sub_callback_t *); #endif /* _EHCI_H_ */ Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c Sat Sep 11 01:49:05 2010 (r212450) @@ -150,12 +150,11 @@ ehci_ixp_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.busmem_func = ehci_iterate_hw_softc; /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, - USB_GET_DMA_TAG(self), ehci_iterate_hw_softc)) { + if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) return (ENOMEM); - } /* NB: hints fix the memory location and irq */ @@ -291,7 +290,7 @@ ehci_ixp_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, ehci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c Sat Sep 11 01:49:05 2010 (r212450) @@ -165,12 +165,11 @@ mv_ehci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.busmem_func = ehci_iterate_hw_softc; /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, - USB_GET_DMA_TAG(self), ehci_iterate_hw_softc)) { + if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) return (ENOMEM); - } rid = 0; sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -333,7 +332,7 @@ mv_ehci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, ehci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sat Sep 11 01:49:05 2010 (r212450) @@ -305,12 +305,11 @@ ehci_pci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.busmem_func = ehci_iterate_hw_softc; /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, - USB_GET_DMA_TAG(self), ehci_iterate_hw_softc)) { + if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) return (ENOMEM); - } pci_enable_busmaster(self); @@ -534,7 +533,7 @@ ehci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, ehci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.c Sat Sep 11 01:49:05 2010 (r212450) @@ -397,7 +397,7 @@ ohci_init(ohci_softc_t *sc) } /* flush all cache into memory */ - usb_bus_mem_flush_all(&sc->sc_bus, ohci_iterate_hw_softc); + usb_bus_mem_flush_all(&sc->sc_bus); /* set up the bus struct */ sc->sc_bus.methods = &ohci_bus_methods; Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.h Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.h Sat Sep 11 01:49:05 2010 (r212450) @@ -256,12 +256,11 @@ typedef struct ohci_softc { } ohci_softc_t; -usb_bus_mem_callback_t ohci_iterate_hw_softc; - usb_error_t ohci_init(ohci_softc_t *sc); void ohci_detach(struct ohci_softc *sc); void ohci_suspend(ohci_softc_t *sc); void ohci_resume(ohci_softc_t *sc); void ohci_interrupt(ohci_softc_t *sc); +void ohci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_sub_callback_t *); #endif /* _OHCI_H_ */ Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c Sat Sep 11 01:49:05 2010 (r212450) @@ -92,12 +92,12 @@ ohci_atmelarm_attach(device_t dev) sc->sc_ohci.sc_bus.parent = dev; sc->sc_ohci.sc_bus.devices = sc->sc_ohci.sc_devices; sc->sc_ohci.sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_ohci.sc_bus.busmem_func = ohci_iterate_hw_softc; /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_ohci.sc_bus, - USB_GET_DMA_TAG(dev), ohci_iterate_hw_softc)) { + if (usb_bus_mem_alloc_all(&sc->sc_ohci.sc_bus, USB_GET_DMA_TAG(dev))) return (ENOMEM); - } + sc->iclk = at91_pmc_clock_ref("ohci_clk"); sc->fclk = at91_pmc_clock_ref("uhpck"); @@ -212,7 +212,7 @@ ohci_atmelarm_detach(device_t dev) sc->sc_ohci.sc_io_res); sc->sc_ohci.sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_ohci.sc_bus, ohci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_ohci.sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c Sat Sep 11 01:49:05 2010 (r212450) @@ -221,12 +221,12 @@ ohci_pci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_bus.busmem_func = ohci_iterate_hw_softc; /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), - ohci_iterate_hw_softc)) { + if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) return (ENOMEM); - } + sc->sc_dev = self; pci_enable_busmaster(self); @@ -377,7 +377,7 @@ ohci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, ohci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c Sat Sep 11 01:49:05 2010 (r212450) @@ -85,12 +85,11 @@ ohci_s3c24x0_attach(device_t dev) sc->sc_bus.parent = dev; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_bus.busmem_func = ohci_iterate_hw_softc; /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev), - ohci_iterate_hw_softc)) { + if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev))) return (ENOMEM); - } sc->sc_dev = dev; @@ -189,7 +188,7 @@ ohci_s3c24x0_detach(device_t dev) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, ohci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.c Sat Sep 11 01:49:05 2010 (r212450) @@ -638,9 +638,9 @@ uhci_init(uhci_softc_t *sc) sc->sc_isoc_p_last[x % UHCI_VFRAMELIST_COUNT]->td_self; } } - /* flush all cache into memory */ - usb_bus_mem_flush_all(&sc->sc_bus, uhci_iterate_hw_softc); + /* flush all cache into memory */ + usb_bus_mem_flush_all(&sc->sc_bus); /* set up the bus struct */ sc->sc_bus.methods = &uhci_bus_methods; Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.h Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.h Sat Sep 11 01:49:05 2010 (r212450) @@ -242,12 +242,11 @@ typedef struct uhci_softc { char sc_vendor[16]; /* vendor string for root hub */ } uhci_softc_t; -usb_bus_mem_callback_t uhci_iterate_hw_softc; - usb_error_t uhci_init(uhci_softc_t *sc); void uhci_suspend(uhci_softc_t *sc); void uhci_resume(uhci_softc_t *sc); void uhci_reset(uhci_softc_t *sc); void uhci_interrupt(uhci_softc_t *sc); +void uhci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_sub_callback_t *); #endif /* _UHCI_H_ */ Modified: user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c Sat Sep 11 01:49:05 2010 (r212450) @@ -281,12 +281,11 @@ uhci_pci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = UHCI_MAX_DEVICES; + sc->sc_bus.busmem_func = uhci_iterate_hw_softc; /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), - uhci_iterate_hw_softc)) { + if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) return ENOMEM; - } sc->sc_dev = self; pci_enable_busmaster(self); @@ -442,7 +441,7 @@ uhci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, uhci_iterate_hw_softc); + usb_bus_mem_free_all(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 01:49:05 2010 (r212450) @@ -486,11 +486,11 @@ usb_bus_mem_flush_all_cb(struct usb_bus *------------------------------------------------------------------------*/ #if USB_HAVE_BUSDMA void -usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_callback_t *func) +usb_bus_mem_flush_all(struct usb_bus *bus) { - if (func != NULL) - (*func)(bus, usb_bus_mem_flush_all_cb); + if (bus->busmem_func != NULL) + bus->busmem_func(bus, usb_bus_mem_flush_all_cb); } #endif @@ -519,8 +519,7 @@ usb_bus_mem_alloc_all_cb(struct usb_bus * Else: Failure *------------------------------------------------------------------------*/ uint8_t -usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, - usb_bus_mem_callback_t *func) +usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat) { bus->alloc_failed = 0; @@ -544,11 +543,11 @@ usb_bus_mem_alloc_all(struct usb_bus *bu bus->alloc_failed = 1; /* failure */ } #if USB_HAVE_BUSDMA - if (func != NULL) - (*func)(bus, usb_bus_mem_alloc_all_cb); + if (bus->busmem_func != NULL) + bus->busmem_func(bus, usb_bus_mem_alloc_all_cb); #endif if (bus->alloc_failed) - usb_bus_mem_free_all(bus, func); + usb_bus_mem_free_all(bus); return (bus->alloc_failed); } @@ -569,12 +568,12 @@ usb_bus_mem_free_all_cb(struct usb_bus * * usb_bus_mem_free_all - factored out code *------------------------------------------------------------------------*/ void -usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_callback_t *func) +usb_bus_mem_free_all(struct usb_bus *bus) { #if USB_HAVE_BUSDMA - if (func != NULL) - (*func)(bus, usb_bus_mem_free_all_cb); + if (bus->busmem_func != NULL) + bus->busmem_func(bus, usb_bus_mem_free_all_cb); usb_dma_tag_unsetup(bus->dma_parent_tag); #endif Modified: user/weongyo/usb/sys/dev/usb/usb_bus.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_bus.h Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/usb_bus.h Sat Sep 11 01:49:05 2010 (r212450) @@ -86,6 +86,8 @@ struct usb_bus { struct usb_bus_methods *methods; /* filled by HC driver */ struct usb_device **devices; + void (*busmem_func)(struct usb_bus *, usb_bus_mem_sub_callback_t *); + usb_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */ usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 01:27:10 2010 (r212449) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 01:49:05 2010 (r212450) @@ -48,8 +48,6 @@ struct usb_endpoint_descriptor; typedef void (usb_bus_mem_sub_callback_t)(struct usb_bus *, struct usb_page_cache *, struct usb_page *, usb_size_t, usb_size_t); -typedef void (usb_bus_mem_callback_t)(struct usb_bus *, - usb_bus_mem_sub_callback_t *); /* * The following structure is used to define all the USB BUS @@ -193,10 +191,9 @@ struct usb_temp_setup { /* prototypes */ -void usb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_callback_t *cb); -uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, - usb_bus_mem_callback_t *cb); -void usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_callback_t *cb); +void usb_bus_mem_flush_all(struct usb_bus *bus); +uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat); +void usb_bus_mem_free_all(struct usb_bus *bus); uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); uint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time); uint8_t usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); From owner-svn-src-user@FreeBSD.ORG Sat Sep 11 01:51:46 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 703F7106566B; Sat, 11 Sep 2010 01:51:46 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FF0B8FC16; Sat, 11 Sep 2010 01:51:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8B1pkCU014791; Sat, 11 Sep 2010 01:51:46 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B1pkJe014782; Sat, 11 Sep 2010 01:51:46 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009110151.o8B1pkJe014782@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 11 Sep 2010 01:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212451 - in user/weongyo/usb/sys/dev/usb: . controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 01:51:46 -0000 Author: weongyo Date: Sat Sep 11 01:51:45 2010 New Revision: 212451 URL: http://svn.freebsd.org/changeset/base/212451 Log: Renames usb_bus_mem_sub_callback_t to usb_bus_mem_callback_t because usb_bus_mem_callback_t is removed at the previous commit. Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c user/weongyo/usb/sys/dev/usb/controller/ehci.h user/weongyo/usb/sys/dev/usb/controller/ohci.c user/weongyo/usb/sys/dev/usb/controller/ohci.h user/weongyo/usb/sys/dev/usb/controller/uhci.c user/weongyo/usb/sys/dev/usb/controller/uhci.h user/weongyo/usb/sys/dev/usb/usb_bus.h user/weongyo/usb/sys/dev/usb/usb_controller.h Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.c Sat Sep 11 01:49:05 2010 (r212450) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.c Sat Sep 11 01:51:45 2010 (r212451) @@ -149,7 +149,7 @@ struct ehci_std_temp { }; void -ehci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_callback_t *func) +ehci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_callback_t *func) { ehci_softc_t *sc = EHCI_BUS2SC(bus); uint32_t i; Modified: user/weongyo/usb/sys/dev/usb/controller/ehci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci.h Sat Sep 11 01:49:05 2010 (r212450) +++ user/weongyo/usb/sys/dev/usb/controller/ehci.h Sat Sep 11 01:51:45 2010 (r212451) @@ -444,6 +444,6 @@ void ehci_suspend(struct ehci_softc *sc) void ehci_resume(struct ehci_softc *sc); void ehci_shutdown(ehci_softc_t *sc); void ehci_interrupt(ehci_softc_t *sc); -void ehci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_sub_callback_t *); +void ehci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_callback_t *); #endif /* _EHCI_H_ */ Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.c Sat Sep 11 01:49:05 2010 (r212450) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.c Sat Sep 11 01:51:45 2010 (r212451) @@ -143,7 +143,7 @@ ohci_get_hcca(ohci_softc_t *sc) } void -ohci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_callback_t *func) +ohci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_callback_t *func) { struct ohci_softc *sc = OHCI_BUS2SC(bus); uint32_t i; Modified: user/weongyo/usb/sys/dev/usb/controller/ohci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci.h Sat Sep 11 01:49:05 2010 (r212450) +++ user/weongyo/usb/sys/dev/usb/controller/ohci.h Sat Sep 11 01:51:45 2010 (r212451) @@ -261,6 +261,6 @@ void ohci_detach(struct ohci_softc *sc); void ohci_suspend(ohci_softc_t *sc); void ohci_resume(ohci_softc_t *sc); void ohci_interrupt(ohci_softc_t *sc); -void ohci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_sub_callback_t *); +void ohci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_callback_t *); #endif /* _OHCI_H_ */ Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.c Sat Sep 11 01:49:05 2010 (r212450) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.c Sat Sep 11 01:51:45 2010 (r212451) @@ -165,7 +165,7 @@ static uint8_t uhci_check_transfer(struc static void uhci_root_intr(uhci_softc_t *sc); void -uhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_callback_t *func) +uhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_callback_t *func) { struct uhci_softc *sc = UHCI_BUS2SC(bus); uint32_t i; Modified: user/weongyo/usb/sys/dev/usb/controller/uhci.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci.h Sat Sep 11 01:49:05 2010 (r212450) +++ user/weongyo/usb/sys/dev/usb/controller/uhci.h Sat Sep 11 01:51:45 2010 (r212451) @@ -247,6 +247,6 @@ void uhci_suspend(uhci_softc_t *sc); void uhci_resume(uhci_softc_t *sc); void uhci_reset(uhci_softc_t *sc); void uhci_interrupt(uhci_softc_t *sc); -void uhci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_sub_callback_t *); +void uhci_iterate_hw_softc(struct usb_bus *, usb_bus_mem_callback_t *); #endif /* _UHCI_H_ */ Modified: user/weongyo/usb/sys/dev/usb/usb_bus.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_bus.h Sat Sep 11 01:49:05 2010 (r212450) +++ user/weongyo/usb/sys/dev/usb/usb_bus.h Sat Sep 11 01:51:45 2010 (r212451) @@ -86,7 +86,7 @@ struct usb_bus { struct usb_bus_methods *methods; /* filled by HC driver */ struct usb_device **devices; - void (*busmem_func)(struct usb_bus *, usb_bus_mem_sub_callback_t *); + void (*busmem_func)(struct usb_bus *, usb_bus_mem_callback_t *); usb_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */ usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 01:49:05 2010 (r212450) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 01:51:45 2010 (r212451) @@ -45,7 +45,7 @@ struct usb_endpoint_descriptor; /* typedefs */ -typedef void (usb_bus_mem_sub_callback_t)(struct usb_bus *, +typedef void (usb_bus_mem_callback_t)(struct usb_bus *, struct usb_page_cache *, struct usb_page *, usb_size_t, usb_size_t); From owner-svn-src-user@FreeBSD.ORG Sat Sep 11 23:03:41 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03955106564A; Sat, 11 Sep 2010 23:03:41 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E59998FC19; Sat, 11 Sep 2010 23:03:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8BN3emM052561; Sat, 11 Sep 2010 23:03:40 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BN3ebv052546; Sat, 11 Sep 2010 23:03:40 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009112303.o8BN3ebv052546@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 11 Sep 2010 23:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212484 - in user/weongyo/usb/sys/dev/usb: . controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 23:03:41 -0000 Author: weongyo Date: Sat Sep 11 23:03:40 2010 New Revision: 212484 URL: http://svn.freebsd.org/changeset/base/212484 Log: Changes the purpose of usb_bus_mem_alloc_all() that did initialize DMA/PIO mode, the tailq and callouts. Just looking the function name it looks it's doing jobs related with memory initialization but it's doing more than it that it's really confusing. So cleans up its meaning and adds a wrapper, usb_bus_struct_init, to initialize the usb_bus structure. Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/atmegadci_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c user/weongyo/usb/sys/dev/usb/controller/musb_otg_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c user/weongyo/usb/sys/dev/usb/controller/usb_controller.c user/weongyo/usb/sys/dev/usb/controller/uss820dci_atmelarm.c user/weongyo/usb/sys/dev/usb/usb_controller.h Modified: user/weongyo/usb/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/at91dci_atmelarm.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/at91dci_atmelarm.c Sat Sep 11 23:03:40 2010 (r212484) @@ -157,16 +157,11 @@ at91_udp_attach(device_t dev) sc->sc_dci.sc_pull_down = &at91_udp_pull_down; sc->sc_dci.sc_pull_arg = sc; - /* initialise some bus fields */ - sc->sc_dci.sc_bus.parent = dev; - sc->sc_dci.sc_bus.devices = sc->sc_dci.sc_devices; - sc->sc_dci.sc_bus.devices_max = AT91_MAX_DEVICES; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_dci.sc_bus, - USB_GET_DMA_TAG(dev), NULL)) { - return (ENOMEM); - } + err = usb_bus_struct_init(&sc->sc_dci.sc_bus, dev, + sc->sc_dci.sc_devices, AT91_MAX_DEVICES, NULL); + if (err != 0) + return (err); + /* * configure VBUS input pin, enable deglitch and enable * interrupt : @@ -314,7 +309,7 @@ at91_udp_detach(device_t dev) sc->sc_dci.sc_io_res); sc->sc_dci.sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL); + usb_bus_struct_fini(&sc->sc_dci.sc_bus); /* disable clocks */ at91_pmc_clock_disable(sc->sc_iclk); Modified: user/weongyo/usb/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/atmegadci_atmelarm.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/atmegadci_atmelarm.c Sat Sep 11 23:03:40 2010 (r212484) @@ -99,16 +99,11 @@ atmegadci_attach(device_t dev) sc->sc_otg.sc_clocks_on = &atmegadci_clocks_on; sc->sc_otg.sc_clocks_off = &atmegadci_clocks_off; - /* initialise some bus fields */ - sc->sc_otg.sc_bus.parent = dev; - sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices; - sc->sc_otg.sc_bus.devices_max = ATMEGA_MAX_DEVICES; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus, - USB_GET_DMA_TAG(dev), NULL)) { - return (ENOMEM); - } + err = usb_bus_struct_init(&sc->sc_otg.sc_bus, dev, + sc->sc_otg.sc_devices, ATMEGA_MAX_DEVICES, NULL); + if (err != NULL) + return (err); + rid = 0; sc->sc_otg.sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -189,7 +184,7 @@ atmegadci_detach(device_t dev) sc->sc_otg.sc_io_res); sc->sc_otg.sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL); + usb_bus_struct_fini(&sc->sc_otg.sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_ixp4xx.c Sat Sep 11 23:03:40 2010 (r212484) @@ -146,15 +146,10 @@ ehci_ixp_attach(device_t self) int err; int rid; - /* initialise some bus fields */ - sc->sc_bus.parent = self; - sc->sc_bus.devices = sc->sc_devices; - sc->sc_bus.devices_max = EHCI_MAX_DEVICES; - sc->sc_bus.busmem_func = ehci_iterate_hw_softc; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) - return (ENOMEM); + err = usb_bus_struct_init(&sc->sc_bus, self, sc->sc_devices, + EHCI_MAX_DEVICES, ehci_iterate_hw_softc); + if (err != 0) + return (err); /* NB: hints fix the memory location and irq */ @@ -290,7 +285,7 @@ ehci_ixp_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus); + usb_bus_struct_fini(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_mv.c Sat Sep 11 23:03:40 2010 (r212484) @@ -161,18 +161,14 @@ mv_ehci_attach(device_t self) int err; int rid; - /* initialise some bus fields */ - sc->sc_bus.parent = self; - sc->sc_bus.devices = sc->sc_devices; - sc->sc_bus.devices_max = EHCI_MAX_DEVICES; - sc->sc_bus.busmem_func = ehci_iterate_hw_softc; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) - return (ENOMEM); + err = usb_bus_struct_init(&sc->sc_bus, self, sc->sc_devices, + EHCI_MAX_DEVICES, ehci_iterate_hw_softc); + if (err != 0) + return (err); rid = 0; - sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); + sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, + RF_ACTIVE); if (!sc->sc_io_res) { device_printf(self, "Could not map memory\n"); goto error; @@ -332,7 +328,7 @@ mv_ehci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus); + usb_bus_struct_fini(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/ehci_pci.c Sat Sep 11 23:03:40 2010 (r212484) @@ -301,15 +301,10 @@ ehci_pci_attach(device_t self) int err; int rid; - /* initialise some bus fields */ - sc->sc_bus.parent = self; - sc->sc_bus.devices = sc->sc_devices; - sc->sc_bus.devices_max = EHCI_MAX_DEVICES; - sc->sc_bus.busmem_func = ehci_iterate_hw_softc; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) - return (ENOMEM); + err = usb_bus_struct_init(&sc->sc_bus, self, sc->sc_devices, + EHCI_MAX_DEVICES, ehci_iterate_hw_softc); + if (err != 0) + return (err); pci_enable_busmaster(self); @@ -533,7 +528,7 @@ ehci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus); + usb_bus_struct_fini(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/musb_otg_atmelarm.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/musb_otg_atmelarm.c Sat Sep 11 23:03:40 2010 (r212484) @@ -113,16 +113,11 @@ musbotg_attach(device_t dev) sc->sc_otg.sc_clocks_off = &musbotg_clocks_off; sc->sc_otg.sc_clocks_arg = sc; - /* initialise some bus fields */ - sc->sc_otg.sc_bus.parent = dev; - sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices; - sc->sc_otg.sc_bus.devices_max = MUSB2_MAX_DEVICES; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus, - USB_GET_DMA_TAG(dev), NULL)) { - return (ENOMEM); - } + err = usb_bus_struct_init(&sc->sc_otg.sc_bus, dev, + sc->sc_otg.sc_devices, MUSB2_MAX_DEVICES, NULL); + if (err != 0) + return (err); + rid = 0; sc->sc_otg.sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -212,7 +207,7 @@ musbotg_detach(device_t dev) sc->sc_otg.sc_io_res); sc->sc_otg.sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_otg.sc_bus, NULL); + usb_bus_struct_fini(&sc->sc_otg.sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_atmelarm.c Sat Sep 11 23:03:40 2010 (r212484) @@ -88,15 +88,10 @@ ohci_atmelarm_attach(device_t dev) int err; int rid; - /* initialise some bus fields */ - sc->sc_ohci.sc_bus.parent = dev; - sc->sc_ohci.sc_bus.devices = sc->sc_ohci.sc_devices; - sc->sc_ohci.sc_bus.devices_max = OHCI_MAX_DEVICES; - sc->sc_ohci.sc_bus.busmem_func = ohci_iterate_hw_softc; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_ohci.sc_bus, USB_GET_DMA_TAG(dev))) - return (ENOMEM); + err = usb_bus_struct_init(&sc->sc_ohci.sc_bus, dev, + sc->sc_ohci.sc_devices, OHCI_MAX_DEVICES, ohci_iterate_hw_softc); + if (err != 0) + return (err); sc->iclk = at91_pmc_clock_ref("ohci_clk"); sc->fclk = at91_pmc_clock_ref("uhpck"); @@ -212,7 +207,7 @@ ohci_atmelarm_detach(device_t dev) sc->sc_ohci.sc_io_res); sc->sc_ohci.sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_ohci.sc_bus); + usb_bus_struct_fini(&sc->sc_ohci.sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_pci.c Sat Sep 11 23:03:40 2010 (r212484) @@ -217,15 +217,10 @@ ohci_pci_attach(device_t self) int rid; int err; - /* initialise some bus fields */ - sc->sc_bus.parent = self; - sc->sc_bus.devices = sc->sc_devices; - sc->sc_bus.devices_max = OHCI_MAX_DEVICES; - sc->sc_bus.busmem_func = ohci_iterate_hw_softc; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) - return (ENOMEM); + err = usb_bus_struct_init(&sc->sc_bus, self, sc->sc_devices, + OHCI_MAX_DEVICES, ohci_iterate_hw_softc); + if (err != 0) + return (err); sc->sc_dev = self; @@ -377,7 +372,7 @@ ohci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus); + usb_bus_struct_fini(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/ohci_s3c24x0.c Sat Sep 11 23:03:40 2010 (r212484) @@ -81,15 +81,10 @@ ohci_s3c24x0_attach(device_t dev) int err; int rid; - /* initialise some bus fields */ - sc->sc_bus.parent = dev; - sc->sc_bus.devices = sc->sc_devices; - sc->sc_bus.devices_max = OHCI_MAX_DEVICES; - sc->sc_bus.busmem_func = ohci_iterate_hw_softc; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev))) - return (ENOMEM); + err = usb_bus_struct_init(&sc->sc_bus, dev, sc->sc_devices, + OHCI_MAX_DEVICES, ohci_iterate_hw_softc); + if (err != 0) + return (err); sc->sc_dev = dev; @@ -188,7 +183,7 @@ ohci_s3c24x0_detach(device_t dev) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus); + usb_bus_struct_fini(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/uhci_pci.c Sat Sep 11 23:03:40 2010 (r212484) @@ -277,15 +277,11 @@ uhci_pci_attach(device_t self) int rid; int err; - /* initialise some bus fields */ - sc->sc_bus.parent = self; - sc->sc_bus.devices = sc->sc_devices; - sc->sc_bus.devices_max = UHCI_MAX_DEVICES; - sc->sc_bus.busmem_func = uhci_iterate_hw_softc; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self))) - return ENOMEM; + err = usb_bus_struct_init(&sc->sc_bus, self, sc->sc_devices, + UHCI_MAX_DEVICES, uhci_iterate_hw_softc); + if (err != 0) + return (err); + sc->sc_dev = self; pci_enable_busmaster(self); @@ -441,7 +437,7 @@ uhci_pci_detach(device_t self) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus); + usb_bus_struct_fini(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/controller/usb_controller.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/usb_controller.c Sat Sep 11 23:03:40 2010 (r212484) @@ -69,6 +69,7 @@ static device_attach_t usb_attach; static device_detach_t usb_detach; static void usb_attach_sub(device_t, struct usb_bus *); +static void usb_bus_mem_free_all(struct usb_bus *); /* static variables */ @@ -518,31 +519,13 @@ usb_bus_mem_alloc_all_cb(struct usb_bus * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -uint8_t +static uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat) { - bus->alloc_failed = 0; - - mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent), - NULL, MTX_DEF | MTX_RECURSE); - - usb_callout_init_mtx(&bus->power_wdog, &bus->bus_mtx, 0); - - TAILQ_INIT(&bus->intr_q.head); - #if USB_HAVE_BUSDMA usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags, dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX); -#endif - if ((bus->devices_max > USB_MAX_DEVICES) || - (bus->devices_max < USB_MIN_DEVICES) || - (bus->devices == NULL)) { - DPRINTFN(0, "Devices field has not been " - "initialised properly\n"); - bus->alloc_failed = 1; /* failure */ - } -#if USB_HAVE_BUSDMA if (bus->busmem_func != NULL) bus->busmem_func(bus, usb_bus_mem_alloc_all_cb); #endif @@ -567,7 +550,7 @@ usb_bus_mem_free_all_cb(struct usb_bus * /*------------------------------------------------------------------------* * usb_bus_mem_free_all - factored out code *------------------------------------------------------------------------*/ -void +static void usb_bus_mem_free_all(struct usb_bus *bus) { @@ -576,6 +559,45 @@ usb_bus_mem_free_all(struct usb_bus *bus bus->busmem_func(bus, usb_bus_mem_free_all_cb); usb_dma_tag_unsetup(bus->dma_parent_tag); #endif +} + +int +usb_bus_struct_init(struct usb_bus *bus, device_t dev, + struct usb_device **udevs, uint8_t udevsmax, + void (*busmem_func)(struct usb_bus *, usb_bus_mem_callback_t *)) +{ + + if (udevsmax > USB_MAX_DEVICES || udevsmax < USB_MIN_DEVICES || + udevs == NULL) { + DPRINTFN(0, "Devices field has not been " + "initialised properly\n"); + return (ENXIO); + } + + /* initialise some bus fields */ + bus->parent = dev; + bus->devices = udevs; + bus->devices_max = udevsmax; + bus->busmem_func = busmem_func; + bus->alloc_failed = 0; + + mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent), + NULL, MTX_DEF | MTX_RECURSE); + + usb_callout_init_mtx(&bus->power_wdog, &bus->bus_mtx, 0); + + TAILQ_INIT(&bus->intr_q.head); + + /* get all DMA memory */ + if (usb_bus_mem_alloc_all(bus, USB_GET_DMA_TAG(dev))) + return (ENOMEM); + return (0); +} + +void +usb_bus_struct_fini(struct usb_bus *bus) +{ + usb_bus_mem_free_all(bus); mtx_destroy(&bus->bus_mtx); } Modified: user/weongyo/usb/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/controller/uss820dci_atmelarm.c Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/controller/uss820dci_atmelarm.c Sat Sep 11 23:03:40 2010 (r212484) @@ -151,16 +151,11 @@ uss820_atmelarm_attach(device_t dev) int err; int rid; - /* initialise some bus fields */ - sc->sc_bus.parent = dev; - sc->sc_bus.devices = sc->sc_devices; - sc->sc_bus.devices_max = USS820_MAX_DEVICES; - - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, - USB_GET_DMA_TAG(dev), NULL)) { - return (ENOMEM); - } + err = usb_bus_struct_init(&sc->sc_bus, dev, sc->sc_devices, + USS820_MAX_DEVICES, NULL); + if (err != 0) + return (err); + rid = 0; sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); @@ -247,7 +242,7 @@ uss820_atmelarm_detach(device_t dev) sc->sc_io_res); sc->sc_io_res = NULL; } - usb_bus_mem_free_all(&sc->sc_bus, NULL); + usb_bus_struct_fini(&sc->sc_bus); return (0); } Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 22:09:16 2010 (r212483) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 23:03:40 2010 (r212484) @@ -191,9 +191,11 @@ struct usb_temp_setup { /* prototypes */ +int usb_bus_struct_init(struct usb_bus *, device_t, struct usb_device **, + uint8_t, void (*busmem_func)(struct usb_bus *, + usb_bus_mem_callback_t *)); +void usb_bus_struct_fini(struct usb_bus *); void usb_bus_mem_flush_all(struct usb_bus *bus); -uint8_t usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat); -void usb_bus_mem_free_all(struct usb_bus *bus); uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); uint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time); uint8_t usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); From owner-svn-src-user@FreeBSD.ORG Sat Sep 11 23:09:25 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76556106564A; Sat, 11 Sep 2010 23:09:25 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65F758FC1E; Sat, 11 Sep 2010 23:09:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8BN9Ppq053030; Sat, 11 Sep 2010 23:09:25 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BN9PVC053028; Sat, 11 Sep 2010 23:09:25 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009112309.o8BN9PVC053028@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 11 Sep 2010 23:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212485 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 23:09:25 -0000 Author: weongyo Date: Sat Sep 11 23:09:25 2010 New Revision: 212485 URL: http://svn.freebsd.org/changeset/base/212485 Log: style(9) Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h Modified: user/weongyo/usb/sys/dev/usb/usb_controller.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 23:03:40 2010 (r212484) +++ user/weongyo/usb/sys/dev/usb/usb_controller.h Sat Sep 11 23:09:25 2010 (r212485) @@ -191,13 +191,18 @@ struct usb_temp_setup { /* prototypes */ -int usb_bus_struct_init(struct usb_bus *, device_t, struct usb_device **, - uint8_t, void (*busmem_func)(struct usb_bus *, - usb_bus_mem_callback_t *)); -void usb_bus_struct_fini(struct usb_bus *); -void usb_bus_mem_flush_all(struct usb_bus *bus); -uint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); -uint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time); -uint8_t usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); +int usb_bus_struct_init(struct usb_bus *bus, device_t dev, + struct usb_device **udevs, uint8_t udevsmax, + void (*busmem_func)(struct usb_bus *, + usb_bus_mem_callback_t *)); +void usb_bus_struct_fini(struct usb_bus *bus); +void usb_bus_mem_flush_all(struct usb_bus *bus); +uint16_t usb_isoc_time_expand(struct usb_bus *bus, + uint16_t isoc_time_curr); +uint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, + struct usb_fs_isoc_schedule **pp_start, + struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time); +uint8_t usbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, + uint8_t *pstart, uint16_t len); #endif /* _USB_CONTROLLER_H_ */