Ticket #1590: bge_2.diff
File bge_2.diff, 5.9 KB (added by , 16 years ago) |
---|
-
build/jam/HaikuImage
134 134 $(X86_ONLY)rtl8139 rtl8169 sis900 $(X86_ONLY)via_rhine wb840 135 135 $(X86_ONLY)ipro100 $(X86_ONLY)nforce #vlance 136 136 $(X86_ONLY)marvell_yukon $(X86_ONLY)syskonnect usb_ecm 137 $(GPL_ONLY)bcm440x $(GPL_ONLY)bcm570x 137 $(GPL_ONLY)bcm440x $(GPL_ONLY)bcm570x broadcom_bcm570x 138 138 ; 139 139 #BEOS_ADD_ONS_DRIVERS_ACPI = $(X86_ONLY)acpi_button ; 140 140 BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)ps2 $(X86_ONLY)isa ide scsi -
src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/if_bgereg.h
2506 2506 #ifdef DEVICE_POLLING 2507 2507 int rxcycles; 2508 2508 #endif /* DEVICE_POLLING */ 2509 #ifdef __HAIKU__ 2510 u_int32_t bge_intr_status; 2511 #endif 2509 2512 }; 2510 2513 2511 2514 #define BGE_LOCK_INIT(_sc, _name) \ -
src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/if_bge.c
3168 3168 * the status check). So toggling would probably be a pessimization 3169 3169 * even with MSI. It would only be needed for using a task queue. 3170 3170 */ 3171 #ifndef __HAIKU__ 3172 // already done in __haiku_disable_interrupts 3171 3173 CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); 3172 3174 #endif 3173 3175 /* 3174 3176 * Do the mandatory PCI flush as well as get the link status. 3175 3177 */ 3178 #ifndef __HAIKU__ 3176 3179 statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; 3180 #else 3181 /* Get the statusword as saved in __haiku_disable_interrupts 3182 * and clear the saved value */ 3183 statusword = atomic_and((int32 *)&sc->bge_intr_status, 0); 3184 #endif 3177 3185 3178 3186 /* Make sure the descriptor ring indexes are coherent. */ 3179 3187 bus_dmamap_sync(sc->bge_cdata.bge_status_tag, … … 3181 3189 bus_dmamap_sync(sc->bge_cdata.bge_status_tag, 3182 3190 sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD); 3183 3191 3192 /* TODO: bge_link_upd is probably not correct with interrupt changes 3193 * May need to also use the saved statusword... */ 3184 3194 if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && 3185 3195 sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || 3186 3196 statusword || sc->bge_link_evt) -
src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/glue.c
5 5 6 6 7 7 #include <sys/bus.h> 8 #include "if_bgereg.h" 8 9 9 10 10 11 HAIKU_FBSD_DRIVER_GLUE(broadcom_bcm570x, bge, pci); … … 25 26 return __haiku_probe_miibus(dev, drivers); 26 27 } 27 28 29 int 30 __haiku_disable_interrupts(device_t dev) 31 { 32 struct bge_softc *sc = device_get_softc(dev); 33 34 // Obtain the status and return 0 if the bge did not set the intr 35 u_int32_t status = CSR_READ_4(sc, BGE_MAC_STS); 36 if ((status & BGE_MACSTAT_MI_INTERRUPT) == 0) { 37 return 0; 38 } 39 40 // Clear the interrupt, the bge intr handler will take care of it 41 BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); 42 CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); 43 44 // save the status for the interrupt handler 45 atomic_or((int32 *)&sc->bge_intr_status, status); 46 return 1; 47 } 48 49 50 void 51 __haiku_reenable_interrupts(device_t dev) 52 { 53 // Honestly, I don't know if this is correct. 54 // I just copied it from if_bge searching for enable interrupts 55 struct bge_softc *sc = device_get_softc(dev); 56 BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA); 57 BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); 58 CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); 59 } -
src/libs/compat/freebsd_network/compat/sys/mbuf.h
82 82 83 83 #define M_BCAST 0x00000200 84 84 #define M_MCAST 0x00000400 85 #define M_FRAG 0x00000800 86 #define M_FIRSTFRAG 0x00001000 87 #define M_LASTFRAG 0x00002000 85 88 #define M_VLANTAG 0x00010000 86 89 87 90 #define CSUM_IP 0x0001 … … 124 127 struct mbuf *m_get(int how, short type); 125 128 struct mbuf *m_gethdr(int how, short type); 126 129 void m_clget(struct mbuf *m, int how); 130 void * m_cljget(struct mbuf *m, int how, int size); 127 131 128 132 void m_extadd(struct mbuf *m, caddr_t buffer, u_int size, 129 133 void (*freeHook)(void *, void *), void *args, int flags, int type); -
src/libs/compat/freebsd_network/mbuf.c
150 150 construct_ext_mbuf(m, how); 151 151 } 152 152 153 /* 154 * Comment from the freebsd (mbuf.h): 155 * m_cljget() is different from m_clget() as it can allocate clusters without 156 * attaching them to an mbuf. In that case the return value is the pointer 157 * to the cluster of the requested size. If an mbuf was specified, it gets 158 * the cluster attached to it and the return value can be safely ignored. 159 * For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES. 160 */ 161 void * 162 m_cljget(struct mbuf *m, int how, int size) 163 { 164 // TODO: implement this 165 panic("m_cljget not yet implemented"); 166 return (void *) NULL; 153 167 168 /* 169 // This is the freebsd code 170 uma_zone_t zone; 171 172 if (m && m->m_flags & M_EXT) 173 printf("%s: %p mbuf already has cluster\n", __func__, m); 174 if (m != NULL) 175 m->m_ext.ext_buf = NULL; 176 177 zone = m_getzone(size); 178 return (uma_zalloc_arg(zone, m, how)); 179 */ 180 } 181 182 154 183 void 155 184 m_freem(struct mbuf *mb) 156 185 {