diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor')
85 files changed, 2035 insertions, 3190 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/files/beepcode_mgr.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/files/beepcode_mgr.cpp index 2940610da..5a2deceaf 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/files/beepcode_mgr.cpp +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/files/beepcode_mgr.cpp @@ -16,6 +16,8 @@ #include <fcntl.h> #include <linux/input.h> +#include <boost/asio/io_service.hpp> +#include <boost/asio/steady_timer.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <chrono> #include <iostream> @@ -292,12 +294,6 @@ static void beep(const uint8_t& beepPriority) return; } - // Log into redfish event log - sd_journal_send("MESSAGE=BeepCode: Priority=%d", beepPriority, - "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", - "OpenBMC.0.1.BeepCode", "REDFISH_MESSAGE_ARGS=%d", - beepPriority, NULL); - beeper.beep(beepPriority); return; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend index cf402206b..8f112e334 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -1,6 +1,6 @@ # this is here just to bump faster than upstream -SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "e18edb5badc2e16181cfc464a6ccd0ef51dc4548" +# SRC_URI = "git://github.com/openbmc/entity-manager.git" +SRCREV = "e1ecc1adc93021db7521042dde2866b1901a8648" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp index 0c1014589..3d0b7fd98 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp @@ -15,6 +15,8 @@ #include <time.h> +#include <boost/asio/io_service.hpp> +#include <boost/asio/steady_timer.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <chrono> #include <iostream> @@ -32,7 +34,9 @@ static uint32_t syncIntervalMS = syncIntervalNormalMS; // will update bmc time if the time difference beyond this value static constexpr uint8_t timeDiffAllowedSecond = 1; - +static uint8_t pchDevI2cBusNo = 0; +static uint8_t pchDevI2cSlaveAddr = 0; +static bool getPCHI2cAddrFlag = false; static inline uint8_t bcd2Decimal(uint8_t hex) { uint8_t dec = ((hex & 0xF0) >> 4) * 10 + (hex & 0x0F); @@ -83,6 +87,88 @@ class I2CFile } }; +static void getPCHI2cAddr(std::shared_ptr<sdbusplus::asio::connection>& conn, + const std::string& service, const std::string& object, + const std::string& interface) +{ + conn->async_method_call( + [](boost::system::error_code ec, + const std::vector< + std::pair<std::string, std::variant<std::string, uint64_t>>>& + propertiesList) { + if (ec) + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "DBUS response error: cannot get I2c address of PCH timer", + phosphor::logging::entry("ECVALUE=%x", ec.value()), + phosphor::logging::entry("ECMESSAGE=%s", + ec.message().c_str())); + return; + } + const uint64_t* i2cBusNoValue = nullptr; + const uint64_t* i2cSlaveAddrValue = nullptr; + for (const auto& property : propertiesList) + { + + if (property.first == "PchSmbusSlaveI2cBus") + { + i2cBusNoValue = std::get_if<uint64_t>(&property.second); + } + if (property.first == "PchSmbusSlaveI2cAddress") + { + i2cSlaveAddrValue = std::get_if<uint64_t>(&property.second); + } + } + if ((i2cBusNoValue != nullptr) && (i2cSlaveAddrValue != nullptr)) + { + pchDevI2cBusNo = static_cast<uint8_t>(*i2cBusNoValue); + pchDevI2cSlaveAddr = static_cast<uint8_t>(*i2cSlaveAddrValue); + getPCHI2cAddrFlag = true; + } + }, + service, object, "org.freedesktop.DBus.Properties", "GetAll", + interface); +} + +static void + getPCHTimerConfiguration(std::shared_ptr<sdbusplus::asio::connection>& conn) +{ + conn->async_method_call( + [&conn]( + boost::system::error_code ec, + const std::vector<std::pair< + std::string, + std::vector<std::pair<std::string, std::vector<std::string>>>>>& + subtree) { + if (ec) + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "DBUS response error:cannot get PCH configuration", + phosphor::logging::entry("ECVALUE=%x", ec.value()), + phosphor::logging::entry("ECMESSAGE=%s", + ec.message().c_str())); + return; + } + if (subtree.empty()) + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "subtree empty"); + return; + } + getPCHI2cAddr(conn, subtree[0].second[0].first, subtree[0].first, + "xyz.openbmc_project.Configuration.PchSmbusSlave"); + return; + }, + "xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetSubTree", + "/xyz/openbmc_project/", 0, + std::array<const char*, 1>{ + "xyz.openbmc_project.Configuration.PchSmbusSlave"}); + + return; +} + class PCHSync { private: @@ -91,15 +177,13 @@ class PCHSync { try { - constexpr uint8_t pchDevI2CBusNumber = 0x03; - constexpr uint8_t pchDevI2CSlaveAddress = 0x44; constexpr uint8_t pchDevRegRTCYear = 0x0f; constexpr uint8_t pchDevRegRTCMonth = 0x0e; constexpr uint8_t pchDevRegRTCDay = 0x0d; constexpr uint8_t pchDevRegRTCHour = 0x0b; constexpr uint8_t pchDevRegRTCMinute = 0x0a; constexpr uint8_t pchDevRegRTCSecond = 0x09; - I2CFile pchDev(pchDevI2CBusNumber, pchDevI2CSlaveAddress, + I2CFile pchDev(pchDevI2cBusNo, pchDevI2cSlaveAddr, O_RDWR | O_CLOEXEC); year = pchDev.i2cReadByteData(pchDevRegRTCYear); year = bcd2Decimal(year); @@ -187,18 +271,18 @@ class PCHSync struct tm tm = {0}; // get PCH and system time + if (!getPCHDate(year, month, day, hour, minute, second)) { return false; }; - if (!getSystemTime(BMCTimeSeconds)) { return false; } - + // fix error when year is set to 2000-2009. std::string dateString = - "20" + std::to_string(year) + "-" + std::to_string(month) + "-" + + std::to_string(2000 + year) + "-" + std::to_string(month) + "-" + std::to_string(day) + " " + std::to_string(hour) + ":" + std::to_string(minute) + ":" + std::to_string(second); @@ -216,37 +300,70 @@ class PCHSync { return false; } - std::cout << "Update BMC time to " << dateString << std::endl; + phosphor::logging::log<phosphor::logging::level::INFO>( + "Update BMC time to: ", + phosphor::logging::entry("TIME=%s", dateString.c_str())); } return true; } - void startSyncTimer() + void startSyncTimer(std::shared_ptr<sdbusplus::asio::connection>& conn) { - if (updateBMCTime()) + // retry 10 times (10 * 30 sec = 5min ) to get the pch timer + // configuration. + static uint8_t retrytimes = 10; + if (!getPCHI2cAddrFlag) { - syncIntervalMS = syncIntervalNormalMS; + if (retrytimes == 0) + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "Get pch timer configuration fail"); + return; + } + syncIntervalMS = syncIntervalFastMS; + getPCHTimerConfiguration(conn); + retrytimes--; } else { - std::cout << "Update BMC time Fail" << std::endl; - syncIntervalMS = syncIntervalFastMS; + if (updateBMCTime()) + { + syncIntervalMS = syncIntervalNormalMS; + } + else + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "Update BMC time Fail"); + syncIntervalMS = syncIntervalFastMS; + } } syncTimer->expires_after(std::chrono::milliseconds(syncIntervalMS)); syncTimer->async_wait( - [this](const boost::system::error_code& ec) { startSyncTimer(); }); + [this, &conn](const boost::system::error_code& ec) { + if (ec) + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "Timer cancelled", + phosphor::logging::entry("ECVALUE=%x", ec.value()), + phosphor::logging::entry("ECMESSAGE=%s", + ec.message().c_str())); + return; + } + startSyncTimer(conn); + }); } std::unique_ptr<boost::asio::steady_timer> syncTimer; uint8_t year, month, day, hour, minute, second; public: - PCHSync(boost::asio::io_service& io) + PCHSync(boost::asio::io_service& io, + std::shared_ptr<sdbusplus::asio::connection>& conn) { syncTimer = std::make_unique<boost::asio::steady_timer>(io); - startSyncTimer(); + startSyncTimer(conn); } ~PCHSync() = default; @@ -255,7 +372,11 @@ class PCHSync int main(int argc, char** argv) { boost::asio::io_service io; - PCHSync pchSyncer(io); + std::shared_ptr<sdbusplus::asio::connection> conn = + std::make_shared<sdbusplus::asio::connection>(io); + sdbusplus::asio::object_server server = + sdbusplus::asio::object_server(conn); + PCHSync pchSyncer(io, conn); phosphor::logging::log<phosphor::logging::level::INFO>( "Starting PCH time sync service"); diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.service b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.service index cf9c3053f..bf4e2a30e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.service +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.service @@ -1,6 +1,8 @@ [Unit] Description=PCH BMC time sync service Conflicts=systemd-timesyncd.service +Requires=xyz.openbmc_project.EntityManager.service +After=xyz.openbmc_project.EntityManager.service [Service] Restart=always @@ -10,4 +12,4 @@ StartLimitInterval=0 Type=simple [Install] -WantedBy=sysinit.target +WantedBy=multi-user.target diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0027-Apply-Options-interface-for-Software.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/0027-Apply-Options-interface-for-Software.patch index 3d2cc43e2..3d2cc43e2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0027-Apply-Options-interface-for-Software.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/0027-Apply-Options-interface-for-Software.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Reapply-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-e.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Reapply-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-e.patch deleted file mode 100644 index 3344c27dd..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Reapply-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-e.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 3789a98fda6e3cafd377b0f4fa1c0c40bb94297e Mon Sep 17 00:00:00 2001 -From: Johnathan Mantey <jonathanx.mantey@intel.com> -Date: Wed, 20 Nov 2019 10:56:44 -0500 -Subject: [PATCH] Reapply: "Enhance DHCP beyond just OFF and IPv4/IPv6 - enabled." - -DHCP is not a binary option. The network interface can have DHCP -disabled, IPv4 only, IPv6 only, and IPv4/IPv6. - -Signed-off-by: Johnathan Mantey <jonathanx.mantey@intel.com> - -Reapplied -> -Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> -Change-Id: I7654116aa3962de253225271190ce4a2fe229ce9 ---- - .../Network/EthernetInterface.interface.yaml | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/xyz/openbmc_project/Network/EthernetInterface.interface.yaml b/xyz/openbmc_project/Network/EthernetInterface.interface.yaml -index ee54145..56285ee 100644 ---- a/xyz/openbmc_project/Network/EthernetInterface.interface.yaml -+++ b/xyz/openbmc_project/Network/EthernetInterface.interface.yaml -@@ -23,7 +23,7 @@ properties: - description: > - Domain names of the ethernet interface. - - name: DHCPEnabled -- type: boolean -+ type: enum[self.DHCPConf] - description: > - Address mode of the ethernet interface. - - name: Nameservers -@@ -69,4 +69,11 @@ enumerations: - - name: v4 - - name: v6 - - name: none -- -+ - name: DHCPConf -+ description: > -+ A list of the permitted DHCP settings used by systemd. -+ values: -+ - name: both -+ - name: v4 -+ - name: v6 -+ - name: none --- -2.21.0 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0005-Add-DBUS-interface-of-CPU-and-Memory-s-properties.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0005-Add-DBUS-interface-of-CPU-and-Memory-s-properties.patch deleted file mode 100644 index 4cfc4acc8..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0005-Add-DBUS-interface-of-CPU-and-Memory-s-properties.patch +++ /dev/null @@ -1,65 +0,0 @@ -From a30a09f58b9ebfb267c0b9cce9ae25994ea025ca Mon Sep 17 00:00:00 2001 -From: cyang29 <cheng.c.yang@intel.com> -Date: Tue, 17 Jul 2018 16:04:58 +0800 -Subject: [PATCH] Add DBUS interface of CPU properties Feature - Support: SMBIOS service interface. CPU information redfish - interface. Base on smbios spec DSP0134_3.0.0 - -Signed-off-by: cyang29 <cheng.c.yang@intel.com> ---- - .../Inventory/Item/Cpu.interface.yaml | 41 +++++++++++++++++++ - 1 files changed, 41 insertions(+) - -diff --git a/xyz/openbmc_project/Inventory/Item/Cpu.interface.yaml b/xyz/openbmc_project/Inventory/Item/Cpu.interface.yaml -index ab29cf3..313eada 100644 ---- a/xyz/openbmc_project/Inventory/Item/Cpu.interface.yaml -+++ b/xyz/openbmc_project/Inventory/Item/Cpu.interface.yaml -@@ -1,4 +1,45 @@ - description: > - Implement to provide CPU attributes. -+properties: -+ - name: ProcessorSocket -+ type: string -+ description: > -+ Processor Socket on MotherBoard -+ - name: ProcessorType -+ type: string -+ description: > -+ Processor Type of CPU -+ - name: ProcessorFamily -+ type: string -+ description: > -+ Processor Family of CPU -+ - name: ProcessorManufacturer -+ type: string -+ description: > -+ Processor Manufacturer of CPU -+ - name: ProcessorId -+ type: uint32 -+ description: > -+ Processor ID of CPU -+ - name: ProcessorVersion -+ type: string -+ description: > -+ Processor Version of CPU -+ - name: ProcessorMaxSpeed -+ type: uint16 -+ description: > -+ Max Speed CPU Can Support -+ - name: ProcessorCharacteristics -+ type: string -+ description: > -+ The Characteristics CPU Has -+ - name: ProcessorCoreCount -+ type: uint16 -+ description: > -+ The Count of Core in CPU -+ - name: ProcessorThreadCount -+ type: uint16 -+ description: > -+ The Count of Thread CPU Can Support - - # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 --- -2.16.2 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0028-MCTP-Daemon-D-Bus-interface-definition.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0028-MCTP-Daemon-D-Bus-interface-definition.patch deleted file mode 100644 index e6afc0117..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0028-MCTP-Daemon-D-Bus-interface-definition.patch +++ /dev/null @@ -1,457 +0,0 @@ -From 65d1772312a76ebfdac6391bb97287c62f18c43f Mon Sep 17 00:00:00 2001 -From: "Kowalski, Mariusz" <mariusz.kowalski@intel.com> -Date: Thu, 27 Feb 2020 15:48:56 +0100 -Subject: [PATCH] MCTP Daemon D-Bus interface definition. - -This interface definition was created on base of the MCTP design -proposed in this document: -https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/28424/9/designs/mctp.md - -Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com> -Signed-off-by: Mariusz Kowalski <mariusz.kowalski@intel.com> -Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> -Change-Id: Ida66f8ffcf00003655edcb0fb0112202797b8e1a ---- - xyz/openbmc_project/MCTP/Base.interface.yaml | 227 ++++++++++++++++++ - .../MCTP/Binding/PCIe.interface.yaml | 29 +++ - .../MCTP/Binding/SMBus.interface.yaml | 17 ++ - .../MCTP/BusOwner.interface.yaml | 17 ++ - .../MCTP/Endpoint.interface.yaml | 13 + - xyz/openbmc_project/MCTP/README.md | 43 ++++ - .../MCTP/SupportedMessageTypes.interface.yaml | 36 +++ - 7 files changed, 382 insertions(+) - create mode 100644 xyz/openbmc_project/MCTP/Base.interface.yaml - create mode 100644 xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml - create mode 100644 xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml - create mode 100644 xyz/openbmc_project/MCTP/BusOwner.interface.yaml - create mode 100644 xyz/openbmc_project/MCTP/Endpoint.interface.yaml - create mode 100644 xyz/openbmc_project/MCTP/README.md - create mode 100644 xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml - -diff --git a/xyz/openbmc_project/MCTP/Base.interface.yaml b/xyz/openbmc_project/MCTP/Base.interface.yaml -new file mode 100644 -index 0000000..9438551 ---- /dev/null -+++ b/xyz/openbmc_project/MCTP/Base.interface.yaml -@@ -0,0 +1,227 @@ -+description: > -+ Mandatory interface for each instance of the MCTP Daemon to expose -+ the base MCTP daemon and medium type interfaces. -+ -+methods: -+ - name: SendMctpMessagePayload -+ description: > -+ Sends message over MCTP interface -+ parameters: -+ - name: DestinationEID -+ type: byte -+ description: > -+ Destination Endpoint ID. The logical address used to route MCTP -+ messages to a specific MCTP endpoint. -+ - name: MsgTag -+ type: byte -+ description: > -+ Message tag. Field that, along with the Source Endpoint IDs and the -+ Tag Owner (TO) field, identifies a unique message at the MCTP -+ transport level. -+ - name: TagOwner -+ type: boolean -+ description: > -+ Tag Owner bit identifies whether the message tag was originated by -+ the endpoint that is the source of the message or by the endpoint -+ that is the destination of the message. -+ - name: Payload -+ type: array[byte] -+ description: Payload of message. -+ returns: -+ - name: Status -+ type: byte -+ description: 0 - if success -+ errors: -+ - xyz.openbmc_project.Common.Error.Timeout -+ - xyz.openbmc_project.Common.Error.InvalidArgument -+ - xyz.openbmc_project.Common.Error.InternalFailure -+ -+ - name: SendMctpMessageFileDescriptor -+ description: > -+ Sends message over MCTP interface -+ parameters: -+ - name: DestinationEID -+ type: byte -+ description: > -+ Destination Endpoint ID. The logical address used to route MCTP -+ messages to a specific MCTP endpoint. -+ - name: MsgTag -+ type: byte -+ description: > -+ Message tag. Field that, along with the Source Endpoint IDs and the -+ Tag Owner (TO) field, identifies a unique message at the MCTP -+ transport level. -+ - name: TagOwner -+ type: boolean -+ description: > -+ Tag Owner bit identifies whether the message tag was originated by -+ the endpoint that is the source of the message or by the endpoint -+ that is the destination of the message. -+ - name: FileDescriptor -+ type: unixfd -+ description: File descriptor of message. -+ returns: -+ - name: Status -+ type: byte -+ description: 0 - if success -+ errors: -+ - xyz.openbmc_project.Common.Error.Timeout -+ - xyz.openbmc_project.Common.Error.InvalidArgument -+ - xyz.openbmc_project.Common.Error.InternalFailure -+ -+signals: -+ - name: MessageReceivedSignal -+ description: > -+ Signal indicating upper layers about arrival of a MCTP message. -+ properties: -+ - name: MessageType -+ type: enum[self.MessageTypes] -+ description: > -+ Defines the values for the Message Type field for different message -+ types transported through MCTP. -+ - name: SrcEid -+ type: byte -+ description: > -+ Source Endpoint ID. The logical address used to route MCTP messages -+ to a specific MCTP endpoint. -+ - name: MsgTag -+ type: byte -+ description: > -+ Message tag. Field that, along with the Source Endpoint IDs and the -+ Tag Owner (TO) field, identifies a unique message at the MCTP -+ transport level. -+ - name: TagOwner -+ type: boolean -+ description: > -+ Tag Owner bit identifies whether the message tag was originated by -+ the endpoint that is the source of the message or by the endpoint -+ that is the destination of the message. -+ - name: Payload -+ type: array[byte] -+ description: Payload of message. -+ -+properties: -+ - name: Eid -+ type: byte -+ description: > -+ Endpoint ID. The logical address used to route MCTP messages to a -+ specific MCTP endpoint. -+ -+ - name: BindingID -+ type: enum[self.BindingTypes] -+ -+ - name: BindingMediumID -+ type: enum[self.MctpPhysicalMediumIdentifiers] -+ -+ - name: StaticEid -+ type: boolean -+ description: Support for statically/dynamicly allocated IDs -+ -+ - name: BindingMode -+ type: enum[self.BindingModeTypes] -+ description: Bus Owner / Endpoint / Bridge -+ -+enumerations: -+ - name: BindingTypes -+ description: > -+ All other values than described are reserved. -+ values: -+ - name: MctpOverSmbus -+ - name: MctpOverPcieVdm -+ - name: MctpOverUsb -+ description: Reserved for MCTP over USB -+ - name: MctpOverKcs -+ - name: MctpOverSerial -+ - name: VendorDefined -+ -+ - name: MctpPhysicalMediumIdentifiers -+ description: > -+ Identifies MCTP physical medium identifiers. see DSP0239. -+ values: -+ - name: Smbus -+ descritpion: SMBus 2.0 100 kHz compatible -+ - name: SmbusI2c -+ descritpion: SMBus 2.0 + I2C 100 kHz compatible -+ - name: I2cCompatible -+ description: I2C 100 kHz compatible (Standard-mode) -+ - name: Smbus3OrI2c400khzCompatible -+ description: SMBus 3.0 or I2C 400 kHz compatible (Fast-mode) -+ - name: Smbus3OrI2c1MhzCompatible -+ description: SMBus 3.0 or I2C 1 MHz compatible (Fast-mode Plus) -+ - name: I2c3Mhz4Compatible -+ description: I2C 3.4 MHz compatible (High-speed mode) -+ - name: Pcie11 -+ description: PCIe revision 1.1 compatible -+ - name: Pcie2 -+ description: PCIe revision 2.0 compatible -+ - name: Pcie21 -+ description: PCIe revision 2.1 compatible -+ - name: Pcie3 -+ description: PCIe revision 3.0 compatible -+ - name: Pcie4 -+ description: PCIe revision 4.0 compatible -+ - name: Pcie5 -+ description: PCIe revision 4.0 compatible -+ - name: PciCompatible -+ description: > -+ PCI compatible (PCI 1.0,2.0,2.1,2.2,2.3,3.0,PCI-X 1.0, PCI-X 2.0) -+ - name: Usb11Compatible -+ description: USB 1.1 compatible -+ - name: Usb20Compatible -+ description: USB 2.0 compatible -+ - name: Usb30Compatible -+ description: USB 3.0 compatible -+ - name: NcSiOverRbt -+ description: > -+ NC-SI over RBT (A physical interface based on RMII as defined in -+ DSP0222) -+ - name: KcsLegacy -+ description: KCS1 / Legacy (Fixed Address Decoding) -+ - name: KcsPci -+ description: KCS1 / PCI (Base Class 0xC0 Subclass 0x01) -+ - name: SerialHostLegacy -+ description: Serial Host2 / Legacy (Fixed Address Decoding) -+ - name: SerialHostPci -+ description: Serial Host2 / PCI (Base Class 0x07 Subclass 0x00) -+ - name: AsynchronousSerial -+ description: Asynchronous Serial (Between MCs and IMDs) -+ - name: I3cSDR -+ description: I3C 12.5 MHz compatible (SDR) -+ - name: I3cHDRDDR -+ description: I3C 25 MHz compatible (HDR-DDR) -+ -+ - name: BindingModeTypes -+ values: -+ - name: Endpoint -+ description: > -+ An MCTP communication terminus. An MCTP endpoint is a terminus or -+ origin of MCTP packets or messages. That is, the combined -+ functionality within a physical device that communicates using the -+ MCTP transport protocol and handles MCTP control commands. This -+ includes MCTP-capable management controllers and managed devices. -+ Also referred to in this document as "endpoint". -+ - name: BusOwner -+ description: > -+ The party responsible for managing address assignments (can be -+ logical or physical addresses) on a bus (for example, in MCTP, the -+ bus owner is the party responsible for managing EID assignments for -+ a given bus). A bus owner may also have additional media-specific -+ responsibilities, such as assignment of physical addresses. -+ - name: Bridge -+ description: > -+ An MCTP endpoint that can route MCTP messages not destined for -+ itself that it receives on one interconnect onto another without -+ interpreting them. The ingress and egress media at the bridge may -+ be either homogeneous or heterogeneous. Also referred to in this -+ document as a "bridge". -+ -+ - name: MessageTypes -+ values: -+ - name: MctpControl -+ - name: PLDM -+ - name: NCSI -+ - name: Ethernet -+ - name: NVMeMgmtMsg -+ - name: SPDM -+ - name: VDPCI -+ - name: VDIANA -diff --git a/xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml b/xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml -new file mode 100644 -index 0000000..1bd2881 ---- /dev/null -+++ b/xyz/openbmc_project/MCTP/Binding/PCIe.interface.yaml -@@ -0,0 +1,29 @@ -+description: > -+ Interface exposed by MCTP daemon for PCIe binding -+ -+properties: -+ - name: DiscoveredFlag -+ type: enum[self.DiscoveryFlags] -+ description: > -+ Each endpoint (except the bus owner) on the PCIe bus maintains an -+ internal flag called the Discovered flag. The flag is set to the -+ discovered state when the Set Endpoint ID command is received. -+ -+ - name: BDF -+ type: uint16 -+ description: > -+ Byte 1 [7:0] Bus number -+ Byte 2 [7:3] Device number [2:0] Function Number -+ -+enumerations: -+ - name: DiscoveryFlags -+ description: > -+ The Prepare for Endpoint Discovery message causes each recipient -+ endpoint on the PCIe bus to set their respective Discovered flag to -+ the undiscovered state. For the Prepare for Endpoint Discovery request -+ message, the routing in the physical transport header should be set to -+ 011b (Broadcast from Root Complex). -+ values: -+ - name: Discovered -+ - name: Undiscovered -+ - name: NotApplicable -diff --git a/xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml b/xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml -new file mode 100644 -index 0000000..9219ad0 ---- /dev/null -+++ b/xyz/openbmc_project/MCTP/Binding/SMBus.interface.yaml -@@ -0,0 +1,17 @@ -+description: > -+ Interface exposed by MCTP daemon for SMBus binding -+ -+properties: -+ - name: ArpMasterSupport -+ type: boolean -+ description: > -+ The SMBus binding can also run ARP Master protocol and -+ assign SMBus addresses to the devices on the bus. -+ -+ - name: BusNumber -+ type: byte -+ description: I2C bus number of the medium used -+ -+ - name: SlaveAddress -+ type: byte -+ description: Slave address to be used for this medium -diff --git a/xyz/openbmc_project/MCTP/BusOwner.interface.yaml b/xyz/openbmc_project/MCTP/BusOwner.interface.yaml -new file mode 100644 -index 0000000..d46298e ---- /dev/null -+++ b/xyz/openbmc_project/MCTP/BusOwner.interface.yaml -@@ -0,0 +1,17 @@ -+description: > -+ Interface exposed by MCTP root object, when executing in Bus Owner mode. -+ -+properties: -+ - name: EidPool -+ type: array[struct[byte, byte]] -+ description: > -+ Pool of allowed EIDs to be used. -+ EID pool of 10-100 can be specified as {{10,100}}. -+ -+ - name: TopMostBusOwner -+ type: boolean -+ description: To indicate whether BMC is topmost Bus Owner -+ -+ - name: OwnEidPool -+ type: boolean -+ description: Indicates Eid pool is managed by self -diff --git a/xyz/openbmc_project/MCTP/Endpoint.interface.yaml b/xyz/openbmc_project/MCTP/Endpoint.interface.yaml -new file mode 100644 -index 0000000..e4ba4d0 ---- /dev/null -+++ b/xyz/openbmc_project/MCTP/Endpoint.interface.yaml -@@ -0,0 +1,13 @@ -+description: -+ Interface exposed by discovered MCTP endpoints. -+ -+properties: -+ - name: Mode -+ type: enum[xyz.openbmc_project.MCTP.Base.BindingModeTypes] -+ description: Endpoint / BusOwner / Bridge -+ -+ - name: NetworkId -+ type: uint16 -+ description: > -+ MCTP network ID a unique identifier to distinguish each independent -+ MCTP network within a platform. -diff --git a/xyz/openbmc_project/MCTP/README.md b/xyz/openbmc_project/MCTP/README.md -new file mode 100644 -index 0000000..c819dbb ---- /dev/null -+++ b/xyz/openbmc_project/MCTP/README.md -@@ -0,0 +1,43 @@ -+# MCTP Daemon -+ -+## Overview -+MCTP service exposes D-Bus methods / properties / signals for managing -+MCTP devices or work as MCTP Endpoint. MCTP daemon will either -+work in Bus Owner or Endpoint mode for the specified physical medium. -+ -+### MCTP service -+MCTP service can be started either in Bus Owner mode or Endpoint mode. -+It will expose following objects. -+1. Base object -+2. MCTP Endpoints (discovered in case of Bus Owner mode, queried using -+routing table in case of Endpoint mode) -+Please refer individual yaml file for details about the -+methods / signals / properties exposed in the interfaces. -+ -+#### Base object -+Exposed under the path `/xyz/openbmc_project/mctp` with the following -+interfaces. -+1. `xyz.openbmc_project.MCTP.Base` which exposes all the common properties -+needed for MCTP Daemon. -+2. `xyz.openbmc_project.MCTP.BusOwner` available only in Bus Owner mode -+which exposes the properties needed by Bus Owner MCTP Daemon. -+3. `xyz.openbmc_project.MCTP.SupportedMessageTypes` which exposes the message -+types supported. -+4. Binding interface `xyz.openbmc_project.MCTP.Binding.PCIe` or -+`xyz.openbmc_project.MCTP.Binding.SMBus` as per the physical medium in which -+this MCTP Daemon is instantiated. -+5. Common UUID interface `xyz.openbmc_project.Common.UUID` which exposes UUID -+in RFC4122 format. -+ -+#### Endpoint object -+Exposed under the path `/xyz/openbmc_project/mctp/device/<eid>` with the -+following interfaces. -+1. `xyz.openbmc_project.MCTP.SupportedMessageTypes` which exposes supported MCTP -+message types for the discovered MCTP Endpoint. -+2. `xyz.openbmc_project.MCTP.Endpoint` which exposes properties like Network ID -+and endpoint mode (to identify Bus Owner or Bridge or Endpoint) for the discovered -+MCTP Endpoint. -+3. `xyz.openbmc_project.MCTP.Bridge` available only for discovered MCTP Bridges to -+expose properties like EID pool. (TBD) -+4. Common UUID interface `xyz.openbmc_project.Common.UUID` which exposes UUID -+in RFC4122 format. -diff --git a/xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml b/xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml -new file mode 100644 -index 0000000..fa447ee ---- /dev/null -+++ b/xyz/openbmc_project/MCTP/SupportedMessageTypes.interface.yaml -@@ -0,0 +1,36 @@ -+description: -+ Interface used to represent the supported MCTP message types. -+ This will be exposed by all MCTP endpoints. -+ -+properties: -+ - name: MctpControl -+ type: boolean -+ description: Indicates support availability -+ -+ - name: PLDM -+ type: boolean -+ description: Indicates support availability -+ -+ - name: NCSI -+ type: boolean -+ description: Indicates support availability -+ -+ - name: Ethernet -+ type: boolean -+ description: Indicates support availability -+ -+ - name: NVMeMgmtMsg -+ type: boolean -+ description: Indicates support availability -+ -+ - name: SPDM -+ type: boolean -+ description: Indicates support availability -+ -+ - name: VDPCI -+ type: boolean -+ description: Indicates support availability -+ -+ - name: VDIANA -+ type: boolean -+ description: Indicates support availability --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0031-update-meson-build-files-for-control-and-bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0031-update-meson-build-files-for-control-and-bios.patch new file mode 100644 index 000000000..fd31665dc --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0031-update-meson-build-files-for-control-and-bios.patch @@ -0,0 +1,156 @@ +From cd3c2ff290e6ff205c32b386c7c8a73d4a8980e5 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren <zhikui.ren@intel.com> +Date: Tue, 8 Dec 2020 15:08:21 -0800 +Subject: [PATCH 1/4] update meson build files for control and bios + +Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +--- + .../Control/Power/RestoreDelay/meson.build | 14 ++++++++++++++ + gen/xyz/openbmc_project/Control/Power/meson.build | 15 +++++++++++++++ + .../Control/Processor/ErrConfig/meson.build | 14 ++++++++++++++ + .../openbmc_project/Control/Processor/meson.build | 15 +++++++++++++++ + .../Inventory/Item/Bios/meson.build | 14 ++++++++++++++ + .../openbmc_project/Inventory/Item/meson.build | 15 +++++++++++++++ + 6 files changed, 87 insertions(+) + create mode 100644 gen/xyz/openbmc_project/Control/Power/RestoreDelay/meson.build + create mode 100644 gen/xyz/openbmc_project/Control/Processor/ErrConfig/meson.build + create mode 100644 gen/xyz/openbmc_project/Inventory/Item/Bios/meson.build + +diff --git a/gen/xyz/openbmc_project/Control/Power/RestoreDelay/meson.build b/gen/xyz/openbmc_project/Control/Power/RestoreDelay/meson.build +new file mode 100644 +index 0000000..91581fd +--- /dev/null ++++ b/gen/xyz/openbmc_project/Control/Power/RestoreDelay/meson.build +@@ -0,0 +1,14 @@ ++# Generated file; do not modify. ++generated_sources += custom_target( ++ 'xyz/openbmc_project/Control/Power/RestoreDelay__cpp'.underscorify(), ++ input: [ meson.source_root() / 'xyz/openbmc_project/Control/Power/RestoreDelay.interface.yaml', ], ++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ], ++ command: [ ++ sdbuspp_gen_meson_prog, '--command', 'cpp', ++ '--output', meson.current_build_dir(), ++ '--tool', sdbusplusplus_prog, ++ '--directory', meson.source_root(), ++ 'xyz/openbmc_project/Control/Power/RestoreDelay', ++ ], ++) ++ +diff --git a/gen/xyz/openbmc_project/Control/Power/meson.build b/gen/xyz/openbmc_project/Control/Power/meson.build +index 05628ec..ad04479 100644 +--- a/gen/xyz/openbmc_project/Control/Power/meson.build ++++ b/gen/xyz/openbmc_project/Control/Power/meson.build +@@ -29,6 +29,21 @@ generated_others += custom_target( + build_by_default: true, + ) + ++subdir('RestoreDelay') ++generated_others += custom_target( ++ 'xyz/openbmc_project/Control/Power/RestoreDelay__markdown'.underscorify(), ++ input: [ meson.source_root() / 'xyz/openbmc_project/Control/Power/RestoreDelay.interface.yaml', ], ++ output: [ 'RestoreDelay.md' ], ++ command: [ ++ sdbuspp_gen_meson_prog, '--command', 'markdown', ++ '--output', meson.current_build_dir(), ++ '--tool', sdbusplusplus_prog, ++ '--directory', meson.source_root(), ++ 'xyz/openbmc_project/Control/Power/RestoreDelay', ++ ], ++ build_by_default: true, ++) ++ + subdir('RestorePolicy') + generated_others += custom_target( + 'xyz/openbmc_project/Control/Power/RestorePolicy__markdown'.underscorify(), +diff --git a/gen/xyz/openbmc_project/Control/Processor/ErrConfig/meson.build b/gen/xyz/openbmc_project/Control/Processor/ErrConfig/meson.build +new file mode 100644 +index 0000000..12961c2 +--- /dev/null ++++ b/gen/xyz/openbmc_project/Control/Processor/ErrConfig/meson.build +@@ -0,0 +1,14 @@ ++# Generated file; do not modify. ++generated_sources += custom_target( ++ 'xyz/openbmc_project/Control/Processor/ErrConfig__cpp'.underscorify(), ++ input: [ meson.source_root() / 'xyz/openbmc_project/Control/Processor/ErrConfig.interface.yaml', ], ++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ], ++ command: [ ++ sdbuspp_gen_meson_prog, '--command', 'cpp', ++ '--output', meson.current_build_dir(), ++ '--tool', sdbusplusplus_prog, ++ '--directory', meson.source_root(), ++ 'xyz/openbmc_project/Control/Processor/ErrConfig', ++ ], ++) ++ +diff --git a/gen/xyz/openbmc_project/Control/Processor/meson.build b/gen/xyz/openbmc_project/Control/Processor/meson.build +index adbff0a..816c30d 100644 +--- a/gen/xyz/openbmc_project/Control/Processor/meson.build ++++ b/gen/xyz/openbmc_project/Control/Processor/meson.build +@@ -14,3 +14,18 @@ generated_others += custom_target( + build_by_default: true, + ) + ++subdir('ErrConfig') ++generated_others += custom_target( ++ 'xyz/openbmc_project/Control/Processor/ErrConfig__markdown'.underscorify(), ++ input: [ meson.source_root() / 'xyz/openbmc_project/Control/Processor/ErrConfig.interface.yaml', ], ++ output: [ 'ErrConfig.md' ], ++ command: [ ++ sdbuspp_gen_meson_prog, '--command', 'markdown', ++ '--output', meson.current_build_dir(), ++ '--tool', sdbusplusplus_prog, ++ '--directory', meson.source_root(), ++ 'xyz/openbmc_project/Control/Processor/ErrConfig', ++ ], ++ build_by_default: true, ++) ++ +diff --git a/gen/xyz/openbmc_project/Inventory/Item/Bios/meson.build b/gen/xyz/openbmc_project/Inventory/Item/Bios/meson.build +new file mode 100644 +index 0000000..5c6fce0 +--- /dev/null ++++ b/gen/xyz/openbmc_project/Inventory/Item/Bios/meson.build +@@ -0,0 +1,14 @@ ++# Generated file; do not modify. ++generated_sources += custom_target( ++ 'xyz/openbmc_project/Inventory/Item/Bios__cpp'.underscorify(), ++ input: [ meson.source_root() / 'xyz/openbmc_project/Inventory/Item/Bios.interface.yaml', ], ++ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ], ++ command: [ ++ sdbuspp_gen_meson_prog, '--command', 'cpp', ++ '--output', meson.current_build_dir(), ++ '--tool', sdbusplusplus_prog, ++ '--directory', meson.source_root(), ++ 'xyz/openbmc_project/Inventory/Item/Bios', ++ ], ++) ++ +diff --git a/gen/xyz/openbmc_project/Inventory/Item/meson.build b/gen/xyz/openbmc_project/Inventory/Item/meson.build +index 145bba2..3e036bd 100644 +--- a/gen/xyz/openbmc_project/Inventory/Item/meson.build ++++ b/gen/xyz/openbmc_project/Inventory/Item/meson.build +@@ -27,6 +27,21 @@ generated_others += custom_target( + build_by_default: true, + ) + ++subdir('Bios') ++generated_others += custom_target( ++ 'xyz/openbmc_project/Inventory/Item/Bios__markdown'.underscorify(), ++ input: [ meson.source_root() / 'xyz/openbmc_project/Inventory/Item/Bios.interface.yaml', ], ++ output: [ 'Bios.md' ], ++ command: [ ++ sdbuspp_gen_meson_prog, '--command', 'markdown', ++ '--output', meson.current_build_dir(), ++ '--tool', sdbusplusplus_prog, ++ '--directory', meson.source_root(), ++ 'xyz/openbmc_project/Inventory/Item/Bios', ++ ], ++ build_by_default: true, ++) ++ + subdir('Bmc') + generated_others += custom_target( + 'xyz/openbmc_project/Inventory/Item/Bmc__markdown'.underscorify(), +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend index adebde874..b7ed97255 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend @@ -1,19 +1,14 @@ -SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git;nobranch=1" - -# todo(Johnathan) fix nobranch -SRCREV = "26ff1c84469e470e28257f3584e1b1126d4783f0" +#SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git" +SRCREV = "395ba2176054745ff453f056e0593d3c2d802ea8" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI += "file://0005-Add-DBUS-interface-of-CPU-and-Memory-s-properties.patch \ - file://0007-ipmi-set-BIOS-id.patch \ +SRC_URI += "file://0007-ipmi-set-BIOS-id.patch \ file://0010-Increase-the-default-watchdog-timeout-value.patch \ file://0012-Add-RestoreDelay-interface-for-power-restore-delay.patch \ file://0013-Add-ErrConfig.yaml-interface-for-processor-error-config.patch \ file://0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch \ file://0025-Add-PreInterruptFlag-properity-in-DBUS.patch \ - file://0001-Reapply-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-e.patch \ file://0026-Add-StandbySpare-support-for-software-inventory.patch \ - file://0027-Apply-Options-interface-for-Software.patch \ - file://0028-MCTP-Daemon-D-Bus-interface-definition.patch \ + file://0031-update-meson-build-files-for-control-and-bios.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend index 2e4e23d40..7e25bb26e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend @@ -4,7 +4,7 @@ inherit obmc-phosphor-systemd SYSTEMD_SERVICE_${PN} = "phosphor-pid-control.service" EXTRA_OECONF = "--enable-configure-dbus=yes" -SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git" -SRCREV = "6fc301fbc3775730a0e69f215110ec93bd9026f3" +SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git;nobranch=1" +SRCREV = "1277543ac599de45d15db99d15bd0e89d3653c9b" FILES_${PN} = "${bindir}/swampd ${bindir}/setsensor" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch deleted file mode 100644 index d43256bf4..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch +++ /dev/null @@ -1,459 +0,0 @@ -From e710df3123c382fc735c451a048f7c51250c1a92 Mon Sep 17 00:00:00 2001 -From: James Feist <james.feist@linux.intel.com> -Date: Thu, 11 Jun 2020 13:14:11 -0700 -Subject: [PATCH 1/2] Add more error types - -This adds ImageFailure and Busy error types -to updates status in bmcweb. - -elog-errors.hpp is a generated file. - -Tested: Could create errors - -Signed-off-by: James Feist <james.feist@linux.intel.com> ---- - elog-errors.hpp | 269 ++++++++++++------ - .../Software/Image.errors.yaml | 5 + - .../Software/Image.metadata.yaml | 11 + - 3 files changed, 204 insertions(+), 81 deletions(-) - -diff --git a/elog-errors.hpp b/elog-errors.hpp -index 2888f0d..38016e1 100644 ---- a/elog-errors.hpp -+++ b/elog-errors.hpp -@@ -2,12 +2,12 @@ - // See elog-gen.py for more details - #pragma once - --#include <phosphor-logging/elog.hpp> --#include <phosphor-logging/log.hpp> --#include <sdbusplus/exception.hpp> - #include <string> - #include <tuple> - #include <type_traits> -+#include <sdbusplus/exception.hpp> -+#include <phosphor-logging/log.hpp> -+#include <phosphor-logging/elog.hpp> - - namespace sdbusplus - { -@@ -21,7 +21,7 @@ namespace Image - { - namespace Error - { --struct UnTarFailure; -+ struct InternalFailure; - } // namespace Error - } // namespace Image - } // namespace Software -@@ -41,7 +41,7 @@ namespace Image - { - namespace Error - { --struct InternalFailure; -+ struct UnTarFailure; - } // namespace Error - } // namespace Image - } // namespace Software -@@ -61,7 +61,7 @@ namespace Image - { - namespace Error - { --struct ManifestFileFailure; -+ struct BusyFailure; - } // namespace Error - } // namespace Image - } // namespace Software -@@ -69,6 +69,47 @@ struct ManifestFileFailure; - } // namespace xyz - } // namespace sdbusplus - -+namespace sdbusplus -+{ -+namespace xyz -+{ -+namespace openbmc_project -+{ -+namespace Software -+{ -+namespace Image -+{ -+namespace Error -+{ -+ struct ImageFailure; -+} // namespace Error -+} // namespace Image -+} // namespace Software -+} // namespace openbmc_project -+} // namespace xyz -+} // namespace sdbusplus -+ -+namespace sdbusplus -+{ -+namespace xyz -+{ -+namespace openbmc_project -+{ -+namespace Software -+{ -+namespace Image -+{ -+namespace Error -+{ -+ struct ManifestFileFailure; -+} // namespace Error -+} // namespace Image -+} // namespace Software -+} // namespace openbmc_project -+} // namespace xyz -+} // namespace sdbusplus -+ -+ - namespace phosphor - { - -@@ -88,38 +129,25 @@ namespace _UnTarFailure - - struct PATH - { -- static constexpr auto str = "PATH=%s"; -+ /* -+ * We can't use -fsanitize=undefined if we declare a -+ * 'static constexpr auto str' member, so don't. Instead, open-code the -+ * mako template lookups. -+ */ - static constexpr auto str_short = "PATH"; -- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; -- explicit constexpr PATH(const char* a) : _entry(entry(str, a)){}; -+ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; -+ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; - type _entry; - }; - --} // namespace _UnTarFailure -+} // namespace _UnTarFailure - --struct UnTarFailure : public sdbusplus::exception_t -+struct UnTarFailure - { -- static constexpr auto errName = -- "xyz.openbmc_project.Software.Image.UnTarFailure"; -- static constexpr auto errDesc = "An error occurred during untar."; - static constexpr auto L = level::ERR; - using PATH = _UnTarFailure::PATH; - using metadata_types = std::tuple<PATH>; - -- const char* name() const noexcept -- { -- return errName; -- } -- -- const char* description() const noexcept -- { -- return errDesc; -- } -- -- const char* what() const noexcept -- { -- return errName; -- } - }; - - } // namespace Image -@@ -127,16 +155,17 @@ struct UnTarFailure : public sdbusplus::exception_t - } // namespace openbmc_project - } // namespace xyz - -+ - namespace details - { - - template <> --struct map_exception_type< -- sdbusplus::xyz::openbmc_project::Software::Image::Error::UnTarFailure> -+struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::UnTarFailure> - { - using type = xyz::openbmc_project::Software::Image::UnTarFailure; - }; --} // namespace details -+ -+} - - namespace xyz - { -@@ -151,38 +180,25 @@ namespace _ManifestFileFailure - - struct PATH - { -- static constexpr auto str = "PATH=%s"; -+ /* -+ * We can't use -fsanitize=undefined if we declare a -+ * 'static constexpr auto str' member, so don't. Instead, open-code the -+ * mako template lookups. -+ */ - static constexpr auto str_short = "PATH"; -- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; -- explicit constexpr PATH(const char* a) : _entry(entry(str, a)){}; -+ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; -+ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; - type _entry; - }; - --} // namespace _ManifestFileFailure -+} // namespace _ManifestFileFailure - --struct ManifestFileFailure : public sdbusplus::exception_t -+struct ManifestFileFailure - { -- static constexpr auto errName = -- "xyz.openbmc_project.Software.Image.ManifestFileFailure"; -- static constexpr auto errDesc = "An error when reading the Manifest file."; - static constexpr auto L = level::ERR; - using PATH = _ManifestFileFailure::PATH; - using metadata_types = std::tuple<PATH>; - -- const char* name() const noexcept -- { -- return errName; -- } -- -- const char* description() const noexcept -- { -- return errDesc; -- } -- -- const char* what() const noexcept -- { -- return errName; -- } - }; - - } // namespace Image -@@ -190,16 +206,17 @@ struct ManifestFileFailure : public sdbusplus::exception_t - } // namespace openbmc_project - } // namespace xyz - -+ - namespace details - { - - template <> --struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image:: -- Error::ManifestFileFailure> -+struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::ManifestFileFailure> - { - using type = xyz::openbmc_project::Software::Image::ManifestFileFailure; - }; --} // namespace details -+ -+} - - namespace xyz - { -@@ -214,39 +231,76 @@ namespace _InternalFailure - - struct FAIL - { -- static constexpr auto str = "FAIL=%s"; -+ /* -+ * We can't use -fsanitize=undefined if we declare a -+ * 'static constexpr auto str' member, so don't. Instead, open-code the -+ * mako template lookups. -+ */ - static constexpr auto str_short = "FAIL"; -- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; -- explicit constexpr FAIL(const char* a) : _entry(entry(str, a)){}; -+ using type = std::tuple<std::decay_t<decltype("FAIL=%s")>,const char*>; -+ explicit constexpr FAIL(const char* a) : _entry(entry("FAIL=%s", a)) {}; - type _entry; - }; - --} // namespace _InternalFailure -+} // namespace _InternalFailure - --struct InternalFailure : public sdbusplus::exception_t -+struct InternalFailure - { -- static constexpr auto errName = -- "xyz.openbmc_project.Software.Image.InternalFailure"; -- static constexpr auto errDesc = -- "The operation failed internally during processing the image."; - static constexpr auto L = level::ERR; - using FAIL = _InternalFailure::FAIL; - using metadata_types = std::tuple<FAIL>; - -- const char* name() const noexcept -- { -- return errName; -- } -+}; -+ -+} // namespace Image -+} // namespace Software -+} // namespace openbmc_project -+} // namespace xyz -+ -+ -+namespace details -+{ -+ -+template <> -+struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::InternalFailure> -+{ -+ using type = xyz::openbmc_project::Software::Image::InternalFailure; -+}; -+ -+} - -- const char* description() const noexcept -- { -- return errDesc; -- } -+namespace xyz -+{ -+namespace openbmc_project -+{ -+namespace Software -+{ -+namespace Image -+{ -+namespace _ImageFailure -+{ -+ -+struct PATH -+{ -+ /* -+ * We can't use -fsanitize=undefined if we declare a -+ * 'static constexpr auto str' member, so don't. Instead, open-code the -+ * mako template lookups. -+ */ -+ static constexpr auto str_short = "PATH"; -+ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; -+ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; -+ type _entry; -+}; -+ -+} // namespace _ImageFailure -+ -+struct ImageFailure -+{ -+ static constexpr auto L = level::ERR; -+ using PATH = _ImageFailure::PATH; -+ using metadata_types = std::tuple<PATH>; - -- const char* what() const noexcept -- { -- return errName; -- } - }; - - } // namespace Image -@@ -254,16 +308,69 @@ struct InternalFailure : public sdbusplus::exception_t - } // namespace openbmc_project - } // namespace xyz - -+ - namespace details - { - - template <> --struct map_exception_type< -- sdbusplus::xyz::openbmc_project::Software::Image::Error::InternalFailure> -+struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::ImageFailure> - { -- using type = xyz::openbmc_project::Software::Image::InternalFailure; -+ using type = xyz::openbmc_project::Software::Image::ImageFailure; - }; --} // namespace details -+ -+} -+ -+namespace xyz -+{ -+namespace openbmc_project -+{ -+namespace Software -+{ -+namespace Image -+{ -+namespace _BusyFailure -+{ -+ -+struct PATH -+{ -+ /* -+ * We can't use -fsanitize=undefined if we declare a -+ * 'static constexpr auto str' member, so don't. Instead, open-code the -+ * mako template lookups. -+ */ -+ static constexpr auto str_short = "PATH"; -+ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; -+ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; -+ type _entry; -+}; -+ -+} // namespace _BusyFailure -+ -+struct BusyFailure -+{ -+ static constexpr auto L = level::ERR; -+ using PATH = _BusyFailure::PATH; -+ using metadata_types = std::tuple<PATH>; -+ -+}; -+ -+} // namespace Image -+} // namespace Software -+} // namespace openbmc_project -+} // namespace xyz -+ -+ -+namespace details -+{ -+ -+template <> -+struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::BusyFailure> -+{ -+ using type = xyz::openbmc_project::Software::Image::BusyFailure; -+}; -+ -+} -+ - - } // namespace logging - -diff --git a/xyz/openbmc_project/Software/Image.errors.yaml b/xyz/openbmc_project/Software/Image.errors.yaml -index 67d6c20..2b8f7ee 100644 ---- a/xyz/openbmc_project/Software/Image.errors.yaml -+++ b/xyz/openbmc_project/Software/Image.errors.yaml -@@ -4,3 +4,8 @@ - description: An error when reading the Manifest file. - - name: InternalFailure - description: The operation failed internally during processing the image. -+- name: ImageFailure -+ description: An error occured processing the image. -+- name: BusyFailure -+ description: The device is busy during the update. -+ -diff --git a/xyz/openbmc_project/Software/Image.metadata.yaml b/xyz/openbmc_project/Software/Image.metadata.yaml -index 5e749c9..65d4e1c 100644 ---- a/xyz/openbmc_project/Software/Image.metadata.yaml -+++ b/xyz/openbmc_project/Software/Image.metadata.yaml -@@ -13,3 +13,14 @@ - meta: - - str: "FAIL=%s" - type: string -+- name: ImageFailure -+ level: ERR -+ meta: -+ - str: "PATH=%s" -+ type: string -+- name: BusyFailure -+ level: ERR -+ meta: -+ - str: "PATH=%s" -+ type: string -+ --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0004-Changed-the-condition-of-software-version-service-wa.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0004-Changed-the-condition-of-software-version-service-wa.patch index 3fc3907ba..bcf692f5e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0004-Changed-the-condition-of-software-version-service-wa.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0004-Changed-the-condition-of-software-version-service-wa.patch @@ -17,7 +17,7 @@ diff --git a/watch.cpp b/watch.cpp index e46b8aa..eee1bc3 100644 --- a/watch.cpp +++ b/watch.cpp -@@ -45,7 +45,7 @@ Watch::Watch(sd_event* loop, std::function<int(std::string&)> imageCallback) : +@@ -46,7 +46,7 @@ Watch::Watch(sd_event* loop, std::function<int(std::string&)> imageCallback) : std::strerror(error)); } @@ -26,7 +26,7 @@ index e46b8aa..eee1bc3 100644 if (-1 == wd) { auto error = errno; -@@ -96,7 +96,8 @@ int Watch::callback(sd_event_source* s, int fd, uint32_t revents, +@@ -97,7 +97,8 @@ int Watch::callback(sd_event_source* /* s */, int fd, uint32_t revents, while (offset < bytes) { auto event = reinterpret_cast<inotify_event*>(&buffer[offset]); diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch index 355261e8f..85ef5afcf 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch @@ -10,22 +10,24 @@ Subject: [PATCH 1/1] Modified firmware activation to launch fwupd.sh through Signed-off-by: Jennifer Lee <jennifer1.lee@intel.com> Signed-off-by: James Feist <james.feist@linux.intel.com> + --- - activation.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ - configure.ac | 7 +++++++ - static/flash.cpp | 41 +++++++++++++++++++++++++++++++++++++++-- - ubi/flash.cpp | 9 +++------ - 4 files changed, 92 insertions(+), 8 deletions(-) + activation.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ + meson.build | 1 + + meson_options.txt | 3 +++ + static/flash.cpp | 41 +++++++++++++++++++++++++++++++++++++++-- + ubi/flash.cpp | 9 +++------ + 5 files changed, 91 insertions(+), 8 deletions(-) diff --git a/activation.cpp b/activation.cpp -index ab76420..91e3a10 100644 +index 291ce7c..f76018d 100644 --- a/activation.cpp +++ b/activation.cpp -@@ -200,6 +200,49 @@ auto Activation::activation(Activations value) -> Activations - softwareServer::Activation::Activations::Active); - } - } -+#elif defined(FWUPD_SCRIPT) +@@ -88,7 +88,50 @@ auto Activation::activation(Activations value) -> Activations + + if (value == softwareServer::Activation::Activations::Activating) + { ++#ifdef FWUPD_SCRIPT + if (!activationProgress) + { + // Enable systemd signals @@ -58,7 +60,7 @@ index ab76420..91e3a10 100644 + redundancyPriority = + std::make_unique<RedundancyPriority>(bus, path, *this, 0); + } -+ + + // Remove version object from image manager + Activation::deleteImageManagerObject(); + @@ -68,35 +70,60 @@ index ab76420..91e3a10 100644 + return softwareServer::Activation::activation( + softwareServer::Activation::Activations::Active); + } - #else // !UBIFS_LAYOUT ++#else // !FWUPD_SCRIPT + #ifdef HOST_BIOS_UPGRADE + auto purpose = parent.versions.find(versionId)->second->purpose(); + if (purpose == VersionPurpose::Host) +@@ -111,7 +154,6 @@ auto Activation::activation(Activations value) -> Activations + return softwareServer::Activation::activation(value); + } + #endif +- + auto versionStr = parent.versions.find(versionId)->second->version(); + + if (!minimum_ship_level::verify(versionStr)) +@@ -175,6 +217,7 @@ auto Activation::activation(Activations value) -> Activations + return softwareServer::Activation::activation( + softwareServer::Activation::Activations::Active); + #endif ++#endif // FWUPD_SCRIPT + } + else + { +diff --git a/meson.build b/meson.build +index 62b9aeb..08d6f71 100644 +--- a/meson.build ++++ b/meson.build +@@ -54,6 +54,7 @@ conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) + # Configurable features + conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) + conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) ++conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) - #ifdef WANT_SIGNATURE_VERIFY -diff --git a/configure.ac b/configure.ac -index 5fba420..3b5fdab 100755 ---- a/configure.ac -+++ b/configure.ac -@@ -194,6 +194,13 @@ AS_IF([test "x$enable_host_bios_upgrade" == "xyes"], \ - [AC_DEFINE([HOST_BIOS_UPGRADE],[],[Enable host bios upgrade support.])]) - AM_CONDITIONAL([HOST_BIOS_UPGRADE], [test "x$enable_host_bios_upgrade" == "xyes"]) + # Configurable variables + conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) +diff --git a/meson_options.txt b/meson_options.txt +index c9b7b33..4f7e62a 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -22,6 +22,9 @@ option('oe-sdk', type: 'feature', description: 'Enable OE SDK') + option('verify-signature', type: 'feature', + description: 'Enable image signature validation.') -+# setup fwupd script support -+AC_ARG_ENABLE([fwupd_script], -+ AS_HELP_STRING([--enable-fwupd_script], [Enable fwupd script support.])) -+AS_IF([test "x$enable_fwupd_script" == "xyes"], \ -+ [AC_DEFINE([FWUPD_SCRIPT],[],[Enable fwupd script support.])]) -+AM_CONDITIONAL([FWUPD_SCRIPT], [test "x$enable_fwupd_script" == "xyes"]) ++option('fwupd-script', type: 'feature', ++ description: 'Enable fwupd script support.') + - # Check for header files. - AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) - AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...openbmc/sdbusplus package required])]) + # Variables + option( + 'active-bmc-max-allowed', type: 'integer', diff --git a/static/flash.cpp b/static/flash.cpp -index 82c2393..1bf29d5 100644 +index 9bb2bba..c4ff002 100644 --- a/static/flash.cpp +++ b/static/flash.cpp -@@ -20,9 +20,11 @@ namespace updater - { +@@ -22,9 +22,11 @@ namespace updater - namespace fs = std::experimental::filesystem; + namespace fs = std::filesystem; + using namespace phosphor::software::image; +namespace softwareServer = sdbusplus::xyz::openbmc_project::Software::server; void Activation::flashWrite() @@ -105,7 +132,7 @@ index 82c2393..1bf29d5 100644 // For static layout code update, just put images in /run/initramfs. // It expects user to trigger a reboot and an updater script will program // the image to flash during reboot. -@@ -33,11 +35,46 @@ void Activation::flashWrite() +@@ -36,11 +38,46 @@ void Activation::flashWrite() fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage, fs::copy_options::overwrite_existing); } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0006-Modify-the-ID-of-software-image-updater-object-on-DB.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0006-Modify-the-ID-of-software-image-updater-object-on-DB.patch index 2d2ac2673..1f2a86fb9 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0006-Modify-the-ID-of-software-image-updater-object-on-DB.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0006-Modify-the-ID-of-software-image-updater-object-on-DB.patch @@ -26,8 +26,8 @@ index 5b2ff49..e3d26e3 100644 +#include <time.h> #include <unistd.h> - #include <algorithm> -@@ -129,6 +130,11 @@ int Manager::processImage(const std::string& tarFilePath) + #include <elog-errors.hpp> +@@ -174,6 +175,11 @@ int Manager::processImage(const std::string& tarFilePath) // Compute id auto id = Version::getId(version); diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-Adding-StandBySpare-for-firmware-activation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-Adding-StandBySpare-for-firmware-activation.patch index b63226cce..6039be44b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-Adding-StandBySpare-for-firmware-activation.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-Adding-StandBySpare-for-firmware-activation.patch @@ -31,9 +31,9 @@ diff --git a/activation.cpp b/activation.cpp index 2966b2f..a098784 100644 --- a/activation.cpp +++ b/activation.cpp -@@ -80,12 +80,16 @@ auto Activation::activation(Activations value) -> Activations +@@ -81,12 +81,16 @@ void Activation::unsubscribeFromSystemdSignals() + auto Activation::activation(Activations value) -> Activations { - if ((value != softwareServer::Activation::Activations::Active) && - (value != softwareServer::Activation::Activations::Activating)) + (value != softwareServer::Activation::Activations::Activating) && @@ -48,9 +48,9 @@ index 2966b2f..a098784 100644 + value == + softwareServer::Activation::Activations::ActivatingAsStandbySpare) { - #ifdef UBIFS_LAYOUT - if (rwVolumeCreated == false && roVolumeCreated == false) -@@ -256,6 +260,20 @@ auto Activation::requestedActivation(RequestedActivations value) + #ifdef FWUPD_SCRIPT + if (!activationProgress) +@@ -309,6 +313,20 @@ auto Activation::requestedActivation(RequestedActivations value) softwareServer::Activation::Activations::Activating); } } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch index 92b3ced38..49bdc138f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch @@ -10,65 +10,23 @@ Testing: tested PFR image uploads and updates Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> + --- - Makefile.am | 18 +++- activation.cpp | 2 +- - configure.ac | 7 ++ - item_updater.cpp | 6 +- + item_updater.cpp | 7 +- + meson.build | 7 +- + meson_options.txt | 3 + pfr_image_manager.cpp | 217 ++++++++++++++++++++++++++++++++++++++++++ pfr_image_manager.hpp | 75 +++++++++++++++ - 6 files changed, 320 insertions(+), 5 deletions(-) + 6 files changed, 306 insertions(+), 5 deletions(-) create mode 100644 pfr_image_manager.cpp create mode 100644 pfr_image_manager.hpp -diff --git a/Makefile.am b/Makefile.am -index 6c3ec16..59ebecc 100755 ---- a/Makefile.am -+++ b/Makefile.am -@@ -6,13 +6,20 @@ noinst_HEADERS = \ - watch.hpp \ - version.hpp \ - images.hpp \ -- image_manager.hpp \ - item_updater.hpp \ - activation.hpp \ - flash.hpp \ - item_updater_helper.hpp \ - utils.hpp - -+if PFR_UPDATE -+noinst_HEADERS += \ -+ pfr_image_manager.hpp -+else -+noinst_HEADERS += \ -+ image_manager.hpp -+endif -+ - bin_PROGRAMS = \ - phosphor-version-software-manager \ - phosphor-download-manager \ -@@ -24,8 +31,15 @@ dist_bin_SCRIPTS = \ - phosphor_version_software_manager_SOURCES = \ - image_manager_main.cpp \ - watch.cpp \ -- version.cpp \ -+ version.cpp -+ -+if PFR_UPDATE -+phosphor_version_software_manager_SOURCES += \ -+ pfr_image_manager.cpp -+else -+phosphor_version_software_manager_SOURCES += \ - image_manager.cpp -+endif - - BUILT_SOURCES = \ - xyz/openbmc_project/Software/Image/error.cpp \ diff --git a/activation.cpp b/activation.cpp -index cea1e50..7ff4196 100644 +index bad17b8..3363230 100644 --- a/activation.cpp +++ b/activation.cpp -@@ -197,7 +197,7 @@ auto Activation::activation(Activations value) -> Activations +@@ -119,7 +119,7 @@ auto Activation::activation(Activations value) -> Activations } else if (activationProgress->progress() == 100) { @@ -77,31 +35,13 @@ index cea1e50..7ff4196 100644 if (!redundancyPriority) { redundancyPriority = -diff --git a/configure.ac b/configure.ac -index 720e704..e527682 100755 ---- a/configure.ac -+++ b/configure.ac -@@ -191,6 +191,13 @@ AS_IF([test "x$enable_fwupd_script" == "xyes"], \ - [AC_DEFINE([FWUPD_SCRIPT],[],[Enable fwupd script support.])]) - AM_CONDITIONAL([FWUPD_SCRIPT], [test "x$enable_fwupd_script" == "xyes"]) - -+# setup pfr image update support -+AC_ARG_ENABLE([pfr_update], -+ AS_HELP_STRING([--enable-pfr_update], [Enable pfr image update support.])) -+AS_IF([test "x$enable_pfr_update" == "xyes"], \ -+ [AC_DEFINE([PFR_UPDATE],[],[Enable pfr image update support.])]) -+AM_CONDITIONAL([PFR_UPDATE], [test "x$enable_pfr_update" == "xyes"]) -+ - # Check for header files. - AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) - AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...openbmc/sdbusplus package required])]) diff --git a/item_updater.cpp b/item_updater.cpp -index 21fb6e0..fd76a7f 100644 +index df8595c..694975f 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -64,10 +64,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) auto value = SVersion::convertVersionPurposeFromString( - variant_ns::get<std::string>(property.second)); + std::get<std::string>(property.second)); if (value == VersionPurpose::BMC || -#ifdef HOST_BIOS_UPGRADE +#if defined(HOST_BIOS_UPGRADE) || defined(PFR_UPDATE) @@ -112,29 +52,84 @@ index 21fb6e0..fd76a7f 100644 { purpose = value; } -@@ -356,6 +357,7 @@ void ItemUpdater::deleteAll() +@@ -399,6 +399,7 @@ void ItemUpdater::deleteAll() ItemUpdater::ActivationStatus ItemUpdater::validateSquashFSImage(const std::string& filePath) { +#ifndef PFR_UPDATE - bool invalid = false; + bool valid = true; - for (auto& bmcImage : bmcImages) -@@ -375,7 +377,7 @@ ItemUpdater::ActivationStatus - { - return ItemUpdater::ActivationStatus::invalid; + // Record the images which are being updated +@@ -416,7 +417,7 @@ ItemUpdater::ActivationStatus + return ItemUpdater::ActivationStatus::invalid; + } } - +#endif return ItemUpdater::ActivationStatus::ready; } +@@ -690,8 +691,8 @@ void ItemUpdater::freeSpace(Activation& caller) + // Failed activations don't have priority, assign them a large value + // for sorting purposes. + auto priority = 999; +- if ((iter.second.get()->activation() == +- server::Activation::Activations::Active)&& ++ if ((iter.second.get()->activation() == ++ server::Activation::Activations::Active) && + iter.second->redundancyPriority.get()) + { + priority = iter.second->redundancyPriority.get()->priority(); +diff --git a/meson.build b/meson.build +index 08d6f71..c61d59f 100644 +--- a/meson.build ++++ b/meson.build +@@ -55,6 +55,7 @@ conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) + conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) + conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) + conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) ++conf.set('PFR_UPDATE', get_option('pfr-update').enabled()) + + # Configurable variables + conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) +@@ -195,12 +196,16 @@ executable( + install: true + ) + ++image_manager_source = files('image_manager.cpp') ++if get_option('pfr-update').enabled() ++ image_manager_source = files('pfr_image_manager.cpp') ++endif + executable( + 'phosphor-version-software-manager', + image_error_cpp, + image_error_hpp, +- 'image_manager.cpp', + 'image_manager_main.cpp', ++ image_manager_source, + 'version.cpp', + 'watch.cpp', + dependencies: [deps, ssl], +diff --git a/meson_options.txt b/meson_options.txt +index 4f7e62a..1593502 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', + option('fwupd-script', type: 'feature', + description: 'Enable fwupd script support.') + ++option('pfr-update', type: 'feature', ++ description: 'Enable fwupd script support.') ++ + # Variables + option( + 'active-bmc-max-allowed', type: 'integer', diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp new file mode 100644 index 0000000..242a6ca --- /dev/null +++ b/pfr_image_manager.cpp -@@ -0,0 +1,217 @@ +@@ -0,0 +1,218 @@ +#include "config.h" + +#include "pfr_image_manager.hpp" @@ -149,15 +144,16 @@ index 0000000..242a6ca +#include <time.h> +#include <unistd.h> + ++#include <elog-errors.hpp> ++#include <xyz/openbmc_project/Software/Image/error.hpp> ++ +#include <algorithm> +#include <cstring> -+#include <elog-errors.hpp> +#include <filesystem> +#include <fstream> +#include <iomanip> +#include <sstream> +#include <string> -+#include <xyz/openbmc_project/Software/Image/error.hpp> + +namespace phosphor +{ @@ -357,7 +353,7 @@ new file mode 100644 index 0000000..c6ee6a4 --- /dev/null +++ b/pfr_image_manager.hpp -@@ -0,0 +1,75 @@ +@@ -0,0 +1,76 @@ +#pragma once +#include "version.hpp" + @@ -370,7 +366,8 @@ index 0000000..c6ee6a4 +namespace manager +{ + -+enum pfrImgPCType { ++enum pfrImgPCType ++{ + pfrCPLDUpdateCap = 0x00, + pfrPCHPFM = 0x01, + pfrPCHUpdateCap = 0x02, @@ -379,7 +376,8 @@ index 0000000..c6ee6a4 +}; + +/* PFR image block 0 - As defined in HAS */ -+struct pfrImgBlock0 { ++struct pfrImgBlock0 ++{ + uint8_t tag[4]; + uint8_t pcLength[4]; + uint8_t pcType[4]; @@ -387,7 +385,7 @@ index 0000000..c6ee6a4 + uint8_t hash256[32]; + uint8_t hash384[48]; + uint8_t reserved2[32]; -+}__attribute__((packed)); ++} __attribute__((packed)); + +/** @class Manager + * @brief Contains a map of Version dbus objects. @@ -427,7 +425,6 @@ index 0000000..c6ee6a4 + + /** @brief Persistent sdbusplus DBus bus connection. */ + sdbusplus::bus::bus& bus; -+ +}; + +} // namespace manager diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-PFR-image-HASH-verification.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-PFR-image-HASH-verification.patch index c65f8318c..72eb0beba 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-PFR-image-HASH-verification.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-PFR-image-HASH-verification.patch @@ -59,18 +59,15 @@ index 242a6ca..1a41cbe 100644 #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> -@@ -15,9 +17,9 @@ - #include <algorithm> - #include <cstring> - #include <elog-errors.hpp> --#include <filesystem> +@@ -20,6 +22,7 @@ + #include <filesystem> #include <fstream> #include <iomanip> +#include <set> #include <sstream> #include <string> - #include <xyz/openbmc_project/Software/Image/error.hpp> -@@ -33,12 +35,21 @@ using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; + +@@ -34,12 +37,21 @@ using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; namespace Software = phosphor::logging::xyz::openbmc_project::Software; static constexpr const uint32_t pfmPos = 2054; @@ -96,7 +93,7 @@ index 242a6ca..1a41cbe 100644 if (std::filesystem::exists(imgPath)) { -@@ -55,17 +66,101 @@ static int getPFRImgInfo(const std::filesystem::path imgPath, uint8_t& imgType, +@@ -56,17 +68,101 @@ static int getPFRImgInfo(const std::filesystem::path imgPath, uint8_t& imgType, imgFile.read(reinterpret_cast<char*>(&block0Data), sizeof(block0Data)); @@ -200,7 +197,7 @@ index 242a6ca..1a41cbe 100644 } catch (std::exception& e) { -@@ -79,20 +174,21 @@ static int getPFRImgInfo(const std::filesystem::path imgPath, uint8_t& imgType, +@@ -80,20 +176,21 @@ static int getPFRImgInfo(const std::filesystem::path imgPath, uint8_t& imgType, int Manager::processImage(const std::string& imgFilePath) { @@ -225,7 +222,7 @@ index 242a6ca..1a41cbe 100644 return -1; } -@@ -103,31 +198,6 @@ int Manager::processImage(const std::string& imgFilePath) +@@ -104,31 +201,6 @@ int Manager::processImage(const std::string& imgFilePath) return -1; } @@ -257,7 +254,7 @@ index 242a6ca..1a41cbe 100644 sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose purpose = Version::VersionPurpose::Unknown; try -@@ -169,6 +239,7 @@ int Manager::processImage(const std::string& imgFilePath) +@@ -170,6 +242,7 @@ int Manager::processImage(const std::string& imgFilePath) std::filesystem::create_directory(imageDirPath); std::filesystem::path newFileName = imageDirPath / "image-runtime"; @@ -265,7 +262,7 @@ index 242a6ca..1a41cbe 100644 std::filesystem::rename(imgFilePath, newFileName); // Create Version object -@@ -212,6 +283,14 @@ void Manager::erase(std::string entryId) +@@ -213,6 +286,14 @@ void Manager::erase(std::string entryId) this->versions.erase(entryId); } @@ -284,7 +281,7 @@ diff --git a/pfr_image_manager.hpp b/pfr_image_manager.hpp index c6ee6a4..5b7b2c3 100644 --- a/pfr_image_manager.hpp +++ b/pfr_image_manager.hpp -@@ -1,6 +1,13 @@ +@@ -1,8 +1,16 @@ #pragma once #include "version.hpp" @@ -294,38 +291,26 @@ index c6ee6a4..5b7b2c3 100644 +#include <sys/mman.h> +#include <unistd.h> + -+#include <filesystem> #include <sdbusplus/server.hpp> ++#include <filesystem> ++ namespace phosphor -@@ -10,7 +17,8 @@ namespace software - namespace manager { - --enum pfrImgPCType { -+enum pfrImgPCType -+{ - pfrCPLDUpdateCap = 0x00, - pfrPCHPFM = 0x01, - pfrPCHUpdateCap = 0x02, -@@ -19,15 +27,94 @@ enum pfrImgPCType { - }; - + namespace software +@@ -22,7 +30,7 @@ enum pfrImgPCType /* PFR image block 0 - As defined in HAS */ --struct pfrImgBlock0 { + struct pfrImgBlock0 + { - uint8_t tag[4]; -+struct pfrImgBlock0 -+{ + uint32_t tag; uint8_t pcLength[4]; uint8_t pcType[4]; uint8_t reserved1[4]; - uint8_t hash256[32]; - uint8_t hash384[48]; +@@ -31,6 +39,82 @@ struct pfrImgBlock0 uint8_t reserved2[32]; --}__attribute__((packed)); -+} __attribute__((packed)); -+ + } __attribute__((packed)); + +/** @struct CustomFd + * + * RAII wrapper for file descriptor. @@ -343,8 +328,7 @@ index c6ee6a4..5b7b2c3 100644 + * @param[in] fd - File descriptor + */ + CustomFd(int fd) : fd(fd) -+ { -+ } ++ {} + + ~CustomFd() + { @@ -390,8 +374,7 @@ index c6ee6a4..5b7b2c3 100644 + * @param[in] length - length of the map + */ + CustomMap(void* addr, size_t length) : addr(addr), length(length) -+ { -+ } ++ {} + + ~CustomMap() + { @@ -403,10 +386,11 @@ index c6ee6a4..5b7b2c3 100644 + return addr; + } +}; - ++ /** @class Manager * @brief Contains a map of Version dbus objects. -@@ -61,13 +148,28 @@ class Manager + * @details The software image manager class that contains the Version dbus +@@ -63,6 +147,22 @@ class Manager void erase(std::string entryId); private: @@ -429,13 +413,3 @@ index c6ee6a4..5b7b2c3 100644 /** @brief Persistent map of Version dbus objects and their * version id */ std::map<std::string, std::unique_ptr<Version>> versions; - - /** @brief Persistent sdbusplus DBus bus connection. */ - sdbusplus::bus::bus& bus; -- - }; - - } // namespace manager --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-item_updater-update-the-bmc_active-objectPath.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-item_updater-update-the-bmc_active-objectPath.patch index bac756a18..e0ff79795 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-item_updater-update-the-bmc_active-objectPath.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0008-item_updater-update-the-bmc_active-objectPath.patch @@ -6,25 +6,45 @@ Subject: [PATCH] item_updater: update the bmc_active objectPath Update the Software object path to bmc_active instead of random Id. Signed-off-by: Chalapathi <chalapathix.venkataramashetty@intel.com> + --- - item_updater.cpp | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) + item_updater.cpp | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/item_updater.cpp b/item_updater.cpp -index 7fe69e4..3ce1dbf 100644 +index e6dd298..c3a846d 100644 --- a/item_updater.cpp +++ b/item_updater.cpp -@@ -175,9 +175,7 @@ void ItemUpdater::processBMCImage() +@@ -175,7 +175,8 @@ void ItemUpdater::processBMCImage() if (0 == iter.path().native().compare(0, BMC_RO_PREFIX_LEN, BMC_ROFS_PREFIX)) { -- // The versionId is extracted from the path -- // for example /media/ro-2a1022fe. -- auto id = iter.path().native().substr(BMC_RO_PREFIX_LEN); +- // Get the version to calculate the id + std::string id = "bmc_active"; - auto osRelease = iter.path() / OS_RELEASE_FILE; ++ // upstream changed this to relative_path ... is that right? + fs::path releaseFile(OS_RELEASE_FILE); + auto osRelease = iter.path() / releaseFile.relative_path(); if (!fs::is_regular_file(osRelease)) - { --- -2.17.1 - +@@ -189,7 +190,6 @@ void ItemUpdater::processBMCImage() + // volumes created by the UBI layout for example have the id in + // the mount directory name. The worst that can happen is that + // erase() is called with an non-existent id and returns. +- auto id = iter.path().native().substr(BMC_RO_PREFIX_LEN); + ItemUpdater::erase(id); + + continue; +@@ -203,14 +203,11 @@ void ItemUpdater::processBMCImage() + + // Try to delete the version, same as above if the + // OS_RELEASE_FILE does not exist. +- auto id = iter.path().native().substr(BMC_RO_PREFIX_LEN); + ItemUpdater::erase(id); + + continue; + } + +- auto id = VersionClass::getId(version); +- + // Check if the id has already been added. This can happen if the + // BMC partitions / devices were manually flashed with the same + // image. diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0009-Add-ApplyOptions-D-bus-property-under-Software.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0009-Add-ApplyOptions-D-bus-property-under-Software.patch index 3fa6a9a79..f150c1027 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0009-Add-ApplyOptions-D-bus-property-under-Software.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0009-Add-ApplyOptions-D-bus-property-under-Software.patch @@ -27,9 +27,9 @@ index 3f0530f..5c1a779 100644 #include <xyz/openbmc_project/Control/FieldMode/server.hpp> +#include <xyz/openbmc_project/Software/ApplyOptions/server.hpp> - namespace phosphor - { -@@ -21,7 +22,8 @@ using ItemUpdaterInherit = sdbusplus::server::object::object< + #include <string> + #include <vector> +@@ -24,7 +25,8 @@ using ItemUpdaterInherit = sdbusplus::server::object::object< sdbusplus::xyz::openbmc_project::Common::server::FactoryReset, sdbusplus::xyz::openbmc_project::Control::server::FieldMode, sdbusplus::xyz::openbmc_project::Association::server::Definitions, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0010-Add-error-reporting-to-pfr_image_manager.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0010-Add-error-reporting-to-pfr_image_manager.patch index 9c3ab4dd2..e72398efd 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0010-Add-error-reporting-to-pfr_image_manager.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0010-Add-error-reporting-to-pfr_image_manager.patch @@ -133,7 +133,7 @@ index 1a41cbe..fe1e6f9 100644 static constexpr const uint32_t pfmPos = 2054; static constexpr const uint32_t block0Magic = 0xB6EAFD19; -@@ -74,6 +78,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, +@@ -76,6 +80,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, phosphor::logging::log<phosphor::logging::level::ERR>( "Image magic number match failed", phosphor::logging::entry("IMAGEMAGIC=0x%x", imgMagic)); @@ -142,34 +142,37 @@ index 1a41cbe..fe1e6f9 100644 return -1; } -@@ -108,6 +114,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, +@@ -110,6 +116,9 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, phosphor::logging::log<phosphor::logging::level::ERR>( "Unknown image type"); + phosphor::logging::report<ImageFailure>( ++ ImageFail::FAIL("Unknown image type"), + ImageFail::PATH(imgPath.c_str())); return -1; } -@@ -151,6 +159,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, +@@ -153,6 +162,9 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s", redfishMsgID.c_str(), "REDFISH_MESSAGE_ARGS=%s", "Image HASH check fail", NULL); + phosphor::logging::report<ImageFailure>( ++ ImageFail::FAIL("Security violation: hash mismatch"), + ImageFail::PATH(imgPath.c_str())); return -1; } -@@ -165,6 +175,8 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, +@@ -167,6 +179,9 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, catch (std::exception& e) { phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); + phosphor::logging::report<ImageFailure>( ++ ImageFail::FAIL("Unhandled exception"), + ImageFail::PATH(imgPath.c_str())); return -1; } } -@@ -180,6 +192,12 @@ int Manager::processImage(const std::string& imgFilePath) +@@ -182,6 +197,12 @@ int Manager::processImage(const std::string& imgFilePath) if (!std::filesystem::exists(imgPath)) return -1; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch index 4c8f82aa3..156e6fe7c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch @@ -1,4 +1,4 @@ -From 0babf82f51561ac92a9b0dd56991d8de01930129 Mon Sep 17 00:00:00 2001 +From f6022e25d0b47af502522913773e589fcdd1568e Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy <vikram.bodireddy@intel.com> Date: Sun, 5 Jul 2020 00:54:57 +0530 Subject: [PATCH] Fix for RedudancyPriority in item_updater @@ -13,15 +13,16 @@ item_updater. Tested: Tested for coredumps during Seamless firmware update. Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> + --- item_updater.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/item_updater.cpp b/item_updater.cpp -index af01e39..8d7bb82 100644 +index c3a846d..b299b4d 100644 --- a/item_updater.cpp +++ b/item_updater.cpp -@@ -655,8 +655,9 @@ void ItemUpdater::freeSpace(Activation& caller) +@@ -690,8 +690,9 @@ void ItemUpdater::freeSpace(Activation& caller) // Failed activations don't have priority, assign them a large value // for sorting purposes. auto priority = 999; @@ -33,6 +34,3 @@ index af01e39..8d7bb82 100644 { priority = iter.second->redundancyPriority.get()->priority(); } --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0014-PFR-image-verification.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0014-PFR-image-verification.patch new file mode 100644 index 000000000..dfc7f2e58 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0014-PFR-image-verification.patch @@ -0,0 +1,116 @@ +From 9d82d53b50769506926dd99273f197a268d68fa3 Mon Sep 17 00:00:00 2001 +From: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com> +Date: Thu, 30 Jul 2020 09:50:40 +0000 +Subject: [PATCH] PFR-image-verification + +Add support verify the complete fw image by using mtd-util repo's +pfr_authenticate function. + +Tested. +1. Upload the corrupted image. +POST: https://<BMC_IP>/redfish/v1/UpdateService/ + with <Corrupted BMC_signed_cap> binary file +Response: +{ + "error": { + "@Message.ExtendedInfo": [ + { + "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", + "Message": "Invalid file uploaded to /redfish/v1/UpdateService: + Invalid image format.", + "MessageArgs": [ + "/redfish/v1/UpdateService", + "Invalid image format" + ], + "MessageId": "OpenBMC.0.1.0.InvalidUpload", + "Resolution": "None.", + "Severity": "Warning" + } + ], + "code": "OpenBMC.0.1.0.InvalidUpload", + "message": "Invalid file uploaded to /redfish/v1/UpdateService: + Invalid image format." + } +} + +2. Upload the correct image. +POST: https://<BMC_IP>/redfish/v1/UpdateService/ + with <BMC_signed_cap> binary file + +Image verified and firmware updated. +{ + "@odata.id": "/redfish/v1/TaskService/Tasks/0", + "@odata.type": "#Task.v1_4_3.Task", + "Id": "0", + "TaskState": "Running", + "TaskStatus": "OK" +} + +Command: +GET: https://<BMC_IP>/redfish/v1/Systems/system/LogServices/EventLog/ + Entries + +Response: +{ + "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/ + Entries/1596082187", + "@odata.type": "#LogEntry.v1_4_0.LogEntry", + "Created": "2020-07-30T04:09:47+00:00", + "EntryType": "Event", + "Id": "1596082187", + "Message": "BMC firmware update to version 00.72 completed + successfully.", + "MessageArgs": [ + "BMC", + "00.72" + ], + "MessageId": "OpenBMC.0.1.FirmwareUpdateCompleted", + "Name": "System Event Log Entry", + "Severity": "OK" + }, + +Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com> +--- + pfr_image_manager.cpp | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp +index eeed4fe..16231fa 100644 +--- a/pfr_image_manager.cpp ++++ b/pfr_image_manager.cpp +@@ -15,6 +15,7 @@ + #include <time.h> + #include <unistd.h> + ++#include <boost/process/child.hpp> + #include <elog-errors.hpp> + #include <xyz/openbmc_project/Software/Image/error.hpp> + +@@ -122,6 +123,24 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, + return -1; + } + ++ // Verify the complete image ++ std::string mtdUtilfile = "/usr/bin/mtd-util"; ++ std::vector<std::string> mtdUtilCmd = {"p", "a"}; ++ mtdUtilCmd.push_back(imgPath); ++ ++ boost::process::child execProg(mtdUtilfile, mtdUtilCmd); ++ execProg.wait(); ++ if (execProg.exit_code()) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Image authentication failed"); ++ phosphor::logging::report<ImageFailure>( ++ ImageFail::FAIL( ++ "Security violation: image authentication failure"), ++ ImageFail::PATH(imgPath.c_str())); ++ return -1; ++ } ++ + imgFile.seekg(pfmPos, + std::ios::beg); // Version is at 0x806 in the PFM + imgFile.read(reinterpret_cast<char*>(&verData), sizeof(verData)); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0015-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0015-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch new file mode 100644 index 000000000..54efbee8c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0015-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch @@ -0,0 +1,153 @@ +From f2dd5e13a0774d8683542798dd96979f9d7a6691 Mon Sep 17 00:00:00 2001 +From: Vernon Mauery <vernon.mauery@intel.com> +Date: Tue, 29 Sep 2020 13:38:35 -0700 +Subject: [PATCH] Fix delete image by ID and inhibit removal of bmc_active + +Delete image by ID was broken because when hitting the delete dbus +interface, it recalculated the ID from the parent version, which then +does not match because of the random number addition that was added to +the ID when the parent interface was created. This saves away the parent +interface ID and recalls it rather than recalculating it. + +Also, there was a logic error in deleting images that would delete the +active BMC image. This fixes up that error. + +Tested: run multiple back-to back updates and see that when the fwupd + script calls delete on the seamless images, the interfaces are + deleted and that the bmc_active interface is not deleted. + +Signed-off-by: Vernon Mauery <vernon.mauery@intel.com> +--- + item_updater.cpp | 17 +++++++++++------ + pfr_image_manager.cpp | 2 +- + version.cpp | 2 +- + version.hpp | 19 +++++++++++++++---- + 4 files changed, 28 insertions(+), 12 deletions(-) + +diff --git a/item_updater.cpp b/item_updater.cpp +index db255d6..90970d3 100644 +--- a/item_updater.cpp ++++ b/item_updater.cpp +@@ -133,7 +133,7 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) + activationState, associations))); + + auto versionPtr = std::make_unique<VersionClass>( +- bus, path, version, purpose, filePath, ++ bus, path, versionId, version, purpose, filePath, + std::bind(&ItemUpdater::erase, this, std::placeholders::_1)); + versionPtr->deleteObject = + std::make_unique<phosphor::software::manager::Delete>(bus, path, +@@ -247,7 +247,7 @@ void ItemUpdater::processBMCImage() + + // Create Version instance for this version. + auto versionPtr = std::make_unique<VersionClass>( +- bus, path, version, purpose, "", ++ bus, path, id, version, purpose, "", + std::bind(&ItemUpdater::erase, this, std::placeholders::_1)); + auto isVersionFunctional = versionPtr->isFunctional(); + if (!isVersionFunctional) +@@ -322,11 +322,11 @@ void ItemUpdater::erase(std::string entryId) + auto it = versions.find(entryId); + if (it != versions.end()) + { +- if (it->second->isFunctional() && ACTIVE_BMC_MAX_ALLOWED > 1) ++ if (it->second->isFunctional()) + { +- log<level::ERR>("Error: Version is currently running on the BMC. " +- "Unable to remove.", +- entry("VERSIONID=%s", entryId.c_str())); ++ log<level::INFO>("Error: Version is currently running on the BMC. " ++ "Unable to remove.", ++ entry("VERSIONID=%s", entryId.c_str())); + return; + } + } +@@ -669,6 +669,11 @@ void ItemUpdater::freeSpace(Activation& caller) + std::size_t count = 0; + for (const auto& iter : activations) + { ++ if (versions.find(iter.second->versionId)->second->isFunctional()) ++ { ++ // don't bother with function versions ++ continue; ++ } + if ((iter.second.get()->activation() == + server::Activation::Activations::Active) || + (iter.second.get()->activation() == +diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp +index 145237e..0c6c3d8 100644 +--- a/pfr_image_manager.cpp ++++ b/pfr_image_manager.cpp +@@ -308,7 +308,7 @@ int Manager::processImage(const std::string& imgFilePath) + std::string objPath = std::string{SOFTWARE_OBJPATH} + '/' + id; + + auto versionPtr = std::make_unique<Version>( +- bus, objPath, ver, purpose, imageDirPath.string(), ++ bus, objPath, id, ver, purpose, imageDirPath.string(), + std::bind(&Manager::erase, this, std::placeholders::_1)); + versionPtr->deleteObject = + std::make_unique<phosphor::software::manager::Delete>(bus, objPath, +diff --git a/version.cpp b/version.cpp +index 18f3f4f..e6fd481 100644 +--- a/version.cpp ++++ b/version.cpp +@@ -182,7 +182,7 @@ void Delete::delete_() + { + if (parent.eraseCallback) + { +- parent.eraseCallback(parent.getId(parent.version())); ++ parent.eraseCallback(parent.getExtId()); + } + } + +diff --git a/version.hpp b/version.hpp +index 9cf76da..ae70ea8 100644 +--- a/version.hpp ++++ b/version.hpp +@@ -74,14 +74,15 @@ class Version : public VersionInherit + * @param[in] callback - The eraseFunc callback + */ + Version(sdbusplus::bus::bus& bus, const std::string& objPath, +- const std::string& versionString, VersionPurpose versionPurpose, +- const std::string& filePath, eraseFunc callback) : ++ const std::string& extId, const std::string& versionString, ++ VersionPurpose versionPurpose, const std::string& filePath, ++ eraseFunc callback) : + VersionInherit(bus, (objPath).c_str(), true), +- eraseCallback(callback), versionStr(versionString) ++ eraseCallback(callback), extId(extId), versionStr(versionString) + { + // Set properties. + purpose(versionPurpose); +- version(versionString); ++ version(extId); + path(filePath); + // Emit deferred signal. + emit_object_added(); +@@ -134,6 +135,15 @@ class Version : public VersionInherit + */ + bool isFunctional(); + ++ /* @brief Return the extended ID of this version object ++ * ++ * @ return - returns the extended ID string ++ */ ++ std::string getExtId() ++ { ++ return extId; ++ } ++ + /** @brief Persistent Delete D-Bus object */ + std::unique_ptr<Delete> deleteObject; + +@@ -143,6 +153,7 @@ class Version : public VersionInherit + private: + /** @brief This Version's version string */ + const std::string versionStr; ++ const std::string extId; + }; + + } // namespace manager +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0016-Process-PLDM-image-type.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0016-Process-PLDM-image-type.patch new file mode 100644 index 000000000..c353a09b2 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0016-Process-PLDM-image-type.patch @@ -0,0 +1,224 @@ +From aaebe1c3db71b7addbd3f1d1b2b5f83d7cba14e3 Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti <smriti.ayushi@intel.com> +Date: Mon, 9 Nov 2020 23:04:58 +0530 +Subject: [PATCH] Process PLDM image type + +This change is to check whether the image uploaded is of PLDM image +type based on the PackageHeaderIdentifier check which is a 16 bytes +uuid field in the pldm package header. + +Also, determine image purpose and version. +Purpose is set to pldm enum type and for version, PackageVersionString +is concluded based on PackageVersionStringLength value. + +Tested: +- On uploading a pldm image through Redfish. Uuid is identified and +matched correctly. +- Purpose and version is given to the image as expected and activation +intf got added. + - verified same with busctl cmd on xyz.openbmc_project.Software.Version + and xyz.openbmc_project.Software.BMC.Updater +- Verified the regular PFR update procedure works + - received expected redfish response from postman + - verified fwupd.sh script is reached + +Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> +--- + item_updater.cpp | 1 + + pfr_image_manager.cpp | 95 +++++++++++++++++++++++++++++++++++++++++-- + pfr_image_manager.hpp | 6 +-- + pldm.hpp | 21 ++++++++++ + 4 files changed, 117 insertions(+), 6 deletions(-) + create mode 100644 pldm.hpp + +diff --git a/item_updater.cpp b/item_updater.cpp +index db255d6..2ed2a3c 100644 +--- a/item_updater.cpp ++++ b/item_updater.cpp +@@ -67,6 +67,7 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) + #if defined(HOST_BIOS_UPGRADE) || defined(PFR_UPDATE) + value == VersionPurpose::Host || + #endif ++ value == VersionPurpose::PLDM || + value == VersionPurpose::Other) + { + purpose = value; +diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp +index 178367f..c923494 100644 +--- a/pfr_image_manager.cpp ++++ b/pfr_image_manager.cpp +@@ -3,6 +3,7 @@ + #include "pfr_image_manager.hpp" + + #include "dbus_helpers.hpp" ++#include "pldm.hpp" + #include "version.hpp" + #include "watch.hpp" + +@@ -44,9 +45,10 @@ using BusyFail = Software::Image::BusyFailure; + static constexpr const uint32_t pfmPos = 2054; + static constexpr const uint32_t block0Magic = 0xB6EAFD19; + static constexpr const uint32_t lengthBlk0Blk1 = 1024; ++static constexpr const uint32_t pldmMagic = 0xF018878C; + +-int Manager::verifyPFRImage(const std::filesystem::path imgPath, +- std::string& version, std::string& purposeString) ++int Manager::verifyImage(const std::filesystem::path imgPath, ++ std::string& version, std::string& purposeString) + { + uint8_t imgType = 0; + uint32_t imgMagic = 0; +@@ -76,6 +78,93 @@ int Manager::verifyPFRImage(const std::filesystem::path imgPath, + + imgMagic = block0Data.tag; + ++ if (htobe32(imgMagic) == pldmMagic) ++ { ++ if (!version.empty()) ++ { ++ version.clear(); ++ } ++ ++ imgFile.seekg(0, std::ios_base::end); ++ ++ const size_t length = imgFile.tellg(); ++ constexpr size_t readBytes = 36; ++ ++ if (length < readBytes) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Insufficient file length to read the required " ++ "bytes"); ++ return -1; ++ } ++ ++ imgFile.seekg(0, std::ios::beg); ++ ++ std::array<char, readBytes> buffer = {}; ++ ++ imgFile.read( ++ buffer.data(), ++ buffer.size()); // read 36 bytes of PLDM Package Header ++ ++ if (!imgFile.good()) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Image file read is not successful"); ++ return -1; ++ } ++ ++ if (!std::equal(buffer.begin(), ++ buffer.begin() + pldm::headerIdLen, ++ pldm::pldmPkgHeaderId ++ .begin())) // comparing 16 bytes of ++ // PackageHeaderIdentifier field ++ { ++ std::string redfishMsgID = ++ "OpenBMC.0.1.FirmwareUpdateFailed"; ++ sd_journal_send( ++ "MESSAGE=%s", "Firmware image verification failed", ++ "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s", ++ redfishMsgID.c_str(), "REDFISH_MESSAGE_ARGS=%s", ++ "PLDM Image package header identifier check fail", ++ NULL); ++ ++ return -1; ++ } ++ ++ phosphor::logging::log<phosphor::logging::level::INFO>( ++ "Package header identifier matched"); ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.PLDM"; ++ ++ const uint8_t pkgVerStrLen = static_cast<uint8_t>( ++ buffer[35]); // PackageVersionStringLen byte ++ ++ imgFile.seekg(readBytes, ++ std::ios::beg); // point to the begin of ++ // PackageVersionString field ++ // i.e. 36th pos ++ ++ std::array<char, 255> ver = {}; ++ imgFile.read(ver.data(), ++ pkgVerStrLen); // read PackageVersionString bytes ++ ++ if (!imgFile.good()) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Image file read is not successful"); ++ return -1; ++ } ++ ++ version.assign(ver.data(), pkgVerStrLen); ++ phosphor::logging::log<phosphor::logging::level::INFO>( ++ "Package version string value", ++ phosphor::logging::entry("IMAGE_VERSION=%s", ++ version.c_str())); ++ ++ imgFile.close(); ++ return 0; ++ } ++ + if (imgMagic != block0Magic) + { + phosphor::logging::log<phosphor::logging::level::ERR>( +@@ -226,7 +315,7 @@ int Manager::processImage(const std::string& imgFilePath) + std::string ver; + std::string purposeString; + +- if (0 != verifyPFRImage(imgFilePath, ver, purposeString)) ++ if (0 != verifyImage(imgFilePath, ver, purposeString)) + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "Error verifying uploaded image"); +diff --git a/pfr_image_manager.hpp b/pfr_image_manager.hpp +index 3591f1a..2facfe6 100644 +--- a/pfr_image_manager.hpp ++++ b/pfr_image_manager.hpp +@@ -156,13 +156,13 @@ class Manager + CustomMap mapFile(const std::filesystem::path& path, size_t size); + + /** +- * @brief Verify the PFR image and return version and purpose ++ * @brief Verify the uploaded image type and return version and purpose + * @param[in] - file path + * @param[out] - version + * @param[out] - purpose + */ +- int verifyPFRImage(const std::filesystem::path imgPath, +- std::string& version, std::string& purposeString); ++ int verifyImage(const std::filesystem::path imgPath, std::string& version, ++ std::string& purposeString); + /** @brief Persistent map of Version dbus objects and their + * version id */ + std::map<std::string, std::unique_ptr<Version>> versions; +diff --git a/pldm.hpp b/pldm.hpp +new file mode 100644 +index 0000000..edbd6ae +--- /dev/null ++++ b/pldm.hpp +@@ -0,0 +1,21 @@ ++namespace pldm ++{ ++ ++struct PldmPkgHeader ++{ ++ uint8_t uuid[16]; // PackageHeaderIdentifier ++ uint8_t formatRev; // PackageHeaderFormatRevision ++ uint16_t headerSize; // PackageHeaderSize ++ uint8_t timestamp[13]; // PackageReleaseDateTime ++ uint16_t bitmapLen; // ComponentBitmapBitLength ++ uint8_t verStringType; // PackageVersionStringType ++ uint8_t verStringLen; // PackageVersionStringLength ++} __attribute__((packed)); ++ ++constexpr size_t headerIdLen = 16; ++ ++const std::array<char, headerIdLen> pldmPkgHeaderId = { ++ 0xF0, 0x18, 0x87, 0x8C, 0xCB, 0x7D, 0x49, 0x43, ++ 0x98, 0x00, 0xA0, 0x2F, 0x05, 0x9A, 0xCA, 0x02}; // 16 bytes package header ++ // identifier uuid ++} // namespace pldm +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend index 623c4f77e..e1c72d161 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend @@ -1,12 +1,11 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -EXTRA_OECONF += "--enable-fwupd_script" +EXTRA_OEMESON += "-Dfwupd-script=enabled" SYSTEMD_SERVICE_${PN}-updater += "fwupd@.service" -EXTRA_OECONF += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '--enable-pfr_update', '', d)}" +EXTRA_OEMESON += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-Dpfr-update=enabled', '', d)}" -SRC_URI += "file://0001-Add-more-error-types.patch \ - file://0002-Redfish-firmware-activation.patch \ +SRC_URI += "file://0002-Redfish-firmware-activation.patch \ file://0004-Changed-the-condition-of-software-version-service-wa.patch \ file://0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch \ file://0006-Modify-the-ID-of-software-image-updater-object-on-DB.patch \ @@ -20,6 +19,8 @@ SRC_URI += "file://0001-Add-more-error-types.patch \ SRC_URI_PFR = "file://0007-PFR-images-support.patch \ file://0008-PFR-image-HASH-verification.patch \ file://0010-Add-error-reporting-to-pfr_image_manager.patch \ + file://0014-PFR-image-verification.patch \ + file://0016-Process-PLDM-image-type.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', SRC_URI_PFR, '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-support-for-StandBySpare.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch index 3895424ac..022ffdc76 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-support-for-StandBySpare.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch @@ -1,13 +1,23 @@ -From 98c57392535227f1906fdc2d6f65980267b5d97c Mon Sep 17 00:00:00 2001 +From 98a84ed284fe71e276d425dbe67a447b6fca1eff Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy <vikram.bodireddy@intel.com> -Date: Tue, 30 Jun 2020 21:47:55 +0530 -Subject: [PATCH] Firmware update support for StandBySpare +Date: Wed, 18 Nov 2020 17:14:41 +0530 +Subject: [PATCH 01/10] Firmware update configuration changes -Firmware update support for StandBySpare. This will -have support for adding 'HttpPushUriTargets' and +This commit will provide user to PATCH the below firmware update +attributes before uploding the firmware image. + +1. This will have PATCH support for 'HttpPushUriTargets' and 'HttpPushUriTargetsBusy' attributes. These attributes enables 'HttpPushUri' to distinguish between the firmware update targets. +2. ApplyOptions are used to specify firmware update specific options +such as ClearConfig which is used while activating the updated +firmware. This setting is maintained in a local static variable +when set using PATCH method. Its used in activate image as input +parameter. This attribute is added as Oem as the default +UpdateService interface doesn't specify any relevant or appropriate +attribute for this. + Tested: - GET on "/redfish/v1/UpdateService", got below response ......... @@ -24,15 +34,24 @@ Tested: - Did Firmware update and verified end to end functionality for both bmc active and backup images. + - Tested setting ClearConfig to true or false using PATCH + method. + - Successfully ran redfish validater with no new errors. Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> + +%% original patch: 0001-Firmware-update-configuration-changes.patch --- - redfish-core/lib/update_service.hpp | 276 ++++++++++++++++++++++++---- - 1 file changed, 243 insertions(+), 33 deletions(-) + redfish-core/lib/update_service.hpp | 337 +++++++++++++++++++-- + .../v1/JsonSchemas/OemUpdateService/index.json | 69 +++++ + static/redfish/v1/schema/OemUpdateService_v1.xml | 40 +++ + 3 files changed, 416 insertions(+), 30 deletions(-) + create mode 100644 static/redfish/v1/JsonSchemas/OemUpdateService/index.json + create mode 100644 static/redfish/v1/schema/OemUpdateService_v1.xml diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp -index 8dae2fb..86ddd8a 100644 +index ddb8b30..399321b 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -32,6 +32,17 @@ static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateErrorMatcher; @@ -178,12 +197,12 @@ index 8dae2fb..86ddd8a 100644 // Note that asyncResp can be either a valid pointer or nullptr. If nullptr // then no asyncResp updates will occur - static void softwareInterfaceAdded(std::shared_ptr<AsyncResp> asyncResp, + static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, + const std::vector<std::string> imgUriTargets, sdbusplus::message::message& m, const crow::Request& req) { -@@ -73,25 +176,27 @@ static void softwareInterfaceAdded(std::shared_ptr<AsyncResp> asyncResp, +@@ -73,22 +176,24 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, m.read(objPath, interfacesProperties); @@ -196,9 +215,6 @@ index 8dae2fb..86ddd8a 100644 - if (interface.first == "xyz.openbmc_project.Software.Activation") + if (interface.first == activationIntf) { - // Found our interface, disable callbacks - fwUpdateMatcher = nullptr; - // Retrieve service and activate crow::connections::systemBus->async_method_call( - [objPath, asyncResp, @@ -215,7 +231,7 @@ index 8dae2fb..86ddd8a 100644 BMCWEB_LOG_DEBUG << "error msg = " << error_code.message(); if (asyncResp) -@@ -118,7 +223,7 @@ static void softwareInterfaceAdded(std::shared_ptr<AsyncResp> asyncResp, +@@ -115,7 +220,7 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, // is added fwAvailableTimer = nullptr; @@ -224,7 +240,7 @@ index 8dae2fb..86ddd8a 100644 if (asyncResp) { std::shared_ptr<task::TaskData> task = -@@ -248,18 +353,17 @@ static void softwareInterfaceAdded(std::shared_ptr<AsyncResp> asyncResp, +@@ -245,8 +350,7 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str, @@ -234,21 +250,17 @@ index 8dae2fb..86ddd8a 100644 } } } - - // Note that asyncResp can be either a valid pointer or nullptr. If nullptr +@@ -255,7 +359,8 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, // then no asyncResp updates will occur --static void monitorForSoftwareAvailable(std::shared_ptr<AsyncResp> asyncResp, -- const crow::Request& req, -- const std::string& url, -- int timeoutTimeSeconds = 5) -+static void monitorForSoftwareAvailable( -+ std::shared_ptr<AsyncResp> asyncResp, const crow::Request& req, + static void monitorForSoftwareAvailable( + const std::shared_ptr<AsyncResp>& asyncResp, const crow::Request& req, +- const std::string& url, int timeoutTimeSeconds = 10) + const std::string& url, const std::vector<std::string>& imgUriTargets, -+ int timeoutTimeSeconds = 5) ++ int timeoutTimeSeconds = 10) { // Only allow one FW update at a time if (fwUpdateInProgress != false) -@@ -299,9 +403,10 @@ static void monitorForSoftwareAvailable(std::shared_ptr<AsyncResp> asyncResp, +@@ -295,9 +400,10 @@ static void monitorForSoftwareAvailable( } }); @@ -261,7 +273,7 @@ index 8dae2fb..86ddd8a 100644 }; fwUpdateInProgress = true; -@@ -467,12 +572,15 @@ class UpdateServiceActionsSimpleUpdate : public Node +@@ -463,12 +569,15 @@ class UpdateServiceActionsSimpleUpdate : public Node std::string fwFile = imageURI.substr(separator + 1); BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile; @@ -269,36 +281,35 @@ index 8dae2fb..86ddd8a 100644 + std::vector<std::string> httpUriTargets; + // Setup callback for when new software detected - // Give TFTP 2 minutes to complete + // Give TFTP 10 minutes to complete monitorForSoftwareAvailable( nullptr, req, "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate", -- 120); -+ httpUriTargets, 120); +- 600); ++ httpUriTargets, 600); - // TFTP can take up to 2 minutes depending on image size and + // TFTP can take up to 10 minutes depending on image size and // connection speed. Return to caller as soon as the TFTP operation -@@ -506,7 +614,8 @@ class UpdateServiceActionsSimpleUpdate : public Node +@@ -502,7 +611,8 @@ class UpdateServiceActionsSimpleUpdate : public Node class UpdateService : public Node { public: -- UpdateService(CrowApp& app) : Node(app, "/redfish/v1/UpdateService/") -+ UpdateService(CrowApp& app) : +- UpdateService(App& app) : Node(app, "/redfish/v1/UpdateService/") ++ UpdateService(App& app) : + Node(app, "/redfish/v1/UpdateService/"), httpPushUriTargetBusy(false) { entityPrivileges = { {boost::beast::http::verb::get, {{"Login"}}}, -@@ -518,6 +627,9 @@ class UpdateService : public Node +@@ -514,6 +624,8 @@ class UpdateService : public Node } private: + std::vector<std::string> httpPushUriTargets; + bool httpPushUriTargetBusy; -+ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { -@@ -528,6 +640,8 @@ class UpdateService : public Node +@@ -524,6 +636,8 @@ class UpdateService : public Node res.jsonValue["Description"] = "Service for Software Update"; res.jsonValue["Name"] = "Update Service"; res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; @@ -307,7 +318,37 @@ index 8dae2fb..86ddd8a 100644 // UpdateService cannot be disabled res.jsonValue["ServiceEnabled"] = true; res.jsonValue["FirmwareInventory"] = { -@@ -587,9 +701,14 @@ class UpdateService : public Node +@@ -573,6 +687,29 @@ class UpdateService : public Node + "/xyz/openbmc_project/software/apply_time", + "org.freedesktop.DBus.Properties", "Get", + "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime"); ++ ++ // Get the ApplyOptions value ++ crow::connections::systemBus->async_method_call( ++ [aResp](const boost::system::error_code ec, ++ const std::variant<bool> applyOption) { ++ if (ec) ++ { ++ BMCWEB_LOG_DEBUG << "DBUS response error " << ec; ++ messages::internalError(aResp->res); ++ return; ++ } ++ ++ const bool* b = std::get_if<bool>(&applyOption); ++ ++ if (b) ++ { ++ aResp->res.jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = ++ *b; ++ } ++ }, ++ "xyz.openbmc_project.Software.BMC.Updater", ++ "/xyz/openbmc_project/software", "org.freedesktop.DBus.Properties", ++ "Get", "xyz.openbmc_project.Software.ApplyOptions", "ClearConfig"); + } + + void doPatch(crow::Response& res, const crow::Request& req, +@@ -583,12 +720,61 @@ class UpdateService : public Node std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); std::optional<nlohmann::json> pushUriOptions; @@ -315,16 +356,63 @@ index 8dae2fb..86ddd8a 100644 - pushUriOptions)) + std::optional<std::vector<std::string>> imgTargets; + std::optional<bool> imgTargetBusy; ++ std::optional<nlohmann::json> oemProps; + + if (!json_util::readJson(req, res, "HttpPushUriOptions", pushUriOptions, + "HttpPushUriTargets", imgTargets, -+ "HttpPushUriTargetsBusy", imgTargetBusy)) ++ "HttpPushUriTargetsBusy", imgTargetBusy, "Oem", ++ oemProps)) { + BMCWEB_LOG_DEBUG << "UpdateService doPatch: Invalid request body"; return; } -@@ -657,6 +776,98 @@ class UpdateService : public Node ++ if (oemProps) ++ { ++ std::optional<nlohmann::json> applyOptions; ++ ++ if (!json_util::readJson(*oemProps, res, "ApplyOptions", ++ applyOptions)) ++ { ++ return; ++ } ++ ++ if (applyOptions) ++ { ++ std::optional<bool> clearConfig; ++ if (!json_util::readJson(*applyOptions, res, "ClearConfig", ++ clearConfig)) ++ { ++ return; ++ } ++ ++ if (clearConfig) ++ { ++ // Set the requested image apply time value ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "D-Bus responses error: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ messages::success(asyncResp->res); ++ }, ++ "xyz.openbmc_project.Software.BMC.Updater", ++ "/xyz/openbmc_project/software", ++ "org.freedesktop.DBus.Properties", "Set", ++ "xyz.openbmc_project.Software.ApplyOptions", ++ "ClearConfig", std::variant<bool>{*clearConfig}); ++ } ++ } ++ } ++ + if (pushUriOptions) + { + std::optional<nlohmann::json> pushUriApplyTime; +@@ -653,6 +839,98 @@ class UpdateService : public Node } } } @@ -423,7 +511,7 @@ index 8dae2fb..86ddd8a 100644 } void doPost(crow::Response& res, const crow::Request& req, -@@ -667,8 +878,8 @@ class UpdateService : public Node +@@ -663,8 +941,8 @@ class UpdateService : public Node std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); // Setup callback for when new software detected @@ -434,7 +522,7 @@ index 8dae2fb..86ddd8a 100644 std::string filepath( "/tmp/images/" + -@@ -754,7 +965,7 @@ class SoftwareInventoryCollection : public Node +@@ -749,7 +1027,7 @@ class SoftwareInventoryCollection : public Node "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/xyz/openbmc_project/software", static_cast<int32_t>(0), @@ -443,7 +531,7 @@ index 8dae2fb..86ddd8a 100644 } }; -@@ -937,7 +1148,7 @@ class SoftwareInventory : public Node +@@ -931,7 +1209,7 @@ class SoftwareInventory : public Node }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", @@ -452,7 +540,7 @@ index 8dae2fb..86ddd8a 100644 } if (!found) { -@@ -958,8 +1169,7 @@ class SoftwareInventory : public Node +@@ -952,8 +1230,7 @@ class SoftwareInventory : public Node "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", @@ -462,6 +550,127 @@ index 8dae2fb..86ddd8a 100644 } }; +diff --git a/static/redfish/v1/JsonSchemas/OemUpdateService/index.json b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json +new file mode 100644 +index 0000000..74e39cd +--- /dev/null ++++ b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json +@@ -0,0 +1,69 @@ ++{ ++ "$id": "http://redfish.dmtf.org/schemas/v1/OemUpdateService.json", ++ "$schema": "http://redfish.dmtf.org/schemas/v1/redfish-schema-v1.json", ++ "copyright": "Copyright 2014-2019 DMTF. For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright", ++ "definitions": { ++ "ApplyOptions": { ++ "additionalProperties": false, ++ "description": "An indication by boolean value whether to update firmware configuration along with firmware image update.", ++ "patternProperties": { ++ "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message)\\.[a-zA-Z_][a-zA-Z0-9_]*$": { ++ "description": "This property shall specify a valid odata or Redfish property.", ++ "type": [ ++ "array", ++ "boolean", ++ "integer", ++ "number", ++ "null", ++ "object", ++ "string" ++ ] ++ } ++ }, ++ "properties": { ++ "ClearConfig": { ++ "description": "This indicates whether to update firmware configuration or not.", ++ "longDescription": "The value of this property is used to indicate the firmware configuration update.", ++ "readonly": false, ++ "type": [ ++ "boolean", ++ "null" ++ ] ++ } ++ }, ++ "type": "object" ++ }, ++ "Oem": { ++ "additionalProperties": true, ++ "description": "OemUpdateService Oem properties.", ++ "patternProperties": { ++ "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message)\\.[a-zA-Z_][a-zA-Z0-9_]*$": { ++ "description": "This property shall specify a valid odata or Redfish property.", ++ "type": [ ++ "array", ++ "boolean", ++ "integer", ++ "number", ++ "null", ++ "object", ++ "string" ++ ] ++ } ++ }, ++ "properties": { ++ "ApplyOptions": { ++ "anyOf": [ ++ { ++ "$ref": "#/definitions/ApplyOptions" ++ }, ++ { ++ "type": "null" ++ } ++ ] ++ } ++ }, ++ "type": "object" ++ } ++ }, ++ "title": "#OemUpdateService" ++} +diff --git a/static/redfish/v1/schema/OemUpdateService_v1.xml b/static/redfish/v1/schema/OemUpdateService_v1.xml +new file mode 100644 +index 0000000..cbb7aa4 +--- /dev/null ++++ b/static/redfish/v1/schema/OemUpdateService_v1.xml +@@ -0,0 +1,40 @@ ++<?xml version="1.0" encoding="UTF-8"?> ++<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"> ++ <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/csd01/complete/vocabularies/Org.OData.Core.V1.xml"> ++ <edmx:Include Namespace="Org.OData.Core.V1" Alias="OData" /> ++ </edmx:Reference> ++ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/RedfishExtensions_v1.xml"> ++ <edmx:Include Namespace="Validation.v1_0_0" Alias="Validation"/> ++ <edmx:Include Namespace="RedfishExtensions.v1_0_0" Alias="Redfish"/> ++ </edmx:Reference> ++ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/UpdateService_v1.xml"> ++ <edmx:Include Namespace="UpdateService"/> ++ <edmx:Include Namespace="UpdateService.v1_4_0"/> ++ </edmx:Reference> ++ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Resource_v1.xml"> ++ <edmx:Include Namespace="Resource"/> ++ <edmx:Include Namespace="Resource.v1_0_0"/> ++ </edmx:Reference> ++ ++ <edmx:DataServices> ++ <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="OemUpdateService"> ++ <ComplexType Name="Oem" BaseType="Resource.OemObject"> ++ <Annotation Term="OData.AdditionalProperties" Bool="true" /> ++ <Annotation Term="OData.Description" String="OemUpdateService Oem properties." /> ++ <Annotation Term="OData.AutoExpand"/> ++ <Property Name="ApplyOptions" Type="OemUpdateService.ApplyOptions"/> ++ </ComplexType> ++ ++ <ComplexType Name="ApplyOptions" BaseType="Resource.OemObject"> ++ <Annotation Term="OData.AdditionalProperties" Bool="false" /> ++ <Annotation Term="OData.Description" String="An indication by boolean value whether to update firmware configuration along with firmware image update." /> ++ <Property Name="ClearConfig" Type="Edm.Boolean"> ++ <Annotation Term="OData.Permissions" EnumMember="OData.Permission/ReadWrite"/> ++ <Annotation Term="OData.Description" String="This indicates whether to update firmware configuration or not."/> ++ <Annotation Term="OData.LongDescription" String="The value of this property is used to indicate the firmware configuration update."/> ++ </Property> ++ </ComplexType> ++ ++ </Schema> ++ </edmx:DataServices> ++</edmx:Edmx> -- -2.17.1 +2.16.6 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Use-chip-id-based-UUID-for-Service-Root.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Use-chip-id-based-UUID-for-Service-Root.patch index e963b1423..31f9abcd5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Use-chip-id-based-UUID-for-Service-Root.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Use-chip-id-based-UUID-for-Service-Root.patch @@ -1,7 +1,7 @@ -From b68d62ddf0a9d77a287a7e9a99762915e31d02b9 Mon Sep 17 00:00:00 2001 +From c61ac0a5cf825193f46c734f1db2f92a72d1f3c9 Mon Sep 17 00:00:00 2001 From: Wiktor Golgowski <wiktor.golgowski@linux.intel.com> Date: Thu, 30 Apr 2020 11:09:35 +0200 -Subject: [PATCH] Use chip id-based UUID for Service Root. +Subject: [PATCH 02/10] Use chip id-based UUID for Service Root. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -15,16 +15,15 @@ If the sysfs node is not available, code falls back to randomly generated UUID. Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@linux.intel.com> - --- - include/persistent_data_middleware.hpp | 32 +++++++++++++++++++++++++++++--- + include/persistent_data.hpp | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) -diff --git a/include/persistent_data_middleware.hpp b/include/persistent_data_middleware.hpp -index de3a6ba..a20b213 100644 ---- a/include/persistent_data_middleware.hpp -+++ b/include/persistent_data_middleware.hpp -@@ -31,6 +31,10 @@ class Middleware +diff --git a/include/persistent_data.hpp b/include/persistent_data.hpp +index 24f7afd..8826b06 100644 +--- a/include/persistent_data.hpp ++++ b/include/persistent_data.hpp +@@ -25,6 +25,10 @@ class ConfigFile public: // todo(ed) should read this from a fixed location somewhere, not CWD static constexpr const char* filename = "bmcweb_persistent_data.json"; @@ -33,9 +32,9 @@ index de3a6ba..a20b213 100644 + static constexpr const char* UuidNs = "{b7b0553a-54cc-4162-982d-" + "944847ed76f5}"; - struct Context - {}; -@@ -141,9 +145,31 @@ class Middleware + ConfigFile() + { +@@ -144,9 +148,31 @@ class ConfigFile if (systemUuid.empty()) { @@ -70,3 +69,6 @@ index de3a6ba..a20b213 100644 } if (fileRevision < jsonRevision) { +-- +2.16.6 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-bmcweb-changes-for-setting-ApplyOptions-ClearCfg.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-bmcweb-changes-for-setting-ApplyOptions-ClearCfg.patch deleted file mode 100644 index 704031fe1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-bmcweb-changes-for-setting-ApplyOptions-ClearCfg.patch +++ /dev/null @@ -1,245 +0,0 @@ -From e883ea9d43a84998641428448d7220c0f5be72c0 Mon Sep 17 00:00:00 2001 -From: Vikram Bodireddy <vikram.bodireddy@intel.com> -Date: Tue, 30 Jun 2020 22:09:10 +0530 -Subject: [PATCH] bmcweb changes for setting ApplyOptions-ClearCfg - -ApplyOptions are used to specify firmware update specific options -such as ClearConfig which is used while activating the updated -firmware. This setting is maintained in a local static variable -when set using PATCH method. Its used in activate image as input -parameter. This attribute is added as Oem as the default -UpdateService interface doesn't specify any relevant or appropriate -attribute for this. - -Tested: Tested setting ClearConfig to true or false using PATCH - method. - Ran Redfish-Service-Validator and no new issues found. - -Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> ---- - redfish-core/lib/update_service.hpp | 69 ++++++++++++++++++- - .../JsonSchemas/OemUpdateService/index.json | 69 +++++++++++++++++++ - .../redfish/v1/schema/OemUpdateService_v1.xml | 40 +++++++++++ - 3 files changed, 177 insertions(+), 1 deletion(-) - create mode 100644 static/redfish/v1/JsonSchemas/OemUpdateService/index.json - create mode 100644 static/redfish/v1/schema/OemUpdateService_v1.xml - -diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp -index 86ddd8a..291acec 100644 ---- a/redfish-core/lib/update_service.hpp -+++ b/redfish-core/lib/update_service.hpp -@@ -691,6 +691,29 @@ class UpdateService : public Node - "/xyz/openbmc_project/software/apply_time", - "org.freedesktop.DBus.Properties", "Get", - "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime"); -+ -+ // Get the ApplyOptions value -+ crow::connections::systemBus->async_method_call( -+ [aResp](const boost::system::error_code ec, -+ const std::variant<bool> applyOption) { -+ if (ec) -+ { -+ BMCWEB_LOG_DEBUG << "DBUS response error " << ec; -+ messages::internalError(aResp->res); -+ return; -+ } -+ -+ const bool* b = std::get_if<bool>(&applyOption); -+ -+ if (b) -+ { -+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = -+ *b; -+ } -+ }, -+ "xyz.openbmc_project.Software.BMC.Updater", -+ "/xyz/openbmc_project/software", "org.freedesktop.DBus.Properties", -+ "Get", "xyz.openbmc_project.Software.ApplyOptions", "ClearConfig"); - } - - void doPatch(crow::Response& res, const crow::Request& req, -@@ -703,15 +726,59 @@ class UpdateService : public Node - std::optional<nlohmann::json> pushUriOptions; - std::optional<std::vector<std::string>> imgTargets; - std::optional<bool> imgTargetBusy; -+ std::optional<nlohmann::json> oemProps; - - if (!json_util::readJson(req, res, "HttpPushUriOptions", pushUriOptions, - "HttpPushUriTargets", imgTargets, -- "HttpPushUriTargetsBusy", imgTargetBusy)) -+ "HttpPushUriTargetsBusy", imgTargetBusy, "Oem", -+ oemProps)) - { - BMCWEB_LOG_DEBUG << "UpdateService doPatch: Invalid request body"; - return; - } - -+ if (oemProps) -+ { -+ std::optional<nlohmann::json> applyOptions; -+ -+ if (!json_util::readJson(*oemProps, res, "ApplyOptions", -+ applyOptions)) -+ { -+ return; -+ } -+ -+ if (applyOptions) -+ { -+ std::optional<bool> clearConfig; -+ if (!json_util::readJson(*applyOptions, res, "ClearConfig", -+ clearConfig)) -+ { -+ return; -+ } -+ -+ if (clearConfig) -+ { -+ // Set the requested image apply time value -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "D-Bus responses error: " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ messages::success(asyncResp->res); -+ }, -+ "xyz.openbmc_project.Software.BMC.Updater", -+ "/xyz/openbmc_project/software", -+ "org.freedesktop.DBus.Properties", "Set", -+ "xyz.openbmc_project.Software.ApplyOptions", -+ "ClearConfig", std::variant<bool>{*clearConfig}); -+ } -+ } -+ } -+ - if (pushUriOptions) - { - std::optional<nlohmann::json> pushUriApplyTime; -diff --git a/static/redfish/v1/JsonSchemas/OemUpdateService/index.json b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json -new file mode 100644 -index 0000000..74e39cd ---- /dev/null -+++ b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json -@@ -0,0 +1,69 @@ -+{ -+ "$id": "http://redfish.dmtf.org/schemas/v1/OemUpdateService.json", -+ "$schema": "http://redfish.dmtf.org/schemas/v1/redfish-schema-v1.json", -+ "copyright": "Copyright 2014-2019 DMTF. For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright", -+ "definitions": { -+ "ApplyOptions": { -+ "additionalProperties": false, -+ "description": "An indication by boolean value whether to update firmware configuration along with firmware image update.", -+ "patternProperties": { -+ "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message)\\.[a-zA-Z_][a-zA-Z0-9_]*$": { -+ "description": "This property shall specify a valid odata or Redfish property.", -+ "type": [ -+ "array", -+ "boolean", -+ "integer", -+ "number", -+ "null", -+ "object", -+ "string" -+ ] -+ } -+ }, -+ "properties": { -+ "ClearConfig": { -+ "description": "This indicates whether to update firmware configuration or not.", -+ "longDescription": "The value of this property is used to indicate the firmware configuration update.", -+ "readonly": false, -+ "type": [ -+ "boolean", -+ "null" -+ ] -+ } -+ }, -+ "type": "object" -+ }, -+ "Oem": { -+ "additionalProperties": true, -+ "description": "OemUpdateService Oem properties.", -+ "patternProperties": { -+ "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message)\\.[a-zA-Z_][a-zA-Z0-9_]*$": { -+ "description": "This property shall specify a valid odata or Redfish property.", -+ "type": [ -+ "array", -+ "boolean", -+ "integer", -+ "number", -+ "null", -+ "object", -+ "string" -+ ] -+ } -+ }, -+ "properties": { -+ "ApplyOptions": { -+ "anyOf": [ -+ { -+ "$ref": "#/definitions/ApplyOptions" -+ }, -+ { -+ "type": "null" -+ } -+ ] -+ } -+ }, -+ "type": "object" -+ } -+ }, -+ "title": "#OemUpdateService" -+} -diff --git a/static/redfish/v1/schema/OemUpdateService_v1.xml b/static/redfish/v1/schema/OemUpdateService_v1.xml -new file mode 100644 -index 0000000..cbb7aa4 ---- /dev/null -+++ b/static/redfish/v1/schema/OemUpdateService_v1.xml -@@ -0,0 +1,40 @@ -+<?xml version="1.0" encoding="UTF-8"?> -+<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"> -+ <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/csd01/complete/vocabularies/Org.OData.Core.V1.xml"> -+ <edmx:Include Namespace="Org.OData.Core.V1" Alias="OData" /> -+ </edmx:Reference> -+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/RedfishExtensions_v1.xml"> -+ <edmx:Include Namespace="Validation.v1_0_0" Alias="Validation"/> -+ <edmx:Include Namespace="RedfishExtensions.v1_0_0" Alias="Redfish"/> -+ </edmx:Reference> -+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/UpdateService_v1.xml"> -+ <edmx:Include Namespace="UpdateService"/> -+ <edmx:Include Namespace="UpdateService.v1_4_0"/> -+ </edmx:Reference> -+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Resource_v1.xml"> -+ <edmx:Include Namespace="Resource"/> -+ <edmx:Include Namespace="Resource.v1_0_0"/> -+ </edmx:Reference> -+ -+ <edmx:DataServices> -+ <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="OemUpdateService"> -+ <ComplexType Name="Oem" BaseType="Resource.OemObject"> -+ <Annotation Term="OData.AdditionalProperties" Bool="true" /> -+ <Annotation Term="OData.Description" String="OemUpdateService Oem properties." /> -+ <Annotation Term="OData.AutoExpand"/> -+ <Property Name="ApplyOptions" Type="OemUpdateService.ApplyOptions"/> -+ </ComplexType> -+ -+ <ComplexType Name="ApplyOptions" BaseType="Resource.OemObject"> -+ <Annotation Term="OData.AdditionalProperties" Bool="false" /> -+ <Annotation Term="OData.Description" String="An indication by boolean value whether to update firmware configuration along with firmware image update." /> -+ <Property Name="ClearConfig" Type="Edm.Boolean"> -+ <Annotation Term="OData.Permissions" EnumMember="OData.Permission/ReadWrite"/> -+ <Annotation Term="OData.Description" String="This indicates whether to update firmware configuration or not."/> -+ <Annotation Term="OData.LongDescription" String="The value of this property is used to indicate the firmware configuration update."/> -+ </Property> -+ </ComplexType> -+ -+ </Schema> -+ </edmx:DataServices> -+</edmx:Edmx> --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Remove-QueryString.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Remove-QueryString.patch deleted file mode 100644 index 238fb83c7..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Remove-QueryString.patch +++ /dev/null @@ -1,621 +0,0 @@ -From f8749b5898403ee04a623a5bc534bd939865e221 Mon Sep 17 00:00:00 2001 -From: James Feist <james.feist@linux.intel.com> -Date: Wed, 22 Jul 2020 09:08:38 -0700 -Subject: [PATCH 1/1] Remove QueryString - -QueryString is an error-prone library that was -leftover from crow. Replace it with boost::url, -a header only library based and written by the -one of the authors of boost beast. - -Tested: Verified logging paging still worked -as expected - -Change-Id: I47c225089aa7d0f7d2299142f91806294f879381 -Signed-off-by: James Feist <james.feist@linux.intel.com> ---- - CMakeLists.txt | 2 + - CMakeLists.txt.in | 10 + - http/http_connection.h | 21 +- - http/http_request.h | 5 +- - http/query_string.h | 421 ----------------------------- - redfish-core/lib/event_service.hpp | 7 +- - redfish-core/lib/log_services.hpp | 20 +- - 7 files changed, 45 insertions(+), 441 deletions(-) - delete mode 100644 http/query_string.h - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2886438..50483ad 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -280,6 +280,8 @@ add_definitions (-DBOOST_ALL_NO_LIB) - add_definitions (-DBOOST_NO_RTTI) - add_definitions (-DBOOST_NO_TYPEID) - add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING) -+add_definitions (-DBOOST_URL_STANDALONE) -+add_definitions (-DBOOST_URL_HEADER_ONLY) - - # sdbusplus - if (NOT ${YOCTO_DEPENDENCIES}) -diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in -index d14910f..5cd73f6 100644 ---- a/CMakeLists.txt.in -+++ b/CMakeLists.txt.in -@@ -53,3 +53,13 @@ externalproject_add ( - cp -r "${CMAKE_BINARY_DIR}/nlohmann-json-src/include/nlohmann" - "${CMAKE_BINARY_DIR}/prefix/include" - ) -+ -+externalproject_add ( -+ Boost-URL GIT_REPOSITORY "https://github.com/CPPAlliance/url.git" GIT_TAG -+ a56ae0df6d3078319755fbaa67822b4fa7fd352b SOURCE_DIR -+ "${CMAKE_BINARY_DIR}/boost-url-src" BINARY_DIR -+ "${CMAKE_BINARY_DIR}/boost-url-build" CONFIGURE_COMMAND "" BUILD_COMMAND -+ "" INSTALL_COMMAND mkdir -p "${CMAKE_BINARY_DIR}/prefix/include" && -+ cp -r "${CMAKE_BINARY_DIR}/boost-url-src/include/boost" -+ "${CMAKE_BINARY_DIR}/prefix/include" -+) -diff --git a/http/http_connection.h b/http/http_connection.h -index 35bf99c..8dba3d6 100644 ---- a/http/http_connection.h -+++ b/http/http_connection.h -@@ -728,13 +728,9 @@ class Connection : - return; - } - -- // Compute the url parameters for the request -- req->url = req->target(); -- std::size_t index = req->url.find("?"); -- if (index != std::string_view::npos) -- { -- req->url = req->url.substr(0, index); -- } -+ req->urlView = boost::urls::url_view(req->target()); -+ req->url = req->urlView.encoded_path(); -+ - crow::authorization::authenticate(*req, res, session); - - bool loggedIn = req && req->session; -@@ -743,7 +739,16 @@ class Connection : - startDeadline(loggedInAttempts); - BMCWEB_LOG_DEBUG << "Starting slow deadline"; - -- req->urlParams = QueryString(std::string(req->target())); -+ req->urlParams = req->urlView.params(); -+ -+#ifdef BMCWEB_ENABLE_DEBUG -+ std::string paramList = ""; -+ for (const auto param : req->urlParams) -+ { -+ paramList += param->key() + " " + param->value() + " "; -+ } -+ BMCWEB_LOG_DEBUG << "QueryParams: " << paramList; -+#endif - } - else - { -diff --git a/http/http_request.h b/http/http_request.h -index 0691465..95f88c7 100644 ---- a/http/http_request.h -+++ b/http/http_request.h -@@ -1,7 +1,6 @@ - #pragma once - - #include "common.h" --#include "query_string.h" - - #include "sessions.hpp" - -@@ -9,6 +8,7 @@ - #include <boost/beast/http.hpp> - #include <boost/beast/ssl/ssl_stream.hpp> - #include <boost/beast/websocket.hpp> -+#include <boost/url/url_view.hpp> - - namespace crow - { -@@ -24,7 +24,8 @@ struct Request - boost::beast::http::request<boost::beast::http::string_body>& req; - boost::beast::http::fields& fields; - std::string_view url{}; -- QueryString urlParams{}; -+ boost::urls::url_view urlView{}; -+ boost::urls::url_view::params_type urlParams{}; - bool isSecure{false}; - - const std::string& body; -diff --git a/http/query_string.h b/http/query_string.h -deleted file mode 100644 -index e980280..0000000 ---- a/http/query_string.h -+++ /dev/null -@@ -1,421 +0,0 @@ --#pragma once -- --#include <cstdio> --#include <cstring> --#include <iostream> --#include <string> --#include <vector> -- --namespace crow --{ --// ---------------------------------------------------------------------------- --// qs_parse (modified) --// https://github.com/bartgrantham/qs_parse --// ---------------------------------------------------------------------------- --/* Similar to strncmp, but handles URL-encoding for either string */ --int qsStrncmp(const char* s, const char* qs, size_t n); -- --/* Finds the beginning of each key/value pair and stores a pointer in qs_kv. -- * Also decodes the value portion of the k/v pair *in-place*. In a future -- * enhancement it will also have a compile-time option of sorting qs_kv -- * alphabetically by key. */ --size_t qsParse(char* qs, char* qs_kv[], size_t qs_kv_size); -- --/* Used by qs_parse to decode the value portion of a k/v pair */ --int qsDecode(char* qs); -- --/* Looks up the value according to the key on a pre-processed query string -- * A future enhancement will be a compile-time option to look up the key -- * in a pre-sorted qs_kv array via a binary search. */ --// char * qs_k2v(const char * key, char * qs_kv[], int qs_kv_size); --char* qsK2v(const char* key, char* const* qs_kv, int qs_kv_size, int nth); -- --/* Non-destructive lookup of value, based on key. User provides the -- * destinaton string and length. */ --char* qsScanvalue(const char* key, const char* qs, char* val, size_t val_len); -- --// TODO: implement sorting of the qs_kv array; for now ensure it's not compiled --#undef _qsSORTING -- --// isxdigit _is_ available in <ctype.h>, but let's avoid another header instead --#define BMCWEB_QS_ISHEX(x) \ -- ((((x) >= '0' && (x) <= '9') || ((x) >= 'A' && (x) <= 'F') || \ -- ((x) >= 'a' && (x) <= 'f')) \ -- ? 1 \ -- : 0) --#define BMCWEB_QS_HEX2DEC(x) \ -- (((x) >= '0' && (x) <= '9') \ -- ? (x)-48 \ -- : ((x) >= 'A' && (x) <= 'F') \ -- ? (x)-55 \ -- : ((x) >= 'a' && (x) <= 'f') ? (x)-87 : 0) --#define BMCWEB_QS_ISQSCHR(x) \ -- ((((x) == '=') || ((x) == '#') || ((x) == '&') || ((x) == '\0')) ? 0 : 1) -- --inline int qsStrncmp(const char* s, const char* qs, size_t n) --{ -- int i = 0; -- char u1, u2; -- char unyb, lnyb; -- -- while (n-- > 0) -- { -- u1 = *s++; -- u2 = *qs++; -- -- if (!BMCWEB_QS_ISQSCHR(u1)) -- { -- u1 = '\0'; -- } -- if (!BMCWEB_QS_ISQSCHR(u2)) -- { -- u2 = '\0'; -- } -- -- if (u1 == '+') -- { -- u1 = ' '; -- } -- if (u1 == '%') // easier/safer than scanf -- { -- unyb = static_cast<char>(*s++); -- lnyb = static_cast<char>(*s++); -- if (BMCWEB_QS_ISHEX(unyb) && BMCWEB_QS_ISHEX(lnyb)) -- { -- u1 = static_cast<char>((BMCWEB_QS_HEX2DEC(unyb) * 16) + -- BMCWEB_QS_HEX2DEC(lnyb)); -- } -- else -- { -- u1 = '\0'; -- } -- } -- -- if (u2 == '+') -- { -- u2 = ' '; -- } -- if (u2 == '%') // easier/safer than scanf -- { -- unyb = static_cast<char>(*qs++); -- lnyb = static_cast<char>(*qs++); -- if (BMCWEB_QS_ISHEX(unyb) && BMCWEB_QS_ISHEX(lnyb)) -- { -- u2 = static_cast<char>((BMCWEB_QS_HEX2DEC(unyb) * 16) + -- BMCWEB_QS_HEX2DEC(lnyb)); -- } -- else -- { -- u2 = '\0'; -- } -- } -- -- if (u1 != u2) -- { -- return u1 - u2; -- } -- if (u1 == '\0') -- { -- return 0; -- } -- i++; -- } -- if (BMCWEB_QS_ISQSCHR(*qs)) -- { -- return -1; -- } -- else -- { -- return 0; -- } --} -- --inline size_t qsParse(char* qs, char* qs_kv[], size_t qs_kv_size) --{ -- size_t i; -- size_t j; -- char* substrPtr; -- -- for (i = 0; i < qs_kv_size; i++) -- { -- qs_kv[i] = nullptr; -- } -- -- // find the beginning of the k/v substrings or the fragment -- substrPtr = qs + strcspn(qs, "?#"); -- if (substrPtr[0] != '\0') -- { -- substrPtr++; -- } -- else -- { -- return 0; // no query or fragment -- } -- -- i = 0; -- while (i < qs_kv_size) -- { -- qs_kv[i++] = substrPtr; -- j = strcspn(substrPtr, "&"); -- if (substrPtr[j] == '\0') -- { -- break; -- } -- substrPtr += j + 1; -- } -- -- // we only decode the values in place, the keys could have '='s in them -- // which will hose our ability to distinguish keys from values later -- for (j = 0; j < i; j++) -- { -- substrPtr = qs_kv[j] + strcspn(qs_kv[j], "=&#"); -- if (substrPtr[0] == '&' || substrPtr[0] == '\0') -- { // blank value: skip decoding -- substrPtr[0] = '\0'; -- } -- else -- { -- qsDecode(++substrPtr); -- } -- } -- --#ifdef _qsSORTING --// TODO: qsort qs_kv, using qs_strncmp() for the comparison --#endif -- -- return i; --} -- --inline int qsDecode(char* qs) --{ -- int i = 0, j = 0; -- -- while (BMCWEB_QS_ISQSCHR(qs[j])) -- { -- if (qs[j] == '+') -- { -- qs[i] = ' '; -- } -- else if (qs[j] == '%') // easier/safer than scanf -- { -- if (!BMCWEB_QS_ISHEX(qs[j + 1]) || !BMCWEB_QS_ISHEX(qs[j + 2])) -- { -- qs[i] = '\0'; -- return i; -- } -- qs[i] = static_cast<char>((BMCWEB_QS_HEX2DEC(qs[j + 1]) * 16) + -- BMCWEB_QS_HEX2DEC(qs[j + 2])); -- j += 2; -- } -- else -- { -- qs[i] = qs[j]; -- } -- i++; -- j++; -- } -- qs[i] = '\0'; -- -- return i; --} -- --inline char* qsK2v(const char* key, char* const* qs_kv, int qs_kv_size, -- int nth = 0) --{ -- int i; -- size_t keyLen, skip; -- -- keyLen = strlen(key); -- --#ifdef _qsSORTING --// TODO: binary search for key in the sorted qs_kv --#else // _qsSORTING -- for (i = 0; i < qs_kv_size; i++) -- { -- // we rely on the unambiguous '=' to find the value in our k/v pair -- if (qsStrncmp(key, qs_kv[i], keyLen) == 0) -- { -- skip = strcspn(qs_kv[i], "="); -- if (qs_kv[i][skip] == '=') -- { -- skip++; -- } -- // return (zero-char value) ? ptr to trailing '\0' : ptr to value -- if (nth == 0) -- { -- return qs_kv[i] + skip; -- } -- else -- { -- --nth; -- } -- } -- } --#endif // _qsSORTING -- -- return nullptr; --} -- --inline char* qsScanvalue(const char* key, const char* qs, char* val, -- size_t val_len) --{ -- size_t i, keyLen; -- const char* tmp; -- -- // find the beginning of the k/v substrings -- if ((tmp = strchr(qs, '?')) != nullptr) -- { -- qs = tmp + 1; -- } -- -- keyLen = strlen(key); -- while (qs[0] != '#' && qs[0] != '\0') -- { -- if (qsStrncmp(key, qs, keyLen) == 0) -- { -- break; -- } -- qs += strcspn(qs, "&") + 1; -- } -- -- if (qs[0] == '\0') -- { -- return nullptr; -- } -- -- qs += strcspn(qs, "=&#"); -- if (qs[0] == '=') -- { -- qs++; -- i = strcspn(qs, "&=#"); -- strncpy(val, qs, (val_len - 1) < (i + 1) ? (val_len - 1) : (i + 1)); -- qsDecode(val); -- } -- else -- { -- if (val_len > 0) -- { -- val[0] = '\0'; -- } -- } -- -- return val; --} --} // namespace crow --// ---------------------------------------------------------------------------- -- --namespace crow --{ --class QueryString --{ -- public: -- static const size_t maxKeyValuePairsCount = 256; -- -- QueryString() = default; -- -- QueryString(const QueryString& qs) : url(qs.url) -- { -- for (auto p : qs.keyValuePairs) -- { -- keyValuePairs.push_back( -- const_cast<char*>(p - qs.url.c_str() + url.c_str())); -- } -- } -- -- QueryString& operator=(const QueryString& qs) -- { -- if (this == &qs) -- { -- return *this; -- } -- -- url = qs.url; -- keyValuePairs.clear(); -- for (auto p : qs.keyValuePairs) -- { -- keyValuePairs.push_back( -- const_cast<char*>(p - qs.url.c_str() + url.c_str())); -- } -- return *this; -- } -- -- QueryString& operator=(QueryString&& qs) -- { -- keyValuePairs = std::move(qs.keyValuePairs); -- auto* oldData = const_cast<char*>(qs.url.c_str()); -- url = std::move(qs.url); -- for (auto& p : keyValuePairs) -- { -- p += const_cast<char*>(url.c_str()) - oldData; -- } -- return *this; -- } -- -- explicit QueryString(std::string newUrl) : url(std::move(newUrl)) -- { -- if (url.empty()) -- { -- return; -- } -- -- keyValuePairs.resize(maxKeyValuePairsCount); -- -- size_t count = -- qsParse(&url[0], &keyValuePairs[0], maxKeyValuePairsCount); -- keyValuePairs.resize(count); -- } -- -- void clear() -- { -- keyValuePairs.clear(); -- url.clear(); -- } -- -- friend std::ostream& operator<<(std::ostream& os, const QueryString& qs) -- { -- os << "[ "; -- for (size_t i = 0; i < qs.keyValuePairs.size(); ++i) -- { -- if (i != 0u) -- { -- os << ", "; -- } -- os << qs.keyValuePairs[i]; -- } -- os << " ]"; -- return os; -- } -- -- char* get(const std::string& name) const -- { -- char* ret = qsK2v(name.c_str(), keyValuePairs.data(), -- static_cast<int>(keyValuePairs.size())); -- return ret; -- } -- -- std::vector<char*> getList(const std::string& name) const -- { -- std::vector<char*> ret; -- std::string plus = name + "[]"; -- char* element = nullptr; -- -- int count = 0; -- while (true) -- { -- element = qsK2v(plus.c_str(), keyValuePairs.data(), -- static_cast<int>(keyValuePairs.size()), count++); -- if (element == nullptr) -- { -- break; -- } -- ret.push_back(element); -- } -- return ret; -- } -- -- private: -- std::string url; -- std::vector<char*> keyValuePairs; --}; -- --} // namespace crow -diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index b27c6e0..8bd30f5 100644 ---- a/redfish-core/lib/event_service.hpp -+++ b/redfish-core/lib/event_service.hpp -@@ -445,13 +445,16 @@ class EventServiceSSE : public Node - subValue->protocol = "Redfish"; - subValue->retryPolicy = "TerminateAfterRetries"; - -- char* filters = req.urlParams.get("$filter"); -- if (filters == nullptr) -+ boost::urls::url_view::params_type::iterator it = -+ req.urlParams.find("$filter"); -+ if (it == req.urlParams.end()) - { - subValue->eventFormatType = "Event"; - } -+ - else - { -+ std::string filters = it->value(); - // Reading from query params. - bool status = readSSEQueryParams( - filters, subValue->eventFormatType, subValue->registryMsgIds, -diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp -index bee1a92..590243c 100644 ---- a/redfish-core/lib/log_services.hpp -+++ b/redfish-core/lib/log_services.hpp -@@ -218,12 +218,14 @@ static bool getEntryTimestamp(sd_journal* journal, std::string& entryTimestamp) - static bool getSkipParam(crow::Response& res, const crow::Request& req, - uint64_t& skip) - { -- char* skipParam = req.urlParams.get("$skip"); -- if (skipParam != nullptr) -+ boost::urls::url_view::params_type::iterator it = -+ req.urlParams.find("$skip"); -+ if (it != req.urlParams.end()) - { -+ std::string skipParam = it->value(); - char* ptr = nullptr; -- skip = std::strtoul(skipParam, &ptr, 10); -- if (*skipParam == '\0' || *ptr != '\0') -+ skip = std::strtoul(skipParam.c_str(), &ptr, 10); -+ if (skipParam.empty() || *ptr != '\0') - { - - messages::queryParameterValueTypeError(res, std::string(skipParam), -@@ -238,12 +240,14 @@ static constexpr const uint64_t maxEntriesPerPage = 1000; - static bool getTopParam(crow::Response& res, const crow::Request& req, - uint64_t& top) - { -- char* topParam = req.urlParams.get("$top"); -- if (topParam != nullptr) -+ boost::urls::url_view::params_type::iterator it = -+ req.urlParams.find("$top"); -+ if (it != req.urlParams.end()) - { -+ std::string topParam = it->value(); - char* ptr = nullptr; -- top = std::strtoul(topParam, &ptr, 10); -- if (*topParam == '\0' || *ptr != '\0') -+ top = std::strtoul(topParam.c_str(), &ptr, 10); -+ if (topParam.empty() || *ptr != '\0') - { - messages::queryParameterValueTypeError(res, std::string(topParam), - "$top"); --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch index 761caabb7..cd4a5317c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch @@ -1,7 +1,7 @@ -From 5fa2fb4bd766b9c74b9edff4701408a002466b2a Mon Sep 17 00:00:00 2001 +From 17d24c7ff9a533ef6ff0e86554840bf5e4a11782 Mon Sep 17 00:00:00 2001 From: Karol Wachowski <karol.wachowski@intel.com> Date: Fri, 10 Jul 2020 09:54:06 +0000 -Subject: [PATCH] bmcweb handle device or resource busy exception +Subject: [PATCH 03/10] bmcweb handle device or resource busy exception Use async_method_call_timed() for mount/unmount dbus oprations. Long mount/unmount times are supported by VirtualMedia service, @@ -21,11 +21,11 @@ Tested: Verified that after mounting non-existing HTTPS resource Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> Change-Id: Ica62c34db0cce24c4c6169fc661edfde49e948d0 --- - redfish-core/lib/virtual_media.hpp | 144 ++++++++++++++++++++++------- + redfish-core/lib/virtual_media.hpp | 144 ++++++++++++++++++++++++++++--------- 1 file changed, 110 insertions(+), 34 deletions(-) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 0b5eb1a..a0c63ad 100644 +index 1336190..1a4a81d 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp @@ -23,6 +23,8 @@ @@ -37,7 +37,7 @@ index 0b5eb1a..a0c63ad 100644 namespace redfish { -@@ -109,6 +111,26 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, +@@ -121,6 +123,26 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, } } @@ -64,7 +64,7 @@ index 0b5eb1a..a0c63ad 100644 /** * @brief Fill template for Virtual Media Item. */ -@@ -806,22 +828,54 @@ class VirtualMediaActionInsertMedia : public Node +@@ -811,22 +833,54 @@ class VirtualMediaActionInsertMedia : public Node } crow::connections::systemBus->async_method_call( @@ -126,7 +126,7 @@ index 0b5eb1a..a0c63ad 100644 } }; -@@ -955,38 +1009,60 @@ class VirtualMediaActionEjectMedia : public Node +@@ -960,38 +1014,60 @@ class VirtualMediaActionEjectMedia : public Node const std::string& service, const std::string& name, bool legacy) { @@ -215,5 +215,5 @@ index 0b5eb1a..a0c63ad 100644 }; -- -2.25.1 +2.16.6 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch index 274dd044a..977a1c6fa 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch @@ -1,7 +1,7 @@ -From f388587781c3d874b13b50ad39e8674f0bc08049 Mon Sep 17 00:00:00 2001 +From f3ae6e96596eadf2a2df4bc723537a47cff13054 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> -Date: Mon, 25 May 2020 16:14:39 +0530 -Subject: [PATCH] EventService: https client support +Date: Mon, 19 Oct 2020 13:21:42 +0530 +Subject: [PATCH 04/10] EventService: https client support Add https client support for push style eventing. Using this BMC can push the event @@ -17,35 +17,54 @@ Tested: Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- - http/http_client.hpp | 270 +++++++++++++++++-------- + http/http_client.hpp | 367 ++++++++++++++++++------- redfish-core/include/event_service_manager.hpp | 2 +- - 2 files changed, 186 insertions(+), 86 deletions(-) + 2 files changed, 264 insertions(+), 105 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index e6a7db1..27d2af3 100644 +index 5c7b13f..bd1e7b6 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp -@@ -17,6 +17,7 @@ - #include <boost/asio/strand.hpp> - #include <boost/beast/core.hpp> - #include <boost/beast/http.hpp> -+#include <boost/beast/ssl.hpp> - #include <boost/beast/version.hpp> +@@ -31,12 +31,17 @@ namespace crow + { + + static constexpr uint8_t maxRequestQueueSize = 50; ++static constexpr unsigned int httpReadBodyLimit = 1024; - #include <cstdlib> -@@ -49,7 +50,10 @@ enum class ConnState + enum class ConnState + { + initialized, ++ resolveInProgress, ++ resolveFailed, ++ resolved, + connectInProgress, + connectFailed, ++ sslHandshakeInProgress, + connected, + sendInProgress, + sendFailed, +@@ -50,53 +55,124 @@ enum class ConnState class HttpClient : public std::enable_shared_from_this<HttpClient> { private: -- boost::beast::tcp_stream conn; -+ boost::asio::io_context& ioc; ++ boost::asio::ip::tcp::resolver resolver; + boost::asio::ssl::context ctx{boost::asio::ssl::context::tlsv12_client}; -+ std::shared_ptr<boost::beast::ssl_stream<boost::beast::tcp_stream>> sslConn; -+ std::shared_ptr<boost::beast::tcp_stream> conn; + boost::beast::tcp_stream conn; ++ std::optional<boost::beast::ssl_stream<boost::beast::tcp_stream&>> sslConn; boost::asio::steady_timer timer; - boost::beast::flat_buffer buffer; +- boost::beast::flat_buffer buffer; ++ boost::beast::flat_static_buffer<httpReadBodyLimit> buffer; ++ std::optional< ++ boost::beast::http::response_parser<boost::beast::http::string_body>> ++ parser; boost::beast::http::request<boost::beast::http::string_body> req; -@@ -62,14 +66,37 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +- boost::beast::http::response<boost::beast::http::string_body> res; + boost::asio::ip::tcp::resolver::results_type endpoint; +- std::vector<std::pair<std::string, std::string>> headers; ++ boost::beast::http::fields fields; + std::queue<std::string> requestDataQueue; +- ConnState state; + std::string subId; std::string host; std::string port; std::string uri; @@ -55,59 +74,54 @@ index e6a7db1..27d2af3 100644 uint32_t retryIntervalSecs; std::string retryPolicyAction; bool runningTimer; - -+ inline boost::beast::tcp_stream& getConn() ++ ConnState state; ++ ++ void doResolve() + { -+ if (useSsl) ++ BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; ++ if (state == ConnState::resolveInProgress) + { -+ return (boost::beast::get_lowest_layer(*sslConn)); ++ return; + } -+ else ++ state = ConnState::resolveInProgress; ++ // TODO: Use async_resolver. boost asio example ++ // code as is crashing with async_resolve(). ++ try + { -+ return (*conn); ++ endpoint = resolver.resolve(host, port); + } ++ catch (const std::exception& e) ++ { ++ BMCWEB_LOG_ERROR << "Failed to resolve hostname: " << host << " - " ++ << e.what(); ++ state = ConnState::resolveFailed; ++ checkQueue(); ++ return; ++ } ++ state = ConnState::resolved; ++ checkQueue(); + } -+ + void doConnect() { +- if (state == ConnState::connectInProgress) + if (useSsl) + { -+ sslConn = std::make_shared< -+ boost::beast::ssl_stream<boost::beast::tcp_stream>>(ioc, ctx); -+ } -+ else -+ { -+ conn = std::make_shared<boost::beast::tcp_stream>(ioc); ++ sslConn.emplace(conn, ctx); + } + - if (state == ConnState::connectInProgress) ++ if ((state == ConnState::connectInProgress) || ++ (state == ConnState::sslHandshakeInProgress)) { return; -@@ -77,25 +104,53 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + } state = ConnState::connectInProgress; BMCWEB_LOG_DEBUG << "Trying to connect to: " << host << ":" << port; - // Set a timeout on the operation -- conn.expires_after(std::chrono::seconds(30)); -- conn.async_connect(endpoint, [self(shared_from_this())]( -- const boost::beast::error_code& ec, -- const boost::asio::ip::tcp::resolver:: -- results_type::endpoint_type& ep) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "Connect " << ep -- << " failed: " << ec.message(); -- self->state = ConnState::connectFailed; -- self->checkQueue(); -- return; -- } -- self->state = ConnState::connected; -- BMCWEB_LOG_DEBUG << "Connected to: " << ep; - -- self->checkQueue(); -- }); ++ + auto respHandler = -+ [self(shared_from_this())](const boost::beast::error_code& ec, ++ [self(shared_from_this())](const boost::beast::error_code ec, + const boost::asio::ip::tcp::resolver:: + results_type::endpoint_type& ep) { + if (ec) @@ -119,7 +133,7 @@ index e6a7db1..27d2af3 100644 + return; + } + BMCWEB_LOG_DEBUG << "Connected to: " << ep; -+ if (self->useSsl) ++ if (self->sslConn) + { + self->performHandshake(); + } @@ -130,57 +144,91 @@ index e6a7db1..27d2af3 100644 + } + }; + -+ getConn().expires_after(std::chrono::seconds(30)); -+ getConn().async_connect(endpoint, std::move(respHandler)); + conn.expires_after(std::chrono::seconds(30)); +- conn.async_connect(endpoint, [self(shared_from_this())]( +- const boost::beast::error_code& ec, +- const boost::asio::ip::tcp::resolver:: +- results_type::endpoint_type& ep) { +- if (ec) +- { +- BMCWEB_LOG_ERROR << "Connect " << ep +- << " failed: " << ec.message(); +- self->state = ConnState::connectFailed; +- self->checkQueue(); +- return; +- } +- self->state = ConnState::connected; +- BMCWEB_LOG_DEBUG << "Connected to: " << ep; ++ conn.async_connect(endpoint, std::move(respHandler)); + } + + void performHandshake() + { ++ if (state == ConnState::sslHandshakeInProgress) ++ { ++ return; ++ } ++ state = ConnState::sslHandshakeInProgress; ++ + sslConn->async_handshake( + boost::asio::ssl::stream_base::client, -+ [self(shared_from_this())](const boost::beast::error_code& ec) { ++ [self(shared_from_this())](const boost::beast::error_code ec) { + if (ec) + { + BMCWEB_LOG_ERROR << "SSL handshake failed: " + << ec.message(); -+ self->state = ConnState::connectFailed; -+ self->doCloseAndCheckQueue(); ++ self->doCloseAndCheckQueue(ConnState::connectFailed); + return; + } + self->state = ConnState::connected; -+ BMCWEB_LOG_DEBUG << "SSL Handshake successfull \n"; -+ ++ BMCWEB_LOG_DEBUG << "SSL Handshake successfull"; + +- self->checkQueue(); +- }); + self->checkQueue(); + }); } void sendMessage(const std::string& data) -@@ -108,7 +163,10 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -107,100 +183,167 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + } + state = ConnState::sendInProgress; - BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; +- BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; ++ BMCWEB_LOG_DEBUG << host << ":" << port; - req.version(static_cast<int>(11)); // HTTP 1.1 +- req.target(uri); +- req.method(boost::beast::http::verb::post); +- +- // Set headers +- for (const auto& [key, value] : headers) + req = {}; -+ res = {}; ++ for (const auto& field : fields) + { +- req.set(key, value); ++ req.set(field.name_string(), field.value()); + } + req.set(boost::beast::http::field::host, host); ++ req.set(boost::beast::http::field::content_type, "text/plain"); + -+ req.version(11); // HTTP 1.1 - req.target(uri); - req.method(boost::beast::http::verb::post); ++ req.version(static_cast<int>(11)); // HTTP 1.1 ++ req.target(uri); ++ req.method(boost::beast::http::verb::post); + req.keep_alive(true); -@@ -123,83 +181,121 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> req.body() = data; req.prepare_payload(); - // Set a timeout on the operation - conn.expires_after(std::chrono::seconds(30)); + auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code& ec, ++ const boost::beast::error_code ec, + const std::size_t& bytesTransferred) { + if (ec) + { + BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); -+ self->state = ConnState::sendFailed; -+ self->doCloseAndCheckQueue(); ++ self->doCloseAndCheckQueue(ConnState::sendFailed); + return; + } + BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " @@ -208,15 +256,15 @@ index e6a7db1..27d2af3 100644 - self->recvMessage(); - }); -+ getConn().expires_after(std::chrono::seconds(30)); -+ if (useSsl) ++ conn.expires_after(std::chrono::seconds(30)); ++ if (sslConn) + { + boost::beast::http::async_write(*sslConn, req, + std::move(respHandler)); + } + else + { -+ boost::beast::http::async_write(*conn, req, std::move(respHandler)); ++ boost::beast::http::async_write(conn, req, std::move(respHandler)); + } } @@ -227,109 +275,141 @@ index e6a7db1..27d2af3 100644 - conn, buffer, res, - [self(shared_from_this())](const boost::beast::error_code& ec, - const std::size_t& bytesTransferred) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "recvMessage() failed: " -- << ec.message(); -- self->state = ConnState::recvFailed; -- self->checkQueue(); -- return; -- } -- BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " -- << bytesTransferred; -- boost::ignore_unused(bytesTransferred); + auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code& ec, ++ const boost::beast::error_code ec, + const std::size_t& bytesTransferred) { + if (ec && ec != boost::beast::http::error::partial_message) + { + BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message(); -+ self->state = ConnState::recvFailed; -+ self->doCloseAndCheckQueue(); ++ self->doCloseAndCheckQueue(ConnState::recvFailed); + return; + } + BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " + << bytesTransferred; + boost::ignore_unused(bytesTransferred); - -- // Discard received data. We are not interested. -- BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->res; -+ // Discard received data. We are not interested. -+ BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->res; - -- // Send is successful, Lets remove data from queue -- // check for next request data in queue. -- self->requestDataQueue.pop(); -- self->state = ConnState::idle; -- self->checkQueue(); -- }); ++ ++ // TODO: check for return status code and perform ++ // retry if fails(Ex: 40x). Take action depending on ++ // retry policy. ++ BMCWEB_LOG_DEBUG << "recvMessage() data: " ++ << self->parser->get().body(); ++ + // Send is successful, Lets remove data from queue + // check for next request data in queue. + self->requestDataQueue.pop(); -+ self->state = ConnState::idle; + -+ if (ec == boost::beast::http::error::partial_message) -+ { -+ // Least bothered about recv message. Partial -+ // message means, already data is sent. Lets close -+ // connection and let next request open connection -+ // to avoid truncated stream. -+ self->state = ConnState::closed; -+ self->doCloseAndCheckQueue(); -+ return; -+ } ++ // Transfer ownership of the response ++ self->parser->release(); + -+ self->checkQueue(); ++ // TODO: Implement the keep-alive connections. ++ // Most of the web servers close connection abruptly ++ // and might be reason due to which its observed that ++ // stream_truncated(Next read) or partial_message ++ // errors. So for now, closing connection and re-open ++ // for all cases. ++ self->doCloseAndCheckQueue(ConnState::closed); + }; + -+ getConn().expires_after(std::chrono::seconds(30)); -+ if (useSsl) ++ parser.emplace(std::piecewise_construct, std::make_tuple()); ++ parser->body_limit(httpReadBodyLimit); ++ buffer.consume(buffer.size()); ++ ++ conn.expires_after(std::chrono::seconds(30)); ++ if (sslConn) + { -+ boost::beast::http::async_read(*sslConn, buffer, res, ++ boost::beast::http::async_read(*sslConn, buffer, *parser, + std::move(respHandler)); + } + else + { -+ boost::beast::http::async_read(*conn, buffer, res, ++ boost::beast::http::async_read(conn, buffer, *parser, + std::move(respHandler)); + } - } - ++ } ++ ++ void doCloseAndCheckQueue(const ConnState setState = ConnState::closed) ++ { ++ if (sslConn) ++ { ++ conn.expires_after(std::chrono::seconds(30)); ++ sslConn->async_shutdown([self = shared_from_this(), ++ setState{std::move(setState)}]( ++ const boost::system::error_code ec) { + if (ec) + { +- BMCWEB_LOG_ERROR << "recvMessage() failed: " +- << ec.message(); +- self->state = ConnState::recvFailed; +- self->checkQueue(); +- return; ++ // Many https server closes connection abruptly ++ // i.e witnout close_notify. More details are at ++ // https://github.com/boostorg/beast/issues/824 ++ if (ec == boost::asio::ssl::error::stream_truncated) ++ { ++ BMCWEB_LOG_ERROR ++ << "doCloseAndCheckQueue(): Connection " ++ "closed by server. "; ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " ++ << ec.message(); ++ } + } +- BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " +- << bytesTransferred; +- boost::ignore_unused(bytesTransferred); +- +- // Discard received data. We are not interested. +- BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->res; +- +- // Send is successful, Lets remove data from queue +- // check for next request data in queue. +- self->requestDataQueue.pop(); +- self->state = ConnState::idle; ++ else ++ { ++ BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; ++ } ++ self->conn.cancel(); ++ self->state = setState; + self->checkQueue(); + }); +- } +- - void doClose() -+ void doCloseAndCheckQueue() - { - boost::beast::error_code ec; +- { +- boost::beast::error_code ec; - conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); -+ getConn().cancel(); -+ getConn().expires_after(std::chrono::seconds(30)); -+ getConn().socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, -+ ec); - +- - state = ConnState::closed; - // not_connected happens sometimes so don't bother reporting it. - if (ec && ec != boost::beast::errc::not_connected) -+ if (ec && ec != boost::asio::error::eof) ++ } ++ else { - BMCWEB_LOG_ERROR << "shutdown failed: " << ec.message(); - return; -+ // Many https server closes connection abruptly -+ // i.e witnout close_notify. More details are at -+ // https://github.com/boostorg/beast/issues/824 -+ if (ec == boost::asio::ssl::error::stream_truncated) ++ boost::beast::error_code ec; ++ conn.expires_after(std::chrono::seconds(30)); ++ conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ++ ec); ++ if (ec) + { -+ BMCWEB_LOG_DEBUG -+ << "doCloseAndCheckQueue(): Connection closed by server."; ++ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " ++ << ec.message(); + } + else + { -+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " -+ << ec.message(); ++ BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; + } - } + -+ getConn().close(); - BMCWEB_LOG_DEBUG << "Connection closed gracefully"; -+ checkQueue(); ++ conn.close(); ++ state = setState; ++ checkQueue(); + } +- BMCWEB_LOG_DEBUG << "Connection closed gracefully"; + return; } @@ -344,54 +424,112 @@ index e6a7db1..27d2af3 100644 BMCWEB_LOG_DEBUG << "requestDataQueue is empty\n"; return; } -@@ -257,17 +353,20 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs +@@ -232,6 +375,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + } + + if ((state == ConnState::connectFailed) || ++ (state == ConnState::resolveFailed) || + (state == ConnState::sendFailed) || + (state == ConnState::recvFailed)) + { +@@ -256,14 +400,18 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> << " seconds. RetryCount = " << retryCount; timer.expires_after(std::chrono::seconds(retryIntervalSecs)); -- timer.async_wait([self = shared_from_this()]( -- const boost::system::error_code& ec) { -- self->runningTimer = false; -- self->connStateCheck(); -- }); -+ timer.async_wait( + timer.async_wait( +- [self = shared_from_this()](const boost::system::error_code&) { + [self = shared_from_this()](boost::system::error_code) { -+ self->runningTimer = false; -+ self->connStateCheck(); -+ }); + self->runningTimer = false; + self->connStateCheck(); + }); return; } - else +- // reset retry count. +- retryCount = 0; ++ ++ if (state == ConnState::idle) ++ { ++ // State idle means, previous attempt is successful. ++ retryCount = 0; ++ } + connStateCheck(); + + return; +@@ -273,15 +421,21 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + { + switch (state) { -- // reset retry count. -- retryCount = 0; -+ if (state == ConnState::idle) -+ { -+ // State idle means, previous attempt is successful. -+ retryCount = 0; -+ } ++ case ConnState::initialized: ++ case ConnState::resolveFailed: ++ case ConnState::connectFailed: ++ doResolve(); ++ break; + case ConnState::connectInProgress: ++ case ConnState::resolveInProgress: ++ case ConnState::sslHandshakeInProgress: + case ConnState::sendInProgress: + case ConnState::suspended: + case ConnState::terminated: + // do nothing + break; +- case ConnState::initialized: + case ConnState::closed: +- case ConnState::connectFailed: ++ case ConnState::resolved: + case ConnState::sendFailed: + case ConnState::recvFailed: + { +@@ -297,22 +451,22 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + sendMessage(data); + break; + } ++ default: ++ break; } - connStateCheck(); + } -@@ -310,10 +409,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> public: explicit HttpClient(boost::asio::io_context& ioc, const std::string& id, const std::string& destIP, const std::string& destPort, - const std::string& destUri) : - conn(ioc), +- timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri), +- retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), +- retryPolicyAction("TerminateAfterRetries"), runningTimer(false) +- { +- boost::asio::ip::tcp::resolver resolver(ioc); +- endpoint = resolver.resolve(host, port); +- state = ConnState::initialized; +- } + const std::string& destUri, + const bool inUseSsl = true) : -+ ioc(ioc), - timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri), -- retryCount(0), maxRetryAttempts(5), -+ useSsl(inUseSsl), retryCount(0), maxRetryAttempts(5), - retryPolicyAction("TerminateAfterRetries"), runningTimer(false) ++ resolver(ioc), ++ conn(ioc), timer(ioc), subId(id), host(destIP), port(destPort), ++ uri(destUri), useSsl(inUseSsl), retryCount(0), maxRetryAttempts(5), ++ retryPolicyAction("TerminateAfterRetries"), runningTimer(false), ++ state(ConnState::initialized) ++ {} + + void sendData(const std::string& data) + { +@@ -337,7 +491,12 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + void setHeaders( + const std::vector<std::pair<std::string, std::string>>& httpHeaders) { - boost::asio::ip::tcp::resolver resolver(ioc); +- headers = httpHeaders; ++ // Set headers ++ for (const auto& [key, value] : httpHeaders) ++ { ++ // TODO: Validate the header fileds before assign. ++ fields.set(key, value); ++ } + } + + void setRetryConfig(const uint32_t retryAttempts, diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 6362112..3ab2605 100644 +index 54dafb4..f68ae1d 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -383,7 +383,7 @@ class Subscription +@@ -387,7 +387,7 @@ class Subscription { conn = std::make_shared<crow::HttpClient>( crow::connections::systemBus->get_io_context(), id, host, port, @@ -399,7 +537,7 @@ index 6362112..3ab2605 100644 + path, (uriProto == "https" ? true : false)); } - Subscription(const std::shared_ptr<crow::Request::Adaptor>& adaptor) : + Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : -- -2.7.4 +2.16.6 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-VirtualMedia-fixes-for-Redfish-Service-Validator.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-VirtualMedia-fixes-for-Redfish-Service-Validator.patch deleted file mode 100644 index 52ff4e531..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-VirtualMedia-fixes-for-Redfish-Service-Validator.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 49dc25100ab8a4220f81bc8f9b54808850fe1267 Mon Sep 17 00:00:00 2001 -From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> -Date: Wed, 8 Jul 2020 15:17:31 +0200 -Subject: [PATCH] VirtualMedia fixes for Redfish Service Validator - -Removes all warnings and errors for VirtualMedia -- rework for OemVirtualMedia -- minor adjustments for jsons - -Tested: -Redfish Service Validator ran with no errors and/or warnings - -Change-Id: Ic027166153a807a8bd3a6c04f042969f16e0dc6a -Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> ---- - redfish-core/lib/virtual_media.hpp | 4 +-- - .../v1/JsonSchemas/OemVirtualMedia/index.json | 28 +++---------------- - .../redfish/v1/schema/OemVirtualMedia_v1.xml | 12 ++++---- - 3 files changed, 12 insertions(+), 32 deletions(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 552e255..183abbe 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -129,7 +129,7 @@ static nlohmann::json vmItemTemplate(const std::string& name, - item["MediaTypes"] = {"CD", "USBStick"}; - item["TransferMethod"] = "Stream"; - item["TransferProtocolType"] = nullptr; -- item["Oem"]["OpenBmc"]["WebSocketEndpoint"] = nullptr; -+ item["Oem"]["OpenBMC"]["WebSocketEndpoint"] = nullptr; - item["Oem"]["OpenBMC"]["@odata.type"] = - "#OemVirtualMedia.v1_0_0.VirtualMedia"; - -@@ -1039,7 +1039,7 @@ class VirtualMediaCollection : public Node - "#VirtualMediaCollection.VirtualMediaCollection"; - res.jsonValue["Name"] = "Virtual Media Services"; - res.jsonValue["@odata.id"] = -- "/redfish/v1/Managers/" + name + "/VirtualMedia/"; -+ "/redfish/v1/Managers/" + name + "/VirtualMedia"; - - crow::connections::systemBus->async_method_call( - [asyncResp, name](const boost::system::error_code ec, -diff --git a/static/redfish/v1/JsonSchemas/OemVirtualMedia/index.json b/static/redfish/v1/JsonSchemas/OemVirtualMedia/index.json -index 78bd8b7..9ae641a 100644 ---- a/static/redfish/v1/JsonSchemas/OemVirtualMedia/index.json -+++ b/static/redfish/v1/JsonSchemas/OemVirtualMedia/index.json -@@ -3,9 +3,10 @@ - "$schema": "http://redfish.dmtf.org/schemas/v1/redfish-schema-v1.json", - "copyright": "Copyright 2014-2019 DMTF. For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright", - "definitions": { -- "OpenBmc": { -- "additionalProperties": true, -- "description": "Oem properties for OpenBmc.", -+ "VirtualMedia": { -+ "additionalProperties": false, -+ "description": "OEM Extension for VirtualMedia", -+ "longDescription": "OEM Extension for VirtualMedia to support Proxy mode.", - "patternProperties": { - "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message)\\.[a-zA-Z_][a-zA-Z0-9_]*$": { - "description": "This property shall specify a valid odata or Redfish property.", -@@ -32,27 +33,6 @@ - } - }, - "type": "object" -- }, -- "VirtualMedia": { -- "additionalProperties": false, -- "description": "OEM Extension for VirtualMedia", -- "longDescription": "OEM Extension for VirtualMedia to support Proxy mode.", -- "patternProperties": { -- "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message)\\.[a-zA-Z_][a-zA-Z0-9_]*$": { -- "description": "This property shall specify a valid odata or Redfish property.", -- "type": [ -- "array", -- "boolean", -- "integer", -- "number", -- "null", -- "object", -- "string" -- ] -- } -- }, -- "properties": {}, -- "type": "object" - } - }, - "owningEntity": "OpenBMC", -diff --git a/static/redfish/v1/schema/OemVirtualMedia_v1.xml b/static/redfish/v1/schema/OemVirtualMedia_v1.xml -index 2b03a67..84afe73 100644 ---- a/static/redfish/v1/schema/OemVirtualMedia_v1.xml -+++ b/static/redfish/v1/schema/OemVirtualMedia_v1.xml -@@ -25,20 +25,20 @@ - <Annotation Term="Redfish.OwningEntity" String="OpenBMC"/> - <Annotation Term="Redfish.Release" String="1.0"/> - -- <ComplexType Name="OpenBmc" BaseType="Resource.OemObject"> -- <Annotation Term="OData.AdditionalProperties" Bool="true"/> -- <Annotation Term="OData.Description" String="Oem properties for OpenBmc." /> -- -- <Property Name="WebSocketEndpoint" Type="Edm.String"> -+ <Property Name="WebSocketEndpoint" Type="Edm.String"> - <Annotation Term="OData.Permissions" EnumMember="OData.Permission/Read"/> - <Annotation Term="OData.Description" String="Indicates endpoint socket name and location."/> - <Annotation Term="OData.LongDescription" String="The value of this property shall be a structure ring indicating location and name of the socket used to communicate with nbd server."/> - </Property> -- </ComplexType> - - <EntityType Name="VirtualMedia" BaseType="Resource.OemObject" Abstract="true"> - <Annotation Term="OData.Description" String="OEM Extension for VirtualMedia"/> - <Annotation Term="OData.LongDescription" String="OEM Extension for VirtualMedia to support Proxy mode."/> -+ <Property Name="WebSocketEndpoint" Type="Edm.String"> -+ <Annotation Term="OData.Permissions" EnumMember="OData.Permission/Read"/> -+ <Annotation Term="OData.Description" String="Indicates endpoint socket name and location."/> -+ <Annotation Term="OData.LongDescription" String="The value of this property shall be a structure ring indicating location and name of the socket used to communicate with nbd server."/> -+ </Property> - </EntityType> - </Schema> - --- -2.25.0 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Fix-Image-and-ImageName-values-in-schema.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Fix-Image-and-ImageName-values-in-schema.patch deleted file mode 100644 index c182822a6..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Fix-Image-and-ImageName-values-in-schema.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 15305d3a9db371af924482e5a6959bbf7812cf6c Mon Sep 17 00:00:00 2001 -From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> -Date: Wed, 29 Jul 2020 15:56:57 +0200 -Subject: [PATCH] Fix Image and ImageName values in schema - -According to design document and schema Image shall contain URL of -image location and ImageName only name of the image. - -Change-Id: Ie1a906c66aa2a10113c307eb1e7d2d7da2810fbd -Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> ---- - redfish-core/lib/virtual_media.hpp | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 183abbe..0345e7b 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -97,7 +97,15 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - std::get_if<std::string>(&imageUrlProperty->second); - if (imageUrlValue && !imageUrlValue->empty()) - { -- aResp->res.jsonValue["ImageName"] = *imageUrlValue; -+ std::size_t lastIndex = imageUrlValue->rfind("/"); -+ if (lastIndex == std::string::npos) -+ { -+ aResp->res.jsonValue["ImageName"] = *imageUrlValue; -+ } -+ -+ aResp->res.jsonValue["ImageName"] = -+ imageUrlValue->substr(lastIndex + 1); -+ aResp->res.jsonValue["Image"] = *imageUrlValue; - aResp->res.jsonValue["Inserted"] = *activeValue; - if (*activeValue == true) - { --- -2.25.0 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch index 3850c8fa8..9157f1bf1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch @@ -1,7 +1,7 @@ -From 7820421433349df28bd393e8d610d1848af0f1c8 Mon Sep 17 00:00:00 2001 +From d8b7e2f4eae85cd76d480970e888a50548523fc2 Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" <jozef.wludzik@intel.com> Date: Mon, 27 Apr 2020 17:24:15 +0200 -Subject: [PATCH 1/5] Redfish TelemetryService schema implementation +Subject: [PATCH 05/10] Redfish TelemetryService schema implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -24,6 +24,10 @@ Tested: Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com> Change-Id: Ie6b0b49f4ef5eeaef07d1209b6c349270c04d570 + +%% original patch: 0001-Redfish-TelemetryService-schema-implementation.patch + +Change-Id: I547073faef9228e8dc5350ea28d06cdd3c5341f6 --- include/dbus_utility.hpp | 21 +++ redfish-core/include/redfish.hpp | 10 ++ @@ -31,10 +35,10 @@ Change-Id: Ie6b0b49f4ef5eeaef07d1209b6c349270c04d570 redfish-core/include/utils/telemetry_utils.hpp | 100 +++++++++++++ redfish-core/include/utils/time_utils.hpp | 97 +++++++++++++ redfish-core/lib/metric_report.hpp | 149 +++++++++++++++++++ - redfish-core/lib/metric_report_definition.hpp | 193 +++++++++++++++++++++++++ + redfish-core/lib/metric_report_definition.hpp | 191 +++++++++++++++++++++++++ redfish-core/lib/service_root.hpp | 2 + redfish-core/lib/telemetry_service.hpp | 92 ++++++++++++ - 9 files changed, 765 insertions(+) + 9 files changed, 763 insertions(+) create mode 100644 redfish-core/include/utils/telemetry_utils.hpp create mode 100644 redfish-core/include/utils/time_utils.hpp create mode 100644 redfish-core/lib/metric_report.hpp @@ -42,10 +46,10 @@ Change-Id: Ie6b0b49f4ef5eeaef07d1209b6c349270c04d570 create mode 100644 redfish-core/lib/telemetry_service.hpp diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp -index e1360f7..3df88d8 100644 +index 8ba9a57..ef3438b 100644 --- a/include/dbus_utility.hpp +++ b/include/dbus_utility.hpp -@@ -109,5 +109,26 @@ inline void checkDbusPathExists(const std::string& path, Callback&& callback) +@@ -99,5 +99,26 @@ inline void checkDbusPathExists(const std::string& path, Callback&& callback) std::array<std::string, 0>()); } @@ -73,19 +77,19 @@ index e1360f7..3df88d8 100644 } // namespace utility } // namespace dbus diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index cc98e1a..3d4c117 100644 +index 54d5d0e..2587b37 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp @@ -25,6 +25,8 @@ - #include "../lib/log_services.hpp" #include "../lib/managers.hpp" + #include "../lib/memory.hpp" #include "../lib/message_registries.hpp" +#include "../lib/metric_report.hpp" +#include "../lib/metric_report_definition.hpp" #include "../lib/network_protocol.hpp" #include "../lib/pcie.hpp" #include "../lib/power.hpp" -@@ -35,6 +37,7 @@ +@@ -36,6 +38,7 @@ #include "../lib/storage.hpp" #include "../lib/systems.hpp" #include "../lib/task.hpp" @@ -93,7 +97,7 @@ index cc98e1a..3d4c117 100644 #include "../lib/thermal.hpp" #include "../lib/update_service.hpp" #ifdef BMCWEB_ENABLE_VM_NBDPROXY -@@ -202,6 +205,13 @@ class RedfishService +@@ -207,6 +210,13 @@ class RedfishService nodes.emplace_back(std::make_unique<HypervisorInterface>(app)); nodes.emplace_back(std::make_unique<HypervisorSystem>(app)); @@ -108,21 +112,20 @@ index cc98e1a..3d4c117 100644 { node->initPrivileges(); diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp -index d578de4..fbb259d 100644 +index c355000..c866a2f 100644 --- a/redfish-core/include/utils/json_utils.hpp +++ b/redfish-core/include/utils/json_utils.hpp -@@ -13,15 +13,19 @@ +@@ -13,14 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. */ + #pragma once - #include <http_request.h> - #include <http_response.h> - +#include <boost/container/flat_map.hpp> #include <error_messages.hpp> + #include <http_request.hpp> + #include <http_response.hpp> #include <nlohmann/json.hpp> #include <bitset> @@ -131,7 +134,7 @@ index d578de4..fbb259d 100644 namespace redfish { -@@ -436,5 +440,102 @@ bool getValueFromJsonObject(nlohmann::json& jsonData, const std::string& key, +@@ -425,5 +429,102 @@ bool getValueFromJsonObject(nlohmann::json& jsonData, const std::string& key, return details::unpackValue(jsonValue, key, value); } @@ -445,7 +448,7 @@ index 0000000..0256b3f +} // namespace redfish diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp new file mode 100644 -index 0000000..a52d680 +index 0000000..4d1c4e5 --- /dev/null +++ b/redfish-core/lib/metric_report.hpp @@ -0,0 +1,149 @@ @@ -481,7 +484,7 @@ index 0000000..a52d680 +class MetricReportCollection : public Node +{ + public: -+ MetricReportCollection(CrowApp& app) : Node(app, telemetry::metricReportUri) ++ MetricReportCollection(App& app) : Node(app, telemetry::metricReportUri) + { + entityPrivileges = { + {boost::beast::http::verb::get, {{"Login"}}}, @@ -493,8 +496,8 @@ index 0000000..a52d680 + } + + private: -+ void doGet(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ void doGet(crow::Response& res, const crow::Request&, ++ const std::vector<std::string>&) override + { + res.jsonValue["@odata.type"] = + "#MetricReportCollection.MetricReportCollection"; @@ -510,7 +513,7 @@ index 0000000..a52d680 +class MetricReport : public Node +{ + public: -+ MetricReport(CrowApp& app) : ++ MetricReport(App& app) : + Node(app, std::string(telemetry::metricReportUri) + "<str>/", + std::string()) + { @@ -524,7 +527,7 @@ index 0000000..a52d680 + } + + private: -+ void doGet(crow::Response& res, const crow::Request& req, ++ void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>& params) override + { + auto asyncResp = std::make_shared<AsyncResp>(res); @@ -600,10 +603,10 @@ index 0000000..a52d680 +} // namespace redfish diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp new file mode 100644 -index 0000000..d82ae59 +index 0000000..72e62e9 --- /dev/null +++ b/redfish-core/lib/metric_report_definition.hpp -@@ -0,0 +1,193 @@ +@@ -0,0 +1,191 @@ +/* +// Copyright (c) 2018-2020 Intel Corporation +// @@ -637,7 +640,7 @@ index 0000000..d82ae59 +class MetricReportDefinitionCollection : public Node +{ + public: -+ MetricReportDefinitionCollection(CrowApp& app) : ++ MetricReportDefinitionCollection(App& app) : + Node(app, telemetry::metricReportDefinitionUri) + { + entityPrivileges = { @@ -650,8 +653,8 @@ index 0000000..d82ae59 + } + + private: -+ void doGet(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ void doGet(crow::Response& res, const crow::Request&, ++ const std::vector<std::string>&) override + { + res.jsonValue["@odata.type"] = "#MetricReportDefinitionCollection." + "MetricReportDefinitionCollection"; @@ -668,7 +671,7 @@ index 0000000..d82ae59 +class MetricReportDefinition : public Node +{ + public: -+ MetricReportDefinition(CrowApp& app) : ++ MetricReportDefinition(App& app) : + Node(app, std::string(telemetry::metricReportDefinitionUri) + "<str>/", + std::string()) + { @@ -682,7 +685,7 @@ index 0000000..d82ae59 + } + + private: -+ void doGet(crow::Response& res, const crow::Request& req, ++ void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>& params) override + { + auto asyncResp = std::make_shared<AsyncResp>(res); @@ -723,12 +726,10 @@ index 0000000..d82ae59 + using ReadingParameters = + std::vector<std::tuple<std::vector<sdbusplus::message::object_path>, + std::string, std::string, std::string>>; -+ using Metrics = std::vector<std::map< -+ std::string, std::variant<std::string, std::vector<std::string>>>>; + -+ static Metrics toMetrics(const ReadingParameters& params) ++ static nlohmann::json toMetrics(const ReadingParameters& params) + { -+ Metrics metrics; ++ nlohmann::json metrics = nlohmann::json::array(); + + for (auto& [sensorPaths, operationType, id, metadata] : params) + { @@ -798,10 +799,10 @@ index 0000000..d82ae59 +}; +} // namespace redfish diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp -index b6bd6e0..3302390 100644 +index 629280c..3df5ec5 100644 --- a/redfish-core/lib/service_root.hpp +++ b/redfish-core/lib/service_root.hpp -@@ -69,6 +69,8 @@ class ServiceRoot : public Node +@@ -68,6 +68,8 @@ class ServiceRoot : public Node res.jsonValue["Tasks"] = {{"@odata.id", "/redfish/v1/TaskService"}}; res.jsonValue["EventService"] = { {"@odata.id", "/redfish/v1/EventService"}}; @@ -812,7 +813,7 @@ index b6bd6e0..3302390 100644 diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp new file mode 100644 -index 0000000..a410700 +index 0000000..b849781 --- /dev/null +++ b/redfish-core/lib/telemetry_service.hpp @@ -0,0 +1,92 @@ @@ -847,7 +848,7 @@ index 0000000..a410700 +class TelemetryService : public Node +{ + public: -+ TelemetryService(CrowApp& app) : Node(app, "/redfish/v1/TelemetryService/") ++ TelemetryService(App& app) : Node(app, "/redfish/v1/TelemetryService/") + { + entityPrivileges = { + {boost::beast::http::verb::get, {{"Login"}}}, @@ -859,8 +860,8 @@ index 0000000..a410700 + } + + private: -+ void doGet(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ void doGet(crow::Response& res, const crow::Request&, ++ const std::vector<std::string>&) override + { + res.jsonValue["@odata.type"] = + "#TelemetryService.v1_2_0.TelemetryService"; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch index 8a8690bf3..c24352de5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch @@ -1,7 +1,7 @@ -From 941be2c7d819b4a55d5a8b67948e53658d907789 Mon Sep 17 00:00:00 2001 +From 00806052b1e9440809ce727523ffcc66083f6417 Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" <jozef.wludzik@intel.com> Date: Mon, 18 May 2020 11:56:57 +0200 -Subject: [PATCH 2/5] Add support for POST in MetricReportDefinitions +Subject: [PATCH 06/10] Add support for POST in MetricReportDefinitions Added POST action in MetricReportDefinitions node to allow user to add new MetricReportDefinition. Using minimal set of @@ -19,6 +19,10 @@ Tested: Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I2fed96848594451e22fde686f8c066d7770cc65a + +%% original patch: 0002-Add-support-for-POST-in-MetricReportDefinitions.patch + +Change-Id: I55032bc1086b60800d19bd1c0fa14fdb891f5a5b --- redfish-core/include/utils/time_utils.hpp | 49 +++ .../include/utils/validate_params_length.hpp | 109 +++++++ @@ -208,7 +212,7 @@ index 0000000..c4e0569 + +} // namespace redfish diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp -index d82ae59..ecbab0c 100644 +index 72e62e9..c6b09f8 100644 --- a/redfish-core/lib/metric_report_definition.hpp +++ b/redfish-core/lib/metric_report_definition.hpp @@ -17,16 +17,29 @@ @@ -261,7 +265,7 @@ index d82ae59..ecbab0c 100644 + MetricParams>; + + void doPost(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ const std::vector<std::string>&) override + { + auto asyncResp = std::make_shared<AsyncResp>(res); + AddReportArgs addReportArgs; @@ -287,7 +291,7 @@ index d82ae59..ecbab0c 100644 + retrieveUriToDbusMap( + chassis, sensorType, + [asyncResp, addReportReq]( -+ const boost::beast::http::status status, ++ const boost::beast::http::status, + const boost::container::flat_map<std::string, std::string>& + uriToDbus) { *addReportReq += uriToDbus; }); + } @@ -518,7 +522,7 @@ index d82ae59..ecbab0c 100644 + + crow::connections::systemBus->async_method_call( + [asyncResp, name](const boost::system::error_code ec, -+ const std::string ret) { ++ const std::string) { + if (ec == boost::system::errc::file_exists) + { + messages::resourceAlreadyExists( @@ -581,7 +585,7 @@ index d82ae59..ecbab0c 100644 }; class MetricReportDefinition : public Node -@@ -148,6 +494,7 @@ class MetricReportDefinition : public Node +@@ -146,6 +492,7 @@ class MetricReportDefinition : public Node asyncResp->res.jsonValue["MetricReport"]["@odata.id"] = telemetry::metricReportUri + id; asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch index 4c49b0cd3..dee5a158b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch @@ -1,7 +1,7 @@ -From 8b2f4a6fe57bf2410cdb22f8c3c695e98d583040 Mon Sep 17 00:00:00 2001 +From 5a1eef4a6c74c29d9b9026676e59e6cdf0a7e8bd Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" <jozef.wludzik@intel.com> Date: Mon, 18 May 2020 12:40:15 +0200 -Subject: [PATCH 3/5] Add support for DELETE in MetricReportDefinitions/<str> +Subject: [PATCH 07/10] Add support for DELETE in MetricReportDefinitions/<str> Added support for DELETE action in MetricReportDefinitions/<str> node. It allows user to remove MetricReportDefinition together @@ -16,19 +16,23 @@ Tested: Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Change-Id: Iffde9f7bbf2955376e9714ac8d833967bd25eaa3 + +%% original patch: 0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch + +Change-Id: I2930b9354fd4cf1f8d9a97af33b81c7b689fe0ef --- redfish-core/lib/metric_report_definition.hpp | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp -index ecbab0c..8e04ac8 100644 +index c6b09f8..3191a8f 100644 --- a/redfish-core/lib/metric_report_definition.hpp +++ b/redfish-core/lib/metric_report_definition.hpp -@@ -533,6 +533,38 @@ class MetricReportDefinition : public Node +@@ -531,6 +531,38 @@ class MetricReportDefinition : public Node "xyz.openbmc_project.MonitoringService.Report"); } -+ void doDelete(crow::Response& res, const crow::Request& req, ++ void doDelete(crow::Response& res, const crow::Request&, + const std::vector<std::string>& params) override + { + auto asyncResp = std::make_shared<AsyncResp>(res); @@ -43,7 +47,7 @@ index ecbab0c..8e04ac8 100644 + } + + static void deleteReport(const std::shared_ptr<AsyncResp>& asyncResp, -+ const std::string& path, const std::string& id) ++ const std::string& path, const std::string&) + { + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec) { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch index e996ac585..c6c6a8f09 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch @@ -1,7 +1,7 @@ -From 9fc7d722b3192df9940062185b40ebb0fabad518 Mon Sep 17 00:00:00 2001 +From d206ea5049057fe4842186777231b9eb8468ec86 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Date: Mon, 8 Jun 2020 15:16:10 +0200 -Subject: [PATCH 4/5] Add support for "OnRequest" in MetricReportDefinition +Subject: [PATCH 08/10] Add support for "OnRequest" in MetricReportDefinition Added support for "OnRequest" of ReportingType property in MetricReportDefinition node. Now user is able to create @@ -14,6 +14,8 @@ Tested: Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I1cdfe47e56fdc5ec9753558145d0bf3645160aaf + +%% original patch: 0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch --- include/dbus_utility.hpp | 30 +++++++++++++++ redfish-core/include/utils/telemetry_utils.hpp | 8 ++-- @@ -21,18 +23,18 @@ Change-Id: I1cdfe47e56fdc5ec9753558145d0bf3645160aaf 3 files changed, 87 insertions(+), 4 deletions(-) diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp -index 3df88d8..029d8d8 100644 +index ef3438b..80f8bcd 100644 --- a/include/dbus_utility.hpp +++ b/include/dbus_utility.hpp -@@ -17,6 +17,7 @@ - +@@ -18,6 +18,7 @@ #include <sdbusplus/message.hpp> + #include <filesystem> +#include <functional> #include <regex> namespace dbus -@@ -130,5 +131,34 @@ inline void getAllProperties(Callback&& callback, const std::string& service, +@@ -120,5 +121,34 @@ inline void getAllProperties(Callback&& callback, const std::string& service, interface); } @@ -94,7 +96,7 @@ index 05ed00f..6c4e810 100644 { messages::resourceNotFound(asyncResp->res, schemaType, id); diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp -index a52d680..877e7f1 100644 +index 4d1c4e5..768cce9 100644 --- a/redfish-core/lib/metric_report.hpp +++ b/redfish-core/lib/metric_report.hpp @@ -85,7 +85,7 @@ class MetricReport : public Node diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch index f7da8a556..5b1d93664 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch @@ -1,7 +1,7 @@ -From b1da8901b5985d6a77b63ca9eb0570b46528f0bd Mon Sep 17 00:00:00 2001 +From b369c09460b46902878da10a106e3b3400fd776e Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" <jozef.wludzik@intel.com> Date: Mon, 8 Jun 2020 17:15:54 +0200 -Subject: [PATCH 5/5] Add support for MetricDefinition scheme +Subject: [PATCH 09/10] Add support for MetricDefinition scheme Added MetricDefinition node to redfish core. Now user is able to get all possible metrics that are present in system and are @@ -14,6 +14,10 @@ Tested: Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00 + +%% original patch: 0005-Add-support-for-MetricDefinition-scheme.patch + +Change-Id: Ibcb7a858c9118c8af5ff1167a055b044f0d8db77 --- redfish-core/include/redfish.hpp | 3 + redfish-core/include/utils/telemetry_utils.hpp | 2 + @@ -25,18 +29,18 @@ Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00 create mode 100644 redfish-core/lib/metric_definition.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index 3d4c117..2a12bf9 100644 +index 2587b37..705f490 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp @@ -25,6 +25,7 @@ - #include "../lib/log_services.hpp" #include "../lib/managers.hpp" + #include "../lib/memory.hpp" #include "../lib/message_registries.hpp" +#include "../lib/metric_definition.hpp" #include "../lib/metric_report.hpp" #include "../lib/metric_report_definition.hpp" #include "../lib/network_protocol.hpp" -@@ -206,6 +207,8 @@ class RedfishService +@@ -211,6 +212,8 @@ class RedfishService nodes.emplace_back(std::make_unique<HypervisorSystem>(app)); nodes.emplace_back(std::make_unique<TelemetryService>(app)); @@ -60,7 +64,7 @@ index 6c4e810..bb747c4 100644 static constexpr const char* metricReportUri = diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp new file mode 100644 -index 0000000..837a068 +index 0000000..1417efa --- /dev/null +++ b/redfish-core/lib/metric_definition.hpp @@ -0,0 +1,300 @@ @@ -127,7 +131,7 @@ index 0000000..837a068 +class MetricDefinitionCollection : public Node +{ + public: -+ MetricDefinitionCollection(CrowApp& app) : ++ MetricDefinitionCollection(App& app) : + Node(app, "/redfish/v1/TelemetryService/MetricDefinitions") + { + entityPrivileges = { @@ -140,8 +144,8 @@ index 0000000..837a068 + } + + private: -+ void doGet(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ void doGet(crow::Response& res, const crow::Request&, ++ const std::vector<std::string>&) override + { + res.jsonValue["@odata.type"] = "#MetricDefinitionCollection." + "MetricDefinitionCollection"; @@ -165,7 +169,7 @@ index 0000000..837a068 + retrieveUriToDbusMap( + chassisName, sensorNode.data(), + [asyncResp, collectionReduce]( -+ const boost::beast::http::status status, ++ const boost::beast::http::status, + const boost::container::flat_map< + std::string, std::string>& uriToDbus) { + *collectionReduce += uriToDbus; @@ -219,7 +223,7 @@ index 0000000..837a068 +class MetricDefinition : public Node +{ + public: -+ MetricDefinition(CrowApp& app) : ++ MetricDefinition(App& app) : + Node(app, std::string(telemetry::metricDefinitionUri) + "<str>/", + std::string()) + { @@ -233,7 +237,7 @@ index 0000000..837a068 + } + + private: -+ void doGet(crow::Response& res, const crow::Request& req, ++ void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>& params) override + { + auto asyncResp = std::make_shared<AsyncResp>(res); @@ -280,7 +284,7 @@ index 0000000..837a068 + retrieveUriToDbusMap( + chassisName, sensorNode.data(), + [asyncResp, definitionGather]( -+ const boost::beast::http::status status, ++ const boost::beast::http::status, + const boost::container::flat_map< + std::string, std::string>& uriToDbus) { + *definitionGather += uriToDbus; @@ -365,7 +369,7 @@ index 0000000..837a068 + +} // namespace redfish diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp -index 877e7f1..be72b18 100644 +index 768cce9..bcb0d3e 100644 --- a/redfish-core/lib/metric_report.hpp +++ b/redfish-core/lib/metric_report.hpp @@ -91,6 +91,9 @@ class MetricReport : public Node @@ -462,10 +466,10 @@ index 877e7f1..be72b18 100644 "xyz.openbmc_project.MonitoringService", reportPath, "xyz.openbmc_project.MonitoringService.Report"); diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp -index f12bbe0..1fa1009 100644 +index 567cb0c..2f7f70b 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp -@@ -53,20 +53,39 @@ static constexpr std::string_view thermal = "Thermal"; +@@ -54,20 +54,39 @@ static constexpr std::string_view thermal = "Thermal"; namespace dbus { @@ -518,7 +522,7 @@ index f12bbe0..1fa1009 100644 /** diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index a410700..79e4154 100644 +index b849781..efbef6e 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp @@ -52,6 +52,8 @@ class TelemetryService : public Node diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Fix-MetricReport-timestamp-for-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Fix-MetricReport-timestamp-for-EventService.patch deleted file mode 100644 index 75d49b6d6..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Fix-MetricReport-timestamp-for-EventService.patch +++ /dev/null @@ -1,78 +0,0 @@ -From b71f087a173c36a16526156fa34581673e2b860c Mon Sep 17 00:00:00 2001 -From: "Wludzik, Jozef" <jozef.wludzik@intel.com> -Date: Fri, 24 Jul 2020 17:05:38 +0200 -Subject: [PATCH 6/6] Fix MetricReport timestamp for EventService - -Changed MetricReport timestamp type from std::string to int32_t. - -Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> -Change-Id: I0a52b6963e7bedda89a216256f64764cd8799bf1 ---- - redfish-core/include/event_service_manager.hpp | 23 +++++++++++++---------- - 1 file changed, 13 insertions(+), 10 deletions(-) - -diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index d2f4f2a..dc04ccb 100644 ---- a/redfish-core/include/event_service_manager.hpp -+++ b/redfish-core/include/event_service_manager.hpp -@@ -38,7 +38,7 @@ namespace redfish - { - - using ReadingsObjType = -- std::vector<std::tuple<std::string, std::string, double, std::string>>; -+ std::vector<std::tuple<std::string, std::string, double, int32_t>>; - using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>; - - static constexpr const char* eventFormatType = "Event"; -@@ -532,10 +532,12 @@ class Subscription - metricValuesArray.push_back({}); - nlohmann::json& entry = metricValuesArray.back(); - -- entry = {{"MetricId", std::get<0>(it)}, -- {"MetricProperty", std::get<1>(it)}, -- {"MetricValue", std::to_string(std::get<2>(it))}, -- {"Timestamp", std::get<3>(it)}}; -+ auto& [id, property, value, timestamp] = it; -+ -+ entry = {{"MetricId", id}, -+ {"MetricProperty", property}, -+ {"MetricValue", value}, -+ {"Timestamp", crow::utility::getDateTime(timestamp)}}; - } - - nlohmann::json msg = { -@@ -1266,7 +1268,7 @@ class EventServiceManager - [idStr{std::move(idStr)}]( - const boost::system::error_code ec, - boost::container::flat_map< -- std::string, std::variant<std::string, ReadingsObjType>>& -+ std::string, std::variant<int32_t, ReadingsObjType>>& - resp) { - if (ec) - { -@@ -1275,8 +1277,8 @@ class EventServiceManager - return; - } - -- const std::string* timestampPtr = -- std::get_if<std::string>(&resp["Timestamp"]); -+ const int32_t* timestampPtr = -+ std::get_if<int32_t>(&resp["Timestamp"]); - if (!timestampPtr) - { - BMCWEB_LOG_DEBUG << "Failed to Get timestamp."; -@@ -1303,8 +1305,9 @@ class EventServiceManager - std::shared_ptr<Subscription> entry = it.second; - if (entry->eventFormatType == metricReportFormatType) - { -- entry->filterAndSendReports(idStr, *timestampPtr, -- *readingsPtr); -+ entry->filterAndSendReports( -+ idStr, crow::utility::getDateTime(*timestampPtr), -+ *readingsPtr); - } - } - }, --- -2.16.6 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend index 5a44eec78..80005f5cd 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,6 +1,5 @@ -# todo(james) remove nobranch SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "6964c9820ad101d6fc30badd1ae353efea3dd094" +SRCREV = "a8fe54f09be1deefc119d8dcf100da922496d46d" DEPENDS += "boost-url" @@ -12,14 +11,10 @@ USERADD_PARAM_${PN} = "-r -s /usr/sbin/nologin -d /home/bmcweb -m -G shadow bmcw GROUPADD_PARAM_${PN} = "web; redfish " -SRC_URI += "file://0001-Firmware-update-support-for-StandBySpare.patch \ +SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0002-Use-chip-id-based-UUID-for-Service-Root.patch \ - file://0003-bmcweb-changes-for-setting-ApplyOptions-ClearCfg.patch \ - file://0004-Remove-QueryString.patch \ file://0004-bmcweb-handle-device-or-resource-busy-exception.patch \ file://0005-EventService-https-client-support.patch \ - file://0005-VirtualMedia-fixes-for-Redfish-Service-Validator.patch \ - file://0006-Fix-Image-and-ImageName-values-in-schema.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details @@ -28,24 +23,24 @@ SRC_URI += "file://telemetry/0001-Redfish-TelemetryService-schema-implementation file://telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch \ file://telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch \ file://telemetry/0005-Add-support-for-MetricDefinition-scheme.patch \ - file://telemetry/0006-Fix-MetricReport-timestamp-for-EventService.patch \ " # Temporary fix: Move it to service file do_install_append() { install -d ${D}/var/lib/bmcweb + install -d ${D}/etc/ssl/certs/authority } # Enable PFR support -EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE=ON', '', d)}" +EXTRA_OEMESON += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-Dredfish-provisioning-feature=enabled', '', d)}" # Enable NBD proxy embedded in bmcweb -EXTRA_OECMAKE += " -DBMCWEB_ENABLE_VM_NBDPROXY=ON" +EXTRA_OEMESON += " -Dvm-nbdproxy=enabled" # Disable dependency on external nbd-proxy application -EXTRA_OECMAKE += " -DBMCWEB_ENABLE_VM_WEBSOCKET=OFF" +EXTRA_OEMESON += " -Dvm-websocket=disabled" RDEPENDS_${PN}_remove += "jsnbd" # Enable Validation unsecure based on IMAGE_FEATURES -EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" +EXTRA_OEMESON += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-Dvalidate-unsecure-feature=enabled', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Modify-Get-Lan-Configuration-IP-Address-Source-to-us.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Modify-Get-Lan-Configuration-IP-Address-Source-to-us.patch deleted file mode 100644 index 7e3f92dbc..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Modify-Get-Lan-Configuration-IP-Address-Source-to-us.patch +++ /dev/null @@ -1,231 +0,0 @@ -From 8e9fba263179ccc87be7212c7dbd87cd7a37ac30 Mon Sep 17 00:00:00 2001 -From: Johnathan Mantey <johnathanx.mantey@intel.com> -Date: Thu, 14 Nov 2019 11:24:19 -0800 -Subject: [PATCH] Modify Get Lan Configuration IP Address Source to use correct - DBus DHCPEnabled type - -The Get/Set Lan Configuration "IP Address Source" subcommand got -broken by phosphor-dbus-interfaces commit 12162be - -12162be changed the DBus DHCPEnabled type from boolean to enum -type. The Get LAN Configuration IP address Source IPMI command did not -get changed to an enum type prior to 12162be being merged. This commit -retroactively updates the boolean type to enum type. - -Tested: - -ipmitool raw 0xc 2 3 4 0 0 # returns correct state -ipmitool raw 0xc 1 3 4 1 # changes DCHP to Static -ipmitool raw 0xc 1 3 4 2 # returns Static to DHCP - -Assigned a static address via Redfish and tested using: -ipmitool raw 0xc 2 3 4 0 0 # returns correct state - -Returned the NIC to use DHCP via Redfish and tested using: -ipmitool raw 0xc 2 3 4 0 0 # returns correct state - -Change-Id: Ia66f7fcf3d5ad0a383b06658b18e8ce2b282e052 -Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com> ---- - transporthandler.cpp | 97 ++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 79 insertions(+), 18 deletions(-) - -diff --git a/transporthandler.cpp b/transporthandler.cpp -index 16ce2b2..ccc2a97 100644 ---- a/transporthandler.cpp -+++ b/transporthandler.cpp -@@ -109,6 +109,18 @@ constexpr auto INTF_NEIGHBOR_CREATE_STATIC = - constexpr auto INTF_VLAN = "xyz.openbmc_project.Network.VLAN"; - constexpr auto INTF_VLAN_CREATE = "xyz.openbmc_project.Network.VLAN.Create"; - -+static constexpr auto dhcpv4v6 = -+ "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.both"; -+static constexpr auto dhcpv6 = -+ "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.v6"; -+static constexpr auto dhcpv4 = -+ "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.v4"; -+static constexpr auto dhcpoff = -+ "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.none"; -+ -+static std::array<const char*, 4> dhcpEnumerations = {dhcpv4v6, dhcpv4, dhcpv6, -+ dhcpoff}; -+ - /** @brief Generic paramters for different address families */ - template <int family> - struct AddrFamily -@@ -456,25 +468,63 @@ auto channelCall(uint8_t channel, Args&&... args) - * - * @param[in] bus - The bus object used for lookups - * @param[in] params - The parameters for the channel -- * @return True if DHCP is enabled, false otherwise -+ * @return string containing an enumerated value -+ * constexpr's dhcpv4v6, dhcpv4, dhcpv6, and dhcpoff - */ --bool getDHCPProperty(sdbusplus::bus::bus& bus, const ChannelParams& params) -+std::string getDHCPProperty(sdbusplus::bus::bus& bus, -+ const ChannelParams& params) - { -- return std::get<bool>(getDbusProperty( -+ return std::get<std::string>(getDbusProperty( - bus, params.service, params.logicalPath, INTF_ETHERNET, "DHCPEnabled")); - } - - /** @brief Sets the system value for DHCP on the given interface - * -- * @param[in] bus - The bus object used for lookups -- * @param[in] params - The parameters for the channel -- * @param[in] on - Whether or not to enable DHCP -+ * @param[in] bus - The bus object used for lookups -+ * @param[in] params - The parameters for the channel -+ * @param[in] setting - DHCP state to assign (none, v4, v6, both) - */ - void setDHCPProperty(sdbusplus::bus::bus& bus, const ChannelParams& params, -- bool on) -+ const std::string& setting) - { -+ auto it = dhcpEnumerations.begin(); -+ while (it != dhcpEnumerations.end()) -+ { -+ if (*it == setting) -+ { -+ break; -+ } -+ it++; -+ } -+ if (it == dhcpEnumerations.end()) -+ { -+ log<level::ERR>("Invalid DHCP setting.", -+ entry("Requested DHCP mode=%s", setting.c_str())); -+ elog<InternalFailure>(); -+ } -+ -+ std::string dhcp = getDHCPProperty(bus, params); -+ std::string nextDhcp{}; -+ -+ if (((dhcp == dhcpv4) && (setting == dhcpv6)) || -+ ((dhcp == dhcpv6) && (setting == dhcpv4))) -+ { -+ // DHCP is enabled independently for IPv4 and IPv6. If IPv4 -+ // DHCP is enabled, and a request to add IPv6 is received, -+ // change the DHCPEnabled enum to "both" active. The same -+ // logic is applied if IPV6 is already enabled, and an IPv4 -+ // enable request is made. -+ nextDhcp = dhcpv4v6; -+ } -+ else -+ { -+ // "both" enabled -> ipv4 only -+ // "both" enabled -> ipv6 only -+ // "ip4v", "ipv6", or "both" enabled -> no DHCP -+ nextDhcp = setting; -+ } - setDbusProperty(bus, params.service, params.logicalPath, INTF_ETHERNET, -- "DHCPEnabled", on); -+ "DHCPEnabled", nextDhcp); - } - - /** @brief Converts a human readable MAC string into MAC bytes -@@ -1113,7 +1163,7 @@ void deconfigureChannel(sdbusplus::bus::bus& bus, ChannelParams& params) - } - - // Clear out any settings on the lower physical interface -- setDHCPProperty(bus, params, false); -+ setDHCPProperty(bus, params, dhcpoff); - } - - /** @brief Creates a new VLAN on the specified interface -@@ -1401,7 +1451,8 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - } - case LanParam::IP: - { -- if (channelCall<getDHCPProperty>(channel)) -+ std::string dhcpSetting = channelCall<getDHCPProperty>(channel); -+ if ((dhcpSetting == dhcpv4) || (dhcpSetting == dhcpv4v6)) - { - return responseCommandNotAvailable(); - } -@@ -1431,7 +1482,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - { - case IPSrc::DHCP: - { -- channelCall<setDHCPProperty>(channel, true); -+ // The IPSrc IPMI command is only for IPv4 -+ // management. Modifying IPv6 state is done using -+ // a completely different Set LAN Configuration -+ // subcommand. -+ channelCall<setDHCPProperty>(channel, dhcpv4); - return responseSuccess(); - } - case IPSrc::Unspecified: -@@ -1439,7 +1494,7 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - case IPSrc::BIOS: - case IPSrc::BMC: - { -- channelCall<setDHCPProperty>(channel, false); -+ channelCall<setDHCPProperty>(channel, dhcpoff); - return responseSuccess(); - } - } -@@ -1464,7 +1519,8 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - } - case LanParam::SubnetMask: - { -- if (channelCall<getDHCPProperty>(channel)) -+ std::string dhcpSetting = channelCall<getDHCPProperty>(channel); -+ if ((dhcpSetting == dhcpv4) || (dhcpSetting == dhcpv4v6)) - { - return responseCommandNotAvailable(); - } -@@ -1481,7 +1537,8 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - } - case LanParam::Gateway1: - { -- if (channelCall<getDHCPProperty>(channel)) -+ std::string dhcpSetting = channelCall<getDHCPProperty>(channel); -+ if ((dhcpSetting == dhcpv4) || (dhcpSetting == dhcpv4v6)) - { - return responseCommandNotAvailable(); - } -@@ -1606,7 +1663,8 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - return responseReqDataLenInvalid(); - } - std::bitset<8> expected; -- if (channelCall<getDHCPProperty>(channel)) -+ std::string dhcp = channelCall<getDHCPProperty>(channel); -+ if ((dhcp == dhcpv4v6) || (dhcp == dhcpv6)) - { - expected[IPv6RouterControlFlag::Dynamic] = 1; - } -@@ -1756,7 +1814,8 @@ RspType<message::Payload> getLan(uint4_t channelBits, uint3_t, bool revOnly, - case LanParam::IPSrc: - { - auto src = IPSrc::Static; -- if (channelCall<getDHCPProperty>(channel)) -+ std::string dhcp = channelCall<getDHCPProperty>(channel); -+ if ((dhcp == dhcpv4) || (dhcp == dhcpv4v6)) - { - src = IPSrc::DHCP; - } -@@ -1877,7 +1936,8 @@ RspType<message::Payload> getLan(uint4_t channelBits, uint3_t, bool revOnly, - case LanParam::IPv6RouterControl: - { - std::bitset<8> control; -- if (channelCall<getDHCPProperty>(channel)) -+ std::string dhcp = channelCall<getDHCPProperty>(channel); -+ if ((dhcp == dhcpv4v6) || (dhcp == dhcpv6)) - { - control[IPv6RouterControlFlag::Dynamic] = 1; - } -@@ -1891,7 +1951,8 @@ RspType<message::Payload> getLan(uint4_t channelBits, uint3_t, bool revOnly, - case LanParam::IPv6StaticRouter1IP: - { - in6_addr gateway{}; -- if (!channelCall<getDHCPProperty>(channel)) -+ std::string dhcp = channelCall<getDHCPProperty>(channel); -+ if ((dhcp == dhcpv4) || (dhcp == dhcpoff)) - { - gateway = - channelCall<getGatewayProperty<AF_INET6>>(channel).value_or( --- -2.24.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0053-Fix-keep-looping-issue-when-entering-OS.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0053-Fix-keep-looping-issue-when-entering-OS.patch index 903ae96a7..7a7fd0859 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0053-Fix-keep-looping-issue-when-entering-OS.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0053-Fix-keep-looping-issue-when-entering-OS.patch @@ -23,7 +23,7 @@ diff --git a/host-cmd-manager.cpp b/host-cmd-manager.cpp index f3aba7f..465eb81 100644 --- a/host-cmd-manager.cpp +++ b/host-cmd-manager.cpp -@@ -26,6 +26,8 @@ constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper"; +@@ -23,6 +23,8 @@ namespace command constexpr auto HOST_STATE_PATH = "/xyz/openbmc_project/state/host0"; constexpr auto HOST_STATE_INTERFACE = "xyz.openbmc_project.State.Host"; constexpr auto HOST_TRANS_PROP = "RequestedHostTransition"; @@ -32,7 +32,7 @@ index f3aba7f..465eb81 100644 // For throwing exceptions using namespace phosphor::logging; -@@ -106,6 +108,20 @@ void Manager::clearQueue() +@@ -103,6 +105,20 @@ void Manager::clearQueue() // `false` indicating Failure std::get<CallBack>(command)(ipmiCmdData, false); } @@ -53,28 +53,37 @@ index f3aba7f..465eb81 100644 } // Called for alerting the host -@@ -115,9 +131,6 @@ void Manager::checkQueueAndAlertHost() +@@ -112,9 +128,7 @@ void Manager::checkQueueAndAlertHost() { log<level::DEBUG>("Asserting SMS Attention"); +- std::string HOST_IPMI_SVC("org.openbmc.HostIpmi"); - std::string IPMI_PATH("/org/openbmc/HostIpmi/1"); - std::string IPMI_INTERFACE("org.openbmc.HostIpmi"); -- - auto host = ::ipmi::getService(this->bus, IPMI_INTERFACE, IPMI_PATH); ++ auto host = ::ipmi::getService(this->bus, IPMI_INTERFACE, IPMI_PATH); // Start the timer for this transaction -@@ -131,9 +144,8 @@ void Manager::checkQueueAndAlertHost() + auto time = std::chrono::duration_cast<std::chrono::microseconds>( +@@ -127,12 +141,13 @@ void Manager::checkQueueAndAlertHost() return; } - auto method = -- this->bus.new_method_call(host.c_str(), IPMI_PATH.c_str(), +- this->bus.new_method_call(HOST_IPMI_SVC.c_str(), IPMI_PATH.c_str(), - IPMI_INTERFACE.c_str(), "setAttention"); +- auto reply = this->bus.call(method); +- +- if (reply.is_method_error()) + auto method = this->bus.new_method_call(host.c_str(), IPMI_PATH, + IPMI_INTERFACE, "setAttention"); - auto reply = this->bus.call(method); - - if (reply.is_method_error()) ++ try ++ { ++ auto reply = this->bus.call(method); ++ } ++ catch (const std::exception&) + { + log<level::ERR>("Error in setting SMS attention"); + elog<InternalFailure>(); -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0056-add-SetInProgress-to-get-set-boot-option-cmd.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0056-add-SetInProgress-to-get-set-boot-option-cmd.patch index 987e61448..862e9baa8 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0056-add-SetInProgress-to-get-set-boot-option-cmd.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0056-add-SetInProgress-to-get-set-boot-option-cmd.patch @@ -1,79 +1,76 @@ -From f9f260391f099b4e67999f9d4ca05cbf9b422baf Mon Sep 17 00:00:00 2001 -From: "Jia, chunhui" <chunhui.jia@linux.intel.com> -Date: Tue, 19 Mar 2019 16:09:06 +0800 -Subject: [PATCH] add SetInProgress to get/set boot option cmd +From d5cfc5a0aaa50cc94054886e5cb7be25ef167c71 Mon Sep 17 00:00:00 2001 +From: huanghe <he.huang@intel.com> +Date: Sat, 10 Oct 2020 14:40:00 +0800 +Subject: [PATCH 7/7] Add set in progress paramter to set/get boot option + command -It is required by BIOS. BIOS will check setinprogress first. -If this flag is not supported, BIOS will bypass all boot -option flow. - -Change-Id: Ibb0501ea5bc36c4f1f72339efef03724dd4e613f -Signed-off-by: Jia, chunhui <chunhui.jia@linux.intel.com> -Signed-off-by: Yong Li <yong.b.li@linux.intel.com> +Signed-off-by: huanghe <he.huang@intel.com> --- - chassishandler.cpp | 28 +++++++++++++++++++++++++++- + chassishandler.cpp | 34 ++++++++++++++++++++++++++++++++++ chassishandler.hpp | 3 +++ - 2 files changed, 30 insertions(+), 1 deletion(-) + 2 files changed, 37 insertions(+) diff --git a/chassishandler.cpp b/chassishandler.cpp -index 305897b..ee23845 100644 +index f043340..322aa9e 100644 --- a/chassishandler.cpp +++ b/chassishandler.cpp -@@ -1399,6 +1399,10 @@ static ipmi_ret_t setBootMode(const Mode::Modes& mode) - return IPMI_CC_OK; +@@ -1564,6 +1564,10 @@ static ipmi::Cc setBootMode(const Mode::Modes& mode) + return ipmi::ccSuccess; } +static constexpr uint8_t setComplete = 0x0; +static constexpr uint8_t setInProgress = 0x1; +static uint8_t transferStatus = setComplete; + - ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - ipmi_request_t request, - ipmi_response_t response, -@@ -1413,11 +1417,21 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - get_sys_boot_options_t* reqptr = (get_sys_boot_options_t*)request; + /** @brief implements the Get Chassis system boot option + * @param bootOptionParameter - boot option parameter selector + * @param reserved1 - reserved bit +@@ -1598,6 +1602,14 @@ ipmi::RspType<ipmi::message::Payload> + IpmiValue bootOption = ipmiDefault; -+ if (reqptr->parameter == -+ static_cast<uint8_t>(BootOptionParameter::SET_IN_PROGRESS)) ++ ++ if (static_cast<uint8_t>(bootOptionParameter) == ++ static_cast<uint8_t>(BootOptionParameter::setInProgress)) + { -+ *data_len = -+ static_cast<uint8_t>(BootOptionResponseSize::SET_IN_PROGRESS); -+ resp->version = SET_PARM_VERSION; -+ resp->parm = static_cast<uint8_t>(BootOptionParameter::SET_IN_PROGRESS); -+ resp->data[0] = transferStatus; -+ return IPMI_CC_OK; ++ response.pack(bootOptionParameter,reserved1,transferStatus); ++ return ipmi::responseSuccess(std::move(response)); + } + - std::memset(resp, 0, sizeof(*resp)); - resp->version = SET_PARM_VERSION; - resp->parm = 5; - resp->data[0] = SET_PARM_BOOT_FLAGS_VALID_ONE_TIME; -- /* * Parameter #5 means boot flags. Please refer to 28.13 of ipmi doc. * This is the only parameter used by petitboot. -@@ -1553,6 +1567,18 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - // This IPMI command does not have any resposne data - *data_len = 0; +@@ -1719,6 +1731,28 @@ ipmi::RspType<> ipmiChassisSetSysBootOptions(ipmi::Context::ptr ctx, + using namespace boot_options; + ipmi::Cc rc; -+ if (reqptr->parameter == -+ static_cast<uint8_t>(BootOptionParameter::SET_IN_PROGRESS)) ++ if (parameterSelector == ++ static_cast<uint7_t>(BootOptionParameter::setInProgress)) + { ++ uint2_t setInProgressFlag; ++ uint6_t rsvd; ++ if (data.unpack(setInProgressFlag,rsvd) != 0 || ++ !data.fullyUnpacked()) ++ { ++ return ipmi::responseReqDataLenInvalid(); ++ } ++ if (rsvd) ++ { ++ return ipmi::responseInvalidFieldRequest(); ++ } + if ((transferStatus == setInProgress) && -+ (reqptr->data[0] != setComplete)) ++ ((uint8_t)setInProgressFlag != setComplete)) + { -+ return IPMI_CC_FAIL_SET_IN_PROGRESS; ++ return ipmi::response(IPMI_CC_FAIL_SET_IN_PROGRESS); + } -+ transferStatus = reqptr->data[0]; -+ return IPMI_CC_OK; ++ transferStatus = (uint8_t)setInProgressFlag; + } + /* 000101 * Parameter #5 means boot flags. Please refer to 28.13 of ipmi doc. * This is the only parameter used by petitboot. diff --git a/chassishandler.hpp b/chassishandler.hpp -index dcaf06c..353a929 100644 +index 93de2c0..5976abc 100644 --- a/chassishandler.hpp +++ b/chassishandler.hpp @@ -25,6 +25,7 @@ enum ipmi_chassis_return_codes @@ -88,18 +85,18 @@ index dcaf06c..353a929 100644 }; enum class BootOptionParameter : size_t { -+ SET_IN_PROGRESS = 0x0, - BOOT_INFO = 0x4, - BOOT_FLAGS = 0x5, - OPAL_NETWORK_SETTINGS = 0x61 ++ setInProgress= 0x0, + bootInfo = 0x4, + bootFlags = 0x5, + opalNetworkSettings = 0x61 @@ -53,6 +55,7 @@ enum class BootOptionParameter : size_t enum class BootOptionResponseSize : size_t { -+ SET_IN_PROGRESS = 3, - BOOT_FLAGS = 5, - OPAL_NETWORK_SETTINGS = 50 ++ setInProgress = 3, + bootFlags = 5, + opalNetworkSettings = 50 }; -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend index 98420b2ef..a3debae71 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -9,7 +9,6 @@ SRC_URI += "file://phosphor-ipmi-host.service \ file://0060-Move-Get-SOL-config-parameter-to-host-ipmid.patch \ file://0062-Update-IPMI-Chassis-Control-command.patch \ file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \ - file://0001-Modify-Get-Lan-Configuration-IP-Address-Source-to-us.patch \ " EXTRA_OECONF_append = " --disable-i2c-whitelist-check" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/ipmb-channels.json b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/ipmb-channels.json new file mode 100644 index 000000000..2d77aa6e7 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/ipmb-channels.json @@ -0,0 +1,22 @@ +{ + "channels": [ + { + "type": "me", + "slave-path": "/dev/ipmb-5", + "bmc-addr": 32, + "remote-addr": 44 + }, + { + "type": "ipmb", + "slave-path": "/dev/ipmb-13", + "bmc-addr": 32, + "remote-addr": 32 + }, + { + "type": "slot-ipmb", + "slave-path": "/dev/ipmb-6", + "bmc-addr": 18, + "remote-addr": 176 + } + ] +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend index dcbba98e7..cfc1ae909 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend @@ -1,4 +1,11 @@ SRC_URI = "git://github.com/openbmc/ipmbbridge.git" -SRCREV = "a86059348fe133725f4616f3e46ff0d555db4039" +SRCREV = "3e07b9ea353b794f9ef666172265ecc056e5cd4d" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI += "file://0001-Add-dbus-method-SlotIpmbRequest.patch" +SRC_URI += "file://0001-Add-dbus-method-SlotIpmbRequest.patch \ + file://ipmb-channels.json \ + " + +do_install_append() { + install -D ${WORKDIR}/ipmb-channels.json \ + ${D}/usr/share/ipmbbridge +}
\ No newline at end of file diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend index a3dceb01e..0aa63ca03 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend @@ -11,7 +11,7 @@ SMM_DEVICE = "ipmi_kcs4" SYSTEMD_SERVICE_${PN}_append = " ${PN}@${SMM_DEVICE}.service " SRC_URI = "git://github.com/openbmc/kcsbridge.git" -SRCREV = "d8594e9a62feb8b2fac789159966b4782b4aa31e" +SRCREV = "4a4d1d03d99fabe089e649aa226ad4c61e71684e" SRC_URI += "file://99-ipmi-kcs.rules" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch index dc7f7357c..5f749af45 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch @@ -1,4 +1,4 @@ -From 97c21a556702a0d65096b30c07ef23f15cb6a7d9 Mon Sep 17 00:00:00 2001 +From e5ab844259f569656e95f5324f7428229dd811a7 Mon Sep 17 00:00:00 2001 From: Cheng C Yang <cheng.c.yang@intel.com> Date: Wed, 3 Jul 2019 07:39:47 +0800 Subject: [PATCH] Add dbus interface for sol commands @@ -25,18 +25,18 @@ to 0 and other properties will not reset to default value. Signed-off-by: Cheng C Yang <cheng.c.yang@intel.com> --- - command/payload_cmds.cpp | 3 ++ - command/sol_cmds.cpp | 84 ------------------------------- - sol/sol_manager.cpp | 125 +++++++++++++++++++++++++++++++++++++++++++++++ + command/payload_cmds.cpp | 3 + + command/sol_cmds.cpp | 84 -------------------------- + sol/sol_manager.cpp | 124 +++++++++++++++++++++++++++++++++++++++ sol/sol_manager.hpp | 1 + - sol_module.cpp | 6 --- - 5 files changed, 129 insertions(+), 90 deletions(-) + sol_module.cpp | 6 -- + 5 files changed, 128 insertions(+), 90 deletions(-) diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp -index c32a510..17167a7 100644 +index c8e682e..bc987c5 100644 --- a/command/payload_cmds.cpp +++ b/command/payload_cmds.cpp -@@ -34,6 +34,9 @@ std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload, +@@ -41,6 +41,9 @@ std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload, return outPayload; } @@ -47,10 +47,10 @@ index c32a510..17167a7 100644 { response->completionCode = IPMI_CC_PAYLOAD_TYPE_DISABLED; diff --git a/command/sol_cmds.cpp b/command/sol_cmds.cpp -index a8fa410..804b5ea 100644 +index fda3e91..a1e820f 100644 --- a/command/sol_cmds.cpp +++ b/command/sol_cmds.cpp -@@ -65,90 +65,6 @@ void activating(uint8_t payloadInstance, uint32_t sessionID) +@@ -71,90 +71,6 @@ void activating(uint8_t payloadInstance, uint32_t sessionID) outPayload); } @@ -142,14 +142,12 @@ index a8fa410..804b5ea 100644 const message::Handler& handler) { diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp -index 2046fe4..eedd28a 100644 +index a118457..55d269a 100644 --- a/sol/sol_manager.cpp +++ b/sol/sol_manager.cpp -@@ -12,7 +12,13 @@ - #include <boost/asio/write.hpp> - #include <chrono> +@@ -14,6 +14,11 @@ #include <cmath> -+#include <ipmid/utils.hpp> + #include <ipmid/utils.hpp> #include <phosphor-logging/log.hpp> +#include <sdbusplus/message/types.hpp> + @@ -159,7 +157,7 @@ index 2046fe4..eedd28a 100644 namespace sol { -@@ -93,6 +99,125 @@ void Manager::stopHostConsole() +@@ -103,6 +108,125 @@ void Manager::stopHostConsole() } } @@ -286,10 +284,10 @@ index 2046fe4..eedd28a 100644 session::SessionID sessionID) { diff --git a/sol/sol_manager.hpp b/sol/sol_manager.hpp -index 5d96890..00da9fb 100644 +index 5b48add..4e797d4 100644 --- a/sol/sol_manager.hpp +++ b/sol/sol_manager.hpp -@@ -248,6 +248,7 @@ class Manager +@@ -252,6 +252,7 @@ class Manager * @return 0 on success and errno on failure. */ int writeConsoleSocket(const std::vector<uint8_t>& input) const; @@ -315,5 +313,5 @@ index 8200e74..2b1fb46 100644 {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x22}, -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend index 10d0d8c94..4c00421a9 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend @@ -3,7 +3,7 @@ inherit useradd # TODO: This should be removed, once up-stream bump up # issue is resolved SRC_URI += "git://github.com/openbmc/phosphor-net-ipmid" -SRCREV = "ecb32fbc699aaacee4d6a42bb986575c4c5780dc" +SRCREV = "07bb095158b39cedb49dae0972e489a6a2776faf" USERADD_PACKAGES = "${PN}" # add a group called ipmi diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb index 36d65fd72..dfae096c6 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb @@ -3,7 +3,7 @@ DESCRIPTION = "The Node Manager Proxy provides a simple interface for communicat with Management Engine via IPMB" SRC_URI = "git://github.com/Intel-BMC/node-manager;protocol=ssh" -SRCREV = "de212d839bb515939bd089c66072e4fcf33b8653" +SRCREV = "403434f80e6a6c476516848dde2512b37f7ec5d8" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/leds/intel-led-manager-config/led.yaml b/meta-openbmc-mods/meta-common/recipes-phosphor/leds/intel-led-manager-config/led.yaml index 533df68a4..1605b8e6b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/leds/intel-led-manager-config/led.yaml +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/leds/intel-led-manager-config/led.yaml @@ -46,3 +46,35 @@ cpu1_fault: cpu1fault: Action: 'On' +fan1_fault: + fan1_fault: + Action: 'On' + +fan2_fault: + fan2_fault: + Action: 'On' + +fan3_fault: + fan3_fault: + Action: 'On' + +fan4_fault: + fan4_fault: + Action: 'On' + +fan5_fault: + fan5_fault: + Action: 'On' + +fan6_fault: + fan6_fault: + Action: 'On' + +fan7_fault: + fan7_fault: + Action: 'On' + +fan8_fault: + fan8_fault: + Action: 'On' + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-manager/multi-node-manager.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-manager/multi-node-manager.bb deleted file mode 100644 index f6a6b1f1b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-manager/multi-node-manager.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "Multi node manager" -DESCRIPTION = "Daemon to handle chassis level shared resources on multi-node platform" - -SRC_URI = "git://github.com/Intel-BMC/multi-node-manager.git;protocol=ssh" -SRCREV = "34d959285a3ca12c4bfefa4040d82d571c78843b" - -S = "${WORKDIR}/git/" - -PV = "0.1+git${SRCPV}" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" - -SYSTEMD_SERVICE_${PN} = "multi-node-manager.service" - -DEPENDS = "boost sdbusplus phosphor-logging i2c-tools" -inherit cmake systemd diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend new file mode 100644 index 000000000..291bec85c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend @@ -0,0 +1,3 @@ +SRC_URI = "git://github.com/openbmc/peci-pcie" + +SRCREV = "bce86a63643e1d7cdf6d42e143738013ee47a8da" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb index 48f740637..f1327dbbd 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI = "git://github.com/openbmc/phosphor-u-boot-env-mgr.git;protocol=ssh" -SRCREV = "7a36277b6fdf33a554a4f9e2258e39d1696b00c2" +SRCREV = "6707fc81f48634599df3fce764578d6d9661881f" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.U_Boot.Environment.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb index 43f0785e5..8f8d48a4d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp_intel" DESCRIPTION = "Implementation of MCTP(DMTF DSP0236)" SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=ssh" -SRCREV = "467717ed557169e86be2c694e616fbfa9f5982c7" +SRCREV = "2d5d44bbf7bf1f270ce5bebd90efd47579ac7120" S = "${WORKDIR}/git/" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb new file mode 100644 index 000000000..c1c06eba8 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb @@ -0,0 +1,18 @@ +SUMMARY = "libpldm_intel" +DESCRIPTION = "Provides encode/decode APIs for PLDM specifications" + +SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" +SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec" + +S = "${WORKDIR}/git/libpldm_intel/" + +PV = "1.0+git${SRCPV}" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +inherit cmake + +DEPENDS += " \ + gtest \ + " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb index 98d2d11e4..16975b9ff 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "1bc2bddcff7104cc9040e9b2688761b2d9b32099" +SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec" S = "${WORKDIR}/git/mctp_emulator/" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb new file mode 100644 index 000000000..0d779d4e3 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb @@ -0,0 +1,28 @@ +SUMMARY = "MCTP Wrapper Library" +DESCRIPTION = "Implementation of MCTP Wrapper Library" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" + +SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" +SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec" + +S = "${WORKDIR}/git/mctp_wrapper/" + +PV = "1.0+git${SRCPV}" + +inherit cmake systemd + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +DEPENDS += " \ + libmctp-intel \ + systemd \ + sdbusplus \ + phosphor-logging \ + gtest \ + boost \ + phosphor-dbus-interfaces \ + " + +EXTRA_OECMAKE += "-DYOCTO_DEPENDENCIES=ON" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb index 740fd460e..d4c50b872 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb @@ -2,15 +2,17 @@ SUMMARY = "MCTP Daemon" DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" +LIC_FILES_CHKSUM = "file://${PN}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "1bc2bddcff7104cc9040e9b2688761b2d9b32099" +SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec" -S = "${WORKDIR}/git/mctpd/" +S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" +OECMAKE_SOURCEPATH = "${S}/${PN}" + inherit cmake systemd FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" @@ -26,9 +28,7 @@ DEPENDS += " \ nlohmann-json \ gtest \ phosphor-dbus-interfaces \ + udev \ " -SMBUS_BINDING = "smbus" - FILES_${PN} += "${systemd_system_unitdir}/xyz.openbmc_project.mctpd@.service" -SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.mctpd@${SMBUS_BINDING}.service" FILES_${PN} += "/usr/share/mctp/mctp_config.json" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb new file mode 100644 index 000000000..5f854ba20 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb @@ -0,0 +1,30 @@ +SUMMARY = "PLDM Requester Stack" +DESCRIPTION = "Implementation of PLDM specifications" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI += "git://github.com/Intel-BMC/pmci.git;protocol=ssh" +SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec" + +S = "${WORKDIR}/git/pldmd/" + +PV = "1.0+git${SRCPV}" + +inherit cmake systemd + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +DEPENDS += " \ + libpldm-intel \ + mctp-wrapper \ + systemd \ + sdbusplus \ + phosphor-logging \ + gtest \ + boost \ + phosphor-dbus-interfaces \ + " + +FILES_${PN} += "${systemd_system_unitdir}/xyz.openbmc_project.pldmd.service" +SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.pldmd.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb new file mode 100644 index 000000000..91d50d064 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb @@ -0,0 +1,23 @@ +SUMMARY = "PMCI Launcher" +DESCRIPTION = "Support to launch pmci services on-demand" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" + +SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" +SRCREV = "108ce1250a9836a8751394ee3a4443ae821de3ec" + +S = "${WORKDIR}/git/pmci_launcher/" + +PV = "1.0+git${SRCPV}" + +inherit cmake systemd + +DEPENDS += " \ + systemd \ + sdbusplus \ + phosphor-logging \ + boost \ + " +FILES_${PN} += "${systemd_system_unitdir}/xyz.openbmc_project.pmci-launcher.service" +SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.pmci-launcher.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init index e954d7757..5d83d85a6 100755 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init @@ -123,7 +123,7 @@ reformat_jffs2_partition() { umount -f "$mnt" flash_eraseall "$(mtd_by_name ${mtd_name})" # remount the JFFS2 - mount -t jffs2 -o sync mtd:"$mtd_name" "$mnt" + mount -t jffs2 -o sync,ro mtd:"$mtd_name" "$mnt" if [ $? -ne 0 ]; then log "Failed to mount reformatted NV volume; system unstable" fi @@ -136,7 +136,7 @@ clear_ubenv() { # mount NV filesystem mkdir -p "$RWFS_MNT" -mount -t jffs2 -o sync mtd:"$NV_MTD" "$RWFS_MNT" +mount -t jffs2 -o sync,ro mtd:"$NV_MTD" "$RWFS_MNT" if [ $? -ne 0 ]; then log "Failed to mount NV volume; attempting recovery" reformat_jffs2_partition $NV_MTD $RWFS_MNT @@ -203,7 +203,7 @@ if ! grep -q sofs /proc/mounts; then SOFS_MTD_NUM="$(mtdnum_by_name ${SOFS_MTD})" # mount a JFFS2 on the partition - mount -t jffs2 -o sync mtd:"$SOFS_MTD" "$SOFS_MNT" + mount -t jffs2 -o sync,ro mtd:"$SOFS_MTD" "$SOFS_MNT" if [ $? -ne 0 ]; then log "Failed to mount SOFS volume; attempting recovery" reformat_jffs2_partition $SOFS_MTD $SOFS_MNT diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb index ce6cf5998..7138e8628 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/provisioning-mode-manager.git;protocol=ssh" -SRCREV = "8994b09bfe2eae4e3d18f3a4633e965bd945547f" +SRCREV = "ea03e4e87f5d5f0d873624b46ebc3deabb8d6ebe" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.RestrictionMode.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/security-manager/security-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/security-manager/security-manager_git.bb index 64201acc1..3fab0ae54 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/security-manager/security-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/security-manager/security-manager_git.bb @@ -18,7 +18,6 @@ DEPENDS += " \ systemd \ sdbusplus \ libgpiod \ - sdbusplus-native \ phosphor-logging \ boost \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend index 8ebca0b9e..6e1690252 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend @@ -1,4 +1,4 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/phosphor-sel-logger.git" -SRCREV = "25b26e162bd109b51aa09b16f26f9aa3d9d940fa" +SRCREV = "df7bc1c6951fb7dd2776008aa0b7dc6bea44bed4" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/selftest/intel-self-test_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/selftest/intel-self-test_git.bb deleted file mode 100644 index 9581619ca..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/selftest/intel-self-test_git.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "BMC Self Test service" -DESCRIPTION = "BMC Self Test service for subsystem diagnosis failure info" - -SRC_URI = "git://github.com/Intel-BMC/intel-self-test;protocol=ssh" - -PV = "1.0+git${SRCPV}" -SRCREV = "d039998ad2c55aeae4191af30e15bbd3032508c1" - -S = "${WORKDIR}/git" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" - -inherit cmake -inherit obmc-phosphor-dbus-service -inherit obmc-phosphor-systemd -inherit pkgconfig - -SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.selftest.service" - -DEPENDS += " \ - autoconf-archive-native \ - systemd \ - sdbusplus \ - sdbusplus-native \ - phosphor-logging \ - phosphor-dbus-interfaces \ - phosphor-dbus-interfaces-native \ - " - -RDEPENDS_${PN} += " \ - libsystemd \ - sdbusplus \ - phosphor-logging \ - phosphor-dbus-interfaces \ - " - -EXTRA_OECMAKE = " -DENABLE_GTEST=OFF -DCMAKE_SKIP_RPATH=ON" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/intrusionsensor-depend-on-networkd.conf b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/intrusionsensor-depend-on-networkd.conf new file mode 100644 index 000000000..6f0fd3ffc --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/intrusionsensor-depend-on-networkd.conf @@ -0,0 +1,3 @@ +[Unit] +After=systemd-networkd.service +Requires=systemd-networkd.service diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend index ac45a8114..16c88f7fc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -1,11 +1,39 @@ -SRCREV = "623723b9e827f52a05cfe2dac8b4ef5d285fb6af" +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +PROJECT_SRC_DIR := "${THISDIR}/${PN}" + +SRCREV = "3bcd823e3783bc49c1e75dec2d43a3ef54333c88" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" +SRC_URI += "\ + file://intrusionsensor-depend-on-networkd.conf \ + " + DEPENDS_append = " libgpiod libmctp" -FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" +PACKAGECONFIG += " \ + adcsensor \ + cpusensor \ + exitairtempsensor \ + fansensor \ + hwmontempsensor \ + intrusionsensor \ + ipmbsensor \ + mcutempsensor \ + psusensor \ +" + +PACKAGECONFIG[nvmesensor] = "-DDISABLE_NVME=OFF, -DDISABLE_NVME=ON" + +SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'nvmesensor', \ + 'xyz.openbmc_project.nvmesensor.service', \ + '', d)}" -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'disable-nvme-sensors', d)}" -PACKAGECONFIG[disable-nvme-sensors] = "-DDISABLE_NVME=ON, -DDISABLE_NVME=OFF" +PACKAGECONFIG_remove = "nvmesensor" -SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'disable-nvme-sensors', '', 'xyz.openbmc_project.nvmesensor.service', d)}" +do_install_append() { + svc="xyz.openbmc_project.intrusionsensor.service" + srcf="${WORKDIR}/intrusionsensor-depend-on-networkd.conf" + dstf="${D}/etc/systemd/system/${svc}.d/10-depend-on-networkd.conf" + mkdir -p "${D}/etc/systemd/system/${svc}.d" + install "${srcf}" "${dstf}" +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/service-config-manager/service-config-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/service-config-manager/service-config-manager_%.bbappend deleted file mode 100644 index c34d7af43..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/service-config-manager/service-config-manager_%.bbappend +++ /dev/null @@ -1,6 +0,0 @@ -inherit meson pkgconfig systemd -SRC_URI = "git://github.com/openbmc/service-config-manager;nobranch=1" -# Move to latest version, only when sdbusplus is bumped up -SRCREV = "0f2b1414d0dda4534008fc5eb0e939d99287c0eb" - - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb index 3fe7a1782..f41bfd6d5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb @@ -1,7 +1,7 @@ SUMMARY = "Settings" SRC_URI = "git://github.com/Intel-BMC/settings.git;protocol=ssh" -SRCREV = "5d2150656d23412c59acd4da7b9f155902f089d9" +SRCREV = "4879d875dc197a19e15227f45630a409a52330c4" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb index e27f2295c..85e3d6e8b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/special-mode-manager.git;protocol=ssh" -SRCREV = "e9bcb94f78ec9dad22bc008e1abdb18f16f39a40" +SRCREV = "024531a11dbe2bd13f2f6e59bdb41a22fce8b431" EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" @@ -19,7 +19,6 @@ SYSTEMD_SERVICE_${PN} = "specialmodemgr.service" DEPENDS += " \ systemd \ sdbusplus \ - sdbusplus-native \ phosphor-logging \ boost \ libpam \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb index cc84015f4..f44965958 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb @@ -1,13 +1,13 @@ SUMMARY = "Callback Manager" DESCRIPTION = "D-Bus daemon that registers matches that trigger method calls" -SRC_URI = "git://github.com/Intel-BMC/provingground;protocol=ssh" +SRC_URI = "git://github.com/openbmc/s2600wf-misc.git;protocol=ssh;nobranch=1" inherit cmake systemd DEPENDS = "boost sdbusplus" PV = "0.1+git${SRCPV}" -SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" +SRCREV = "291d6388e0b770e89091935bc4edc7f371874666" S = "${WORKDIR}/git/callback-manager" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend index 5733eceed..2b90b01e5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend @@ -1,6 +1,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRCREV = "73ce773e2f94fcfdeeeb9db83a3e92429ab4a663" +SRC_URI = "git://github.com/openbmc/phosphor-user-manager" +SRCREV = "703131fa01422bc28675f5d629edb98d285a1bc4" EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], '', '--disable-root_user_mgmt', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb index 2ffb40431..d6ff9f7a4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb @@ -20,10 +20,8 @@ inherit pkgconfig DEPENDS += " \ systemd \ sdbusplus \ - sdbusplus-native \ phosphor-logging \ phosphor-dbus-interfaces \ - phosphor-dbus-interfaces-native \ boost \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp index 792e564d9..bae54f335 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp @@ -20,6 +20,13 @@ #include <sys/types.h> #include <unistd.h> +#include <boost/asio/buffers_iterator.hpp> +#include <boost/asio/deadline_timer.hpp> +#include <boost/asio/io_service.hpp> +#include <boost/asio/ip/tcp.hpp> +#include <boost/asio/posix/stream_descriptor.hpp> +#include <boost/asio/read_until.hpp> +#include <boost/asio/streambuf.hpp> #include <boost/container/flat_set.hpp> #include <cassert> #include <cstdint> diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb deleted file mode 100644 index fc6e1034a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb +++ /dev/null @@ -1,24 +0,0 @@ -SUMMARY = "System watchdog" -DESCRIPTION = "BMC hardware watchdog service that is used to reset BMC \ - when unrecoverable events occurs" - -inherit allarch -inherit obmc-phosphor-systemd - -RDEPENDS_${PN} = "bash" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" - -SYSTEMD_SERVICE_${PN} += "system-watchdog.service" -SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/system-watchdog/system-watchdog.conf" - -SYSTEMD_SERVICE_${PN} += "watchdog-reset@.service" -SYSTEMD_SERVICE_${PN} += "watchdog-clear-failures.service" -SYSTEMD_SERVICE_${PN} += "watchdog-clear-failures.timer" -SRC_URI += "file://watchdog-reset.sh" - -do_install_append(){ - install -d ${D}${bindir} - install -m 0755 ${WORKDIR}/watchdog-reset.sh ${D}${bindir} -} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/obmc/system-watchdog/system-watchdog.conf b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/obmc/system-watchdog/system-watchdog.conf deleted file mode 100644 index defe830a1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/obmc/system-watchdog/system-watchdog.conf +++ /dev/null @@ -1,3 +0,0 @@ -TIMEOUT=60 -INTERVAL=10 -DEVICE=/dev/watchdog1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/system-watchdog.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/system-watchdog.service deleted file mode 100644 index 1564fda20..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/system-watchdog.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=BMC Hardware Watchdog Daemon - -[Service] -EnvironmentFile=/etc/default/obmc/system-watchdog/system-watchdog.conf -ExecStart=/sbin/watchdog -T ${{TIMEOUT}} -t ${{INTERVAL}} -F ${{DEVICE}} -KillSignal=SIGKILL - -[Install] -WantedBy=basic.target - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.service deleted file mode 100644 index 801f4ed27..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Reset BMC Hardware Watchdog Failure Count - -[Service] -ExecStart=busctl call xyz.openbmc_project.U_Boot.Environment.Manager \ - /xyz/openbmc_project/u_boot/environment/mgr \ - xyz.openbmc_project.U_Boot.Environment.Manager \ - Write ss bootfailures 0 -Type=oneshot - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.timer b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.timer deleted file mode 100644 index 1abac4326..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.timer +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Starts the clear watchdog serivce after 30 minutes - -[Timer] -OnBootSec=30min - -[Install] -WantedBy=timers.target diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh deleted file mode 100644 index 3413fdb9f..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -echo "Watchdog being started by $1" > /dev/kmsg - -if /sbin/fw_printenv bootfailures -n | grep -q 3; then - exit 0 # passed boot limit, user started again on purpose -fi - -if test -f "/tmp/nowatchdog"; then - echo "Not resetting due to nowatchdog file" > /dev/kmsg - exit 0 -fi - -echo "Log as follows:" > /dev/kmsg -journalctl -r -n 100 | while read line; do echo $line > /dev/kmsg; done - -systemctl stop system-watchdog.service -/sbin/watchdog -T 0 -F /dev/watchdog1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset@.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset@.service deleted file mode 100644 index 6b1ebc544..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset@.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Reset BMC Using Hardware Watchdog - -[Service] -ExecStart=/usr/bin/watchdog-reset.sh %i -Type=oneshot - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend index 4a188f28e..9c4a3c879 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend @@ -1,4 +1,4 @@ SRC_URI = "git://github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel2" FILESEXTRAPATHS_prepend_intel := "${THISDIR}/${PN}:" -SRCREV = "3348cfbfd54e52a795516bc4a906e128c1bc6bcf" +SRCREV = "9db94c5d0e61c6cd5935e770c14a9ad6231da497" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend new file mode 100644 index 000000000..4fffef955 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend @@ -0,0 +1,7 @@ +# Enable downstream autobump +SRC_URI = "git://github.com/openbmc/webui-vue.git" +SRCREV = "978807de2d5a11860b74f1f97dc0d915ee5c9a5e" + +do_compile_prepend() { + cp -vf ${S}/.env.intel ${S}/.env +} |