Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
On Wed, Aug 30, 2006 at 12:23:20PM +0900, Ganbold wrote: Hi, Thanks a lot for your patch. Your patch fixes panic, however I still see bge0: firmware handshake timed out bge0: link state changed to DOWN messages. When I tried to use Oleg's if_bge.c, rev. 1.140 in STABLE buildkernel stops: mkdep -f .depend -a -nostdinc -D_KERNEL -DKLD_MODULE -I- -DHAVE_KERNEL_OPTION_HEADERS -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include -I/usr/obj/usr/src/sys/DEVIL /usr/src/sys/modules/bge/../../dev/bge/if_bge.c /usr/src/sys/modules/bge/../../dev/bge/if_bge.c:2570:35: macro VLAN_INPUT_TAG requires 4 arguments, but only 3 given mkdep: compile failed *** Error code 1 1 error *** Error code 2 1 error *** Error code 2 mkdep: compile failed *** Error code 1 2 errors *** Error code 2 1 error *** Error code 2 1 error I see VLAN_INPUT_TAG is defined as VLAN_INPUT_TAG(_ifp, _m, _t, _errcase) in if_vlan_var.h, rev v 1.21.2.2 with 4 arguments, however new if_bge.c, rev. 1.140 uses 3 arguments. Is it safe to use if_vlan_var.h, rev 1.24 and if_vlan.c, rev 1.114 only? What other patches should I use? When all these changes MFC to STABLE? You should use VLAN_INPUT_TAG_NEW macro in RELENG_6. Anyway, here is guess work for BCM5752(obtained from OpenBSD). Because I don't have 5752 hardware I don't know whether it works or not. The patch is for RELENG_6(You need brgphy(4) patch too). thanks, Ganbold Pyun YongHyeon wrote: I think your PHY was not recognized by brgphy(4). But I don't know it fixes firmware handshake timed out issue you've seen. Recently oleg fixed a long standing bug in bge(4). So you may also want to merge the change.(See if_bge.c, rev. 1.140) Patch generated against RELENG_6(compile tested only). -- Regards, Pyun YongHyeon Index: if_bge.c === RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.91.2.16 diff -u -r1.91.2.16 if_bge.c --- if_bge.c10 Aug 2006 11:02:14 - 1.91.2.16 +++ if_bge.c30 Aug 2006 07:20:43 - @@ -1007,9 +1007,26 @@ /* Set up the PCI DMA control register. */ if (sc-bge_pcie) { /* PCI Express bus */ - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | - (0xf BGE_PCIDMARWCTL_RD_WAT_SHIFT) | - (0x2 BGE_PCIDMARWCTL_WR_WAT_SHIFT); + uint32_t device_ctl; + + /* alternative from Linux driver */ +#define DMA_CTRL_WRITE_PCIE_H20MARK_1280x0018 +#define DMA_CTRL_WRITE_PCIE_H20MARK_2560x0038 + + dma_rw_ctl = 0x7600; /* XXX XXX XXX */; + device_ctl = pci_read_config(sc-bge_dev, + BGE_PCI_CONF_DEV_CTRL, 4); + if ((device_ctl 0x00e0) 0) { + /* +* This clause is exactly what the Broadcom-supplied +* Linux does; but given overall register programming +* by bge(4), this larger DMA-write watermark +* value causes BCM5721 chips to totally wedge. +*/ + dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_256; + } else { + dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_128; + } } else if (sc-bge_pcix) { /* PCI-X bus */ if (BGE_IS_5714_FAMILY(sc)) { @@ -1148,22 +1165,20 @@ CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10); /* Enable buffer manager */ - if (!(BGE_IS_5705_OR_BEYOND(sc))) { - CSR_WRITE_4(sc, BGE_BMAN_MODE, - BGE_BMANMODE_ENABLE|BGE_BMANMODE_LOMBUF_ATTN); + CSR_WRITE_4(sc, BGE_BMAN_MODE, + BGE_BMANMODE_ENABLE|BGE_BMANMODE_LOMBUF_ATTN); - /* Poll for buffer manager start indication */ - for (i = 0; i BGE_TIMEOUT; i++) { - if (CSR_READ_4(sc, BGE_BMAN_MODE) BGE_BMANMODE_ENABLE) - break; - DELAY(10); - } + /* Poll for buffer manager start indication */ + for (i = 0; i BGE_TIMEOUT; i++) { + if (CSR_READ_4(sc, BGE_BMAN_MODE) BGE_BMANMODE_ENABLE) + break; + DELAY(10); + } - if (i == BGE_TIMEOUT) { - device_printf(sc-bge_dev, - buffer manager failed to start\n); - return (ENXIO); - } + if (i == BGE_TIMEOUT) { + device_printf(sc-bge_dev, + buffer manager failed to start\n); + return (ENXIO); } /* Enable flow-through queues */ Index: if_bgereg.h === RCS file:
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
Pyun YongHyeon wrote: On Wed, Aug 30, 2006 at 12:23:20PM +0900, Ganbold wrote: Hi, Thanks a lot for your patch. Your patch fixes panic, however I still see bge0: firmware handshake timed out bge0: link state changed to DOWN messages. When I tried to use Oleg's if_bge.c, rev. 1.140 in STABLE buildkernel stops: mkdep -f .depend -a -nostdinc -D_KERNEL -DKLD_MODULE -I- -DHAVE_KERNEL_OPTION_HEADERS -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include -I/usr/obj/usr/src/sys/DEVIL /usr/src/sys/modules/bge/../../dev/bge/if_bge.c /usr/src/sys/modules/bge/../../dev/bge/if_bge.c:2570:35: macro VLAN_INPUT_TAG requires 4 arguments, but only 3 given mkdep: compile failed *** Error code 1 1 error *** Error code 2 1 error *** Error code 2 mkdep: compile failed *** Error code 1 2 errors *** Error code 2 1 error *** Error code 2 1 error I see VLAN_INPUT_TAG is defined as VLAN_INPUT_TAG(_ifp, _m, _t, _errcase) in if_vlan_var.h, rev v 1.21.2.2 with 4 arguments, however new if_bge.c, rev. 1.140 uses 3 arguments. Is it safe to use if_vlan_var.h, rev 1.24 and if_vlan.c, rev 1.114 only? What other patches should I use? When all these changes MFC to STABLE? You should use VLAN_INPUT_TAG_NEW macro in RELENG_6. Anyway, here is guess work for BCM5752(obtained from OpenBSD). Because I don't have 5752 hardware I don't know whether it works or not. The patch is for RELENG_6(You need brgphy(4) patch too). Where can I get brgphy(4) patch for RELENG_6? thanks, Ganbold thanks, Ganbold Pyun YongHyeon wrote: I think your PHY was not recognized by brgphy(4). But I don't know it fixes firmware handshake timed out issue you've seen. Recently oleg fixed a long standing bug in bge(4). So you may also want to merge the change.(See if_bge.c, rev. 1.140) Patch generated against RELENG_6(compile tested only). Index: if_bge.c === RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.91.2.16 diff -u -r1.91.2.16 if_bge.c --- if_bge.c10 Aug 2006 11:02:14 - 1.91.2.16 +++ if_bge.c30 Aug 2006 07:20:43 - @@ -1007,9 +1007,26 @@ /* Set up the PCI DMA control register. */ if (sc-bge_pcie) { /* PCI Express bus */ - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | - (0xf BGE_PCIDMARWCTL_RD_WAT_SHIFT) | - (0x2 BGE_PCIDMARWCTL_WR_WAT_SHIFT); + uint32_t device_ctl; + + /* alternative from Linux driver */ +#define DMA_CTRL_WRITE_PCIE_H20MARK_1280x0018 +#define DMA_CTRL_WRITE_PCIE_H20MARK_2560x0038 + + dma_rw_ctl = 0x7600; /* XXX XXX XXX */; + device_ctl = pci_read_config(sc-bge_dev, + BGE_PCI_CONF_DEV_CTRL, 4); + if ((device_ctl 0x00e0) 0) { + /* +* This clause is exactly what the Broadcom-supplied +* Linux does; but given overall register programming +* by bge(4), this larger DMA-write watermark +* value causes BCM5721 chips to totally wedge. +*/ + dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_256; + } else { + dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_128; + } } else if (sc-bge_pcix) { /* PCI-X bus */ if (BGE_IS_5714_FAMILY(sc)) { @@ -1148,22 +1165,20 @@ CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10); /* Enable buffer manager */ - if (!(BGE_IS_5705_OR_BEYOND(sc))) { - CSR_WRITE_4(sc, BGE_BMAN_MODE, - BGE_BMANMODE_ENABLE|BGE_BMANMODE_LOMBUF_ATTN); + CSR_WRITE_4(sc, BGE_BMAN_MODE, + BGE_BMANMODE_ENABLE|BGE_BMANMODE_LOMBUF_ATTN); - /* Poll for buffer manager start indication */ - for (i = 0; i BGE_TIMEOUT; i++) { - if (CSR_READ_4(sc, BGE_BMAN_MODE) BGE_BMANMODE_ENABLE) - break; - DELAY(10); - } + /* Poll for buffer manager start indication */ + for (i = 0; i BGE_TIMEOUT; i++) { + if (CSR_READ_4(sc, BGE_BMAN_MODE) BGE_BMANMODE_ENABLE) + break; + DELAY(10); + } - if (i == BGE_TIMEOUT) { - device_printf(sc-bge_dev, - buffer manager failed to start\n); - return (ENXIO); - } + if (i == BGE_TIMEOUT) { + device_printf(sc-bge_dev, + buffer manager failed to start\n); + return (ENXIO); } /* Enable
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
Pyun, On Wed, Aug 30, 2006 at 04:30:25PM +0900, Pyun YongHyeon wrote: P === P RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v P retrieving revision 1.91.2.16 P diff -u -r1.91.2.16 if_bge.c P --- if_bge.c 10 Aug 2006 11:02:14 - 1.91.2.16 P +++ if_bge.c 30 Aug 2006 07:20:43 - P @@ -1007,9 +1007,26 @@ P /* Set up the PCI DMA control register. */ P if (sc-bge_pcie) { P /* PCI Express bus */ P -dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | P -(0xf BGE_PCIDMARWCTL_RD_WAT_SHIFT) | P -(0x2 BGE_PCIDMARWCTL_WR_WAT_SHIFT); P +uint32_t device_ctl; P + P +/* alternative from Linux driver */ P +#define DMA_CTRL_WRITE_PCIE_H20MARK_128 0x0018 P +#define DMA_CTRL_WRITE_PCIE_H20MARK_256 0x0038 P + P +dma_rw_ctl = 0x7600; /* XXX XXX XXX */; P +device_ctl = pci_read_config(sc-bge_dev, P +BGE_PCI_CONF_DEV_CTRL, 4); P +if ((device_ctl 0x00e0) 0) { P +/* P + * This clause is exactly what the Broadcom-supplied P + * Linux does; but given overall register programming P + * by bge(4), this larger DMA-write watermark P + * value causes BCM5721 chips to totally wedge. P + */ P +dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_256; P +} else { P +dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_128; P +} P } else if (sc-bge_pcix) { My small penny into the discussion. I was working on reviewing the difference in initializing the PCI DMA control register in Linux tg3.c and in bge(4). I was quite lost in this stuff, and so I asked for help from David Christensen (davidch@). He has explained me all the differencies in this register between chips and I have prepared the attached patch. Since I have very small collection of bge(4) cards, I avoid to commit it. May be I will commit it after 6.2-RELEASE if several people test it on their cards and all is OK. And it will live unmerged in HEAD until 6.3-RELEASE. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE Index: if_bge.c === RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.139 diff -u -p -r1.139 if_bge.c --- if_bge.c23 Aug 2006 11:32:54 - 1.139 +++ if_bge.c23 Aug 2006 15:18:22 - @@ -1005,36 +1005,48 @@ bge_chipinit(struct bge_softc *sc) BGE_MEMWIN_WRITE(sc, i, 0); /* Set up the PCI DMA control register. */ + dma_rw_ctl = BGE_PCIDMARWCTL_READ_CMD | BGE_PCIDMARWCTL_WRITE_CMD; + + /* Bits 23, 22. */ + if (sc-bge_asicrev == BGE_ASICREV_BCM5700 || + sc-bge_asicrev == BGE_ASICREV_BCM5701 || + sc-bge_asicrev == BGE_ASICREV_BCM5714) + dma_rw_ctl |= BGE_PCIDMARWCTL_ASRT_ALL_BE | + BGE_PCIDMARWCTL_USE_MRM; + + /* DMA watermarks: bits 21 - 19, 18 - 16. */ if (sc-bge_flags BGE_FLAG_PCIE) { - /* PCI Express bus */ - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | - (0xf BGE_PCIDMARWCTL_RD_WAT_SHIFT) | - (0x2 BGE_PCIDMARWCTL_WR_WAT_SHIFT); + /* +* DMA read watermark not used on PCI-E. +* DMA write watermark set to 128 bytes. +*/ + dma_rw_ctl |= (3 BGE_PCIDMARWCTL_WR_WAT_SHIFT); } else if (sc-bge_flags BGE_FLAG_PCIX) { - /* PCI-X bus */ - if (BGE_IS_5714_FAMILY(sc)) { - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD; - dma_rw_ctl = ~BGE_PCIDMARWCTL_ONEDMA_ATONCE; /* XXX */ - /* XXX magic values, Broadcom-supplied Linux driver */ - if (sc-bge_asicrev == BGE_ASICREV_BCM5780) - dma_rw_ctl |= (1 20) | (1 18) | - BGE_PCIDMARWCTL_ONEDMA_ATONCE; - else - dma_rw_ctl |= (1 20) | (1 18) | (1 15); - - } else if (sc-bge_asicrev == BGE_ASICREV_BCM5704) + switch (sc-bge_asicrev) { + case BGE_ASICREV_BCM5780: + /* XXX: Linux driver magic values. */ + dma_rw_ctl |= (1 20) | (1 18) | + BGE_PCIDMARWCTL_ONEDMA_ATONCE; + break; + case BGE_ASICREV_BCM5714: + case BGE_ASICREV_BCM5714_A0: + /* XXX: Linux driver magic values. */ + dma_rw_ctl |= (1 20) | (1 18) | + BGE_PCIDMARWCTL_ONEDMA_ATONCE_LOCAL; + break; +
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
Ganbold, On Wed, Aug 30, 2006 at 12:23:20PM +0900, Ganbold wrote: G Thanks a lot for your patch. Your patch fixes panic, however I still see G bge0: firmware handshake timed out G bge0: link state changed to DOWN G messages. And yesterday delphij@ have sent me patch against firmware handshake timed out. It is attached. Can you please test it? -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE ---BeginMessage--- Hi, A colleague of mine has found that BCM 5752 A02 would get firmware handshake timeout problem during the ifconfig stage. After some investigation and comparing to the Linux driver I have the attached patch make the problem disappear. Unfortunately I do not have specification documentation from Broadcom so I can not say if that is a real fix :-( The patch was tested on Dell Latitude D820. The only problem remains is that the -CURRENT kernel crashes if I did not explicitly set the media and do a ifconfig bge0 up, with panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia. Backtrace is available upon request. Cheers, -- Xin LI [EMAIL PROTECTED] http://www.delphij.net/ FreeBSD - The Power to Serve! Index: if_bge.c === RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.140 diff -u -r1.140 if_bge.c --- if_bge.c24 Aug 2006 14:41:16 - 1.140 +++ if_bge.c29 Aug 2006 06:20:44 - @@ -2313,6 +2313,13 @@ BGE_PCIMISCCTL_INDIRECT_ACCESS|BGE_PCIMISCCTL_MASK_PCI_INTR| BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_PCISTATE_RW, 4); + /* XXX: Broadcom Linux driver. */ + if (sc-bge_asicrev == BGE_ASICREV_BCM5752 || + sc-bge_asicrev == BGE_ASICREV_BCM5755 || + sc-bge_asicrev == BGE_ASICREV_BCM5787) { + CSR_WRITE_4(sc, BGE_FASTBOOT_PC, 0x0); + } + reset = BGE_MISCCFG_RESET_CORE_CLOCKS|(651); /* XXX: Broadcom Linux driver. */ Index: if_bgereg.h === RCS file: /home/ncvs/src/sys/dev/bge/if_bgereg.h,v retrieving revision 1.52 diff -u -r1.52 if_bgereg.h --- if_bgereg.h 23 Aug 2006 11:32:54 - 1.52 +++ if_bgereg.h 29 Aug 2006 06:32:31 - @@ -1656,6 +1656,7 @@ #define BGE_EE_CTL 0x6840 #define BGE_MDI_CTL0x6844 #define BGE_EE_DELAY 0x6848 +#define BGE_FASTBOOT_PC0x6894 /* Mode control register */ #define BGE_MODECTL_INT_SNDCOAL_ONLY 0x0001 signature.asc Description: OpenPGP digital signature ---End Message--- ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
Gleb, Pyun, Gleb Smirnoff wrote: Ganbold, On Wed, Aug 30, 2006 at 12:23:20PM +0900, Ganbold wrote: G Thanks a lot for your patch. Your patch fixes panic, however I still see G bge0: firmware handshake timed out G bge0: link state changed to DOWN G messages. And yesterday delphij@ have sent me patch against firmware handshake timed out. It is attached. Can you please test it? Applied delphij@'s patch and now bge0: firmware handshake timed out message is gone. Previously there was applied Pyun's brgphy(4) patch. Ganbold Subject: [PATCH FOR REVIEW] Broadcom BCM 5752 A02 firmware handshake timeout From: LI Xin [EMAIL PROTECTED] Date: Tue, 29 Aug 2006 14:39:31 +0800 To: [EMAIL PROTECTED], [EMAIL PROTECTED] To: [EMAIL PROTECTED], [EMAIL PROTECTED] Hi, A colleague of mine has found that BCM 5752 A02 would get firmware handshake timeout problem during the ifconfig stage. After some investigation and comparing to the Linux driver I have the attached patch make the problem disappear. Unfortunately I do not have specification documentation from Broadcom so I can not say if that is a real fix :-( The patch was tested on Dell Latitude D820. The only problem remains is that the -CURRENT kernel crashes if I did not explicitly set the media and do a ifconfig bge0 up, with panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia. Backtrace is available upon request. Cheers, Index: if_bge.c === RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.140 diff -u -r1.140 if_bge.c --- if_bge.c24 Aug 2006 14:41:16 - 1.140 +++ if_bge.c29 Aug 2006 06:20:44 - @@ -2313,6 +2313,13 @@ BGE_PCIMISCCTL_INDIRECT_ACCESS|BGE_PCIMISCCTL_MASK_PCI_INTR| BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_PCISTATE_RW, 4); + /* XXX: Broadcom Linux driver. */ + if (sc-bge_asicrev == BGE_ASICREV_BCM5752 || + sc-bge_asicrev == BGE_ASICREV_BCM5755 || + sc-bge_asicrev == BGE_ASICREV_BCM5787) { + CSR_WRITE_4(sc, BGE_FASTBOOT_PC, 0x0); + } + reset = BGE_MISCCFG_RESET_CORE_CLOCKS|(651); /* XXX: Broadcom Linux driver. */ Index: if_bgereg.h === RCS file: /home/ncvs/src/sys/dev/bge/if_bgereg.h,v retrieving revision 1.52 diff -u -r1.52 if_bgereg.h --- if_bgereg.h 23 Aug 2006 11:32:54 - 1.52 +++ if_bgereg.h 29 Aug 2006 06:32:31 - @@ -1656,6 +1656,7 @@ #define BGE_EE_CTL 0x6840 #define BGE_MDI_CTL0x6844 #define BGE_EE_DELAY 0x6848 +#define BGE_FASTBOOT_PC0x6894 /* Mode control register */ #define BGE_MODECTL_INT_SNDCOAL_ONLY 0x0001 ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED] ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
Gleb, Pyun, I'm a kind of bit confused here whose patch to choose. Can you guys enlighten me in this regard? thanks, Ganbold Gleb Smirnoff wrote: Pyun, On Wed, Aug 30, 2006 at 04:30:25PM +0900, Pyun YongHyeon wrote: P === P RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v P retrieving revision 1.91.2.16 P diff -u -r1.91.2.16 if_bge.c P --- if_bge.c 10 Aug 2006 11:02:14 - 1.91.2.16 P +++ if_bge.c 30 Aug 2006 07:20:43 - P @@ -1007,9 +1007,26 @@ P /* Set up the PCI DMA control register. */ P if (sc-bge_pcie) { P /* PCI Express bus */ P - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | P - (0xf BGE_PCIDMARWCTL_RD_WAT_SHIFT) | P - (0x2 BGE_PCIDMARWCTL_WR_WAT_SHIFT); P + uint32_t device_ctl; P + P + /* alternative from Linux driver */ P +#define DMA_CTRL_WRITE_PCIE_H20MARK_128 0x0018 P +#define DMA_CTRL_WRITE_PCIE_H20MARK_256 0x0038 P + P + dma_rw_ctl = 0x7600; /* XXX XXX XXX */; P + device_ctl = pci_read_config(sc-bge_dev, P + BGE_PCI_CONF_DEV_CTRL, 4); P + if ((device_ctl 0x00e0) 0) { P + /* P + * This clause is exactly what the Broadcom-supplied P + * Linux does; but given overall register programming P + * by bge(4), this larger DMA-write watermark P + * value causes BCM5721 chips to totally wedge. P + */ P + dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_256; P + } else { P + dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_128; P + } P } else if (sc-bge_pcix) { My small penny into the discussion. I was working on reviewing the difference in initializing the PCI DMA control register in Linux tg3.c and in bge(4). I was quite lost in this stuff, and so I asked for help from David Christensen (davidch@). He has explained me all the differencies in this register between chips and I have prepared the attached patch. Since I have very small collection of bge(4) cards, I avoid to commit it. May be I will commit it after 6.2-RELEASE if several people test it on their cards and all is OK. And it will live unmerged in HEAD until 6.3-RELEASE. Index: if_bge.c === RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.139 diff -u -p -r1.139 if_bge.c --- if_bge.c23 Aug 2006 11:32:54 - 1.139 +++ if_bge.c23 Aug 2006 15:18:22 - @@ -1005,36 +1005,48 @@ bge_chipinit(struct bge_softc *sc) BGE_MEMWIN_WRITE(sc, i, 0); /* Set up the PCI DMA control register. */ + dma_rw_ctl = BGE_PCIDMARWCTL_READ_CMD | BGE_PCIDMARWCTL_WRITE_CMD; + + /* Bits 23, 22. */ + if (sc-bge_asicrev == BGE_ASICREV_BCM5700 || + sc-bge_asicrev == BGE_ASICREV_BCM5701 || + sc-bge_asicrev == BGE_ASICREV_BCM5714) + dma_rw_ctl |= BGE_PCIDMARWCTL_ASRT_ALL_BE | + BGE_PCIDMARWCTL_USE_MRM; + + /* DMA watermarks: bits 21 - 19, 18 - 16. */ if (sc-bge_flags BGE_FLAG_PCIE) { - /* PCI Express bus */ - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | - (0xf BGE_PCIDMARWCTL_RD_WAT_SHIFT) | - (0x2 BGE_PCIDMARWCTL_WR_WAT_SHIFT); + /* +* DMA read watermark not used on PCI-E. +* DMA write watermark set to 128 bytes. +*/ + dma_rw_ctl |= (3 BGE_PCIDMARWCTL_WR_WAT_SHIFT); } else if (sc-bge_flags BGE_FLAG_PCIX) { - /* PCI-X bus */ - if (BGE_IS_5714_FAMILY(sc)) { - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD; - dma_rw_ctl = ~BGE_PCIDMARWCTL_ONEDMA_ATONCE; /* XXX */ - /* XXX magic values, Broadcom-supplied Linux driver */ - if (sc-bge_asicrev == BGE_ASICREV_BCM5780) -dma_rw_ctl |= (1 20) | (1 18) | -BGE_PCIDMARWCTL_ONEDMA_ATONCE; - else - dma_rw_ctl |= (1 20) | (1 18) | (1 15); - - } else if (sc-bge_asicrev == BGE_ASICREV_BCM5704) + switch (sc-bge_asicrev) { + case BGE_ASICREV_BCM5780: + /* XXX: Linux driver magic values. */ + dma_rw_ctl |= (1 20) | (1 18) | + BGE_PCIDMARWCTL_ONEDMA_ATONCE; + break; + case BGE_ASICREV_BCM5714: + case BGE_ASICREV_BCM5714_A0: + /* XXX: Linux driver magic values. */ + dma_rw_ctl |= (1 20) | (1 18) | + BGE_PCIDMARWCTL_ONEDMA_ATONCE_LOCAL; +
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
On Wed, Aug 30, 2006 at 05:22:23PM +0900, Ganbold wrote: G On Wed, Aug 30, 2006 at 12:23:20PM +0900, Ganbold wrote: G G Thanks a lot for your patch. Your patch fixes panic, however I still see G G bge0: firmware handshake timed out G G bge0: link state changed to DOWN G G messages. G G And yesterday delphij@ have sent me patch against firmware handshake G timed out. G It is attached. Can you please test it? G G G Applied delphij@'s patch and now bge0: firmware handshake timed out G message is gone. Previously there was applied Pyun's brgphy(4) patch. Good. We probably need to commit them both soon. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
On Wed, Aug 30, 2006 at 05:26:07PM +0900, Ganbold wrote: G Gleb, Pyun, G G I'm a kind of bit confused here whose patch to choose. G Can you guys enlighten me in this regard? Can you please merge them? You should take all the stuff that prepares the dma_rw_ctl variable from my patch, and all the other stuff from Pyun's patch. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
Gleb Smirnoff wrote: On Wed, Aug 30, 2006 at 05:26:07PM +0900, Ganbold wrote: G Gleb, Pyun, G G I'm a kind of bit confused here whose patch to choose. G Can you guys enlighten me in this regard? Can you please merge them? You should take all the stuff that prepares the dma_rw_ctl variable from my patch, and all the other stuff from Pyun's patch. Ok, here it is. Let me know if I did something wrong. It also includes delphij@'s patch. Pyun's brgphy(4) patch is included too. Ganbold --- if_bge.c Thu Aug 10 20:02:14 2006 +++ /home/tsgan/bge/new/if_bge.c Wed Aug 30 18:41:39 2006 @@ -1005,36 +1005,48 @@ BGE_MEMWIN_WRITE(sc, i, 0); /* Set up the PCI DMA control register. */ + dma_rw_ctl = BGE_PCIDMARWCTL_READ_CMD | BGE_PCIDMARWCTL_WRITE_CMD; + + /* Bits 23, 22. */ + if (sc-bge_asicrev == BGE_ASICREV_BCM5700 || + sc-bge_asicrev == BGE_ASICREV_BCM5701 || + sc-bge_asicrev == BGE_ASICREV_BCM5714) + dma_rw_ctl |= BGE_PCIDMARWCTL_ASRT_ALL_BE | + BGE_PCIDMARWCTL_USE_MRM; + + /* DMA watermarks: bits 21 - 19, 18 - 16. */ if (sc-bge_pcie) { - /* PCI Express bus */ - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | - (0xf BGE_PCIDMARWCTL_RD_WAT_SHIFT) | - (0x2 BGE_PCIDMARWCTL_WR_WAT_SHIFT); + /* + * DMA read watermark not used on PCI-E. + * DMA write watermark set to 128 bytes. + */ + dma_rw_ctl |= (3 BGE_PCIDMARWCTL_WR_WAT_SHIFT); } else if (sc-bge_pcix) { - /* PCI-X bus */ - if (BGE_IS_5714_FAMILY(sc)) { - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD; - dma_rw_ctl = ~BGE_PCIDMARWCTL_ONEDMA_ATONCE; /* XXX */ - /* XXX magic values, Broadcom-supplied Linux driver */ - if (sc-bge_asicrev == BGE_ASICREV_BCM5780) -dma_rw_ctl |= (1 20) | (1 18) | -BGE_PCIDMARWCTL_ONEDMA_ATONCE; - else -dma_rw_ctl |= (1 20) | (1 18) | (1 15); - - } else if (sc-bge_asicrev == BGE_ASICREV_BCM5704) + switch (sc-bge_asicrev) { + case BGE_ASICREV_BCM5780: + /* XXX: Linux driver magic values. */ + dma_rw_ctl |= (1 20) | (1 18) | + BGE_PCIDMARWCTL_ONEDMA_ATONCE; + break; + case BGE_ASICREV_BCM5714: + case BGE_ASICREV_BCM5714_A0: + /* XXX: Linux driver magic values. */ + dma_rw_ctl |= (1 20) | (1 18) | + BGE_PCIDMARWCTL_ONEDMA_ATONCE_LOCAL; + break; + case BGE_ASICREV_BCM5704: /* * The 5704 uses a different encoding of read/write - * watermarks. + * watermarks: 384 bytes for write and 1536 for read. */ - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | - (0x7 BGE_PCIDMARWCTL_RD_WAT_SHIFT) | - (0x3 BGE_PCIDMARWCTL_WR_WAT_SHIFT); - else - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | - (0x3 BGE_PCIDMARWCTL_RD_WAT_SHIFT) | - (0x3 BGE_PCIDMARWCTL_WR_WAT_SHIFT) | - (0x0F); + dma_rw_ctl |= (7 BGE_PCIDMARWCTL_RD_WAT_SHIFT) | + (3 BGE_PCIDMARWCTL_WR_WAT_SHIFT); + break; + default: + /* All other chips: 384 for write and read. */ + dma_rw_ctl |= (3 BGE_PCIDMARWCTL_RD_WAT_SHIFT) | + (3 BGE_PCIDMARWCTL_WR_WAT_SHIFT); + } /* * 5703 and 5704 need ONEDMA_AT_ONCE as a workaround @@ -1047,18 +1059,20 @@ tmp = CSR_READ_4(sc, BGE_PCI_CLKCTL) 0x1f; if (tmp == 0x6 || tmp == 0x7) dma_rw_ctl |= BGE_PCIDMARWCTL_ONEDMA_ATONCE; + + /* Set bit 23 to enable PCIX hw bug fix. */ + dma_rw_ctl |= BGE_PCIDMARWCTL_ASRT_ALL_BE; } } else - /* Conventional PCI bus */ - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | - (0x7 BGE_PCIDMARWCTL_RD_WAT_SHIFT) | - (0x7 BGE_PCIDMARWCTL_WR_WAT_SHIFT) | - (0x0F); - - if (sc-bge_asicrev == BGE_ASICREV_BCM5703 || - sc-bge_asicrev == BGE_ASICREV_BCM5704 || - sc-bge_asicrev == BGE_ASICREV_BCM5705) - dma_rw_ctl = ~BGE_PCIDMARWCTL_MINDMA; + /* Conventional PCI bus: 1024 bytes for read and write. */ + dma_rw_ctl |= (7 BGE_PCIDMARWCTL_RD_WAT_SHIFT) | + (7 BGE_PCIDMARWCTL_WR_WAT_SHIFT); + + /* Set minimum DMA only for 5700 and 5701. */ + if (sc-bge_asicrev == BGE_ASICREV_BCM5700 || + sc-bge_asicrev == BGE_ASICREV_BCM5701) + dma_rw_ctl |= 0xf; + pci_write_config(sc-bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4); /* @@ -1148,22 +1162,20 @@ CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10); /* Enable buffer manager */ - if (!(BGE_IS_5705_OR_BEYOND(sc))) { - CSR_WRITE_4(sc, BGE_BMAN_MODE, - BGE_BMANMODE_ENABLE|BGE_BMANMODE_LOMBUF_ATTN); + CSR_WRITE_4(sc, BGE_BMAN_MODE, + BGE_BMANMODE_ENABLE|BGE_BMANMODE_LOMBUF_ATTN); - /* Poll for buffer manager start indication */ - for (i = 0; i BGE_TIMEOUT; i++) { - if (CSR_READ_4(sc, BGE_BMAN_MODE) BGE_BMANMODE_ENABLE) -break; - DELAY(10); - } + /* Poll for buffer manager start indication */ + for (i = 0; i BGE_TIMEOUT; i++) { + if (CSR_READ_4(sc, BGE_BMAN_MODE) BGE_BMANMODE_ENABLE) + break; + DELAY(10); + } - if (i == BGE_TIMEOUT) { - device_printf(sc-bge_dev, - buffer manager failed to start\n); - return (ENXIO); - } + if (i == BGE_TIMEOUT) { + device_printf(sc-bge_dev, +
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
On Wed, Aug 30, 2006 at 12:52:49PM +0400, Gleb Smirnoff wrote: On Wed, Aug 30, 2006 at 05:22:23PM +0900, Ganbold wrote: G On Wed, Aug 30, 2006 at 12:23:20PM +0900, Ganbold wrote: G G Thanks a lot for your patch. Your patch fixes panic, however I still see G G bge0: firmware handshake timed out G G bge0: link state changed to DOWN G G messages. G G And yesterday delphij@ have sent me patch against firmware handshake G timed out. G It is attached. Can you please test it? G G G Applied delphij@'s patch and now bge0: firmware handshake timed out G message is gone. Previously there was applied Pyun's brgphy(4) patch. Good. We probably need to commit them both soon. If there is no objections, I'll commit brgphy(4) patch tomorrow. -- Regards, Pyun YongHyeon ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
On Wed, Aug 30, 2006 at 11:50:12AM +0400, Gleb Smirnoff wrote: Pyun, On Wed, Aug 30, 2006 at 04:30:25PM +0900, Pyun YongHyeon wrote: P === P RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v P retrieving revision 1.91.2.16 P diff -u -r1.91.2.16 if_bge.c P --- if_bge.c 10 Aug 2006 11:02:14 - 1.91.2.16 P +++ if_bge.c 30 Aug 2006 07:20:43 - P @@ -1007,9 +1007,26 @@ P /* Set up the PCI DMA control register. */ P if (sc-bge_pcie) { P /* PCI Express bus */ P - dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD | P - (0xf BGE_PCIDMARWCTL_RD_WAT_SHIFT) | P - (0x2 BGE_PCIDMARWCTL_WR_WAT_SHIFT); P + uint32_t device_ctl; P + P + /* alternative from Linux driver */ P +#define DMA_CTRL_WRITE_PCIE_H20MARK_128 0x0018 P +#define DMA_CTRL_WRITE_PCIE_H20MARK_256 0x0038 P + P + dma_rw_ctl = 0x7600; /* XXX XXX XXX */; P + device_ctl = pci_read_config(sc-bge_dev, P + BGE_PCI_CONF_DEV_CTRL, 4); P + if ((device_ctl 0x00e0) 0) { P + /* P + * This clause is exactly what the Broadcom-supplied P + * Linux does; but given overall register programming P + * by bge(4), this larger DMA-write watermark P + * value causes BCM5721 chips to totally wedge. P + */ P + dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_256; P + } else { P + dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_128; P + } P } else if (sc-bge_pcix) { My small penny into the discussion. I was working on reviewing the difference in initializing the PCI DMA control register in Linux tg3.c and in bge(4). I was quite lost in this stuff, and so I asked for help from David Christensen (davidch@). He has explained me all the differencies in this register between chips and I have prepared the attached patch. Since I have very small collection of bge(4) cards, I avoid to commit it. May be I will commit it after 6.2-RELEASE if several people test it on their cards and all is OK. And it will live unmerged in HEAD until 6.3-RELEASE. Ok, I don't have BCM5752 documentation for the details. Since you've got all the secret of the magic I'd like to see the fix from you. :-) -- Regards, Pyun YongHyeon ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
Pyun YongHyeon wrote: On Wed, Aug 30, 2006 at 12:52:49PM +0400, Gleb Smirnoff wrote: On Wed, Aug 30, 2006 at 05:22:23PM +0900, Ganbold wrote: G On Wed, Aug 30, 2006 at 12:23:20PM +0900, Ganbold wrote: G G Thanks a lot for your patch. Your patch fixes panic, however I still see G G bge0: firmware handshake timed out G G bge0: link state changed to DOWN G G messages. G G And yesterday delphij@ have sent me patch against firmware handshake G timed out. G It is attached. Can you please test it? G G G Applied delphij@'s patch and now bge0: firmware handshake timed out G message is gone. Previously there was applied Pyun's brgphy(4) patch. Good. We probably need to commit them both soon. If there is no objections, I'll commit brgphy(4) patch tomorrow. I can also confirm, that the mentioned panic goes away when the 5752 does not attach to ukphy but brgphy. I had a local patch for this some time now (See current@). I'm happy to test the fix for firmware handshake timeout tommorrow. This is on Dell Latitude D620 and a Broadcom 5752 A2. -- Patrick Hurrelmann | Programming today is a race between software Mannheim, Germany| engineers striving to build bigger and better | idiot-proof programs, and the Universe trying [EMAIL PROTECTED] | to produce bigger and better idiots. So far, www.bytephobia.de| the Universe is winning. - Rich Cook /\ \ /ASCII Ribbon Campaign X against HTML email vCards / \ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: panic: invalid ife-ifm_data (0xa) in mii_phy_setmedia
Hi, Thanks a lot for your patch. Your patch fixes panic, however I still see bge0: firmware handshake timed out bge0: link state changed to DOWN messages. When I tried to use Oleg's if_bge.c, rev. 1.140 in STABLE buildkernel stops: mkdep -f .depend -a -nostdinc -D_KERNEL -DKLD_MODULE -I- -DHAVE_KERNEL_OPTION_HEADERS -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include -I/usr/obj/usr/src/sys/DEVIL /usr/src/sys/modules/bge/../../dev/bge/if_bge.c /usr/src/sys/modules/bge/../../dev/bge/if_bge.c:2570:35: macro VLAN_INPUT_TAG requires 4 arguments, but only 3 given mkdep: compile failed *** Error code 1 1 error *** Error code 2 1 error *** Error code 2 mkdep: compile failed *** Error code 1 2 errors *** Error code 2 1 error *** Error code 2 1 error I see VLAN_INPUT_TAG is defined as VLAN_INPUT_TAG(_ifp, _m, _t, _errcase) in if_vlan_var.h, rev v 1.21.2.2 with 4 arguments, however new if_bge.c, rev. 1.140 uses 3 arguments. Is it safe to use if_vlan_var.h, rev 1.24 and if_vlan.c, rev 1.114 only? What other patches should I use? When all these changes MFC to STABLE? thanks, Ganbold Pyun YongHyeon wrote: I think your PHY was not recognized by brgphy(4). But I don't know it fixes firmware handshake timed out issue you've seen. Recently oleg fixed a long standing bug in bge(4). So you may also want to merge the change.(See if_bge.c, rev. 1.140) Patch generated against RELENG_6(compile tested only). Index: miidevs === RCS file: /home/ncvs/src/sys/dev/mii/miidevs,v retrieving revision 1.30.2.3 diff -u -r1.30.2.3 miidevs --- miidevs 8 Aug 2006 07:51:21 - 1.30.2.3 +++ miidevs 30 Aug 2006 02:28:07 - @@ -118,6 +118,7 @@ model xxBROADCOM BCM5400 0x0004 Broadcom 1000baseTX PHY model xxBROADCOM BCM5401 0x0005 BCM5401 10/100/1000baseTX PHY model xxBROADCOM BCM5411 0x0007 BCM5411 10/100/1000baseTX PHY +model xxBROADCOM BCM5752 0x0010 BCM5752 10/100/1000baseTX PHY model xxBROADCOM BCM5701 0x0011 BCM5701 10/100/1000baseTX PHY model xxBROADCOM BCM5703 0x0016 BCM5703 10/100/1000baseTX PHY model xxBROADCOM BCM5704 0x0019 BCM5704 10/100/1000baseTX PHY Index: brgphy.c === RCS file: /home/ncvs/src/sys/dev/mii/brgphy.c,v retrieving revision 1.34.2.6 diff -u -r1.34.2.6 brgphy.c --- brgphy.c8 Aug 2006 04:37:18 - 1.34.2.6 +++ brgphy.c30 Aug 2006 02:28:07 - @@ -126,6 +126,12 @@ } if (MII_OUI(ma-mii_id1, ma-mii_id2) == MII_OUI_xxBROADCOM + MII_MODEL(ma-mii_id2) == MII_MODEL_xxBROADCOM_BCM5752) { + device_set_desc(dev, MII_STR_xxBROADCOM_BCM5752); + return(BUS_PROBE_DEFAULT); + } + + if (MII_OUI(ma-mii_id1, ma-mii_id2) == MII_OUI_xxBROADCOM MII_MODEL(ma-mii_id2) == MII_MODEL_xxBROADCOM_BCM5701) { device_set_desc(dev, MII_STR_xxBROADCOM_BCM5701); return(BUS_PROBE_DEFAULT); @@ -665,6 +671,7 @@ bcm5704_load_dspcode(sc); break; case MII_MODEL_xxBROADCOM_BCM5750: + case MII_MODEL_xxBROADCOM_BCM5752: case MII_MODEL_xxBROADCOM_BCM5714: case MII_MODEL_xxBROADCOM_BCM5780: case MII_MODEL_xxBROADCOM_BCM5706C: ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]