Ticket #1590: if_bge.fix.diff

File if_bge.fix.diff, 3.1 KB (added by Adek336, 16 years ago)

fix

  • if_bge.

    old new  
    378384static int bge_has_eaddr(struct bge_softc *);
    379385static uint32_t bge_readmem_ind(struct bge_softc *, int);
    380386static void bge_writemem_ind(struct bge_softc *, int, int);
    381 static void bge_writembx(struct bge_softc *, int, int);
     387//used in glue.c
     388void bge_writembx(struct bge_softc *, int, int);
    382389#ifdef notdef
    383390static uint32_t bge_readreg_ind(struct bge_softc *, int);
    384391#endif
     
    553559    CSR_WRITE_4(sc, off, val);
    554560}
    555561
    556 static void
     562void
    557563bge_writembx(struct bge_softc *sc, int off, int val)
    558564{
    559565    if (sc->bge_asicrev == BGE_ASICREV_BCM5906)
    (this hunk was shorter than expected)  
    23582364    u_char eaddr[ETHER_ADDR_LEN];
    23592365    int error, reg, rid, trys;
    23602366
    23612367    sc = device_get_softc(dev);
    23622368    sc->bge_dev = dev;
     2369    sc->transmitting = 0;
    23632370
    23642371    /*
    23652372     * Map control/status registers.
    23662373
    (this hunk was shorter than expected)  
    33153332     * the status check).  So toggling would probably be a pessimization
    33163333     * even with MSI.  It would only be needed for using a task queue.
    33173334     */
     3335#ifndef __HAIKU__
    33183336    bge_writembx(sc, BGE_MBX_IRQ0_LO, 0);
     3337#endif
    33193338
    33203339    /*
    33213340     * Do the mandatory PCI flush as well as get the link status.
    33223341     */
    3323     statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED;
     3342#ifndef __HAIKU__
     3343        statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED;
     3344#else
     3345        /* Get the statusword as saved in __haiku_disable_interrupts
     3346         * and clear the saved value */
     3347        statusword = atomic_and((int32 *)&sc->bge_intr_status, 0) & BGE_MACSTAT_LINK_CHANGED;
     3348#endif
    33243349
    33253350    /* Make sure the descriptor ring indexes are coherent. */
    33263351    bus_dmamap_sync(sc->bge_cdata.bge_status_tag,
     
    33283355    bus_dmamap_sync(sc->bge_cdata.bge_status_tag,
    33293356        sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD);
    33303357
     3358        /* TODO: bge_link_upd is probably not correct with interrupt changes
     3359         * May need to also use the saved statusword... */
    33313360    if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 &&
    33323361        sc->bge_chipid != BGE_CHIPID_BCM5700_B2) ||
    33333362        statusword || sc->bge_link_evt)
     
    35413570    error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag, map, m, segs,
    35423571        &nsegs, BUS_DMA_NOWAIT);
    35433572    if (error == EFBIG) {
    3544         m = m_collapse(m, M_DONTWAIT, BGE_NSEG_NEW);
     3573        //m = m_collapse(m, M_DONTWAIT, BGE_NSEG_NEW);
     3574        panic("m_collapse not implemented");
    35453575        if (m == NULL) {
    35463576            m_freem(*m_head);
    35473577            *m_head = NULL;
    (this hunk was shorter than expected)  
    36313661    uint32_t prodidx;
    36323662    int count = 0;
    36333663
    36343664    sc = ifp->if_softc;
    36353665
    3636     if (!sc->bge_link || IFQ_DRV_IS_EMPTY(&ifp->if_snd))
     3666    if (IFQ_DRV_IS_EMPTY(&ifp->if_snd))
    36373667        return;
    36383668
    36393669    prodidx = sc->bge_tx_prodidx;
    36403670
    36413671    while(sc->bge_cdata.bge_tx_chain[prodidx] == NULL) {
    (this hunk was shorter than expected)  
    36953730        /* No packets were dequeued. */
    36963731        return;
    36973732
     3733    sc -> transmitting = 1;
    36983734    /* Transmit. */
    36993735    bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx);
    37003736    /* 5700 b2 errata */
     
    42524291         */
    42534292        if (mii != NULL) {
    42544293            ifm = mii->mii_media.ifm_cur;
     4294            if (ifm == NULL)
     4295            {
     4296                panic("bge_stop: ifm == NULL");
     4297                return ;
     4298            }
    42554299            mtmp = ifm->ifm_media;
    42564300            ifm->ifm_media = IFM_ETHER | IFM_NONE;
    42574301            mii_mediachg(mii);