Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii use a macro to tidy up the phydesc array initial...



details:   https://anonhg.NetBSD.org/src/rev/ea35248dbd14
branches:  trunk
changeset: 997148:ea35248dbd14
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Feb 24 17:22:21 2019 +0000

description:
use a macro to tidy up the phydesc array initialization, from FreeBSD

diffstat:

 sys/dev/mii/acphy.c    |   24 ++----
 sys/dev/mii/amhphy.c   |   11 +--
 sys/dev/mii/atphy.c    |   22 ++----
 sys/dev/mii/bmtphy.c   |   29 +++-----
 sys/dev/mii/brgphy.c   |  159 ++++++++++++------------------------------------
 sys/dev/mii/ciphy.c    |   47 ++++----------
 sys/dev/mii/dmphy.c    |   19 +----
 sys/dev/mii/etphy.c    |   10 +-
 sys/dev/mii/glxtphy.c  |   15 +---
 sys/dev/mii/gphyter.c  |   19 +----
 sys/dev/mii/icsphy.c   |   27 ++-----
 sys/dev/mii/igphy.c    |   15 +---
 sys/dev/mii/ihphy.c    |   23 ++----
 sys/dev/mii/ikphy.c    |   11 +--
 sys/dev/mii/inphy.c    |   27 ++-----
 sys/dev/mii/iophy.c    |   15 +---
 sys/dev/mii/lxtphy.c   |   15 +---
 sys/dev/mii/makphy.c   |  102 ++++++++----------------------
 sys/dev/mii/micphy.c   |   15 +---
 sys/dev/mii/miivar.h   |    6 +-
 sys/dev/mii/mvphy.c    |   11 +--
 sys/dev/mii/nsphy.c    |   11 +--
 sys/dev/mii/nsphyter.c |   23 ++----
 sys/dev/mii/pnaphy.c   |   11 +--
 sys/dev/mii/qsphy.c    |   11 +--
 sys/dev/mii/rdcphy.c   |   10 +-
 sys/dev/mii/rgephy.c   |   19 +----
 sys/dev/mii/rlphy.c    |   17 +---
 sys/dev/mii/sqphy.c    |   19 +----
 sys/dev/mii/tlphy.c    |   11 +--
 sys/dev/mii/tqphy.c    |   13 +--
 31 files changed, 241 insertions(+), 526 deletions(-)

diffs (truncated from 1414 to 300 lines):

diff -r 353714b2f523 -r ea35248dbd14 sys/dev/mii/acphy.c
--- a/sys/dev/mii/acphy.c       Sun Feb 24 17:01:52 2019 +0000
+++ b/sys/dev/mii/acphy.c       Sun Feb 24 17:22:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acphy.c,v 1.26 2019/01/22 03:42:27 msaitoh Exp $       */
+/*     $NetBSD: acphy.c,v 1.27 2019/02/24 17:22:21 christos Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.26 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.27 2019/02/24 17:22:21 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,21 +72,13 @@
 };
 
 static const struct mii_phydesc acphys[] = {
-       { MII_OUI_ALTIMA,               MII_MODEL_ALTIMA_AC101,
-         MII_STR_ALTIMA_AC101 },
-       { MII_OUI_ALTIMA,               MII_MODEL_ALTIMA_AC101L,
-         MII_STR_ALTIMA_AC101L },
-       { MII_OUI_ALTIMA,               MII_MODEL_ALTIMA_Am79C874,
-         MII_STR_ALTIMA_Am79C874 },
-       { MII_OUI_ALTIMA,               MII_MODEL_ALTIMA_Am79C875,
-         MII_STR_ALTIMA_Am79C875 },
-
+       MII_PHY_DESC(ALTIMA, AC101),
+       MII_PHY_DESC(ALTIMA, AC101L),
+       MII_PHY_DESC(ALTIMA, Am79C874),
+       MII_PHY_DESC(ALTIMA, Am79C875),
        /* XXX This is reported to work, but it's not from any data sheet. */
-       { MII_OUI_ALTIMA,               MII_MODEL_ALTIMA_ACXXX,
-         MII_STR_ALTIMA_ACXXX },
-
-       { 0,                            0,
-         NULL },
+       MII_PHY_DESC(ALTIMA, ACXXX),
+       MII_PHY_END,
 };
 
 static int
