Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Simplify. No functional change.



details:   https://anonhg.NetBSD.org/src/rev/96a180eb833d
branches:  trunk
changeset: 333233:96a180eb833d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Oct 24 17:58:09 2014 +0000

description:
Simplify. No functional change.

diffstat:

 sys/dev/pci/if_wm.c    |  24 ++++--------------------
 sys/dev/pci/if_wmreg.h |   6 ++----
 2 files changed, 6 insertions(+), 24 deletions(-)

diffs (65 lines):

diff -r 3b6cccc77dac -r 96a180eb833d sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Fri Oct 24 17:50:50 2014 +0000
+++ b/sys/dev/pci/if_wm.c       Fri Oct 24 17:58:09 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.306 2014/10/24 17:50:50 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.307 2014/10/24 17:58:09 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.306 2014/10/24 17:50:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.307 2014/10/24 17:58:09 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2804,24 +2804,8 @@
        case WM_T_82580:
        case WM_T_I350:
        case WM_T_I354:
-               switch (sc->sc_funcid) {
-               case 0:
-                       /* default value (== NVM_OFF_MACADDR) */
-                       break;
-               case 1:
-                       offset = NVM_OFF_LAN1;
-                       break;
-               case 2:
-                       offset = NVM_OFF_LAN2;
-                       break;
-               case 3:
-                       offset = NVM_OFF_LAN3;
-                       break;
-               default:
-                       goto bad;
-                       /* NOTREACHED */
-                       break;
-               }
+               /* EEPROM Top Level Partitioning */
+               offset = NVM_OFF_LAN_FUNC_82580(sc->sc_funcid) + 0;
                break;
        case WM_T_82571:
        case WM_T_82575:
diff -r 3b6cccc77dac -r 96a180eb833d sys/dev/pci/if_wmreg.h
--- a/sys/dev/pci/if_wmreg.h    Fri Oct 24 17:50:50 2014 +0000
+++ b/sys/dev/pci/if_wmreg.h    Fri Oct 24 17:58:09 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wmreg.h,v 1.64 2014/10/24 17:50:50 msaitoh Exp $    */
+/*     $NetBSD: if_wmreg.h,v 1.65 2014/10/24 17:58:09 msaitoh Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -972,9 +972,7 @@
  * EEPROM Partitioning. See Table 6-1, "EEPROM Top Level Partitioning"
  * in 82580's datasheet.
  */
-#define NVM_OFF_LAN1   0x0080  /* Offset for LAN1 (82580)*/
-#define NVM_OFF_LAN2   0x00c0  /* Offset for LAN2 (82580)*/
-#define NVM_OFF_LAN3   0x0100  /* Offset for LAN3 (82580)*/
+#define NVM_OFF_LAN_FUNC_82580(x)      ((x) ? (0x40 + (0x40 * (x))) : 0)
 
 /* ich8 flash control */
 #define ICH_FLASH_COMMAND_TIMEOUT            5000    /* 5000 uSecs - adjusted */



Home | Main Index | Thread Index | Old Index