Ticket #1590: if_bge.fix.diff
File if_bge.fix.diff, 3.1 KB (added by , 16 years ago) |
---|
-
if_bge.
old new 378 384 static int bge_has_eaddr(struct bge_softc *); 379 385 static uint32_t bge_readmem_ind(struct bge_softc *, int); 380 386 static void bge_writemem_ind(struct bge_softc *, int, int); 381 static void bge_writembx(struct bge_softc *, int, int); 387 //used in glue.c 388 void bge_writembx(struct bge_softc *, int, int); 382 389 #ifdef notdef 383 390 static uint32_t bge_readreg_ind(struct bge_softc *, int); 384 391 #endif … … 553 559 CSR_WRITE_4(sc, off, val); 554 560 } 555 561 556 staticvoid562 void 557 563 bge_writembx(struct bge_softc *sc, int off, int val) 558 564 { 559 565 if (sc->bge_asicrev == BGE_ASICREV_BCM5906) … … (this hunk was shorter than expected) 2358 2364 u_char eaddr[ETHER_ADDR_LEN]; 2359 2365 int error, reg, rid, trys; 2360 2366 2361 2367 sc = device_get_softc(dev); 2362 2368 sc->bge_dev = dev; 2369 sc->transmitting = 0; 2363 2370 2364 2371 /* 2365 2372 * Map control/status registers. 2366 2373 … … (this hunk was shorter than expected) 3315 3332 * the status check). So toggling would probably be a pessimization 3316 3333 * even with MSI. It would only be needed for using a task queue. 3317 3334 */ 3335 #ifndef __HAIKU__ 3318 3336 bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); 3337 #endif 3319 3338 3320 3339 /* 3321 3340 * Do the mandatory PCI flush as well as get the link status. 3322 3341 */ 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 3324 3349 3325 3350 /* Make sure the descriptor ring indexes are coherent. */ 3326 3351 bus_dmamap_sync(sc->bge_cdata.bge_status_tag, … … 3328 3355 bus_dmamap_sync(sc->bge_cdata.bge_status_tag, 3329 3356 sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD); 3330 3357 3358 /* TODO: bge_link_upd is probably not correct with interrupt changes 3359 * May need to also use the saved statusword... */ 3331 3360 if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && 3332 3361 sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || 3333 3362 statusword || sc->bge_link_evt) … … 3541 3570 error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag, map, m, segs, 3542 3571 &nsegs, BUS_DMA_NOWAIT); 3543 3572 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"); 3545 3575 if (m == NULL) { 3546 3576 m_freem(*m_head); 3547 3577 *m_head = NULL; … … (this hunk was shorter than expected) 3631 3661 uint32_t prodidx; 3632 3662 int count = 0; 3633 3663 3634 3664 sc = ifp->if_softc; 3635 3665 3636 if ( !sc->bge_link ||IFQ_DRV_IS_EMPTY(&ifp->if_snd))3666 if (IFQ_DRV_IS_EMPTY(&ifp->if_snd)) 3637 3667 return; 3638 3668 3639 3669 prodidx = sc->bge_tx_prodidx; 3640 3670 3641 3671 while(sc->bge_cdata.bge_tx_chain[prodidx] == NULL) { … … (this hunk was shorter than expected) 3695 3730 /* No packets were dequeued. */ 3696 3731 return; 3697 3732 3733 sc -> transmitting = 1; 3698 3734 /* Transmit. */ 3699 3735 bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); 3700 3736 /* 5700 b2 errata */ … … 4252 4291 */ 4253 4292 if (mii != NULL) { 4254 4293 ifm = mii->mii_media.ifm_cur; 4294 if (ifm == NULL) 4295 { 4296 panic("bge_stop: ifm == NULL"); 4297 return ; 4298 } 4255 4299 mtmp = ifm->ifm_media; 4256 4300 ifm->ifm_media = IFM_ETHER | IFM_NONE; 4257 4301 mii_mediachg(mii);