diff -r 353714b2f523 -r ea35248dbd14 sys/dev/mii/amhphy.c
--- a/sys/dev/mii/amhphy.c      Sun Feb 24 17:01:52 2019 +0000
+++ b/sys/dev/mii/amhphy.c      Sun Feb 24 17:22:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amhphy.c,v 1.21 2019/01/22 03:42:27 msaitoh Exp $      */
+/*     $NetBSD: amhphy.c,v 1.22 2019/02/24 17:22:21 christos Exp $     */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.21 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.22 2019/02/24 17:22:21 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,11 +72,8 @@
 };
 
 static const struct mii_phydesc amhphys[] = {
-       { MII_OUI_yyAMD,                MII_MODEL_yyAMD_79c901,
-         MII_STR_yyAMD_79c901 },
-
-       { 0,                            0,
-         NULL },
+       MII_PHY_DESC(yyAMD, 79c901),
+       MII_PHY_END,
 };
 
 static int
diff -r 353714b2f523 -r ea35248dbd14 sys/dev/mii/atphy.c
--- a/sys/dev/mii/atphy.c       Sun Feb 24 17:01:52 2019 +0000
+++ b/sys/dev/mii/atphy.c       Sun Feb 24 17:22:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atphy.c,v 1.19 2019/01/22 03:42:27 msaitoh Exp $ */
+/*     $NetBSD: atphy.c,v 1.20 2019/02/24 17:22:21 christos Exp $ */
 /*     $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $  */
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.19 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.20 2019/02/24 17:22:21 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -91,18 +91,12 @@
 };
 
 static const struct mii_phydesc etphys[] = {
-       { MII_OUI_ATHEROS,      MII_MODEL_ATHEROS_F1,
-         MII_STR_ATHEROS_F1 },
-       { MII_OUI_ATTANSIC,     MII_MODEL_ATTANSIC_L1,
-         MII_STR_ATTANSIC_L1 },
-       { MII_OUI_ATTANSIC,     MII_MODEL_ATTANSIC_L2,
-         MII_STR_ATTANSIC_L2 },
-       { MII_OUI_ATTANSIC,     MII_MODEL_ATTANSIC_AR8021,
-         MII_STR_ATTANSIC_AR8021 },
-       { MII_OUI_ATTANSIC,     MII_MODEL_ATTANSIC_AR8035,
-         MII_STR_ATTANSIC_AR8035 },
-       { 0,                    0,
-         NULL },
+       MII_PHY_DESC(ATHEROS, F1),
+       MII_PHY_DESC(ATTANSIC, L1),
+       MII_PHY_DESC(ATTANSIC, L2),
+       MII_PHY_DESC(ATTANSIC, AR8021),
+       MII_PHY_DESC(ATTANSIC, AR8035),
+       MII_PHY_END,
 };
 
 static bool
