Skip to content

Commit

Permalink
Pegatron common_bde: add support for FN-8032-BN-F series.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Max Lee <[email protected]>
Signed-off-by: Alex Doyle <[email protected]>
  • Loading branch information
PegaSwitch authored and alexdoyle committed Sep 18, 2020
1 parent 19c38c1 commit fe99409
Show file tree
Hide file tree
Showing 12 changed files with 610 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build-config/scripts/onie-build-targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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." },

Expand Down
10 changes: 10 additions & 0 deletions machine/pegatron/pegatron_common_bde/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
From c05c4dfe04c4f65b41b75f75e032443903aae43f Mon Sep 17 00:00:00 2001
From: Wolf Lin <[email protected]>
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

Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
From fc2a6d562c71703a1d8a9670298180b7aacff7b5 Mon Sep 17 00:00:00 2001
From: GeorgeWu <[email protected]>
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 <mb_detect.h>
+
+#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

2 changes: 2 additions & 0 deletions machine/pegatron/pegatron_common_bde/busybox/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit fe99409

Please sign in to comment.