From d8d2506553cf0bb01f07642d75cc7b73a0950cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 11 Nov 2008 13:31:28 +0000 Subject: [PATCH] filled glue holes to have broadcom570x compiles, reusing part of patches posted on bug #1590. Obviously untested. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28604 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/broadcom570x/dev/bge/glue.c | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c b/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c index f7c447d325..ecbf983bfe 100644 --- a/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c +++ b/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c @@ -4,8 +4,11 @@ */ +#include #include +#include +#include "if_bgereg.h" HAIKU_FBSD_DRIVER_GLUE(broadcom570x, bge, pci); HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE); @@ -25,3 +28,41 @@ __haiku_select_miibus_driver(device_t dev) return __haiku_probe_miibus(dev, drivers); } + +// copied from if_bge.c +static void +bge_writembx(struct bge_softc *sc, int off, int val) +{ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI; + + CSR_WRITE_4(sc, off, val); +} + + +int +__haiku_disable_interrupts(device_t dev) +{ + struct bge_softc *sc = device_get_softc(dev); + + uint32 statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; + + if ((sc->bge_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 && !statusword + && (pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE,4) & BGE_PCISTATE_INTR_STATE)) + return 0; + + BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); + + return 1; +} + + +void +__haiku_reenable_interrupts(device_t dev) +{ + struct bge_softc *sc = device_get_softc(dev); + BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA); + BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); +}