It sure helped with the panic. Now it get unresponsive for about 2 min then I get the print-out below, all at once and then it unfreezes.

bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
bge0: PHY read timed out
brgphy0 detached
bge0 detached
bge0 at pci5 dev 0 function 0 "Broadcom BCM5787M" rev 0x02, BCM5754/5787 A2 (0xb002): apic 1 int 17 (irq 11), address 00:24:81:44:b2:b5
brgphy0 at bge0 phy 1: BCM5787 10/100/1000baseT PHY, rev. 0

/Markus

On 11/28/10 15:04, Jonathan Gray wrote:
On Sun, Nov 28, 2010 at 02:12:44PM +0100, Markus Bergkvist wrote:
I get the panic when unplugging either AC or bge0. The panic, trace
and ps are the same regardless of unplugging AC or bge0, but `mach
ddbcpu 1` fills the console with 'bge0: PHY read timed out' when
unplugging bge0.

This is a HP 6730b, -current, clean install. Anyone who can help me?
Should I file a PR?

This is because there is currently no detach hook for bge, try this:

Index: if_bge.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.303
diff -u -p -r1.303 if_bge.c
--- if_bge.c    20 Sep 2010 07:40:38 -0000      1.303
+++ if_bge.c    28 Nov 2010 14:01:37 -0000
@@ -127,10 +127,12 @@
  const struct bge_revision * bge_lookup_rev(u_int32_t);
  int bge_probe(struct device *, void *, void *);
  void bge_attach(struct device *, struct device *, void *);
+int bge_detach(struct device *, int);
  int bge_activate(struct device *, int);

  struct cfattach bge_ca = {
-       sizeof(struct bge_softc), bge_probe, bge_attach, NULL, bge_activate
+       sizeof(struct bge_softc), bge_probe, bge_attach, bge_detach,
+       bge_activate
  };

  struct cfdriver bge_cd = {
@@ -1797,7 +1799,6 @@ bge_attach(struct device *parent, struct
        pcireg_t                pm_ctl, memtype, subid;
        pci_intr_handle_t       ih;
        const char              *intrstr = NULL;
-       bus_size_t              size;
        bus_dma_segment_t       seg;
        int                     rseg, gotenaddr = 0;
        u_int32_t               hwcfg = 0;
@@ -1821,7 +1822,7 @@ bge_attach(struct device *parent, struct
        DPRINTFN(5, ("pci_mapreg_map\n"));
        memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, BGE_PCI_BAR0);
        if (pci_mapreg_map(pa, BGE_PCI_BAR0, memtype, 0,&sc->bge_btag,
-       &sc->bge_bhandle, NULL,&size, 0)) {
+       &sc->bge_bhandle, NULL,&sc->bge_size, 0)) {
                printf(": can't find mem space\n");
                return;
        }
@@ -2215,6 +2216,7 @@ bge_attach(struct device *parent, struct
                printf("\n");
                goto fail_5;
        }
+       sc->bge_pc = pa->pa_pc;

        /*
         * A Broadcom chip was detected. Inform the world.
@@ -2280,7 +2282,31 @@ fail_2:
        bus_dmamem_free(sc->bge_dmatag,&seg, rseg);

  fail_1:
-       bus_space_unmap(sc->bge_btag, sc->bge_bhandle, size);
+       bus_space_unmap(sc->bge_btag, sc->bge_bhandle, sc->bge_size);
+}
+
+int
+bge_detach(struct device *self, int flags)
+{
+       struct bge_softc *sc = (struct bge_softc *)self;
+       struct ifnet *ifp =&sc->arpcom.ac_if;
+
+       pci_intr_disestablish(sc->bge_pc, sc->bge_intrhand);
+
+       bge_stop(sc);
+
+       /* Detach all PHYs */
+       mii_detach(&sc->bge_mii, MII_PHY_ANY, MII_OFFSET_ANY);
+
+       /* Delete any remaining media. */
+       ifmedia_delete_instance(&sc->bge_mii.mii_media, IFM_INST_ANY);
+
+       ether_ifdetach(ifp);
+       if_detach(ifp);
+
+       bus_space_unmap(sc->bge_btag, sc->bge_bhandle, sc->bge_size);
+
+       return (0);
  }

  int
Index: if_bgereg.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bgereg.h,v
retrieving revision 1.103
diff -u -p -r1.103 if_bgereg.h
--- if_bgereg.h 20 Sep 2010 07:40:38 -0000      1.103
+++ if_bgereg.h 28 Nov 2010 14:01:38 -0000
@@ -2578,6 +2578,7 @@ struct bge_softc {
        struct arpcom           arpcom;         /* interface info */
        bus_space_handle_t      bge_bhandle;
        bus_space_tag_t         bge_btag;
+       bus_size_t              bge_size;
        void                    *bge_intrhand;
        struct pci_attach_args  bge_pa;
        struct mii_data         bge_mii;
@@ -2611,6 +2612,7 @@ struct bge_softc {
  #define BGE_5700_FAMILY               0x02000000

        bus_dma_tag_t           bge_dmatag;
+       pci_chipset_tag_t       bge_pc;
        u_int32_t               bge_chipid;
        struct bge_ring_data    *bge_rdata;     /* rings */
        struct bge_chain_data   bge_cdata;      /* mbufs */

Reply via email to