From b06ff76a218f7df3bf338eb7769cf269d3c899a5 Mon Sep 17 00:00:00 2001 From: HL Yi Date: Sat, 17 Oct 2026 09:05:04 -0500 Subject: [PATCH] add MACHINE_CHIPSET in header files, and add common settings in machine_defs.h --- doc/adding-a-device.md | 37 +++++++++++++++---------- machine.h | 40 ++++++++++++++++++++++++++++ machine/2G08110GSN.h | 1 + machine/2G5F4_10G2_V1_01.c | 5 +--- machine/2G5F4_10G2_V1_01.h | 1 + machine/DEFAULT_8C_1SFP.h | 1 + machine/F7008_2_5.c | 5 +--- machine/F7008_2_5.h | 1 + machine/FG_4GT_2SX_V2_0.c | 5 +--- machine/FG_4GT_2SX_V2_0.h | 1 + machine/FG_8GT_1SX.c | 5 +--- machine/FG_8GT_1SX.h | 1 + machine/FNS1200P.h | 1 + machine/GT_ST018M.h | 1 + machine/GT_ST024M.h | 1 + machine/HASIVO_S1100WP_8GT_1SX_SE.h | 1 + machine/HASIVO_S600W_4GT_2XGT_SE.c | 5 +--- machine/HASIVO_S600W_4GT_2XGT_SE.h | 1 + machine/HC_SWTG124AS.h | 1 + machine/HG0402XG_V1_1.c | 5 +--- machine/HG0402XG_V1_1.h | 1 + machine/HI_K0402WS.c | 5 +--- machine/HI_K0402WS.h | 1 + machine/HI_K0801WS.c | 5 +--- machine/HI_K0801WS.h | 1 + machine/K0501W_V2_0.c | 5 +--- machine/K0501W_V2_0.h | 1 + machine/KP_9000_6XHML_X2.c | 5 +--- machine/KP_9000_6XHML_X2.h | 1 + machine/KP_9000_6XHML_X2_V1_1.h | 1 + machine/KP_9000_6XHML_X2_V1_2.h | 1 + machine/KP_9000_6XHML_X2_V2_1.h | 1 + machine/KP_9000_6XH_X.c | 5 +--- machine/KP_9000_6XH_X.h | 1 + machine/KP_9000_6XH_X2.c | 5 +--- machine/KP_9000_6XH_X2.h | 1 + machine/KP_9000_6XH_X2_V1_1.h | 1 + machine/KP_9000_6XH_X2_V1_2.h | 1 + machine/KP_9000_6XH_X2_V2_1.h | 1 + machine/KP_9000_9XHML_X_V2_2.c | 5 +--- machine/KP_9000_9XHML_X_V2_2.h | 1 + machine/KP_9000_9XHML_X_V3_1.c | 5 +--- machine/KP_9000_9XHML_X_V3_1.h | 1 + machine/KP_9000_9XHML_X_V3_2.h | 1 + machine/KP_9000_9XH_X_EU.c | 5 +--- machine/KP_9000_9XH_X_EU.h | 1 + machine/LIANGUO_HYWS_SGT0108S.c | 5 +--- machine/LIANGUO_HYWS_SGT0108S.h | 1 + machine/LIANGUO_ZX_SWTGW215AS.c | 5 +--- machine/LIANGUO_ZX_SWTGW215AS.h | 1 + machine/ONT_S207CW_62TS_SE.c | 5 +--- machine/ONT_S207CW_62TS_SE.h | 1 + machine/PB_2132.c | 5 +--- machine/PB_2132.h | 1 + machine/PCB_K0402WS_V1.c | 5 +--- machine/PCB_K0402WS_V1.h | 1 + machine/PCB_K0402WS_V2.c | 5 +--- machine/PCB_K0402WS_V2.h | 1 + machine/PCB_K0402WS_V3.h | 1 + machine/PCB_SWTG018AS_V2_1_0.c | 5 +--- machine/PCB_SWTG018AS_V2_1_0.h | 1 + machine/PCB_SWTG024AS_A_2_0_1.c | 5 +--- machine/PCB_SWTG024AS_A_2_0_1.h | 1 + machine/POE_2G080110GS.c | 5 +--- machine/POE_2G080110GS.h | 1 + machine/SIRIVISION_S25G2206FP_V1_1.c | 5 +--- machine/SIRIVISION_S25G2206FP_V1_1.h | 1 + machine/SKS3200_8E1X.h | 1 + machine/STEAMEMO_IG204_V1.c | 5 +--- machine/STEAMEMO_IG204_V1.h | 1 + machine/SWGT024_V2_0_MANAGED.c | 5 +--- machine/SWGT024_V2_0_MANAGED.h | 1 + machine/SWGT024_V2_0_UNMANAGED.c | 5 +--- machine/SWGT024_V2_0_UNMANAGED.h | 1 + machine/SWTG018AS_A_V_2_0.c | 5 +--- machine/SWTG018AS_A_V_2_0.h | 1 + machine/SWTG024AS_A_2_0_1_5C_1SFP.c | 5 +--- machine/SWTG024AS_A_2_0_1_5C_1SFP.h | 1 + machine/SWTG024AS_V2_0.c | 5 +--- machine/SWTG024AS_V2_0.h | 1 + machine/SWTGW218AS.c | 5 +--- machine/SWTGW218AS.h | 1 + machine/TRENDNET_TEG_S562.c | 5 +--- machine/TRENDNET_TEG_S562.h | 1 + machine/YS25_0402M.h | 1 + machine/ZX310S_4T2XH.c | 5 +--- machine/ZX310S_4T2XH.h | 1 + machine/ZX310S_4T2XT.c | 5 +--- machine/ZX310S_4T2XT.h | 1 + machine/default_machine.h | 6 ++++- machine/machine_defs.h | 6 +++++ 91 files changed, 161 insertions(+), 155 deletions(-) diff --git a/doc/adding-a-device.md b/doc/adding-a-device.md index 8d45d198..312f318f 100644 --- a/doc/adding-a-device.md +++ b/doc/adding-a-device.md @@ -1,6 +1,6 @@ # Adding a new device -A device is supported by adding one board definition `.h` and board configuration `.c` file +A device is supported by adding one board header `.h` and board definition `.c` file under `machine/`. the build selects the definition by name, and CI compiles every file it finds. @@ -14,27 +14,34 @@ make MACHINE= | File | Purpose | |------|---------| | `machine/.c` | the `struct machine machine` board definition | -| `machine/.h` | `MACHINE_MODEL`, the model string shown in the UI and the CLI | +| `machine/.h` | `MACHINE_MODEL` (the model string shown in the UI and the CLI) and `MACHINE_CHIPSET` (`RTL8372` or `RTL8373`) | | `doc/devices/.md` + `doc/supported_devices.md` | (only if the board is verified and you want to support it publicly) user-facing documentation | `` is the machine symbol without its `MACHINE_` prefix, so `MACHINE` is passed exactly as spelled on the command line: `make MACHINE=MY_BOARD_1_0` needs `machine/MY_BOARD_1_0.c` and `machine/MY_BOARD_1_0.h`. -## Step 1: the model header +## Step 1: the board header -`machine/.h` only carries the product string. Use the existing files as -the template: +`machine/.h` carries the product string and the SoC family. Use the +existing files as the template: ```c #ifndef _MACHINE_MY_BOARD_1_0_H_ #define _MACHINE_MY_BOARD_1_0_H_ #define MACHINE_MODEL "Brand Model V1.0" +#define MACHINE_CHIPSET RTL8373 #endif ``` +`MACHINE_CHIPSET` is `RTL8373` or `RTL8372`; a build without it will fail. It selects the default +logical port range: `min_port` is `0` for RTL8373 and `3` for RTL8372, while `max_port` is `8`, +the highest logical port index. A board with a different range defines +`MACHINE_MIN_PORT` and/or `MACHINE_MAX_PORT` in its header to override the +defaults. + The device product string is what the CLI or the Web-Interface will print to identify the device; `machine.h` includes it by name. > [!NOTE] @@ -55,10 +62,7 @@ ports and the same number of SFP+ cages. #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, @@ -89,13 +93,16 @@ __code const struct machine machine = { }; ``` +`MACHINE_COMMON_SETTING` (from `machine_defs.h`) initializes `machine_name`, +`isRTL8373`, `min_port` and `max_port` from the header's `MACHINE_MODEL` and +`MACHINE_CHIPSET`. Keep it as the first initializer and list the +board-specific fields after it. + ### Fields | Field | Meaning | |-------|---------| -| `machine_name` | always `MACHINE_MODEL` | -| `isRTL8373` | `1` for an RTL8373 SoC, `0` for RTL8372 | -| `min_port` / `max_port` | range of logical port numbers the device has; `min_port` is `0` for RTL8373 boards and `3` for RTL8372 boards (logical ports 1–2 are the SoC's internal ports on the 8372), `max_port` is usually 8. | +| `MACHINE_COMMON_SETTING` | expands to `machine_name` (`MACHINE_MODEL`), `isRTL8373` (`1` for `RTL8373`, `0` for `RTL8372`), `min_port` and `max_port`; all are derived from the header's `MACHINE_CHIPSET` (see Step 1) | | `n_sfp` | number of SFP+ cages | | `n_10g` | SerDes 10G capability used by the RTL837xN init: `0` none, `1` one, `2` two 10G-capable SerDes | | `log_to_phys_port[9]` | logical port (0-based index) → physical front-panel port number | @@ -130,8 +137,10 @@ apart: ln -s KP_9000_6XHML_X2.c machine/MY_BOARD_1_0.c ``` -The new board still needs `machine/MY_BOARD_1_0.h` (pick the version number on the PCB) with its own -`MACHINE_MODEL`, because `MACHINE_MODEL` is what distinguishes the products. +The new board still needs `machine/MY_BOARD_1_0.h` (pick the version number on +the PCB) with its own `MACHINE_MODEL` and `MACHINE_CHIPSET`: `MACHINE_MODEL` is +what distinguishes the products, and `MACHINE_CHIPSET` must match the SoC of +the board definition being reused. Existing examples: `machine/PCB_K0402WS_V3.c`, `machine/KP_9000_9XHML_X_V3_2.c` and the six `KP_9000_*` revision variants. diff --git a/machine.h b/machine.h index c0e10cd5..c55fb634 100644 --- a/machine.h +++ b/machine.h @@ -15,8 +15,48 @@ #define MACHINE_INC(dir,file) MACHINE_STR(dir/file) +#define RTL8370 0x70 +#define RTL8372 0x72 +#define RTL8373 0x73 + #include MACHINE_INC(MACHINE_DEF_DIR,MACHINE_NAME.h) + +#ifndef MACHINE_CHIPSET +#error "MACHINE_CHIPSET shall be defined in .h file" +#endif + +#ifndef MACHINE_MIN_PORT +#if MACHINE_CHIPSET == RTL8372 +#define MACHINE_MIN_PORT 3 +#else +#define MACHINE_MIN_PORT 0 +#endif +#endif + +#ifndef MACHINE_MAX_PORT +#if MACHINE_CHIPSET == RTL8370 +#define MACHINE_MAX_PORT 7 +#else +#define MACHINE_MAX_PORT 8 +#endif +#endif + +// auto derive SOC_FAMILY +#define RTL836X 6 +#define RTL837X 7 + +#ifdef SOC_FAMILY +#error "SOC_FAMILY can not define manually, shall be auto derived" +#endif +#if (MACHINE_CHIPSET == RTL8372) || (MACHINE_CHIPSET == RTL8373) +#define SOC_FAMILY RTL837X +#elif (MACHINE_CHIPSET == RTL8370 ) +#define SOC_FAMILY RTL836X +#else +#error "Unsupport MACHINE_CHIPSET is specified!" +#endif + #define LED_27 1 // SYSTEM LED #define LED_28_SYS 2 diff --git a/machine/2G08110GSN.h b/machine/2G08110GSN.h index f54133d0..46cd230f 100644 --- a/machine/2G08110GSN.h +++ b/machine/2G08110GSN.h @@ -2,5 +2,6 @@ #define _MACHINE_2G08110GSN_H_ #define MACHINE_MODEL "MokerLink 2G08110GSN" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/2G5F4_10G2_V1_01.c b/machine/2G5F4_10G2_V1_01.c index 9a08e19f..e4a78ad1 100644 --- a/machine/2G5F4_10G2_V1_01.c +++ b/machine/2G5F4_10G2_V1_01.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, /* Same 2M-PCB43-V1.1 board family as the KP-9000-6XH-X2 (see * machine/KP_9000_6XHML_X2.c), but the two SFP+ cages (physical ports 5 and diff --git a/machine/2G5F4_10G2_V1_01.h b/machine/2G5F4_10G2_V1_01.h index d372b58a..80a90fbd 100644 --- a/machine/2G5F4_10G2_V1_01.h +++ b/machine/2G5F4_10G2_V1_01.h @@ -2,5 +2,6 @@ #define _MACHINE_2G5F4_10G2_V1_01_H_ #define MACHINE_MODEL "2G5F4_10G2_V1.01 / SGT0204S" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/DEFAULT_8C_1SFP.h b/machine/DEFAULT_8C_1SFP.h index 2b802a30..f19507e1 100644 --- a/machine/DEFAULT_8C_1SFP.h +++ b/machine/DEFAULT_8C_1SFP.h @@ -2,5 +2,6 @@ #define _MACHINE_DEFAULT_8C_1SFP_H_ #define MACHINE_MODEL "8+1 SFP Port Switch" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/F7008_2_5.c b/machine/F7008_2_5.c index e2d08e61..df6643cc 100644 --- a/machine/F7008_2_5.c +++ b/machine/F7008_2_5.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/F7008_2_5.h b/machine/F7008_2_5.h index c3b0cbbf..f8c78cae 100644 --- a/machine/F7008_2_5.h +++ b/machine/F7008_2_5.h @@ -2,5 +2,6 @@ #define _MACHINE_F7008_2_5_H_ #define MACHINE_MODEL "F7008-2.5 8+1 SFP Port Switch" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/FG_4GT_2SX_V2_0.c b/machine/FG_4GT_2SX_V2_0.c index 9590c6f0..9931a1a1 100644 --- a/machine/FG_4GT_2SX_V2_0.c +++ b/machine/FG_4GT_2SX_V2_0.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/FG_4GT_2SX_V2_0.h b/machine/FG_4GT_2SX_V2_0.h index 8f9697e7..8c819abf 100644 --- a/machine/FG_4GT_2SX_V2_0.h +++ b/machine/FG_4GT_2SX_V2_0.h @@ -2,5 +2,6 @@ #define _MACHINE_FG_4GT_2SX_V2_0_H_ #define MACHINE_MODEL "FG-4GT-2SX_V2.0" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/FG_8GT_1SX.c b/machine/FG_8GT_1SX.c index 0fd3dee0..c232d92a 100644 --- a/machine/FG_8GT_1SX.c +++ b/machine/FG_8GT_1SX.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/FG_8GT_1SX.h b/machine/FG_8GT_1SX.h index e75a9946..789d8a9b 100644 --- a/machine/FG_8GT_1SX.h +++ b/machine/FG_8GT_1SX.h @@ -2,5 +2,6 @@ #define _MACHINE_FG_8GT_1SX_H_ #define MACHINE_MODEL "FG-8GT-1SX" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/FNS1200P.h b/machine/FNS1200P.h index e5691b48..f058e5eb 100644 --- a/machine/FNS1200P.h +++ b/machine/FNS1200P.h @@ -2,5 +2,6 @@ #define _MACHINE_FNS1200P_H_ #define MACHINE_MODEL "FNS-1200P" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/GT_ST018M.h b/machine/GT_ST018M.h index c4550c26..66b0c51f 100644 --- a/machine/GT_ST018M.h +++ b/machine/GT_ST018M.h @@ -2,5 +2,6 @@ #define _MACHINE_GT_ST018M_H_ #define MACHINE_MODEL "GoodTop GT-ST018M" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/GT_ST024M.h b/machine/GT_ST024M.h index be57f788..8662bb31 100644 --- a/machine/GT_ST024M.h +++ b/machine/GT_ST024M.h @@ -2,5 +2,6 @@ #define _MACHINE_GT_ST024M_H_ #define MACHINE_MODEL "GoodTop GT-ST024M" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/HASIVO_S1100WP_8GT_1SX_SE.h b/machine/HASIVO_S1100WP_8GT_1SX_SE.h index d50dfc22..433a42f2 100644 --- a/machine/HASIVO_S1100WP_8GT_1SX_SE.h +++ b/machine/HASIVO_S1100WP_8GT_1SX_SE.h @@ -2,5 +2,6 @@ #define _MACHINE_HASIVO_S1100WP_8GT_1SX_SE_H_ #define MACHINE_MODEL "Hasivo S1100WP-8GT-1SX-SE" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/HASIVO_S600W_4GT_2XGT_SE.c b/machine/HASIVO_S600W_4GT_2XGT_SE.c index e43477d8..223c990f 100644 --- a/machine/HASIVO_S600W_4GT_2XGT_SE.c +++ b/machine/HASIVO_S600W_4GT_2XGT_SE.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 0, .n_10g = 2, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, diff --git a/machine/HASIVO_S600W_4GT_2XGT_SE.h b/machine/HASIVO_S600W_4GT_2XGT_SE.h index 97beb686..dcb40306 100644 --- a/machine/HASIVO_S600W_4GT_2XGT_SE.h +++ b/machine/HASIVO_S600W_4GT_2XGT_SE.h @@ -2,5 +2,6 @@ #define _MACHINE_HASIVO_S600W_4GT_2XGT_SE_H_ #define MACHINE_MODEL "Hasivo S600W-4GT-2XGT-SE" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/HC_SWTG124AS.h b/machine/HC_SWTG124AS.h index 8d4dd648..f1936317 100644 --- a/machine/HC_SWTG124AS.h +++ b/machine/HC_SWTG124AS.h @@ -2,5 +2,6 @@ #define _MACHINE_HC_SWTG124AS_H_ #define MACHINE_MODEL "Horaco HC-SWTG124AS" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/HG0402XG_V1_1.c b/machine/HG0402XG_V1_1.c index 5d7be1e9..5f20e295 100644 --- a/machine/HG0402XG_V1_1.c +++ b/machine/HG0402XG_V1_1.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, diff --git a/machine/HG0402XG_V1_1.h b/machine/HG0402XG_V1_1.h index 628dc168..5b578acc 100644 --- a/machine/HG0402XG_V1_1.h +++ b/machine/HG0402XG_V1_1.h @@ -2,5 +2,6 @@ #define _MACHINE_HG0402XG_V1_1_H_ #define MACHINE_MODEL "HG0402XG V1.1" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/HI_K0402WS.c b/machine/HI_K0402WS.c index 3ad7b241..2c59d8bc 100644 --- a/machine/HI_K0402WS.c +++ b/machine/HI_K0402WS.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/HI_K0402WS.h b/machine/HI_K0402WS.h index d930fce9..18416117 100644 --- a/machine/HI_K0402WS.h +++ b/machine/HI_K0402WS.h @@ -2,5 +2,6 @@ #define _MACHINE_HI_K0402WS_H_ #define MACHINE_MODEL "PCB-K0402WS-V3.0" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/HI_K0801WS.c b/machine/HI_K0801WS.c index 8fba5e82..cc06d550 100644 --- a/machine/HI_K0801WS.c +++ b/machine/HI_K0801WS.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/HI_K0801WS.h b/machine/HI_K0801WS.h index 4321d0fe..ff5a7721 100644 --- a/machine/HI_K0801WS.h +++ b/machine/HI_K0801WS.h @@ -2,5 +2,6 @@ #define _MACHINE_HI_K0801WS_H_ #define MACHINE_MODEL "Hi-Source HI-k0801WS" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/K0501W_V2_0.c b/machine/K0501W_V2_0.c index 75f36c6b..51224523 100644 --- a/machine/K0501W_V2_0.c +++ b/machine/K0501W_V2_0.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, diff --git a/machine/K0501W_V2_0.h b/machine/K0501W_V2_0.h index dbe10df6..b657edf4 100644 --- a/machine/K0501W_V2_0.h +++ b/machine/K0501W_V2_0.h @@ -2,5 +2,6 @@ #define _MACHINE_K0501W_V2_0_H_ #define MACHINE_MODEL "K0501W V2.0" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XHML_X2.c b/machine/KP_9000_6XHML_X2.c index a6520f01..850d7e2a 100644 --- a/machine/KP_9000_6XHML_X2.c +++ b/machine/KP_9000_6XHML_X2.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, diff --git a/machine/KP_9000_6XHML_X2.h b/machine/KP_9000_6XHML_X2.h index da850ae4..67551b56 100644 --- a/machine/KP_9000_6XHML_X2.h +++ b/machine/KP_9000_6XHML_X2.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XHML_X2_H_ #define MACHINE_MODEL "keepLink KP-9000-6XHML-X2" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XHML_X2_V1_1.h b/machine/KP_9000_6XHML_X2_V1_1.h index 1e8b2c49..8d491998 100644 --- a/machine/KP_9000_6XHML_X2_V1_1.h +++ b/machine/KP_9000_6XHML_X2_V1_1.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XHML_X2_V1_1_H_ #define MACHINE_MODEL "keepLink KP-9000-6XHML V1.1" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XHML_X2_V1_2.h b/machine/KP_9000_6XHML_X2_V1_2.h index 484ff3e2..df5fd559 100644 --- a/machine/KP_9000_6XHML_X2_V1_2.h +++ b/machine/KP_9000_6XHML_X2_V1_2.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XHML_X2_V1_2_H_ #define MACHINE_MODEL "keepLink KP-9000-6XHML V1.2" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XHML_X2_V2_1.h b/machine/KP_9000_6XHML_X2_V2_1.h index 4cea1de7..3b276ac7 100644 --- a/machine/KP_9000_6XHML_X2_V2_1.h +++ b/machine/KP_9000_6XHML_X2_V2_1.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XHML_X2_V2_1_H_ #define MACHINE_MODEL "keepLink KP-9000-6XHML V2.1" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XH_X.c b/machine/KP_9000_6XH_X.c index 50dcc10b..bd4b52a3 100644 --- a/machine/KP_9000_6XH_X.c +++ b/machine/KP_9000_6XH_X.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, diff --git a/machine/KP_9000_6XH_X.h b/machine/KP_9000_6XH_X.h index f52d0ad6..664c830b 100644 --- a/machine/KP_9000_6XH_X.h +++ b/machine/KP_9000_6XH_X.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XH_X_H_ #define MACHINE_MODEL "keepLink KP-9000-6XH-X" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XH_X2.c b/machine/KP_9000_6XH_X2.c index aa6a2655..9ea09451 100644 --- a/machine/KP_9000_6XH_X2.c +++ b/machine/KP_9000_6XH_X2.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/KP_9000_6XH_X2.h b/machine/KP_9000_6XH_X2.h index 5493dc79..2d7a8374 100644 --- a/machine/KP_9000_6XH_X2.h +++ b/machine/KP_9000_6XH_X2.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XH_X2_H_ #define MACHINE_MODEL "keepLink KP-9000-6XH-X2" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XH_X2_V1_1.h b/machine/KP_9000_6XH_X2_V1_1.h index 183cc276..f3d2d068 100644 --- a/machine/KP_9000_6XH_X2_V1_1.h +++ b/machine/KP_9000_6XH_X2_V1_1.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XH_X2_V1_1_H_ #define MACHINE_MODEL "keepLink KP-9000-6XH V1.1" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XH_X2_V1_2.h b/machine/KP_9000_6XH_X2_V1_2.h index 4fcd94af..2de3183e 100644 --- a/machine/KP_9000_6XH_X2_V1_2.h +++ b/machine/KP_9000_6XH_X2_V1_2.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XH_X2_V1_2_H_ #define MACHINE_MODEL "keepLink KP-9000-6XH V1.2" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_6XH_X2_V2_1.h b/machine/KP_9000_6XH_X2_V2_1.h index a144dc96..dd1a954c 100644 --- a/machine/KP_9000_6XH_X2_V2_1.h +++ b/machine/KP_9000_6XH_X2_V2_1.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_6XH_X2_V2_1_H_ #define MACHINE_MODEL "keepLink KP-9000-6XH-X2 V2.1" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/KP_9000_9XHML_X_V2_2.c b/machine/KP_9000_9XHML_X_V2_2.c index e73a7514..6c8338b0 100644 --- a/machine/KP_9000_9XHML_X_V2_2.c +++ b/machine/KP_9000_9XHML_X_V2_2.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, .phys_to_log_port = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, diff --git a/machine/KP_9000_9XHML_X_V2_2.h b/machine/KP_9000_9XHML_X_V2_2.h index 2d6d0a7f..4bb261ac 100644 --- a/machine/KP_9000_9XHML_X_V2_2.h +++ b/machine/KP_9000_9XHML_X_V2_2.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_9XHML_X_V2_2_H_ #define MACHINE_MODEL "keepLink KP-9000-9XHML-X V2.2" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/KP_9000_9XHML_X_V3_1.c b/machine/KP_9000_9XHML_X_V3_1.c index 26ea751f..515b59ac 100644 --- a/machine/KP_9000_9XHML_X_V3_1.c +++ b/machine/KP_9000_9XHML_X_V3_1.c @@ -2,10 +2,7 @@ // 2M-PCB23-V3.2 is wired like V3.1 (SFP detection, LEDs, factory MAC location) __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/KP_9000_9XHML_X_V3_1.h b/machine/KP_9000_9XHML_X_V3_1.h index c100b5f8..ae5e8e55 100644 --- a/machine/KP_9000_9XHML_X_V3_1.h +++ b/machine/KP_9000_9XHML_X_V3_1.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_9XHML_X_V3_1_H_ #define MACHINE_MODEL "keepLink KP-9000-9XHML-X V3.1" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/KP_9000_9XHML_X_V3_2.h b/machine/KP_9000_9XHML_X_V3_2.h index e3b4eec2..416cb327 100644 --- a/machine/KP_9000_9XHML_X_V3_2.h +++ b/machine/KP_9000_9XHML_X_V3_2.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_9XHML_X_V3_2_H_ #define MACHINE_MODEL "keepLink KP-9000-9XHML-X V3.2" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/KP_9000_9XH_X_EU.c b/machine/KP_9000_9XH_X_EU.c index 7209e82b..17562565 100644 --- a/machine/KP_9000_9XH_X_EU.c +++ b/machine/KP_9000_9XH_X_EU.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/KP_9000_9XH_X_EU.h b/machine/KP_9000_9XH_X_EU.h index 2269b8fb..74c20b33 100644 --- a/machine/KP_9000_9XH_X_EU.h +++ b/machine/KP_9000_9XH_X_EU.h @@ -2,5 +2,6 @@ #define _MACHINE_KP_9000_9XH_X_EU_H_ #define MACHINE_MODEL "keepLink KP-9000-9XH-X-EU" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/LIANGUO_HYWS_SGT0108S.c b/machine/LIANGUO_HYWS_SGT0108S.c index aff1713c..1160585a 100644 --- a/machine/LIANGUO_HYWS_SGT0108S.c +++ b/machine/LIANGUO_HYWS_SGT0108S.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {2, 1, 4, 3, 5, 6, 7, 8, 9}, .phys_to_log_port = {1, 0, 3, 2, 4, 5, 6, 7, 8}, diff --git a/machine/LIANGUO_HYWS_SGT0108S.h b/machine/LIANGUO_HYWS_SGT0108S.h index f82bd128..310ee653 100644 --- a/machine/LIANGUO_HYWS_SGT0108S.h +++ b/machine/LIANGUO_HYWS_SGT0108S.h @@ -2,5 +2,6 @@ #define _MACHINE_LIANGUO_HYWS_SGT0108S_H_ #define MACHINE_MODEL "Lianguo HYWS-SGT0108S" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/LIANGUO_ZX_SWTGW215AS.c b/machine/LIANGUO_ZX_SWTGW215AS.c index 70414eca..dfd48f49 100644 --- a/machine/LIANGUO_ZX_SWTGW215AS.c +++ b/machine/LIANGUO_ZX_SWTGW215AS.c @@ -1,11 +1,8 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, + MACHINE_COMMON_SETTING, .mac_flash_offset = 0x1FC000, - .min_port = 3, - .max_port = 8, .n_sfp = 1, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, diff --git a/machine/LIANGUO_ZX_SWTGW215AS.h b/machine/LIANGUO_ZX_SWTGW215AS.h index 6c4e2210..840acd4a 100644 --- a/machine/LIANGUO_ZX_SWTGW215AS.h +++ b/machine/LIANGUO_ZX_SWTGW215AS.h @@ -2,5 +2,6 @@ #define _MACHINE_LIANGUO_ZX_SWTGW215AS_H_ #define MACHINE_MODEL "Lianguo ZX-SWTGW215AS" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/ONT_S207CW_62TS_SE.c b/machine/ONT_S207CW_62TS_SE.c index 6ba60778..65e339e6 100644 --- a/machine/ONT_S207CW_62TS_SE.c +++ b/machine/ONT_S207CW_62TS_SE.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 5, 4, 3, 2, 1, 6}, .phys_to_log_port = {7, 6, 5, 4, 3, 8, 0, 0, 0}, diff --git a/machine/ONT_S207CW_62TS_SE.h b/machine/ONT_S207CW_62TS_SE.h index 9938b004..1367900c 100644 --- a/machine/ONT_S207CW_62TS_SE.h +++ b/machine/ONT_S207CW_62TS_SE.h @@ -2,5 +2,6 @@ #define _MACHINE_ONT_S207CW_62TS_SE_H_ #define MACHINE_MODEL "ONT-S207CW-62TS-SE / Binardat 2G06-04210GSM / Binardat 2G06-04210GS" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/PB_2132.c b/machine/PB_2132.c index 8822c066..55388d98 100644 --- a/machine/PB_2132.c +++ b/machine/PB_2132.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/PB_2132.h b/machine/PB_2132.h index a3668767..ac50906b 100644 --- a/machine/PB_2132.h +++ b/machine/PB_2132.h @@ -2,5 +2,6 @@ #define _MACHINE_PB_2132_H_ #define MACHINE_MODEL "PB-2132" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/PCB_K0402WS_V1.c b/machine/PCB_K0402WS_V1.c index 0f365025..59b62387 100644 --- a/machine/PCB_K0402WS_V1.c +++ b/machine/PCB_K0402WS_V1.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/PCB_K0402WS_V1.h b/machine/PCB_K0402WS_V1.h index d1170aa7..189da400 100644 --- a/machine/PCB_K0402WS_V1.h +++ b/machine/PCB_K0402WS_V1.h @@ -2,5 +2,6 @@ #define _MACHINE_PCB_K0402WS_V1_H_ #define MACHINE_MODEL "PCB-K0402WS-V1.0" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/PCB_K0402WS_V2.c b/machine/PCB_K0402WS_V2.c index 71334029..33a9a93d 100644 --- a/machine/PCB_K0402WS_V2.c +++ b/machine/PCB_K0402WS_V2.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/PCB_K0402WS_V2.h b/machine/PCB_K0402WS_V2.h index eb5337ab..36352e43 100644 --- a/machine/PCB_K0402WS_V2.h +++ b/machine/PCB_K0402WS_V2.h @@ -2,5 +2,6 @@ #define _MACHINE_PCB_K0402WS_V2_H_ #define MACHINE_MODEL "PCB-K0402WS-V2.0" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/PCB_K0402WS_V3.h b/machine/PCB_K0402WS_V3.h index f206079d..b31bd3bb 100644 --- a/machine/PCB_K0402WS_V3.h +++ b/machine/PCB_K0402WS_V3.h @@ -2,5 +2,6 @@ #define _MACHINE_PCB_K0402WS_V3_H_ #define MACHINE_MODEL "PCB-K0402WS-V3.0" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/PCB_SWTG018AS_V2_1_0.c b/machine/PCB_SWTG018AS_V2_1_0.c index 1501de45..1eb77872 100644 --- a/machine/PCB_SWTG018AS_V2_1_0.c +++ b/machine/PCB_SWTG018AS_V2_1_0.c @@ -2,11 +2,8 @@ __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, + MACHINE_COMMON_SETTING, .mac_flash_offset = 0x1FC000, - .min_port = 0, - .max_port = 8, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/PCB_SWTG018AS_V2_1_0.h b/machine/PCB_SWTG018AS_V2_1_0.h index fce78470..546fe4d0 100644 --- a/machine/PCB_SWTG018AS_V2_1_0.h +++ b/machine/PCB_SWTG018AS_V2_1_0.h @@ -2,5 +2,6 @@ #define _MACHINE_PCB_SWTG018AS_V2_1_0_H_ #define MACHINE_MODEL "SWTGW218AS (SWTG018AS-V2.1.0)" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/PCB_SWTG024AS_A_2_0_1.c b/machine/PCB_SWTG024AS_A_2_0_1.c index 169e479a..0d20de50 100644 --- a/machine/PCB_SWTG024AS_A_2_0_1.c +++ b/machine/PCB_SWTG024AS_A_2_0_1.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, diff --git a/machine/PCB_SWTG024AS_A_2_0_1.h b/machine/PCB_SWTG024AS_A_2_0_1.h index 2d3b5c22..6785140a 100644 --- a/machine/PCB_SWTG024AS_A_2_0_1.h +++ b/machine/PCB_SWTG024AS_A_2_0_1.h @@ -2,5 +2,6 @@ #define _MACHINE_PCB_SWTG024AS_A_2_0_1_H_ #define MACHINE_MODEL "PCB-SWTG024AS-A-2.0.1" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/POE_2G080110GS.c b/machine/POE_2G080110GS.c index 73f6dc8c..acd4129f 100644 --- a/machine/POE_2G080110GS.c +++ b/machine/POE_2G080110GS.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/POE_2G080110GS.h b/machine/POE_2G080110GS.h index 40ce3415..3fafc0d5 100644 --- a/machine/POE_2G080110GS.h +++ b/machine/POE_2G080110GS.h @@ -2,5 +2,6 @@ #define _MACHINE_POE_2G080110GS_H_ #define MACHINE_MODEL "MokerLink POE-2G080110GS" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/SIRIVISION_S25G2206FP_V1_1.c b/machine/SIRIVISION_S25G2206FP_V1_1.c index fde745b5..3f0db022 100644 --- a/machine/SIRIVISION_S25G2206FP_V1_1.c +++ b/machine/SIRIVISION_S25G2206FP_V1_1.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/SIRIVISION_S25G2206FP_V1_1.h b/machine/SIRIVISION_S25G2206FP_V1_1.h index 6dbb7c71..7bb5c9a2 100644 --- a/machine/SIRIVISION_S25G2206FP_V1_1.h +++ b/machine/SIRIVISION_S25G2206FP_V1_1.h @@ -2,5 +2,6 @@ #define _MACHINE_SIRIVISION_S25G2206FP_V1_1_H_ #define MACHINE_MODEL "SIRIVISION S25G2206FP V1.1" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/SKS3200_8E1X.h b/machine/SKS3200_8E1X.h index e644baf4..ca1e7846 100644 --- a/machine/SKS3200_8E1X.h +++ b/machine/SKS3200_8E1X.h @@ -2,6 +2,7 @@ #define _MACHINE_SKS3200_8E1X_H_ #define MACHINE_MODEL "XikeStor SKS3200-8E1X" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/STEAMEMO_IG204_V1.c b/machine/STEAMEMO_IG204_V1.c index 23d876a7..a7d765e3 100644 --- a/machine/STEAMEMO_IG204_V1.c +++ b/machine/STEAMEMO_IG204_V1.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/STEAMEMO_IG204_V1.h b/machine/STEAMEMO_IG204_V1.h index 170840d7..752493d2 100644 --- a/machine/STEAMEMO_IG204_V1.h +++ b/machine/STEAMEMO_IG204_V1.h @@ -2,5 +2,6 @@ #define _MACHINE_STEAMEMO_IG204_V1_H_ #define MACHINE_MODEL "Steamemo IG204 V1" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/SWGT024_V2_0_MANAGED.c b/machine/SWGT024_V2_0_MANAGED.c index ad52bc5b..b3997fd3 100644 --- a/machine/SWGT024_V2_0_MANAGED.c +++ b/machine/SWGT024_V2_0_MANAGED.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/SWGT024_V2_0_MANAGED.h b/machine/SWGT024_V2_0_MANAGED.h index c5f95a04..4ee99e67 100644 --- a/machine/SWGT024_V2_0_MANAGED.h +++ b/machine/SWGT024_V2_0_MANAGED.h @@ -2,5 +2,6 @@ #define _MACHINE_SWGT024_V2_0_MANAGED_H_ #define MACHINE_MODEL "SWGT024 V2.0 Managed" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/SWGT024_V2_0_UNMANAGED.c b/machine/SWGT024_V2_0_UNMANAGED.c index 9008bb4b..b07f6d8f 100644 --- a/machine/SWGT024_V2_0_UNMANAGED.c +++ b/machine/SWGT024_V2_0_UNMANAGED.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/SWGT024_V2_0_UNMANAGED.h b/machine/SWGT024_V2_0_UNMANAGED.h index 8391b42a..cf286b04 100644 --- a/machine/SWGT024_V2_0_UNMANAGED.h +++ b/machine/SWGT024_V2_0_UNMANAGED.h @@ -2,5 +2,6 @@ #define _MACHINE_SWGT024_V2_0_UNMANAGED_H_ #define MACHINE_MODEL "SWGT024 V2.0 Unmanaged" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/SWTG018AS_A_V_2_0.c b/machine/SWTG018AS_A_V_2_0.c index 8304bf7e..7d749fde 100644 --- a/machine/SWTG018AS_A_V_2_0.c +++ b/machine/SWTG018AS_A_V_2_0.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/SWTG018AS_A_V_2_0.h b/machine/SWTG018AS_A_V_2_0.h index 82b7f632..60c499ec 100644 --- a/machine/SWTG018AS_A_V_2_0.h +++ b/machine/SWTG018AS_A_V_2_0.h @@ -2,5 +2,6 @@ #define _MACHINE_SWTG018AS_A_V_2_0_H_ #define MACHINE_MODEL "SWTG018AS-A V2.0" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/SWTG024AS_A_2_0_1_5C_1SFP.c b/machine/SWTG024AS_A_2_0_1_5C_1SFP.c index 2a3ad97b..de37693e 100644 --- a/machine/SWTG024AS_A_2_0_1_5C_1SFP.c +++ b/machine/SWTG024AS_A_2_0_1_5C_1SFP.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, diff --git a/machine/SWTG024AS_A_2_0_1_5C_1SFP.h b/machine/SWTG024AS_A_2_0_1_5C_1SFP.h index f492765f..6345a9ce 100644 --- a/machine/SWTG024AS_A_2_0_1_5C_1SFP.h +++ b/machine/SWTG024AS_A_2_0_1_5C_1SFP.h @@ -2,5 +2,6 @@ #define _MACHINE_SWTG024AS_A_2_0_1_5C_1SFP_H_ #define MACHINE_MODEL "SWTG024AS-A-V2.0.1-5C-1SFP" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/SWTG024AS_V2_0.c b/machine/SWTG024AS_V2_0.c index eb0652e2..b1902329 100644 --- a/machine/SWTG024AS_V2_0.c +++ b/machine/SWTG024AS_V2_0.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, diff --git a/machine/SWTG024AS_V2_0.h b/machine/SWTG024AS_V2_0.h index bd37eece..53287e84 100644 --- a/machine/SWTG024AS_V2_0.h +++ b/machine/SWTG024AS_V2_0.h @@ -2,5 +2,6 @@ #define _MACHINE_SWTG024AS_V2_0_H_ #define MACHINE_MODEL "SWTG024AS-V2.0" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/SWTGW218AS.c b/machine/SWTGW218AS.c index cbb2a2f0..0d9d3f6e 100644 --- a/machine/SWTGW218AS.c +++ b/machine/SWTGW218AS.c @@ -2,11 +2,8 @@ __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 1, + MACHINE_COMMON_SETTING, .mac_flash_offset = 0x1FC000, - .min_port = 0, - .max_port = 8, .n_sfp = 1, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, diff --git a/machine/SWTGW218AS.h b/machine/SWTGW218AS.h index ed9c9e54..33812670 100644 --- a/machine/SWTGW218AS.h +++ b/machine/SWTGW218AS.h @@ -2,5 +2,6 @@ #define _MACHINE_SWTGW218AS_H_ #define MACHINE_MODEL "SWTGW218AS 8+1 Managed Switch" +#define MACHINE_CHIPSET RTL8373 #endif diff --git a/machine/TRENDNET_TEG_S562.c b/machine/TRENDNET_TEG_S562.c index 3cfc12c5..a37bc84a 100644 --- a/machine/TRENDNET_TEG_S562.c +++ b/machine/TRENDNET_TEG_S562.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, diff --git a/machine/TRENDNET_TEG_S562.h b/machine/TRENDNET_TEG_S562.h index c08ae7a9..724369ea 100644 --- a/machine/TRENDNET_TEG_S562.h +++ b/machine/TRENDNET_TEG_S562.h @@ -2,5 +2,6 @@ #define _MACHINE_TRENDNET_TEG_S562_H_ #define MACHINE_MODEL "Trendnet TEG-S562" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/YS25_0402M.h b/machine/YS25_0402M.h index 1df79241..67550200 100644 --- a/machine/YS25_0402M.h +++ b/machine/YS25_0402M.h @@ -2,5 +2,6 @@ #define _MACHINE_YS25_0402M_H_ #define MACHINE_MODEL "YuanLey YS25-0402M" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/ZX310S_4T2XH.c b/machine/ZX310S_4T2XH.c index f5313e02..583263e4 100644 --- a/machine/ZX310S_4T2XH.c +++ b/machine/ZX310S_4T2XH.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 1, .n_10g = 1, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, diff --git a/machine/ZX310S_4T2XH.h b/machine/ZX310S_4T2XH.h index f0873be3..1f51c9dd 100644 --- a/machine/ZX310S_4T2XH.h +++ b/machine/ZX310S_4T2XH.h @@ -2,5 +2,6 @@ #define _MACHINE_ZX310S_4T2XH_H_ #define MACHINE_MODEL "ZX310S-4T2XH" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/ZX310S_4T2XT.c b/machine/ZX310S_4T2XT.c index c7ec95b9..825cf810 100644 --- a/machine/ZX310S_4T2XT.c +++ b/machine/ZX310S_4T2XT.c @@ -1,10 +1,7 @@ #include "machine_defs.h" __code const struct machine machine = { - .machine_name = MACHINE_MODEL, - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, + MACHINE_COMMON_SETTING, .n_sfp = 0, .n_10g = 2, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, diff --git a/machine/ZX310S_4T2XT.h b/machine/ZX310S_4T2XT.h index 15b76217..8903d9f6 100644 --- a/machine/ZX310S_4T2XT.h +++ b/machine/ZX310S_4T2XT.h @@ -2,5 +2,6 @@ #define _MACHINE_ZX310S_4T2XT_H_ #define MACHINE_MODEL "ZX310S_4T2XT" +#define MACHINE_CHIPSET RTL8372 #endif diff --git a/machine/default_machine.h b/machine/default_machine.h index 0919674f..56233fee 100644 --- a/machine/default_machine.h +++ b/machine/default_machine.h @@ -11,7 +11,11 @@ * MACHINE_MODEL is deliberately not defined here: a build that reaches this * header must not silently pick up some default model string. Any code that * needs MACHINE_MODEL therefore fails to compile unless a real machine is - * selected. + * selected. MACHINE_CHIPSET has to be present because machine.h requires it; + * the tests supply their own `machine` object, so the chipset-derived port + * defaults below it are unused. */ +#define MACHINE_CHIPSET RTL8373 + #endif diff --git a/machine/machine_defs.h b/machine/machine_defs.h index 94b989c4..4775a58f 100644 --- a/machine/machine_defs.h +++ b/machine/machine_defs.h @@ -41,4 +41,10 @@ (scl_pin) == GPIO50_I2C_SCL2_UART1_TX ? 2 : \ (scl_pin) == GPIO40_I2C_SCL3_MDC1 ? 3 : I2CBUS_INVALID) +#define MACHINE_COMMON_SETTING \ + .machine_name = MACHINE_MODEL, \ + .isRTL8373 = MACHINE_CHIPSET == RTL8373, \ + .min_port = MACHINE_MIN_PORT, \ + .max_port = MACHINE_MAX_PORT + #endif