From fe994091dd843b4d18070d3a52b9ffbf1bf4c1c6 Mon Sep 17 00:00:00 2001 From: Wolf Lin Date: Mon, 17 Aug 2020 13:49:06 +0800 Subject: [PATCH] Pegatron common_bde: add support for FN-8032-BN-F series. Add below three models support into pegatron_common_bde: 1. Pegatron_fn_8032_bn_f: with Nephos Leo NP8579 x1 32x400GbE QSFP-DD ports 2. Pegatron_fn_8032_ba_f: with Nephos Leo NP8579 x1 32x400GbE QSFP-DD ports and Aspeed AT2500 BMC 3. Pegatron_fm_6256_ba_f: with Marvell Falcon 98CX8512 x1 48x10GbE/25GbE SFP28 ports, and 8x40GbE/100GbE QSFP28 ports and ASpeed AT2500 BMC The CPU is a Intel Broadwell-DE D1527 Other changeset added into this commit are: - Supoort IPMI Signed-off-by: Wolf Lin Signed-off-by: Max Lee Signed-off-by: Alex Doyle --- build-config/scripts/onie-build-targets.json | 2 +- machine/pegatron/pegatron_common_bde/INSTALL | 10 + .../patches/add-fn-8032-bn-f-platform.patch | 63 +++++ .../patches/onie-syseeprom-support-ipmi.patch | 210 +++++++++++++++ .../busybox/patches/series | 2 + ...id-phy-reset-during-system-rebooting.patch | 253 ++++++++++++++++++ .../pegatron_common_bde/kernel/config | 14 + .../pegatron_common_bde/kernel/series | 1 + .../rootconf/sysroot-lib-onie/force2astonM.sh | 18 ++ .../sysroot-lib-onie/network-driver-platform | 25 ++ .../rootconf/sysroot-rcS/S60rc.local | 3 + .../rootconf/sysroot_machine.make | 11 +- 12 files changed, 610 insertions(+), 2 deletions(-) create mode 100644 machine/pegatron/pegatron_common_bde/busybox/patches/add-fn-8032-bn-f-platform.patch create mode 100644 machine/pegatron/pegatron_common_bde/busybox/patches/onie-syseeprom-support-ipmi.patch create mode 100644 machine/pegatron/pegatron_common_bde/kernel/avoid-phy-reset-during-system-rebooting.patch create mode 100755 machine/pegatron/pegatron_common_bde/rootconf/sysroot-lib-onie/force2astonM.sh create mode 100755 machine/pegatron/pegatron_common_bde/rootconf/sysroot-lib-onie/network-driver-platform create mode 100755 machine/pegatron/pegatron_common_bde/rootconf/sysroot-rcS/S60rc.local diff --git a/build-config/scripts/onie-build-targets.json b/build-config/scripts/onie-build-targets.json index 1b1792082..0cf455e7f 100644 --- a/build-config/scripts/onie-build-targets.json +++ b/build-config/scripts/onie-build-targets.json @@ -211,7 +211,7 @@ { "Vendor": "nxp", "Platform": "nxp_p2041rdb", "BuildEnv": "Debian9", "Release": "None", "Architecture": "PowerPC", "Notes": "Compile error" }, { "Vendor": "nxp", "Platform": "nxp_t2080rdb", "BuildEnv": "Debian9", "Release": "None", "Architecture": "PowerPC", "Notes": "Compile error" }, - { "Vendor": "pegatron", "Platform": "pegatron_common_bde", "BuildEnv": "Debian9", "Release": "2020.05br", "Architecture": "amd64", "Notes": "No notes." }, + { "Vendor": "pegatron", "Platform": "pegatron_common_bde", "BuildEnv": "Debian9", "Release": "2020.08br", "Architecture": "amd64", "Notes": "No notes." }, { "Vendor": "pegatron", "Platform": "pegatron_common_rgl", "BuildEnv": "Debian9", "Release": "2020.05br", "Architecture": "amd64", "Notes": "No notes." }, { "Vendor": "pegatron", "Platform": "pegatron_fn_6254_dn_f", "BuildEnv": "Debian9", "Release": "2020.05br", "Architecture": "amd64", "Notes": "No notes." }, diff --git a/machine/pegatron/pegatron_common_bde/INSTALL b/machine/pegatron/pegatron_common_bde/INSTALL index 8f945e9c9..d6c8a4b11 100755 --- a/machine/pegatron/pegatron_common_bde/INSTALL +++ b/machine/pegatron/pegatron_common_bde/INSTALL @@ -19,6 +19,16 @@ detection, please refer to ``rootconf/sysroot-lib-onie/gen-config-platform`` - Pegatron_fm_6256_bn_f 48x10GbE/25GbE SFP28 ports, and 8x40GbE/100GbE QSFP28 ports + - Pegatron_fm_6256_ba_f + 48x10GbE/25GbE SFP28 ports, and 8x40GbE/100GbE QSFP28 ports + with BMC + + - Pegatron_fn_8032_bn_f + 32x400GbE QSFP-DD ports + + - Pegatron_fn_8032_ba_f + 32x400GbE QSFP-DD ports with BMC + Specification =============== - Modularized CPU board design diff --git a/machine/pegatron/pegatron_common_bde/busybox/patches/add-fn-8032-bn-f-platform.patch b/machine/pegatron/pegatron_common_bde/busybox/patches/add-fn-8032-bn-f-platform.patch new file mode 100644 index 000000000..16255e974 --- /dev/null +++ b/machine/pegatron/pegatron_common_bde/busybox/patches/add-fn-8032-bn-f-platform.patch @@ -0,0 +1,63 @@ +From c05c4dfe04c4f65b41b75f75e032443903aae43f Mon Sep 17 00:00:00 2001 +From: Wolf Lin +Date: Thu, 3 Sep 2020 09:36:55 +0800 +Subject: [PATCH] Add 'fn_8032_bn_f' platform support. + +--- + include/mb_detect.h | 3 +++ + miscutils/mb_detect.c | 3 +++ + miscutils/sys_eeprom_i2c.c | 8 ++++++++ + 3 files changed, 14 insertions(+) + +diff --git a/include/mb_detect.h b/include/mb_detect.h +index dac33fa..b10cb88 100644 +--- a/include/mb_detect.h ++++ b/include/mb_detect.h +@@ -27,7 +27,10 @@ enum { + BUGATTI = 0, + JAGUAR, + BUGATTI2, ++ ASTONMARTIN, ++ ASTONMARTINWITHBMC, + GEMINI, ++ GEMINIWITHBMC, + MB_LAST + }; + +diff --git a/miscutils/mb_detect.c b/miscutils/mb_detect.c +index cbf1bcb..16835e7 100644 +--- a/miscutils/mb_detect.c ++++ b/miscutils/mb_detect.c +@@ -10,7 +10,10 @@ SysBoardInfo sysBoardInfo[] = { + { 0x04, "bugatti", "FB_6032_BN_F\0", "fb_6032_bn_f\0", 0, 0 }, + { 0x05, "jaguar", "FB_6256_BN_B\0", "fb_6256_bn_b\0", 0, 0 }, + { 0x07, "bugatti2", "FB_6032_BN_F\0", "fb_6032_bn_f\0", 1, 0 }, ++ { 0x08, "astonMartin", "FN_8032_BN_F\0", "fn_8032_bn_f\0", 0, 0 }, ++ { 0x08, "astonMartin(BMC)", "FN_8032_BA_F\0", "fn_8032_ba_f\0", 0, 1 }, + { 0x09, "gemini", "FM_6256_BN_F\0", "fm_6256_bn_f\0", 0, 0 }, ++ { 0x09, "gemini(BMC)", "FM_6256_BA_F\0", "fm_6256_ba_f\0", 0, 1 } + }; + + static u32 mb_id_get_from_cpld(void) +diff --git a/miscutils/sys_eeprom_i2c.c b/miscutils/sys_eeprom_i2c.c +index 72cf0c5..bc451da 100644 +--- a/miscutils/sys_eeprom_i2c.c ++++ b/miscutils/sys_eeprom_i2c.c +@@ -55,6 +55,14 @@ struct mb_info mb_i2c_info[] = { + .wp_disable = 0xfb, + .wp_enable = 0x04 + }, ++ { ++ .motherboard_id = 0x8, /* Aston Martin */ ++ .mux = {.addr = 0x73, .channel = 0}, ++ .eeprom_addr = 0x74, ++ .eeprom_offset = 0x01, ++ .wp_disable = 0xfd, ++ .wp_enable = 0x02 ++ }, + { + .motherboard_id = 0x9, /* Gemini */ + .mux = {.addr = 0x73, .channel = 1}, +-- +2.17.1 + diff --git a/machine/pegatron/pegatron_common_bde/busybox/patches/onie-syseeprom-support-ipmi.patch b/machine/pegatron/pegatron_common_bde/busybox/patches/onie-syseeprom-support-ipmi.patch new file mode 100644 index 000000000..3746ecd98 --- /dev/null +++ b/machine/pegatron/pegatron_common_bde/busybox/patches/onie-syseeprom-support-ipmi.patch @@ -0,0 +1,210 @@ +From fc2a6d562c71703a1d8a9670298180b7aacff7b5 Mon Sep 17 00:00:00 2001 +From: GeorgeWu +Date: Tue, 4 Jun 2019 09:05:58 +0800 +Subject: [PATCH] onie-syseeprom support IPMI + +--- + miscutils/Kbuild.src | 2 +- + miscutils/sys_eeprom_alt.c | 148 +++++++++++++++++++++++++++++++++++++ + miscutils/sys_eeprom_i2c.c | 8 +- + 3 files changed, 153 insertions(+), 5 deletions(-) + create mode 100755 miscutils/sys_eeprom_alt.c + +diff --git a/miscutils/Kbuild.src b/miscutils/Kbuild.src +index d45fd4e..3dd45fa 100644 +--- a/miscutils/Kbuild.src ++++ b/miscutils/Kbuild.src +@@ -52,7 +52,7 @@ lib-$(CONFIG_UBOOT_ENV) += fw_env.o + lib-$(CONFIG_VOLNAME) += volname.o + lib-$(CONFIG_WATCHDOG) += watchdog.o + lib-$(CONFIG_SYS_EEPROM) += sys_eeprom.o onie_tlvinfo.o +-lib-$(CONFIG_SYS_EEPROM_DEVICE_I2C) += sys_eeprom_i2c.o 24cXX.o mb_detect.o gpio.o ++lib-$(CONFIG_SYS_EEPROM_DEVICE_I2C) += sys_eeprom_i2c.o 24cXX.o mb_detect.o gpio.o sys_eeprom_alt.o + lib-$(CONFIG_SYS_EEPROM_DEVICE_MTD) += sys_eeprom_mtd.o + lib-$(CONFIG_SYS_EEPROM_DEVICE_DISK) += sys_eeprom_disk.o + lib-$(CONFIG_SYS_EEPROM_SYSFS_FILE) += sys_eeprom_sysfs_file.o +diff --git a/miscutils/sys_eeprom_alt.c b/miscutils/sys_eeprom_alt.c +new file mode 100755 +index 0000000..14f4dec +--- /dev/null ++++ b/miscutils/sys_eeprom_alt.c +@@ -0,0 +1,148 @@ ++#include "libbb.h" ++#include "onie_tlvinfo.h" ++#include "sys_eeprom.h" ++#include ++ ++#define DATA_SIZE (128) ++#define EEPROM_READ "ipmitool raw 0x3C 0x10" ++#define EEPROM_WRITE "ipmitool raw 0x3C 0x11" ++char cmd[sizeof(EEPROM_READ) + 15 + 5*DATA_SIZE + 1]; ++size_t cmd_length = sizeof(cmd); ++ ++extern int i2c_read_sys_eeprom(void *eeprom_data, int offset, int len); ++extern int i2c_write_sys_eeprom(void *eeprom_data, int len); ++int ipmi_read_sys_eeprom(void *eeprom_data, int offset, int len); ++int ipmi_write_sys_eeprom(void *eeprom_data, int len); ++ ++int ipmi_read_sys_eeprom(void *eeprom_data, int offset, int len) ++{ ++ int i; ++ int read_len; ++ int ipmi_offset; ++ int ipmi_len; ++ FILE *fd; ++ char *c = eeprom_data; ++ char *cmd_p; ++ unsigned int data; ++ ++ read_len = 0; ++ while (read_len < len) { ++ ipmi_offset = offset + SYS_EEPROM_OFFSET + read_len; ++ ipmi_len = len - read_len; ++ if (ipmi_len > DATA_SIZE) { ++ ipmi_len = DATA_SIZE; ++ } ++ memset(cmd, 0, cmd_length); ++ cmd_p = cmd; ++ cmd_p += sprintf(cmd_p, "%s",EEPROM_READ); ++ if (SYS_EEPROM_MAX_SIZE > 256) { ++ cmd_p += sprintf(cmd_p, " 0x%02x",(ipmi_offset>>8)&0x0ff); ++ cmd_p += sprintf(cmd_p, " 0x%02x",ipmi_offset&0x0ff); ++ } else { ++ cmd_p += sprintf(cmd_p, " 0x%02x",ipmi_offset); ++ } ++ cmd_p += sprintf(cmd_p, " 0x%02x",ipmi_len); ++ ++ fd = popen(cmd, "r"); ++ if (fd == NULL) { ++ fprintf(stderr, "Cannot open file: %s\n", strerror(errno)); ++ return -1; ++ } ++ i = 0; ++ while (i < ipmi_len) { ++ fscanf(fd, "%2x", &data); ++ if (feof(fd)) { ++ break; ++ } ++ *c = data; ++ i++; c++; ++ } ++ pclose(fd); ++ if (i != ipmi_len) { ++ fprintf(stderr, "ERROR: expected length: %d; read length: %d\n", ipmi_len, i); ++ fprintf(stderr, "%s\n", cmd); ++ return -1; ++ } ++ read_len += i; ++ } ++ ++ return 0; ++} ++ ++int ipmi_write_sys_eeprom(void *eeprom_data, int len) ++{ ++ int i; ++ int write_len; ++ int ipmi_offset; ++ int ipmi_len; ++ char *c = eeprom_data; ++ char *cmd_p; ++ ++ write_len = 0; ++ while (write_len < len) { ++ ipmi_offset = SYS_EEPROM_OFFSET + write_len; ++ ipmi_len = len - write_len; ++ if (ipmi_len > DATA_SIZE) { ++ ipmi_len = DATA_SIZE; ++ } ++ memset(cmd, 0, cmd_length); ++ cmd_p = cmd; ++ cmd_p += sprintf(cmd_p, "%s",EEPROM_WRITE); ++ if (SYS_EEPROM_MAX_SIZE > 256) { ++ cmd_p += sprintf(cmd_p, " 0x%02x",(ipmi_offset>>8)&0x0ff); ++ cmd_p += sprintf(cmd_p, " 0x%02x",ipmi_offset&0x0ff); ++ } else { ++ cmd_p += sprintf(cmd_p, " 0x%02x",ipmi_offset); ++ } ++ cmd_p += sprintf(cmd_p, " 0x%02x",ipmi_len); ++ i = 0; ++ cmd_p = cmd + strlen(cmd); ++ while (i < ipmi_len) { ++ sprintf(cmd_p, " 0x%02x", *c); ++ i++; c++; cmd_p += 5; ++ } ++ write_len += i; ++ if (system(cmd) != 0) { ++ fprintf(stderr, "Write error: %s\n", strerror(errno)); ++ fprintf(stderr, "%s\n", cmd); ++ return -1; ++ } ++ } ++ ++ return 0; ++} ++ ++int read_sys_eeprom(void *eeprom_data, int offset, int len) ++{ ++ u32 index = -1; ++ u32 support_bmc = 0; ++ ++ index = mb_index_get(); ++ support_bmc = mb_index_support_bmc(index); ++ ++ if (support_bmc && bmc_is_available() == 1) ++ { ++ return ipmi_read_sys_eeprom(eeprom_data, offset, len); ++ } ++ else ++ { ++ return i2c_read_sys_eeprom(eeprom_data, offset, len); ++ } ++} ++ ++int write_sys_eeprom(void *eeprom_data, int len) ++{ ++ u32 index = -1; ++ u32 support_bmc = 0; ++ ++ index = mb_index_get(); ++ support_bmc = mb_index_support_bmc(index); ++ if (support_bmc && bmc_is_available() == 1) ++ { ++ return ipmi_write_sys_eeprom(eeprom_data, len); ++ } ++ else ++ { ++ return i2c_write_sys_eeprom(eeprom_data, len); ++ } ++} +diff --git a/miscutils/sys_eeprom_i2c.c b/miscutils/sys_eeprom_i2c.c +index 874f414..d6dcdea 100644 +--- a/miscutils/sys_eeprom_i2c.c ++++ b/miscutils/sys_eeprom_i2c.c +@@ -197,9 +197,9 @@ static int sys_eeprom_write_protect_set(int enable) + } + + /* +- * read_sys_eeprom - read the hwinfo from i2c EEPROM ++ * i2c_read_sys_eeprom - read the hwinfo from i2c EEPROM + */ +-int read_sys_eeprom(void *eeprom_data, int offset, int len) ++int i2c_read_sys_eeprom(void *eeprom_data, int offset, int len) + { + int ret = 0; + struct eeprom e; +@@ -232,9 +232,9 @@ int read_sys_eeprom(void *eeprom_data, int offset, int len) + } + + /* +- * write_sys_eeprom - write the hwinfo to i2c EEPROM ++ * i2c_write_sys_eeprom - write the hwinfo to i2c EEPROM + */ +-int write_sys_eeprom(void *eeprom_data, int len) ++int i2c_write_sys_eeprom(void *eeprom_data, int len) + { + int ret = 0; + struct eeprom e; +-- +2.17.1 + diff --git a/machine/pegatron/pegatron_common_bde/busybox/patches/series b/machine/pegatron/pegatron_common_bde/busybox/patches/series index 7035b22c2..c69a2626f 100755 --- a/machine/pegatron/pegatron_common_bde/busybox/patches/series +++ b/machine/pegatron/pegatron_common_bde/busybox/patches/series @@ -5,3 +5,5 @@ onie-sys-eeprom-mux-enable.patch onie-sys-eeprom-write-protection.patch support-i2c-mux-driver-pca9641.patch Add-force-option-for-sys_eeprom.patch +add-fn-8032-bn-f-platform.patch +onie-syseeprom-support-ipmi.patch diff --git a/machine/pegatron/pegatron_common_bde/kernel/avoid-phy-reset-during-system-rebooting.patch b/machine/pegatron/pegatron_common_bde/kernel/avoid-phy-reset-during-system-rebooting.patch new file mode 100644 index 000000000..cf525870f --- /dev/null +++ b/machine/pegatron/pegatron_common_bde/kernel/avoid-phy-reset-during-system-rebooting.patch @@ -0,0 +1,253 @@ +From e4f4ff6b680e2233871a24b13be29c7485eaf6d9 Mon Sep 17 00:00:00 2001 +From: Wolf Lin +Date: Thu, 9 Apr 2020 11:19:26 +0800 +Subject: [PATCH] Avoid PHY reset during system rebooting + +--- + drivers/net/ethernet/intel/igb/bcm_phy.c | 6 +++ + drivers/net/ethernet/intel/igb/e1000_82575.c | 20 ++++++++++ + drivers/net/ethernet/intel/igb/e1000_82575.h | 2 + + drivers/net/ethernet/intel/igb/e1000_phy.c | 42 ++++++++++++++++++++ + drivers/net/ethernet/intel/igb/igb_main.c | 16 ++++++-- + 5 files changed, 82 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/intel/igb/bcm_phy.c b/drivers/net/ethernet/intel/igb/bcm_phy.c +index 7f3d81a1fc7d..af9882480da9 100644 +--- a/drivers/net/ethernet/intel/igb/bcm_phy.c ++++ b/drivers/net/ethernet/intel/igb/bcm_phy.c +@@ -1,4 +1,5 @@ + #include "e1000_hw.h" ++#include "e1000_82575.h" + + /* + * 1000Base-T Control Register +@@ -259,6 +260,11 @@ int bcm54616_config_init(struct e1000_hw *hw) + u16 regval; + int i; + //int reg; ++ u32 status; ++ ++ status = bmc_is_available(); ++ if (status) ++ return 0; + + /* reset PHY */ + regval = (1<<15); +diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c +index 486f8a63df4e..c977e537deb0 100644 +--- a/drivers/net/ethernet/intel/igb/e1000_82575.c ++++ b/drivers/net/ethernet/intel/igb/e1000_82575.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + #include "e1000_mac.h" + #include "e1000_82575.h" +@@ -73,11 +74,23 @@ static s32 igb_update_nvm_checksum_i350(struct e1000_hw *hw); + static const u16 e1000_82580_rxpbs_table[] = { + 36, 72, 144, 1, 2, 4, 8, 16, 35, 70, 140 }; + ++static int bmc_available = 0; ++module_param(bmc_available, int, S_IRUGO); ++MODULE_PARM_DESC(bmc_available, "bmc_available - 0 disable; 1 enable;"); ++ + /* Due to a hw errata, if the host tries to configure the VFTA register + * while performing queries from the BMC or DMA, then the VFTA in some + * cases won't be written. + */ + ++u32 bmc_is_available(void) ++{ ++ if (bmc_available) ++ return 1; ++ ++ return 0; ++} ++ + /** + * igb_write_vfta_i350 - Write value to VLAN filter table + * @hw: pointer to the HW structure +@@ -962,6 +975,7 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw) + { + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; ++ u32 status; + + /* This isn't a true "hard" reset, but is the only reset + * available to us at this time. +@@ -969,6 +983,12 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw) + + hw_dbg("Soft resetting SGMII attached PHY...\n"); + ++ status = bmc_is_available(); ++ if (status) { ++ ret_val = 0; ++ goto out; ++ } ++ + /* SFP documentation requires the following to configure the SPF module + * to work on SGMII. No further documentation is given. + */ +diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h +index acf06051e111..ffdeb73ef4af 100644 +--- a/drivers/net/ethernet/intel/igb/e1000_82575.h ++++ b/drivers/net/ethernet/intel/igb/e1000_82575.h +@@ -261,6 +261,8 @@ struct e1000_adv_tx_context_desc { + + #define ALL_QUEUES 0xFFFF + ++u32 bmc_is_available(void); ++ + /* RX packet buffer size defines */ + #define E1000_RXPBS_SIZE_MASK_82576 0x0000007F + void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *, bool, int); +diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c +index 4c9290635233..e4ffd99e6d21 100644 +--- a/drivers/net/ethernet/intel/igb/e1000_phy.c ++++ b/drivers/net/ethernet/intel/igb/e1000_phy.c +@@ -26,6 +26,7 @@ + + #include "e1000_mac.h" + #include "e1000_phy.h" ++#include "e1000_82575.h" + + static s32 igb_phy_setup_autoneg(struct e1000_hw *hw); + static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw, +@@ -661,10 +662,15 @@ s32 igb_copper_link_setup_m88_gen2(struct e1000_hw *hw) + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 phy_data; ++ u32 status; + + if (phy->reset_disable) + return 0; + ++ status = bmc_is_available(); ++ if (status) ++ return 0; ++ + /* Enable CRS on Tx. This must be set for half-duplex operation. */ + ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); + if (ret_val) +@@ -894,6 +900,14 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw) + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 phy_ctrl; ++ u32 status; ++ ++ status = bmc_is_available(); ++ if (status) { ++ hw->mac.get_link_status = true; ++ ret_val = 0; ++ goto out; ++ } + + /* Perform some bounds checking on the autoneg advertisement + * parameter. +@@ -958,6 +972,13 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw) + s32 ret_val; + u16 mii_autoneg_adv_reg; + u16 mii_1000t_ctrl_reg = 0; ++ u32 status; ++ ++ status = bmc_is_available(); ++ if (status) { ++ ret_val = 0; ++ goto out; ++ } + + phy->autoneg_advertised &= phy->autoneg_mask; + +@@ -2171,6 +2192,13 @@ s32 igb_phy_sw_reset(struct e1000_hw *hw) + { + s32 ret_val = 0; + u16 phy_ctrl; ++ u32 status; ++ ++ status = bmc_is_available(); ++ if (status) { ++ ret_val = 0; ++ goto out; ++ } + + if (!(hw->phy.ops.read_reg)) + goto out; +@@ -2204,6 +2232,13 @@ s32 igb_phy_hw_reset(struct e1000_hw *hw) + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u32 ctrl; ++ u32 status; ++ ++ status = bmc_is_available(); ++ if (status) { ++ ret_val = 0; ++ goto out; ++ } + + ret_val = igb_check_reset_block(hw); + if (ret_val) { +@@ -2377,6 +2412,13 @@ s32 igb_initialize_M88E1512_phy(struct e1000_hw *hw) + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val = 0; + u16 mii_reg = 0; ++ u32 status = 0; ++ ++ status = bmc_is_available(); ++ if (status) { ++ ret_val = 0; ++ goto out; ++ } + + ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 0x3); + if (ret_val) +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c +index be21baa32f38..0a85e8e80294 100644 +--- a/drivers/net/ethernet/intel/igb/igb_main.c ++++ b/drivers/net/ethernet/intel/igb/igb_main.c +@@ -1872,7 +1872,7 @@ void igb_reset(struct igb_adapter *adapter) + struct e1000_hw *hw = &adapter->hw; + struct e1000_mac_info *mac = &hw->mac; + struct e1000_fc_info *fc = &hw->fc; +- u32 pba, hwm; ++ u32 pba, hwm, status; + + /* Repartition Pba for greater than 9k mtu + * To take effect CTRL.RST is required. +@@ -2022,8 +2022,12 @@ void igb_reset(struct igb_adapter *adapter) + break; + } + } +- if (!netif_running(adapter->netdev)) +- igb_power_down_link(adapter); ++ ++ status = bmc_is_available(); ++ if (!status) { ++ if (!netif_running(adapter->netdev)) ++ igb_power_down_link(adapter); ++ } + + igb_update_mng_vlan(adapter); + +@@ -7555,12 +7559,16 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, + struct net_device *netdev = pci_get_drvdata(pdev); + struct igb_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; +- u32 ctrl, rctl, status; ++ u32 ctrl, rctl, status, bmc_status; + u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; + #ifdef CONFIG_PM + int retval = 0; + #endif + ++ bmc_status = bmc_is_available(); ++ if (bmc_status) ++ return 0; ++ + rtnl_lock(); + netif_device_detach(netdev); + +-- +2.17.1 + diff --git a/machine/pegatron/pegatron_common_bde/kernel/config b/machine/pegatron/pegatron_common_bde/kernel/config index d3e351760..63ae72b28 100755 --- a/machine/pegatron/pegatron_common_bde/kernel/config +++ b/machine/pegatron/pegatron_common_bde/kernel/config @@ -1,3 +1,6 @@ +CONFIG_IGB=m +CONFIG_IGB_HWMON=y +CONFIG_I2C_ALGOBIT=m CONFIG_I2C_I801=y CONFIG_I2C_ISMT=y # CONFIG_I2C_ISMT_BUS_80K is not set @@ -6,3 +9,14 @@ CONFIG_I2C_ISMT_BUS_100K=y # CONFIG_I2C_ISMT_BUS_1000K is not set CONFIG_I2C_MUX_PCA9541=y CONFIG_GPIO_ICH=y +CONFIG_ACPI_IPMI=y +CONFIG_IPMI_HANDLER=y +CONFIG_IPMI_PANIC_EVENT=y +CONFIG_IPMI_PANIC_STRING=y +CONFIG_IPMI_DEVICE_INTERFACE=y +CONFIG_IPMI_SI=y +# CONFIG_SENSORS_IBMAEM is not set +# CONFIG_SENSORS_IBMPEX is not set +# CONFIG_IPMI_SSIF is not set +# CONFIG_IPMI_WATCHDOG is not set +# CONFIG_IPMI_POWEROFF is not set diff --git a/machine/pegatron/pegatron_common_bde/kernel/series b/machine/pegatron/pegatron_common_bde/kernel/series index dc9b77b48..1dbaccd48 100755 --- a/machine/pegatron/pegatron_common_bde/kernel/series +++ b/machine/pegatron/pegatron_common_bde/kernel/series @@ -1,6 +1,7 @@ driver-igb-common.patch driver-igb-bcm54616s-phy.patch driver-igb-m88e1512-phy.patch +avoid-phy-reset-during-system-rebooting.patch i2c-bus-speed-configure.patch Apply-for-Intel-Broadwell-DE-initialize-GPIO.patch add-i2c-mux-driver-pca9641-support.patch diff --git a/machine/pegatron/pegatron_common_bde/rootconf/sysroot-lib-onie/force2astonM.sh b/machine/pegatron/pegatron_common_bde/rootconf/sysroot-lib-onie/force2astonM.sh new file mode 100755 index 000000000..f1b14e0ea --- /dev/null +++ b/machine/pegatron/pegatron_common_bde/rootconf/sysroot-lib-onie/force2astonM.sh @@ -0,0 +1,18 @@ +#!/bin/sh +sed -i "s/onie_machine=.*/onie_machine=pegatron_fn_8032_bn_f/g" /etc/machine.conf +sed -i "s/onie_machine_rev=.*/onie_machine_rev=0/g" /etc/machine.conf +sed -i "s/onie_platform=.*/onie_platform=x86_64-pegatron_fn_8032_bn_f-r0/g" /etc/machine.conf +onie-syseeprom -f -s 0x21=FN_8032_BN_F +onie-syseeprom -f -s 0x27=pegatron_fn_8032_bn_f +onie-syseeprom -f -s 0x28=x86_64-pegatron_fn_8032_bn_f-r0 +onie-syseeprom -f -s 0x2b=PEGATRON +onie-syseeprom -f -s 0x2c=TW +onie-syseeprom -f -s 0x2d=PEGATRON +onie-syseeprom -f -s 0x2e=0 +onie-syseeprom -f -s 0x2f=0 +if [ ! -z $1 ]; then + MAC_ADDRESS=$(echo $1 | egrep "^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$") + if [ ! -z ${MAC_ADDRESS} ]; then + onie-syseeprom -f -s 0x24=${MAC_ADDRESS} + fi +fi diff --git a/machine/pegatron/pegatron_common_bde/rootconf/sysroot-lib-onie/network-driver-platform b/machine/pegatron/pegatron_common_bde/rootconf/sysroot-lib-onie/network-driver-platform new file mode 100755 index 000000000..5a5febfde --- /dev/null +++ b/machine/pegatron/pegatron_common_bde/rootconf/sysroot-lib-onie/network-driver-platform @@ -0,0 +1,25 @@ +# Copyright (C) 2017 Curt Brune +# +# SPDX-License-Identifier: GPL-2.0 + +# Demonstration of the ASIC network-driver functionality + +# This script fragment is sourced by /etc/init.d/network-driver.sh, +# which in turn executes the network_driver_init() function. + +# A machine, or set of common machines, can use this feature to run +# any scripts needed to perform the bulk of networking ASIC +# initialization and configuration. A typical usage would be to +# initialize a common ASIC/SDK. + +# The platform specific initialization is handled by the +# network-driver-platform script, which handles platform specific +# details like port/lane mappings. + +# Use this function to insert igb kernel module. +network_driver_init() +{ + bmc_is_available=$(/usr/bin/mbdetect -b) + /sbin/insmod /lib/modules/i2c-algo-bit.ko + /sbin/insmod /lib/modules/igb.ko bmc_available=${bmc_is_available} +} \ No newline at end of file diff --git a/machine/pegatron/pegatron_common_bde/rootconf/sysroot-rcS/S60rc.local b/machine/pegatron/pegatron_common_bde/rootconf/sysroot-rcS/S60rc.local new file mode 100755 index 000000000..78efcc5fc --- /dev/null +++ b/machine/pegatron/pegatron_common_bde/rootconf/sysroot-rcS/S60rc.local @@ -0,0 +1,3 @@ +if [ ! -e "/dev/ipmi0" ]; then + mknod /dev/ipmi0 c `cat /proc/devices | grep ipmidev |cut -d " " -f 1` 0 +fi \ No newline at end of file diff --git a/machine/pegatron/pegatron_common_bde/rootconf/sysroot_machine.make b/machine/pegatron/pegatron_common_bde/rootconf/sysroot_machine.make index 0c52d3cd5..5747de08a 100755 --- a/machine/pegatron/pegatron_common_bde/rootconf/sysroot_machine.make +++ b/machine/pegatron/pegatron_common_bde/rootconf/sysroot_machine.make @@ -12,10 +12,19 @@ INSTALLER_GRUB_MACHINE_CONF = $(MACHINEDIR)/rootconf/grub/grub-common.cfg SYSROOT_MACHINE_COMPLETE_STAMP = $(STAMPDIR)/sysroot-machine-complete MACHINE_IMAGE_COMPLETE_STAMP = $(STAMPDIR)/machine-image-complete +KERNEL_MODULE_ORDER_FILE = $(MBUILDDIR)/kernel/linux/modules.order +KERNEL_MODULES_INSTALL_DIR = $(SYSROOTDIR)/lib/modules -$(SYSROOT_MACHINE_COMPLETE_STAMP): $(SYSROOT_COMPLETE_STAMP) +SYSROOT_COMPLETE_STAMP = $(STAMPDIR)/sysroot-complete +KERNEL_INSTALL_STAMP = $(STAMPDIR)/kernel-install + +$(SYSROOT_MACHINE_COMPLETE_STAMP): $(KERNEL_INSTALL_STAMP) $(SYSROOT_COMPLETE_STAMP) $(Q) cp -f $(INSTALLER_GRUB_COMMON_CONF) $(INSTALLER_GRUB_COMMON_CONF_ORI) $(Q) cp -f $(INSTALLER_GRUB_MACHINE_CONF) $(INSTALLER_GRUB_COMMON_CONF) + $(Q) mkdir -p $(KERNEL_MODULES_INSTALL_DIR) && \ + for file in $(shell cat ${KERNEL_MODULE_ORDER_FILE} | sed -e 's/kernel\///g') ; do \ + cp -av $(LINUXDIR)/$$file $(KERNEL_MODULES_INSTALL_DIR); \ + done sysroot-machine-clean: $(Q) if [ -f "$(INSTALLER_GRUB_COMMON_CONF_ORI)" ] ; then \