Ticket #1590: against-28608.diff
File against-28608.diff, 9.4 KB (added by , 15 years ago) |
---|
-
build/jam/HaikuImage
142 142 $(X86_ONLY)via_rhine wb840 $(X86_ONLY)ipro100 $(X86_ONLY)nforce 143 143 #vlance 144 144 $(X86_ONLY)marvell_yukon $(X86_ONLY)syskonnect usb_ecm 145 $(GPL_ONLY)bcm570x145 broadcom570x 146 146 ; 147 147 #BEOS_ADD_ONS_DRIVERS_ACPI = $(X86_ONLY)acpi_button ; 148 148 BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)ps2 $(X86_ONLY)isa ide scsi -
src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h
2578 2578 #ifdef DEVICE_POLLING 2579 2579 int rxcycles; 2580 2580 #endif /* DEVICE_POLLING */ 2581 u_int32_t bge_intr_status; 2582 int bge_transmitting; 2581 2583 }; 2582 2584 2583 2585 #define BGE_LOCK_INIT(_sc, _name) \ -
src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c
398 398 static void bge_sig_legacy(struct bge_softc *, int); 399 399 static void bge_sig_pre_reset(struct bge_softc *, int); 400 400 static int bge_reset(struct bge_softc *); 401 staticvoid bge_link_upd(struct bge_softc *);401 /*static*/ void bge_link_upd(struct bge_softc *); 402 402 403 403 /* 404 404 * The BGE_REGISTER_DEBUG option is only for low-level debugging. It may … … 2361 2361 2362 2362 sc = device_get_softc(dev); 2363 2363 sc->bge_dev = dev; 2364 sc->bge_transmitting = 0; 2364 2365 2365 2366 /* 2366 2367 * Map control/status registers. … … 3026 3027 sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx) 3027 3028 return; 3028 3029 3030 dprintf("bge_rxeof\n"); 3031 3029 3032 ifp = sc->bge_ifp; 3030 3033 3031 3034 bus_dmamap_sync(sc->bge_cdata.bge_rx_return_ring_tag, … … 3194 3197 sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx) 3195 3198 return; 3196 3199 3200 dprintf("bge_txeof\n"); 3201 3197 3202 ifp = sc->bge_ifp; 3198 3203 3199 3204 bus_dmamap_sync(sc->bge_cdata.bge_tx_ring_tag, … … 3281 3286 3282 3287 sc = xsc; 3283 3288 3289 dprintf("bge_intr, sc->bge_intr_status=0x%x\n", sc->bge_intr_status); 3290 3284 3291 BGE_LOCK(sc); 3285 3292 3286 3293 ifp = sc->bge_ifp; … … 3312 3319 * the status check). So toggling would probably be a pessimization 3313 3320 * even with MSI. It would only be needed for using a task queue. 3314 3321 */ 3322 #ifndef __HAIKU__ 3315 3323 bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); 3324 #endif 3316 3325 3317 3326 /* 3318 3327 * Do the mandatory PCI flush as well as get the link status. 3319 3328 */ 3320 statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; 3329 #ifdef __HAIKU__ 3330 /* Get the statusword as saved in __haiku_disable_interrupts 3331 * and clear the saved value */ 3332 statusword = atomic_and((int32 *)&sc->bge_intr_status, 0) & BGE_MACSTAT_LINK_CHANGED; 3333 #else 3334 statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; 3335 #endif 3321 3336 3322 3337 /* Make sure the descriptor ring indexes are coherent. */ 3323 3338 bus_dmamap_sync(sc->bge_cdata.bge_status_tag, … … 3325 3340 bus_dmamap_sync(sc->bge_cdata.bge_status_tag, 3326 3341 sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD); 3327 3342 3328 if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && 3329 sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || 3330 statusword || sc->bge_link_evt) 3331 bge_link_upd(sc); 3343 /* TODO: bge_link_upd is probably not correct with interrupt changes 3344 * May need to also use the saved statusword... */ 3345 //FIXME: moved to glue.c, probably safe to remove 3346 //if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && 3347 // sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || 3348 // statusword || sc->bge_link_evt) 3349 // bge_link_upd(sc); 3332 3350 3333 3351 if (ifp->if_drv_flags & IFF_DRV_RUNNING) { 3334 3352 /* Check RX return ring producer/consumer. */ … … 3634 3652 3635 3653 sc = ifp->if_softc; 3636 3654 3637 if (!sc->bge_link || IFQ_DRV_IS_EMPTY(&ifp->if_snd)) 3655 //FIXME: sc->bge_link isn't being properly set in bge_link_upd 3656 //if (!sc->bge_link || IFQ_DRV_IS_EMPTY(&ifp->if_snd)) 3657 if (IFQ_DRV_IS_EMPTY(&ifp->if_snd)) 3638 3658 return; 3639 3659 3640 3660 prodidx = sc->bge_tx_prodidx; … … 3696 3716 /* No packets were dequeued. */ 3697 3717 return; 3698 3718 3719 sc -> bge_transmitting = 1; 3699 3720 /* Transmit. */ 3700 3721 bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); 3701 3722 /* 5700 b2 errata */ … … 4253 4275 */ 4254 4276 if (mii != NULL) { 4255 4277 ifm = mii->mii_media.ifm_cur; 4278 if (ifm == NULL) 4279 { 4280 panic("bge_stop: ifm == NULL"); 4281 return ; 4282 } 4256 4283 mtmp = ifm->ifm_media; 4257 4284 ifm->ifm_media = IFM_ETHER | IFM_NONE; 4258 4285 mii_mediachg(mii); … … 4320 4347 return (0); 4321 4348 } 4322 4349 4323 staticvoid4350 /*static*/ void 4324 4351 bge_link_upd(struct bge_softc *sc) 4325 4352 { 4326 4353 struct mii_data *mii; … … 4402 4429 * in status word always set. Workaround this bug by reading 4403 4430 * PHY link status directly. 4404 4431 */ 4432 #define lnDbg do {printf("%s: %s: %d\n", __FILE__,__func__, __LINE__); } while(0) 4433 lnDbg; 4434 printf("bge: bge\n"); 4405 4435 link = (CSR_READ_4(sc, BGE_MI_STS) & BGE_MISTS_LINK) ? 1 : 0; 4406 4436 4407 4437 if (link != sc->bge_link || 4408 4438 sc->bge_asicrev == BGE_ASICREV_BCM5700) { 4439 lnDbg; 4409 4440 mii = device_get_softc(sc->bge_miibus); 4410 4441 mii_pollstat(mii); 4411 4442 if (!sc->bge_link && 4412 4443 mii->mii_media_status & IFM_ACTIVE && 4413 4444 IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { 4445 lnDbg; 4414 4446 sc->bge_link++; 4415 4447 if (bootverbose) 4416 4448 if_printf(sc->bge_ifp, "link UP\n"); … … 4433 4465 CSR_WRITE_4(sc, BGE_MAC_STS, BGE_MACSTAT_SYNC_CHANGED | 4434 4466 BGE_MACSTAT_CFG_CHANGED | BGE_MACSTAT_MI_COMPLETE | 4435 4467 BGE_MACSTAT_LINK_CHANGED); 4468 4469 dprintf("bge_link_upd, sc->bge_link=0x%x\n", sc->bge_link); 4436 4470 } 4437 4471 4438 4472 #define BGE_SYSCTL_STAT(sc, ctx, desc, parent, node, oid) \ -
src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c
28 28 return __haiku_probe_miibus(dev, drivers); 29 29 } 30 30 31 int 32 __haiku_disable_interrupts(device_t dev) 33 { 34 struct bge_softc *sc = device_get_softc(dev); 35 36 // Obtain the status and return 0 if the bge did not set the intr 37 u_int32_t status = CSR_READ_4(sc, BGE_MAC_STS); 38 // status & 0x1000 for media change, sc->transmitting if sending a packet 39 // use BGE_PCI_PCISTATE to check interrupt source like in the Linux driver 40 if ( ((status & 0x1000)==0)&&(sc->bge_transmitting==0) && ((pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE,4) & BGE_PCISTATE_INTR_STATE) != 0)) { 41 return 0; 42 } 43 sc->bge_transmitting=0; 44 45 // Clear the interrupt, the bge intr handler will take care of it 46 BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); 47 bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); 48 49 // save the status for the interrupt handler 50 atomic_or((int32 *)&sc->bge_intr_status, status); 51 // *** 52 if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && 53 sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || 54 (status&0x1000) || sc->bge_link_evt) 55 bge_link_upd(sc); 56 // *** 57 return 1; 58 } 59 //int 60 //__haiku_disable_interrupts(device_t dev) 61 //{ 62 // struct bge_softc *sc = device_get_softc(dev); 63 // 64 // uint32 statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; 65 // 66 // if ((sc->bge_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 && !statusword 67 // && (pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE,4) & BGE_PCISTATE_INTR_STATE)) 68 // return 0; 69 // 70 // BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); 71 // bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); 72 // 73 // return 1; 74 //} 75 31 76 32 77 // copied from if_bge.c 33 78 static void … … 39 84 CSR_WRITE_4(sc, off, val); 40 85 } 41 86 42 43 int 44 __haiku_disable_interrupts(device_t dev) 87 void 88 __haiku_reenable_interrupts(device_t dev) 45 89 { 46 struct bge_softc *sc = device_get_softc(dev); 90 struct bge_softc *sc = device_get_softc(dev); 91 BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA); 92 BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); 93 bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); 94 } 47 95 48 uint32 statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED;49 50 if ((sc->bge_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 && !statusword51 && (pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE,4) & BGE_PCISTATE_INTR_STATE))52 return 0;53 54 BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);55 bge_writembx(sc, BGE_MBX_IRQ0_LO, 1);56 57 return 1;58 }59 60 61 void62 __haiku_reenable_interrupts(device_t dev)63 {64 struct bge_softc *sc = device_get_softc(dev);65 BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA);66 BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);67 bge_writembx(sc, BGE_MBX_IRQ0_LO, 0);68 } -
src/libs/compat/freebsd_network/fbsd_mii_physubr.c
510 510 } 511 511 512 512 if (sc->mii_capabilities & BMSR_ANEG) { 513 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 514 MII_NMEDIA); /* intentionally invalid index */ 513 dprintf("don't know how to handle sc->mii_capabilities & BMSR_ANEG\n"); 514 //ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 515 //MII_NMEDIA); /* intentionally invalid index */ 515 516 PRINT("auto"); 516 517 } 517 518 #undef ADD