Ticket #1590: if_bge.diff

File if_bge.diff, 3.1 KB (added by PieterPanman, 16 years ago)
  • add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/glue.c

     
    55
    66
    77#include <sys/bus.h>
     8#include "if_bgereg.h"
    89
    910
    1011HAIKU_FBSD_DRIVER_GLUE(broadcom_bcm570x, bge, pci);
     
    2526    return __haiku_probe_miibus(dev, drivers);
    2627}
    2728
     29int
     30__haiku_disable_interrupts(device_t dev)
     31{
     32    // Honestly, I don't know if this is correct.
     33    // I just copied it from if_bge searching for disable interrupts
     34    struct bge_softc *sc = device_get_softc(dev);
     35    BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);
     36    CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1);
     37
     38    // TODO: should we check if this succeeded and return appropriately?
     39    return 1;
     40}
     41
     42
     43void
     44__haiku_reenable_interrupts(device_t dev)
     45{
     46    // Honestly, I don't know if this is correct.
     47    // I just copied it from if_bge searching for enable interrupts
     48    struct bge_softc *sc = device_get_softc(dev);
     49    BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);
     50    CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0);
     51}
  • libs/compat/freebsd_network/compat/sys/mbuf.h

     
    8282
    8383#define M_BCAST         0x00000200
    8484#define M_MCAST         0x00000400
     85#define M_FRAG          0x00000800
     86#define M_FIRSTFRAG     0x00001000
     87#define M_LASTFRAG      0x00002000
    8588#define M_VLANTAG       0x00010000
    8689
    8790#define CSUM_IP         0x0001
     
    124127struct mbuf *m_get(int how, short type);
    125128struct mbuf *m_gethdr(int how, short type);
    126129void m_clget(struct mbuf *m, int how);
     130void * m_cljget(struct mbuf *m, int how, int size);
    127131
    128132void m_extadd(struct mbuf *m, caddr_t buffer, u_int size,
    129133    void (*freeHook)(void *, void *), void *args, int flags, int type);
  • libs/compat/freebsd_network/mbuf.c

     
    150150    construct_ext_mbuf(m, how);
    151151}
    152152
     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 */
     161void *
     162m_cljget(struct mbuf *m, int how, int size)
     163{
     164    // TODO: implement this
     165    panic("m_cljget not yet implemented");
     166    return (void *) NULL;
    153167
     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
    154183void
    155184m_freem(struct mbuf *mb)
    156185{