Module Name:    src
Committed By:   msaitoh
Date:           Fri Oct 24 17:58:09 UTC 2014

Modified Files:
        src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
Simplify. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/if_wmreg.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.306 src/sys/dev/pci/if_wm.c:1.307
--- src/sys/dev/pci/if_wm.c:1.306	Fri Oct 24 17:50:50 2014
+++ src/sys/dev/pci/if_wm.c	Fri Oct 24 17:58:09 2014
@@ -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 @@ wm_read_mac_addr(struct wm_softc *sc, ui
 	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:

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.64 src/sys/dev/pci/if_wmreg.h:1.65
--- src/sys/dev/pci/if_wmreg.h:1.64	Fri Oct 24 17:50:50 2014
+++ src/sys/dev/pci/if_wmreg.h	Fri Oct 24 17:58:09 2014
@@ -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 @@ struct livengood_tcpip_ctxdesc {
  * 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 */

Reply via email to