| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_wm.c,v 1.610 2018/12/20 09:32:13 msaitoh Exp $ */ | | 1 | /* $NetBSD: if_wm.c,v 1.611 2018/12/21 08:29:22 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 |
| @@ -73,27 +73,27 @@ | | | @@ -73,27 +73,27 @@ |
73 | * TODO (in order of importance): | | 73 | * TODO (in order of importance): |
74 | * | | 74 | * |
75 | * - Check XXX'ed comments | | 75 | * - Check XXX'ed comments |
76 | * - TX Multi queue improvement (refine queue selection logic) | | 76 | * - TX Multi queue improvement (refine queue selection logic) |
77 | * - Split header buffer for newer descriptors | | 77 | * - Split header buffer for newer descriptors |
78 | * - EEE (Energy Efficiency Ethernet) | | 78 | * - EEE (Energy Efficiency Ethernet) |
79 | * - Virtual Function | | 79 | * - Virtual Function |
80 | * - Set LED correctly (based on contents in EEPROM) | | 80 | * - Set LED correctly (based on contents in EEPROM) |
81 | * - Rework how parameters are loaded from the EEPROM. | | 81 | * - Rework how parameters are loaded from the EEPROM. |
82 | * - Image Unique ID | | 82 | * - Image Unique ID |
83 | */ | | 83 | */ |
84 | | | 84 | |
85 | #include <sys/cdefs.h> | | 85 | #include <sys/cdefs.h> |
86 | __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.610 2018/12/20 09:32:13 msaitoh Exp $"); | | 86 | __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.611 2018/12/21 08:29:22 msaitoh Exp $"); |
87 | | | 87 | |
88 | #ifdef _KERNEL_OPT | | 88 | #ifdef _KERNEL_OPT |
89 | #include "opt_net_mpsafe.h" | | 89 | #include "opt_net_mpsafe.h" |
90 | #include "opt_if_wm.h" | | 90 | #include "opt_if_wm.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> |
| @@ -2386,32 +2386,32 @@ alloc_retry: | | | @@ -2386,32 +2386,32 @@ alloc_retry: |
2386 | | | 2386 | |
2387 | /* Check for WM_F_WOL on some chips before wm_reset() */ | | 2387 | /* Check for WM_F_WOL on some chips before wm_reset() */ |
2388 | switch (sc->sc_type) { | | 2388 | switch (sc->sc_type) { |
2389 | case WM_T_ICH8: | | 2389 | case WM_T_ICH8: |
2390 | case WM_T_ICH9: | | 2390 | case WM_T_ICH9: |
2391 | case WM_T_ICH10: | | 2391 | case WM_T_ICH10: |
2392 | case WM_T_PCH: | | 2392 | case WM_T_PCH: |
2393 | case WM_T_PCH2: | | 2393 | case WM_T_PCH2: |
2394 | case WM_T_PCH_LPT: | | 2394 | case WM_T_PCH_LPT: |
2395 | case WM_T_PCH_SPT: | | 2395 | case WM_T_PCH_SPT: |
2396 | case WM_T_PCH_CNP: | | 2396 | case WM_T_PCH_CNP: |
2397 | apme_mask = WUC_APME; | | 2397 | apme_mask = WUC_APME; |
2398 | eeprom_data = CSR_READ(sc, WMREG_WUC); | | 2398 | eeprom_data = CSR_READ(sc, WMREG_WUC); |
| | | 2399 | if ((eeprom_data & apme_mask) != 0) |
| | | 2400 | sc->sc_flags |= WM_F_WOL; |
2399 | break; | | 2401 | break; |
2400 | default: | | 2402 | default: |
2401 | break; | | 2403 | break; |
2402 | } | | 2404 | } |
2403 | if ((eeprom_data & apme_mask) != 0) | | | |
2404 | sc->sc_flags |= WM_F_WOL; | | | |
2405 | | | 2405 | |
2406 | /* Reset the chip to a known state. */ | | 2406 | /* Reset the chip to a known state. */ |
2407 | wm_reset(sc); | | 2407 | wm_reset(sc); |
2408 | | | 2408 | |
2409 | /* | | 2409 | /* |
2410 | * Check for I21[01] PLL workaround. | | 2410 | * Check for I21[01] PLL workaround. |
2411 | * | | 2411 | * |
2412 | * Three cases: | | 2412 | * Three cases: |
2413 | * a) Chip is I211. | | 2413 | * a) Chip is I211. |
2414 | * b) Chip is I210 and it uses INVM (not FLASH). | | 2414 | * b) Chip is I210 and it uses INVM (not FLASH). |
2415 | * c) Chip is I210 (and it uses FLASH) and the NVM image version < 3.25 | | 2415 | * c) Chip is I210 (and it uses FLASH) and the NVM image version < 3.25 |
2416 | */ | | 2416 | */ |
2417 | if (sc->sc_type == WM_T_I211) | | 2417 | if (sc->sc_type == WM_T_I211) |