From 820013481a115100d5f8f22dc01aac8cc0363a23 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Tue, 7 Jan 2020 10:40:08 -0800 Subject: Update to internal 2020-01-07 Signed-off-by: Jason M. Bills --- .../recipes-core/fw-update/files/fwupd.sh | 7 +- .../libmctp/0001-Smbus-changes-for-libmctp.patch | 45 +++++------ .../recipes-core/interfaces/libmctp/smbus.c | 89 ++++++++++++++++++++-- .../recipes-core/interfaces/libmctp_git.bb | 4 +- .../recipes-core/ipmi/intel-ipmi-oem_%.bbappend | 2 +- .../recipes-core/libpeci/libpeci_git.bb | 2 +- 6 files changed, 111 insertions(+), 38 deletions(-) (limited to 'meta-openbmc-mods/meta-common/recipes-core') diff --git a/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh b/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh index 3073128e0..03dac7582 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh +++ b/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh @@ -124,9 +124,10 @@ touch /tmp/fwupd_progress # Byte at location 0x8 gives image type img_type=$(busctl get-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/$1 xyz.openbmc_project.Software.Version Purpose | cut -d " " -f 2 | cut -d "." -f 6 | sed 's/.\{1\}$//') img_target=$(busctl get-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/$1 xyz.openbmc_project.Software.Activation RequestedActivation | cut -d " " -f 2| cut -d "." -f 6 | sed 's/.\{1\}$//') - +apply_time=$(busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/software/apply_time xyz.openbmc_project.Software.ApplyTime RequestedApplyTime | cut -d " " -f 2 | cut -d "." -f 6 | sed 's/.\{1\}$//') echo "image-type=$img_type" echo "image-target=$img_target" +echo "apply_time=$apply_time" # BMC image - max size 32MB if [ "$img_type" = 'BMC' ]; then @@ -174,6 +175,10 @@ else exit 1 fi +if [ "$apply_time" == 'OnReset' ]; then + upd_intent_val=$(( "$upd_intent_val"|0x80 )) +fi + # do a size check on the image if [ $(stat -c "%s" "$LOCAL_PATH") -gt $img_size ]; then echo "Update file "$LOCAL_PATH" is bigger than the supported image size" diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch index e456c10ad..88da437fc 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch @@ -1,8 +1,9 @@ -From cb330f4bf1f519032ee50d60f473c28df7b772d8 Mon Sep 17 00:00:00 2001 +From 40303196d9f07b71042cd7ba87dcab6fdad29422 Mon Sep 17 00:00:00 2001 From: Nikhil Potade Date: Tue, 19 Feb 2019 14:16:20 +0800 -Subject: [PATCH] Smbus changes for libmctp +Subject: [PATCH 1/1] Smbus changes for libmctp +Signed-off-by: James Feist --- CMakeLists.txt | 6 ++++-- core.c | 2 ++ @@ -16,7 +17,7 @@ index a5b1042..249b12b 100644 @@ -2,8 +2,9 @@ cmake_minimum_required (VERSION 3.5 FATAL_ERROR) add_definitions (-DMCTP_LOG_STDERR) - add_definitions (-DMCTP_FILEIO) + add_definitions (-DMCTP_HAVE_FILEIO) +add_definitions (-DMCTP_DEFAULT_ALLOC) -add_library (libmctp STATIC alloc.c core.c log.c libmctp.h serial.c) @@ -33,7 +34,7 @@ index a5b1042..249b12b 100644 + include) diff --git a/core.c b/core.c -index b855ced..8be7407 100644 +index 61356e9..622bc5e 100644 --- a/core.c +++ b/core.c @@ -17,6 +17,7 @@ @@ -44,16 +45,16 @@ index b855ced..8be7407 100644 struct mctp_bus { mctp_eid_t eid; struct mctp_binding *binding; -@@ -50,6 +51,7 @@ struct mctp { - */ - struct mctp_msg_ctx msg_ctxs[16]; +@@ -56,6 +57,7 @@ struct mctp { + ROUTE_BRIDGE, + } route_policy; }; +/* clang-format on */ #ifndef BUILD_ASSERT #define BUILD_ASSERT(x) \ diff --git a/libmctp.h b/libmctp.h -index f0633e3..cec7c00 100644 +index b36a943..4f211f9 100644 --- a/libmctp.h +++ b/libmctp.h @@ -15,6 +15,7 @@ extern "C" { @@ -64,16 +65,15 @@ index f0633e3..cec7c00 100644 struct mctp_hdr { uint8_t ver; uint8_t dest; -@@ -30,12 +31,47 @@ struct mctp_hdr { +@@ -30,19 +31,56 @@ struct mctp_hdr { #define MCTP_HDR_SEQ_MASK (0x3) #define MCTP_HDR_TAG_SHIFT (0) #define MCTP_HDR_TAG_MASK (0x7) +/* clang-format on */ - /* Maximum size of *payload* data in a MCTP packet - * @todo: dynamic sixing based on channel implementation. - */ - #define MCTP_MTU 64 + /* Baseline maximum size of a MCTP packet */ + #define MCTP_BMTU_PAYLOAD 64 + #define MCTP_BMTU (MCTP_BMTU_PAYLOAD + sizeof(struct mctp_hdr)) +#define MCTP_CONTROL_MESSAGE_TYPE 0x00 + @@ -111,23 +111,18 @@ index f0633e3..cec7c00 100644 + /* packet buffers */ - /* Allow a little space before the MCTP header in the packet, for bindings that -@@ -46,12 +82,14 @@ struct mctp_hdr { - #define MCTP_PKTBUF_SIZE (MCTP_PKTBUF_BINDING_PAD + \ - (sizeof(struct mctp_hdr) + MCTP_MTU)) - +/* clang-format off */ struct mctp_pktbuf { - unsigned char data[MCTP_PKTBUF_SIZE]; - uint8_t start, end; - uint8_t mctp_hdr_off; + size_t start, end, size; + size_t mctp_hdr_off; struct mctp_pktbuf *next; + unsigned char data[]; }; +/* clang-format on */ - struct mctp_pktbuf *mctp_pktbuf_alloc(uint8_t len); - void mctp_pktbuf_free(struct mctp_pktbuf *pkt); -@@ -85,6 +123,7 @@ int mctp_message_tx(struct mctp *mctp, mctp_eid_t eid, + struct mctp_binding; + +@@ -90,6 +128,7 @@ int mctp_message_tx(struct mctp *mctp, mctp_eid_t eid, void *msg, size_t msg_len); /* hardware bindings */ @@ -135,7 +130,7 @@ index f0633e3..cec7c00 100644 struct mctp_binding { const char *name; uint8_t version; -@@ -93,6 +132,7 @@ struct mctp_binding { +@@ -101,6 +140,7 @@ struct mctp_binding { int (*tx)(struct mctp_binding *binding, struct mctp_pktbuf *pkt); }; diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c index d7c396444..bbdfe2aa4 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c @@ -7,7 +7,7 @@ #include #include -#ifdef MCTP_FILEIO +#ifdef MCTP_HAVE_FILEIO #include #endif @@ -197,7 +197,7 @@ static int mctp_binding_smbus_tx(struct mctp_binding *b, return 0; } -#ifdef MCTP_FILEIO +#ifdef MCTP_HAVE_FILEIO int mctp_smbus_read(struct mctp_binding_smbus *smbus) { ssize_t len = 0; @@ -251,7 +251,7 @@ int mctp_smbus_read(struct mctp_binding_smbus *smbus) break; } - smbus->rx_pkt = mctp_pktbuf_alloc(0); + smbus->rx_pkt = mctp_pktbuf_alloc(&(smbus->binding), 0); assert(smbus->rx_pkt); if (mctp_pktbuf_push(smbus->rx_pkt, &smbus->rxbuf[sizeof(*hdr)], @@ -264,7 +264,6 @@ int mctp_smbus_read(struct mctp_binding_smbus *smbus) mctp_bus_rx(&(smbus->binding), smbus->rx_pkt); - mctp_pktbuf_free(smbus->rx_pkt); smbus->rx_pkt = NULL; } while (0); @@ -284,11 +283,84 @@ int mctp_smbus_get_in_fd(struct mctp_binding_smbus *smbus) return smbus->in_fd; } + +int mctp_smbus_set_in_fd(struct mctp_binding_smbus *smbus, int fd) +{ + smbus->in_fd = fd; +} + +int mctp_smbus_set_out_fd(struct mctp_binding_smbus *smbus, int fd) +{ + smbus->out_fd = fd; +} + int mctp_smbus_get_out_fd(struct mctp_binding_smbus *smbus) { return smbus->out_fd; } +int mctp_smbus_open_in_bus(struct mctp_binding_smbus *smbus, int in_bus) +{ + char filename[60]; + size_t filename_size = 0; + char slave_mqueue[20]; + size_t mqueue_size = 0; + int fd = 0; + size_t size = sizeof(filename); + int address_7_bit = MCTP_SOURCE_SLAVE_ADDRESS >> 1; + int ret = -1; + + snprintf(filename, size, + "/sys/bus/i2c/devices/i2c-%d/%d-%04x/slave-mqueue", in_bus, + in_bus, (address_7_bit << 8) + address_7_bit); + + ret = open(filename, O_RDONLY | O_NONBLOCK | O_CLOEXEC); + if (ret >= 0) { + return ret; + } + + // Device doesn't exist. Create it. + filename_size = sizeof(filename); + snprintf(filename, filename_size, + "/sys/bus/i2c/devices/i2c-%d/new_device", in_bus); + filename[filename_size - 1] = '\0'; + + fd = open(filename, O_WRONLY); + if (fd < 0) { + mctp_prerr("can't open root device %s: %m", filename); + return -1; + } + + mqueue_size = sizeof(slave_mqueue); + snprintf(slave_mqueue, mqueue_size, "slave-mqueue %#04x", + (address_7_bit << 8) + address_7_bit); + + size = write(fd, slave_mqueue, mqueue_size); + close(fd); + if (size != mqueue_size) { + mctp_prerr("can't create mqueue device on %s: %m", filename); + return -1; + } + + size = sizeof(filename); + snprintf(filename, size, + "/sys/bus/i2c/devices/i2c-%d/%d-%04x/slave-mqueue", in_bus, + in_bus, (address_7_bit << 8) + address_7_bit); + + return open(filename, O_RDONLY | O_NONBLOCK | O_CLOEXEC); +} + +int mctp_smbus_open_out_bus(struct mctp_binding_smbus *smbus, int out_bus) +{ + char filename[60]; + size_t size = sizeof(filename); + snprintf(filename, size, "/dev/i2c-%d", out_bus); + filename[size - 1] = '\0'; + + return open(filename, O_RDWR | O_NONBLOCK); +} + +/* int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, int root_bus_num) { @@ -359,13 +431,12 @@ int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, return 0; } +*/ #endif void mctp_smbus_register_bus(struct mctp_binding_smbus *smbus, struct mctp *mctp, mctp_eid_t eid) { - assert(smbus->out_fd >= 0); - assert(smbus->in_fd >= 0); smbus->bus_id = mctp_register_bus(mctp, &smbus->binding, eid); mctp_binding_set_tx_enabled(&smbus->binding, true); } @@ -375,19 +446,21 @@ struct mctp_binding_smbus *mctp_smbus_init(void) struct mctp_binding_smbus *smbus; smbus = __mctp_alloc(sizeof(*smbus)); + memset(&(smbus->binding), 0, sizeof(smbus->binding)); + smbus->in_fd = -1; smbus->out_fd = -1; smbus->rx_pkt = NULL; smbus->binding.name = "smbus"; smbus->binding.version = 1; + smbus->binding.pkt_size = sizeof(smbus->rxbuf); smbus->binding.tx = mctp_binding_smbus_tx; - return smbus; } void mctp_smbus_free(struct mctp_binding_smbus *smbus) { __mctp_free(smbus); -} \ No newline at end of file +} diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb index fcf6631ea..132db31c7 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp" DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)" SRC_URI = "git://github.com/openbmc/libmctp.git" -SRCREV = "62d7236f6be8e830e753c94b6b9018004a7f8e27" +SRCREV = "34b9b3d82b049610775aea4460ff0f3bb9f02b1d" PV = "0.1+git${SRCPV}" @@ -37,4 +37,4 @@ CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" CXXFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include/uapi" CXXFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" -do_configure[depends] += "virtual/kernel:do_shared_workdir" \ No newline at end of file +do_configure[depends] += "virtual/kernel:do_shared_workdir" diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend index bfe6de7b2..0cb5bd52e 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend @@ -1,4 +1,4 @@ EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DINTEL_PFR_ENABLED=ON', '', d)}" EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" SRC_URI = "git://github.com/openbmc/intel-ipmi-oem.git" -SRCREV = "822b0b40efe7695b56e1edb80f995d3c810d6d22" +SRCREV = "38b58f5866602906833f7afc864dd2729516dd7f" diff --git a/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb b/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb index 9401b2496..5ec8669e6 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb @@ -5,7 +5,7 @@ inherit cmake SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" PV = "0.1+git${SRCPV}" -SRCREV = "eddf621897090ba346b1aaa81a4b8be12076ab60" +SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" S = "${WORKDIR}/git/libpeci" -- cgit v1.2.3