Module Name: src Committed By: msaitoh Date: Thu Mar 21 12:56:03 UTC 2013
Modified Files: src/sys/dev/pci: if_bge.c if_bgereg.h Log Message: Wait for the bootcode to complete initialization for 5717 and newer devices. See BCM5718 programmer's guide's "step 13, Device reset Procedure, Section 7". 57781's document has the same note. I verified the loop really looped on those chips. But, I don't know why tg3 doesn't it. To generate a diff of this commit: cvs rdiff -u -r1.222 -r1.223 src/sys/dev/pci/if_bge.c cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pci/if_bgereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/if_bge.c diff -u src/sys/dev/pci/if_bge.c:1.222 src/sys/dev/pci/if_bge.c:1.223 --- src/sys/dev/pci/if_bge.c:1.222 Thu Mar 21 12:33:11 2013 +++ src/sys/dev/pci/if_bge.c Thu Mar 21 12:56:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_bge.c,v 1.222 2013/03/21 12:33:11 msaitoh Exp $ */ +/* $NetBSD: if_bge.c,v 1.223 2013/03/21 12:56:03 msaitoh Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -79,7 +79,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.222 2013/03/21 12:33:11 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.223 2013/03/21 12:56:03 msaitoh Exp $"); #include "vlan.h" @@ -3992,6 +3992,20 @@ bge_reset(struct bge_softc *sc) /* Step 28: Fix up byte swapping */ CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS); + /* + * Wait for the bootcode to complete initialization. + * See BCM5718 programmer's guide's "step 13, Device reset Procedure, + * Section 7". + */ + if (BGE_IS_5717_PLUS(sc)) { + for (i = 0; i < 1000*1000; i++) { + val = bge_readmem_ind(sc, BGE_SRAM_FW_MB); + if (val == BGE_SRAM_FW_MB_RESET_MAGIC) + break; + DELAY(10); + } + } + /* Step 21: 5822 B0 errata */ if (BGE_CHIPREV(sc->bge_chipid) == BGE_CHIPREV_5704_BX) { pcireg_t msidata; Index: src/sys/dev/pci/if_bgereg.h diff -u src/sys/dev/pci/if_bgereg.h:1.67 src/sys/dev/pci/if_bgereg.h:1.68 --- src/sys/dev/pci/if_bgereg.h:1.67 Thu Mar 21 12:33:11 2013 +++ src/sys/dev/pci/if_bgereg.h Thu Mar 21 12:56:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_bgereg.h,v 1.67 2013/03/21 12:33:11 msaitoh Exp $ */ +/* $NetBSD: if_bgereg.h,v 1.68 2013/03/21 12:56:03 msaitoh Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2001 @@ -2178,6 +2178,7 @@ * code from running. */ #define BGE_SRAM_FW_MB_MAGIC 0x4B657654 +#define BGE_SRAM_FW_MB_RESET_MAGIC 0xB49A89AB typedef struct { volatile u_int32_t bge_addr_hi;