diff -r 353714b2f523 -r ea35248dbd14 sys/dev/mii/bmtphy.c
--- a/sys/dev/mii/bmtphy.c      Sun Feb 24 17:01:52 2019 +0000
+++ b/sys/dev/mii/bmtphy.c      Sun Feb 24 17:22:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bmtphy.c,v 1.33 2019/01/22 03:42:27 msaitoh Exp $      */
+/*     $NetBSD: bmtphy.c,v 1.34 2019/02/24 17:22:21 christos Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bmtphy.c,v 1.33 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bmtphy.c,v 1.34 2019/02/24 17:22:21 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -94,23 +94,14 @@
 };
 
 static const struct mii_phydesc bmtphys[] = {
-       { MII_OUI_xxBROADCOM,           MII_MODEL_xxBROADCOM_3C905B,
-         MII_STR_xxBROADCOM_3C905B },
-       { MII_OUI_xxBROADCOM,           MII_MODEL_xxBROADCOM_3C905C,
-         MII_STR_xxBROADCOM_3C905C },
-       { MII_OUI_xxBROADCOM,           MII_MODEL_xxBROADCOM_BCM5201,
-         MII_STR_xxBROADCOM_BCM5201 },
-       { MII_OUI_xxBROADCOM,           MII_MODEL_xxBROADCOM_BCM5214,
-         MII_STR_xxBROADCOM_BCM5214 },
-       { MII_OUI_xxBROADCOM,           MII_MODEL_xxBROADCOM_BCM5221,
-         MII_STR_xxBROADCOM_BCM5221 },
-       { MII_OUI_xxBROADCOM,           MII_MODEL_xxBROADCOM_BCM5222,
-         MII_STR_xxBROADCOM_BCM5222 },
-       { MII_OUI_xxBROADCOM,           MII_MODEL_xxBROADCOM_BCM4401,
-         MII_STR_xxBROADCOM_BCM4401 },
-
-       { 0,                            0,
-         NULL },
+       MII_PHY_DESC(xxBROADCOM, 3C905B),
+       MII_PHY_DESC(xxBROADCOM, 3C905C),
+       MII_PHY_DESC(xxBROADCOM, BCM5201),
+       MII_PHY_DESC(xxBROADCOM, BCM5214),
+       MII_PHY_DESC(xxBROADCOM, BCM5221),
+       MII_PHY_DESC(xxBROADCOM, BCM5222),
+       MII_PHY_DESC(xxBROADCOM, BCM4401),
+       MII_PHY_END,
 };
 
 static int
diff -r 353714b2f523 -r ea35248dbd14 sys/dev/mii/brgphy.c
--- a/sys/dev/mii/brgphy.c      Sun Feb 24 17:01:52 2019 +0000
+++ b/sys/dev/mii/brgphy.c      Sun Feb 24 17:22:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: brgphy.c,v 1.80 2019/02/20 17:00:20 msaitoh Exp $      */
+/*     $NetBSD: brgphy.c,v 1.81 2019/02/24 17:22:21 christos Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.80 2019/02/20 17:00:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.81 2019/02/24 17:22:21 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -138,122 +138,45 @@
 };
 
 static const struct mii_phydesc brgphys[] = {
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5400,
-         MII_STR_BROADCOM_BCM5400 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5401,
-         MII_STR_BROADCOM_BCM5401 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5411,
-         MII_STR_BROADCOM_BCM5411 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5421,
-         MII_STR_BROADCOM_BCM5421 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5462,
-         MII_STR_BROADCOM_BCM5462 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5461,
-         MII_STR_BROADCOM_BCM5461 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM54K2,
-         MII_STR_BROADCOM_BCM54K2 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5464,
-         MII_STR_BROADCOM_BCM5464 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5701,
-         MII_STR_BROADCOM_BCM5701 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5703,
-         MII_STR_BROADCOM_BCM5703 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5704,
-         MII_STR_BROADCOM_BCM5704 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5705,
-         MII_STR_BROADCOM_BCM5705 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5706,
-         MII_STR_BROADCOM_BCM5706 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5714,
-         MII_STR_BROADCOM_BCM5714 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5750,
-         MII_STR_BROADCOM_BCM5750 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5752,
-         MII_STR_BROADCOM_BCM5752 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5780,
-         MII_STR_BROADCOM_BCM5780 },
-
-       { MII_OUI_BROADCOM,             MII_MODEL_BROADCOM_BCM5708C,
-         MII_STR_BROADCOM_BCM5708C },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5481,
-         MII_STR_BROADCOM2_BCM5481 },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5482,
-         MII_STR_BROADCOM2_BCM5482 },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5708S,
-         MII_STR_BROADCOM2_BCM5708S },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5709C,
-         MII_STR_BROADCOM2_BCM5709C },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5709S,
-         MII_STR_BROADCOM2_BCM5709S },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5709CAX,
-         MII_STR_BROADCOM2_BCM5709CAX },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5722,
-         MII_STR_BROADCOM2_BCM5722 },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5754,
-         MII_STR_BROADCOM2_BCM5754 },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5755,
-         MII_STR_BROADCOM2_BCM5755 },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5756,
-         MII_STR_BROADCOM2_BCM5756 },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5761,
-         MII_STR_BROADCOM2_BCM5761 },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5784,
-         MII_STR_BROADCOM2_BCM5784 },
-
-       { MII_OUI_BROADCOM2,            MII_MODEL_BROADCOM2_BCM5785,
-         MII_STR_BROADCOM2_BCM5785 },
-
-       { MII_OUI_BROADCOM3,            MII_MODEL_BROADCOM3_BCM5717C,
-         MII_STR_BROADCOM3_BCM5717C },
-
-       { MII_OUI_BROADCOM3,            MII_MODEL_BROADCOM3_BCM5719C,
-         MII_STR_BROADCOM3_BCM5719C },
-
-       { MII_OUI_BROADCOM3,            MII_MODEL_BROADCOM3_BCM5720C,
-         MII_STR_BROADCOM3_BCM5720C },
-
-       { MII_OUI_BROADCOM3,            MII_MODEL_BROADCOM3_BCM57765,
-         MII_STR_BROADCOM3_BCM57765 },
-
-       { MII_OUI_BROADCOM3,            MII_MODEL_BROADCOM3_BCM57780,
-         MII_STR_BROADCOM3_BCM57780 },



Home | Main Index | Thread Index | Old Index