From 2e26c34f2ae340cce835c8992e8f6eb9abce5d8b Mon Sep 17 00:00:00 2001 From: msaitoh Date: Fri, 24 Oct 2014 17:58:09 +0000 Subject: [PATCH] Simplify. No functional change. --- sys/dev/pci/if_wm.c | 24 ++++-------------------- sys/dev/pci/if_wmreg.h | 6 ++---- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c index 59938d2e4d0e..0b501c53c1f9 100644 --- a/sys/dev/pci/if_wm.c +++ b/sys/dev/pci/if_wm.c @@ -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 -__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 #include @@ -2804,24 +2804,8 @@ wm_read_mac_addr(struct wm_softc *sc, uint8_t *enaddr) 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 --git a/sys/dev/pci/if_wmreg.h b/sys/dev/pci/if_wmreg.h index 32de7bc1a278..7e3ba71a9e99 100644 --- a/sys/dev/pci/if_wmreg.h +++ b/sys/dev/pci/if_wmreg.h @@ -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 */