Thu Oct 20 04:06:53 2016 UTC ()
Add more DPRINTF()s.


(msaitoh)
diff -r1.420 -r1.421 src/sys/dev/pci/if_wm.c

cvs diff -r1.420 -r1.421 src/sys/dev/pci/if_wm.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_wm.c 2016/10/19 08:55:23 1.420
+++ src/sys/dev/pci/if_wm.c 2016/10/20 04:06:53 1.421
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_wm.c,v 1.420 2016/10/19 08:55:23 msaitoh Exp $ */ 1/* $NetBSD: if_wm.c,v 1.421 2016/10/20 04:06:53 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. 4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -74,27 +74,27 @@ @@ -74,27 +74,27 @@
74 * 74 *
75 * - Check XXX'ed comments 75 * - Check XXX'ed comments
76 * - Disable D0 LPLU on 8257[12356], 82580 and I350. 76 * - Disable D0 LPLU on 8257[12356], 82580 and I350.
77 * - TX Multi queue improvement (refine queue selection logic) 77 * - TX Multi queue improvement (refine queue selection logic)
78 * - Advanced Receive Descriptor 78 * - Advanced Receive Descriptor
79 * - EEE (Energy Efficiency Ethernet) 79 * - EEE (Energy Efficiency Ethernet)
80 * - Virtual Function 80 * - Virtual Function
81 * - Set LED correctly (based on contents in EEPROM) 81 * - Set LED correctly (based on contents in EEPROM)
82 * - Rework how parameters are loaded from the EEPROM. 82 * - Rework how parameters are loaded from the EEPROM.
83 * - Image Unique ID 83 * - Image Unique ID
84 */ 84 */
85 85
86#include <sys/cdefs.h> 86#include <sys/cdefs.h>
87__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.420 2016/10/19 08:55:23 msaitoh Exp $"); 87__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.421 2016/10/20 04:06:53 msaitoh Exp $");
88 88
89#ifdef _KERNEL_OPT 89#ifdef _KERNEL_OPT
90#include "opt_net_mpsafe.h" 90#include "opt_net_mpsafe.h"
91#endif 91#endif
92 92
93#include <sys/param.h> 93#include <sys/param.h>
94#include <sys/systm.h> 94#include <sys/systm.h>
95#include <sys/callout.h> 95#include <sys/callout.h>
96#include <sys/mbuf.h> 96#include <sys/mbuf.h>
97#include <sys/malloc.h> 97#include <sys/malloc.h>
98#include <sys/kmem.h> 98#include <sys/kmem.h>
99#include <sys/kernel.h> 99#include <sys/kernel.h>
100#include <sys/socket.h> 100#include <sys/socket.h>
@@ -10037,26 +10037,29 @@ wm_nvm_set_addrbits_size_eecd(struct wm_ @@ -10037,26 +10037,29 @@ wm_nvm_set_addrbits_size_eecd(struct wm_
10037} 10037}
10038 10038
10039/* 10039/*
10040 * wm_nvm_ready_spi: 10040 * wm_nvm_ready_spi:
10041 * 10041 *
10042 * Wait for a SPI EEPROM to be ready for commands. 10042 * Wait for a SPI EEPROM to be ready for commands.
10043 */ 10043 */
10044static int 10044static int
10045wm_nvm_ready_spi(struct wm_softc *sc) 10045wm_nvm_ready_spi(struct wm_softc *sc)
10046{ 10046{
10047 uint32_t val; 10047 uint32_t val;
10048 int usec; 10048 int usec;
10049 10049
 10050 DPRINTF(WM_DEBUG_NVM, ("%s: %s called\n",
 10051 device_xname(sc->sc_dev), __func__));
 10052
10050 for (usec = 0; usec < SPI_MAX_RETRIES; delay(5), usec += 5) { 10053 for (usec = 0; usec < SPI_MAX_RETRIES; delay(5), usec += 5) {
10051 wm_eeprom_sendbits(sc, SPI_OPC_RDSR, 8); 10054 wm_eeprom_sendbits(sc, SPI_OPC_RDSR, 8);
10052 wm_eeprom_recvbits(sc, &val, 8); 10055 wm_eeprom_recvbits(sc, &val, 8);
10053 if ((val & SPI_SR_RDY) == 0) 10056 if ((val & SPI_SR_RDY) == 0)
10054 break; 10057 break;
10055 } 10058 }
10056 if (usec >= SPI_MAX_RETRIES) { 10059 if (usec >= SPI_MAX_RETRIES) {
10057 aprint_error_dev(sc->sc_dev,"EEPROM failed to become ready\n"); 10060 aprint_error_dev(sc->sc_dev,"EEPROM failed to become ready\n");
10058 return 1; 10061 return 1;
10059 } 10062 }
10060 return 0; 10063 return 0;
10061} 10064}
10062 10065
@@ -10638,26 +10641,29 @@ wm_nvm_read_word_invm(struct wm_softc *s @@ -10638,26 +10641,29 @@ wm_nvm_read_word_invm(struct wm_softc *s
10638 break; 10641 break;
10639 } 10642 }
10640 } 10643 }
10641 } 10644 }
10642 10645
10643 return rv; 10646 return rv;
10644} 10647}
10645 10648
10646static int 10649static int
10647wm_nvm_read_invm(struct wm_softc *sc, int offset, int words, uint16_t *data) 10650wm_nvm_read_invm(struct wm_softc *sc, int offset, int words, uint16_t *data)
10648{ 10651{
10649 int rv = 0; 10652 int rv = 0;
10650 int i; 10653 int i;
 10654
 10655 DPRINTF(WM_DEBUG_NVM, ("%s: %s called\n",
 10656 device_xname(sc->sc_dev), __func__));
10651 10657
10652 for (i = 0; i < words; i++) { 10658 for (i = 0; i < words; i++) {
10653 switch (offset + i) { 10659 switch (offset + i) {
10654 case NVM_OFF_MACADDR: 10660 case NVM_OFF_MACADDR:
10655 case NVM_OFF_MACADDR1: 10661 case NVM_OFF_MACADDR1:
10656 case NVM_OFF_MACADDR2: 10662 case NVM_OFF_MACADDR2:
10657 rv = wm_nvm_read_word_invm(sc, offset + i, &data[i]); 10663 rv = wm_nvm_read_word_invm(sc, offset + i, &data[i]);
10658 if (rv != 0) { 10664 if (rv != 0) {
10659 data[i] = 0xffff; 10665 data[i] = 0xffff;
10660 rv = -1; 10666 rv = -1;
10661 } 10667 }
10662 break; 10668 break;
10663 case NVM_OFF_CFG2: 10669 case NVM_OFF_CFG2:
@@ -11076,26 +11082,29 @@ wm_nvm_read(struct wm_softc *sc, int wor @@ -11076,26 +11082,29 @@ wm_nvm_read(struct wm_softc *sc, int wor
11076} 11082}
11077 11083
11078/* 11084/*
11079 * Hardware semaphores. 11085 * Hardware semaphores.
11080 * Very complexed... 11086 * Very complexed...
11081 */ 11087 */
11082 11088
11083static int 11089static int
11084wm_get_swsm_semaphore(struct wm_softc *sc) 11090wm_get_swsm_semaphore(struct wm_softc *sc)
11085{ 11091{
11086 int32_t timeout; 11092 int32_t timeout;
11087 uint32_t swsm; 11093 uint32_t swsm;
11088 11094
 11095 DPRINTF(WM_DEBUG_NVM, ("%s: %s called\n",
 11096 device_xname(sc->sc_dev), __func__));
 11097
11089 if (sc->sc_flags & WM_F_LOCK_SWSM) { 11098 if (sc->sc_flags & WM_F_LOCK_SWSM) {
11090 /* Get the SW semaphore. */ 11099 /* Get the SW semaphore. */
11091 timeout = sc->sc_nvm_wordsize + 1; 11100 timeout = sc->sc_nvm_wordsize + 1;
11092 while (timeout) { 11101 while (timeout) {
11093 swsm = CSR_READ(sc, WMREG_SWSM); 11102 swsm = CSR_READ(sc, WMREG_SWSM);
11094 11103
11095 if ((swsm & SWSM_SMBI) == 0) 11104 if ((swsm & SWSM_SMBI) == 0)
11096 break; 11105 break;
11097 11106
11098 delay(50); 11107 delay(50);
11099 timeout--; 11108 timeout--;
11100 } 11109 }
11101 11110