From 6c1caca70063aa707ba809a6b4695d0f0c5646f1 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Thu, 27 Feb 2020 15:57:13 -0800 Subject: Update to internal 2020-02-27 Signed-off-by: Jason M. Bills --- meta-openbmc-mods/conf/layer.conf | 2 +- .../entity-manager/CPC-Baseboard.json | 84 +- .../entity-manager/CYP-baseboard.json | 18 +- .../configuration/entity-manager/J85894-HSBP.json | 1 + .../entity-manager/TNP-baseboard.json | 58 +- .../configuration/entity-manager/WC-Baseboard.json | 493 +++++++++++- .../configuration/entity-manager/WC-Chassis.json | 455 +++++++++++ .../configuration/entity-manager/WP-Baseboard.json | 493 +++++++++++- .../configuration/entity-manager_%.bbappend | 3 +- .../classes/image_types_intel_pfr.bbclass | 2 +- .../classes/obmc-phosphor-image-common.bbclass | 4 +- .../0001-Add-ast2600-intel-as-a-new-board.patch | 93 ++- .../0004-Disable-crashdump-trigger-gpio.patch | 10 +- .../0005-Ast2600-Enable-interrupt-in-u-boot.patch | 458 +++++++++++ .../u-boot/files/0006-SPI-Quad-IO-Mode.patch | 158 ++++ .../u-boot/files/0007-Add-espi-support.patch | 83 +- .../0007-ast2600-Override-OTP-strap-settings.patch | 41 + .../u-boot/files/0009-Add-basic-GPIO-support.patch | 61 +- ...acturing-mode-physical-presence-detection.patch | 23 +- ...IPMI-commands-and-flash-support-in-u-boot.patch | 16 +- ...-PFR-platform-EXTRST-reset-mask-selection.patch | 14 +- .../files/0039-AST2500-increase-boot-speed.patch | 50 -- ...ialize-the-BMC-host-mailbox-at-reset-time.patch | 65 ++ .../u-boot/files/0041-Disabling-boot-delay.patch | 27 + .../u-boot/u-boot-aspeed-sdk_%.bbappend | 3 + .../recipes-bsp/u-boot/u-boot-aspeed_%.bbappend | 6 +- .../files/com.intel.AtScaleDebug.service | 3 +- .../recipes-core/crashdump/crashdump_git.bb | 2 +- .../recipes-core/fw-update/files/fwupd.sh | 550 +++++++------ .../recipes-core/fw-update/intel-fw-update.bb | 2 +- .../host-error-monitor/host-error-monitor_git.bb | 2 +- .../libmctp/0001-Smbus-changes-for-libmctp.patch | 28 +- .../interfaces/libmctp/libmctp-smbus.h | 4 + .../recipes-core/interfaces/libmctp/smbus.c | 13 +- .../recipes-core/interfaces/libmctp_git.bb | 2 +- .../recipes-core/ipmi/intel-ipmi-oem_%.bbappend | 3 +- .../recipes-core/ipmi/ipmi-providers.bb | 32 - .../recipes-core/libpeci/libpeci_git.bb | 2 +- .../meta-common/recipes-core/safec/safec_3.4.bb | 2 +- .../recipes-devtools/mtd-util/mtd-util.bb | 1 + .../sdbusplus/sdbusplus_%.bbappend | 2 +- .../recipes-extended/shadow/shadow/pam.d/login | 90 +++ .../recipes-extended/shadow/shadow_%.bbappend | 4 + .../libvncserver/libvncserver_%.bbappend | 2 +- .../recipes-intel/hsbp/hsbp-manager_git.bb | 2 +- .../recipes-intel/images/intel-platforms.bb | 1 + .../intel-pfr/files/pfr_manifest.json | 16 +- .../intel-pfr/intel-pfr-manager_git.bb | 2 +- .../recipes-intel/psu-manager/psu-manager.bb | 2 +- .../recipes-intel/smbios/smbios-mdrv2.bb | 2 +- ...m-dts-add-DTS-for-Intel-ast2500-platforms.patch | 40 +- ...m-dts-add-DTS-for-Intel-ast2600-platforms.patch | 36 +- ...port-link-statistics-for-the-NCSI-channel.patch | 54 -- ...021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch | 403 +++++----- .../0022-Add-AST2500-eSPI-driver.patch | 94 ++- ...c-aspeed-add-buffer-mode-transfer-support.patch | 635 +++++++++------ ...-i2c-aspeed-add-DMA-mode-transfer-support.patch | 457 ++++++----- .../0063-i2c-aspeed-add-general-call-support.patch | 20 +- .../0068-i2c-aspeed-add-H-W-timeout-support.patch | 22 +- ...add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch | 8 +- ...d-refine-HSYNC-VSYNC-polarity-setting-log.patch | 93 --- ...-Refine-initialization-flow-in-I2C-driver.patch | 18 +- ...076-media-aspeed-clear-garbage-interrupts.patch | 74 -- ...M-dts-aspeed-g6-add-USB-virtual-hub-fixup.patch | 53 -- ...dget-aspeed-add-ast2600-compatible-string.patch | 32 - .../linux-aspeed/0090-peci-cpupower-driver-1.patch | 405 ++++++++++ .../0092-SPI-Quad-IO-driver-support-AST2600.patch | 136 ++++ ...ev_int-add-quick-fix-for-raw-I2C-type-reg.patch | 37 + ...-speed-and-duplex-settings-for-the-NCSI-c.patch | 57 ++ ...x-truncated-WrEndPointConfig-MMIO-command.patch | 40 + .../recipes-kernel/linux/linux-aspeed/debug.cfg | 2 + .../recipes-kernel/linux/linux-aspeed/intel.cfg | 2 + .../recipes-kernel/linux/linux-aspeed_%.bbappend | 11 +- ...HCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch | 657 --------------- ...HCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch | 504 ++++++++++++ ...itional-use-of-ETHTOOL-features-in-the-NI.patch | 120 +++ ...e-disable-control-of-the-Network-Interfac.patch | 191 +++++ ...HCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch | 504 ++++++++++++ ...network-link-carrier-state-to-be-reported.patch | 282 +++++++ .../network/phosphor-network_%.bbappend | 9 +- .../configuration/entity-manager_%.bbappend | 2 +- .../0016-Add-DBUS-interface-of-SMBIOS-MDR-V2.patch | 227 ------ ...20-Create-dbus-interface-for-SOL-commands.patch | 76 -- ...is-power-cycle-and-reset-to-Chassis-State.patch | 40 - ...andbySpare-support-for-software-inventory.patch | 19 +- .../dbus/phosphor-dbus-interfaces_%.bbappend | 4 +- .../0007-PFR-images-support.patch | 7 +- ...-Firmware-update-support-for-StandBySpare.patch | 26 +- .../recipes-phosphor/interfaces/bmcweb_%.bbappend | 14 +- .../recipes-phosphor/ipmi/ipmitool_%.bbappend | 6 + ...Lan-Configuration-IP-Address-Source-to-us.patch | 66 +- ...xed-issue-in-setLan-command-for-IP-source.patch | 62 -- ...Fix-for-return-CC-in-setLan-command-cases.patch | 69 -- .../0009-IPv6-Network-changes.patch | 877 --------------------- .../0010-fix-get-system-GUID-ipmi-command.patch | 35 +- ...x-User-commands-require-channel-layer-lib.patch | 37 - .../0062-Update-IPMI-Chassis-Control-command.patch | 30 +- ...064-Update-provisioning-mode-filter-logic.patch | 301 ------- .../phosphor-ipmi-host/host-ipmid-whitelist.conf | 200 ----- .../phosphor-ipmi-host/transporthandler_oem.cpp | 3 +- .../ipmi/phosphor-ipmi-host_%.bbappend | 11 +- .../ipmi/phosphor-ipmi-ipmb_%.bbappend | 2 +- .../ipmi/phosphor-ipmi-net_%.bbappend | 2 +- .../ipmi/phosphor-node-manager-proxy_git.bb | 2 +- .../multi-node-nl/multi-node-nl.bb | 27 + .../multi-node-nl/multi-node-nl.target | 4 + .../multi-node-nl/nonLegacyNode.service | 9 + .../multi-node-nl/multi-node-nl/nonLegacyNode.sh | 20 + .../phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb | 2 +- .../preinit-mounts/preinit-mounts/init | 97 ++- .../prov-mode-mgr/prov-mode-mgr_git.bb | 2 +- .../security-manager/security-manager_git.bb | 2 +- .../sensors/dbus-sensors_%.bbappend | 4 +- .../recipes-phosphor/settings/settings_git.bb | 2 +- .../special-mode-mgr/special-mode-mgr_git.bb | 3 +- .../srvcfg-manager/srvcfg-manager_git.bb | 2 +- .../state/phosphor-state-manager_%.bbappend | 3 + .../state/post-code-manager_git.bb | 1 + .../recipes-phosphor/system/callback-manager.bb | 2 +- ...mems-instead-of-getgrnam_r-due-to-overlay.patch | 73 ++ .../users/phosphor-user-manager_%.bbappend | 1 + .../virtual-media/virtual-media.bb | 2 +- .../webui/phosphor-webui_%.bbappend | 2 +- .../recipes-utilities/lpc-cmds/files/lpc_cmds.c | 27 + .../recipes-utilities/lpc-cmds/files/lpc_drv.h | 1 + .../chassis/x86-power-control_%.bbappend | 2 +- .../meta-egs/conf/bblayers.conf.sample | 2 +- meta-openbmc-mods/meta-egs/conf/local.conf.sample | 4 +- .../meta-wht/conf/bblayers.conf.sample | 2 +- meta-openbmc-mods/meta-wht/conf/local.conf.sample | 4 +- .../meta-wolfpass/conf/bblayers.conf.sample | 2 +- .../meta-wolfpass/conf/local.conf.sample | 4 +- 132 files changed, 6480 insertions(+), 4430 deletions(-) create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Chassis.json create mode 100644 meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0005-Ast2600-Enable-interrupt-in-u-boot.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0006-SPI-Quad-IO-Mode.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0007-ast2600-Override-OTP-strap-settings.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0039-AST2500-increase-boot-speed.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0040-Initialize-the-BMC-host-mailbox-at-reset-time.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0041-Disabling-boot-delay.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-core/ipmi/ipmi-providers.bb create mode 100644 meta-openbmc-mods/meta-common/recipes-extended/shadow/shadow/pam.d/login create mode 100644 meta-openbmc-mods/meta-common/recipes-extended/shadow/shadow_%.bbappend delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Report-link-statistics-for-the-NCSI-channel.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0076-media-aspeed-clear-garbage-interrupts.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0082-ARM-dts-aspeed-g6-add-USB-virtual-hub-fixup.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0083-usb-gadget-aspeed-add-ast2600-compatible-string.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0090-peci-cpupower-driver-1.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0092-SPI-Quad-IO-driver-support-AST2600.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0093-ipmi-ipmb_dev_int-add-quick-fix-for-raw-I2C-type-reg.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0094-Return-link-speed-and-duplex-settings-for-the-NCSI-c.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0096-Fix-truncated-WrEndPointConfig-MMIO-command.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/debug.cfg delete mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0001-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0008-Added-enable-disable-control-of-the-Network-Interfac.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0010-Enable-the-network-link-carrier-state-to-be-reported.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0016-Add-DBUS-interface-of-SMBIOS-MDR-V2.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0020-Create-dbus-interface-for-SOL-commands.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0022-Add-chassis-power-cycle-and-reset-to-Chassis-State.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/ipmitool_%.bbappend delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Fixed-issue-in-setLan-command-for-IP-source.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-for-return-CC-in-setLan-command-cases.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0054-Fix-User-commands-require-channel-layer-lib.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Update-provisioning-mode-filter-logic.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl.bb create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/multi-node-nl.target create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/nonLegacyNode.service create mode 100755 meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/nonLegacyNode.sh create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-state-manager_%.bbappend create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch (limited to 'meta-openbmc-mods') diff --git a/meta-openbmc-mods/conf/layer.conf b/meta-openbmc-mods/conf/layer.conf index d0a3e4057..71d23a2ba 100644 --- a/meta-openbmc-mods/conf/layer.conf +++ b/meta-openbmc-mods/conf/layer.conf @@ -17,6 +17,6 @@ USERADDEXTENSION = "useradd-staticids" USERADD_UID_TABLES = "files/passwd" USERADD_GID_TABLES = "files/group" -LAYER_CONF_VERSION = "10" +LAYER_CONF_VERSION = "11" INTELBASE = '${@os.path.normpath("${LAYERDIR}/")}' diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CPC-Baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CPC-Baseboard.json index 637de563b..71ea74135 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CPC-Baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CPC-Baseboard.json @@ -619,13 +619,6 @@ ], "Type": "CFMSensor" }, - { - "Direction": "Input", - "Index": 40, - "Name": "NMI Input", - "Polarity": "Low", - "Type": "Gpio" - }, { "Name": "System Fan connector 1", "Pwm": 0, @@ -859,38 +852,6 @@ ], "Type": "IpmbSensor" }, - { - "Address": "0x4A", - "Class": "IRBridgeTemp", - "Name": "CPU1 VR P1V8", - "Thresholds": [ - { - "Direction": "greater than", - "Name": "upper critical", - "Severity": 1, - "Value": 115 - }, - { - "Direction": "greater than", - "Name": "upper non critical", - "Severity": 0, - "Value": 110 - }, - { - "Direction": "less than", - "Name": "lower non critical", - "Severity": 0, - "Value": 5 - }, - { - "Direction": "less than", - "Name": "lower critical", - "Severity": 1, - "Value": 0 - } - ], - "Type": "IpmbSensor" - }, { "Address": "0xCC", "Class": "MpsBridgeTemp", @@ -1019,38 +980,6 @@ ], "Type": "IpmbSensor" }, - { - "Address": "0x4C", - "Class": "IRBridgeTemp", - "Name": "CPU2 VR P1V8", - "Thresholds": [ - { - "Direction": "greater than", - "Name": "upper critical", - "Severity": 1, - "Value": 115 - }, - { - "Direction": "greater than", - "Name": "upper non critical", - "Severity": 0, - "Value": 110 - }, - { - "Direction": "less than", - "Name": "lower non critical", - "Severity": 0, - "Value": 5 - }, - { - "Direction": "less than", - "Name": "lower critical", - "Severity": 1, - "Value": 0 - } - ], - "Type": "IpmbSensor" - }, { "Address": "0x71", "Bus": 2, @@ -1625,8 +1554,7 @@ "ILimitMin": 30, "Inputs": [ "CPU1 VR Mem ABCD Temp", - "CPU1 VR Mem ABCD Temp", - "CPU1 VR P1V8" + "CPU1 VR Mem ABCD Temp" ], "Name": "CPU 1 VR Temp", "NegativeHysteresis": 5.0, @@ -1652,8 +1580,7 @@ "ILimitMin": 30, "Inputs": [ "CPU2 VR Mem ABCD Temp", - "CPU2 VR Mem ABCD Temp", - "CPU2 VR P1V8" + "CPU2 VR Mem ABCD Temp" ], "Name": "CPU 2 VR Temp", "NegativeHysteresis": 5.0, @@ -1946,7 +1873,6 @@ "OR", "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': '.*CPC'})" ], - "ProductId": 157, "Type": "Board", "xyz.openbmc_project.Inventory.Decorator.Asset": { "Manufacturer": "$PRODUCT_MANUFACTURER", @@ -1957,6 +1883,8 @@ "xyz.openbmc_project.Inventory.Decorator.AssetTag": { "AssetTag": "$PRODUCT_ASSET_TAG" }, - "xyz.openbmc_project.Inventory.Item.Baseboard": {}, + "xyz.openbmc_project.Inventory.Item.Board.Motherboard": { + "ProductId": 157 +}, "xyz.openbmc_project.Inventory.Item.System": {} -} +} \ No newline at end of file diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CYP-baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CYP-baseboard.json index 845c444b2..b06f1d266 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CYP-baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/CYP-baseboard.json @@ -527,9 +527,9 @@ "Type": "ADC" }, { - "BindGpioIntrusion": "Chassis Intrusion GPIO", "Class": "Gpio", "Name": "Chassis Intrusion Sensor", + "GpioPolarity": "Low", "Type": "ChassisIntrusionSensor" }, { @@ -819,13 +819,6 @@ "Polarity": "Low", "Type": "Gpio" }, - { - "Direction": "Input", - "Index": 143, - "Name": "Chassis Intrusion GPIO", - "Polarity": "Low", - "Type": "Gpio" - }, { "Direction": "Input", "Index": 144, @@ -1417,7 +1410,6 @@ "OR", "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': '.*CYP'})" ], - "ProductId": 152, "Type": "Board", "xyz.openbmc_project.Inventory.Decorator.Asset": { "Manufacturer": "$PRODUCT_MANUFACTURER", @@ -1425,5 +1417,11 @@ "PartNumber": "$PRODUCT_PART_NUMBER", "SerialNumber": "$PRODUCT_SERIAL_NUMBER" }, - "xyz.openbmc_project.Inventory.Item.Baseboard": {} + "xyz.openbmc_project.Inventory.Decorator.AssetTag": { + "AssetTag": "$PRODUCT_ASSET_TAG" + }, + "xyz.openbmc_project.Inventory.Item.Board.Motherboard": { + "ProductId": 152 + }, + "xyz.openbmc_project.Inventory.Item.System": {} } \ No newline at end of file diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/J85894-HSBP.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/J85894-HSBP.json index 660b4e2d7..f5b222909 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/J85894-HSBP.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/J85894-HSBP.json @@ -41,6 +41,7 @@ "Address": "0x4b", "Bus": "$bus", "Name": "HSBP $index Temp", + "PowerState": "On", "Thresholds": [ { "Direction": "greater than", diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/TNP-baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/TNP-baseboard.json index c66cc86a2..24a65437e 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/TNP-baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/TNP-baseboard.json @@ -527,48 +527,6 @@ ], "Type": "ADC" }, - { - "Direction": "Input", - "Index": 40, - "Name": "NMI Out", - "Polarity": "Low", - "Type": "Gpio" - }, - { - "Direction": "Input", - "Index": 50, - "Name": "PCH Thermaltrip", - "Polarity": "Low", - "Type": "Gpio" - }, - { - "Direction": "Input", - "Index": 51, - "Name": "Lcp Enter Button", - "Polarity": "Low", - "Type": "Gpio" - }, - { - "Direction": "Input", - "Index": 52, - "Name": "Lcp Left Button", - "Polarity": "High", - "Type": "Gpio" - }, - { - "Direction": "Input", - "Index": 53, - "Name": "Lcp Right Button", - "Polarity": "Low", - "Type": "Gpio" - }, - { - "Direction": "Input", - "Index": 63, - "Name": "PU 240VA Status", - "Polarity": "Low", - "Type": "Gpio" - }, { "Direction": "Input", "Index": 214, @@ -576,13 +534,6 @@ "Polarity": "High", "Type": "Gpio" }, - { - "Direction": "Input", - "Index": 218, - "Name": "ID Button", - "Polarity": "Low", - "Type": "Gpio" - }, { "Direction": "Out", "Index": 232, @@ -1809,7 +1760,6 @@ "OR", "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': '.*TNP'})" ], - "ProductId": 153, "Type": "Board", "xyz.openbmc_project.Inventory.Decorator.Asset": { "Manufacturer": "$PRODUCT_MANUFACTURER", @@ -1817,5 +1767,11 @@ "PartNumber": "$PRODUCT_PART_NUMBER", "SerialNumber": "$PRODUCT_SERIAL_NUMBER" }, - "xyz.openbmc_project.Inventory.Item.Baseboard": {} + "xyz.openbmc_project.Inventory.Decorator.AssetTag": { + "AssetTag": "$PRODUCT_ASSET_TAG" + }, + "xyz.openbmc_project.Inventory.Item.Board.Motherboard": { + "ProductId": 153 + }, + "xyz.openbmc_project.Inventory.Item.System": {} } \ No newline at end of file diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json index dd18a889d..caf960748 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json @@ -619,6 +619,492 @@ ], "Type": "CFMSensor" }, + { + "Dcpmm": [ + { + "Channel": 0, + "DimmID": 1, + "I2cAddress": "0xB0", + "I2cbus": "MemoryChannel1", + "Imc": 0, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 2, + "I2cAddress": "0xB2", + "I2cbus": "MemoryChannel1", + "Imc": 0, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 3, + "I2cAddress": "0xB4", + "I2cbus": "MemoryChannel1", + "Imc": 0, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 4, + "I2cAddress": "0xB6", + "I2cbus": "MemoryChannel1", + "Imc": 0, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 5, + "I2cAddress": "0xB8", + "I2cbus": "MemoryChannel1", + "Imc": 1, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 6, + "I2cAddress": "0xBA", + "I2cbus": "MemoryChannel1", + "Imc": 1, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 7, + "I2cAddress": "0xBC", + "I2cbus": "MemoryChannel1", + "Imc": 1, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 8, + "I2cAddress": "0xBE", + "I2cbus": "MemoryChannel1", + "Imc": 1, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 9, + "I2cAddress": "0xB0", + "I2cbus": "MemoryChannel2", + "Imc": 2, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 10, + "I2cAddress": "0xB2", + "I2cbus": "MemoryChannel2", + "Imc": 2, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 11, + "I2cAddress": "0xB4", + "I2cbus": "MemoryChannel2", + "Imc": 2, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 12, + "I2cAddress": "0xB6", + "I2cbus": "MemoryChannel2", + "Imc": 2, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 13, + "I2cAddress": "0xB8", + "I2cbus": "MemoryChannel2", + "Imc": 3, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 14, + "I2cAddress": "0xBA", + "I2cbus": "MemoryChannel2", + "Imc": 3, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 15, + "I2cAddress": "0xBC", + "I2cbus": "MemoryChannel2", + "Imc": 3, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 16, + "I2cAddress": "0xBE", + "I2cbus": "MemoryChannel2", + "Imc": 3, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 17, + "I2cAddress": "0xB0", + "I2cbus": "MemoryChannel3", + "Imc": 0, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 18, + "I2cAddress": "0xB2", + "I2cbus": "MemoryChannel3", + "Imc": 0, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 19, + "I2cAddress": "0xB4", + "I2cbus": "MemoryChannel3", + "Imc": 0, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 20, + "I2cAddress": "0xB6", + "I2cbus": "MemoryChannel3", + "Imc": 0, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 21, + "I2cAddress": "0xB8", + "I2cbus": "MemoryChannel3", + "Imc": 1, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 22, + "I2cAddress": "0xBA", + "I2cbus": "MemoryChannel3", + "Imc": 1, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 23, + "I2cAddress": "0xBC", + "I2cbus": "MemoryChannel3", + "Imc": 1, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 24, + "I2cAddress": "0xBE", + "I2cbus": "MemoryChannel3", + "Imc": 1, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 25, + "I2cAddress": "0xB0", + "I2cbus": "MemoryChannel4", + "Imc": 2, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 26, + "I2cAddress": "0xB2", + "I2cbus": "MemoryChannel4", + "Imc": 2, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 27, + "I2cAddress": "0xB4", + "I2cbus": "MemoryChannel4", + "Imc": 2, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 28, + "I2cAddress": "0xB6", + "I2cbus": "MemoryChannel4", + "Imc": 2, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 29, + "I2cAddress": "0xB8", + "I2cbus": "MemoryChannel4", + "Imc": 3, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 30, + "I2cAddress": "0xBA", + "I2cbus": "MemoryChannel4", + "Imc": 3, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 31, + "I2cAddress": "0xBC", + "I2cbus": "MemoryChannel4", + "Imc": 3, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 32, + "I2cAddress": "0xBE", + "I2cbus": "MemoryChannel4", + "Imc": 3, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + } + ], + "Name": "DCPMM", + "Type": "DCPMM" + }, { "Direction": "Input", "Index": 40, @@ -1892,7 +2378,6 @@ "OR", "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': '.*WC'})" ], - "ProductId": 145, "Type": "Board", "xyz.openbmc_project.Inventory.Decorator.Asset": { "Manufacturer": "$PRODUCT_MANUFACTURER", @@ -1903,6 +2388,8 @@ "xyz.openbmc_project.Inventory.Decorator.AssetTag": { "AssetTag": "$PRODUCT_ASSET_TAG" }, - "xyz.openbmc_project.Inventory.Item.Baseboard": {}, + "xyz.openbmc_project.Inventory.Item.Board.Motherboard": { + "ProductId": 145 + }, "xyz.openbmc_project.Inventory.Item.System": {} -} +} \ No newline at end of file diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Chassis.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Chassis.json new file mode 100644 index 000000000..a30626daa --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Chassis.json @@ -0,0 +1,455 @@ +{ + "Exposes": [ + { + "BindConnector": "System Fan connector 1", + "Index": 0, + "Name": "Fan 1", + "Thresholds": [ + { + "Direction": "less than", + "Name": "lower critical", + "Severity": 1, + "Value": 1750 + }, + { + "Direction": "less than", + "Name": "lower non critical", + "Severity": 0, + "Value": 2000 + } + ], + "Type": "AspeedFan" + }, + { + "BindConnector": "System Fan connector 2", + "Index": 2, + "Name": "Fan 2", + "Thresholds": [ + { + "Direction": "less than", + "Name": "lower critical", + "Severity": 1, + "Value": 1750 + }, + { + "Direction": "less than", + "Name": "lower non critical", + "Severity": 0, + "Value": 2000 + } + ], + "Type": "AspeedFan" + }, + { + "BindConnector": "System Fan connector 3", + "Index": 4, + "Name": "Fan 3", + "Thresholds": [ + { + "Direction": "less than", + "Name": "lower critical", + "Severity": 1, + "Value": 1750 + }, + { + "Direction": "less than", + "Name": "lower non critical", + "Severity": 0, + "Value": 2000 + } + ], + "Type": "AspeedFan" + }, + { + "BindConnector": "System Fan connector 6", + "Index": 10, + "Name": "Fan 4", + "Thresholds": [ + { + "Direction": "less than", + "Name": "lower critical", + "Severity": 1, + "Value": 1750 + }, + { + "Direction": "less than", + "Name": "lower non critical", + "Severity": 0, + "Value": 2000 + } + ], + "Type": "AspeedFan" + }, + { + "BindConnector": "System Fan connector 7", + "Index": 12, + "Name": "Fan 5", + "Thresholds": [ + { + "Direction": "less than", + "Name": "lower critical", + "Severity": 1, + "Value": 1750 + }, + { + "Direction": "less than", + "Name": "lower non critical", + "Severity": 0, + "Value": 2000 + } + ], + "Type": "AspeedFan" + }, + { + "BindConnector": "System Fan connector 8", + "Index": 14, + "Name": "Fan 6", + "Thresholds": [ + { + "Direction": "less than", + "Name": "lower critical", + "Severity": 1, + "Value": 1750 + }, + { + "Direction": "less than", + "Name": "lower non critical", + "Severity": 0, + "Value": 2000 + } + ], + "Type": "AspeedFan" + }, + { + "C1": 92.16, + "C2": 107.52, + "MaxCFM": 17.5, + "Name": "System Airflow", + "TachMaxPercent": 100, + "TachMinPercent": 20, + "Tachs": [ + "Fan 1", + "Fan 2", + "Fan 3", + "Fan 4", + "Fan 5", + "Fan 6" + ], + "Type": "CFMSensor" + }, + { + "DisableNode": [ + "Fan 1a", + "Fan 1b", + "Fan 2a", + "Fan 2b", + "Fan 3a", + "Fan 3b", + "Fan 4a", + "Fan 4b", + "Fan 5a", + "Fan 5b", + "Fan 6a", + "Fan 6b", + "Fan 7a", + "Fan 7b", + "Fan 8a", + "Fan 8b", + "Fan 1", + "Fan 2", + "Fan 3", + "Fan 4", + "Fan 5", + "Fan 6", + "Fan 7", + "Fan 8", + "System Airflow" + ], + "Name": "Disable Baseboard Configurations", + "Type": "Disable" + }, + { + "AlphaF": 4.352, + "AlphaS": 0.512, + "Name": "Exit Air Temp", + "PowerFactorMax": 1.2, + "PowerFactorMin": 0.9, + "QMax": 165, + "QMin": 31, + "Thresholds": [ + { + "Direction": "greater than", + "Name": "upper critical", + "Severity": 1, + "Value": 85 + }, + { + "Direction": "greater than", + "Name": "upper non critical", + "Severity": 0, + "Value": 80 + }, + { + "Direction": "less than", + "Name": "lower non critical", + "Severity": 0, + "Value": 5 + }, + { + "Direction": "less than", + "Name": "lower critical", + "Severity": 1, + "Value": 0 + } + ], + "Type": "ExitAirTempSensor" + }, + { + "Class": "temp", + "FFGainCoefficient": 0.0, + "FFOffCoefficient": 0.0, + "ICoefficient": -4.64, + "ILimitMax": 100, + "ILimitMin": 30, + "Inputs": [ + "Exit Air Temp" + ], + "Name": "Exit Air Temp", + "NegativeHysteresis": 5.0, + "OutLimitMax": 100, + "OutLimitMin": 30, + "Outputs": [], + "PCoefficient": -0.15, + "PositiveHysteresis": 0.0, + "SetPoint": 75.0, + "SlewNeg": -1, + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ + "Left", + "Right" + ] + }, + { + "Class": "fan", + "FFGainCoefficient": 1.0, + "FFOffCoefficient": 0.0, + "ICoefficient": 0.0, + "ILimitMax": 0.0, + "ILimitMin": 0.0, + "Inputs": [ + "Fan 1" + ], + "Name": "Fan 1", + "NegativeHysteresis": 0.0, + "OutLimitMax": 100.0, + "OutLimitMin": 30.0, + "Outputs": [ + "Pwm 1" + ], + "PCoefficient": 0.0, + "PositiveHysteresis": 0.0, + "SlewNeg": 0.0, + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ + "Left" + ] + }, + { + "Class": "fan", + "FFGainCoefficient": 1.0, + "FFOffCoefficient": 0.0, + "ICoefficient": 0.0, + "ILimitMax": 0.0, + "ILimitMin": 0.0, + "Inputs": [ + "Fan 2" + ], + "Name": "Fan 2", + "NegativeHysteresis": 0.0, + "OutLimitMax": 100.0, + "OutLimitMin": 30.0, + "Outputs": [ + "Pwm 2" + ], + "PCoefficient": 0.0, + "PositiveHysteresis": 0.0, + "SlewNeg": 0.0, + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ + "Left" + ] + }, + { + "Class": "fan", + "FFGainCoefficient": 1.0, + "FFOffCoefficient": 0.0, + "ICoefficient": 0.0, + "ILimitMax": 0.0, + "ILimitMin": 0.0, + "Inputs": [ + "Fan 3" + ], + "Name": "Fan 3", + "NegativeHysteresis": 0.0, + "OutLimitMax": 100.0, + "OutLimitMin": 30.0, + "Outputs": [ + "Pwm 3" + ], + "PCoefficient": 0.0, + "PositiveHysteresis": 0.0, + "SlewNeg": 0.0, + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ + "Left" + ] + }, + { + "Class": "fan", + "FFGainCoefficient": 1.0, + "FFOffCoefficient": 0.0, + "ICoefficient": 0.0, + "ILimitMax": 0.0, + "ILimitMin": 0.0, + "Inputs": [ + "Fan 4" + ], + "Name": "Fan 4", + "NegativeHysteresis": 0.0, + "OutLimitMax": 100.0, + "OutLimitMin": 30.0, + "Outputs": [ + "Pwm 6" + ], + "PCoefficient": 0.0, + "PositiveHysteresis": 0.0, + "SlewNeg": 0.0, + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ + "Right" + ] + }, + { + "Class": "fan", + "FFGainCoefficient": 1.0, + "FFOffCoefficient": 0.0, + "ICoefficient": 0.0, + "ILimitMax": 0.0, + "ILimitMin": 0.0, + "Inputs": [ + "Fan 5" + ], + "Name": "Fan 5", + "NegativeHysteresis": 0.0, + "OutLimitMax": 100.0, + "OutLimitMin": 30.0, + "Outputs": [ + "Pwm 7" + ], + "PCoefficient": 0.0, + "PositiveHysteresis": 0.0, + "SlewNeg": 0.0, + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ + "Right" + ] + }, + { + "Class": "fan", + "FFGainCoefficient": 1.0, + "FFOffCoefficient": 0.0, + "ICoefficient": 0.0, + "ILimitMax": 0.0, + "ILimitMin": 0.0, + "Inputs": [ + "Fan 6" + ], + "Name": "Fan 6", + "NegativeHysteresis": 0.0, + "OutLimitMax": 100.0, + "OutLimitMin": 30.0, + "Outputs": [ + "Pwm 8" + ], + "PCoefficient": 0.0, + "PositiveHysteresis": 0.0, + "SlewNeg": 0.0, + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ + "Right" + ] + }, + { + "Class": "Floor", + "Inputs": [ + "Front Panel Temp" + ], + "Name": "Front Panel LCC", + "NegativeHysteresis": 2, + "Output": [ + 50.0, + 60.0 + ], + "PositiveHysteresis": 0, + "Reading": [ + 20.0, + 30.0 + ], + "Type": "Stepwise", + "Zones": [ + "Left", + "Right" + ] + }, + { + "Class": "Ceiling", + "Inputs": [ + "Front Panel Temp" + ], + "Name": "Front Panel UCC", + "NegativeHysteresis": 2, + "Output": [ + 70.0, + 80.0 + ], + "PositiveHysteresis": 0, + "Profiles": [ + "Acoustic" + ], + "Reading": [ + 22.0, + 32.0 + ], + "Type": "Stepwise", + "Zones": [ + "Left", + "Right" + ] + } + ], + "Name": "R4000 Chassis", + "Probe": [ + "FOUND('Intel Front Panel')", + "AND", + "FOUND('WC Baseboard')", + "AND", + "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'WilsonCity'})" + ], + "Type": "Chassis", + "xyz.openbmc_project.Inventory.Decorator.Asset": { + "Manufacturer": "$PRODUCT_MANUFACTURER", + "Model": "$PRODUCT_PRODUCT_NAME", + "PartNumber": "$PRODUCT_PART_NUMBER", + "SerialNumber": "$PRODUCT_SERIAL_NUMBER" + }, + "xyz.openbmc_project.Inventory.Decorator.AssetTag": { + "AssetTag": "$PRODUCT_ASSET_TAG" + } +} \ No newline at end of file diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WP-Baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WP-Baseboard.json index 29c6f9d52..de98c78fa 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WP-Baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WP-Baseboard.json @@ -619,6 +619,492 @@ ], "Type": "CFMSensor" }, + { + "Dcpmm": [ + { + "Channel": 0, + "DimmID": 1, + "I2cAddress": "0xB0", + "I2cbus": "MemoryChannel1", + "Imc": 0, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 2, + "I2cAddress": "0xB2", + "I2cbus": "MemoryChannel1", + "Imc": 0, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 3, + "I2cAddress": "0xB4", + "I2cbus": "MemoryChannel1", + "Imc": 0, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 4, + "I2cAddress": "0xB6", + "I2cbus": "MemoryChannel1", + "Imc": 0, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 5, + "I2cAddress": "0xB8", + "I2cbus": "MemoryChannel1", + "Imc": 1, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 6, + "I2cAddress": "0xBA", + "I2cbus": "MemoryChannel1", + "Imc": 1, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 7, + "I2cAddress": "0xBC", + "I2cbus": "MemoryChannel1", + "Imc": 1, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 8, + "I2cAddress": "0xBE", + "I2cbus": "MemoryChannel1", + "Imc": 1, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 9, + "I2cAddress": "0xB0", + "I2cbus": "MemoryChannel2", + "Imc": 2, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 10, + "I2cAddress": "0xB2", + "I2cbus": "MemoryChannel2", + "Imc": 2, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 11, + "I2cAddress": "0xB4", + "I2cbus": "MemoryChannel2", + "Imc": 2, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 12, + "I2cAddress": "0xB6", + "I2cbus": "MemoryChannel2", + "Imc": 2, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 13, + "I2cAddress": "0xB8", + "I2cbus": "MemoryChannel2", + "Imc": 3, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 14, + "I2cAddress": "0xBA", + "I2cbus": "MemoryChannel2", + "Imc": 3, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 15, + "I2cAddress": "0xBC", + "I2cbus": "MemoryChannel2", + "Imc": 3, + "Slot": 0, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 16, + "I2cAddress": "0xBE", + "I2cbus": "MemoryChannel2", + "Imc": 3, + "Slot": 1, + "Socket": 0, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 17, + "I2cAddress": "0xB0", + "I2cbus": "MemoryChannel3", + "Imc": 0, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 18, + "I2cAddress": "0xB2", + "I2cbus": "MemoryChannel3", + "Imc": 0, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 19, + "I2cAddress": "0xB4", + "I2cbus": "MemoryChannel3", + "Imc": 0, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 20, + "I2cAddress": "0xB6", + "I2cbus": "MemoryChannel3", + "Imc": 0, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 21, + "I2cAddress": "0xB8", + "I2cbus": "MemoryChannel3", + "Imc": 1, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 22, + "I2cAddress": "0xBA", + "I2cbus": "MemoryChannel3", + "Imc": 1, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 23, + "I2cAddress": "0xBC", + "I2cbus": "MemoryChannel3", + "Imc": 1, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 24, + "I2cAddress": "0xBE", + "I2cbus": "MemoryChannel3", + "Imc": 1, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 0, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 25, + "I2cAddress": "0xB0", + "I2cbus": "MemoryChannel4", + "Imc": 2, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 26, + "I2cAddress": "0xB2", + "I2cbus": "MemoryChannel4", + "Imc": 2, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 27, + "I2cAddress": "0xB4", + "I2cbus": "MemoryChannel4", + "Imc": 2, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 28, + "I2cAddress": "0xB6", + "I2cbus": "MemoryChannel4", + "Imc": 2, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 29, + "I2cAddress": "0xB8", + "I2cbus": "MemoryChannel4", + "Imc": 3, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 0, + "DimmID": 30, + "I2cAddress": "0xBA", + "I2cbus": "MemoryChannel4", + "Imc": 3, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 31, + "I2cAddress": "0xBC", + "I2cbus": "MemoryChannel4", + "Imc": 3, + "Slot": 0, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + }, + { + "Channel": 1, + "DimmID": 32, + "I2cAddress": "0xBE", + "I2cbus": "MemoryChannel4", + "Imc": 3, + "Slot": 1, + "Socket": 1, + "Spdpcibus": "0x7E", + "Spdpcicmdregister": "0x80", + "Spdpcidataregister": "0x88", + "Spdpcidevice": 11, + "Spdpcifunction": 1, + "Spdpcistatusregister": "0x84" + } + ], + "Name": "DCPMM", + "Type": "DCPMM" + }, { "Name": "System Fan connector 1", "Pwm": 0, @@ -1876,7 +2362,6 @@ "OR", "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': '.*WP'})" ], - "ProductId": 154, "Type": "Board", "xyz.openbmc_project.Inventory.Decorator.Asset": { "Manufacturer": "$PRODUCT_MANUFACTURER", @@ -1887,6 +2372,8 @@ "xyz.openbmc_project.Inventory.Decorator.AssetTag": { "AssetTag": "$PRODUCT_ASSET_TAG" }, - "xyz.openbmc_project.Inventory.Item.Baseboard": {}, + "xyz.openbmc_project.Inventory.Item.Board.Motherboard": { + "ProductId": 154 + }, "xyz.openbmc_project.Inventory.Item.System": {} -} +} \ No newline at end of file diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager_%.bbappend b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager_%.bbappend index 1e0d2b1b4..6528bd513 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -8,7 +8,8 @@ SRC_URI_append = " file://0001-Blacklist-DIMM-Bus.patch \ file://CYP-baseboard.json \ file://J85894-HSBP.json \ file://CPC-Baseboard.json \ - file://MIDPLANE-2U2X12SWITCH.json" + file://MIDPLANE-2U2X12SWITCH.json \ + file://WC-Chassis.json" RDEPENDS_${PN} += " default-fru" diff --git a/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass b/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass index e15812562..9563b55cb 100644 --- a/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass +++ b/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass @@ -74,7 +74,7 @@ do_image_pfr () { mv ${PFR_IMAGES_DIR}/image-mtd-pfr ${PFR_IMAGES_DIR}/image-mtd-pfr-${DATETIME}.bin } -do_image_pfr[vardepsexclude] += "DATETIME" +do_image_pfr[vardepsexclude] += "DATE DATETIME" do_image_pfr[vardeps] += "IPMI_MAJOR IPMI_MINOR IPMI_AUX13 IPMI_AUX14 IPMI_AUX15 IPMI_AUX16" do_image_pfr[depends] += " \ obmc-intel-pfr-image-native:do_populate_sysroot \ diff --git a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass index 802fa2bd5..7db3fa4a6 100644 --- a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass +++ b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass @@ -4,7 +4,6 @@ inherit systemd-watchdog IMAGE_INSTALL_append = " \ bmcweb \ dbus-broker \ - dtc \ entity-manager \ ipmitool \ intel-ipmi-oem \ @@ -12,7 +11,6 @@ IMAGE_INSTALL_append = " \ phosphor-node-manager-proxy \ dbus-sensors \ phosphor-webui \ - rest-dbus-static \ at-scale-debug \ phosphor-pid-control \ phosphor-host-postd \ @@ -42,6 +40,8 @@ IMAGE_INSTALL_append = " \ security-registers-check \ pch-time-sync \ nv-sync \ + security-manager \ + multi-node-nl \ " IMAGE_INSTALL_append = "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'intel-pfr-manager', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0001-Add-ast2600-intel-as-a-new-board.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0001-Add-ast2600-intel-as-a-new-board.patch index a084c4a8c..f1505b8cd 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0001-Add-ast2600-intel-as-a-new-board.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0001-Add-ast2600-intel-as-a-new-board.patch @@ -1,28 +1,29 @@ -From 069a20560bf9efbd358503c76f043fcdd3a68a94 Mon Sep 17 00:00:00 2001 +From efa949f82a1dd32b83eafe3fe58038abc04ecdbf Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Thu, 24 Oct 2019 14:06:33 -0700 Subject: [PATCH] Add ast2600-intel as a new board Signed-off-by: Vernon Mauery Signed-off-by: Jae Hyun Yoo +Signed-off-by: Kuiying Wang --- arch/arm/dts/Makefile | 3 + - arch/arm/dts/ast2600-intel.dts | 170 +++++++++++ + arch/arm/dts/ast2600-intel.dts | 157 ++++++++++ arch/arm/lib/interrupts.c | 5 + arch/arm/mach-aspeed/ast2600/Kconfig | 9 + arch/arm/mach-aspeed/ast2600/aspeed_scu_info.c | 1 + board/aspeed/ast2600_intel/Kconfig | 13 + board/aspeed/ast2600_intel/Makefile | 4 + - board/aspeed/ast2600_intel/ast-espi.c | 282 +++++++++++++++++ + board/aspeed/ast2600_intel/ast-espi.c | 298 ++++++++++++++++++ board/aspeed/ast2600_intel/ast-irq.c | 399 +++++++++++++++++++++++++ board/aspeed/ast2600_intel/ast-irq.h | 8 + board/aspeed/ast2600_intel/ast-timer.c | 59 ++++ - board/aspeed/ast2600_intel/intel.c | 171 +++++++++++ + board/aspeed/ast2600_intel/intel.c | 176 +++++++++++ cmd/Kconfig | 2 +- common/autoboot.c | 10 + common/board_r.c | 8 +- include/configs/evb_ast2600.h | 2 +- - 16 files changed, 1140 insertions(+), 6 deletions(-) + 16 files changed, 1148 insertions(+), 6 deletions(-) create mode 100644 arch/arm/dts/ast2600-intel.dts create mode 100644 board/aspeed/ast2600_intel/Kconfig create mode 100644 board/aspeed/ast2600_intel/Makefile @@ -48,10 +49,10 @@ index d1d4dca340f8..38fe8113469e 100644 diff --git a/arch/arm/dts/ast2600-intel.dts b/arch/arm/dts/ast2600-intel.dts new file mode 100644 -index 000000000000..0d362ac7c150 +index 000000000000..99788b21e444 --- /dev/null +++ b/arch/arm/dts/ast2600-intel.dts -@@ -0,0 +1,170 @@ +@@ -0,0 +1,157 @@ +/dts-v1/; + +#include "ast2600-u-boot.dtsi" @@ -209,19 +210,6 @@ index 000000000000..0d362ac7c150 + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c9_default>; +}; -+ -+#if 0 -+&pcie_bridge0 { -+ status = "okay"; -+}; -+#else -+&pcie_bridge1 { -+ status = "okay"; -+}; -+#endif -+&h2x { -+ status = "okay"; -+}; diff --git a/arch/arm/lib/interrupts.c b/arch/arm/lib/interrupts.c index ee775ce5d264..8c985532afb4 100644 --- a/arch/arm/lib/interrupts.c @@ -322,10 +310,10 @@ index 000000000000..37d2f0064f38 +obj-y += ast-timer.o diff --git a/board/aspeed/ast2600_intel/ast-espi.c b/board/aspeed/ast2600_intel/ast-espi.c new file mode 100644 -index 000000000000..8dc12d7c9fe8 +index 000000000000..1852dd3d86e2 --- /dev/null +++ b/board/aspeed/ast2600_intel/ast-espi.c -@@ -0,0 +1,282 @@ +@@ -0,0 +1,298 @@ +/* + * Copyright 2018 Intel Corporation + * @@ -341,11 +329,11 @@ index 000000000000..8dc12d7c9fe8 +#define AST_LPC_BASE 0x1e6e9000 +#define AST_ESPI_BASE 0x1e6ee000 +#define AST_SCU_BASE 0x1e6e2000 -+#define AST_SCU_HW_STRAP1 0x510 ++#define AST_SCU_HW_STRAP2 0x510 +#define SCU_HW_STRAP_ESPI_ENABLED 0x40 + -+#define USE_HW_HANDSHAKE 1 -+#define DEBUG_ESPI_ENABLED 1 ++#define USE_HW_HANDSHAKE 0 ++#define DEBUG_ESPI_ENABLED 0 +#if DEBUG_ESPI_ENABLED +#define DBG_ESPI printf +#else @@ -431,7 +419,8 @@ index 000000000000..8dc12d7c9fe8 + +/* ESPI008 bits ISR */ +#define AST_ESPI_VW_SYS_EVT BIT(8) -+#define AST_ESPI_VW_SYS_EV1 BIT(9) ++#define AST_ESPI_VW_GPIO_EVT BIT(9) ++#define AST_ESPI_VW_SYS_EV1 BIT(22) +#define AST_ESPI_HW_RST BIT(31) + +/* ESPI080 bits */ @@ -479,7 +468,15 @@ index 000000000000..8dc12d7c9fe8 +{ + uint32_t irq_status = readl(AST_ESPI_BASE + ESPI008); + -+ DBG_ESPI("ISR irq_status : 0x%08X\n", irq_status); ++ DBG_ESPI("espi_irq_handler, ESPI008=0X%x, ESPI00c=0X%x,\ ++ ESPI100=0X%x, ESPI11c=0X%x, ESPI094=0X%x,\ ++ ESPI12c=0X%x, irq_status=0x%x\n", ++ readl(AST_ESPI_BASE + ESPI008), ++ readl(AST_ESPI_BASE + ESPI00C), ++ readl(AST_ESPI_BASE + ESPI100), ++ readl(AST_ESPI_BASE + ESPI11C), ++ readl(AST_ESPI_BASE + ESPI094), ++ readl(AST_ESPI_BASE + ESPI12C), irq_status); + + if (irq_status & AST_ESPI_VW_SYS_EVT) { + uint32_t sys_status = readl(AST_ESPI_BASE + ESPI11C); @@ -542,13 +539,22 @@ index 000000000000..8dc12d7c9fe8 + + writel(irq_status, AST_ESPI_BASE + ESPI008); /* clear irq_status */ + ++ DBG_ESPI("end espi_irq_handler, ESPI008=0X%x, ESPI00c=0X%x,\ ++ ESPI100=0X%x, ESPI11c=0X%x, ESPI094=0X%x,\ ++ ESPI12c=0X%x, irq_status=0X%x\n", ++ readl(AST_ESPI_BASE + ESPI008), ++ readl(AST_ESPI_BASE + ESPI00C), ++ readl(AST_ESPI_BASE + ESPI100), ++ readl(AST_ESPI_BASE + ESPI11C), ++ readl(AST_ESPI_BASE + ESPI094), ++ readl(AST_ESPI_BASE + ESPI12C), irq_status); + return 0; +} + +void espi_init(void) +{ -+ if (1 || !readl(AST_SCU_BASE + AST_SCU_HW_STRAP1) -+ & SCU_HW_STRAP_ESPI_ENABLED) { ++ if (!readl(AST_SCU_BASE + AST_SCU_HW_STRAP2) & ++ SCU_HW_STRAP_ESPI_ENABLED) { + uint32_t v; + + DBG_ESPI("espi init\n"); @@ -601,8 +607,6 @@ index 000000000000..8dc12d7c9fe8 + writel(AST_ESPI_IEN_HW_RST | AST_ESPI_IEN_SYS1_EV | + AST_ESPI_IEN_SYS_EV, AST_ESPI_BASE + ESPI00C); + -+ espi_handshake_ack(); -+ + irq_install_handler(IRQ_SRC_ESPI, espi_irq_handler, NULL); + } else { + DBG_ESPI("No espi strap\n"); @@ -1094,10 +1098,10 @@ index 000000000000..cf8c69aba5d3 +} diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c new file mode 100644 -index 000000000000..100eb1ec5d21 +index 000000000000..b5d8dd36d20b --- /dev/null +++ b/board/aspeed/ast2600_intel/intel.c -@@ -0,0 +1,171 @@ +@@ -0,0 +1,176 @@ +/* Intel customizations of Das U-Boot */ +#include +#include @@ -1196,18 +1200,23 @@ index 000000000000..100eb1ec5d21 + writel(value, AST_LPC_BASE + HICRB); +} + -+#define AST_GPIO_BASE 0x1e780000 -+#define SGPIO_CLK_DIV(N) ((N) << 16) -+#define SGPIO_BYTES(N) ((N) << 6) -+#define SGPIO_ENABLE 1 -+#define GPIO254 0x554 ++#define AST_GPIO_BASE 0x1e780000 + +static void sgpio_init(void) +{ ++#define SGPIO_CLK_DIV(N) ((N) << 16) ++#define SGPIO_BYTES(N) ((N) << 6) ++#define SGPIO_ENABLE 1 ++#define GPIO554 0x554 ++#define SCU_414 0x414 /* Multi-function Pin Control #5 */ ++#define SCU_414_SGPM_MASK GENMASK(27, 24) ++ + uint32_t value; -+ /* set the gpio clock to pclk/(2*(5+1)) or ~2 MHz */ ++ /* set the sgpio clock to pclk/(2*(5+1)) or ~2 MHz */ + value = SGPIO_CLK_DIV(256) | SGPIO_BYTES(10) | SGPIO_ENABLE; -+ writel(value, AST_GPIO_BASE + GPIO254); ++ writel(value, AST_GPIO_BASE + GPIO554); ++ writel(readl(SCU_BASE | SCU_414) | SCU_414_SGPM_MASK, ++ SCU_BASE | SCU_414); +} + +void espi_init(void); @@ -1238,8 +1247,8 @@ index 000000000000..100eb1ec5d21 + +int board_early_init_r(void) +{ -+ printf("board_early_init_r\n"); -+ timer_enable(0, 1, timer_handler); ++ debug("board_early_init_r\n"); ++ /* timer_enable(0, 1, timer_handler); */ + + espi_init(); + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0004-Disable-crashdump-trigger-gpio.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0004-Disable-crashdump-trigger-gpio.patch index 6ffdbc702..d9c40fea0 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0004-Disable-crashdump-trigger-gpio.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0004-Disable-crashdump-trigger-gpio.patch @@ -1,4 +1,4 @@ -From aae3bab86f19784cbe0767ea0973527ce217bf89 Mon Sep 17 00:00:00 2001 +From b203aee347f6b4104a7dfbc061b195c99795451e Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Fri, 3 Jan 2020 15:14:09 -0800 Subject: [PATCH] Disable crashdump trigger gpio @@ -12,11 +12,11 @@ Signed-off-by: Jae Hyun Yoo 1 file changed, 23 insertions(+) diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c -index eb6fbaf77e66..7daf1b83305a 100644 +index b6a11132448f..f095f1ecd696 100644 --- a/board/aspeed/ast2600_intel/intel.c +++ b/board/aspeed/ast2600_intel/intel.c -@@ -146,6 +146,27 @@ static void sgpio_init(void) - writel(value, AST_GPIO_BASE + GPIO254); +@@ -151,6 +151,27 @@ static void sgpio_init(void) + SCU_BASE | SCU_414); } +static void disable_crashlog_trigger(void) @@ -43,7 +43,7 @@ index eb6fbaf77e66..7daf1b83305a 100644 void espi_init(void); int arch_interrupt_init_early(void); -@@ -162,6 +183,8 @@ int board_early_init_f(void) +@@ -167,6 +188,8 @@ int board_early_init_f(void) * I am not sure if it actually does anything... */ arch_interrupt_init_early(); diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0005-Ast2600-Enable-interrupt-in-u-boot.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0005-Ast2600-Enable-interrupt-in-u-boot.patch new file mode 100644 index 000000000..ce9aa668a --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0005-Ast2600-Enable-interrupt-in-u-boot.patch @@ -0,0 +1,458 @@ +From 959b75b846aa25168fe9e3d04ceb0e0778f89992 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Fri, 3 Jan 2020 12:52:29 +0800 +Subject: [PATCH] Enable interrupt in u-boot. + +Ast2600 is Cortex-A7 +GIC V2 is used as the interrupt controller +GIC includes GICD and GICC + +Testedby: +1. Enable interrupt based SW handshake for ESPI +2. Both ArcherCity and Ast2600 EVB are working well. + +Signed-off-by: Kuiying Wang +--- + arch/arm/lib/vectors.S | 31 ++++++- + board/aspeed/ast2600_intel/ast-irq.c | 154 +++++++++++++++++------------------ + configs/evb-ast2600_defconfig | 1 + + include/configs/evb_ast2600.h | 1 + + 4 files changed, 107 insertions(+), 80 deletions(-) + +diff --git a/arch/arm/lib/vectors.S b/arch/arm/lib/vectors.S +index 2ca6e2494a7a..e2ed04a204de 100644 +--- a/arch/arm/lib/vectors.S ++++ b/arch/arm/lib/vectors.S +@@ -13,7 +13,7 @@ + */ + + #include +- ++#define CONFIG_USE_IRQ + /* + * A macro to allow insertion of an ARM exception vector either + * for the non-boot0 case or by a boot0-header. +@@ -145,6 +145,17 @@ fiq: + + #else /* !CONFIG_SPL_BUILD */ + ++#ifdef CONFIG_USE_IRQ ++/* IRQ stack memory (calculated at run-time) */ ++.globl IRQ_STACK_START ++IRQ_STACK_START: ++ .word 0x0badc0de ++/* IRQ stack memory (calculated at run-time) */ ++.globl FIQ_STACK_START ++FIQ_STACK_START: ++ .word 0x0badc0de ++#endif ++ + /* IRQ stack memory (calculated at run-time) + 8 bytes */ + .globl IRQ_STACK_START_IN + IRQ_STACK_START_IN: +@@ -277,17 +288,31 @@ not_used: + bad_save_user_regs + bl do_not_used + ++ .align 5 ++#ifdef CONFIG_USE_IRQ ++irq: ++ get_irq_stack ++ irq_save_user_regs ++ bl do_irq ++ irq_restore_user_regs ++ .align 5 ++fiq: ++ get_fiq_stack ++ /* someone ought to write a more effective fiq_save_user_regs */ ++ irq_save_user_regs ++ bl do_fiq ++ irq_restore_user_regs + + .align 5 ++#else + irq: + get_bad_stack + bad_save_user_regs + bl do_irq +- + .align 5 + fiq: + get_bad_stack + bad_save_user_regs + bl do_fiq +- ++#endif /* CONFIG_USE_IRQ */ + #endif /* CONFIG_SPL_BUILD */ +diff --git a/board/aspeed/ast2600_intel/ast-irq.c b/board/aspeed/ast2600_intel/ast-irq.c +index f817f8cd7c81..6e91b17ab186 100644 +--- a/board/aspeed/ast2600_intel/ast-irq.c ++++ b/board/aspeed/ast2600_intel/ast-irq.c +@@ -18,19 +18,6 @@ DECLARE_GLOBAL_DATA_PTR; + #define GIC_INTERFACE_OFFSET 0x4000 + #define GIC_VIRT_OFFSET 0x6000 + +-#define VIC_STATUS_L 0x80 +-#define VIC_STATUS_H 0x84 +-#define VIC_IRQ_SELECTION_L 0x98 +-#define VIC_IRQ_SELECTION_H 0x9C +-#define VIC_ENABLE_L 0xA0 +-#define VIC_ENABLE_H 0xA4 +-#define VIC_ENABLE_CLEAR_L 0xA8 +-#define VIC_ENABLE_CLEAR_H 0xAC +-#define VIC_INTERRUPT_CLEAR_L 0xD8 +-#define VIC_INTERRUPT_CLEAR_H 0xDC +- +-#define VIC_CLEAR_ALL (~0) +- + /* GIC_DISTRIBUTOR_OFFSET register offsets */ + #define GICD_CTLR 0x000 + #define GICD_TYPER 0x004 +@@ -82,7 +69,9 @@ DECLARE_GLOBAL_DATA_PTR; + #define GICC_IIDR 0x00fc + #define GICC_DIR 0x1000 + +-#define GIC_CPU_IMPLEMENTER_MAGIC 0x0102143b ++#define GIC_CPU_IMPLEMENTER_MAGIC 0x0102143b ++#define GICC_IAR_INT_ID_MASK 0x3ff ++#define GIC_CPU_DEACTIVATE 0x1000 + + /* GIC_INTERFACE_OFFSET register offsets */ + #define GICH_HCR 0x000 +@@ -116,9 +105,10 @@ DECLARE_GLOBAL_DATA_PTR; + + #define GIC_VIRT_CPU_IMPLEMENTER_MAGIC 0x0102143b + +-#define GICD_CTLR_ENABLE 0x03 +- +-#define GICD_INT_DEF_PRI 0xa0 ++#define GICD_CTLR_ENABLE 0x03 /*enable group 0 and 1*/ ++#define GICC_CTLR_ENABLE 0x03 ++#define GICD_ITARGET_ALL 0xffffffff ++#define GICD_INT_DEF_PRI 0xa0 + #define GICD_INT_DEF_PRI_X4 (\ + (GICD_INT_DEF_PRI << 24) |\ + (GICD_INT_DEF_PRI << 16) |\ +@@ -129,20 +119,30 @@ DECLARE_GLOBAL_DATA_PTR; + #define GICD_INT_EN_CLR_X32 0xffffffff + #define GICD_INT_EN_CLR_PPI 0xffff0000 + #define GICD_INT_EN_SET_SGI 0x0000ffff ++#define GICD_ICFG_LEVEL_TRIGGER 0x55555555 ++#define GICC_UNMASK_ALL_PRIORITY 0xff + + #define gicd_readl(OFFSET) readl(gbase + GIC_DISTRIBUTOR_OFFSET + (OFFSET)) + #define gicd_writel(VALUE, OFFSET) \ + writel((VALUE), gbase + GIC_DISTRIBUTOR_OFFSET + (OFFSET)) + #define gicc_readl(OFFSET) readl(gbase + GIC_CPU_OFFSET + (OFFSET)) ++#define gicc_writel(VALUE, OFFSET) \ ++ writel((VALUE), gbase + GIC_CPU_OFFSET + (OFFSET)) + #define gich_readl(OFFSET) readl(gbase + GIC_INTERFACE_OFFSET + (OFFSET)) + #define gicv_readl(OFFSET) readl(gbase + GIC_VIRT_OFFSET + (OFFSET)) +- +-static size_t max_irq = 0; +- + #define ITLINES_MASK 0x1f + #define ITLINES_SHIFT 5 +- + #define GIC_MAX_IRQ 1020 ++#define SPI_INT_NUM_MIN 32 ++#define MAX_IRQ 0xfffffffe ++#define DEBUG_IRQ_ENABLED 0 ++#if DEBUG_IRQ_ENABLED ++#define DBG_IRQ printf ++#else ++#define DBG_IRQ(...) ++#endif ++ ++static size_t max_irq = 0; + static interrupt_handler_t *handlers[GIC_MAX_IRQ] = {NULL}; + static unsigned long irq_total = 0; + static unsigned long irq_counts[GIC_MAX_IRQ] = {0}; +@@ -159,31 +159,40 @@ static inline uint32_t gic_base(void) + + static void enable_gic(void) + { +- uint32_t gicd_ctlr; ++ uint32_t gicd_ctlr, gicc_ctlr; + ++ DBG_IRQ(" %s()\n", __FUNCTION__); + /* add GIC offset ref table 1-3 for interrupt distributor address */ + gicd_ctlr = gicd_readl(GICD_CTLR); ++ gicc_ctlr = gicc_readl(GICC_CTLR); + gicd_writel(gicd_ctlr | GICD_CTLR_ENABLE, GICD_CTLR); ++ gicc_writel(gicc_ctlr | GICC_CTLR_ENABLE, GICC_CTLR); + } + + static void disable_gic(void) + { +- uint32_t gicd_ctlr; +- ++ uint32_t gicd_ctlr, gicc_ctlr; ++ DBG_IRQ(" %s()\n", __FUNCTION__); + /* add GIC offset ref table 1-3 for interrupt distributor address */ + gicd_ctlr = gicd_readl(GICD_CTLR); + gicd_writel(gicd_ctlr & ~GICD_CTLR_ENABLE, GICD_CTLR); ++ gicc_ctlr = gicc_readl(GICC_CTLR); ++ gicc_writel(gicc_ctlr & ~GICC_CTLR_ENABLE, GICC_CTLR); + } + + static void enable_irq_id(unsigned int id) + { ++ DBG_IRQ(" %s()\n", __FUNCTION__); ++ + uint32_t grp = id >> ITLINES_SHIFT; + uint32_t grp_bit = 1 << (id & ITLINES_MASK); + gicd_writel(grp_bit, GICD_ISENABLERn + grp * sizeof(uint32_t)); ++ gicd_writel(GICD_ITARGET_ALL, GICD_ITARGETSRn + id / 4 * 4); + } + + static void disable_irq_id(unsigned int id) + { ++ DBG_IRQ(" %s()\n", __FUNCTION__); + uint32_t grp = id >> ITLINES_SHIFT; + uint32_t grp_bit = 1 << (id & ITLINES_MASK); + gicd_writel(grp_bit, GICD_ICENABLERn + grp * sizeof(uint32_t)); +@@ -193,22 +202,29 @@ static int gic_probe(void) + { + int i; + gbase = gic_base(); ++ DBG_IRQ("gic_probe GIC base = 0x%x, magicd=0x%x\n", ++ gbase, gicd_readl(GICD_IIDR)); + enable_gic(); + + if (gicd_readl(GICD_IIDR) != GIC_DISTRIBUTOR_IMPLEMENTER_MAGIC && + gicc_readl(GICC_IIDR) != GIC_CPU_IMPLEMENTER_MAGIC && + gicv_readl(GICV_IIDR) != GIC_VIRT_CPU_IMPLEMENTER_MAGIC) + { ++ printf("error: magic check \n"); + return 0; + } + /* GIC supports up to 1020 lines */ +- max_irq = ((gicd_readl(GICD_TYPER) & ITLINES_MASK) + 1) << ITLINES_SHIFT; ++ max_irq = (((gicd_readl(GICD_TYPER) & ITLINES_MASK) + 1) * 32) - 1; + if (max_irq > GIC_MAX_IRQ) + max_irq = GIC_MAX_IRQ; + /* set all lines to be level triggered N-N */ + for (i = 32; i < max_irq; i += 16) +- gicd_writel(0, GICD_ICFGRn + i / 4); ++ gicd_writel(GICD_ICFG_LEVEL_TRIGGER, GICD_ICFGRn + i / 4); + ++ DBG_IRQ("max_irq = 0x%x, typer=0x%x, config=0x%x, maxirq=0x%x\n", max_irq, ++ (gicd_readl(GICD_TYPER) & ITLINES_MASK) + 1, ++ gicd_readl(GICD_ICFGRn + 0x8), ++ ((gicd_readl(GICD_TYPER) & ITLINES_MASK) + 1) * 0x20); + /* Set priority on all interrupts. */ + for (i = 0; i < max_irq; i += 4) + gicd_writel(GICD_INT_DEF_PRI_X4, GICD_IPRIORITYRn + i); +@@ -218,9 +234,11 @@ static int gic_probe(void) + gicd_writel(GICD_INT_EN_CLR_X32, GICD_ICACTIVERn + i / 8); + gicd_writel(GICD_INT_EN_CLR_X32, GICD_ICENABLERn + i / 8); + } +- gicd_writel(GICD_INT_EN_CLR_X32, GICD_ICACTIVERn); +- gicd_writel(GICD_INT_EN_CLR_PPI, GICD_ICENABLERn); ++ gicd_writel(GICD_INT_EN_CLR_X32, GICD_ICACTIVERn); ++ gicd_writel(GICD_INT_EN_CLR_PPI, GICD_ICENABLERn); + gicd_writel(GICD_INT_EN_SET_SGI, GICD_ISENABLERn); ++ /* unmask all priority */ ++ gicc_writel(GICC_UNMASK_ALL_PRIORITY, GICC_PMRn); + + return 0; + } +@@ -228,6 +246,7 @@ static int gic_probe(void) + void irq_free_handler (int irq); + static void gic_shutdown(void) + { ++ DBG_IRQ(" %s()\n", __FUNCTION__); + int i; + for (i = 0; i < max_irq; i++) + { +@@ -238,6 +257,7 @@ static void gic_shutdown(void) + + int arch_interrupt_init_early(void) + { ++ DBG_IRQ(" %s()\n", __FUNCTION__); + return 0; + } + +@@ -249,11 +269,13 @@ int arch_interrupt_init(void) + handlers[i] = NULL; + irq_counts[i] = 0; + } ++ DBG_IRQ("arch_interrupt_init\n"); + return gic_probe(); + } + + int arch_interrupt_fini(void) + { ++ DBG_IRQ(" %s()\n", __FUNCTION__); + gic_shutdown(); + return 0; + } +@@ -261,14 +283,12 @@ int arch_interrupt_fini(void) + int interrupt_init (void) + { + /* +- * setup up stacks if necessary +- */ ++ * setup up stacks if necessary*/ ++ IRQ_STACK_START = gd->irq_sp + 8; + IRQ_STACK_START_IN = gd->irq_sp + 8; + +- printf("%s()\n", __FUNCTION__); ++ DBG_IRQ(" %s()\n", __FUNCTION__); + return arch_interrupt_init(); +- +- return 0; + } + + int global_interrupts_enabled (void) +@@ -286,12 +306,12 @@ void enable_interrupts (void) + { + unsigned long cpsr; + __asm__ __volatile__("mrs %0, cpsr\n" +- "bic %0, %0, #0x80\n" ++ "bic %0, %0, #0x1c0\n" + "msr cpsr_c, %0" + : "=r" (cpsr) + : + : "memory"); +- ++ DBG_IRQ(" %s()\n", __FUNCTION__); + return; + } + +@@ -304,11 +324,13 @@ int disable_interrupts (void) + : "=r" (cpsr), "=r" (temp) + : + : "memory"); ++ DBG_IRQ(" %s()\n", __FUNCTION__); + return (cpsr & 0x80) == 0; + } + + void irq_install_handler(int irq, interrupt_handler_t *handler, void *ctx) + { ++ DBG_IRQ(" %s()\n", __FUNCTION__); + if (irq > max_irq) { + printf("irq %d out of range\n", irq); + return; +@@ -317,13 +339,14 @@ void irq_install_handler(int irq, interrupt_handler_t *handler, void *ctx) + printf("irq %d already in use (%p)\n", irq, handlers[irq]); + return; + } +- printf("registering handler for irq %d\n", irq); ++ DBG_IRQ("registering handler for irq %d\n", irq); + handlers[irq] = handler; + enable_irq_id(irq); + } + + void irq_free_handler (int irq) + { ++ DBG_IRQ(" %s()\n", __FUNCTION__); + if (irq >= max_irq) { + printf("irq %d out of range\n", irq); + return; +@@ -338,9 +361,10 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) + { + int i; + int enabled = global_interrupts_enabled(); +- printf("GIC base = 0x%x\n", gbase); +- printf("interrupts %sabled\n", (enabled ? "en" : "dis")); ++ DBG_IRQ("GIC base = 0x%x\n", gbase); ++ DBG_IRQ("interrupts %sabled\n", (enabled ? "en" : "dis")); + uint32_t grp_en = 0; ++ + for (i = 0; i < max_irq; i++) { + if ((i & ITLINES_MASK) == 0) + grp_en = gicd_readl(GICD_ISENABLERn + +@@ -348,52 +372,28 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) + int irq_enabled = grp_en & (1 << (i & ITLINES_MASK)); + if (!irq_enabled) + continue; +- printf("% 2i (% 3s): %lu\n", i, ++ DBG_IRQ("%2d (%3s): %lu\n", i, + (irq_enabled ? "on" : "off"), irq_counts[i]); + } +- printf("total: %lu\n", irq_total); ++ DBG_IRQ("total: %lu\n", irq_total); + return 0; + } + + void do_irq(struct pt_regs *pt_regs) + { +- int i; +- if (!gbase) { +- static int printed_msg = 0; +- if (!printed_msg) +- { +- printed_msg = 1; +- printf("interrupt before configured!\n"); +- } +- return; +- } +- irq_total++; +- uint32_t grp_pend = 0; +- for (i = 0; i < max_irq; i++) { +- /* limit reads of the pending register to once in 32 */ +- if ((i & ITLINES_MASK) == 0) +- grp_pend = gicd_readl(GICD_ISPENDRn + +- (i >> ITLINES_SHIFT) * sizeof(uint32_t)); +- uint32_t pending = grp_pend & (1 << (i & ITLINES_MASK)); +- if (pending) { +- irq_counts[i]++; +- /* mask via GICD_ICENABLERn */ +- gicd_writel(pending, GICD_ICENABLERn + +- (i >> ITLINES_SHIFT) * sizeof(uint32_t)); +- if (handlers[i]) { +- handlers[i](pt_regs); +- /* unmask via GICD_ISENABLERn */ +- gicd_writel(pending, GICD_ISENABLERn + +- (i >> ITLINES_SHIFT) * sizeof(uint32_t)); +- /* clear pending via GICD_ICPENDRn */ +- gicd_writel(pending, GICD_ICPENDRn + +- (i >> ITLINES_SHIFT) * sizeof(uint32_t)); +- } else { +- printf("unexpected interrupt %i; masking\n", i); +- /* clear pending via GICD_ICPENDRn */ +- gicd_writel(pending, GICD_ISPENDRn + +- (i >> ITLINES_SHIFT) * sizeof(uint32_t)); +- } ++ uint32_t irqstat = 0, irqnr = 0; ++ ++ if (irq_total < MAX_IRQ) ++ irq_total++; ++ irqstat = gicc_readl(GICC_IAR); ++ irqnr = irqstat & GICC_IAR_INT_ID_MASK; ++ ++ if (irqnr > SPI_INT_NUM_MIN && irqnr < GIC_MAX_IRQ) { ++ gicc_writel(irqnr, GICC_EOIR); ++ if (irq_counts[irqnr] < MAX_IRQ) ++ irq_counts[irqnr]++; ++ if (handlers[irqnr]) { ++ handlers[irqnr](NULL); + } + } + } +diff --git a/configs/evb-ast2600_defconfig b/configs/evb-ast2600_defconfig +index 517d59adaf11..9cd7aea98e8d 100644 +--- a/configs/evb-ast2600_defconfig ++++ b/configs/evb-ast2600_defconfig +@@ -72,3 +72,4 @@ CONFIG_SPI=y + CONFIG_DM_SPI=y + CONFIG_SYSRESET=y + CONFIG_WDT=y ++CONFIG_USE_IRQ=y +diff --git a/include/configs/evb_ast2600.h b/include/configs/evb_ast2600.h +index 91a42f2522e2..15061b25d872 100644 +--- a/include/configs/evb_ast2600.h ++++ b/include/configs/evb_ast2600.h +@@ -8,6 +8,7 @@ + + #include + ++#define CONFIG_USE_IRQ + #define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE + 0x300000) + #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x5000000) + +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0006-SPI-Quad-IO-Mode.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0006-SPI-Quad-IO-Mode.patch new file mode 100644 index 000000000..ca5846416 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0006-SPI-Quad-IO-Mode.patch @@ -0,0 +1,158 @@ +From 8c953c7f1d512cf4acd9ce000d65e46094d61597 Mon Sep 17 00:00:00 2001 +From: arun-pm +Date: Fri, 29 Nov 2019 00:19:09 +0530 +Subject: [PATCH] SPI Quad IO Mode + +This commit adds quad IO mode in SPI driver for AST2600. + +Note:- Removed n25q00 Quad I/O support for the time being due to clock issue + with chip 'Micron 8UA15 - rw182 (128MB)' while enabling Quad I/O mode. +--- + arch/arm/dts/ast2600-intel.dts | 6 ++--- + drivers/mtd/spi/spi-nor-ids.c | 7 +++++- + drivers/spi/aspeed_spi.c | 46 ++++++++++++++++++++++++---------- + 3 files changed, 41 insertions(+), 18 deletions(-) + +diff --git a/arch/arm/dts/ast2600-intel.dts b/arch/arm/dts/ast2600-intel.dts +index 0d362ac7c1..2a74bbd30a 100644 +--- a/arch/arm/dts/ast2600-intel.dts ++++ b/arch/arm/dts/ast2600-intel.dts +@@ -101,16 +101,14 @@ + + &fmc { + status = "okay"; +-#if 0 + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_fmcquad_default>; +-#endif + flash@0 { + compatible = "spi-flash", "sst,w25q256"; + status = "okay"; + spi-max-frequency = <40000000>; +- spi-tx-bus-width = <2>; +- spi-rx-bus-width = <2>; ++ spi-tx-bus-width = <4>; ++ spi-rx-bus-width = <4>; + }; + }; + +diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c +index c77987f1ff..d679238562 100644 +--- a/drivers/mtd/spi/spi-nor-ids.c ++++ b/drivers/mtd/spi/spi-nor-ids.c +@@ -164,7 +164,12 @@ const struct flash_info spi_nor_ids[] = { + { INFO("n25q256ax1", 0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + { INFO("n25q512a", 0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, + { INFO("n25q512ax3", 0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, +- { INFO("n25q00", 0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, ++ /* Removed n25q00 Quad I/O support for the time being due to clock issue with chip 'Micron 8UA15 - rw182 (128MB)' ++ * while enabling Quad I/O mode. As this chip is default shipped in platforms, marking it ++ * as Not supported for the time being. Once all chips are replaced with the new model, this can be enabled ++ * back(Note:- Certain other chips having same name(n25q00) but different part number has no issues). ++ */ ++ { INFO("n25q00", 0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | NO_CHIP_ERASE) }, + { INFO("n25q00a", 0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + { INFO("mt25qu02g", 0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + #endif +diff --git a/drivers/spi/aspeed_spi.c b/drivers/spi/aspeed_spi.c +index a8c2b3de2b..ae5edaee9f 100644 +--- a/drivers/spi/aspeed_spi.c ++++ b/drivers/spi/aspeed_spi.c +@@ -16,6 +16,9 @@ + #include + + #define ASPEED_SPI_MAX_CS 3 ++#define AST2600A0 0x05000303 ++#define AST2600A0_MAX_FREQ 40000000 ++#define AST_MAX_FREQ 100000000 + + struct aspeed_spi_regs { + u32 conf; /* 0x00 CE Type Setting */ +@@ -593,6 +596,7 @@ static int aspeed_spi_write_reg(struct aspeed_spi_priv *priv, + aspeed_spi_write_to_ahb(flash->ahb_base, write_buf, len); + aspeed_spi_stop_user(priv, flash); + ++ debug("=== write opcode [%x] ==== \n", opcode); + switch(opcode) { + case SPINOR_OP_EN4B: + writel(readl(&priv->regs->ctrl) | BIT(flash->cs), &priv->regs->ctrl); +@@ -615,6 +619,8 @@ static void aspeed_spi_send_cmd_addr(struct aspeed_spi_priv *priv, + /* First, send the opcode */ + aspeed_spi_write_to_ahb(flash->ahb_base, &cmdbuf[0], 1); + ++ if(flash->iomode == CE_CTRL_IO_QUAD_ADDR_DATA) ++ writel(flash->ce_ctrl_user | flash->iomode, &priv->regs->ce_ctrl[flash->cs]); + /* + * The controller is configured for 4BYTE address mode. Fix + * the address width and send an extra byte if the SPI Flash +@@ -664,9 +670,6 @@ static ssize_t aspeed_spi_write_user(struct aspeed_spi_priv *priv, + { + aspeed_spi_start_user(priv, flash); + +- if(flash->iomode == CE_CTRL_IO_QPI_DATA) +- writel(flash->ce_ctrl_user | flash->iomode, &priv->regs->ce_ctrl[flash->cs]); +- + /* cmd buffer = cmd + addr : normally cmd is use signle mode*/ + aspeed_spi_send_cmd_addr(priv, flash, cmdbuf, cmdlen); + +@@ -872,15 +875,19 @@ static int aspeed_spi_flash_init(struct aspeed_spi_priv *priv, + else + read_hclk = aspeed_spi_hclk_divisor(priv, slave->speed); + +- if (slave->mode & (SPI_RX_DUAL | SPI_TX_DUAL)) { +- debug("CS%u: setting dual data mode\n", flash->cs); +- flash->iomode = CE_CTRL_IO_DUAL_DATA; +- flash->spi->read_opcode = SPINOR_OP_READ_1_1_2; +- } else if (slave->mode & (SPI_RX_QUAD | SPI_TX_QUAD)) { +- flash->iomode = CE_CTRL_IO_QUAD_DATA; +- flash->spi->read_opcode = SPINOR_OP_READ_1_4_4; +- } else { +- debug("normal read \n"); ++ switch(flash->spi->read_opcode) { ++ case SPINOR_OP_READ_1_1_2: ++ case SPINOR_OP_READ_1_1_2_4B: ++ flash->iomode = CE_CTRL_IO_DUAL_DATA; ++ break; ++ case SPINOR_OP_READ_1_1_4: ++ case SPINOR_OP_READ_1_1_4_4B: ++ flash->iomode = CE_CTRL_IO_QUAD_DATA; ++ break; ++ case SPINOR_OP_READ_1_4_4: ++ case SPINOR_OP_READ_1_4_4_4B: ++ flash->iomode = CE_CTRL_IO_QUAD_ADDR_DATA; ++ break; + } + + if(priv->new_ver) { +@@ -986,6 +993,19 @@ static int aspeed_spi_bind(struct udevice *bus) + return 0; + } + ++static int aspeed_get_max_freq(void) ++{ ++ u32 rev_id = readl(ASPEED_REVISION_ID); ++ ++ /*Limit max spi frequency less than 50MHz on AST2600-A0 due ++ * to FWSPICLK signal quality issue. ++ */ ++ if(rev_id == AST2600A0) ++ return AST2600A0_MAX_FREQ; ++ else ++ return AST_MAX_FREQ; ++} ++ + static int aspeed_spi_probe(struct udevice *bus) + { + struct resource res_regs, res_ahb; +@@ -1016,7 +1036,7 @@ static int aspeed_spi_probe(struct udevice *bus) + clk_free(&hclk); + + priv->max_hz = dev_read_u32_default(bus, "spi-max-frequency", +- 100000000); ++ aspeed_get_max_freq()); + + priv->num_cs = dev_read_u32_default(bus, "num-cs", ASPEED_SPI_MAX_CS); + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0007-Add-espi-support.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0007-Add-espi-support.patch index b37aee7e6..fac5a64ef 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0007-Add-espi-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0007-Add-espi-support.patch @@ -1,7 +1,7 @@ -From c46cb2dd703f55ca63ed9c5cf2a97868a7e6c209 Mon Sep 17 00:00:00 2001 +From 74a1399befdb0f7604d116ac8578e7e4004728d8 Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Wed, 14 Nov 2018 10:21:40 -0800 -Subject: [PATCH] Add espi support +Subject: [PATCH 1/1] Add espi support This adds basic eSPI support for U-Boot. The eSPI driver works best with interrupts because the timing of the initialization with the PCH is not @@ -12,23 +12,22 @@ host to boot. In the future it may be expanded to have further functions. Signed-off-by: Vernon Mauery -Change-Id: Id7072f1408dcf364968b1b74f2192e50a22a82f0 - +Signed-off-by: James Feist --- arch/arm/include/asm/arch-aspeed/regs-scu.h | 2 + board/aspeed/ast-g5/Makefile | 2 + - board/aspeed/ast-g5/ast-g5-espi.c | 231 ++++++++++++++++++++++++++++ + board/aspeed/ast-g5/ast-g5-espi.c | 242 ++++++++++++++++++++ board/aspeed/ast-g5/ast-g5-intel.c | 16 ++ board/aspeed/ast-g5/ast-g5.c | 3 + - 5 files changed, 254 insertions(+) + 5 files changed, 265 insertions(+) create mode 100644 board/aspeed/ast-g5/ast-g5-espi.c create mode 100644 board/aspeed/ast-g5/ast-g5-intel.c diff --git a/arch/arm/include/asm/arch-aspeed/regs-scu.h b/arch/arm/include/asm/arch-aspeed/regs-scu.h -index b714fa9..10b983a 100644 +index c9b91795d1..019c00036a 100644 --- a/arch/arm/include/asm/arch-aspeed/regs-scu.h +++ b/arch/arm/include/asm/arch-aspeed/regs-scu.h -@@ -552,6 +552,8 @@ +@@ -554,6 +554,8 @@ #define CLK_25M_IN (0x1 << 23) @@ -38,7 +37,7 @@ index b714fa9..10b983a 100644 #define SCU_HW_STRAP_SUPER_IO_CONFIG (0x1 << 16) #define SCU_HW_STRAP_VGA_CLASS_CODE (0x1 << 15) diff --git a/board/aspeed/ast-g5/Makefile b/board/aspeed/ast-g5/Makefile -index df4e639..58e0c64 100644 +index df4e63966e..58e0c648f4 100644 --- a/board/aspeed/ast-g5/Makefile +++ b/board/aspeed/ast-g5/Makefile @@ -1,2 +1,4 @@ @@ -48,10 +47,10 @@ index df4e639..58e0c64 100644 obj-y += ast-g5-irq.o diff --git a/board/aspeed/ast-g5/ast-g5-espi.c b/board/aspeed/ast-g5/ast-g5-espi.c new file mode 100644 -index 0000000..79ef253 +index 0000000000..dda7ac7cd5 --- /dev/null +++ b/board/aspeed/ast-g5/ast-g5-espi.c -@@ -0,0 +1,231 @@ +@@ -0,0 +1,242 @@ +/* + * Copyright 2018 Intel Corporation + * @@ -144,10 +143,12 @@ index 0000000..79ef253 +#define AST_ESPI_OOB_CHRDY (1 << 4) +#define AST_ESPI_FLASH_SW_CHRDY (0x1 << 7) +#define AST_ESPI_FLASH_SW_READ (0x1 << 10) ++#define ASPEED_ESPI_CTRL_SW_RESET GENMASK(31, 24) + +/* ESPI00C bits (Interrupt Enable) */ +#define AST_ESPI_IEN_SYS_EV (1 << 8) +#define AST_ESPI_IEN_GPIO_EV (1 << 9) ++#define AST_ESPI_IEN_HW_RST (1 << 31) + +/* ESPI008 bits ISR */ +#define AST_ESPI_VW_SYS_EVT (1 << 8) @@ -169,12 +170,38 @@ index 0000000..79ef253 +#define SCR0SIO 0x170 +#define IRQ_SRC_ESPI 23 /* IRQ 23 */ + ++static void espi_handshake_ack(void) ++{ ++ // IRQ only serviced if strapped, so no strap check ++ if (!(readl(AST_ESPI_BASE + ESPI098) & AST_ESPI_SL_BT_STATUS)) { ++ DBG_ESPI("Setting espi slave boot done\n"); ++ uint32_t v = readl(AST_ESPI_BASE + ESPI098) ++ | AST_ESPI_SL_BT_STATUS | AST_ESPI_SL_BT_DONE; ++ writel(v, AST_ESPI_BASE + ESPI098); ++ } ++ ++ if (readl(AST_ESPI_BASE + ESPI104) & AST_ESPI_SUS_WARN) { ++ DBG_ESPI("Boot SUS WARN set %08x\n", ++ readl(AST_ESPI_BASE + ESPI104)); ++ uint32_t v = readl(AST_ESPI_BASE + ESPI104) | AST_ESPI_SUS_ACK; ++ writel(v, AST_ESPI_BASE + ESPI104); ++ } ++} ++ +static int espi_irq_handler(struct pt_regs *regs) +{ + uint32_t irq_status = readl(AST_ESPI_BASE + ESPI008); + + DBG_ESPI("ISR irq_status : 0x%08X\n", irq_status); + ++ ++ if (irq_status & AST_ESPI_IEN_HW_RST) { ++ uint32_t v = readl(AST_ESPI_BASE + ESPI000); ++ writel(v & ~ASPEED_ESPI_CTRL_SW_RESET, AST_ESPI_BASE + ESPI000); ++ writel(v | ASPEED_ESPI_CTRL_SW_RESET, AST_ESPI_BASE + ESPI000); ++ espi_handshake_ack(); ++ } ++ + if (irq_status & AST_ESPI_VW_SYS_EVT) { + uint32_t sys_status = readl(AST_ESPI_BASE + ESPI11C); + uint32_t sys_event = readl(AST_ESPI_BASE + ESPI098); @@ -214,28 +241,11 @@ index 0000000..79ef253 + } + writel(sys1_status, AST_ESPI_BASE + ESPI12C); // clear status + } ++ + writel(irq_status, AST_ESPI_BASE + ESPI008); // clear irq_status + return 0; +} + -+static void espi_handshake_ack(void) -+{ -+ // IRQ only serviced if strapped, so no strap check -+ if (!(readl(AST_ESPI_BASE + ESPI098) & AST_ESPI_SL_BT_STATUS)) { -+ DBG_ESPI("Setting espi slave boot done\n"); -+ uint32_t v = readl(AST_ESPI_BASE + ESPI098) -+ | AST_ESPI_SL_BT_STATUS | AST_ESPI_SL_BT_DONE; -+ writel(v, AST_ESPI_BASE + ESPI098); -+ } -+ -+ if (readl(AST_ESPI_BASE + ESPI104) & AST_ESPI_SUS_WARN) { -+ DBG_ESPI("Boot SUS WARN set %08x\n", -+ readl(AST_ESPI_BASE + ESPI104)); -+ uint32_t v = readl(AST_ESPI_BASE + ESPI104) | AST_ESPI_SUS_ACK; -+ writel(v, AST_ESPI_BASE + ESPI104); -+ } -+} -+ +void espi_init(void) +{ + if (readl(AST_SCU_BASE + AST_SCU_HW_STRAP1) @@ -273,8 +283,8 @@ index 0000000..79ef253 + AST_ESPI_BASE + + ESPI100); // Enable sysev1 ints for susp warn + -+ writel(AST_ESPI_IEN_SYS_EV, -+ AST_ESPI_BASE + ESPI00C); // Enable only sys events ++ writel(AST_ESPI_IEN_SYS_EV | AST_ESPI_IEN_HW_RST, ++ AST_ESPI_BASE + ESPI00C); // Enable events + + espi_handshake_ack(); + @@ -285,7 +295,7 @@ index 0000000..79ef253 +} diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c new file mode 100644 -index 0000000..e79235c +index 0000000000..e79235c8d0 --- /dev/null +++ b/board/aspeed/ast-g5/ast-g5-intel.c @@ -0,0 +1,16 @@ @@ -306,10 +316,10 @@ index 0000000..e79235c + espi_init(); +} diff --git a/board/aspeed/ast-g5/ast-g5.c b/board/aspeed/ast-g5/ast-g5.c -index 2472aa3..d41ef9c 100644 +index ca25348178..cab5fabcef 100644 --- a/board/aspeed/ast-g5/ast-g5.c +++ b/board/aspeed/ast-g5/ast-g5.c -@@ -18,6 +18,8 @@ +@@ -21,6 +21,8 @@ DECLARE_GLOBAL_DATA_PTR; @@ -318,7 +328,7 @@ index 2472aa3..d41ef9c 100644 int board_early_init_f(void) { /* make sure uart5 is using 24MHz clock */ -@@ -34,6 +36,7 @@ int board_init(void) +@@ -84,6 +86,7 @@ int board_init(void) gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; gd->flags = 0; @@ -326,3 +336,6 @@ index 2472aa3..d41ef9c 100644 return 0; } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0007-ast2600-Override-OTP-strap-settings.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0007-ast2600-Override-OTP-strap-settings.patch new file mode 100644 index 000000000..e309f6a98 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0007-ast2600-Override-OTP-strap-settings.patch @@ -0,0 +1,41 @@ +From 899934a036171eb9174e800ba6367b8b8a3e70c4 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Wed, 29 Jan 2020 14:55:44 -0800 +Subject: [PATCH] Override OTP strap settings + +This commit adds settings to override OTP strap. + +Signed-off-by: Jae Hyun Yoo +--- + arch/arm/mach-aspeed/ast2600/platform.S | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/arch/arm/mach-aspeed/ast2600/platform.S b/arch/arm/mach-aspeed/ast2600/platform.S +index de97cccc78b7..ab8d10b70b9a 100644 +--- a/arch/arm/mach-aspeed/ast2600/platform.S ++++ b/arch/arm/mach-aspeed/ast2600/platform.S +@@ -40,6 +40,7 @@ + #define AST_SCU_HPLL_PARAM (AST_SCU_BASE + 0x200) + #define AST_SCU_HPLL_PARAM_EXT (AST_SCU_BASE + 0x204) + #define AST_SCU_HW_STRAP1 (AST_SCU_BASE + 0x500) ++#define AST_SCU_HW_STRAP2 (AST_SCU_BASE + 0x510) + #define AST_SCU_CA7_PARITY_CHK (AST_SCU_BASE + 0x820) + #define AST_SCU_CA7_PARITY_CLR (AST_SCU_BASE + 0x824) + +@@ -133,6 +134,13 @@ do_primary_core_setup: + /* unlock system control unit */ + scu_unlock + ++ /* enable eSPI and ACPI */ ++ ldr r0, =AST_SCU_HW_STRAP2 ++ ldr r1, [r0] ++ bic r1, #0x40 @; Select eSPI ++ orr r1, #0x20 @; Enable ACPI ++ str r1, [r0] ++ + /* tune-up CPU clock for AST2600 A0 */ + ldr r0, =AST_SCU_REV_ID + ldr r0, [r0] +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0009-Add-basic-GPIO-support.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0009-Add-basic-GPIO-support.patch index f7dd80504..e11f15870 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0009-Add-basic-GPIO-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0009-Add-basic-GPIO-support.patch @@ -1,7 +1,7 @@ -From 0fbd5fe6fa08f709b64bdbad6440ea77b422fc4b Mon Sep 17 00:00:00 2001 +From 15d04184a94aca6db889d77c2cc5a800b280da4b Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Fri, 16 Nov 2018 09:58:01 -0800 -Subject: [PATCH] Add basic GPIO support +Subject: [PATCH 01/30] Add basic GPIO support Add a table of well-known gpios (such as FP LEDs and FF UPD jumper) and initialize them at boot. @@ -11,18 +11,19 @@ Add a mechanism to get/set well known gpios from command line. Change-Id: I4136a5ccb048b3604f13b17ea0c18a4bc596c249 Signed-off-by: Vernon Mauery +%% original patch: 0009-Add-basic-GPIO-support.patch --- board/aspeed/ast-g5/Makefile | 1 + - board/aspeed/ast-g5/ast-g5-gpio.c | 195 +++++++++++++++++++++++++++++++++++++ - board/aspeed/ast-g5/ast-g5-gpio.h | 102 +++++++++++++++++++ - board/aspeed/ast-g5/ast-g5-intel.c | 42 ++++++++ + board/aspeed/ast-g5/ast-g5-gpio.c | 202 +++++++++++++++++++++++++++++ + board/aspeed/ast-g5/ast-g5-gpio.h | 103 +++++++++++++++ + board/aspeed/ast-g5/ast-g5-intel.c | 45 +++++++ board/aspeed/ast-g5/ast-g5.h | 1 + - 5 files changed, 341 insertions(+) + 5 files changed, 352 insertions(+) create mode 100644 board/aspeed/ast-g5/ast-g5-gpio.c create mode 100644 board/aspeed/ast-g5/ast-g5-gpio.h diff --git a/board/aspeed/ast-g5/Makefile b/board/aspeed/ast-g5/Makefile -index 58e0c64..2970ae5 100644 +index 58e0c648f4..2970ae5741 100644 --- a/board/aspeed/ast-g5/Makefile +++ b/board/aspeed/ast-g5/Makefile @@ -2,3 +2,4 @@ obj-y += ast-g5.o @@ -32,10 +33,10 @@ index 58e0c64..2970ae5 100644 +obj-y += ast-g5-gpio.o diff --git a/board/aspeed/ast-g5/ast-g5-gpio.c b/board/aspeed/ast-g5/ast-g5-gpio.c new file mode 100644 -index 0000000..d596c15 +index 0000000000..dc6962f4ba --- /dev/null +++ b/board/aspeed/ast-g5/ast-g5-gpio.c -@@ -0,0 +1,195 @@ +@@ -0,0 +1,202 @@ +/* + * Copyright 2018 Intel Corporation + * @@ -104,13 +105,13 @@ index 0000000..d596c15 + return; + } + port = GPIO_PORT(gpio_table[n].u8PortPin); -+ assert = GPIO_PORT(gpio_table[n].u8Value); ++ assert = GPIO_ASSERT(gpio_table[n].u8PinCFG); + pin = GPIO_PIN(gpio_table[n].u8PortPin); + base = GPIO_BASES[GPIO_GROUP(port)].u32ddr; + shift = GPIO_SHIFT(port, pin); + + gpio_value = readl(base + GPIO_DATA_VALUE); -+ if ((assert &&asserted) || !(assert || asserted)) { ++ if ((assert && asserted) || !(assert || asserted)) { + // set the bit + gpio_value |= (1 << shift); + } else { @@ -133,7 +134,7 @@ index 0000000..d596c15 + return -1; + } + port = GPIO_PORT(gpio_table[n].u8PortPin); -+ assert = GPIO_PORT(gpio_table[n].u8Value); ++ assert = GPIO_ASSERT(gpio_table[n].u8PinCFG); + pin = GPIO_PIN(gpio_table[n].u8PortPin); + base = GPIO_BASES[GPIO_GROUP(port)].u32ddr; + shift = GPIO_SHIFT(port, pin); @@ -141,6 +142,9 @@ index 0000000..d596c15 + gpio_value = readl(base + GPIO_DATA_VALUE); + gpio_value >>= shift; + gpio_value &= 1; ++ // the output here is the logical output, which is ++ // NOT (value XOR assert) ++ // This just gets there without a conditional + gpio_value ^= assert; + return !gpio_value; +} @@ -166,6 +170,8 @@ index 0000000..d596c15 + uint8_t pin; + uint32_t base; + uint8_t shift; ++ uint8_t assert; ++ uint8_t init_val; + + port = GPIO_PORT(gpio_table[i].u8PortPin); + pin = GPIO_PIN(gpio_table[i].u8PortPin); @@ -182,7 +188,9 @@ index 0000000..d596c15 + + /* set data value */ + value = readl(base + GPIO_DATA_VALUE); -+ if (gpio_table[i].u8Value) ++ assert = GPIO_ASSERT(gpio_table[i].u8PinCFG); ++ init_val = gpio_table[i].u8Value; ++ if ((assert && init_val) || !(assert || init_val)) + value |= (1 << shift); + else + value &= ~(1 << shift); @@ -211,7 +219,7 @@ index 0000000..d596c15 + if (argc < 3) { + return 1; + } -+ n = simple_strtoul(argv[2], NULL, 16); ++ n = simple_strtoul(argv[2], NULL, 0); + if (argv[1][0] == 'g') { + printf("%d\n", gpio_get_value(n)); + return 0; @@ -221,7 +229,7 @@ index 0000000..d596c15 + } + if (argv[1][0] == 's') { + int value; -+ value = simple_strtoul(argv[3], NULL, 16); ++ value = simple_strtoul(argv[3], NULL, 0); + gpio_set_value(n, value); + return 0; + } @@ -233,10 +241,10 @@ index 0000000..d596c15 + ""); diff --git a/board/aspeed/ast-g5/ast-g5-gpio.h b/board/aspeed/ast-g5/ast-g5-gpio.h new file mode 100644 -index 0000000..a820c0f +index 0000000000..54b7388a22 --- /dev/null +++ b/board/aspeed/ast-g5/ast-g5-gpio.h -@@ -0,0 +1,102 @@ +@@ -0,0 +1,103 @@ +#ifndef __HW_GPIO_H__ +#define __HW_GPIO_H__ + @@ -305,6 +313,7 @@ index 0000000..a820c0f +#define GPIO_PORT(N) (N >> 3) +#define GPIO_SHIFT(PORT, PIN) ((PIN) + (((PORT) % 4) * 8)) +#define GPIO_GROUP(PORT) ((PORT) / 4) ++#define GPIO_ASSERT(N) (((N) >> 4) & 0x01) + +#define ID_LED_PORT_PIN PORT_PIN(GPIO_PORT_S, GPIO_PIN_6) +#define GRN_LED_PORT_PIN PORT_PIN(GPIO_PORT_S, GPIO_PIN_4) @@ -340,10 +349,10 @@ index 0000000..a820c0f + +#endif /* __HW_GPIO_H__ */ diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c -index c2a8b33..069e7a3 100644 +index c2a8b33aec..1868c230eb 100644 --- a/board/aspeed/ast-g5/ast-g5-intel.c +++ b/board/aspeed/ast-g5/ast-g5-intel.c -@@ -14,6 +14,47 @@ +@@ -14,6 +14,50 @@ #include #include "ast-g5.h" @@ -361,8 +370,11 @@ index c2a8b33..069e7a3 100644 +#define GPIO_CFG_DEFAULT (GPCFG_ACTIVE_HIGH | GPCFG_LEVEL_TRIG) +// Active High, Level, Output Disabled + ++#define GPIO_CFG_LOW_INPUT (GPCFG_LEVEL_TRIG) ++// Active Low, Level, Output Disabled ++ +#define GPIO_CFG_FP_LED (GPCFG_OUTPUT_EN) -+// Active High, Pull-up, Level, Output Disabled ++// Active High, Pull-up, Level, Output Enabled + +// Format is: +// GPIO PORT, GPIO PIN Number, GPIO PIN Configuration, GPIO PIN Value, GPIO @@ -381,7 +393,7 @@ index c2a8b33..069e7a3 100644 + GPIO_DEBOUNCE_NONE}, + + /* Force Update Jumper -- pin D0 */ -+ [GPIO_FF_UPD_JUMPER] = {FORCE_BMC_UPDATE_PORT_PIN, GPIO_CFG_DEFAULT, 0, ++ [GPIO_FF_UPD_JUMPER] = {FORCE_BMC_UPDATE_PORT_PIN, GPIO_CFG_LOW_INPUT, 0, + GPIO_DEBOUNCE_8MS}, + + /* Enable Pulse -- pin D6 */ @@ -391,7 +403,7 @@ index c2a8b33..069e7a3 100644 #define LPC_SNOOP_ADDR 0x80 #define HICR5 0x080 /* Host Interface Control Register 5 */ -@@ -107,6 +148,7 @@ static void sgpio_init(void) +@@ -107,6 +151,7 @@ static void sgpio_init(void) extern void espi_init(void); void ast_g5_intel(void) { @@ -400,7 +412,7 @@ index c2a8b33..069e7a3 100644 sgpio_init(); } diff --git a/board/aspeed/ast-g5/ast-g5.h b/board/aspeed/ast-g5/ast-g5.h -index 9fd10ec..908db14 100644 +index 9fd10eccb3..908db1477b 100644 --- a/board/aspeed/ast-g5/ast-g5.h +++ b/board/aspeed/ast-g5/ast-g5.h @@ -3,5 +3,6 @@ @@ -410,3 +422,6 @@ index 9fd10ec..908db14 100644 +#include "ast-g5-gpio.h" #endif /* _AST_G5_H_ */ +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0025-Manufacturing-mode-physical-presence-detection.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0025-Manufacturing-mode-physical-presence-detection.patch index 2d63314af..065f890bc 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0025-Manufacturing-mode-physical-presence-detection.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0025-Manufacturing-mode-physical-presence-detection.patch @@ -1,7 +1,7 @@ -From 4c87d6074fb36d423f135392983d225785abf43a Mon Sep 17 00:00:00 2001 +From b6f898ef15eede75700e9e13a8e0b69d88b12fd4 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Thu, 20 Jun 2019 18:11:43 +0530 -Subject: [PATCH] Manufacturing mode physical presence detection +Subject: [PATCH 15/30] Manufacturing mode physical presence detection Support for physical presence of manufacturing mode added. Front panel power button press for 15 seconds will be detected @@ -23,16 +23,17 @@ Change-Id: Id7e7c7e7860c7ef3ae8e3a7a7cfda7ff506c0f2b Signed-off-by: Richard Marian Thomaiyar Signed-off-by: AppaRao Puli +%% original patch: 0025-Manufacturing-mode-physical-presence-detection.patch --- board/aspeed/ast-g5/ast-g5-gpio.h | 2 +- - board/aspeed/ast-g5/ast-g5-intel.c | 35 +++++++++++++++++++++++++++++++++++ + board/aspeed/ast-g5/ast-g5-intel.c | 35 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/board/aspeed/ast-g5/ast-g5-gpio.h b/board/aspeed/ast-g5/ast-g5-gpio.h -index a820c0f..ed2499f 100644 +index 54b7388a22..8ccf437346 100644 --- a/board/aspeed/ast-g5/ast-g5-gpio.h +++ b/board/aspeed/ast-g5/ast-g5-gpio.h -@@ -72,7 +72,7 @@ +@@ -73,7 +73,7 @@ #define AMB_LED_PORT_PIN PORT_PIN(GPIO_PORT_S, GPIO_PIN_5) #define FORCE_BMC_UPDATE_PORT_PIN PORT_PIN(GPIO_PORT_D, GPIO_PIN_0) #define TPM_EN_PULSE_PORT_PIN PORT_PIN(GPIO_PORT_D, GPIO_PIN_6) @@ -42,7 +43,7 @@ index a820c0f..ed2499f 100644 // GPIO Configuration Register bits #define GPCFG_EVENT_TO_SMI (1 << 7) // 1 == enabled diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c -index 55afa09..452cb5c 100644 +index 45ecd83fd3..efc3315caf 100644 --- a/board/aspeed/ast-g5/ast-g5-intel.c +++ b/board/aspeed/ast-g5/ast-g5-intel.c @@ -24,6 +24,7 @@ enum gpio_names { @@ -53,18 +54,18 @@ index 55afa09..452cb5c 100644 }; #define GPIO_CFG_DEFAULT (GPCFG_ACTIVE_HIGH | GPCFG_LEVEL_TRIG) -@@ -55,6 +56,10 @@ static const GPIOValue gpio_table[] = { +@@ -58,6 +59,10 @@ static const GPIOValue gpio_table[] = { /* Enable Pulse -- pin D6 */ [GPIO_ENABLE_TPM_PULSE] = {TPM_EN_PULSE_PORT_PIN, GPCFG_OUTPUT_EN, 0, GPIO_DEBOUNCE_NONE}, + /* Front Panel Power Button -- pin E2 */ -+ [GPIO_FP_PWR_BTN] = {FP_PWR_BTN_PORT_PIN, GPIO_CFG_DEFAULT, 0, ++ [GPIO_FP_PWR_BTN] = {FP_PWR_BTN_PORT_PIN, GPIO_CFG_LOW_INPUT, 0, + GPIO_DEBOUNCE_8MS}, + }; #define LPC_SNOOP_ADDR 0x80 -@@ -373,6 +378,30 @@ static void update_bootargs_cmd(const char *key, const char *value) +@@ -403,6 +408,30 @@ static void update_bootargs_cmd(const char *key, const char *value) free(buf); } @@ -95,7 +96,7 @@ index 55afa09..452cb5c 100644 void ast_g5_intel_late_init(void) { char value[32]; -@@ -420,6 +449,12 @@ void ast_g5_intel_late_init(void) +@@ -450,6 +479,12 @@ void ast_g5_intel_late_init(void) ast_scu_write(0, AST_SCU_SYS_CTRL); update_bootargs_cmd("resetreason", value); @@ -109,5 +110,5 @@ index 55afa09..452cb5c 100644 static void pwm_init(void) -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0029-FFUJ-FW-IPMI-commands-and-flash-support-in-u-boot.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0029-FFUJ-FW-IPMI-commands-and-flash-support-in-u-boot.patch index f91ab8fea..3c21a7c0a 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0029-FFUJ-FW-IPMI-commands-and-flash-support-in-u-boot.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0029-FFUJ-FW-IPMI-commands-and-flash-support-in-u-boot.patch @@ -1,4 +1,4 @@ -From 513ff559cd6fedd29412fb59b6f436f617620511 Mon Sep 17 00:00:00 2001 +From 0f64b0e0c0a122ce23b5ccc518f514ec296bc7f5 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Tue, 21 May 2019 00:53:04 +0530 Subject: [PATCH] FFUJ: FW IPMI commands and flash support in u-boot @@ -28,7 +28,6 @@ Tested: image transfer via KCS and flashing. Signed-off-by: AppaRao Puli - --- arch/arm/include/asm/arch-aspeed/ast-g5-intel.h | 1 + board/aspeed/ast-g5/Makefile | 2 + @@ -38,9 +37,9 @@ Signed-off-by: AppaRao Puli board/aspeed/ast-g5/ipmi-fwupd.h | 81 ++++ board/aspeed/ast-g5/ipmi-handler.c | 66 +++- board/aspeed/ast-g5/ipmi-handler.h | 3 +- - common/autoboot.c | 11 + + common/autoboot.c | 13 + configs/ast_g5_phy_defconfig | 1 + - 10 files changed, 1091 insertions(+), 12 deletions(-) + 10 files changed, 1093 insertions(+), 12 deletions(-) create mode 100644 board/aspeed/ast-g5/fw-update.c create mode 100644 board/aspeed/ast-g5/fw-update.h create mode 100644 board/aspeed/ast-g5/ipmi-fwupd.c @@ -1237,10 +1236,10 @@ index 9d46d9b..8eea930 100644 /* BMC IPMB LUNs */ diff --git a/common/autoboot.c b/common/autoboot.c -index d66c0fa..45a600e 100644 +index d66c0fa..3647d5f 100644 --- a/common/autoboot.c +++ b/common/autoboot.c -@@ -349,6 +349,17 @@ void autoboot_command(const char *s) +@@ -349,6 +349,19 @@ void autoboot_command(const char *s) { debug("### main_loop: bootcmd=\"%s\"\n", s ? s : ""); @@ -1251,6 +1250,8 @@ index d66c0fa..45a600e 100644 + * This will make sure debug mode intact during FFUJ. + */ + if (intel_force_firmware_jumper_enabled()) { ++ printf("#### Force firmware update mode is enabled, " ++ "Serial console is disabled. ####\n"); + start_fw_update_loop(); + } +#endif @@ -1267,3 +1268,6 @@ index 1b96ab7..5965a9b 100644 CONFIG_CMD_I2C=y CONFIG_SYS_I2C_AST=y +CONFIG_LIB_RAND=y +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0035-PFR-platform-EXTRST-reset-mask-selection.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0035-PFR-platform-EXTRST-reset-mask-selection.patch index 193101370..85cf0cc5e 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0035-PFR-platform-EXTRST-reset-mask-selection.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0035-PFR-platform-EXTRST-reset-mask-selection.patch @@ -1,4 +1,4 @@ -From c15d982a36e34f3d3cc69efff7b56a5157be9a5c Mon Sep 17 00:00:00 2001 +From 3886bca377525ca9a70a6e04403606e456c535ad Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy Date: Thu, 5 Sep 2019 15:03:21 +0530 Subject: [PATCH] PFR platform - EXTRST# reset mask selection @@ -11,7 +11,7 @@ update flow, during which certain modules of BMC should be chosen to be reset so that Host functionality would be intact. Signed-off-by: Vikram Bodireddy - +--- .../include/asm/arch-aspeed/ast-g5-intel.h | 31 +++++++++++++++++++ arch/arm/include/asm/arch-aspeed/regs-scu.h | 29 +++++++++++++++++ board/aspeed/ast-g5/ast-g5-intel.c | 9 ++++++ @@ -60,7 +60,7 @@ index 64f4ed17bf..b9386b2cf6 100644 int intel_force_firmware_jumper_enabled(void); int intel_failed_boot(void); diff --git a/arch/arm/include/asm/arch-aspeed/regs-scu.h b/arch/arm/include/asm/arch-aspeed/regs-scu.h -index 8333ba1c59..98895a47bf 100644 +index 1bdb1d8574..0a4fb6f773 100644 --- a/arch/arm/include/asm/arch-aspeed/regs-scu.h +++ b/arch/arm/include/asm/arch-aspeed/regs-scu.h @@ -144,6 +144,35 @@ @@ -100,13 +100,13 @@ index 8333ba1c59..98895a47bf 100644 #define SCU_RESET_CRT3 (0x1 << 8) #define SCU_RESET_CRT2 (0x1 << 7) diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c -index 13889594bf..ce87a46cd1 100644 +index f8dbae8163..e697bd17e5 100644 --- a/board/aspeed/ast-g5/ast-g5-intel.c +++ b/board/aspeed/ast-g5/ast-g5-intel.c -@@ -579,6 +579,15 @@ extern void espi_init(void); - extern void kcs_init(void); - void ast_g5_intel(void) +@@ -684,6 +684,15 @@ void ast_g5_intel(void) { + int platform_id; + + /* EXTRST# mask for PFR platform + * EXTRST# is used by PFR CPLD to keep BMC in + * reset during firmware authentication, updates and recovery diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0039-AST2500-increase-boot-speed.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0039-AST2500-increase-boot-speed.patch deleted file mode 100644 index d8ac50dbd..000000000 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0039-AST2500-increase-boot-speed.patch +++ /dev/null @@ -1,50 +0,0 @@ -From b571713f51beb467eefae8e56bfea6e5eab48f8c Mon Sep 17 00:00:00 2001 -From: James Feist -Date: Tue, 10 Dec 2019 16:21:24 -0800 -Subject: [PATCH 1/1] AST2500 increase boot speed - -Enable CONFIG_FLASH_SPIx2_Dummy and add it to known -good SPI flashes. - -Signed-off-by: James Feist ---- - arch/arm/mach-aspeed/flash.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/mach-aspeed/flash.c b/arch/arm/mach-aspeed/flash.c -index d33fb9e0fe..95fc46dd76 100644 ---- a/arch/arm/mach-aspeed/flash.c -+++ b/arch/arm/mach-aspeed/flash.c -@@ -34,6 +34,7 @@ - #include - #include - -+#define CONFIG_FLASH_SPIx2_Dummy 1 - - /* - * This file implements a Common Flash Interface (CFI) driver for U-Boot. -@@ -730,7 +731,7 @@ static ulong flash_get_size (ulong base, flash_info_t *info) - ulID = ((ulong)ch[0]) | ((ulong)ch[1] << 8) | ((ulong)ch[2] << 16) ; - info->flash_id = ulID; - --// printf("SPI Flash ID: %x \n", ulID); -+ printf("SPI Flash ID: %x \n", ulID); - - /* init default */ - info->iomode = IOMODEx1; -@@ -1035,6 +1036,12 @@ static ulong flash_get_size (ulong base, flash_info_t *info) - EraseClk = 25; - ReadClk = 50; - info->address32 = 1; -+#if defined(CONFIG_FLASH_SPIx2_Dummy) -+ info->readcmd = 0xbb; -+ info->dummybyte = 1; -+ info->dualport = 1; -+ info->iomode = IOMODEx2_dummy; -+#endif - break; - - case SST25VF016B: --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0040-Initialize-the-BMC-host-mailbox-at-reset-time.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0040-Initialize-the-BMC-host-mailbox-at-reset-time.patch new file mode 100644 index 000000000..b36627d17 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0040-Initialize-the-BMC-host-mailbox-at-reset-time.patch @@ -0,0 +1,65 @@ +From 933d80ac82dbe1f74c653b0ac505fde406e2553c Mon Sep 17 00:00:00 2001 +From: Vernon Mauery +Date: Mon, 27 Jan 2020 15:13:10 -0800 +Subject: [PATCH] Initialize the BMC/host mailbox at reset time + +When the BMC comes out of reset, the mailbox registers need to be set so +the communications with the host can start properly. + +Tested: boot the BMC and take note that the mailbox registers are no + longer random garbage. + +Signed-off-by: Vernon Mauery +--- + board/aspeed/ast-g5/ast-g5-intel.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c +index ce87a46cd1..1086742045 100644 +--- a/board/aspeed/ast-g5/ast-g5-intel.c ++++ b/board/aspeed/ast-g5/ast-g5-intel.c +@@ -575,6 +575,33 @@ static void pwm_init(void) + writel(val, PWM_BASE_ADDR + PWM_CONTROL); + } + ++#define AST_MBX_COUNT 16 ++#define MB_HINIT_BP_REG1 (0) ++#define MB_HINIT_BP_REG2 (1) // reserved for future bit definition. ++#define MB_FW_MJ_VER_REG (2) ++#define MB_FW_MN_VER_REG (3) ++#define MB_HINIT_ERR_REG (4) ++#define MB_BOOTL_BP_REG1 (5) ++#define MB_BOOTL_BP_REG2 (6) // tracks which image selected ++#define MB_BOOTL_ERR_REG (7) ++#define MB_RUNTM_BP_REG1 (8) ++#define MB_RUNTM_BP_REG2 (9) // reserved for future bit definition. ++#define MB_RUNTM_ERR_REG (10) ++static void mailbox_init(void) ++{ ++ /* clear out default mbox values */ ++ int i; ++ for (i = 0; i < AST_MBX_COUNT; i++) ++ { ++ writel(0, AST_MBX_BASE + 4 * i); ++ } ++ /* by the time this is called, all the hardware init is done ++ * so we can mark that as complete */ ++ writel(0xff, AST_MBX_BASE + 4 * MB_HINIT_BP_REG1); ++ /* mark progress up through booting linux */ ++ writel(0x1f, AST_MBX_BASE + 4 * MB_BOOTL_BP_REG1); ++} ++ + extern void espi_init(void); + extern void kcs_init(void); + void ast_g5_intel(void) +@@ -597,6 +624,7 @@ void ast_g5_intel(void) + set_cpld_reg(PFR_CPLD_BOOT_CHECKPOINT_REG, PFR_CPLD_CHKPOINT_START); + + uart_init(); ++ mailbox_init(); + pwm_init(); + gpio_init(gpio_table, ARRAY_SIZE(gpio_table)); + espi_init(); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0041-Disabling-boot-delay.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0041-Disabling-boot-delay.patch new file mode 100644 index 000000000..69ec33a17 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0041-Disabling-boot-delay.patch @@ -0,0 +1,27 @@ +From e21ee4b456addc93a9afed0cb52ac2a53d3b785a Mon Sep 17 00:00:00 2001 +From: arun-pm +Date: Thu, 30 Jan 2020 10:32:13 +0530 +Subject: [PATCH] Disabling boot delay + +Boot delay is changed to -2 so that BMC will not stop in u-boot by pressing +ESC key. +--- + include/configs/ast-common.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h +index 0bc7f2d75f..dce6bbf5aa 100644 +--- a/include/configs/ast-common.h ++++ b/include/configs/ast-common.h +@@ -70,7 +70,7 @@ + /* + * Environment Config + */ +-#define CONFIG_BOOTDELAY 2 ++#define CONFIG_BOOTDELAY -2 + + /* + * Miscellaneous configurable options +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend index b5ea27dae..bc5d2f415 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend @@ -10,6 +10,9 @@ SRC_URI_append_intel-ast2600 = " \ file://0021-AST2600-Enable-host-searial-port-clock-configuration.patch \ file://0003-ast2600-intel-layout-environment-addr.patch \ file://0004-Disable-crashdump-trigger-gpio.patch \ + file://0005-Ast2600-Enable-interrupt-in-u-boot.patch \ + file://0006-SPI-Quad-IO-Mode.patch \ + file://0007-ast2600-Override-OTP-strap-settings.patch \ " do_install_append () { install -m 0644 ${WORKDIR}/fw_env.config ${S}/tools/env/fw_env.config diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend index 8e35c468b..170e84846 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend @@ -39,14 +39,18 @@ SRC_URI_append_intel-ast2500 = " \ file://0036-Re-Enable-KCS.patch \ file://0037-aspeed-ast-scu.c-fix-MAC1LINK-and-MAC2LINK-pin-pads-.patch \ file://0038-Increase-default-fan-speed-for-cooper-city.patch \ - file://0039-AST2500-increase-boot-speed.patch \ + file://0040-Initialize-the-BMC-host-mailbox-at-reset-time.patch \ " PFR_SRC_URI = " \ file://0022-u-boot-env-change-for-PFR-image.patch \ file://0032-PFR-FW-update-and-checkpoint-support-in-u-boot.patch \ file://0035-PFR-platform-EXTRST-reset-mask-selection.patch \ " +AUTOBOOT_SRC_URI = " \ + file://0041-Disabling-boot-delay.patch \ + " SRC_URI_append_intel-ast2500 += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', PFR_SRC_URI, '', d)}" +SRC_URI_append_intel-ast2500 += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', '', AUTOBOOT_SRC_URI, d)}" do_install_append () { install -m 0644 ${WORKDIR}/fw_env.config ${S}/tools/env/fw_env.config } diff --git a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/com.intel.AtScaleDebug.service b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/com.intel.AtScaleDebug.service index a7c238ffe..4411de11c 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/com.intel.AtScaleDebug.service +++ b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/com.intel.AtScaleDebug.service @@ -9,5 +9,4 @@ ExecStart={bindir}/asd Type=simple SyslogIdentifier=asd -[Install] -WantedBy=multi-user.target + diff --git a/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb b/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb index 9d3883d3a..6d2bfa88e 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb @@ -13,7 +13,7 @@ LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=26bb6d0733830e7bab774914a8f8f20a" SRC_URI = "git://github.com/Intel-BMC/crashdump;protocol=git" -SRCREV = "0.4" +SRCREV = "0.5" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh b/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh index 03dac7582..17923b84d 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh +++ b/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh @@ -1,263 +1,355 @@ #!/bin/sh -SSH_ID=$HOME/.ssh/id_rsa.db -[ -e $HOME/.fwupd.defaults ] && source $HOME/.fwupd.defaults +log() { + echo "$@" +} -usage() { - echo "usage: $(basename $0) uri" - echo " uri is something like: file:///path/to/fw" - echo " tftp://tftp.server.ip.addr/path/to/fw" - echo " scp://[user@]scp.server.ip.addr:/path/to/fw" - echo " http[s]://web.server.ip.addr/path/to/fw" - echo " ftp://[user@]ftp.server.ip.addr/path/to/fw" - exit 1 +FWTYPE="" +FWVER="" +redfish_log_fw_evt() { + local evt=$1 + local sev="" + local msg="" + [ -z "$FWTYPE" ] && return + [ -z "$FWVER" ] && return + case "$evt" in + start) + evt=OpenBMC.0.1.FirmwareUpdateStarted + msg="${FWTYPE} firmware update to version ${FWVER} started." + sev=OK + ;; + success) + evt=OpenBMC.0.1.FirmwareUpdateCompleted + msg="${FWTYPE} firmware update to version ${FWVER} completed successfully." + sev=OK + ;; + abort) + evt=OpenBMC.0.1.FirmwareUpdateFailed + msg="${FWTYPE} firmware update to version ${FWVER} failed." + sev=Warning + ;; + *) return ;; + esac + logger-systemd --journald <<-EOF + MESSAGE=$msg + PRIORITY=2 + SEVERITY=${sev} + REDFISH_MESSAGE_ID=${evt} + REDFISH_MESSAGE_ARGS=${FWTYPE},${FWVER} + EOF } -logevent_update_started() { -echo -cat </dev/null } -logevent_update_failed() { -echo -cat <&/dev/null } -if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then usage; fi -if [ $# -eq 0 ]; then - # set DEFURI in $HOME/.fwupd.defaults - URI="$DEFURI" -else - if [[ "$1" == *"/"* ]]; then - URI=$1 # local file - local_file=1 ; +pfr_active_update() { + local factory_reset="" + systemctl stop nv-sync.service || \ + log "BMC NV sync failed to stop" + # transition from non-PFR to PFR image requires factory reset + [ ! -e /usr/share/pfr ] && factory_reset="-r" + mtd-util $factory_reset pfr write $LOCAL_PATH + redfish_log_fw_evt success + # only wait for logging if not transitioning from non-PFR to PFR + if [ -e /usr/share/pfr ]; then + # exit bmc no nv mode + systemctl start nv-sync.service || log "failed to start nv-sync" + wait_for_log_sync + fi + reboot +} + +pfr_staging_update() { + log "Updating $(basename $TGT)" + flash_erase $TGT $erase_offset $blk_cnt + log "Writing $(stat -c "%s" "$LOCAL_PATH") bytes" + # cat "$LOCAL_PATH" > "$TGT" + dd bs=4k seek=$(($erase_offset / 0x1000)) if=$LOCAL_PATH of=$TGT 2>/dev/null + + # remove the updated image from /tmp + rm -f $LOCAL_PATH + redfish_log_fw_evt success + log "Setting update intent in PFR CPLD" + wait_for_log_sync + + # write to PFRCPLD about BMC update intent. + pfr_write 0x13 $upd_intent_val +} + +pfr_active_mode() { + # check for 0xde in register file 0 + local id=$(pfr_read $PFR_ID_REG) || return 1 + [ "$id" == "0xde" ] || return 1 + local state=$(pfr_read $PFR_STATE_REG) || return 1 + local prov=$(pfr_read $PFR_PROV_REG) || return 1 + prov=$((prov & 0x20)) + [ "$prov" == "32" ] && return 0 + return 1 +} + +blk0blk1_update() { + # PFR-style image update section + # read the image type from the uploaded image + # Byte at location 0x8 gives image type + TGT="/dev/mtd/image-stg" + img_type=$(hexdump -s 8 -n 1 -e '/1 "%02x\n"' $LOCAL_PATH) + log "image-type=$img_type" + + if [ $local_file -eq 0 ]; then + img_type_str=$(busctl get-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/$img_obj xyz.openbmc_project.Software.Version Purpose | cut -d " " -f 2 | cut -d "." -f 6 | sed 's/.\{1\}$//') + img_target=$(busctl get-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/$img_obj xyz.openbmc_project.Software.Activation RequestedActivation | cut -d " " -f 2| cut -d "." -f 6 | sed 's/.\{1\}$//') else - URI="file:////tmp/images/$1/image-runtime" - local_file=0 ; + img_type_str='BMC' + img_target='Active' fi -fi -PROTO=$(echo "$URI" | sed 's,\([a-z]*\)://.*$,\1,') -REMOTE=$(echo "$URI" | sed 's,.*://\(.*\)$,\1,') -REMOTE_HOST=$(echo "$REMOTE" | sed 's,\([^/]*\)/.*$,\1,') -if [ "$PROTO" = 'scp' ]; then - REMOTE_PATH=$(echo "$REMOTE" | cut -d':' -f2) -else - REMOTE_PATH=$(echo "$REMOTE" | sed 's,[^/]*/\(.*\)$,\1,') -fi -LOCAL_PATH="/tmp/$(basename $REMOTE_PATH)" -echo "URI=$URI" -echo "PROTO=$PROTO" -echo "REMOTE=$REMOTE" -echo "REMOTE_HOST=$REMOTE_HOST" -echo "REMOTE_PATH=$REMOTE_PATH" -echo "LOCAL_PATH=$LOCAL_PATH" -if [ ! -e $LOCAL_PATH ] || [ $(stat -c %s $LOCAL_PATH) -eq 0 ]; then - echo "Download '$REMOTE_PATH' from $PROTO $REMOTE_HOST $REMOTE_PATH" - case "$PROTO" in - scp) - mkdir -p $HOME/.ssh - if [ -e "$SSH_ID" ]; then - ARG_ID="-i $SSH_ID" - fi - scp $ARG_ID $REMOTE_HOST$REMOTE_PATH $LOCAL_PATH - if [ $? -ne 0 ]; then - echo "scp $REMOTE $LOCAL_PATH failed!" - exit 255 + apply_time=$(busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/software/apply_time xyz.openbmc_project.Software.ApplyTime RequestedApplyTime | cut -d " " -f 2 | cut -d "." -f 6 | sed 's/.\{1\}$//') + log "image-name=$img_type_str" + log "image-target=$img_target" + log "apply_time=$apply_time" + + case "$img_type" in + 04) + if [ "$img_type_str" == 'BMC' ]; then + # BMC image - max size 32MB + log "BMC firmware image" + img_size=33554432 + if [ "$img_target" == 'StandbySpare' ]; then + upd_intent_val=0x10 + else + upd_intent_val=0x08 fi - ;; - tftp) - cd /tmp - tftp -g -r "$REMOTE_PATH" "$REMOTE_HOST" - if [ $? -ne 0 ]; then - echo "tftp -g -r \"$REMOTE_PATH\" \"$REMOTE_HOST\" failed!" - exit 255 + erase_offset=0 + FWTYPE="BMC" + FWVER="${RANDOM}-fixme" + else + # log error the image selected for update is not same as downloaded. + log "Mismatch: image selected for update and image parsed are different" + redfish_log_fw_evt abort + return 1 + fi + ;; + 00) + if [ "$img_type_str" == 'Other' ]; then + log "CPLD firmware image" + # CPLD image- max size 1MB + img_size=1048576 + if [ "$img_target" == 'StandbySpare' ]; then + upd_intent_val=0x20 + else + upd_intent_val=0x04 fi - ;; - http|https|ftp) - wget --no-check-certificate "$URI" -O "$LOCAL_PATH" - if [ $? -ne 0 ]; then - echo "wget $URI failed!" - exit 255 + erase_offset=0x3000000 + FWTYPE="CPLD" + FWVER="${RANDOM}-fixme" + else + # log error the image selected for update is not same as downloaded. + log "Mismatch: image selected for update and image parsed are different" + redfish_log_fw_evt abort + return 1 + fi + ;; + 02) + if [ "$img_type_str" = 'Host' ]; then + # BIOS image- max size 16MB + log "BIOS firmware image" + img_size=16777216 + if [ "$img_target" == 'StandbySpare' ]; then + upd_intent_val=0x02 + else + upd_intent_val=0x41 fi - ;; - file) - cp "$REMOTE_PATH" "$LOCAL_PATH" - ;; - *) - echo "Invalid URI $URI" - exit 1; - ;; + erase_offset=0x2000000 + # TODO: parse out the fwtype and fwver once that is specified + FWTYPE="BIOS" + FWVER="${RANDOM}-fixme" + else + # log error the image selected for update is not same as downloaded. + log "Mismatch: image selected for update and image parsed are different" + redfish_log_fw_evt abort + return 1 + fi + ;; + *) + log "Unknown image type ${img_type}" + return 1 + ;; esac -fi -# PFR image update section -# this file being created at build time for PFR images -if [ -e /usr/share/pfr ] && [ $local_file -eq 0 ]; then - if [ -e /tmp/fwupd_progress ]; then - echo "Firmware update already in progress" - exit 1 + # For deferred updates + if [ "$apply_time" == 'OnReset' ]; then + upd_intent_val=$(( "$upd_intent_val"|0x80 )) fi -touch /tmp/fwupd_progress - -# read the image type from the uploaded image -# Byte at location 0x8 gives image type -img_type=$(busctl get-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/$1 xyz.openbmc_project.Software.Version Purpose | cut -d " " -f 2 | cut -d "." -f 6 | sed 's/.\{1\}$//') -img_target=$(busctl get-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/$1 xyz.openbmc_project.Software.Activation RequestedActivation | cut -d " " -f 2| cut -d "." -f 6 | sed 's/.\{1\}$//') -apply_time=$(busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/software/apply_time xyz.openbmc_project.Software.ApplyTime RequestedApplyTime | cut -d " " -f 2 | cut -d "." -f 6 | sed 's/.\{1\}$//') -echo "image-type=$img_type" -echo "image-target=$img_target" -echo "apply_time=$apply_time" -# BMC image - max size 32MB -if [ "$img_type" = 'BMC' ]; then - echo "BMC firmware image" - # 32MB - 33554432 - img_size=33554432 - if [ "$img_target" = 'StandbySpare' ]; then - upd_intent_val=0x10 - else - upd_intent_val=0x08 + # do a quick sanity check on the image + if [ $(stat -c "%s" "$LOCAL_PATH") -gt $img_size ]; then + log "Update file "$LOCAL_PATH" is bigger than the supported image size" + redfish_log_fw_evt abort + return 1 fi - # page is at 4KB boundary - img_page_offset=0 - erase_offset=0 - blk_cnt=0x200 -# CPLD image- max size 4MB -elif [ "$img_type" = 'Other' ]; then - echo "CPLD firmware image" - # 4MB - 4194304 - img_size=4194304 - upd_intent_val=0x04 - # dd command accepts the offset in decimal - # below is the page offset in 4KB boundary - img_page_offset=12288 - erase_offset=0x3000000 - blk_cnt=0x40 -# BIOS image- max size 16MB -elif [ "$img_type" = 'Host' ]; then - echo "BIOS firmware image" - # 16MB- 16777216 - img_size=16777216 - if [ "$img_target" = 'StandbySpare' ]; then - upd_intent_val=0x02 + blk_cnt=$((img_size / 0x10000)) + + if pfr_active_mode; then + # pfr enforcing mode; any b0b1 image type + pfr_staging_update + elif [ "$img_type" == '04' ]; then + # legacy mode; pfr is not present but we got a pfr image + log "Updating BMC active firmware- PFR unprovisioned mode" + pfr_active_update else - upd_intent_val=0x01 + # error; pfr is not present but we got a pfr image, + # an invalid image, or nonBMC image + log "PFR inactive or invalid image type:${img_type}, cowardly refusing to process image" + redfish_log_fw_evt abort + return 1 fi - # dd command accepts the offset in decimal - # below is the page offset in 4KB boundary - img_page_offset=8192 - erase_offset=0x2000000 - blk_cnt=0x100 -else - echo "${img_type}:Unknown image type, exiting the firmware update script" - rm -rf /tmp/fwupd_progress - exit 1 -fi - -if [ "$apply_time" == 'OnReset' ]; then - upd_intent_val=$(( "$upd_intent_val"|0x80 )) -fi - -# do a size check on the image -if [ $(stat -c "%s" "$LOCAL_PATH") -gt $img_size ]; then - echo "Update file "$LOCAL_PATH" is bigger than the supported image size" - rm -rf /tmp/fwupd_progress - exit 1 -fi - -TGT="/dev/mtd/image-stg" -echo "Update $(basename $TGT)" -flash_erase $TGT $erase_offset $blk_cnt -sync -echo "Writing $(stat -c "%s" "$LOCAL_PATH") bytes" -# cat "$LOCAL_PATH" > "$TGT" -dd bs=4k seek=$img_page_offset if=$LOCAL_PATH of=$TGT -sync -echo "Written $(stat -c "%s" "$LOCAL_PATH") bytes" -# remove the updated image from /tmp -rm -f $LOCAL_PATH -echo "Writing $upd_intent_val to update intent register in PFR RoT" -sleep 5 # delay for sync and to get the above echo messages - -# remove the file which used as lock -rm -rf /tmp/fwupd_progress - -# write to PFRCPLD about BMC update intent. -i2cset -y 4 0x38 0x13 $upd_intent_val - -else # Non-PFR image update section -version="unknown" -component="BMC" -manifest_file=$(dirname "${REMOTE_PATH}")"/MANIFEST" -if [ -e $manifest_file ]; then - version=`awk -F= -v key="version" '$1==key {print $2}' $manifest_file` -fi - -logevent_update_started $component $version - -# do a quick sanity check on the image -if [ $(stat -c "%s" "$LOCAL_PATH") -lt 10000000 ]; then - echo "Update file "$LOCAL_PATH" seems to be too small" - logevent_update_failed $component $version - exit 1 -fi -dtc -I dtb -O dtb "$LOCAL_PATH" > /dev/null 2>&1 -if [ $? -ne 0 ]; then - echo "Update file $LOCAL_PATH doesn't seem to be in the proper format" - logevent_update_failed $component $version - exit 1 -fi +} -# guess based on fw_env which partition we booted from -BOOTADDR=$(fw_printenv bootcmd | awk '{print $2}') +ping_pong_update() { + # do a quick sanity check on the image + if [ $(stat -c "%s" "$LOCAL_PATH") -lt 10000000 ]; then + log "Update file "$LOCAL_PATH" seems to be too small" + redfish_log_fw_evt abort + return 1 + fi + dtc -I dtb -O dtb "$LOCAL_PATH" > /dev/null 2>&1 + if [ $? -ne 0 ]; then + log "Update file $LOCAL_PATH doesn't seem to be in the proper format" + redfish_log_fw_evt abort + return 1 + fi -TGT="/dev/mtd/image-a" -if [ ! -e /usr/share/pfr ]; then + # guess based on fw_env which partition we booted from + local BOOTADDR=$(fw_printenv bootcmd | awk '{print $2}') + local TGT="/dev/mtd/image-a" case "$BOOTADDR" in 20080000) TGT="/dev/mtd/image-b"; BOOTADDR="22480000" ;; 22480000) TGT="/dev/mtd/image-a"; BOOTADDR="20080000" ;; *) TGT="/dev/mtd/image-a"; BOOTADDR="20080000" ;; esac -fi -echo "Updating $(basename $TGT) (use bootm $BOOTADDR)" -flash_erase $TGT 0 0 -if [ $? -ne 0 ]; then - echo "Erasing the flash failed" - logevent_update_failed $component $version - exit 1 -fi -echo "Writing $(stat -c "%s" "$LOCAL_PATH") bytes" -cat "$LOCAL_PATH" > "$TGT" -if [ $? -ne 0 ]; then - echo "Writing to flash failed" - logevent_update_failed $component $version - exit 1 -fi -fw_setenv "bootcmd" "bootm ${BOOTADDR}" + log "Updating $(basename $TGT) (use bootm $BOOTADDR)" + flash_erase $TGT 0 0 + log "Writing $(stat -c "%s" "$LOCAL_PATH") bytes" + cat "$LOCAL_PATH" > "$TGT" + fw_setenv "bootcmd" "bootm ${BOOTADDR}" + redfish_log_fw_evt success + wait_for_log_sync + # reboot + reboot +} -logevent_update_completed $component $version +fetch_fw() { + PROTO=$(echo "$URI" | sed 's,\([a-z]*\)://.*$,\1,') + REMOTE=$(echo "$URI" | sed 's,.*://\(.*\)$,\1,') + REMOTE_HOST=$(echo "$REMOTE" | sed 's,\([^/]*\)/.*$,\1,') + if [ "$PROTO" = 'scp' ]; then + REMOTE_PATH=$(echo "$REMOTE" | cut -d':' -f2) + else + REMOTE_PATH=$(echo "$REMOTE" | sed 's,[^/]*/\(.*\)$,\1,') + fi + LOCAL_PATH="/tmp/$(basename $REMOTE_PATH)" + log "PROTO=$PROTO" + log "REMOTE=$REMOTE" + log "REMOTE_HOST=$REMOTE_HOST" + log "REMOTE_PATH=$REMOTE_PATH" + if [ ! -e $LOCAL_PATH ] || [ $(stat -c %s $LOCAL_PATH) -eq 0 ]; then + log "Download '$REMOTE_PATH' from $PROTO $REMOTE_HOST $REMOTE_PATH" + case "$PROTO" in + scp) + mkdir -p $HOME/.ssh + if [ -e "$SSH_ID" ]; then + ARG_ID="-i $SSH_ID" + fi + scp $ARG_ID $REMOTE_HOST$REMOTE_PATH $LOCAL_PATH + if [ $? -ne 0 ]; then + log "scp $REMOTE $LOCAL_PATH failed!" + return 1 + fi + ;; + tftp) + cd /tmp + tftp -g -r "$REMOTE_PATH" "$REMOTE_HOST" + if [ $? -ne 0 ]; then + log "tftp -g -r \"$REMOTE_PATH\" \"$REMOTE_HOST\" failed!" + return 1 + fi + ;; + http|https|ftp) + wget --no-check-certificate "$URI" -O "$LOCAL_PATH" + if [ $? -ne 0 ]; then + log "wget $URI failed!" + return 1 + fi + ;; + file) + LOCAL_PATH=$(echo $URI | sed 's,^file://,,') + ;; + *) + log "Invalid URI $URI" + return 1 + ;; + esac + fi +} -# reboot -reboot +update_fw() { + redfish_log_fw_evt start + # determine firmware file type + local magic=$(hexdump -n 4 -v -e '/1 "%02x"' "$LOCAL_PATH") + case "$magic" in + d00dfeed) ping_pong_update ;; + 19fdeab6) blk0blk1_update ;; + *) log "Uknown file type ${magic}" + esac +} + +# if this script was sourced, just return without executing anything +[ "$_" != "$0" ] && return 0 >&/dev/null + +usage() { + echo "usage: $(basename $0) uri" + echo " uri is something like: file:///path/to/fw" + echo " tftp://tftp.server.ip.addr/path/to/fw" + echo " scp://[user@]scp.server.ip.addr:/path/to/fw" + echo " http[s]://web.server.ip.addr/path/to/fw" + echo " ftp://[user@]ftp.server.ip.addr/path/to/fw" + exit 1 +} + +if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then usage; fi +if [ $# -eq 0 ]; then + # set DEFURI in $HOME/.fwupd.defaults + URI="$DEFURI" +else + if [[ "$1" == *"/"* ]]; then + URI=$1 # local file + local_file=1 ; + else + URI="file:////tmp/images/$1/image-runtime" + img_obj=$1 + local_file=0 ; + fi fi +fetch_fw && update_fw diff --git a/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb b/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb index 7c994053e..007a4aece 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb @@ -7,7 +7,7 @@ RDEPENDS_intel-fw-update += "mtd-utils" # wget tftp scp RDEPENDS_intel-fw-update += "busybox dropbear" # mkfs.vfat, parted -RDEPENDS_intel-fw-update += "dosfstools" +RDEPENDS_intel-fw-update += "dosfstools dtc" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" diff --git a/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_git.bb b/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_git.bb index faa08a58c..6b6d58bfc 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_git.bb @@ -7,7 +7,7 @@ SRC_URI = "git://github.com/Intel-BMC/host-error-monitor.git;protocol=ssh" DEPENDS = "boost sdbusplus libgpiod libpeci" PV = "0.1+git${SRCPV}" -SRCREV = "ba7c4e08b423dc71bb8dcb963942cba860cdf7d4" +SRCREV = "4215c9de1b5fc3f86f2a2538f04675fc0ee12086" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch index 88da437fc..7bba22ede 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch @@ -1,31 +1,29 @@ -From 40303196d9f07b71042cd7ba87dcab6fdad29422 Mon Sep 17 00:00:00 2001 +From ab1634441f4dd218486f6bb3b94e90e2110ccc2a Mon Sep 17 00:00:00 2001 From: Nikhil Potade Date: Tue, 19 Feb 2019 14:16:20 +0800 Subject: [PATCH 1/1] Smbus changes for libmctp Signed-off-by: James Feist --- - CMakeLists.txt | 6 ++++-- + CMakeLists.txt | 5 +++-- core.c | 2 ++ libmctp.h | 40 ++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 46 insertions(+), 2 deletions(-) + 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index a5b1042..249b12b 100644 +index f3f05bd..7991b11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -2,8 +2,9 @@ cmake_minimum_required (VERSION 3.5 FATAL_ERROR) - - add_definitions (-DMCTP_LOG_STDERR) - add_definitions (-DMCTP_HAVE_FILEIO) -+add_definitions (-DMCTP_DEFAULT_ALLOC) +@@ -5,7 +5,7 @@ add_definitions (-DMCTP_HAVE_FILEIO) + add_definitions (-DMCTP_HAVE_STDIO) + add_definitions (-DMCTP_DEFAULT_ALLOC) -add_library (libmctp STATIC alloc.c core.c log.c libmctp.h serial.c) +add_library (libmctp STATIC alloc.c core.c log.c libmctp.h serial.c smbus.c crc32c.c) target_include_directories (libmctp PUBLIC $ -@@ -18,5 +19,6 @@ add_executable (test_seq tests/test_seq.c tests/test-utils.c) +@@ -20,5 +20,6 @@ add_executable (test_seq tests/test_seq.c tests/test-utils.c) target_link_libraries (test_seq libmctp) install (TARGETS libmctp DESTINATION lib) @@ -34,7 +32,7 @@ index a5b1042..249b12b 100644 + include) diff --git a/core.c b/core.c -index 61356e9..622bc5e 100644 +index f8abbb1..79a681c 100644 --- a/core.c +++ b/core.c @@ -17,6 +17,7 @@ @@ -54,7 +52,7 @@ index 61356e9..622bc5e 100644 #ifndef BUILD_ASSERT #define BUILD_ASSERT(x) \ diff --git a/libmctp.h b/libmctp.h -index b36a943..4f211f9 100644 +index 69ec46a..b7212be 100644 --- a/libmctp.h +++ b/libmctp.h @@ -15,6 +15,7 @@ extern "C" { @@ -71,9 +69,9 @@ index b36a943..4f211f9 100644 #define MCTP_HDR_TAG_MASK (0x7) +/* clang-format on */ - /* Baseline maximum size of a MCTP packet */ - #define MCTP_BMTU_PAYLOAD 64 - #define MCTP_BMTU (MCTP_BMTU_PAYLOAD + sizeof(struct mctp_hdr)) + /* Baseline Transmission Unit and packet size */ + #define MCTP_BTU 64 + #define MCTP_PACKET_SIZE(unit) ((unit) + sizeof(struct mctp_hdr)) +#define MCTP_CONTROL_MESSAGE_TYPE 0x00 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/libmctp-smbus.h b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/libmctp-smbus.h index 5ecaa6b74..67690bcb3 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/libmctp-smbus.h +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/libmctp-smbus.h @@ -20,6 +20,10 @@ int mctp_smbus_read(struct mctp_binding_smbus *smbus); int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, int root_bus_num); void mctp_smbus_free(struct mctp_binding_smbus *smbus); +int mctp_smbus_open_in_bus(struct mctp_binding_smbus *smbus, int in_bus); +int mctp_smbus_open_out_bus(struct mctp_binding_smbus *smbus, int out_bus); +int mctp_smbus_set_in_fd(struct mctp_binding_smbus *smbus, int fd); +int mctp_smbus_set_out_fd(struct mctp_binding_smbus *smbus, int fd); #ifdef __cplusplus } diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c index bbdfe2aa4..2f099a7e5 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c @@ -52,6 +52,7 @@ struct mctp_binding_smbus { #define SMBUS_PEC_BYTE_SIZE 1 #define SMBUS_COMMAND_CODE_SIZE 1 #define SMBUS_LENGTH_FIELD_SIZE 1 +#define SMBUS_ADDR_OFFSET_SLAVE 0x1000 struct mctp_smbus_header_tx { uint8_t source_slave_address; @@ -312,7 +313,7 @@ int mctp_smbus_open_in_bus(struct mctp_binding_smbus *smbus, int in_bus) snprintf(filename, size, "/sys/bus/i2c/devices/i2c-%d/%d-%04x/slave-mqueue", in_bus, - in_bus, (address_7_bit << 8) + address_7_bit); + in_bus, SMBUS_ADDR_OFFSET_SLAVE | address_7_bit); ret = open(filename, O_RDONLY | O_NONBLOCK | O_CLOEXEC); if (ret >= 0) { @@ -333,7 +334,7 @@ int mctp_smbus_open_in_bus(struct mctp_binding_smbus *smbus, int in_bus) mqueue_size = sizeof(slave_mqueue); snprintf(slave_mqueue, mqueue_size, "slave-mqueue %#04x", - (address_7_bit << 8) + address_7_bit); + SMBUS_ADDR_OFFSET_SLAVE | address_7_bit); size = write(fd, slave_mqueue, mqueue_size); close(fd); @@ -345,7 +346,7 @@ int mctp_smbus_open_in_bus(struct mctp_binding_smbus *smbus, int in_bus) size = sizeof(filename); snprintf(filename, size, "/sys/bus/i2c/devices/i2c-%d/%d-%04x/slave-mqueue", in_bus, - in_bus, (address_7_bit << 8) + address_7_bit); + in_bus, SMBUS_ADDR_OFFSET_SLAVE | address_7_bit); return open(filename, O_RDONLY | O_NONBLOCK | O_CLOEXEC); } @@ -375,7 +376,7 @@ int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, snprintf(filename, size, "/sys/bus/i2c/devices/i2c-%d/%d-%04x/slave-mqueue", root_bus_num, root_bus_num, - (address_7_bit << 8) + address_7_bit); + SMBUS_ADDR_OFFSET_SLAVE | address_7_bit); smbus->in_fd = open(filename, O_RDONLY | O_NONBLOCK | O_CLOEXEC); if (smbus->in_fd < 0) { @@ -394,7 +395,7 @@ int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, mqueue_size = sizeof(slave_mqueue); snprintf(slave_mqueue, mqueue_size, "slave-mqueue %#04x", - (address_7_bit << 8) + address_7_bit); + SMBUS_ADDR_OFFSET_SLAVE | address_7_bit); size = write(fd, slave_mqueue, mqueue_size); close(fd); @@ -408,7 +409,7 @@ int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, snprintf(filename, size, "/sys/bus/i2c/devices/i2c-%d/%d-%04x/slave-mqueue", root_bus_num, root_bus_num, - (address_7_bit << 8) + address_7_bit); + SMBUS_ADDR_OFFSET_SLAVE | address_7_bit); smbus->in_fd = open(filename, O_RDONLY | O_NONBLOCK | O_CLOEXEC); diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb index 132db31c7..97ce1179f 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp" DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)" SRC_URI = "git://github.com/openbmc/libmctp.git" -SRCREV = "34b9b3d82b049610775aea4460ff0f3bb9f02b1d" +SRCREV = "b6516a083c622a76e3e485f56b743b2a63171881" PV = "0.1+git${SRCPV}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend index 0cb5bd52e..eeafa0222 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend @@ -1,4 +1,5 @@ EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DINTEL_PFR_ENABLED=ON', '', d)}" EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" +EXTRA_OECMAKE += "-DUSING_ENTITY_MANAGER_DECORATORS=OFF" SRC_URI = "git://github.com/openbmc/intel-ipmi-oem.git" -SRCREV = "38b58f5866602906833f7afc864dd2729516dd7f" +SRCREV = "849c319f95bfc5b76b1731cadbf95c24093aa53c" diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/ipmi-providers.bb b/meta-openbmc-mods/meta-common/recipes-core/ipmi/ipmi-providers.bb deleted file mode 100644 index 939efa75f..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/ipmi-providers.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "Intel IPMI Providers" -DESCRIPTION = "IPMI Provider Libraries" - -SRC_URI = "git://github.com/Intel-BMC/intel-ipmi-providers;protocol=ssh" -SRCREV = "b2c6184269e3bdf601c38f716ac7ee73379af71b" - -S = "${WORKDIR}/git" -PV = "0.1+git${SRCPV}" - -DEPENDS = "boost phosphor-ipmi-host intel-ipmi-oem systemd microsoft-gsl" - -inherit cmake obmc-phosphor-ipmiprovider-symlink - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" - -EXTRA_OECMAKE="-DENABLE_TEST=0 -DYOCTO=1" - -LIBRARY_NAMES += "libmtmcmds.so" -LIBRARY_NAMES += "libsmbioshandler.so" -LIBRARY_NAMES += "libzbridgecmd.so" -LIBRARY_NAMES += "libsmbiosmdrv2.so" -LIBRARY_NAMES += "libfwupdcmds.so" - -HOSTIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}" -NETIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}" - -FILES_${PN}_append = " ${libdir}/ipmid-providers/lib*${SOLIBS}" -FILES_${PN}_append = " ${libdir}/host-ipmid/lib*${SOLIBS}" -FILES_${PN}_append = " ${libdir}/net-ipmid/lib*${SOLIBS}" -FILES_${PN}-dev_append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV}" - diff --git a/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb b/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb index 5ec8669e6..5a49156da 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb @@ -5,7 +5,7 @@ inherit cmake SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" PV = "0.1+git${SRCPV}" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" S = "${WORKDIR}/git/libpeci" diff --git a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb b/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb index a09c8ac2d..449dcf04d 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb @@ -7,7 +7,7 @@ SECTION = "lib" inherit autotools pkgconfig S = "${WORKDIR}/git" -SRCREV = "60786283fd61cd621a5d1df00e083a1c1e3cf52a" +SRCREV = "a7da29dadadde04feec174f595b59d67a64f3956" SRC_URI = "git://github.com/rurban/safeclib.git" COMPATIBLE_HOST = '(x86_64|i.86|powerpc|powerpc64|arm|aarch64).*-linux' diff --git a/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb b/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb index 027161fc5..2a00f6375 100644 --- a/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb +++ b/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb @@ -18,3 +18,4 @@ inherit cmake pkgconfig # Specify any options you want to pass to cmake using EXTRA_OECMAKE: EXTRA_OECMAKE = "" +EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', '-DDEVELOPER_OPTIONS=ON', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend index a7fefea96..6d0732265 100644 --- a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend @@ -1,4 +1,4 @@ #SRC_URI += "git://github.com/openbmc/sdbusplus" -SRCREV = "4212292bcf136d04b38ba5116aa568b0fa312798" +SRCREV = "67c79b0ca6e013c8621dd2cff95e367dbb75bb2a" diff --git a/meta-openbmc-mods/meta-common/recipes-extended/shadow/shadow/pam.d/login b/meta-openbmc-mods/meta-common/recipes-extended/shadow/shadow/pam.d/login new file mode 100644 index 000000000..51dd3a83b --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-extended/shadow/shadow/pam.d/login @@ -0,0 +1,90 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# Note that it is included as a "requisite" module. No password prompts will +# be displayed if this module fails to avoid having the root password +# transmitted on unsecure ttys. +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root). +auth [success=ok ignore=ignore user_unknown=ignore default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 + +# Allow only uid 0 for login prompt authentication +auth required pam_succeed_if.so uid eq 0 + +# Do regular pam unix based authentication. Allow null password. +auth [success=2 default=ignore] pam_unix.so quiet nullok_secure +# here's the fallback if no module succeeds +auth requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +auth required pam_permit.so + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restrainst on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon succesful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the motd upon succesful login +# (Replaces the `MOTD_FILE' option in login.defs) +session optional pam_motd.so + +# Prints the status of the user's mailbox upon succesful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Standard Un*x account and session +account include common-account +password include common-password +session include common-session diff --git a/meta-openbmc-mods/meta-common/recipes-extended/shadow/shadow_%.bbappend b/meta-openbmc-mods/meta-common/recipes-extended/shadow/shadow_%.bbappend new file mode 100644 index 000000000..283d787e5 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-extended/shadow/shadow_%.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +PAM_SRC_URI += "file://pam.d/login \ + " diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend index c9aeb07b8..fc1dd5a37 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend @@ -2,4 +2,4 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" # Use the latest to support obmc-ikvm properly #SRC_URI = "git://github.com/LibVNC/libvncserver" -SRCREV = "daf250ff188e8d8d44503e2a2fdb79820d723ad5" +SRCREV = "6fa1b219f8b173e292b5a0591986d390e3c86ef5" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb index 636a8a3c3..b6fa1c9ea 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb @@ -2,7 +2,7 @@ SUMMARY = "HSBP Manager" DESCRIPTION = "HSBP Manager monitors HSBPs through SMBUS" SRC_URI = "git://github.com/openbmc/s2600wf-misc.git" -SRCREV = "e6db783f06594c4f0057f7b6c22b90d6f344960b" +SRCREV = "da0c35fce8b53c1fba05b253c2e24effbbd97197" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb b/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb index 8fa7ba865..545ecae7f 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb @@ -3,6 +3,7 @@ DESCRIPTION = "Image with Intel content based upon Phosphor, an OpenBMC framewor inherit obmc-phosphor-full-fitimage inherit obmc-phosphor-image-common inherit obmc-phosphor-image-dev +inherit ${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'image_types_intel_pfr', '', d)} DEPENDS += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'obmc-intel-pfr-image-native', '', d)}" DEPENDS += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'intel-pfr-manager', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json index c9f7d0746..b567faa02 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json @@ -73,11 +73,21 @@ "name": "image-stg", "index": 7, "offset": "0x4a00000", - "size": "0x3600000", + "size": "0x3500000", "prot_mask": 3, "pfm": 1, "hash": 0, "compress": 0 + }, + { + "name": "cpld-rc", + "index": 8, + "offset": "0x7f00000", + "size": "0x100000", + "prot_mask": 0, + "pfm": 1, + "hash": 0, + "compress": 0 } ], "i2c-rules": [{ @@ -100,7 +110,7 @@ "bus-id": 1, "rule-id": 6, "address": "0xB0", - "cmd-whitelist": ["0x03", "0x05", "0x06", "0x19", "0x1A", "0x30", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F", + "cmd-whitelist": ["0x00", "0x03", "0x05", "0x06", "0x19", "0x1A", "0x30", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F", "0x79", "0x7A", "0x7B", "0x7C", "0x7D", "0x7E", "0x7F", "0x81", "0x82", "0x86", "0x87", "0x88", "0x89", "0x8C", "0x8D", "0x8E", "0x8F", "0x90", "0x91", "0x92", "0x93", "0x94", "0x95", "0x96", "0x97", "0x98", "0x9A", "0xA6", "0xA7", "0xD0", "0xD3", "0xD4", "0xD5", "0xD6", "0xD7", "0xD8", @@ -110,7 +120,7 @@ "bus-id": 1, "rule-id": 4, "address": "0xB2", - "cmd-whitelist": ["0x03", "0x05", "0x06", "0x19", "0x1A", "0x30", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F", + "cmd-whitelist": ["0x00", "0x03", "0x05", "0x06", "0x19", "0x1A", "0x30", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F", "0x79", "0x7A", "0x7B", "0x7C", "0x7D", "0x7E", "0x7F", "0x81", "0x82", "0x86", "0x87", "0x88", "0x89", "0x8C", "0x8D", "0x8E", "0x8F", "0x90", "0x91", "0x92", "0x93", "0x94", "0x95", "0x96", "0x97", "0x98", "0x9A", "0xA6", "0xA7", "0xD0", "0xD3", "0xD4", "0xD5", "0xD6", "0xD7", "0xD8", diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-manager_git.bb index 65348652c..d48ffb1a5 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-manager_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.PFR.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb index 0c032c509..daeced419 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb @@ -2,7 +2,7 @@ SUMMARY = "Power supply manager for Intel based platform" DESCRIPTION = "Power supply manager which include PSU Cold Redundancy service" SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" S = "${WORKDIR}/git/psu-manager/" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb index 59cdc8781..306ef13f5 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb @@ -2,7 +2,7 @@ SUMMARY = "SMBIOS MDR version 2 service for Intel based platform" DESCRIPTION = "SMBIOS MDR version 2 service for Intel based platfrom" SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" S = "${WORKDIR}/git/services/smbios-mdrv2/" diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2500-platforms.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2500-platforms.patch index baf9dba9a..31061624c 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2500-platforms.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2500-platforms.patch @@ -1,4 +1,4 @@ -From 89dec433cd2fcfcb8690b315bb4e787d53de2296 Mon Sep 17 00:00:00 2001 +From da2fecd5d5b3f69bcc4d07fd1265415bd350e5a6 Mon Sep 17 00:00:00 2001 From: Yuan Li Date: Tue, 19 Sep 2017 15:55:39 +0800 Subject: [PATCH] arm: dts: add DTS for Intel ast2500 platforms @@ -14,17 +14,19 @@ Signed-off-by: Zhu, Yunge Signed-off-by: Qiang XU Signed-off-by: Chen Yugang Signed-off-by: Zhikui Ren +Signed-off-by: jayaprakash Mutyala +Signed-off-by: AppaRao Puli --- - arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts | 471 +++++++++++++++++++++++++ - 1 file changed, 471 insertions(+) + arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts | 460 +++++++++++++++++++++++++ + 1 file changed, 460 insertions(+) create mode 100644 arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts b/arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts new file mode 100644 -index 0000000..6ded94d +index 0000000..1fe6240 --- /dev/null +++ b/arch/arm/boot/dts/aspeed-bmc-intel-ast2500.dts -@@ -0,0 +1,470 @@ +@@ -0,0 +1,460 @@ +/dts-v1/; + +#include "aspeed-g5.dtsi" @@ -114,7 +116,7 @@ index 0000000..6ded94d + + beeper { + compatible = "pwm-beeper"; -+ pwms = <&timer 5 1000000 0>; ++ pwms = <&timer 6 1000000 0>; + }; +}; + @@ -180,8 +182,8 @@ index 0000000..6ded94d + /*D0-D7*/ "","","","","","","","", + /*E0-E7*/ "RESET_BUTTON","RESET_OUT","POWER_BUTTON","POWER_OUT","","DEBUG_EN_N","","", + /*F0-F7*/ "NMI_OUT","","","","CPU_ERR0","CPU_ERR1","PLTRST_N","PRDY_N", -+ /*G0-G7*/ "CPU_ERR2","CPU_CATERR","PCH_BMC_THERMTRIP","","","FM_BMC_BOARD_SKU_ID5_N","","", -+ /*H0-H7*/ "","","","","","","","", ++ /*G0-G7*/ "CPU_ERR2","CPU_CATERR","PCH_BMC_THERMTRIP","LCP_ENTER_BUTTON","LCP_LEFT_BUTTON","FM_BMC_BOARD_SKU_ID5_N","","", ++ /*H0-H7*/ "","","","FM_NODE_ID_1","FM_NODE_ID_2","FM_NODE_ID_3","FM_NODE_ID_4","FM_240VA_STATUS", + /*I0-I7*/ "FM_SYS_FAN0_PRSNT_D_N","FM_SYS_FAN1_PRSNT_D_N","FM_SYS_FAN2_PRSNT_D_N","FM_SYS_FAN3_PRSNT_D_N","FM_SYS_FAN4_PRSNT_D_N","FM_SYS_FAN5_PRSNT_D_N","","", + /*J0-J7*/ "","","","","","","","", + /*K0-K7*/ "","","","","","","","", @@ -191,7 +193,7 @@ index 0000000..6ded94d + /*O0-O7*/ "","","","","","","","", + /*P0-P7*/ "","","","","","","","", + /*Q0-Q7*/ "","","","","","","","PWR_DEBUG_N", -+ /*R0-R7*/ "","XDP_PRST_N","","","","","","", ++ /*R0-R7*/ "","XDP_PRST_N","","","","","","CHASSIS_INTRUSION", + /*S0-S7*/ "REMOTE_DEBUG_ENABLE","SYSPWROK","RSMRST_N","","","","","", + /*T0-T7*/ "","","","","","","","", + /*U0-U7*/ "","","","","","","","", @@ -224,8 +226,8 @@ index 0000000..6ded94d + + /* SGPIO input lines */ + /*IA0-IA7*/ "CPU1_PRESENCE","CPU1_THERMTRIP","CPU1_VRHOT","CPU1_FIVR_FAULT","CPU1_MEM_ABCD_VRHOT","CPU1_MEM_EFGH_VRHOT","","", -+ /*IB0-IB7*/ "","","CPU2_PRESENCE","CPU2_THERMTRIP","CPU2_VRHOT","CPU2_FIVR_FAULT","CPU2_MEM_ABCD_VRHOT","CPU2_MEM_EFGH_VRHOT", -+ /*IC0-IC7*/ "","","","","","","","", ++ /*IB0-IB7*/ "CPU1_MISMATCH","CPU1_MEM_THERM_EVENT","CPU2_PRESENCE","CPU2_THERMTRIP","CPU2_VRHOT","CPU2_FIVR_FAULT","CPU2_MEM_ABCD_VRHOT","CPU2_MEM_EFGH_VRHOT", ++ /*IC0-IC7*/ "","","CPU2_MISMATCH","CPU2_MEM_THERM_EVENT","","","","", + /*ID0-ID7*/ "","","","","","","","", + /*IE0-IE7*/ "","","","","","","","", + /*IF0-IF7*/ "","","","","","","","", @@ -365,11 +367,6 @@ index 0000000..6ded94d + aspeed,dma-buf-size = <4095>; + aspeed,hw-timeout-ms = <300>; + status = "okay"; -+ -+ hsbp0@10 { -+ compatible = "slave-mqueue"; -+ reg = <(0x10 | I2C_OWN_SLAVE_ADDRESS)>; -+ }; +}; + +&i2c5 { @@ -378,11 +375,6 @@ index 0000000..6ded94d + aspeed,dma-buf-size = <4095>; + aspeed,hw-timeout-ms = <300>; + status = "okay"; -+ -+ smlink0@10 { -+ compatible = "slave-mqueue"; -+ reg = <(0x10 | I2C_OWN_SLAVE_ADDRESS)>; -+ }; +}; + +&i2c6 { @@ -480,9 +472,9 @@ index 0000000..6ded94d + * pinctrl-0 = <&pinctrl_timer5_default &pinctrl_timer6_default + * &pinctrl_timer7_default &pinctrl_timer8_default>; + */ -+ fttmr010,pwm-outputs = <5>; ++ fttmr010,pwm-outputs = <6>; + pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_timer5_default>; ++ pinctrl-0 = <&pinctrl_timer6_default>; + #pwm-cells = <3>; + status = "okay"; +}; @@ -495,6 +487,6 @@ index 0000000..6ded94d +&vhub { + status = "okay"; +}; --- +-- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2600-platforms.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2600-platforms.patch index 34490822e..cc025e1f8 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2600-platforms.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2600-platforms.patch @@ -1,4 +1,4 @@ -From 57363b496c6eb832b0c3407ee997fdee09f4007f Mon Sep 17 00:00:00 2001 +From 733ea1e7c0fd70ce372efcc8250bb2baebd74b68 Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Tue, 19 Sep 2017 15:55:39 +0800 Subject: [PATCH] arm: dts: add DTS for Intel ast2600 platforms @@ -8,17 +8,19 @@ Add the DTS file for Intel ast2600-based systems. Signed-off-by: Vernon Mauery Signed-off-by: Jae Hyun Yoo Signed-off-by: Chen Yugang +Signed-off-by: Kuiying Wang +Signed-off-by: arun-pm --- - arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts | 507 +++++++++++++++++++++++++ - 1 file changed, 507 insertions(+) + arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts | 497 +++++++++++++++++++++++++ + 1 file changed, 497 insertions(+) create mode 100644 arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts new file mode 100644 -index 000000000000..1ad46e8bc69b +index 000000000000..5bc76dd069af --- /dev/null +++ b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts -@@ -0,0 +1,507 @@ +@@ -0,0 +1,497 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + @@ -76,8 +78,8 @@ index 000000000000..1ad46e8bc69b + compatible = "iio-hwmon"; + io-channels = <&adc0 0>, <&adc0 1>, <&adc0 2>, <&adc0 3>, + <&adc0 4>, <&adc0 5>, <&adc0 6>, <&adc0 7>, -+ <&adc1 8>, <&adc1 9>, <&adc1 10>, <&adc1 11>, -+ <&adc1 12>, <&adc1 13>, <&adc1 14>, <&adc1 15>; ++ <&adc1 0>, <&adc1 1>, <&adc1 2>, <&adc1 3>, ++ <&adc1 4>, <&adc1 5>, <&adc1 6>, <&adc1 7>; + }; + + leds { @@ -112,14 +114,15 @@ index 000000000000..1ad46e8bc69b + reg = <0x0>; + #address-cells = <1>; + #size-cells = <1>; -+ spi-max-frequency = <10000000>; ++ spi-max-frequency = <40000000>; ++ spi-tx-bus-width = <4>; + m25p,fast-read; +#include "openbmc-flash-layout-intel-64MB.dtsi" + }; +}; + +&espi { -+ status = "disabled"; /* FIXME: Use H/W handshaking */ ++ status = "okay"; +}; + +&peci0 { @@ -173,14 +176,14 @@ index 000000000000..1ad46e8bc69b + gpio-line-names = + /*A0-A7*/ "","","","","SMB_CPU_PIROM_SCL","SMB_CPU_PIROM_SDA","SMB_IPMB_STBY_LVC3_R_SCL","SMB_IPMB_STBY_LVC3_R_SDA", + /*B0-B7*/ "FM_1200VA_OC","NMI_OUT","IRQ_SMB3_M2_ALERT_N","","RGMII_BMC_RMM4_LVC3_R_MDC","RGMII_BMC_RMM4_LVC3_R_MDIO","FM_BMC_BMCINIT_R","FP_ID_LED_N", -+ /*C0-C7*/ "FM_FORCE_BMC_UPDATE_N","RST_RGMII_PHYRST_N","FM_TPM_EN_PULSE","FM_BMC_CRASHLOG_TRIG_N","IRQ_BMC_PCH_NMI_R","FM_CPU1_DISABLE_COD_N","","", ++ /*C0-C7*/ "FM_FORCE_BMC_UPDATE_N","RST_RGMII_PHYRST_N","FM_TPM_EN_PULSE","FM_BMC_CRASHLOG_TRIG_N","IRQ_BMC_PCH_NMI_R","FM_CPU1_DISABLE_COD_N","FM_4S_8S_N_MODE","FM_STANDALONE_MODE_N", + /*D0-D7*/ "CPU_ERR0","CPU_ERR1","CPU_ERR2","PRDY_N","FM_SPD_SWITCH_CTRL_N","","","", + /*E0-E7*/ "FM_SKT1_FAULT_LED","FM_SKT0_FAULT_LED","CLK_50M_CKMNG_BMCB","FM_BMC_BOARD_REV_ID2_N","","","","", + /*F0-F7*/ "FM_BMC_BOARD_SKU_ID0_N","FM_BMC_BOARD_SKU_ID1_N","FM_BMC_BOARD_SKU_ID2_N","FM_BMC_BOARD_SKU_ID3_N","FM_BMC_BOARD_SKU_ID4_N","FM_BMC_BOARD_SKU_ID5_N","ID_BUTTON","PS_PWROK", + /*G0-G7*/ "FM_SMB_BMC_NVME_LVC3_ALERT_N","RST_BMC_I2C_M2_R_N","FP_LED_STATUS_GREEN_N","FP_LED_STATUS_AMBER_N","FM_BMC_BOARD_REV_ID0_N","FM_BMC_BOARD_REV_ID1_N","FM_BMC_CPU_FBRK_OUT_R_N","DBP_PRESENT_IN_R2_N", + /*H0-H7*/ "SGPIO_BMC_CLK_R","SGPIO_BMC_LD_R","SGPIO_BMC_DOUT_R","SGPIO_BMC_DIN","PLTRST_N","CPU_CATERR","PCH_BMC_THERMTRIP","", + /*I0-I7*/ "JTAG_ASD_NTRST_R_N","JTAG_ASD_TDI_R","JTAG_ASD_TCK_R","JTAG_ASD_TMS_R","JTAG_ASD_TDO","FM_BMC_PWRBTN_OUT_R_N","FM_BMC_PWR_BTN_N","", -+ /*J0-J7*/ "SMB_CHASSENSOR_STBY_LVC3_SCL","SMB_CHASSENSOR_STBY_LVC3_SDA","","","","","","", ++ /*J0-J7*/ "SMB_CHASSENSOR_STBY_LVC3_SCL","SMB_CHASSENSOR_STBY_LVC3_SDA","FM_NODE_ID0","FM_NODE_ID1","","","","", + /*K0-K7*/ "SMB_HSBP_STBY_LVC3_R_SCL","SMB_HSBP_STBY_LVC3_R_SDA","SMB_SMLINK0_STBY_LVC3_R2_SCL","SMB_SMLINK0_STBY_LVC3_R2_SDA","SMB_TEMPSENSOR_STBY_LVC3_R_SCL","SMB_TEMPSENSOR_STBY_LVC3_R_SDA","SMB_PMBUS_SML1_STBY_LVC3_R_SCL","SMB_PMBUS_SML1_STBY_LVC3_R_SDA", + /*L0-L7*/ "SMB_PCIE_STBY_LVC3_R_SCL","SMB_PCIE_STBY_LVC3_R_SDA","SMB_HOST_STBY_BMC_LVC3_R_SCL","SMB_HOST_STBY_BMC_LVC3_R_SDA","PREQ_N","DEBUG_EN_N","V_BMC_GFX_HSYNC_R","V_BMC_GFX_VSYNC_R", + /*M0-M7*/ "SPA_CTS_N","SPA_DCD_N","SPA_DSR_N","PU_SPA_RI_N","SPA_DTR_N","SPA_RTS_N","SPA_SOUT","SPA_SIN", @@ -385,11 +388,6 @@ index 000000000000..1ad46e8bc69b + /* SMB_HSBP_STBY_LVC3_R */ + multi-master; + status = "okay"; -+ -+ hsbp0@10 { -+ compatible = "slave-mqueue"; -+ reg = <(0x10 | I2C_OWN_SLAVE_ADDRESS)>; -+ }; +}; + +&i2c5 { @@ -397,11 +395,6 @@ index 000000000000..1ad46e8bc69b + bus-frequency = <1000000>; + multi-master; + status = "okay"; -+ -+ smlink0@10 { -+ compatible = "slave-mqueue"; -+ reg = <(0x10 | I2C_OWN_SLAVE_ADDRESS)>; -+ }; +}; + +&i2c6 { @@ -414,7 +407,6 @@ index 000000000000..1ad46e8bc69b + /* SMB_PMBUS_SML1_STBY_LVC3_R */ + multi-master; + #retries = <3>; -+ + status = "okay"; +}; + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Report-link-statistics-for-the-NCSI-channel.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Report-link-statistics-for-the-NCSI-channel.patch deleted file mode 100644 index 7e38110af..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Report-link-statistics-for-the-NCSI-channel.patch +++ /dev/null @@ -1,54 +0,0 @@ -From b08fba62b18ecb04d3e7dafac6bd819dd9b90d35 Mon Sep 17 00:00:00 2001 -From: Johnathan Mantey -Date: Thu, 1 Aug 2019 11:29:41 -0700 -Subject: [PATCH] Report link statistics for the NCSI channel - -The ftgmac driver does not report the link statistics for the NCSI -channel used for the shared NICs attached to the BMC. Report a fixed -value for the NSCI interface. - -Change-Id: Idb65ca1ce07f06a883417ee44df30ea2c8483107 -Signed-off-by: Johnathan Mantey ---- - drivers/net/ethernet/faraday/ftgmac100.c | 22 +++++++++++++++++++++- - 1 file changed, 21 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c -index 2e5fba354412..b1eb3abe759b 100644 ---- a/drivers/net/ethernet/faraday/ftgmac100.c -+++ b/drivers/net/ethernet/faraday/ftgmac100.c -@@ -1218,10 +1218,30 @@ static int ftgmac100_set_pauseparam(struct net_device *netdev, - return 0; - } - -+int ftgmac100_ethtool_get_link_ksettings(struct net_device *netdev, -+ struct ethtool_link_ksettings *cmd) -+{ -+ struct phy_device *phydev = netdev->phydev; -+ struct ftgmac100 *priv = netdev_priv(netdev); -+ int retval = 0; -+ -+ if (phydev) { -+ phy_ethtool_ksettings_get(phydev, cmd); -+ } else if (priv->use_ncsi) { -+ cmd->base.speed = SPEED_100; -+ cmd->base.duplex = DUPLEX_FULL; -+ cmd->base.autoneg = 0; -+ } else { -+ retval = -ENODEV; -+ } -+ -+ return retval; -+} -+ - static const struct ethtool_ops ftgmac100_ethtool_ops = { - .get_drvinfo = ftgmac100_get_drvinfo, - .get_link = ethtool_op_get_link, -- .get_link_ksettings = phy_ethtool_get_link_ksettings, -+ .get_link_ksettings = ftgmac100_ethtool_get_link_ksettings, - .set_link_ksettings = phy_ethtool_set_link_ksettings, - .nway_reset = phy_ethtool_nway_reset, - .get_ringparam = ftgmac100_get_ringparam, --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch index d66e84beb..b4b1bcad8 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch @@ -1,4 +1,4 @@ -From c111aac36e2f4fa1149662c85883407315ba76a6 Mon Sep 17 00:00:00 2001 +From 39f76bd49fd481999cf51fbdfbea3e820efc7227 Mon Sep 17 00:00:00 2001 From: Yong Li Date: Mon, 13 Nov 2017 16:29:44 +0800 Subject: [PATCH] Aspeed LPC SIO driver @@ -13,9 +13,9 @@ Signed-off-by: Jae Hyun Yoo arch/arm/boot/dts/aspeed-g5.dtsi | 7 + drivers/soc/aspeed/Kconfig | 7 + drivers/soc/aspeed/Makefile | 1 + - drivers/soc/aspeed/aspeed-lpc-sio.c | 450 +++++++++++++++++++++ - include/uapi/linux/aspeed-lpc-sio.h | 44 ++ - 7 files changed, 533 insertions(+) + drivers/soc/aspeed/aspeed-lpc-sio.c | 410 +++++++++++++++++++++ + include/uapi/linux/aspeed-lpc-sio.h | 45 +++ + 7 files changed, 494 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/aspeed/aspeed-lpc-sio.txt create mode 100644 drivers/soc/aspeed/aspeed-lpc-sio.c create mode 100644 include/uapi/linux/aspeed-lpc-sio.h @@ -110,14 +110,15 @@ index f3ff29b874ed..2e547cc47e62 100644 obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o diff --git a/drivers/soc/aspeed/aspeed-lpc-sio.c b/drivers/soc/aspeed/aspeed-lpc-sio.c new file mode 100644 -index 000000000000..c717a3182320 +index 000000000000..d4a4da112ff4 --- /dev/null +++ b/drivers/soc/aspeed/aspeed-lpc-sio.c -@@ -0,0 +1,450 @@ +@@ -0,0 +1,410 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2012-2017 ASPEED Technology Inc. -+// Copyright (c) 2017-2019 Intel Corporation ++// Copyright (c) 2017-2020 Intel Corporation + ++#include +#include +#include +#include @@ -128,62 +129,67 @@ index 000000000000..c717a3182320 +#include +#include + -+#include -+ -+#define SOC_NAME "aspeed" -+#define DEVICE_NAME "lpc-sio" -+ -+#define AST_LPC_SWCR0300 0x0 -+#define LPC_PWRGD_STS (1 << 30) -+#define LPC_PWRGD_RISING_EVT_STS (1 << 29) -+#define LPC_PWRGD_FALLING_EVT_STS (1 << 28) -+#define LPC_PWRBTN_STS (1 << 27) -+#define LPC_PWRBTN_RISING_EVT_STS (1 << 26) -+#define LPC_PWRBTN_FALLING_EVT_STS (1 << 25) -+#define LPC_S5N_STS (1 << 21) -+#define LPC_S5N_RISING_EVT_STS (1 << 20) -+#define LPC_S5N_FALLING_EVT_STS (1 << 19) -+#define LPC_S3N_STS (1 << 18) -+#define LPC_S3N_RISING_EVT_STS (1 << 17) -+#define LPC_S3N_FALLING_EVT_STS (1 << 16) -+#define LPC_PWBTO_RAW_STS (1 << 15) -+#define LPC_LAST_ONCTL_STS (1 << 14) -+#define LPC_WAS_PFAIL_STS (1 << 13) -+#define LPC_POWER_UP_FAIL_STS (1 << 12) /* Crowbar */ -+#define LPC_PWRBTN_OVERRIDE_STS (1 << 11) -+ -+#define AST_LPC_SWCR0704 0x4 -+ -+#define AST_LPC_SWCR0B08 0x8 -+#define LPC_PWREQ_OUTPUT_LEVEL (1 << 25) -+#define LPC_PWBTO_OUTPUT_LEVEL (1 << 24) -+#define LPC_ONCTL_STS (1 << 15) -+#define LPC_ONCTL_GPIO_LEVEL (1 << 14) -+#define LPC_ONCTL_EN_GPIO_OUTPUT (1 << 13) -+#define LPC_ONCTL_EN_GPIO_MODE (1 << 12) -+ -+#define AST_LPC_SWCR0F0C 0xC -+#define AST_LPC_SWCR1310 0x10 -+#define AST_LPC_SWCR1714 0x14 -+#define AST_LPC_SWCR1B18 0x18 -+#define AST_LPC_SWCR1F1C 0x1C -+#define AST_LPC_ACPIE3E0 0x20 -+#define AST_LPC_ACPIC1C0 0x24 -+#define AST_LPC_ACPIB3B0 0x28 -+#define AST_LPC_ACPIB7B4 0x2C ++#define SOC_NAME "aspeed" ++#define DEVICE_NAME "lpc-sio" ++ ++#define AST_LPC_SWCR0300 0x00 ++#define LPC_PWRGD_STS BIT(30) ++#define LPC_PWRGD_RISING_EVT_STS BIT(29) ++#define LPC_PWRGD_FALLING_EVT_STS BIT(28) ++#define LPC_PWRBTN_STS BIT(27) ++#define LPC_PWRBTN_RISING_EVT_STS BIT(26) ++#define LPC_PWRBTN_FALLING_EVT_STS BIT(25) ++#define LPC_S5N_STS BIT(21) ++#define LPC_S5N_RISING_EVT_STS BIT(20) ++#define LPC_S5N_FALLING_EVT_STS BIT(19) ++#define LPC_S3N_STS BIT(18) ++#define LPC_S3N_RISING_EVT_STS BIT(17) ++#define LPC_S3N_FALLING_EVT_STS BIT(16) ++#define LPC_PWBTO_RAW_STS BIT(15) ++#define LPC_LAST_ONCTL_STS BIT(14) ++#define LPC_WAS_PFAIL_STS BIT(13) ++#define LPC_POWER_UP_FAIL_STS BIT(12) /* Crowbar */ ++#define LPC_PWRBTN_OVERRIDE_STS BIT(11) ++#define LPC_BMC_TRIG_WAKEUP_EVT_STS BIT(8) ++ ++#define AST_LPC_SWCR0704 0x04 ++#define LPC_BMC_TRIG_WAKEUP_EVT_EN BIT(8) ++ ++#define AST_LPC_SWCR0B08 0x08 ++#define LPC_PWREQ_OUTPUT_LEVEL BIT(25) ++#define LPC_PWBTO_OUTPUT_LEVEL BIT(24) ++#define LPC_ONCTL_STS BIT(15) ++#define LPC_ONCTL_GPIO_LEVEL BIT(14) ++#define LPC_ONCTL_EN_GPIO_OUTPUT BIT(13) ++#define LPC_ONCTL_EN_GPIO_MODE BIT(12) ++#define LPC_BMC_TRIG_WAKEUP_EVT BIT(6) ++ ++#define AST_LPC_SWCR0F0C 0x0C ++#define AST_LPC_SWCR1310 0x10 ++#define AST_LPC_SWCR1714 0x14 ++#define AST_LPC_SWCR1B18 0x18 ++#define AST_LPC_SWCR1F1C 0x1C ++#define AST_LPC_ACPIE3E0 0x20 ++#define AST_LPC_ACPIC1C0 0x24 ++ ++#define AST_LPC_ACPIB3B0 0x28 ++#define LPC_BMC_TRIG_SCI_EVT_STS BIT(8) ++ ++#define AST_LPC_ACPIB7B4 0x2C ++#define LPC_BMC_TRIG_SCI_EVT_EN BIT(8) + +struct aspeed_lpc_sio { -+ struct miscdevice miscdev; -+ struct regmap *regmap; -+ struct clk *clk; -+ struct semaphore lock; -+ unsigned int reg_base; ++ struct miscdevice miscdev; ++ struct regmap *regmap; ++ struct clk *clk; ++ struct semaphore lock; ++ unsigned int reg_base; +}; + +static struct aspeed_lpc_sio *file_aspeed_lpc_sio(struct file *file) +{ + return container_of(file->private_data, struct aspeed_lpc_sio, -+ miscdev); ++ miscdev); +} + +static int aspeed_lpc_sio_open(struct inode *inode, struct file *filp) @@ -196,7 +202,8 @@ index 000000000000..c717a3182320 + LPC_S5N_FALLING_EVT_STS | \ + LPC_S3N_RISING_EVT_STS | \ + LPC_S3N_FALLING_EVT_STS) -+/************************************* ++ ++/* + * SLPS3n SLPS5n State + * --------------------------------- + * 1 1 S12 @@ -205,33 +212,20 @@ index 000000000000..c717a3182320 + ************************************* + */ + -+static long sio_get_acpi_state(struct aspeed_lpc_sio *lpc_sio, -+ struct sio_ioctl_data *sio_data) ++static void sio_get_acpi_state(struct aspeed_lpc_sio *lpc_sio, ++ struct sio_ioctl_data *sio_data) +{ -+ u32 reg; -+ u32 val; -+ int rc; ++ u32 reg, val; + + reg = lpc_sio->reg_base + AST_LPC_SWCR0300; -+ rc = regmap_read(lpc_sio->regmap, reg, &val); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_read() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_read(lpc_sio->regmap, reg, &val); + + /* update the ACPI state event status */ + if (sio_data->param != 0) { + if (val & LPC_SLP3N5N_EVENT_STATUS) { + sio_data->param = 1; -+ rc = regmap_write(lpc_sio->regmap, reg, -+ LPC_SLP3N5N_EVENT_STATUS); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_write() failed with %d(reg:0x%x)\n", -+ rc, reg); -+ return rc; -+ } ++ regmap_write(lpc_sio->regmap, reg, ++ LPC_SLP3N5N_EVENT_STATUS); + } else { + sio_data->param = 0; + } @@ -243,85 +237,52 @@ index 000000000000..c717a3182320 + sio_data->data = ACPI_STATE_S3I; + else + sio_data->data = ACPI_STATE_S45; -+ -+ return 0; +} + +#define LPC_PWRGD_EVENT_STATUS ( \ + LPC_PWRGD_RISING_EVT_STS | \ + LPC_PWRGD_FALLING_EVT_STS) + -+static long sio_get_pwrgd_status(struct aspeed_lpc_sio *lpc_sio, -+ struct sio_ioctl_data *sio_data) ++static void sio_get_pwrgd_status(struct aspeed_lpc_sio *lpc_sio, ++ struct sio_ioctl_data *sio_data) +{ -+ u32 reg; -+ u32 val; -+ int rc; ++ u32 reg, val; + + reg = lpc_sio->reg_base + AST_LPC_SWCR0300; -+ rc = regmap_read(lpc_sio->regmap, reg, &val); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_read() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_read(lpc_sio->regmap, reg, &val); + + /* update the PWRGD event status */ + if (sio_data->param != 0) { + if (val & LPC_PWRGD_EVENT_STATUS) { + sio_data->param = 1; -+ rc = regmap_write(lpc_sio->regmap, reg, -+ LPC_PWRGD_EVENT_STATUS); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_write() failed with %d(reg:0x%x)\n", -+ rc, reg); -+ return rc; -+ } ++ regmap_write(lpc_sio->regmap, reg, ++ LPC_PWRGD_EVENT_STATUS); + } else { + sio_data->param = 0; + } + } + + sio_data->data = (val & LPC_PWRGD_STS) != 0 ? 1 : 0; -+ -+ return 0; +} + -+static long sio_get_onctl_status(struct aspeed_lpc_sio *lpc_sio, -+ struct sio_ioctl_data *sio_data) ++static void sio_get_onctl_status(struct aspeed_lpc_sio *lpc_sio, ++ struct sio_ioctl_data *sio_data) +{ -+ u32 reg; -+ u32 val; -+ int rc; ++ u32 reg, val; + + reg = lpc_sio->reg_base + AST_LPC_SWCR0B08; -+ rc = regmap_read(lpc_sio->regmap, reg, &val); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_read() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_read(lpc_sio->regmap, reg, &val); + + sio_data->data = (val & LPC_ONCTL_STS) != 0 ? 1 : 0; -+ -+ return 0; +} + -+static long sio_set_onctl_gpio(struct aspeed_lpc_sio *lpc_sio, -+ struct sio_ioctl_data *sio_data) ++static void sio_set_onctl_gpio(struct aspeed_lpc_sio *lpc_sio, ++ struct sio_ioctl_data *sio_data) +{ -+ u32 reg; -+ u32 val; -+ int rc; ++ u32 reg, val; + + reg = lpc_sio->reg_base + AST_LPC_SWCR0B08; -+ rc = regmap_read(lpc_sio->regmap, reg, &val); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_read() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_read(lpc_sio->regmap, reg, &val); + + /* Enable ONCTL GPIO mode */ + if (sio_data->param != 0) { @@ -333,112 +294,103 @@ index 000000000000..c717a3182320 + else + val &= ~LPC_ONCTL_GPIO_LEVEL; + -+ rc = regmap_write(lpc_sio->regmap, reg, val); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_write() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_write(lpc_sio->regmap, reg, val); + } else { + val &= ~LPC_ONCTL_EN_GPIO_MODE; -+ rc = regmap_write(lpc_sio->regmap, reg, val); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_write() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_write(lpc_sio->regmap, reg, val); + } -+ -+ return 0; +} + -+static long sio_get_pwrbtn_override(struct aspeed_lpc_sio *lpc_sio, -+ struct sio_ioctl_data *sio_data) ++static void sio_get_pwrbtn_override(struct aspeed_lpc_sio *lpc_sio, ++ struct sio_ioctl_data *sio_data) +{ -+ u32 reg; -+ u32 val; -+ int rc; ++ u32 reg, val; + + reg = lpc_sio->reg_base + AST_LPC_SWCR0300; -+ rc = regmap_read(lpc_sio->regmap, reg, &val); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_read() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_read(lpc_sio->regmap, reg, &val); + + /* clear the PWRBTN OVERRIDE status */ -+ if (sio_data->param != 0) { -+ if (val & LPC_PWRBTN_OVERRIDE_STS) { -+ rc = regmap_write(lpc_sio->regmap, reg, -+ LPC_PWRBTN_OVERRIDE_STS); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_write() failed with %d(reg:0x%x)\n", -+ rc, reg); -+ return rc; -+ } -+ } -+ } ++ if (sio_data->param != 0 && val & LPC_PWRBTN_OVERRIDE_STS) ++ regmap_write(lpc_sio->regmap, reg, LPC_PWRBTN_OVERRIDE_STS); + + sio_data->data = (val & LPC_PWRBTN_OVERRIDE_STS) != 0 ? 1 : 0; -+ -+ return 0; +} + -+static long sio_get_pfail_status(struct aspeed_lpc_sio *lpc_sio, -+ struct sio_ioctl_data *sio_data) ++static void sio_get_pfail_status(struct aspeed_lpc_sio *lpc_sio, ++ struct sio_ioctl_data *sio_data) +{ -+ u32 reg; -+ u32 val; -+ int rc; ++ u32 reg, val; + + reg = lpc_sio->reg_base + AST_LPC_SWCR0300; -+ rc = regmap_read(lpc_sio->regmap, reg, &val); -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_read() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_read(lpc_sio->regmap, reg, &val); + + /* [ASPEED]: SWCR_03_00[13] (Was_pfail: default 1) is used to identify + * this current booting is from AC loss (not DC loss) if FW cleans this + * bit after booting successfully every time. + **********************************************************************/ + if (val & LPC_WAS_PFAIL_STS) { -+ rc = regmap_write(lpc_sio->regmap, reg, 0); /* W0C */ -+ if (rc) { -+ dev_err(lpc_sio->miscdev.parent, -+ "regmap_write() failed with %d(reg:0x%x)\n", rc, reg); -+ return rc; -+ } ++ regmap_write(lpc_sio->regmap, reg, 0); /* W0C */ + sio_data->data = 1; + } else { + sio_data->data = 0; + } ++} + -+ return 0; ++static void sio_set_bmc_sci_event(struct aspeed_lpc_sio *lpc_sio, ++ struct sio_ioctl_data *sio_data) ++{ ++ u32 reg; ++ ++ if (sio_data->param) { ++ reg = lpc_sio->reg_base + AST_LPC_ACPIB7B4; ++ regmap_write_bits(lpc_sio->regmap, reg, ++ LPC_BMC_TRIG_SCI_EVT_EN, ++ LPC_BMC_TRIG_SCI_EVT_EN); ++ ++ reg = lpc_sio->reg_base + AST_LPC_SWCR0704; ++ regmap_write_bits(lpc_sio->regmap, reg, ++ LPC_BMC_TRIG_WAKEUP_EVT_EN, ++ LPC_BMC_TRIG_WAKEUP_EVT_EN); ++ ++ reg = lpc_sio->reg_base + AST_LPC_SWCR0B08; ++ regmap_write_bits(lpc_sio->regmap, reg, ++ LPC_BMC_TRIG_WAKEUP_EVT, ++ LPC_BMC_TRIG_WAKEUP_EVT); ++ } else { ++ reg = lpc_sio->reg_base + AST_LPC_SWCR0300; ++ regmap_write_bits(lpc_sio->regmap, reg, ++ LPC_BMC_TRIG_WAKEUP_EVT_STS, ++ LPC_BMC_TRIG_WAKEUP_EVT_STS); ++ ++ reg = lpc_sio->reg_base + AST_LPC_ACPIB3B0; ++ regmap_write_bits(lpc_sio->regmap, reg, ++ LPC_BMC_TRIG_SCI_EVT_STS, ++ LPC_BMC_TRIG_SCI_EVT_STS); ++ } ++ ++ sio_data->data = sio_data->param; +} + -+typedef long (*sio_cmd_fn) (struct aspeed_lpc_sio *sio_dev, -+ struct sio_ioctl_data *sio_data); ++typedef void (*sio_cmd_fn) (struct aspeed_lpc_sio *sio_dev, ++ struct sio_ioctl_data *sio_data); ++ +static sio_cmd_fn sio_cmd_handle[SIO_MAX_CMD] = { -+ [SIO_GET_ACPI_STATE] = sio_get_acpi_state, -+ [SIO_GET_PWRGD_STATUS] = sio_get_pwrgd_status, -+ [SIO_GET_ONCTL_STATUS] = sio_get_onctl_status, -+ [SIO_SET_ONCTL_GPIO] = sio_set_onctl_gpio, -+ [SIO_GET_PWRBTN_OVERRIDE] = sio_get_pwrbtn_override, -+ [SIO_GET_PFAIL_STATUS] = sio_get_pfail_status, ++ [SIO_GET_ACPI_STATE] = sio_get_acpi_state, ++ [SIO_GET_PWRGD_STATUS] = sio_get_pwrgd_status, ++ [SIO_GET_ONCTL_STATUS] = sio_get_onctl_status, ++ [SIO_SET_ONCTL_GPIO] = sio_set_onctl_gpio, ++ [SIO_GET_PWRBTN_OVERRIDE] = sio_get_pwrbtn_override, ++ [SIO_GET_PFAIL_STATUS] = sio_get_pfail_status, ++ [SIO_SET_BMC_SCI_EVENT] = sio_set_bmc_sci_event, +}; + +static long aspeed_lpc_sio_ioctl(struct file *file, unsigned int cmd, -+ unsigned long param) ++ unsigned long param) +{ + struct aspeed_lpc_sio *lpc_sio = file_aspeed_lpc_sio(file); -+ long ret; -+ sio_cmd_fn cmd_fn; + struct sio_ioctl_data sio_data; -+ ++ sio_cmd_fn cmd_fn; ++ long ret; + + if (copy_from_user(&sio_data, (void __user *)param, sizeof(sio_data))) + return -EFAULT; @@ -447,18 +399,14 @@ index 000000000000..c717a3182320 + return -EINVAL; + + cmd_fn = sio_cmd_handle[sio_data.sio_cmd]; -+ if (cmd_fn == NULL) ++ if (!cmd_fn) + return -EINVAL; + + if (down_interruptible(&lpc_sio->lock) != 0) + return -ERESTARTSYS; + -+ ret = cmd_fn(lpc_sio, &sio_data); -+ if (ret == 0) { -+ if (copy_to_user((void __user *)param, &sio_data, -+ sizeof(sio_data))) -+ ret = -EFAULT; -+ } ++ cmd_fn(lpc_sio, &sio_data); ++ ret = copy_to_user((void __user *)param, &sio_data, sizeof(sio_data)); + + up(&lpc_sio->lock); + @@ -475,7 +423,8 @@ index 000000000000..c717a3182320 +{ + struct aspeed_lpc_sio *lpc_sio; + struct device *dev; -+ int rc; ++ u32 val; ++ int ret; + + dev = &pdev->dev; + @@ -485,40 +434,51 @@ index 000000000000..c717a3182320 + + dev_set_drvdata(&pdev->dev, lpc_sio); + -+ rc = of_property_read_u32(dev->of_node, "reg", &lpc_sio->reg_base); -+ if (rc) { ++ ret = of_property_read_u32(dev->of_node, "reg", &lpc_sio->reg_base); ++ if (ret) { + dev_err(dev, "Couldn't read reg device-tree property\n"); -+ return rc; ++ return ret; + } + -+ lpc_sio->regmap = syscon_node_to_regmap( -+ pdev->dev.parent->of_node); ++ lpc_sio->regmap = syscon_node_to_regmap(pdev->dev.parent->of_node); + if (IS_ERR(lpc_sio->regmap)) { + dev_err(dev, "Couldn't get regmap\n"); + return -ENODEV; + } + ++ /* ++ * We check that the regmap works on this very first access, ++ * but as this is an MMIO-backed regmap, subsequent regmap ++ * access is not going to fail and we skip error checks from ++ * this point. ++ */ ++ ret = regmap_read(lpc_sio->regmap, AST_LPC_SWCR0300, &val); ++ if (ret) { ++ dev_err(dev, "failed to read regmap\n"); ++ return ret; ++ } ++ + sema_init(&lpc_sio->lock, 1); + + lpc_sio->clk = devm_clk_get(dev, NULL); + if (IS_ERR(lpc_sio->clk)) { -+ rc = PTR_ERR(lpc_sio->clk); -+ if (rc != -EPROBE_DEFER) ++ ret = PTR_ERR(lpc_sio->clk); ++ if (ret != -EPROBE_DEFER) + dev_err(dev, "couldn't get clock\n"); -+ return rc; ++ return ret; + } -+ rc = clk_prepare_enable(lpc_sio->clk); -+ if (rc) { ++ ret = clk_prepare_enable(lpc_sio->clk); ++ if (ret) { + dev_err(dev, "couldn't enable clock\n"); -+ return rc; ++ return ret; + } + + lpc_sio->miscdev.minor = MISC_DYNAMIC_MINOR; + lpc_sio->miscdev.name = DEVICE_NAME; + lpc_sio->miscdev.fops = &aspeed_lpc_sio_fops; + lpc_sio->miscdev.parent = dev; -+ rc = misc_register(&lpc_sio->miscdev); -+ if (rc) { ++ ret = misc_register(&lpc_sio->miscdev); ++ if (ret) { + dev_err(dev, "Unable to register device\n"); + goto err; + } @@ -531,7 +491,7 @@ index 000000000000..c717a3182320 +err: + clk_disable_unprepare(lpc_sio->clk); + -+ return rc; ++ return ret; +} + +static int aspeed_lpc_sio_remove(struct platform_device *pdev) @@ -551,25 +511,25 @@ index 000000000000..c717a3182320 +MODULE_DEVICE_TABLE(of, aspeed_lpc_sio_match); + +static struct platform_driver aspeed_lpc_sio_driver = { -+ .driver = { ++ .driver = { + .name = SOC_NAME "-" DEVICE_NAME, -+ .of_match_table = aspeed_lpc_sio_match, ++ .of_match_table = of_match_ptr(aspeed_lpc_sio_match), + }, -+ .probe = aspeed_lpc_sio_probe, -+ .remove = aspeed_lpc_sio_remove, ++ .probe = aspeed_lpc_sio_probe, ++ .remove = aspeed_lpc_sio_remove, +}; +module_platform_driver(aspeed_lpc_sio_driver); + -+MODULE_LICENSE("GPL"); ++MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Ryan Chen "); +MODULE_AUTHOR("Yong Li "); +MODULE_DESCRIPTION("ASPEED AST LPC SIO device driver"); diff --git a/include/uapi/linux/aspeed-lpc-sio.h b/include/uapi/linux/aspeed-lpc-sio.h new file mode 100644 -index 000000000000..5dc1efd4a426 +index 000000000000..acf89a7d2b4a --- /dev/null +++ b/include/uapi/linux/aspeed-lpc-sio.h -@@ -0,0 +1,44 @@ +@@ -0,0 +1,45 @@ +/* + * Copyright (C) 2012-2020 ASPEED Technology Inc. + * Copyright (c) 2017 Intel Corporation @@ -600,6 +560,7 @@ index 000000000000..5dc1efd4a426 + SIO_SET_ONCTL_GPIO, + SIO_GET_PWRBTN_OVERRIDE, + SIO_GET_PFAIL_STATUS, /* Start from AC Loss */ ++ SIO_SET_BMC_SCI_EVENT, + + SIO_MAX_CMD +}; diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch index 490104cda..64059b1da 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch @@ -1,4 +1,4 @@ -From 1d0c60f1aa8b7b25d8d0d6f6f6443d307d543600 Mon Sep 17 00:00:00 2001 +From 34308f4078361987adfb854bdc6876abdaf323cb Mon Sep 17 00:00:00 2001 From: Haiyue Wang Date: Sat, 24 Feb 2018 11:12:32 +0800 Subject: [PATCH] Add AST2500 eSPI driver @@ -26,11 +26,12 @@ Signed-off-by: Vernon Mauery .../devicetree/bindings/misc/aspeed,espi-slave.txt | 20 + Documentation/misc-devices/espi-slave.rst | 118 ++++++ arch/arm/boot/dts/aspeed-g5.dtsi | 4 + - arch/arm/boot/dts/aspeed-g6.dtsi | 12 + + arch/arm/boot/dts/aspeed-g6.dtsi | 14 + drivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + - drivers/misc/aspeed-espi-slave.c | 421 +++++++++++++++++++++ - 7 files changed, 584 insertions(+) + drivers/misc/aspeed-espi-slave.c | 468 +++++++++++++++++++++ + include/dt-bindings/clock/ast2600-clock.h | 1 + + 8 files changed, 634 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/aspeed,espi-slave.txt create mode 100644 Documentation/misc-devices/espi-slave.rst create mode 100644 drivers/misc/aspeed-espi-slave.c @@ -208,7 +209,7 @@ index c15be82c3a9d..bd2037e52a94 100644 lpc: lpc@1e789000 { diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi -index 459070693aba..e4c1ab3d274e 100644 +index 62d101dc6926..753770912f0a 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi @@ -3,6 +3,7 @@ @@ -219,7 +220,7 @@ index 459070693aba..e4c1ab3d274e 100644 / { model = "Aspeed BMC"; -@@ -651,6 +652,17 @@ +@@ -674,6 +675,19 @@ status = "disabled"; }; @@ -230,8 +231,10 @@ index 459070693aba..e4c1ab3d274e 100644 + <&gpio0 ASPEED_GPIO(W, 7) IRQ_TYPE_EDGE_FALLING>; + status = "disabled"; + clocks = <&syscon ASPEED_CLK_GATE_ESPICLK>; ++ resets = <&syscon ASPEED_RESET_ESPI>; + pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_espi_default>; ++ pinctrl-0 = <&pinctrl_espi_default>, ++ <&pinctrl_espialt_default>; + }; + i2c: bus@1e78a000 { @@ -270,10 +273,10 @@ index b9e6d4c3e906..53864687e8fd 100644 obj-y += cardreader/ diff --git a/drivers/misc/aspeed-espi-slave.c b/drivers/misc/aspeed-espi-slave.c new file mode 100644 -index 000000000000..d70332d1fef3 +index 000000000000..87bc81948694 --- /dev/null +++ b/drivers/misc/aspeed-espi-slave.c -@@ -0,0 +1,421 @@ +@@ -0,0 +1,468 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2015-2019, Intel Corporation. + @@ -286,6 +289,7 @@ index 000000000000..d70332d1fef3 +#include +#include +#include ++#include +#include +#include +#include @@ -361,7 +365,9 @@ index 000000000000..d70332d1fef3 + struct regmap *map; + struct clk *clk; + struct device *dev; ++ struct reset_control *reset; + int irq; ++ int rst_irq; + + /* for PLTRST_N signal monitoring interface */ + struct miscdevice pltrstn_miscdev; @@ -469,11 +475,17 @@ index 000000000000..d70332d1fef3 + } + + if (sts & ASPEED_ESPI_HW_RESET) { ++ if (priv->rst_irq < 0) { ++ regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, ++ ASPEED_ESPI_CTRL_SW_RESET, 0); ++ regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, ++ ASPEED_ESPI_CTRL_SW_RESET, ++ ASPEED_ESPI_CTRL_SW_RESET); ++ } ++ + regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, -+ ASPEED_ESPI_CTRL_SW_RESET, 0); -+ regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, -+ ASPEED_ESPI_CTRL_SW_RESET, -+ ASPEED_ESPI_CTRL_SW_RESET); ++ ASPEED_ESPI_CTRL_OOB_CHRDY, ++ ASPEED_ESPI_CTRL_OOB_CHRDY); + aspeed_espi_boot_ack(priv); + sts_handled |= ASPEED_ESPI_HW_RESET; + } @@ -504,8 +516,26 @@ index 000000000000..d70332d1fef3 + ASPEED_ESPI_SYSEVT1_INT_MASK); + + regmap_write(priv->map, ASPEED_ESPI_INT_EN, ASPEED_ESPI_INT_MASK); ++} + -+ aspeed_espi_boot_ack(priv); ++static irqreturn_t aspeed_espi_reset_isr(int irq, void *arg) ++{ ++ struct aspeed_espi *priv = arg; ++ ++ reset_control_assert(priv->reset); ++ reset_control_deassert(priv->reset); ++ ++ regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, ++ ASPEED_ESPI_CTRL_SW_RESET, 0); ++ regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, ++ ASPEED_ESPI_CTRL_SW_RESET, ASPEED_ESPI_CTRL_SW_RESET); ++ ++ regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, ++ ASPEED_ESPI_CTRL_OOB_CHRDY, 0); ++ ++ aspeed_espi_config_irq(priv); ++ ++ return IRQ_HANDLED; +} + +static inline struct aspeed_espi *to_aspeed_espi(struct file *filp) @@ -610,13 +640,30 @@ index 000000000000..d70332d1fef3 + if (priv->irq < 0) + return priv->irq; + -+ aspeed_espi_config_irq(priv); -+ + ret = devm_request_irq(&pdev->dev, priv->irq, aspeed_espi_irq, 0, + "aspeed-espi-irq", priv); + if (ret) + return ret; + ++ if (of_device_is_compatible(pdev->dev.of_node, ++ "aspeed,ast2600-espi-slave")) { ++ priv->rst_irq = platform_get_irq(pdev, 1); ++ if (priv->rst_irq < 0) ++ return priv->rst_irq; ++ ++ ret = devm_request_irq(&pdev->dev, priv->rst_irq, ++ aspeed_espi_reset_isr, 0, ++ "aspeed-espi-rst-irq", priv); ++ if (ret) ++ return ret; ++ ++ priv->reset = devm_reset_control_get(&pdev->dev, NULL); ++ if (IS_ERR(priv->reset)) ++ return PTR_ERR(priv->reset); ++ } else { ++ priv->rst_irq = -ENOTSUPP; ++ } ++ + priv->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(priv->clk)) { + ret = PTR_ERR(priv->clk); @@ -654,6 +701,9 @@ index 000000000000..d70332d1fef3 + goto err_clk_disable_out; + } + ++ aspeed_espi_config_irq(priv); ++ aspeed_espi_boot_ack(priv); ++ + dev_info(&pdev->dev, "eSPI registered, irq %d\n", priv->irq); + + return 0; @@ -695,6 +745,18 @@ index 000000000000..d70332d1fef3 +MODULE_AUTHOR("Jae Hyun Yoo "); +MODULE_DESCRIPTION("Aspeed eSPI driver"); +MODULE_LICENSE("GPL v2"); +diff --git a/include/dt-bindings/clock/ast2600-clock.h b/include/dt-bindings/clock/ast2600-clock.h +index 3d90582a813f..1e18364de03d 100644 +--- a/include/dt-bindings/clock/ast2600-clock.h ++++ b/include/dt-bindings/clock/ast2600-clock.h +@@ -104,6 +104,7 @@ + #define ASPEED_RESET_PECI 36 + #define ASPEED_RESET_MII 35 + #define ASPEED_RESET_I2C 34 ++#define ASPEED_RESET_ESPI 32 + #define ASPEED_RESET_H2X 31 + #define ASPEED_RESET_GP_MCU 30 + #define ASPEED_RESET_DP_MCU 29 -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0061-i2c-aspeed-add-buffer-mode-transfer-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0061-i2c-aspeed-add-buffer-mode-transfer-support.patch index 24032087b..fbf422a35 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0061-i2c-aspeed-add-buffer-mode-transfer-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0061-i2c-aspeed-add-buffer-mode-transfer-support.patch @@ -1,4 +1,4 @@ -From fcee7b9515140486ad8c58beedf88cf12cd09b8b Mon Sep 17 00:00:00 2001 +From b8d7d0f3513abdf014345b240a79d23c63409c4c Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Tue, 11 Jun 2019 15:07:08 -0700 Subject: [PATCH] i2c: aspeed: add buffer mode transfer support @@ -31,11 +31,11 @@ It provides buffer based master and slave data transfer. Signed-off-by: Jae Hyun Yoo --- .../devicetree/bindings/i2c/i2c-aspeed.txt | 40 ++- - arch/arm/boot/dts/aspeed-g4.dtsi | 47 ++-- - arch/arm/boot/dts/aspeed-g5.dtsi | 47 ++-- - arch/arm/boot/dts/aspeed-g6.dtsi | 32 +-- - drivers/i2c/busses/i2c-aspeed.c | 294 ++++++++++++++++++--- - 5 files changed, 365 insertions(+), 95 deletions(-) + arch/arm/boot/dts/aspeed-g4.dtsi | 47 +-- + arch/arm/boot/dts/aspeed-g5.dtsi | 47 +-- + arch/arm/boot/dts/aspeed-g6.dtsi | 32 +- + drivers/i2c/busses/i2c-aspeed.c | 376 +++++++++++++++++++-- + 5 files changed, 451 insertions(+), 91 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt index 7da7e813b2b0..0ff3539cee95 100644 @@ -422,10 +422,10 @@ index eb1f9c9d9cca..51593a0a8a23 100644 clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi -index 0e35c4598df5..eeace4b7b725 100644 +index f92a2aa999d1..3ef312543269 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi -@@ -713,7 +713,7 @@ +@@ -712,7 +712,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -434,7 +434,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -728,7 +728,7 @@ +@@ -727,7 +727,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -443,7 +443,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -743,7 +743,7 @@ +@@ -742,7 +742,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -452,7 +452,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -758,7 +758,7 @@ +@@ -757,7 +757,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -461,7 +461,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -773,7 +773,7 @@ +@@ -772,7 +772,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -470,7 +470,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -788,7 +788,7 @@ +@@ -787,7 +787,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -479,7 +479,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -803,7 +803,7 @@ +@@ -802,7 +802,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -488,7 +488,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -818,7 +818,7 @@ +@@ -817,7 +817,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -497,7 +497,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -833,7 +833,7 @@ +@@ -832,7 +832,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -506,7 +506,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -848,7 +848,7 @@ +@@ -847,7 +847,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -515,7 +515,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -863,7 +863,7 @@ +@@ -862,7 +862,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -524,7 +524,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -878,7 +878,7 @@ +@@ -877,7 +877,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -533,7 +533,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -893,7 +893,7 @@ +@@ -892,7 +892,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -542,7 +542,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -908,7 +908,7 @@ +@@ -907,7 +907,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -551,7 +551,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -923,7 +923,7 @@ +@@ -922,7 +922,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -560,7 +560,7 @@ index 0e35c4598df5..eeace4b7b725 100644 compatible = "aspeed,ast2600-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -938,7 +938,7 @@ +@@ -937,7 +937,7 @@ #address-cells = <1>; #size-cells = <0>; #interrupt-cells = <1>; @@ -570,7 +570,7 @@ index 0e35c4598df5..eeace4b7b725 100644 clocks = <&syscon ASPEED_CLK_APB2>; resets = <&syscon ASPEED_RESET_I2C>; diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 7becfcd67142..1b338492c68a 100644 +index 7becfcd67142..bf72e151d11f 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -7,6 +7,7 @@ @@ -653,220 +653,338 @@ index 7becfcd67142..1b338492c68a 100644 bool multi_master; + /* Buffer mode */ + void __iomem *buf_base; -+ size_t buf_size; + u8 buf_offset; + u8 buf_page; ++ size_t buf_size; #if IS_ENABLED(CONFIG_I2C_SLAVE) struct i2c_client *slave; enum aspeed_i2c_slave_state slave_state; -@@ -259,6 +281,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -255,6 +277,77 @@ static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus) + } + + #if IS_ENABLED(CONFIG_I2C_SLAVE) ++static inline void ++aspeed_i2c_slave_handle_rx_done(struct aspeed_i2c_bus *bus, u32 irq_status, ++ u8 *value) ++{ ++ if (bus->buf_base && ++ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && ++ !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP)) ++ *value = readb(bus->buf_base); ++ else ++ *value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; ++} ++ ++static inline void ++aspeed_i2c_slave_handle_normal_stop(struct aspeed_i2c_bus *bus, u32 irq_status, ++ u8 *value) ++{ ++ int i, len; ++ ++ if (bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && ++ irq_status & ASPEED_I2CD_INTR_RX_DONE) { ++ if (bus->buf_base) { ++ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, ++ readl(bus->base + ++ ASPEED_I2C_BUF_CTRL_REG)); ++ for (i = 0; i < len; i++) { ++ *value = readb(bus->buf_base + i); ++ i2c_slave_event(bus->slave, ++ I2C_SLAVE_WRITE_RECEIVED, ++ value); ++ } ++ } ++ } ++} ++ ++static inline void ++aspeed_i2c_slave_handle_write_requested(struct aspeed_i2c_bus *bus, u8 *value) ++{ ++ if (bus->buf_base) { ++ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, ++ bus->buf_size - 1) | ++ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, ++ bus->buf_offset), ++ bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ writel(ASPEED_I2CD_RX_BUFF_ENABLE, ++ bus->base + ASPEED_I2C_CMD_REG); ++ } ++} ++ ++static inline void ++aspeed_i2c_slave_handle_write_received(struct aspeed_i2c_bus *bus, u8 *value) ++{ ++ int i, len; ++ ++ if (bus->buf_base) { ++ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, ++ readl(bus->base + ++ ASPEED_I2C_BUF_CTRL_REG)); ++ for (i = 1; i < len; i++) { ++ *value = readb(bus->buf_base + i); ++ i2c_slave_event(bus->slave, I2C_SLAVE_WRITE_RECEIVED, ++ value); ++ } ++ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, ++ bus->buf_size - 1) | ++ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, bus->buf_offset), ++ bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ writel(ASPEED_I2CD_RX_BUFF_ENABLE, ++ bus->base + ASPEED_I2C_CMD_REG); ++ } ++} ++ + static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) { u32 command, irq_handled = 0; - struct i2c_client *slave = bus->slave; -+ int i, len; - u8 value; - - if (!slave) -@@ -281,7 +304,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -281,7 +374,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) /* Slave was sent something. */ if (irq_status & ASPEED_I2CD_INTR_RX_DONE) { - value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; -+ if (bus->buf_base && -+ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && -+ !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP)) -+ value = readb(bus->buf_base); -+ else -+ value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; ++ aspeed_i2c_slave_handle_rx_done(bus, irq_status, &value); /* Handle address frame. */ if (bus->slave_state == ASPEED_I2C_SLAVE_START) { if (value & 0x1) -@@ -296,6 +324,20 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -296,9 +389,11 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) /* Slave was asked to stop. */ if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP) { -+ if (bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && -+ irq_status & ASPEED_I2CD_INTR_RX_DONE) { -+ if (bus->buf_base) { -+ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, -+ readl(bus->base + -+ ASPEED_I2C_BUF_CTRL_REG)); -+ for (i = 0; i < len; i++) { -+ value = readb(bus->buf_base + i); -+ i2c_slave_event(slave, -+ I2C_SLAVE_WRITE_RECEIVED, -+ &value); -+ } -+ } -+ } ++ aspeed_i2c_slave_handle_normal_stop(bus, irq_status, &value); irq_handled |= ASPEED_I2CD_INTR_NORMAL_STOP; bus->slave_state = ASPEED_I2C_SLAVE_STOP; } -@@ -328,9 +370,36 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) ++ + if (irq_status & ASPEED_I2CD_INTR_TX_NAK && + bus->slave_state == ASPEED_I2C_SLAVE_READ_PROCESSED) { + irq_handled |= ASPEED_I2CD_INTR_TX_NAK; +@@ -328,9 +423,11 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) case ASPEED_I2C_SLAVE_WRITE_REQUESTED: bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); -+ if (bus->buf_base) { -+ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, -+ bus->buf_size - 1) | -+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, -+ bus->buf_offset), -+ bus->base + ASPEED_I2C_BUF_CTRL_REG); -+ writel(ASPEED_I2CD_RX_BUFF_ENABLE, -+ bus->base + ASPEED_I2C_CMD_REG); -+ } ++ aspeed_i2c_slave_handle_write_requested(bus, &value); break; case ASPEED_I2C_SLAVE_WRITE_RECEIVED: i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value); -+ if (bus->buf_base) { -+ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, -+ readl(bus->base + -+ ASPEED_I2C_BUF_CTRL_REG)); -+ for (i = 1; i < len; i++) { -+ value = readb(bus->buf_base + i); -+ i2c_slave_event(slave, -+ I2C_SLAVE_WRITE_RECEIVED, -+ &value); -+ } -+ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, -+ bus->buf_size - 1) | -+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, -+ bus->buf_offset), -+ bus->base + ASPEED_I2C_BUF_CTRL_REG); -+ writel(ASPEED_I2CD_RX_BUFF_ENABLE, -+ bus->base + ASPEED_I2C_CMD_REG); -+ } ++ aspeed_i2c_slave_handle_write_received(bus, &value); break; case ASPEED_I2C_SLAVE_STOP: i2c_slave_event(slave, I2C_SLAVE_STOP, &value); -@@ -356,6 +425,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) +@@ -350,12 +447,76 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) + } + #endif /* CONFIG_I2C_SLAVE */ + ++static inline u32 ++aspeed_i2c_prepare_rx_buf(struct aspeed_i2c_bus *bus, struct i2c_msg *msg) ++{ ++ u32 command = 0; ++ int len; ++ ++ if (msg->len > bus->buf_size) { ++ len = bus->buf_size; ++ } else { ++ len = msg->len; ++ command |= ASPEED_I2CD_M_S_RX_CMD_LAST; ++ } ++ ++ if (bus->buf_base) { ++ command |= ASPEED_I2CD_RX_BUFF_ENABLE; ++ ++ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, len - 1) | ++ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, bus->buf_offset), ++ bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ } ++ ++ return command; ++} ++ ++static inline u32 ++aspeed_i2c_prepare_tx_buf(struct aspeed_i2c_bus *bus, struct i2c_msg *msg) ++{ ++ u8 slave_addr = i2c_8bit_addr_from_msg(msg); ++ u32 command = 0; ++ int len; ++ ++ if (msg->len + 1 > bus->buf_size) ++ len = bus->buf_size; ++ else ++ len = msg->len + 1; ++ ++ if (bus->buf_base) { ++ u8 wbuf[4]; ++ int i; ++ ++ command |= ASPEED_I2CD_TX_BUFF_ENABLE; ++ ++ /* ++ * Yeah, it looks bad but byte writing on remapped I2C SRAM ++ * causes corruption so use this way to make dword writings. ++ */ ++ wbuf[0] = slave_addr; ++ for (i = 1; i < len; i++) { ++ wbuf[i % 4] = msg->buf[i - 1]; ++ if (i % 4 == 3) ++ writel(*(u32 *)wbuf, bus->buf_base + i - 3); ++ } ++ if (--i % 4 != 3) ++ writel(*(u32 *)wbuf, bus->buf_base + i - (i % 4)); ++ ++ writel(FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, len - 1) | ++ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, bus->buf_offset), ++ bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ } ++ ++ bus->buf_index = len - 1; ++ ++ return command; ++} ++ + /* precondition: bus.lock has been acquired. */ + static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) + { u32 command = ASPEED_I2CD_M_START_CMD | ASPEED_I2CD_M_TX_CMD; struct i2c_msg *msg = &bus->msgs[bus->msgs_index]; - u8 slave_addr = i2c_8bit_addr_from_msg(msg); -+ u8 wbuf[4]; -+ int len; +- u8 slave_addr = i2c_8bit_addr_from_msg(msg); #if IS_ENABLED(CONFIG_I2C_SLAVE) /* -@@ -374,12 +445,66 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) +@@ -374,12 +535,21 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) if (msg->flags & I2C_M_RD) { command |= ASPEED_I2CD_M_RX_CMD; - /* Need to let the hardware know to NACK after RX. */ - if (msg->len == 1 && !(msg->flags & I2C_M_RECV_LEN)) - command |= ASPEED_I2CD_M_S_RX_CMD_LAST; ++ if (!(msg->flags & I2C_M_RECV_LEN)) { ++ if (msg->len && bus->buf_base) ++ command |= aspeed_i2c_prepare_rx_buf(bus, msg); + -+ if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) { -+ command |= ASPEED_I2CD_RX_BUFF_ENABLE; -+ -+ if (msg->len > bus->buf_size) { -+ len = bus->buf_size; -+ } else { -+ len = msg->len; -+ command |= ASPEED_I2CD_M_S_RX_CMD_LAST; -+ } -+ -+ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, -+ len - 1) | -+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, -+ bus->buf_offset), -+ bus->base + ASPEED_I2C_BUF_CTRL_REG); -+ } else { + /* Need to let the hardware know to NACK after RX. */ -+ if (msg->len == 1 && !(msg->flags & I2C_M_RECV_LEN)) ++ if (msg->len <= 1) + command |= ASPEED_I2CD_M_S_RX_CMD_LAST; + } -+ } else { -+ if (bus->buf_base) { -+ int i; -+ -+ command |= ASPEED_I2CD_TX_BUFF_ENABLE; -+ -+ if (msg->len + 1 > bus->buf_size) -+ len = bus->buf_size; -+ else -+ len = msg->len + 1; -+ -+ /* -+ * Yeah, it looks clumsy but byte writings on a remapped -+ * I2C SRAM cause corruptions so use this way to make -+ * dword writings. -+ */ -+ wbuf[0] = slave_addr; -+ for (i = 1; i < len; i++) { -+ wbuf[i % 4] = msg->buf[i - 1]; -+ if (i % 4 == 3) -+ writel(*(u32 *)wbuf, -+ bus->buf_base + i - 3); -+ } -+ if (--i % 4 != 3) -+ writel(*(u32 *)wbuf, -+ bus->buf_base + i - (i % 4)); -+ -+ bus->buf_index = len - 1; -+ -+ writel(FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, -+ len - 1) | -+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, -+ bus->buf_offset), -+ bus->base + ASPEED_I2C_BUF_CTRL_REG); -+ } ++ } else if (msg->len && bus->buf_base) { ++ command |= aspeed_i2c_prepare_tx_buf(bus, msg); } - writel(slave_addr, bus->base + ASPEED_I2C_BYTE_BUF_REG); + if (!(command & ASPEED_I2CD_TX_BUFF_ENABLE)) -+ writel(slave_addr, bus->base + ASPEED_I2C_BYTE_BUF_REG); ++ writel(i2c_8bit_addr_from_msg(msg), ++ bus->base + ASPEED_I2C_BYTE_BUF_REG); writel(command, bus->base + ASPEED_I2C_CMD_REG); } -@@ -419,7 +544,7 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - u32 irq_handled = 0, command = 0; - struct i2c_msg *msg; - u8 recv_byte; -- int ret; -+ int ret, len; +@@ -414,6 +584,104 @@ static int aspeed_i2c_is_irq_error(u32 irq_status) + return 0; + } - if (irq_status & ASPEED_I2CD_INTR_BUS_RECOVER_DONE) { - bus->master_state = ASPEED_I2C_MASTER_INACTIVE; -@@ -522,11 +647,43 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - /* fall through */ - case ASPEED_I2C_MASTER_TX_FIRST: - if (bus->buf_index < msg->len) { -+ command = ASPEED_I2CD_M_TX_CMD; ++static inline u32 ++aspeed_i2c_master_handle_tx_first(struct aspeed_i2c_bus *bus, ++ struct i2c_msg *msg) ++{ ++ u32 command = 0; + -+ if (bus->buf_base) { -+ u8 wbuf[4]; -+ int i; ++ if (bus->buf_base) { ++ u8 wbuf[4]; ++ int len; ++ int i; + -+ command |= ASPEED_I2CD_TX_BUFF_ENABLE; ++ if (msg->len - bus->buf_index > bus->buf_size) ++ len = bus->buf_size; ++ else ++ len = msg->len - bus->buf_index; + -+ if (msg->len - bus->buf_index > bus->buf_size) -+ len = bus->buf_size; -+ else -+ len = msg->len - bus->buf_index; + -+ for (i = 0; i < len; i++) { -+ wbuf[i % 4] = msg->buf[bus->buf_index -+ + i]; -+ if (i % 4 == 3) -+ writel(*(u32 *)wbuf, -+ bus->buf_base + i - 3); -+ } -+ if (--i % 4 != 3) -+ writel(*(u32 *)wbuf, -+ bus->buf_base + i - (i % 4)); ++ command |= ASPEED_I2CD_TX_BUFF_ENABLE; + -+ bus->buf_index += len; ++ if (msg->len - bus->buf_index > bus->buf_size) ++ len = bus->buf_size; ++ else ++ len = msg->len - bus->buf_index; + -+ writel(FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, -+ len - 1) | -+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, -+ bus->buf_offset), -+ bus->base + ASPEED_I2C_BUF_CTRL_REG); -+ } else { -+ writel(msg->buf[bus->buf_index++], -+ bus->base + ASPEED_I2C_BYTE_BUF_REG); -+ } ++ for (i = 0; i < len; i++) { ++ wbuf[i % 4] = msg->buf[bus->buf_index + i]; ++ if (i % 4 == 3) ++ writel(*(u32 *)wbuf, ++ bus->buf_base + i - 3); ++ } ++ if (--i % 4 != 3) ++ writel(*(u32 *)wbuf, ++ bus->buf_base + i - (i % 4)); ++ ++ writel(FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, ++ len - 1) | ++ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, ++ bus->buf_offset), ++ bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ ++ bus->buf_index += len; ++ } else { ++ writel(msg->buf[bus->buf_index++], ++ bus->base + ASPEED_I2C_BYTE_BUF_REG); ++ } ++ ++ return command; ++} ++ ++static inline void ++aspeed_i2c_master_handle_rx(struct aspeed_i2c_bus *bus, struct i2c_msg *msg) ++{ ++ u8 recv_byte; ++ int len; ++ ++ if (bus->buf_base) { ++ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, ++ readl(bus->base + ASPEED_I2C_BUF_CTRL_REG)); ++ memcpy_fromio(msg->buf + bus->buf_index, bus->buf_base, len); ++ bus->buf_index += len; ++ } else { ++ recv_byte = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; ++ msg->buf[bus->buf_index++] = recv_byte; ++ } ++} ++ ++static inline u32 ++aspeed_i2c_master_handle_rx_next(struct aspeed_i2c_bus *bus, ++ struct i2c_msg *msg) ++{ ++ u32 command = 0; ++ ++ if (bus->buf_base) { ++ int len; ++ ++ if (msg->len - bus->buf_index > bus->buf_size) { ++ len = bus->buf_size; ++ } else { ++ len = msg->len - bus->buf_index; ++ command |= ASPEED_I2CD_M_S_RX_CMD_LAST; ++ } ++ ++ command |= ASPEED_I2CD_RX_BUFF_ENABLE; ++ ++ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, ++ len - 1) | ++ FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, 0) | ++ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, ++ bus->buf_offset), ++ bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ } else { ++ if (bus->buf_index + 1 == msg->len) ++ command |= ASPEED_I2CD_M_S_RX_CMD_LAST; ++ } ++ ++ return command; ++} ++ + static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) + { + u32 irq_handled = 0, command = 0; +@@ -522,11 +790,10 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) + /* fall through */ + case ASPEED_I2C_MASTER_TX_FIRST: + if (bus->buf_index < msg->len) { ++ command = ASPEED_I2CD_M_TX_CMD; ++ command |= aspeed_i2c_master_handle_tx_first(bus, msg); + writel(command, bus->base + ASPEED_I2C_CMD_REG); bus->master_state = ASPEED_I2C_MASTER_TX; - writel(msg->buf[bus->buf_index++], @@ -876,44 +994,28 @@ index 7becfcd67142..1b338492c68a 100644 } else { aspeed_i2c_next_msg_or_stop(bus); } -@@ -543,25 +700,56 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -543,26 +810,26 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) } irq_handled |= ASPEED_I2CD_INTR_RX_DONE; - recv_byte = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; - msg->buf[bus->buf_index++] = recv_byte; - -- if (msg->flags & I2C_M_RECV_LEN) { -- if (unlikely(recv_byte > I2C_SMBUS_BLOCK_MAX)) { -- bus->cmd_err = -EPROTO; -- aspeed_i2c_do_stop(bus); -- goto out_no_complete; -+ if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) { -+ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, -+ readl(bus->base + -+ ASPEED_I2C_BUF_CTRL_REG)); -+ memcpy_fromio(msg->buf + bus->buf_index, -+ bus->buf_base, len); -+ bus->buf_index += len; -+ } else { -+ recv_byte = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) -+ >> 8; -+ msg->buf[bus->buf_index++] = recv_byte; -+ -+ if (msg->flags & I2C_M_RECV_LEN) { -+ if (unlikely(recv_byte > I2C_SMBUS_BLOCK_MAX)) { -+ bus->cmd_err = -EPROTO; -+ aspeed_i2c_do_stop(bus); -+ goto out_no_complete; -+ } -+ msg->len = recv_byte + -+ ((msg->flags & I2C_CLIENT_PEC) ? -+ 2 : 1); -+ msg->flags &= ~I2C_M_RECV_LEN; + if (msg->flags & I2C_M_RECV_LEN) { ++ recv_byte = readl(bus->base + ++ ASPEED_I2C_BYTE_BUF_REG) >> 8; + if (unlikely(recv_byte > I2C_SMBUS_BLOCK_MAX)) { + bus->cmd_err = -EPROTO; + aspeed_i2c_do_stop(bus); + goto out_no_complete; } - msg->len = recv_byte + - ((msg->flags & I2C_CLIENT_PEC) ? 2 : 1); -- msg->flags &= ~I2C_M_RECV_LEN; ++ msg->len = recv_byte + ((msg->flags & I2C_CLIENT_PEC) ? ++ 2 : 1); + msg->flags &= ~I2C_M_RECV_LEN; ++ } else if (msg->len) { ++ aspeed_i2c_master_handle_rx(bus, msg); } if (bus->buf_index < msg->len) { @@ -921,33 +1023,13 @@ index 7becfcd67142..1b338492c68a 100644 command = ASPEED_I2CD_M_RX_CMD; - if (bus->buf_index + 1 == msg->len) - command |= ASPEED_I2CD_M_S_RX_CMD_LAST; -+ bus->master_state = ASPEED_I2C_MASTER_RX; -+ if (bus->buf_base) { -+ command |= ASPEED_I2CD_RX_BUFF_ENABLE; -+ -+ if (msg->len - bus->buf_index > -+ bus->buf_size) { -+ len = bus->buf_size; -+ } else { -+ len = msg->len - bus->buf_index; -+ command |= ASPEED_I2CD_M_S_RX_CMD_LAST; -+ } -+ -+ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, -+ len - 1) | -+ FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, -+ 0) | -+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, -+ bus->buf_offset), -+ bus->base + ASPEED_I2C_BUF_CTRL_REG); -+ } else { -+ if (bus->buf_index + 1 == msg->len) -+ command |= ASPEED_I2CD_M_S_RX_CMD_LAST; -+ } ++ command |= aspeed_i2c_master_handle_rx_next(bus, msg); writel(command, bus->base + ASPEED_I2C_CMD_REG); ++ bus->master_state = ASPEED_I2C_MASTER_RX; } else { aspeed_i2c_next_msg_or_stop(bus); -@@ -924,6 +1112,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, + } +@@ -924,6 +1191,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, if (ret < 0) return ret; @@ -957,34 +1039,24 @@ index 7becfcd67142..1b338492c68a 100644 if (of_property_read_bool(pdev->dev.of_node, "multi-master")) bus->multi_master = true; else -@@ -985,16 +1176,15 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) - { - const struct of_device_id *match; - struct aspeed_i2c_bus *bus; -+ bool sram_enabled = true; - struct clk *parent_clk; -- struct resource *res; - int irq, ret; - - bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); - if (!bus) - return -ENOMEM; - -- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- bus->base = devm_ioremap_resource(&pdev->dev, res); -+ bus->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(bus->base)) - return PTR_ERR(bus->base); - -@@ -1028,6 +1218,42 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) - bus->get_clk_reg_val = (u32 (*)(struct device *, u32)) - match->data; +@@ -964,6 +1234,52 @@ static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus) + return ret; + } -+ /* Enable I2C SRAM in case of AST2500 */ ++static void aspeed_i2c_set_xfer_mode(struct aspeed_i2c_bus *bus) ++{ ++ struct platform_device *pdev = to_platform_device(bus->dev); ++ bool sram_enabled = true; ++ int ret; ++ ++ /* ++ * Enable I2C SRAM in case of AST2500. ++ * SRAM is enabled by default in AST2400 and AST2600. ++ */ + if (of_device_is_compatible(pdev->dev.of_node, + "aspeed,ast2500-i2c-bus")) { -+ struct regmap *gr_regmap = syscon_regmap_lookup_by_compatible( -+ "aspeed,ast2500-i2c-gr"); ++ struct regmap *gr_regmap = syscon_regmap_lookup_by_compatible("aspeed,ast2500-i2c-gr"); ++ + if (IS_ERR(gr_regmap)) + ret = PTR_ERR(gr_regmap); + else @@ -1001,10 +1073,10 @@ index 7becfcd67142..1b338492c68a 100644 + struct resource *res = platform_get_resource(pdev, + IORESOURCE_MEM, 1); + -+ if (res) ++ if (res && resource_size(res) >= 2) + bus->buf_base = devm_ioremap_resource(&pdev->dev, res); + -+ if (!IS_ERR_OR_NULL(bus->buf_base) && resource_size(res) >= 2) { ++ if (!IS_ERR_OR_NULL(bus->buf_base)) { + bus->buf_size = resource_size(res); + if (of_device_is_compatible(pdev->dev.of_node, + "aspeed,ast2400-i2c-bus")) { @@ -1015,11 +1087,52 @@ index 7becfcd67142..1b338492c68a 100644 + } + } + } ++} ++ + static const struct of_device_id aspeed_i2c_bus_of_table[] = { + { + .compatible = "aspeed,ast2400-i2c-bus", +@@ -986,18 +1302,18 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + const struct of_device_id *match; + struct aspeed_i2c_bus *bus; + struct clk *parent_clk; +- struct resource *res; + int irq, ret; + + bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); + if (!bus) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- bus->base = devm_ioremap_resource(&pdev->dev, res); ++ bus->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(bus->base)) + return PTR_ERR(bus->base); + ++ bus->dev = &pdev->dev; ++ + parent_clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(parent_clk)) + return PTR_ERR(parent_clk); +@@ -1028,6 +1344,8 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + bus->get_clk_reg_val = (u32 (*)(struct device *, u32)) + match->data; + ++ aspeed_i2c_set_xfer_mode(bus); + /* Initialize the I2C adapter */ spin_lock_init(&bus->lock); init_completion(&bus->cmd_complete); -@@ -1063,8 +1289,8 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -1038,8 +1356,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + strlcpy(bus->adap.name, pdev->name, sizeof(bus->adap.name)); + i2c_set_adapdata(&bus->adap, bus); + +- bus->dev = &pdev->dev; +- + /* Clean up any left over interrupt state. */ + writel(0, bus->base + ASPEED_I2C_INTR_CTRL_REG); + writel(0xffffffff, bus->base + ASPEED_I2C_INTR_STS_REG); +@@ -1063,8 +1379,8 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) platform_set_drvdata(pdev, bus); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0062-i2c-aspeed-add-DMA-mode-transfer-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0062-i2c-aspeed-add-DMA-mode-transfer-support.patch index a66e759e7..994c20b18 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0062-i2c-aspeed-add-DMA-mode-transfer-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0062-i2c-aspeed-add-DMA-mode-transfer-support.patch @@ -1,4 +1,4 @@ -From 0d237f4b5111aa192a1ae9aaee6e6779761906bc Mon Sep 17 00:00:00 2001 +From 5bf7a202eb0af455675a85a4f1bdad863fd8805d Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Tue, 18 Jun 2019 08:47:50 -0700 Subject: [PATCH] i2c: aspeed: add DMA mode transfer support @@ -15,9 +15,9 @@ use DMA mode. Signed-off-by: Jae Hyun Yoo --- - .../devicetree/bindings/i2c/i2c-aspeed.txt | 25 +++ - drivers/i2c/busses/i2c-aspeed.c | 231 +++++++++++++++++++-- - 2 files changed, 241 insertions(+), 15 deletions(-) + .../devicetree/bindings/i2c/i2c-aspeed.txt | 25 ++ + drivers/i2c/busses/i2c-aspeed.c | 253 +++++++++++++++++---- + 2 files changed, 234 insertions(+), 44 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt index 0ff3539cee95..d3f4a39f7ba6 100644 @@ -61,7 +61,7 @@ index 0ff3539cee95..d3f4a39f7ba6 100644 + }; }; diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 1b338492c68a..8dc6723bfaaf 100644 +index bf72e151d11f..3c9e491cbe4e 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -10,6 +10,8 @@ @@ -106,242 +106,291 @@ index 1b338492c68a..8dc6723bfaaf 100644 enum aspeed_i2c_master_state { ASPEED_I2C_MASTER_INACTIVE, ASPEED_I2C_MASTER_PENDING, -@@ -185,6 +199,12 @@ struct aspeed_i2c_bus { - size_t buf_size; +@@ -184,6 +198,12 @@ struct aspeed_i2c_bus { + void __iomem *buf_base; u8 buf_offset; u8 buf_page; + /* DMA mode */ + struct dma_pool *dma_pool; + dma_addr_t dma_handle; + u8 *dma_buf; -+ size_t dma_buf_size; + size_t dma_len; ++ /* Buffer/DMA mode */ + size_t buf_size; #if IS_ENABLED(CONFIG_I2C_SLAVE) struct i2c_client *slave; - enum aspeed_i2c_slave_state slave_state; -@@ -304,9 +324,13 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - - /* Slave was sent something. */ - if (irq_status & ASPEED_I2CD_INTR_RX_DONE) { -- if (bus->buf_base && -+ if (bus->dma_buf && - bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && - !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP)) -+ value = bus->dma_buf[0]; -+ else if (bus->buf_base && -+ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && -+ !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP)) - value = readb(bus->buf_base); - else - value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; -@@ -326,7 +350,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP) { - if (bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && - irq_status & ASPEED_I2CD_INTR_RX_DONE) { -- if (bus->buf_base) { -+ if (bus->dma_buf) { -+ len = bus->dma_buf_size - -+ FIELD_GET(ASPEED_I2CD_DMA_LEN_MASK, -+ readl(bus->base + -+ ASPEED_I2C_DMA_LEN_REG)); -+ for (i = 0; i < len; i++) { -+ value = bus->dma_buf[i]; -+ i2c_slave_event(slave, -+ I2C_SLAVE_WRITE_RECEIVED, -+ &value); -+ } -+ } else if (bus->buf_base) { - len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, - readl(bus->base + - ASPEED_I2C_BUF_CTRL_REG)); -@@ -370,7 +405,15 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - case ASPEED_I2C_SLAVE_WRITE_REQUESTED: - bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; - i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); -- if (bus->buf_base) { -+ if (bus->dma_buf) { -+ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, -+ bus->base + ASPEED_I2C_DMA_ADDR_REG); -+ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, -+ bus->dma_buf_size), -+ bus->base + ASPEED_I2C_DMA_LEN_REG); -+ writel(ASPEED_I2CD_RX_DMA_ENABLE, -+ bus->base + ASPEED_I2C_CMD_REG); -+ } else if (bus->buf_base) { - writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, - bus->buf_size - 1) | - FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, -@@ -382,7 +425,25 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - break; - case ASPEED_I2C_SLAVE_WRITE_RECEIVED: - i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value); +@@ -281,7 +301,11 @@ static inline void + aspeed_i2c_slave_handle_rx_done(struct aspeed_i2c_bus *bus, u32 irq_status, + u8 *value) + { +- if (bus->buf_base && ++ if (bus->dma_buf && ++ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && ++ !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP)) ++ *value = bus->dma_buf[0]; ++ else if (bus->buf_base && + bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && + !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP)) + *value = readb(bus->buf_base); +@@ -297,7 +321,18 @@ aspeed_i2c_slave_handle_normal_stop(struct aspeed_i2c_bus *bus, u32 irq_status, + + if (bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && + irq_status & ASPEED_I2CD_INTR_RX_DONE) { - if (bus->buf_base) { + if (bus->dma_buf) { -+ len = bus->dma_buf_size - ++ len = bus->buf_size - + FIELD_GET(ASPEED_I2CD_DMA_LEN_MASK, + readl(bus->base + + ASPEED_I2C_DMA_LEN_REG)); -+ for (i = 1; i < len; i++) { -+ value = bus->dma_buf[i]; -+ i2c_slave_event(slave, ++ for (i = 0; i < len; i++) { ++ *value = bus->dma_buf[i]; ++ i2c_slave_event(bus->slave, + I2C_SLAVE_WRITE_RECEIVED, -+ &value); ++ value); + } -+ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, -+ bus->base + ASPEED_I2C_DMA_ADDR_REG); -+ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, -+ bus->dma_buf_size), -+ bus->base + ASPEED_I2C_DMA_LEN_REG); -+ writel(ASPEED_I2CD_RX_DMA_ENABLE, -+ bus->base + ASPEED_I2C_CMD_REG); + } else if (bus->buf_base) { len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, readl(bus->base + ASPEED_I2C_BUF_CTRL_REG)); -@@ -446,7 +507,23 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) - if (msg->flags & I2C_M_RD) { - command |= ASPEED_I2CD_M_RX_CMD; +@@ -314,7 +349,14 @@ aspeed_i2c_slave_handle_normal_stop(struct aspeed_i2c_bus *bus, u32 irq_status, + static inline void + aspeed_i2c_slave_handle_write_requested(struct aspeed_i2c_bus *bus, u8 *value) + { +- if (bus->buf_base) { ++ if (bus->dma_buf) { ++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, ++ bus->base + ASPEED_I2C_DMA_ADDR_REG); ++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, bus->buf_size), ++ bus->base + ASPEED_I2C_DMA_LEN_REG); ++ writel(ASPEED_I2CD_RX_DMA_ENABLE, ++ bus->base + ASPEED_I2C_CMD_REG); ++ } else if (bus->buf_base) { + writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, + bus->buf_size - 1) | + FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, +@@ -330,7 +372,23 @@ aspeed_i2c_slave_handle_write_received(struct aspeed_i2c_bus *bus, u8 *value) + { + int i, len; -- if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) { -+ if (bus->dma_buf && !(msg->flags & I2C_M_RECV_LEN)) { -+ command |= ASPEED_I2CD_RX_DMA_ENABLE; -+ -+ if (msg->len > bus->dma_buf_size) { -+ len = bus->dma_buf_size; -+ } else { -+ len = msg->len; -+ command |= ASPEED_I2CD_M_S_RX_CMD_LAST; -+ } -+ -+ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, -+ bus->base + ASPEED_I2C_DMA_ADDR_REG); -+ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, -+ len), -+ bus->base + ASPEED_I2C_DMA_LEN_REG); -+ bus->dma_len = len; -+ } else if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) { - command |= ASPEED_I2CD_RX_BUFF_ENABLE; +- if (bus->buf_base) { ++ if (bus->dma_buf) { ++ len = bus->buf_size - ++ FIELD_GET(ASPEED_I2CD_DMA_LEN_MASK, ++ readl(bus->base + ++ ASPEED_I2C_DMA_LEN_REG)); ++ for (i = 1; i < len; i++) { ++ *value = bus->dma_buf[i]; ++ i2c_slave_event(bus->slave, I2C_SLAVE_WRITE_RECEIVED, ++ value); ++ } ++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, ++ bus->base + ASPEED_I2C_DMA_ADDR_REG); ++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, bus->buf_size), ++ bus->base + ASPEED_I2C_DMA_LEN_REG); ++ writel(ASPEED_I2CD_RX_DMA_ENABLE, ++ bus->base + ASPEED_I2C_CMD_REG); ++ } else if (bus->buf_base) { + len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, + readl(bus->base + + ASPEED_I2C_BUF_CTRL_REG)); +@@ -460,7 +518,15 @@ aspeed_i2c_prepare_rx_buf(struct aspeed_i2c_bus *bus, struct i2c_msg *msg) + command |= ASPEED_I2CD_M_S_RX_CMD_LAST; + } - if (msg->len > bus->buf_size) { -@@ -467,7 +544,26 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) - command |= ASPEED_I2CD_M_S_RX_CMD_LAST; - } - } else { -- if (bus->buf_base) { -+ if (bus->dma_buf) { -+ command |= ASPEED_I2CD_TX_DMA_ENABLE; -+ -+ if (msg->len + 1 > bus->dma_buf_size) -+ len = bus->dma_buf_size; -+ else -+ len = msg->len + 1; +- if (bus->buf_base) { ++ if (bus->dma_buf) { ++ command |= ASPEED_I2CD_RX_DMA_ENABLE; + -+ bus->dma_buf[0] = slave_addr; -+ memcpy(bus->dma_buf + 1, msg->buf, len); ++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, ++ bus->base + ASPEED_I2C_DMA_ADDR_REG); ++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, len), ++ bus->base + ASPEED_I2C_DMA_LEN_REG); ++ bus->dma_len = len; ++ } else { + command |= ASPEED_I2CD_RX_BUFF_ENABLE; + + writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, len - 1) | +@@ -483,7 +549,18 @@ aspeed_i2c_prepare_tx_buf(struct aspeed_i2c_bus *bus, struct i2c_msg *msg) + else + len = msg->len + 1; + +- if (bus->buf_base) { ++ if (bus->dma_buf) { ++ command |= ASPEED_I2CD_TX_DMA_ENABLE; + -+ bus->buf_index = len - 1; ++ bus->dma_buf[0] = slave_addr; ++ memcpy(bus->dma_buf + 1, msg->buf, len); + -+ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, -+ bus->base + ASPEED_I2C_DMA_ADDR_REG); -+ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, -+ len), -+ bus->base + ASPEED_I2C_DMA_LEN_REG); -+ bus->dma_len = len; -+ } else if (bus->buf_base) { - int i; ++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, ++ bus->base + ASPEED_I2C_DMA_ADDR_REG); ++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, len), ++ bus->base + ASPEED_I2C_DMA_LEN_REG); ++ bus->dma_len = len; ++ } else { + u8 wbuf[4]; + int i; + +@@ -536,18 +613,19 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) + if (msg->flags & I2C_M_RD) { + command |= ASPEED_I2CD_M_RX_CMD; + if (!(msg->flags & I2C_M_RECV_LEN)) { +- if (msg->len && bus->buf_base) ++ if (msg->len && (bus->dma_buf || bus->buf_base)) + command |= aspeed_i2c_prepare_rx_buf(bus, msg); - command |= ASPEED_I2CD_TX_BUFF_ENABLE; -@@ -503,7 +599,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) + /* Need to let the hardware know to NACK after RX. */ + if (msg->len <= 1) + command |= ASPEED_I2CD_M_S_RX_CMD_LAST; } +- } else if (msg->len && bus->buf_base) { ++ } else if (msg->len && (bus->dma_buf || bus->buf_base)) { + command |= aspeed_i2c_prepare_tx_buf(bus, msg); } - if (!(command & ASPEED_I2CD_TX_BUFF_ENABLE)) + if (!(command & (ASPEED_I2CD_TX_BUFF_ENABLE | + ASPEED_I2CD_TX_DMA_ENABLE))) - writel(slave_addr, bus->base + ASPEED_I2C_BYTE_BUF_REG); + writel(i2c_8bit_addr_from_msg(msg), + bus->base + ASPEED_I2C_BYTE_BUF_REG); writel(command, bus->base + ASPEED_I2C_CMD_REG); - } -@@ -649,7 +746,28 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - if (bus->buf_index < msg->len) { - command = ASPEED_I2CD_M_TX_CMD; +@@ -590,39 +668,52 @@ aspeed_i2c_master_handle_tx_first(struct aspeed_i2c_bus *bus, + { + u32 command = 0; + +- if (bus->buf_base) { +- u8 wbuf[4]; ++ if (bus->dma_buf || bus->buf_base) { + int len; +- int i; -- if (bus->buf_base) { -+ if (bus->dma_buf) { -+ command |= ASPEED_I2CD_TX_DMA_ENABLE; + if (msg->len - bus->buf_index > bus->buf_size) + len = bus->buf_size; + else + len = msg->len - bus->buf_index; + ++ if (bus->dma_buf) { ++ command |= ASPEED_I2CD_TX_DMA_ENABLE; + +- command |= ASPEED_I2CD_TX_BUFF_ENABLE; ++ memcpy(bus->dma_buf, msg->buf + bus->buf_index, len); + +- if (msg->len - bus->buf_index > bus->buf_size) +- len = bus->buf_size; +- else +- len = msg->len - bus->buf_index; + +- for (i = 0; i < len; i++) { +- wbuf[i % 4] = msg->buf[bus->buf_index + i]; +- if (i % 4 == 3) ++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, ++ bus->base + ASPEED_I2C_DMA_ADDR_REG); ++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, len), ++ bus->base + ASPEED_I2C_DMA_LEN_REG); ++ bus->dma_len = len; ++ } else { ++ u8 wbuf[4]; ++ int i; + -+ if (msg->len - bus->buf_index > -+ bus->dma_buf_size) -+ len = bus->dma_buf_size; -+ else -+ len = msg->len - bus->buf_index; ++ command |= ASPEED_I2CD_TX_BUFF_ENABLE; + -+ memcpy(bus->dma_buf, msg->buf + bus->buf_index, -+ len); ++ if (msg->len - bus->buf_index > bus->buf_size) ++ len = bus->buf_size; ++ else ++ len = msg->len - bus->buf_index; + -+ bus->buf_index += len; ++ for (i = 0; i < len; i++) { ++ wbuf[i % 4] = msg->buf[bus->buf_index + i]; ++ if (i % 4 == 3) ++ writel(*(u32 *)wbuf, ++ bus->buf_base + i - 3); ++ } ++ if (--i % 4 != 3) + writel(*(u32 *)wbuf, +- bus->buf_base + i - 3); +- } +- if (--i % 4 != 3) +- writel(*(u32 *)wbuf, +- bus->buf_base + i - (i % 4)); ++ bus->buf_base + i - (i % 4)); + +- writel(FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, +- len - 1) | +- FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, +- bus->buf_offset), +- bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ writel(FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, ++ len - 1) | ++ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, ++ bus->buf_offset), ++ bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ } + + bus->buf_index += len; + } else { +@@ -639,7 +730,14 @@ aspeed_i2c_master_handle_rx(struct aspeed_i2c_bus *bus, struct i2c_msg *msg) + u8 recv_byte; + int len; + +- if (bus->buf_base) { ++ if (bus->dma_buf) { ++ len = bus->dma_len - ++ FIELD_GET(ASPEED_I2CD_DMA_LEN_MASK, ++ readl(bus->base + ASPEED_I2C_DMA_LEN_REG)); + -+ writel(bus->dma_handle & -+ ASPEED_I2CD_DMA_ADDR_MASK, -+ bus->base + ASPEED_I2C_DMA_ADDR_REG); -+ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, -+ len), -+ bus->base + ASPEED_I2C_DMA_LEN_REG); -+ bus->dma_len = len; -+ } else if (bus->buf_base) { - u8 wbuf[4]; - int i; - -@@ -700,7 +818,15 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) ++ memcpy(msg->buf + bus->buf_index, bus->dma_buf, len); ++ bus->buf_index += len; ++ } else if (bus->buf_base) { + len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, + readl(bus->base + ASPEED_I2C_BUF_CTRL_REG)); + memcpy_fromio(msg->buf + bus->buf_index, bus->buf_base, len); +@@ -656,7 +754,7 @@ aspeed_i2c_master_handle_rx_next(struct aspeed_i2c_bus *bus, + { + u32 command = 0; + +- if (bus->buf_base) { ++ if (bus->dma_buf || bus->buf_base) { + int len; + + if (msg->len - bus->buf_index > bus->buf_size) { +@@ -666,14 +764,24 @@ aspeed_i2c_master_handle_rx_next(struct aspeed_i2c_bus *bus, + command |= ASPEED_I2CD_M_S_RX_CMD_LAST; } - irq_handled |= ASPEED_I2CD_INTR_RX_DONE; -- if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) { -+ if (bus->dma_buf && !(msg->flags & I2C_M_RECV_LEN)) { -+ len = bus->dma_len - -+ FIELD_GET(ASPEED_I2CD_DMA_LEN_MASK, -+ readl(bus->base + -+ ASPEED_I2C_DMA_LEN_REG)); -+ -+ memcpy(msg->buf + bus->buf_index, bus->dma_buf, len); -+ bus->buf_index += len; -+ } else if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) { - len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, - readl(bus->base + - ASPEED_I2C_BUF_CTRL_REG)); -@@ -728,7 +854,25 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - if (bus->buf_index < msg->len) { - command = ASPEED_I2CD_M_RX_CMD; - bus->master_state = ASPEED_I2C_MASTER_RX; -- if (bus->buf_base) { -+ if (bus->dma_buf) { -+ command |= ASPEED_I2CD_RX_DMA_ENABLE; -+ -+ if (msg->len - bus->buf_index > -+ bus->dma_buf_size) { -+ len = bus->dma_buf_size; -+ } else { -+ len = msg->len - bus->buf_index; -+ command |= ASPEED_I2CD_M_S_RX_CMD_LAST; -+ } +- command |= ASPEED_I2CD_RX_BUFF_ENABLE; ++ if (bus->dma_buf) { ++ command |= ASPEED_I2CD_RX_DMA_ENABLE; + +- writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, +- len - 1) | +- FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, 0) | +- FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, +- bus->buf_offset), +- bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK, ++ bus->base + ASPEED_I2C_DMA_ADDR_REG); ++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, len), ++ bus->base + ASPEED_I2C_DMA_LEN_REG); ++ bus->dma_len = len; ++ } else { ++ command |= ASPEED_I2CD_RX_BUFF_ENABLE; + -+ writel(bus->dma_handle & -+ ASPEED_I2CD_DMA_ADDR_MASK, -+ bus->base + ASPEED_I2C_DMA_ADDR_REG); -+ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK, -+ len), -+ bus->base + ASPEED_I2C_DMA_LEN_REG); -+ bus->dma_len = len; -+ } else if (bus->buf_base) { - command |= ASPEED_I2CD_RX_BUFF_ENABLE; - - if (msg->len - bus->buf_index > -@@ -1235,7 +1379,51 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) ++ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, ++ len - 1) | ++ FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, 0) | ++ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, ++ bus->buf_offset), ++ bus->base + ASPEED_I2C_BUF_CTRL_REG); ++ } + } else { + if (bus->buf_index + 1 == msg->len) + command |= ASPEED_I2CD_M_S_RX_CMD_LAST; +@@ -1260,7 +1368,51 @@ static void aspeed_i2c_set_xfer_mode(struct aspeed_i2c_bus *bus) sram_enabled = false; } - if (sram_enabled) { + /* -+ * Only AST2500 supports DMA mode under some limitations: ++ * Only AST2500 and AST2600 support DMA mode under some limitations: + * I2C is sharing the DMA H/W with UHCI host controller and MCTP + * controller. Since those controllers operate with DMA mode only, I2C + * has to use buffer mode or byte mode instead if one of those @@ -350,25 +399,25 @@ index 1b338492c68a..8dc6723bfaaf 100644 + * use DMA mode. + */ + if (sram_enabled && !IS_ENABLED(CONFIG_USB_UHCI_ASPEED) && -+ of_device_is_compatible(pdev->dev.of_node, -+ "aspeed,ast2500-i2c-bus")) { ++ !of_device_is_compatible(pdev->dev.of_node, ++ "aspeed,ast2400-i2c-bus")) { + u32 dma_len_max = ASPEED_I2CD_DMA_LEN_MASK >> + ASPEED_I2CD_DMA_LEN_SHIFT; + + ret = device_property_read_u32(&pdev->dev, + "aspeed,dma-buf-size", -+ &bus->dma_buf_size); -+ if (!ret && bus->dma_buf_size > dma_len_max) -+ bus->dma_buf_size = dma_len_max; ++ &bus->buf_size); ++ if (!ret && bus->buf_size > dma_len_max) ++ bus->buf_size = dma_len_max; + } + -+ if (bus->dma_buf_size) { ++ if (bus->buf_size) { + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { + dev_warn(&pdev->dev, "No suitable DMA available\n"); + } else { + bus->dma_pool = dma_pool_create("i2c-aspeed", + &pdev->dev, -+ bus->dma_buf_size, ++ bus->buf_size, + ASPEED_I2CD_DMA_ALIGN, + 0); + if (bus->dma_pool) @@ -388,7 +437,7 @@ index 1b338492c68a..8dc6723bfaaf 100644 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 1); -@@ -1275,24 +1463,33 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -1365,24 +1517,33 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) */ ret = aspeed_i2c_init(bus, pdev); if (ret < 0) @@ -426,7 +475,7 @@ index 1b338492c68a..8dc6723bfaaf 100644 } static int aspeed_i2c_remove_bus(struct platform_device *pdev) -@@ -1310,6 +1507,10 @@ static int aspeed_i2c_remove_bus(struct platform_device *pdev) +@@ -1400,6 +1561,10 @@ static int aspeed_i2c_remove_bus(struct platform_device *pdev) reset_control_assert(bus->rst); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0063-i2c-aspeed-add-general-call-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0063-i2c-aspeed-add-general-call-support.patch index 2f51c3fc9..899924f61 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0063-i2c-aspeed-add-general-call-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0063-i2c-aspeed-add-general-call-support.patch @@ -1,4 +1,4 @@ -From 3f73215941667176ba05f358f4ee08816299bd32 Mon Sep 17 00:00:00 2001 +From d731b53de05b8d69ea739f02275416126cf5fe4e Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Wed, 1 May 2019 13:27:34 -0700 Subject: [PATCH] i2c: aspeed: add general call support @@ -28,7 +28,7 @@ index d3f4a39f7ba6..c1ee99398517 100644 specified. - #retries : Number of retries for master transfer. diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 8dc6723bfaaf..891b2b5c4b7a 100644 +index 3c9e491cbe4e..4420899e2c2d 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -59,6 +59,7 @@ @@ -65,7 +65,7 @@ index 8dc6723bfaaf..891b2b5c4b7a 100644 #endif /* CONFIG_I2C_SLAVE */ }; -@@ -315,6 +321,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -423,6 +429,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) bus->slave_state = ASPEED_I2C_SLAVE_START; } @@ -78,7 +78,7 @@ index 8dc6723bfaaf..891b2b5c4b7a 100644 /* Slave is not currently active, irq was for someone else. */ if (bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE) return irq_handled; -@@ -342,6 +354,21 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -441,6 +453,21 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) else bus->slave_state = ASPEED_I2C_SLAVE_WRITE_REQUESTED; @@ -100,9 +100,9 @@ index 8dc6723bfaaf..891b2b5c4b7a 100644 } irq_handled |= ASPEED_I2CD_INTR_RX_DONE; } -@@ -462,11 +489,16 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - bus->base + ASPEED_I2C_CMD_REG); - } +@@ -487,11 +514,16 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) + i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value); + aspeed_i2c_slave_handle_write_received(bus, &value); break; + case ASPEED_I2C_SLAVE_GCALL_REQUESTED: + bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; @@ -117,7 +117,7 @@ index 8dc6723bfaaf..891b2b5c4b7a 100644 /* Slave was just started. Waiting for the next event. */; break; default: -@@ -1084,6 +1116,8 @@ static void __aspeed_i2c_reg_slave(struct aspeed_i2c_bus *bus, u16 slave_addr) +@@ -1127,6 +1159,8 @@ static void __aspeed_i2c_reg_slave(struct aspeed_i2c_bus *bus, u16 slave_addr) /* Turn on slave mode. */ func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG); func_ctrl_reg_val |= ASPEED_I2CD_SLAVE_EN; @@ -126,7 +126,7 @@ index 8dc6723bfaaf..891b2b5c4b7a 100644 writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG); } -@@ -1122,6 +1156,8 @@ static int aspeed_i2c_unreg_slave(struct i2c_client *client) +@@ -1165,6 +1199,8 @@ static int aspeed_i2c_unreg_slave(struct i2c_client *client) /* Turn off slave mode. */ func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG); func_ctrl_reg_val &= ~ASPEED_I2CD_SLAVE_EN; @@ -135,7 +135,7 @@ index 8dc6723bfaaf..891b2b5c4b7a 100644 writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG); bus->slave = NULL; -@@ -1269,6 +1305,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, +@@ -1312,6 +1348,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, bus->base + ASPEED_I2C_FUN_CTRL_REG); #if IS_ENABLED(CONFIG_I2C_SLAVE) diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch index a5f4fa216..0e8a2b101 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch @@ -1,4 +1,4 @@ -From 3e359be7e8a96b068479d01aa671ff642d291bca Mon Sep 17 00:00:00 2001 +From b429cf11ecb2f6009dd9e062ea5e053718802d93 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Thu, 11 Jul 2019 13:53:34 -0700 Subject: [PATCH] i2c: aspeed: add H/W timeout support @@ -11,7 +11,7 @@ Signed-off-by: Jae Hyun Yoo 1 file changed, 76 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 891b2b5c4b7a..71ebf3bbf38b 100644 +index 4420899e2c2d..830b3d2cabad 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -55,6 +55,7 @@ @@ -79,10 +79,10 @@ index 891b2b5c4b7a..71ebf3bbf38b 100644 + return 0; +} + - static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - { - u32 command, irq_handled = 0; -@@ -313,6 +331,14 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) + static inline void + aspeed_i2c_slave_handle_rx_done(struct aspeed_i2c_bus *bus, u32 irq_status, + u8 *value) +@@ -421,6 +439,14 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) if (!slave) return 0; @@ -97,7 +97,7 @@ index 891b2b5c4b7a..71ebf3bbf38b 100644 command = readl(bus->base + ASPEED_I2C_CMD_REG); /* Slave was requested, restart state machine. */ -@@ -655,7 +681,7 @@ static void aspeed_i2c_next_msg_or_stop(struct aspeed_i2c_bus *bus) +@@ -681,7 +707,7 @@ static void aspeed_i2c_next_msg_or_stop(struct aspeed_i2c_bus *bus) } } @@ -106,7 +106,7 @@ index 891b2b5c4b7a..71ebf3bbf38b 100644 { if (irq_status & ASPEED_I2CD_INTR_ARBIT_LOSS) return -EAGAIN; -@@ -686,9 +712,9 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -840,9 +866,9 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) * should clear the command queue effectively taking us back to the * INACTIVE state. */ @@ -118,7 +118,7 @@ index 891b2b5c4b7a..71ebf3bbf38b 100644 irq_status); irq_handled |= (irq_status & ASPEED_I2CD_INTR_MASTER_ERRORS); if (bus->master_state != ASPEED_I2C_MASTER_INACTIVE) { -@@ -1264,6 +1290,7 @@ static u32 aspeed_i2c_25xx_get_clk_reg_val(struct device *dev, u32 divisor) +@@ -1307,6 +1333,7 @@ static u32 aspeed_i2c_25xx_get_clk_reg_val(struct device *dev, u32 divisor) /* precondition: bus.lock has been acquired. */ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus) { @@ -126,7 +126,7 @@ index 891b2b5c4b7a..71ebf3bbf38b 100644 u32 divisor, clk_reg_val; divisor = DIV_ROUND_UP(bus->parent_clk_frequency, bus->bus_frequency); -@@ -1272,8 +1299,46 @@ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus) +@@ -1315,8 +1342,46 @@ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus) ASPEED_I2CD_TIME_THDSTA_MASK | ASPEED_I2CD_TIME_TACST_MASK); clk_reg_val |= bus->get_clk_reg_val(bus->dev, divisor); @@ -174,7 +174,7 @@ index 891b2b5c4b7a..71ebf3bbf38b 100644 return 0; } -@@ -1288,6 +1353,11 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, +@@ -1331,6 +1396,11 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, /* Disable everything. */ writel(0, bus->base + ASPEED_I2C_FUN_CTRL_REG); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch index a304de019..104279ace 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch @@ -1,4 +1,4 @@ -From 78ad5c6291df33b7cba0e6be9a2b6ed6e7bbd571 Mon Sep 17 00:00:00 2001 +From b43bdeb5f3aa297549655e67f0e6a5db5f592e34 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Thu, 11 Jul 2019 14:04:39 -0700 Subject: [PATCH] i2c: aspeed: add SLAVE_ADDR_RECEIVED_PENDING interrupt @@ -15,7 +15,7 @@ Signed-off-by: Jae Hyun Yoo 1 file changed, 13 insertions(+) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 71ebf3bbf38b..a15f54f64b50 100644 +index 830b3d2cabad..a308d5896632 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -87,6 +87,7 @@ @@ -26,7 +26,7 @@ index 71ebf3bbf38b..a15f54f64b50 100644 #define ASPEED_I2CD_INTR_SLAVE_INACTIVE_TIMEOUT BIT(15) #define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14) #define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13) -@@ -360,6 +361,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -468,6 +469,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) dev_dbg(bus->dev, "slave irq status 0x%08x, cmd 0x%08x\n", irq_status, command); @@ -44,7 +44,7 @@ index 71ebf3bbf38b..a15f54f64b50 100644 + /* Slave was sent something. */ if (irq_status & ASPEED_I2CD_INTR_RX_DONE) { - if (bus->dma_buf && + aspeed_i2c_slave_handle_rx_done(bus, irq_status, &value); -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch deleted file mode 100644 index 4118e366c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 1032b062669b7ee041d2f5a9f4729953655efe61 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Wed, 4 Sep 2019 14:52:40 -0700 -Subject: [PATCH] media: aspeed: refine HSYNC/VSYNC polarity setting logic - -Sometimes it detects weird resolutions such as 1024x287 when the -actual resolution is 1280x768. To resolve this issue, this commit -refines HSYNC/VSYNC polarity setting code for mode detection by -clearing the bits as normal polarity at the beginning of the first -mode detection like datasheet suggested, and refines polarity -setting logic so that the bits can be set or cleared properly. - -Signed-off-by: Jae Hyun Yoo ---- - drivers/media/platform/aspeed-video.c | 45 ++++++++++++++++++----------------- - 1 file changed, 23 insertions(+), 22 deletions(-) - -diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c -index 4ef37cfc8446..455c6af81236 100644 ---- a/drivers/media/platform/aspeed-video.c -+++ b/drivers/media/platform/aspeed-video.c -@@ -614,7 +614,7 @@ static void aspeed_video_check_and_set_polarity(struct aspeed_video *video) - int i; - int hsync_counter = 0; - int vsync_counter = 0; -- u32 sts; -+ u32 sts, ctrl; - - for (i = 0; i < NUM_POLARITY_CHECKS; ++i) { - sts = aspeed_video_read(video, VE_MODE_DETECT_STATUS); -@@ -629,30 +629,29 @@ static void aspeed_video_check_and_set_polarity(struct aspeed_video *video) - hsync_counter++; - } - -- if (hsync_counter < 0 || vsync_counter < 0) { -- u32 ctrl = 0; -+ ctrl = aspeed_video_read(video, VE_CTRL); - -- if (hsync_counter < 0) { -- ctrl = VE_CTRL_HSYNC_POL; -- video->detected_timings.polarities &= -- ~V4L2_DV_HSYNC_POS_POL; -- } else { -- video->detected_timings.polarities |= -- V4L2_DV_HSYNC_POS_POL; -- } -- -- if (vsync_counter < 0) { -- ctrl = VE_CTRL_VSYNC_POL; -- video->detected_timings.polarities &= -- ~V4L2_DV_VSYNC_POS_POL; -- } else { -- video->detected_timings.polarities |= -- V4L2_DV_VSYNC_POS_POL; -- } -+ if (hsync_counter < 0) { -+ ctrl |= VE_CTRL_HSYNC_POL; -+ video->detected_timings.polarities &= -+ ~V4L2_DV_HSYNC_POS_POL; -+ } else { -+ ctrl &= ~VE_CTRL_HSYNC_POL; -+ video->detected_timings.polarities |= -+ V4L2_DV_HSYNC_POS_POL; -+ } - -- if (ctrl) -- aspeed_video_update(video, VE_CTRL, 0, ctrl); -+ if (vsync_counter < 0) { -+ ctrl |= VE_CTRL_VSYNC_POL; -+ video->detected_timings.polarities &= -+ ~V4L2_DV_VSYNC_POS_POL; -+ } else { -+ ctrl &= ~VE_CTRL_VSYNC_POL; -+ video->detected_timings.polarities |= -+ V4L2_DV_VSYNC_POS_POL; - } -+ -+ aspeed_video_write(video, VE_CTRL, ctrl); - } - - static bool aspeed_video_alloc_buf(struct aspeed_video *video, -@@ -741,6 +740,8 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) - } - - set_bit(VIDEO_RES_DETECT, &video->flags); -+ aspeed_video_update(video, VE_CTRL, -+ VE_CTRL_VSYNC_POL | VE_CTRL_HSYNC_POL, 0); - aspeed_video_enable_mode_detect(video); - - rc = wait_event_interruptible_timeout(video->wait, --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0075-Refine-initialization-flow-in-I2C-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0075-Refine-initialization-flow-in-I2C-driver.patch index 009fccacf..52c3617d6 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0075-Refine-initialization-flow-in-I2C-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0075-Refine-initialization-flow-in-I2C-driver.patch @@ -1,4 +1,4 @@ -From 83c1fcb7dacb59d22b41356e3b7009ff2387d448 Mon Sep 17 00:00:00 2001 +From 93ba2aeb9ad3899e2b72877daa47376a6bf192b6 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Mon, 23 Sep 2019 13:48:49 -0700 Subject: [PATCH] Refine initialization flow in I2C driver @@ -15,12 +15,12 @@ Signed-off-by: Jae Hyun Yoo 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index a15f54f64b50..62b803e15ce2 100644 +index a308d5896632..b32611088c82 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -1454,6 +1454,11 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) - if (IS_ERR(bus->base)) - return PTR_ERR(bus->base); +@@ -1588,6 +1588,11 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + + bus->dev = &pdev->dev; + /* Disable bus and clean up any left over interrupt state. */ + writel(0, bus->base + ASPEED_I2C_FUN_CTRL_REG); @@ -30,9 +30,9 @@ index a15f54f64b50..62b803e15ce2 100644 parent_clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(parent_clk)) return PTR_ERR(parent_clk); -@@ -1576,17 +1581,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) - - bus->dev = &pdev->dev; +@@ -1630,17 +1635,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + strlcpy(bus->adap.name, pdev->name, sizeof(bus->adap.name)); + i2c_set_adapdata(&bus->adap, bus); - /* Clean up any left over interrupt state. */ - writel(0, bus->base + ASPEED_I2C_INTR_CTRL_REG); @@ -48,7 +48,7 @@ index a15f54f64b50..62b803e15ce2 100644 irq = irq_of_parse_and_map(pdev->dev.of_node, 0); ret = devm_request_irq(&pdev->dev, irq, aspeed_i2c_bus_irq, 0, dev_name(&pdev->dev), bus); -@@ -1599,6 +1593,10 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -1653,6 +1647,10 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) platform_set_drvdata(pdev, bus); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0076-media-aspeed-clear-garbage-interrupts.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0076-media-aspeed-clear-garbage-interrupts.patch deleted file mode 100644 index 0cf9913fe..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0076-media-aspeed-clear-garbage-interrupts.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 5f89fa4b6468771b5de6e73454bf0ea546249b7b Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Thu, 26 Sep 2019 12:15:23 -0700 -Subject: [PATCH] media: aspeed: clear garbage interrupts - -CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even when these -are disabled in the VE_INTERRUPT_CTRL register and eventually this -behavior causes disabling irq itself like below: - -[10055.108784] irq 23: nobody cared (try booting with the "irqpoll" option) -[10055.115525] CPU: 0 PID: 331 Comm: swampd Tainted: G W 5.3.0-4fde000-dirty-d683e2e #1 -[10055.124565] Hardware name: Generic DT based system -[10055.129355] Backtrace: -[10055.131854] [<80107d7c>] (dump_backtrace) from [<80107fb0>] (show_stack+0x20/0x24) -[10055.139431] r7:00000017 r6:00000001 r5:00000000 r4:9d51dc00 -[10055.145120] [<80107f90>] (show_stack) from [<8074bf50>] (dump_stack+0x20/0x28) -[10055.152361] [<8074bf30>] (dump_stack) from [<80150ffc>] (__report_bad_irq+0x40/0xc0) -[10055.160109] [<80150fbc>] (__report_bad_irq) from [<80150f2c>] (note_interrupt+0x23c/0x294) -[10055.168374] r9:015b6e60 r8:00000000 r7:00000017 r6:00000001 r5:00000000 r4:9d51dc00 -[10055.176136] [<80150cf0>] (note_interrupt) from [<8014df1c>] (handle_irq_event_percpu+0x88/0x98) -[10055.184835] r10:7eff7910 r9:015b6e60 r8:00000000 r7:9d417600 r6:00000001 r5:00000002 -[10055.192657] r4:9d51dc00 r3:00000000 -[10055.196248] [<8014de94>] (handle_irq_event_percpu) from [<8014df64>] (handle_irq_event+0x38/0x4c) -[10055.205113] r5:80b56d50 r4:9d51dc00 -[10055.208697] [<8014df2c>] (handle_irq_event) from [<80151f1c>] (handle_level_irq+0xbc/0x12c) -[10055.217037] r5:80b56d50 r4:9d51dc00 -[10055.220623] [<80151e60>] (handle_level_irq) from [<8014d4b8>] (generic_handle_irq+0x30/0x44) -[10055.229052] r5:80b56d50 r4:00000017 -[10055.232648] [<8014d488>] (generic_handle_irq) from [<8014d524>] (__handle_domain_irq+0x58/0xb4) -[10055.241356] [<8014d4cc>] (__handle_domain_irq) from [<801021e4>] (avic_handle_irq+0x68/0x70) -[10055.249797] r9:015b6e60 r8:00c5387d r7:00c5387d r6:ffffffff r5:9dd33fb0 r4:9d402380 -[10055.257539] [<8010217c>] (avic_handle_irq) from [<80101e34>] (__irq_usr+0x54/0x80) -[10055.265105] Exception stack(0x9dd33fb0 to 0x9dd33ff8) -[10055.270152] 3fa0: 015d0530 00000000 00000000 015d0538 -[10055.278328] 3fc0: 015d0530 015b6e60 00000000 00000000 0052c5d0 015b6e60 7eff7910 7eff7918 -[10055.286496] 3fe0: 76ce5614 7eff7908 0050e2f4 76a3a08c 20000010 ffffffff -[10055.293104] r5:20000010 r4:76a3a08c -[10055.296673] handlers: -[10055.298967] [<79f218a5>] irq_default_primary_handler threaded [<1de88514>] aspeed_video_irq -[10055.307344] Disabling IRQ #23 - -To fix this issue, this commit makes the interrupt handler clear -these garbage interrupts. This driver enables and uses only -COMP_COMPLETE interrupt. - -Signed-off-by: Jae Hyun Yoo ---- - drivers/media/platform/aspeed-video.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c -index 455c6af81236..0473f3141329 100644 ---- a/drivers/media/platform/aspeed-video.c -+++ b/drivers/media/platform/aspeed-video.c -@@ -606,6 +606,16 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg) - aspeed_video_start_frame(video); - } - -+ /* -+ * CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even when these -+ * are disabled in the VE_INTERRUPT_CTRL register so clear them to -+ * prevent unnecessary interrupt calls. -+ */ -+ if (sts & VE_INTERRUPT_CAPTURE_COMPLETE) -+ sts &= ~VE_INTERRUPT_CAPTURE_COMPLETE; -+ if (sts & VE_INTERRUPT_FRAME_COMPLETE) -+ sts &= ~VE_INTERRUPT_FRAME_COMPLETE; -+ - return sts ? IRQ_NONE : IRQ_HANDLED; - } - --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0082-ARM-dts-aspeed-g6-add-USB-virtual-hub-fixup.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0082-ARM-dts-aspeed-g6-add-USB-virtual-hub-fixup.patch deleted file mode 100644 index f950c9262..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0082-ARM-dts-aspeed-g6-add-USB-virtual-hub-fixup.patch +++ /dev/null @@ -1,53 +0,0 @@ -From e0e33dfafe30f6dfb175caaf6be99aa9cbfe295a Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Wed, 20 Nov 2019 13:06:58 -0800 -Subject: [PATCH] ARM: dts: aspeed-g6: add USB virtual hub fixup - -This commit adds dt and pinctrl fixup for USB virtual hub. - -Signed-off-by: Jae Hyun Yoo ---- - arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi | 5 +++++ - arch/arm/boot/dts/aspeed-g6.dtsi | 10 ++++++++++ - 2 files changed, 15 insertions(+) - -diff --git a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi -index 045ce66ca876..6ea66aaf9dd0 100644 ---- a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi -+++ b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi -@@ -1112,6 +1112,11 @@ - groups = "UART9"; - }; - -+ pinctrl_usb2adp_default: usb2adp_default { -+ function = "USB2ADP"; -+ groups = "USBA"; -+ }; -+ - pinctrl_vb_default: vb_default { - function = "VB"; - groups = "VB"; -diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi -index 33fcd89db6b8..b880e8e8f999 100644 ---- a/arch/arm/boot/dts/aspeed-g6.dtsi -+++ b/arch/arm/boot/dts/aspeed-g6.dtsi -@@ -272,6 +272,16 @@ - status = "disabled"; - }; - -+ vhub: usb-vhub@1e6a0000 { -+ compatible = "aspeed,ast2600-usb-vhub"; -+ reg = <0x1e6a0000 0x300>; -+ interrupts = ; -+ clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_usb2adp_default>; -+ status = "disabled"; -+ }; -+ - apb { - compatible = "simple-bus"; - #address-cells = <1>; --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0083-usb-gadget-aspeed-add-ast2600-compatible-string.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0083-usb-gadget-aspeed-add-ast2600-compatible-string.patch deleted file mode 100644 index 3f6f3ce91..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0083-usb-gadget-aspeed-add-ast2600-compatible-string.patch +++ /dev/null @@ -1,32 +0,0 @@ -From eedb53957b507bda2b9f6025149d2052e0598f76 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo -Date: Wed, 20 Nov 2019 12:49:46 -0800 -Subject: [PATCH] usb: gadget: aspeed: add ast2600 compatible string - -This commit adds "aspeed,ast2600-usb-vhub" compatible string to -use it for AST2600 USB virtual hub driver. AST2600 support total 7 -downstream device ports so this driver should be modified later to -support the additional ports. - -Signed-off-by: Jae Hyun Yoo ---- - drivers/usb/gadget/udc/aspeed-vhub/core.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c -index 90b134d..905e1cf 100644 ---- a/drivers/usb/gadget/udc/aspeed-vhub/core.c -+++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c -@@ -407,6 +407,9 @@ static const struct of_device_id ast_vhub_dt_ids[] = { - { - .compatible = "aspeed,ast2500-usb-vhub", - }, -+ { -+ .compatible = "aspeed,ast2600-usb-vhub", -+ }, - { } - }; - MODULE_DEVICE_TABLE(of, ast_vhub_dt_ids); --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0090-peci-cpupower-driver-1.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0090-peci-cpupower-driver-1.patch new file mode 100644 index 000000000..475e9611f --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0090-peci-cpupower-driver-1.patch @@ -0,0 +1,405 @@ +From e40f7d10d5306c075e2fc7e538ce1efc70eeb448 Mon Sep 17 00:00:00 2001 +From: ZhikuiRen +Date: Thu, 9 Jan 2020 10:48:00 -0800 +Subject: [PATCH] Add peci-cpupower driver + +peci-cpupower reads CPU energy counter through peci +and computes average power in mW since last read. + +Signed-off-by: ZhikuiRen +--- + Documentation/hwmon/index.rst | 1 + + Documentation/hwmon/peci-cpupower.rst | 52 ++++++++ + arch/arm/configs/aspeed_g5_defconfig | 1 + + drivers/hwmon/Kconfig | 14 +++ + drivers/hwmon/Makefile | 1 + + drivers/hwmon/peci-cpupower.c | 231 ++++++++++++++++++++++++++++++++++ + drivers/mfd/intel-peci-client.c | 1 + + include/uapi/linux/peci-ioctl.h | 1 + + 8 files changed, 302 insertions(+) + create mode 100644 Documentation/hwmon/peci-cpupower.rst + create mode 100644 drivers/hwmon/peci-cpupower.c + +diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst +index 7d894c9..0bde0ef 100644 +--- a/Documentation/hwmon/index.rst ++++ b/Documentation/hwmon/index.rst +@@ -130,6 +130,7 @@ Hardware Monitoring Kernel Drivers + pcf8591 + peci-cputemp + peci-dimmtemp ++ peci-cpupower + pmbus + powr1220 + pxe1610 +diff --git a/Documentation/hwmon/peci-cpupower.rst b/Documentation/hwmon/peci-cpupower.rst +new file mode 100644 +index 0000000..4d7bd61 +--- /dev/null ++++ b/Documentation/hwmon/peci-cpupower.rst +@@ -0,0 +1,52 @@ ++.. SPDX-License-Identifier: GPL-2.0 ++ ++Kernel driver peci-cpupower ++========================== ++ ++:Copyright: |copy| 2018-2020 Intel Corporation ++ ++Supported chips: ++ One of Intel server CPUs listed below which is connected to a PECI bus. ++ * Intel Xeon E5/E7 v3 server processors ++ Intel Xeon E5-14xx v3 family ++ Intel Xeon E5-24xx v3 family ++ Intel Xeon E5-16xx v3 family ++ Intel Xeon E5-26xx v3 family ++ Intel Xeon E5-46xx v3 family ++ Intel Xeon E7-48xx v3 family ++ Intel Xeon E7-88xx v3 family ++ * Intel Xeon E5/E7 v4 server processors ++ Intel Xeon E5-16xx v4 family ++ Intel Xeon E5-26xx v4 family ++ Intel Xeon E5-46xx v4 family ++ Intel Xeon E7-48xx v4 family ++ Intel Xeon E7-88xx v4 family ++ * Intel Xeon Scalable server processors ++ Intel Xeon D family ++ Intel Xeon Bronze family ++ Intel Xeon Silver family ++ Intel Xeon Gold family ++ Intel Xeon Platinum family ++ ++ Addresses scanned: PECI client address 0x30 - 0x37 ++ Datasheet: Available from http://www.intel.com/design/literature.htm ++ ++Author: ++ Zhikui Ren ++ ++Description ++----------- ++ ++This driver implements a generic PECI hwmon feature which provides ++average power consumption readings of the CPU package based on energy counter ++accessible using the PECI Client Command Suite via the processor PECI client. ++ ++Power values are average power since last measure given in milli Watt and ++will be measurable only when the target CPU is powered on. ++ ++``sysfs`` interface ++------------------- ++======================= ======================================================= ++power1_average Provides average power since last read in milli Watt. ++power1_label Provides string "Average Power". ++======================= ======================================================= +diff --git a/arch/arm/configs/aspeed_g5_defconfig b/arch/arm/configs/aspeed_g5_defconfig +index 1e589a0..0e50040 100644 +--- a/arch/arm/configs/aspeed_g5_defconfig ++++ b/arch/arm/configs/aspeed_g5_defconfig +@@ -177,6 +177,7 @@ CONFIG_SENSORS_OCC_P8_I2C=y + CONFIG_SENSORS_OCC_P9_SBE=y + CONFIG_SENSORS_PECI_CPUTEMP=y + CONFIG_SENSORS_PECI_DIMMTEMP=y ++CONFIG_SENSORS_PECI_CPUPOWER=y + CONFIG_PMBUS=y + CONFIG_SENSORS_ADM1275=y + CONFIG_SENSORS_IBM_CFFPS=y +diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig +index 8312b37..07d8826 100644 +--- a/drivers/hwmon/Kconfig ++++ b/drivers/hwmon/Kconfig +@@ -1361,6 +1361,20 @@ config SENSORS_PECI_DIMMTEMP + This driver can also be built as a module. If so, the module + will be called peci-dimmtemp. + ++config SENSORS_PECI_CPUPOWER ++ tristate "PECI CPU power monitoring support" ++ depends on PECI ++ select MFD_INTEL_PECI_CLIENT ++ help ++ If you say yes here you get support for the generic Intel PECI ++ cputemp driver which provides average engergy ++ readings of the CPU package using ++ the PECI Client Command Suite via the processor PECI client. ++ Check Documentation/hwmon/peci-cpupower for details. ++ ++ This driver can also be built as a module. If so, the module ++ will be called peci-cpupower. ++ + source "drivers/hwmon/pmbus/Kconfig" + + config SENSORS_PWM_FAN +diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile +index e74ea92..fab43fd 100644 +--- a/drivers/hwmon/Makefile ++++ b/drivers/hwmon/Makefile +@@ -144,6 +144,7 @@ obj-$(CONFIG_SENSORS_PC87427) += pc87427.o + obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o + obj-$(CONFIG_SENSORS_PECI_CPUTEMP) += peci-cputemp.o + obj-$(CONFIG_SENSORS_PECI_DIMMTEMP) += peci-dimmtemp.o ++obj-$(CONFIG_SENSORS_PECI_CPUPOWER) += peci-cpupower.o + obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o + obj-$(CONFIG_SENSORS_PWM_FAN) += pwm-fan.o + obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON) += raspberrypi-hwmon.o +diff --git a/drivers/hwmon/peci-cpupower.c b/drivers/hwmon/peci-cpupower.c +new file mode 100644 +index 0000000..6907696 +--- /dev/null ++++ b/drivers/hwmon/peci-cpupower.c +@@ -0,0 +1,231 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// Copyright (c) 2018-2020 Intel Corporation ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "peci-hwmon.h" ++ ++#define POWER_DEFAULT_CHANNEL_NUMS 1 ++ ++struct peci_cpupower { ++ struct peci_client_manager *mgr; ++ struct device *dev; ++ char name[PECI_NAME_SIZE]; ++ const struct cpu_gen_info *gen_info; ++ struct peci_sensor_data energy; ++ long avg_power_val; ++ u64 core_mask; ++ u32 power_config[POWER_DEFAULT_CHANNEL_NUMS + 1]; ++ uint config_idx; ++ struct hwmon_channel_info power_info; ++ const struct hwmon_channel_info *info[2]; ++ struct hwmon_chip_info chip; ++}; ++ ++enum cpupower_channels { ++ average_power, ++}; ++ ++static const u32 config_table[POWER_DEFAULT_CHANNEL_NUMS] = { ++ /* average power */ ++ HWMON_P_LABEL | HWMON_P_AVERAGE, ++}; ++ ++static const char *cpupower_label[POWER_DEFAULT_CHANNEL_NUMS] = { ++ "Average Power", ++}; ++ ++static int get_average_power(struct peci_cpupower *priv) ++{ ++ u8 pkg_cfg[4]; ++ int ret; ++ ++ if (!peci_sensor_need_update(&priv->energy)) ++ return 0; ++ ++ ret = peci_client_read_package_config(priv->mgr, ++ PECI_MBX_INDEX_TDP_UNITS, ++ PECI_PKG_ID_PKG_ENERGY_STATUS, ++ pkg_cfg); ++ ++ u32 power_unit = ((le32_to_cpup((__le32 *)pkg_cfg)) & 0x1f00) >> 8; ++ ++ dev_dbg(priv->dev, "cpupower units %d (1J/pow(2, unit))\n", ++ power_unit); ++ ++ ret = peci_client_read_package_config(priv->mgr, ++ PECI_MBX_INDEX_ENERGY_COUNTER, ++ PECI_PKG_ID_PKG_ENERGY_STATUS, ++ pkg_cfg); ++ if (!ret) { ++ u32 energy_cnt = le32_to_cpup((__le32 *)pkg_cfg); ++ ulong jif = jiffies; ++ ulong elapsed = (jif - priv->energy.last_updated); ++ long power_val = 0; ++ /* ++ * Don't calculate average power for first counter read or ++ * counter wrapped around or last counter read was more than ++ * 60 minutes ago (jiffies did not wrap and power calculation ++ * does not overflow or underflow ++ */ ++ if (priv->energy.last_updated > 0 && ++ energy_cnt > priv->energy.value && ++ (elapsed < (HZ * 3600))) { ++ power_val = (long)(energy_cnt - priv->energy.value) ++ / elapsed * HZ; ++ dev_dbg(priv->dev, "countDiff %d, jiffes elapsed %d, raw powerValue %d scale to %d mW\n", ++ (long)(energy_cnt - priv->energy.value), ++ elapsed, power_val, ++ power_val >> (power_unit - 10)); ++ } else { ++ dev_dbg(priv->dev, "countDiff %d, jiffes elapsed %d, skipping calculate power, try agin\n", ++ (long)(energy_cnt - priv->energy.value), ++ elapsed); ++ ret = -EAGAIN; ++ } ++ ++ priv->energy.value = energy_cnt; ++ priv->avg_power_val = power_val >> ((power_unit - 10)); ++ peci_sensor_mark_updated(&priv->energy); ++ ++ dev_dbg(priv->dev, "energy counter 0x%8x, average power %dmW, jif %u, HZ is %d jiffies\n", ++ priv->energy.value, priv->avg_power_val, ++ jif, HZ); ++ } ++ return ret; ++} ++ ++static int cpupower_read_string(struct device *dev, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel, const char **str) ++{ ++ if (attr != hwmon_power_label) ++ return -EOPNOTSUPP; ++ if (channel >= POWER_DEFAULT_CHANNEL_NUMS) ++ return -EOPNOTSUPP; ++ *str = cpupower_label[channel]; ++ ++ return 0; ++} ++ ++static int cpupower_read(struct device *dev, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel, long *val) ++{ ++ struct peci_cpupower *priv = dev_get_drvdata(dev); ++ int ret; ++ ++ if (channel >= POWER_DEFAULT_CHANNEL_NUMS || ++ !(priv->power_config[channel] & BIT(attr))) ++ return -EOPNOTSUPP; ++ ++ switch (attr) { ++ case hwmon_power_average: ++ switch (channel) { ++ case average_power: ++ ret = get_average_power(priv); ++ if (ret) ++ break; ++ ++ *val = priv->avg_power_val; ++ break; ++ default: ++ break; ++ } ++ break; ++ default: ++ ret = -EOPNOTSUPP; ++ break; ++ } ++ ++ return ret; ++} ++ ++static umode_t cpupower_is_visible(const void *data, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel) ++{ ++ const struct peci_cpupower *priv = data; ++ ++ if (channel < POWER_DEFAULT_CHANNEL_NUMS || ++ (priv->power_config[channel] & BIT(attr))) ++ return 0444; ++ ++ return 0; ++} ++ ++static const struct hwmon_ops cpupower_ops = { ++ .is_visible = cpupower_is_visible, ++ .read_string = cpupower_read_string, ++ .read = cpupower_read, ++}; ++ ++static int peci_cpupower_probe(struct platform_device *pdev) ++{ ++ struct peci_client_manager *mgr = dev_get_drvdata(pdev->dev.parent); ++ struct device *dev = &pdev->dev; ++ struct peci_cpupower *priv; ++ struct device *hwmon_dev; ++ ++ if ((mgr->client->adapter->cmd_mask & ++ (BIT(PECI_CMD_RD_PKG_CFG))) != ++ (BIT(PECI_CMD_RD_PKG_CFG))) { ++ return -ENODEV; ++ } ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ dev_set_drvdata(dev, priv); ++ priv->mgr = mgr; ++ priv->dev = dev; ++ priv->gen_info = mgr->gen_info; ++ ++ snprintf(priv->name, PECI_NAME_SIZE, "peci_cpupower.cpu%d", ++ mgr->client->addr - PECI_BASE_ADDR); ++ ++ priv->power_config[priv->config_idx++] = config_table[average_power]; ++ ++ priv->chip.ops = &cpupower_ops; ++ priv->chip.info = priv->info; ++ ++ priv->info[0] = &priv->power_info; ++ ++ priv->power_info.type = hwmon_power; ++ priv->power_info.config = priv->power_config; ++ ++ hwmon_dev = devm_hwmon_device_register_with_info(priv->dev, ++ priv->name, ++ priv, ++ &priv->chip, ++ NULL); ++ ++ if (IS_ERR(hwmon_dev)) ++ return PTR_ERR(hwmon_dev); ++ ++ dev_dbg(dev, "%s: sensor '%s'\n", dev_name(hwmon_dev), priv->name); ++ ++ return 0; ++} ++ ++static const struct platform_device_id peci_cpupower_ids[] = { ++ { .name = "peci-cpupower", .driver_data = 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(platform, peci_cpupower_ids); ++ ++static struct platform_driver peci_cpupower_driver = { ++ .probe = peci_cpupower_probe, ++ .id_table = peci_cpupower_ids, ++ .driver = { .name = KBUILD_MODNAME, }, ++}; ++module_platform_driver(peci_cpupower_driver); ++ ++MODULE_AUTHOR("Zhikui Ren "); ++MODULE_DESCRIPTION("PECI cpupower driver"); ++MODULE_LICENSE("GPL v2"); +diff --git a/drivers/mfd/intel-peci-client.c b/drivers/mfd/intel-peci-client.c +index 9751b04..0c62ad6 100644 +--- a/drivers/mfd/intel-peci-client.c ++++ b/drivers/mfd/intel-peci-client.c +@@ -21,6 +21,7 @@ + static struct mfd_cell peci_functions[] = { + { .name = "peci-cputemp", }, + { .name = "peci-dimmtemp", }, ++ { .name = "peci-cpupower", }, + }; + + static const struct cpu_gen_info cpu_gen_info_table[] = { +diff --git a/include/uapi/linux/peci-ioctl.h b/include/uapi/linux/peci-ioctl.h +index 843930f..d16f7c9 100644 +--- a/include/uapi/linux/peci-ioctl.h ++++ b/include/uapi/linux/peci-ioctl.h +@@ -231,6 +231,7 @@ struct peci_rd_pkg_cfg_msg { + #define PECI_PKG_ID_MAX_THREAD_ID 0x0003 /* Max Thread ID */ + #define PECI_PKG_ID_MICROCODE_REV 0x0004 /* CPU Microcode Update Revision */ + #define PECI_PKG_ID_MACHINE_CHECK_STATUS 0x0005 /* Machine Check Status */ ++#define PECI_PKG_ID_PKG_ENERGY_STATUS 0x00ff /* Average Energy */ + + __u8 rx_len; + __u8 cc; +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0092-SPI-Quad-IO-driver-support-AST2600.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0092-SPI-Quad-IO-driver-support-AST2600.patch new file mode 100644 index 000000000..dd756edbe --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0092-SPI-Quad-IO-driver-support-AST2600.patch @@ -0,0 +1,136 @@ +From 879834a305bd5c0cbf3c60f8fe235cea8783fe35 Mon Sep 17 00:00:00 2001 +From: arun-pm +Date: Tue, 3 Dec 2019 17:22:28 +0530 +Subject: [PATCH] SPI Quad IO driver support AST2600 + +This commit adds spi driver quad io support for AST2600 + +Note:- Removed n25q00 Quad I/O support for the time being due to clock issue + with chip 'Micron 8UA15 - rw182 (128MB)' while enabling Quad I/O mode. + +Signed-off-by: arun-pm +--- + drivers/mtd/spi-nor/aspeed-smc.c | 49 ++++++++++++++++++++++++++++++++++------ + drivers/mtd/spi-nor/spi-nor.c | 7 +++++- + 2 files changed, 48 insertions(+), 8 deletions(-) + +diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c +index 0805dcab8cb1..305c1940e822 100644 +--- a/drivers/mtd/spi-nor/aspeed-smc.c ++++ b/drivers/mtd/spi-nor/aspeed-smc.c +@@ -21,6 +21,11 @@ + #include + + #define DEVICE_NAME "aspeed-smc" ++#define AST2600A0 0x05000303 ++#define AST2600A0_MAX_FREQ 50000000 ++#define AST2600A0_SAFE_FREQ 40000000 ++#define AST_MAX_FREQ 100000000 ++#define AST2600_REVISION_ID_SCU 0x1e6e2004 + + /* + * The driver only support SPI flash +@@ -542,6 +547,10 @@ static int aspeed_smc_get_io_mode(struct aspeed_smc_chip *chip) + return CONTROL_IO_DUAL_DATA; + case SNOR_PROTO_1_2_2: + return CONTROL_IO_DUAL_ADDR_DATA; ++ case SNOR_PROTO_1_1_4: ++ return CONTROL_IO_QUAD_DATA; ++ case SNOR_PROTO_1_4_4: ++ return CONTROL_IO_QUAD_ADDR_DATA; + default: + dev_err(chip->nor.dev, "unsupported SPI read mode\n"); + return -EINVAL; +@@ -573,7 +582,7 @@ static ssize_t aspeed_smc_read_user(struct spi_nor *nor, loff_t from, + aspeed_smc_write_to_ahb(chip->ahb_base, &dummy, sizeof(dummy)); + + /* Set IO mode only for data */ +- if (io_mode == CONTROL_IO_DUAL_DATA) ++ if (io_mode == CONTROL_IO_DUAL_DATA || io_mode == CONTROL_IO_QUAD_DATA) + aspeed_smc_set_io_mode(chip, io_mode); + + aspeed_smc_read_from_ahb(read_buf, chip->ahb_base, len); +@@ -1222,20 +1231,35 @@ static int aspeed_smc_chip_setup_finish(struct aspeed_smc_chip *chip) + return 0; + } + ++static void aspeed_allowed_max_freq(struct aspeed_smc_chip *chip) ++{ ++ void __iomem *scu_ast_revision_id = ioremap(AST2600_REVISION_ID_SCU, 4); ++ u32 rev_id = readl(scu_ast_revision_id); ++ ++ /*Limit max spi frequency less than 50MHz on AST2600-A0 due ++ * to FWSPICLK signal quality issue. ++ */ ++ if(rev_id == AST2600A0 && chip->clk_rate >= AST2600A0_MAX_FREQ) ++ chip->clk_rate = AST2600A0_SAFE_FREQ; ++} ++ ++static u32 get_hwcaps(unsigned int tx_width){ ++ if(tx_width == 4) ++ return SNOR_HWCAPS_READ_1_1_4; ++ else ++ return SNOR_HWCAPS_READ_1_1_2; ++} ++ + static int aspeed_smc_setup_flash(struct aspeed_smc_controller *controller, + struct device_node *np, struct resource *r) + { +- const struct spi_nor_hwcaps hwcaps = { +- .mask = SNOR_HWCAPS_READ | +- SNOR_HWCAPS_READ_FAST | +- SNOR_HWCAPS_READ_1_1_2 | +- SNOR_HWCAPS_PP, +- }; ++ struct spi_nor_hwcaps hwcaps; + const struct aspeed_smc_info *info = controller->info; + struct device *dev = controller->dev; + struct device_node *child; + unsigned int cs; + int ret = -ENODEV; ++ unsigned int spi_tx_width; + + for_each_available_child_of_node(np, child) { + struct aspeed_smc_chip *chip; +@@ -1276,9 +1300,20 @@ static int aspeed_smc_setup_flash(struct aspeed_smc_controller *controller, + &chip->clk_rate)) { + chip->clk_rate = ASPEED_SPI_DEFAULT_FREQ; + } ++ aspeed_allowed_max_freq(chip); + dev_info(dev, "Using %d MHz SPI frequency\n", + chip->clk_rate / 1000000); + ++ if (of_property_read_u32(child, "spi-tx-bus-width", ++ &spi_tx_width)) { ++ spi_tx_width = 2; ++ } ++ dev_info(dev, "tx width: %ld\n", spi_tx_width); ++ ++ hwcaps.mask = SNOR_HWCAPS_READ | ++ SNOR_HWCAPS_READ_FAST | ++ get_hwcaps(spi_tx_width) | ++ SNOR_HWCAPS_PP; + chip->controller = controller; + chip->ctl = controller->regs + info->ctl0 + cs * 4; + chip->cs = cs; +diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c +index 19fe44b0965a..c69ef8b56700 100644 +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -2310,7 +2310,12 @@ static const struct flash_info spi_nor_ids[] = { + { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + { "n25q256ax1", INFO(0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, + { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, +- { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, ++ /* Removed n25q00 Quad I/O support for the time being due to clock issue with chip 'Micron 8UA15 - rw182 (128MB)' ++ * while enabling Quad I/O mode. As this chip is default shipped in platforms, marking it ++ * as Not supported for the time being. Once all chips are replaced with the new model, this can be enabled ++ * back(Note:- Certain other chips having same name(n25q00) but different part number has no issues). ++ */ ++ { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | NO_CHIP_ERASE) }, + { "n25q00a", INFO(0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, + { "mt25ql02g", INFO(0x20ba22, 0, 64 * 1024, 4096, + SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0093-ipmi-ipmb_dev_int-add-quick-fix-for-raw-I2C-type-reg.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0093-ipmi-ipmb_dev_int-add-quick-fix-for-raw-I2C-type-reg.patch new file mode 100644 index 000000000..4b3b6b838 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0093-ipmi-ipmb_dev_int-add-quick-fix-for-raw-I2C-type-reg.patch @@ -0,0 +1,37 @@ +From 8be7c34e78bd09fa95ce9972332c8c2bb950ec03 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Tue, 28 Jan 2020 16:14:07 -0800 +Subject: [PATCH] ipmi: ipmb_dev_int: add quick fix for raw I2C type + registration + +This commit adds quick fix for cases of run time registration +through sysfs. It should be fixed later by adding parsing code for +ipmb_id instead. + +This is a temporary fix. Do not upstream it. + +Signed-off-by: Jae Hyun Yoo +--- + drivers/char/ipmi/ipmb_dev_int.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c +index 382e4a1df510..c5db37266724 100644 +--- a/drivers/char/ipmi/ipmb_dev_int.c ++++ b/drivers/char/ipmi/ipmb_dev_int.c +@@ -328,8 +328,12 @@ static int ipmb_probe(struct i2c_client *client, + if (ret) + return ret; + ++#if 1 /* FIXME: Quick fix. Need to add parsing code for ipmb_id instead */ ++ ipmb_dev->is_i2c_protocol = true; ++#else + ipmb_dev->is_i2c_protocol + = device_property_read_bool(&client->dev, "i2c-protocol"); ++#endif + + ipmb_dev->client = client; + i2c_set_clientdata(client, ipmb_dev); +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0094-Return-link-speed-and-duplex-settings-for-the-NCSI-c.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0094-Return-link-speed-and-duplex-settings-for-the-NCSI-c.patch new file mode 100644 index 000000000..3e426edcd --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0094-Return-link-speed-and-duplex-settings-for-the-NCSI-c.patch @@ -0,0 +1,57 @@ +From f280c15c79e7d13e4a59d413a3091eb21b56dd92 Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey +Date: Mon, 27 Jan 2020 09:03:56 -0800 +Subject: [PATCH] Return link speed and duplex settings for the NCSI channel + +The ftgmac100_open function initializes state for the NCSI +channel. The get link settings function does not return this +data. This caused the link speed, and the duplex value to be returned +incorrectly by the PHY driver (0 Mbps, and duplex off). + +Update the driver to return either the PHY settings when not using +NCSI, or the NCSI values that were assigned when the driver is opened. + +Signed-off-by: Johnathan Mantey +--- + drivers/net/ethernet/faraday/ftgmac100.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c +index 8ed85037f021..a53878eecfc8 100644 +--- a/drivers/net/ethernet/faraday/ftgmac100.c ++++ b/drivers/net/ethernet/faraday/ftgmac100.c +@@ -1218,10 +1218,30 @@ static int ftgmac100_set_pauseparam(struct net_device *netdev, + return 0; + } + ++int ftgmac100_ethtool_get_link_ksettings(struct net_device *netdev, ++ struct ethtool_link_ksettings *cmd) ++{ ++ struct phy_device *phydev = netdev->phydev; ++ struct ftgmac100 *priv = netdev_priv(netdev); ++ int retval = 0; ++ ++ if (phydev) { ++ phy_ethtool_ksettings_get(phydev, cmd); ++ } else if (priv->use_ncsi) { ++ cmd->base.speed = priv->cur_speed; ++ cmd->base.duplex = priv->cur_duplex; ++ cmd->base.autoneg = 0; ++ } else { ++ retval = -ENODEV; ++ } ++ ++ return retval; ++} ++ + static const struct ethtool_ops ftgmac100_ethtool_ops = { + .get_drvinfo = ftgmac100_get_drvinfo, + .get_link = ethtool_op_get_link, +- .get_link_ksettings = phy_ethtool_get_link_ksettings, ++ .get_link_ksettings = ftgmac100_ethtool_get_link_ksettings, + .set_link_ksettings = phy_ethtool_set_link_ksettings, + .nway_reset = phy_ethtool_nway_reset, + .get_ringparam = ftgmac100_get_ringparam, +-- +2.24.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0096-Fix-truncated-WrEndPointConfig-MMIO-command.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0096-Fix-truncated-WrEndPointConfig-MMIO-command.patch new file mode 100644 index 000000000..e2196c629 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0096-Fix-truncated-WrEndPointConfig-MMIO-command.patch @@ -0,0 +1,40 @@ +From 7555448ab0676ea974ef67ef0c8ebe5d68b73d25 Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" +Date: Tue, 18 Feb 2020 14:17:22 -0800 +Subject: [PATCH] Fix truncated WrEndPointConfig MMIO command + +When address type is 6, the driver is reducing the msg buffer to +the base size and truncating the additional command data. + +This removes the line that sets the msg buffer size to the base +size. The correct buffer size is already set. + +Tested: +Ran this command: +peci_cmds WrEndpointConfigMMIO 6 0 0 0x7e 0x1a 0x0 0x224e0 0x5f5a56 + +and got the full buffer in the driver log: +[ 795.207278] peci_aspeed 1e78b000.peci-bus: HEAD : 0x00011730 +[ 795.212980] TX : c5 00 05 00 00 00 06 00 d0 7e e0 24 02 00 00 00 .........~.$.... +[ 795.220556] TX : 00 00 56 5a 5f 00 a8 ..VZ_.. + +Signed-off-by: Jason M. Bills +--- + drivers/peci/peci-core.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c +index 9aedb74..efb73b0 100644 +--- a/drivers/peci/peci-core.c ++++ b/drivers/peci/peci-core.c +@@ -1040,7 +1040,6 @@ static int peci_cmd_wr_end_pt_cfg(struct peci_adapter *adapter, void *vmsg) + >> 24); /* MSB - DWORD Register Offset */ + if (umsg->params.mmio.addr_type == + PECI_ENDPTCFG_ADDR_TYPE_MMIO_Q) { +- msg->tx_len = PECI_WRENDPTCFG_MMIO_Q_WRITE_LEN_BASE; + msg->tx_buf[14] = (u8)(umsg->params.mmio.offset + >> 32); /* Register Offset */ + msg->tx_buf[15] = (u8)(umsg->params.mmio.offset +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/debug.cfg b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/debug.cfg new file mode 100644 index 000000000..bbc7fa5b6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/debug.cfg @@ -0,0 +1,2 @@ +CONFIG_DEVMEM = y +CONFIG_DEVMEM_BOOTPARAM = n diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg index 714f40bfd..5f453510a 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg @@ -12,6 +12,7 @@ CONFIG_PECI_CHARDEV=y CONFIG_PECI_ASPEED=y CONFIG_SENSORS_PECI_CPUTEMP=y CONFIG_SENSORS_PECI_DIMMTEMP=y +CONFIG_SENSORS_PECI_CPUPOWER=y CONFIG_CONFIGFS_FS=y CONFIG_BLK_DEV_RAM_SIZE=49152 CONFIG_MAGIC_SYSRQ=y @@ -85,3 +86,4 @@ CONFIG_USB_DYNAMIC_MINORS=n CONFIG_USB_EHCI_HCD=n CONFIG_USB_EHCI_ROOT_HUB_TT=n CONFIG_USB_EHCI_HCD_PLATFORM=n +CONFIG_IPMB_DEVICE_INTERFACE=y diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend index 1898e95f0..b2a81beae 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -14,7 +14,6 @@ SRC_URI += " \ file://0003-Enable-GPIOE0-and-GPIOE2-pass-through-by-default.patch \ file://0006-Allow-monitoring-of-power-control-input-GPIOs.patch \ file://0007-aspeed-pwm-tacho-change-default-fan-speed.patch \ - file://0008-Report-link-statistics-for-the-NCSI-channel.patch \ file://0014-arm-dts-aspeed-g5-add-espi.patch \ file://0015-New-flash-map-for-intel.patch \ file://0016-Add-ASPEED-SGPIO-driver.patch \ @@ -53,15 +52,11 @@ SRC_URI += " \ file://0070-gpio-aspeed-temporary-fix-for-gpiochip-range-setting.patch \ file://0072-pmbus-add-fault-and-beep-attributes.patch \ file://0073-Add-IO-statistics-to-USB-Mass-storage-gadget.patch \ - file://0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch \ file://0075-Refine-initialization-flow-in-I2C-driver.patch \ - file://0076-media-aspeed-clear-garbage-interrupts.patch \ file://0076-arm-ast2600-add-pwm_tacho-driver-from-aspeed.patch \ file://0077-soc-aspeed-Add-read-only-property-support.patch \ file://0078-Fix-NCSI-driver-issue-caused-by-host-shutdown.patch \ file://0080-i2c-aspeed-filter-garbage-interrupts-out.patch \ - file://0082-ARM-dts-aspeed-g6-add-USB-virtual-hub-fixup.patch \ - file://0083-usb-gadget-aspeed-add-ast2600-compatible-string.patch \ file://0084-ARM-dts-aspeed-g6-add-GFX-node.patch \ file://0085-drm-add-AST2600-GFX-support.patch \ file://0086-ADC-linux-driver-for-AST2600.patch \ @@ -69,6 +64,12 @@ SRC_URI += " \ file://0087-media-aspeed-add-aspeed-ast2600-video-engine-compati.patch \ file://0088-clk-ast2600-enable-ESPICLK-always.patch \ file://0089-ast2600-enable-high-speed-uart-in-kernel.patch \ + file://0090-peci-cpupower-driver-1.patch \ + file://0092-SPI-Quad-IO-driver-support-AST2600.patch \ + file://0093-ipmi-ipmb_dev_int-add-quick-fix-for-raw-I2C-type-reg.patch \ + file://0094-Return-link-speed-and-duplex-settings-for-the-NCSI-c.patch \ + file://0096-Fix-truncated-WrEndPointConfig-MMIO-command.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://0005-128MB-flashmap-for-PFR.patch', '', d)}" +SRC_URI += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', 'file://debug.cfg', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0001-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0001-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch deleted file mode 100644 index 41541500f..000000000 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0001-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch +++ /dev/null @@ -1,657 +0,0 @@ -From c7050f4a1f87d49e8a619d5d8752d1c98bfed3e8 Mon Sep 17 00:00:00 2001 -From: Johnathan Mantey -Date: Wed, 3 Jul 2019 14:12:49 -0700 -Subject: [PATCH] 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. - -Tested: -Using dbus-send or busctl: -Disabled DHCP, and confirmed only link local addresses were present. - -Assigned only static addresses. Both with/and without the gateway set -to 0.0.0.0 - -Deleted static IPv4 addresses. -Reassigned static addresses. - -Enabled DHCP for ipv4 only, and witnessed a DHCP server assign a valid -address. It also correctly managed the routing table. - -Assigned static IPv4 address. -Assigned static IPv6 address. -Confirmed both IPv4 and IPv6 static addresses are active. - -Enabled DHCP for ipv6 only, and confirmed the static v4 address -remains. The ipv6 address is removed, waiting for a DHCP6 server. - -Enabled DHCP for both ipv4 and ipv6. IPv4 address was assigned. IPv6 -address is assumed to succeed, as systemd config file enables IPv6 -DHCP. - -Change-Id: I2e0ff80ac3a5e88bcff28adac419bf21e37be162 -Signed-off-by: Johnathan Mantey ---- - Makefile.am | 5 + - configure.ac | 1 + - ethernet_interface.cpp | 170 ++++++++++++++++++++++--------- - ethernet_interface.hpp | 31 +++++- - ipaddress.cpp | 2 +- - network_manager.cpp | 2 +- - test/test_ethernet_interface.cpp | 3 +- - test/test_vlan_interface.cpp | 3 +- - types.hpp | 3 + - util.cpp | 69 ++++++++++++- - util.hpp | 13 ++- - vlan_interface.cpp | 2 +- - vlan_interface.hpp | 4 +- - 13 files changed, 246 insertions(+), 62 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 79db184..2768e38 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -97,6 +97,11 @@ phosphor_network_manager_CXXFLAGS = \ - $(SDEVENTPLUS_CFLAGS) \ - $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \ - $(PHOSPHOR_LOGGING_CFLAGS) \ -+ -DBOOST_ERROR_CODE_HEADER_ONLY \ -+ -DBOOST_SYSTEM_NO_DEPRECATED \ -+ -DBOOST_COROUTINES_NO_DEPRECATION_WARNING \ -+ -DBOOST_ASIO_DISABLE_THREADS \ -+ -DBOOST_ALL_NO_LIB \ - -flto - - xyz/openbmc_project/Network/VLAN/Create/server.cpp: xyz/openbmc_project/Network/VLAN/Create.interface.yaml xyz/openbmc_project/Network/VLAN/Create/server.hpp -diff --git a/configure.ac b/configure.ac -index 8870fcd..00b23bc 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -36,6 +36,7 @@ AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) - PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) - PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) - PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0]) -+AC_CHECK_HEADER(boost/algorithm/string/split.hpp, [], [AC_MSG_ERROR([Could not find boost/algorithm/string/split.hpp])]) - - # Checks for header files. - AC_CHECK_HEADER(systemd/sd-bus.h, ,\ -diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp -index c3edd4b..537054f 100644 ---- a/ethernet_interface.cpp -+++ b/ethernet_interface.cpp -@@ -3,9 +3,9 @@ - #include "ethernet_interface.hpp" - - #include "config_parser.hpp" --#include "ipaddress.hpp" - #include "neighbor.hpp" - #include "network_manager.hpp" -+#include "util.hpp" - #include "vlan_interface.hpp" - - #include -@@ -40,9 +40,12 @@ using Argument = xyz::openbmc_project::Common::InvalidArgument; - static constexpr const char* networkChannelCfgFile = - "/var/channel_intf_data.json"; - static constexpr const char* defaultChannelPriv = "priv-admin"; -+std::map mapDHCPToSystemd = { -+ {"both", "true"}, {"v4", "ipv4"}, {"v6", "ipv6"}, {"none", "false"}}; -+ - EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, - const std::string& objPath, -- bool dhcpEnabled, Manager& parent, -+ DHCPConf dhcpEnabled, Manager& parent, - bool emitSignal) : - Ifaces(bus, objPath.c_str(), true), - bus(bus), manager(parent), objPath(objPath) -@@ -81,24 +84,78 @@ static IP::Protocol convertFamily(int family) - throw std::invalid_argument("Bad address family"); - } - -+void EthernetInterface::disableDHCP(IP::Protocol protocol) -+{ -+ DHCPConf dhcpState = EthernetInterfaceIntf::dHCPEnabled(); -+ if (dhcpState == EthernetInterface::DHCPConf::both) -+ { -+ if (protocol == IP::Protocol::IPv4) -+ { -+ dHCPEnabled(EthernetInterface::DHCPConf::v6); -+ } -+ else if (protocol == IP::Protocol::IPv6) -+ { -+ dHCPEnabled(EthernetInterface::DHCPConf::v4); -+ } -+ } -+ else if ((dhcpState == EthernetInterface::DHCPConf::v4) && -+ (protocol == IP::Protocol::IPv4)) -+ { -+ dHCPEnabled(EthernetInterface::DHCPConf::none); -+ } -+ else if ((dhcpState == EthernetInterface::DHCPConf::v6) && -+ (protocol == IP::Protocol::IPv6)) -+ { -+ dHCPEnabled(EthernetInterface::DHCPConf::none); -+ } -+} -+ -+bool EthernetInterface::dhcpIsEnabled(IP::Protocol family, bool ignoreProtocol) -+{ -+ return ((EthernetInterfaceIntf::dHCPEnabled() == -+ EthernetInterface::DHCPConf::both) || -+ ((EthernetInterfaceIntf::dHCPEnabled() == -+ EthernetInterface::DHCPConf::v6) && -+ ((family == IP::Protocol::IPv6) || ignoreProtocol)) || -+ ((EthernetInterfaceIntf::dHCPEnabled() == -+ EthernetInterface::DHCPConf::v4) && -+ ((family == IP::Protocol::IPv4) || ignoreProtocol))); -+} -+ -+bool EthernetInterface::dhcpToBeEnabled(IP::Protocol family, -+ std::string& nextDHCPState) -+{ -+ return ((nextDHCPState == "true") || -+ ((nextDHCPState == "ipv6") && (family == IP::Protocol::IPv6)) || -+ ((nextDHCPState == "ipv4") && (family == IP::Protocol::IPv4))); -+} -+ -+bool EthernetInterface::addressIsStatic(IP::AddressOrigin origin) -+{ -+ return ( -+#ifdef LINK_LOCAL_AUTOCONFIGURATION -+ (origin == IP::AddressOrigin::Static) -+#else -+ (origin == IP::AddressOrigin::Static || -+ origin == IP::AddressOrigin::LinkLocal) -+#endif -+ -+ ); -+} -+ - void EthernetInterface::createIPAddressObjects() - { - addrs.clear(); - - auto addrs = getInterfaceAddrs()[interfaceName()]; -+ if (getIPAddrOrigins(addrs)) -+ { -+ return; -+ } - - for (auto& addr : addrs) - { - IP::Protocol addressType = convertFamily(addr.addrType); -- IP::AddressOrigin origin = IP::AddressOrigin::Static; -- if (dHCPEnabled()) -- { -- origin = IP::AddressOrigin::DHCP; -- } -- if (isLinkLocalIP(addr.ipaddress)) -- { -- origin = IP::AddressOrigin::LinkLocal; -- } - // Obsolete parameter - std::string gateway = ""; - -@@ -108,7 +165,7 @@ void EthernetInterface::createIPAddressObjects() - this->addrs.emplace(addr.ipaddress, - std::make_shared( - bus, ipAddressObjectPath.c_str(), *this, -- addressType, addr.ipaddress, origin, -+ addressType, addr.ipaddress, addr.origin, - addr.prefix, gateway)); - } - } -@@ -152,11 +209,11 @@ ObjectPath EthernetInterface::iP(IP::Protocol protType, std::string ipaddress, - uint8_t prefixLength, std::string gateway) - { - -- if (dHCPEnabled()) -+ if (dhcpIsEnabled(protType)) - { - log("DHCP enabled on the interface"), - entry("INTERFACE=%s", interfaceName().c_str()); -- dHCPEnabled(false); -+ disableDHCP(protType); - } - - IP::AddressOrigin origin = IP::AddressOrigin::Static; -@@ -438,7 +495,7 @@ bool EthernetInterface::iPv6AcceptRA(bool value) - return value; - } - --bool EthernetInterface::dHCPEnabled(bool value) -+EthernetInterface::DHCPConf EthernetInterface::dHCPEnabled(DHCPConf value) - { - if (value == EthernetInterfaceIntf::dHCPEnabled()) - { -@@ -505,7 +562,7 @@ void EthernetInterface::loadVLAN(VlanId id) - std::string path = objPath; - path += "_" + std::to_string(id); - -- auto dhcpEnabled = -+ DHCPConf dhcpEnabled = - getDHCPValue(manager.getConfDir().string(), vlanInterfaceName); - - auto vlanIntf = std::make_unique( -@@ -527,7 +584,8 @@ ObjectPath EthernetInterface::createVLAN(VlanId id) - path += "_" + std::to_string(id); - - auto vlanIntf = std::make_unique( -- bus, path.c_str(), false, id, *this, manager); -+ bus, path.c_str(), EthernetInterface::DHCPConf::none, id, *this, -+ manager); - - // write the device file for the vlan interface. - vlanIntf->writeDeviceFile(); -@@ -600,8 +658,6 @@ void EthernetInterface::writeConfigurationFile() - // write all the static ip address in the systemd-network conf file - - using namespace std::string_literals; -- using AddressOrigin = -- sdbusplus::xyz::openbmc_project::Network::server::IP::AddressOrigin; - namespace fs = std::experimental::filesystem; - - // if there is vlan interafce then write the configuration file -@@ -670,41 +726,57 @@ void EthernetInterface::writeConfigurationFile() - } - - // Add the DHCP entry -- auto value = dHCPEnabled() ? "true"s : "false"s; -- stream << "DHCP="s + value + "\n"; -- -- // When the interface configured as dhcp, we don't need below given entries -- // in config file. -- if (dHCPEnabled() == false) -- { -- // Static -- for (const auto& addr : addrs) -+ std::string requestedDHCPState; -+ std::string::size_type loc; -+ std::string value = convertForMessage(EthernetInterfaceIntf::dHCPEnabled()); -+ loc = value.rfind("."); -+ requestedDHCPState = value.substr(loc + 1); -+ std::string mappedDHCPState = mapDHCPToSystemd[requestedDHCPState]; -+ stream << "DHCP="s + mappedDHCPState + "\n"; -+ -+ bool dhcpv6Requested = dhcpToBeEnabled(IP::Protocol::IPv6, mappedDHCPState); -+ bool dhcpv4Requested = dhcpToBeEnabled(IP::Protocol::IPv4, mappedDHCPState); -+ // Static IP addresses -+ for (const auto& addr : addrs) -+ { -+ bool isValidIPv4 = isValidIP(AF_INET, addr.second->address()); -+ bool isValidIPv6 = isValidIP(AF_INET6, addr.second->address()); -+ if (((!dhcpv4Requested && isValidIPv4) || -+ (!dhcpv6Requested && isValidIPv6)) && -+ addressIsStatic(addr.second->origin())) - { -- if (addr.second->origin() == AddressOrigin::Static --#ifndef LINK_LOCAL_AUTOCONFIGURATION -- || addr.second->origin() == AddressOrigin::LinkLocal --#endif -- ) -+ std::string address = addr.second->address() + "/" + -+ std::to_string(addr.second->prefixLength()); -+ -+ // build the address entries. Do not use [Network] shortcuts to -+ // insert address entries. -+ stream << "[Address]\n"; -+ stream << "Address=" << address << "\n"; -+ -+ // build the route section. Do not use [Network] shortcuts to apply -+ // default gateway values. -+ std::string gw = "0.0.0.0"; -+ if (addr.second->gateway() != "0.0.0.0" && -+ addr.second->gateway() != "") - { -- std::string address = -- addr.second->address() + "/" + -- std::to_string(addr.second->prefixLength()); -- -- stream << "Address=" << address << "\n"; -+ gw = addr.second->gateway(); - } -- } -- -- if (manager.getSystemConf()) -- { -- const auto& gateway = manager.getSystemConf()->defaultGateway(); -- if (!gateway.empty()) -+ else - { -- stream << "Gateway=" << gateway << "\n"; -+ if (isValidIPv4) -+ { -+ gw = manager.getSystemConf()->defaultGateway(); -+ } -+ else if (isValidIPv6) -+ { -+ gw = manager.getSystemConf()->defaultGateway6(); -+ } - } -- const auto& gateway6 = manager.getSystemConf()->defaultGateway6(); -- if (!gateway6.empty()) -+ -+ if (!gw.empty()) - { -- stream << "Gateway=" << gateway6 << "\n"; -+ stream << "[Route]\n"; -+ stream << "Gateway=" << gw << "\n"; - } - } - } -@@ -816,7 +888,7 @@ std::string EthernetInterface::mACAddress(std::string value) - - void EthernetInterface::deleteAll() - { -- if (EthernetInterfaceIntf::dHCPEnabled()) -+ if (dhcpIsEnabled(IP::Protocol::IPv4, true)) - { - log("DHCP enabled on the interface"), - entry("INTERFACE=%s", interfaceName().c_str()); -diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp -index 3e4cf12..a962751 100644 ---- a/ethernet_interface.hpp -+++ b/ethernet_interface.hpp -@@ -91,7 +91,7 @@ class EthernetInterface : public Ifaces - * send. - */ - EthernetInterface(sdbusplus::bus::bus& bus, const std::string& objPath, -- bool dhcpEnabled, Manager& parent, -+ DHCPConf dhcpEnabled, Manager& parent, - bool emitSignal = true); - - /** @brief Function to create ipaddress dbus object. -@@ -157,7 +157,34 @@ class EthernetInterface : public Ifaces - } - - /** Set value of DHCPEnabled */ -- bool dHCPEnabled(bool value) override; -+ DHCPConf dHCPEnabled(DHCPConf value) override; -+ -+ /** @brief Determines if DHCP is active for the IP::Protocol supplied. -+ * @param[in] protocol - Either IPv4 or IPv6 -+ * @param[in] ignoreProtocol - Allows IPv4 and IPv6 to be checked using a -+ * single call. -+ * @returns true/false value if DHCP is active for the input protocol -+ */ -+ bool dhcpIsEnabled(IP::Protocol protocol, bool ignoreProtocol = false); -+ -+ /** @brief Determines if DHCP will be active following next reconfig -+ * @param[in] protocol - Either IPv4 or IPv6 -+ * @param[in] nextDHCPState - The new DHCP mode to take affect -+ * @returns true/false value if DHCP is active for the input protocol -+ */ -+ bool dhcpToBeEnabled(IP::Protocol family, std::string& nextDHCPState); -+ -+ /** @brief Determines if the address is manually assigned -+ * @param[in] origin - The origin entry of the IP::Address -+ * @returns true/false value if the address is static -+ */ -+ bool addressIsStatic(IP::AddressOrigin origin); -+ -+ /** @brief Selectively disables DHCP -+ * @param[in] protocol - The IPv4 or IPv6 protocol to return to static -+ * addressing mode -+ */ -+ void disableDHCP(IP::Protocol protocol); - - /** @brief sets the MAC address. - * @param[in] value - MAC address which needs to be set on the system. -diff --git a/ipaddress.cpp b/ipaddress.cpp -index 10a22b2..5b2bf56 100644 ---- a/ipaddress.cpp -+++ b/ipaddress.cpp -@@ -57,7 +57,7 @@ IP::AddressOrigin IPAddress::origin(IP::AddressOrigin origin) - } - void IPAddress::delete_() - { -- if (origin() != IP::AddressOrigin::Static) -+ if (parent.dhcpIsEnabled(type())) - { - log("Tried to delete a non-static address"), - entry("ADDRESS=%s", address().c_str()), -diff --git a/network_manager.cpp b/network_manager.cpp -index 75f4e5f..f7e8a75 100644 ---- a/network_manager.cpp -+++ b/network_manager.cpp -@@ -248,7 +248,7 @@ void Manager::createInterfaces() - // normal ethernet interface - objPath /= interface; - -- auto dhcp = getDHCPValue(confDir, interface); -+ EthernetInterfaceIntf::DHCPConf dhcp = getDHCPValue(confDir, interface); - - auto intf = std::make_shared( - bus, objPath.string(), dhcp, *this); -diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp -index 30dee8a..87fd68d 100644 ---- a/test/test_ethernet_interface.cpp -+++ b/test/test_ethernet_interface.cpp -@@ -58,7 +58,8 @@ class TestEthernetInterface : public testing::Test - { - mock_clear(); - mock_addIF("test0", 1, mac); -- return {bus, "/xyz/openbmc_test/network/test0", false, manager}; -+ return {bus, "/xyz/openbmc_test/network/test0", -+ EthernetInterface::DHCPConf::none, manager}; - } - - int countIPObjects() -diff --git a/test/test_vlan_interface.cpp b/test/test_vlan_interface.cpp -index 1dffc7e..e49b43f 100644 ---- a/test/test_vlan_interface.cpp -+++ b/test/test_vlan_interface.cpp -@@ -50,7 +50,8 @@ class TestVlanInterface : public testing::Test - { - mock_clear(); - mock_addIF("test0", 1); -- return {bus, "/xyz/openbmc_test/network/test0", false, manager}; -+ return {bus, "/xyz/openbmc_test/network/test0", -+ EthernetInterface::DHCPConf::none, manager}; - } - - void setConfDir() -diff --git a/types.hpp b/types.hpp -index 123067a..c4409fe 100644 ---- a/types.hpp -+++ b/types.hpp -@@ -1,5 +1,7 @@ - #pragma once - -+#include "ipaddress.hpp" -+ - #include - #include - #include -@@ -50,6 +52,7 @@ struct AddrInfo - { - uint8_t addrType; - std::string ipaddress; -+ IP::AddressOrigin origin; - uint16_t prefix; - }; - -diff --git a/util.cpp b/util.cpp -index afbc229..2e5b164 100644 ---- a/util.cpp -+++ b/util.cpp -@@ -6,12 +6,17 @@ - #include - #include - #include -+#include - #include - - #include -+#include -+#include -+#include - #include - #include - #include -+#include - #include - #include - #include -@@ -26,6 +31,54 @@ namespace phosphor - namespace network - { - -+int getIPAddrOrigins(AddrList& addressList) -+{ -+ boost::process::ipstream inputStream; -+ boost::process::child ipaddr("ip -o addr", -+ boost::process::std_out > inputStream); -+ std::string ipaddrLine; -+ -+ while (inputStream && std::getline(inputStream, ipaddrLine) && -+ !ipaddrLine.empty()) -+ { -+ std::vector addressElements; -+ std::vector addrPrefixVec; -+ -+ boost::split(addressElements, ipaddrLine, boost::is_any_of(" "), -+ boost::token_compress_on); -+ boost::split(addrPrefixVec, addressElements[3], boost::is_any_of("/"), -+ boost::token_compress_on); -+ std::string& nic = addressElements[1]; -+ std::string& ipClass = addressElements[2]; // inet | inet6 -+ std::string& address = addrPrefixVec[0]; -+ if (nic != "lo") -+ { -+ for (auto it = addressList.begin(); it != addressList.end(); it++) -+ { -+ if (it->ipaddress == address) -+ { -+ bool isIPv6 = (ipClass == "inet6"); -+ int globalStrIdx = isIPv6 ? 5 : 7; -+ if (addressElements[globalStrIdx] == "global") -+ { -+ it->origin = (addressElements[8] == "dynamic") -+ ? IP::AddressOrigin::DHCP -+ : IP::AddressOrigin::Static; -+ } -+ else if (addressElements[globalStrIdx] == "link") -+ { -+ it->origin = isIPv6 ? IP::AddressOrigin::SLAAC -+ : IP::AddressOrigin::LinkLocal; -+ } -+ break; -+ } -+ } -+ } -+ } -+ ipaddr.wait(); -+ return 0; -+} -+ - namespace - { - -@@ -410,9 +463,11 @@ std::optional interfaceToUbootEthAddr(const char* intf) - return "eth" + std::to_string(idx) + "addr"; - } - --bool getDHCPValue(const std::string& confDir, const std::string& intf) -+EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir, -+ const std::string& intf) - { -- bool dhcp = false; -+ EthernetInterfaceIntf::DHCPConf dhcp = -+ EthernetInterfaceIntf::DHCPConf::none; - // Get the interface mode value from systemd conf - // using namespace std::string_literals; - fs::path confPath = confDir; -@@ -434,7 +489,15 @@ bool getDHCPValue(const std::string& confDir, const std::string& intf) - // There will be only single value for DHCP key. - if (values[0] == "true") - { -- dhcp = true; -+ dhcp = EthernetInterfaceIntf::DHCPConf::both; -+ } -+ else if (values[0] == "ipv4") -+ { -+ dhcp = EthernetInterfaceIntf::DHCPConf::v4; -+ } -+ else if (values[0] == "ipv6") -+ { -+ dhcp = EthernetInterfaceIntf::DHCPConf::v6; - } - return dhcp; - } -diff --git a/util.hpp b/util.hpp -index 251aa0d..b3f7bba 100644 ---- a/util.hpp -+++ b/util.hpp -@@ -13,12 +13,16 @@ - #include - #include - #include -+#include - - namespace phosphor - { - namespace network - { - -+using EthernetInterfaceIntf = -+ sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface; -+ - constexpr auto IPV4_MIN_PREFIX_LENGTH = 1; - constexpr auto IPV4_MAX_PREFIX_LENGTH = 32; - constexpr auto IPV6_MAX_PREFIX_LENGTH = 64; -@@ -156,7 +160,8 @@ std::optional interfaceToUbootEthAddr(const char* intf); - * @param[in] confDir - Network configuration directory. - * @param[in] intf - Interface name. - */ --bool getDHCPValue(const std::string& confDir, const std::string& intf); -+EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir, -+ const std::string& intf); - - namespace internal - { -@@ -183,6 +188,12 @@ void execute(const char* path, ArgTypes&&... tArgs) - internal::executeCommandinChildProcess(path, args); - } - -+/* @brief Retrieve the source (DHCP, Static, Local/Self assigned) for -+ * each IP address supplied -+ * @param[in] addressList - List of IP addresses active on one interface -+ */ -+int getIPAddrOrigins(AddrList& addressList); -+ - } // namespace network - - /** @brief Copies data from a buffer into a copyable type -diff --git a/vlan_interface.cpp b/vlan_interface.cpp -index 73de4e8..26282cb 100644 ---- a/vlan_interface.cpp -+++ b/vlan_interface.cpp -@@ -22,7 +22,7 @@ using namespace phosphor::logging; - using namespace sdbusplus::xyz::openbmc_project::Common::Error; - - VlanInterface::VlanInterface(sdbusplus::bus::bus& bus, -- const std::string& objPath, bool dhcpEnabled, -+ const std::string& objPath, DHCPConf dhcpEnabled, - uint32_t vlanID, EthernetInterface& intf, - Manager& parent) : - VlanIface(bus, objPath.c_str()), -diff --git a/vlan_interface.hpp b/vlan_interface.hpp -index a994d05..37ae7ee 100644 ---- a/vlan_interface.hpp -+++ b/vlan_interface.hpp -@@ -45,8 +45,8 @@ class VlanInterface : public VlanIface, - * @param[in] manager - network manager object. - */ - VlanInterface(sdbusplus::bus::bus& bus, const std::string& objPath, -- bool dhcpEnabled, uint32_t vlanID, EthernetInterface& intf, -- Manager& manager); -+ DHCPConf dhcpEnabled, uint32_t vlanID, -+ EthernetInterface& intf, Manager& manager); - - /** @brief Delete this d-bus object. - */ --- -2.21.0 - diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch new file mode 100644 index 000000000..b6cf8f77d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch @@ -0,0 +1,504 @@ +From 42f361622a9c029221c8a90f92104703166e48c2 Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey +Date: Thu, 30 Jan 2020 15:07:39 -0800 +Subject: [PATCH] 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. + +Tested: +Using dbus-send or busctl: +Disabled DHCP, and confirmed only link local addresses were present. + +Assigned only static addresses. Both with/and without the gateway set +to 0.0.0.0 + +Deleted static IPv4 addresses. +Reassigned static addresses. + +Enabled DHCP for ipv4 only, and witnessed a DHCP server assign a valid +address. + +Assigned static IPv4 address. +Assigned static IPv6 address. +Confirmed both IPv4 and IPv6 static addresses are active. + +Enabled DHCP for ipv6 only, and confirmed the static v4 address +remains. The ipv6 address is removed, waiting for a DHCP6 server. + +Enabled DHCP for both ipv4 and ipv6. IPv4 address was assigned. IPv6 +address is assumed to succeed, as systemd config file enables IPv6 +DHCP. + +Change-Id: I2e0ff80ac3a5e88bcff28adac419bf21e37be162 +Signed-off-by: Johnathan Mantey +--- + Makefile.am | 1 + + configure.ac | 1 + + ethernet_interface.cpp | 147 ++++++++++++++++++++++--------- + ethernet_interface.hpp | 31 ++++++- + test/test_ethernet_interface.cpp | 3 +- + test/test_vlan_interface.cpp | 3 +- + types.hpp | 3 + + util.cpp | 16 +++- + util.hpp | 7 +- + vlan_interface.cpp | 2 +- + vlan_interface.hpp | 4 +- + 11 files changed, 165 insertions(+), 53 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 1c47747..ff252fc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -97,6 +97,7 @@ phosphor_network_manager_CXXFLAGS = \ + $(SDEVENTPLUS_CFLAGS) \ + $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \ + $(PHOSPHOR_LOGGING_CFLAGS) \ ++ -DBOOST_ASIO_DISABLE_THREADS \ + -flto + if FEATURE_NIC_ETHTOOL + phosphor_network_manager_CXXFLAGS += -DNIC_SUPPORTS_ETHTOOL +diff --git a/configure.ac b/configure.ac +index 12d6caa..fed3e09 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -36,6 +36,7 @@ AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) + PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) + PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) + PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0]) ++AC_CHECK_HEADER(boost/algorithm/string/split.hpp, [], [AC_MSG_ERROR([Could not find boost/algorithm/string/split.hpp])]) + + # Checks for header files. + AC_CHECK_HEADER(systemd/sd-bus.h, ,\ +diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp +index 73fd8fe..ba6195e 100644 +--- a/ethernet_interface.cpp ++++ b/ethernet_interface.cpp +@@ -3,7 +3,6 @@ + #include "ethernet_interface.hpp" + + #include "config_parser.hpp" +-#include "ipaddress.hpp" + #include "neighbor.hpp" + #include "network_manager.hpp" + #include "vlan_interface.hpp" +@@ -40,9 +39,12 @@ using Argument = xyz::openbmc_project::Common::InvalidArgument; + static constexpr const char* networkChannelCfgFile = + "/var/channel_intf_data.json"; + static constexpr const char* defaultChannelPriv = "priv-admin"; ++std::map mapDHCPToSystemd = { ++ {"both", "true"}, {"v4", "ipv4"}, {"v6", "ipv6"}, {"none", "false"}}; ++ + EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, + const std::string& objPath, +- bool dhcpEnabled, Manager& parent, ++ DHCPConf dhcpEnabled, Manager& parent, + bool emitSignal) : + Ifaces(bus, objPath.c_str(), true), + bus(bus), manager(parent), objPath(objPath) +@@ -83,6 +85,65 @@ static IP::Protocol convertFamily(int family) + throw std::invalid_argument("Bad address family"); + } + ++void EthernetInterface::disableDHCP(IP::Protocol protocol) ++{ ++ DHCPConf dhcpState = EthernetInterfaceIntf::dHCPEnabled(); ++ if (dhcpState == EthernetInterface::DHCPConf::both) ++ { ++ if (protocol == IP::Protocol::IPv4) ++ { ++ dHCPEnabled(EthernetInterface::DHCPConf::v6); ++ } ++ else if (protocol == IP::Protocol::IPv6) ++ { ++ dHCPEnabled(EthernetInterface::DHCPConf::v4); ++ } ++ } ++ else if ((dhcpState == EthernetInterface::DHCPConf::v4) && ++ (protocol == IP::Protocol::IPv4)) ++ { ++ dHCPEnabled(EthernetInterface::DHCPConf::none); ++ } ++ else if ((dhcpState == EthernetInterface::DHCPConf::v6) && ++ (protocol == IP::Protocol::IPv6)) ++ { ++ dHCPEnabled(EthernetInterface::DHCPConf::none); ++ } ++} ++ ++bool EthernetInterface::dhcpIsEnabled(IP::Protocol family, bool ignoreProtocol) ++{ ++ return ((EthernetInterfaceIntf::dHCPEnabled() == ++ EthernetInterface::DHCPConf::both) || ++ ((EthernetInterfaceIntf::dHCPEnabled() == ++ EthernetInterface::DHCPConf::v6) && ++ ((family == IP::Protocol::IPv6) || ignoreProtocol)) || ++ ((EthernetInterfaceIntf::dHCPEnabled() == ++ EthernetInterface::DHCPConf::v4) && ++ ((family == IP::Protocol::IPv4) || ignoreProtocol))); ++} ++ ++bool EthernetInterface::dhcpToBeEnabled(IP::Protocol family, ++ std::string& nextDHCPState) ++{ ++ return ((nextDHCPState == "true") || ++ ((nextDHCPState == "ipv6") && (family == IP::Protocol::IPv6)) || ++ ((nextDHCPState == "ipv4") && (family == IP::Protocol::IPv4))); ++} ++ ++bool EthernetInterface::addressIsStatic(IP::AddressOrigin origin) ++{ ++ return ( ++#ifdef LINK_LOCAL_AUTOCONFIGURATION ++ (origin == IP::AddressOrigin::Static) ++#else ++ (origin == IP::AddressOrigin::Static || ++ origin == IP::AddressOrigin::LinkLocal) ++#endif ++ ++ ); ++} ++ + void EthernetInterface::createIPAddressObjects() + { + addrs.clear(); +@@ -93,7 +154,7 @@ void EthernetInterface::createIPAddressObjects() + { + IP::Protocol addressType = convertFamily(addr.addrType); + IP::AddressOrigin origin = IP::AddressOrigin::Static; +- if (dHCPEnabled()) ++ if (dhcpIsEnabled(addressType)) + { + origin = IP::AddressOrigin::DHCP; + } +@@ -154,11 +215,11 @@ ObjectPath EthernetInterface::iP(IP::Protocol protType, std::string ipaddress, + uint8_t prefixLength, std::string gateway) + { + +- if (dHCPEnabled()) ++ if (dhcpIsEnabled(protType)) + { + log("DHCP enabled on the interface"), + entry("INTERFACE=%s", interfaceName().c_str()); +- dHCPEnabled(false); ++ disableDHCP(protType); + } + + IP::AddressOrigin origin = IP::AddressOrigin::Static; +@@ -441,7 +502,7 @@ bool EthernetInterface::iPv6AcceptRA(bool value) + return value; + } + +-bool EthernetInterface::dHCPEnabled(bool value) ++EthernetInterface::DHCPConf EthernetInterface::dHCPEnabled(DHCPConf value) + { + if (value == EthernetInterfaceIntf::dHCPEnabled()) + { +@@ -508,7 +569,7 @@ void EthernetInterface::loadVLAN(VlanId id) + std::string path = objPath; + path += "_" + std::to_string(id); + +- auto dhcpEnabled = ++ DHCPConf dhcpEnabled = + getDHCPValue(manager.getConfDir().string(), vlanInterfaceName); + + auto vlanIntf = std::make_unique( +@@ -530,7 +591,8 @@ ObjectPath EthernetInterface::createVLAN(VlanId id) + path += "_" + std::to_string(id); + + auto vlanIntf = std::make_unique( +- bus, path.c_str(), false, id, *this, manager); ++ bus, path.c_str(), EthernetInterface::DHCPConf::none, id, *this, ++ manager); + + // write the device file for the vlan interface. + vlanIntf->writeDeviceFile(); +@@ -603,8 +665,6 @@ void EthernetInterface::writeConfigurationFile() + // write all the static ip address in the systemd-network conf file + + using namespace std::string_literals; +- using AddressOrigin = +- sdbusplus::xyz::openbmc_project::Network::server::IP::AddressOrigin; + namespace fs = std::experimental::filesystem; + + // if there is vlan interafce then write the configuration file +@@ -673,42 +733,45 @@ void EthernetInterface::writeConfigurationFile() + } + + // Add the DHCP entry +- auto value = dHCPEnabled() ? "true"s : "false"s; +- stream << "DHCP="s + value + "\n"; ++ std::string value = convertForMessage(EthernetInterfaceIntf::dHCPEnabled()); ++ std::string::size_type loc = value.rfind("."); ++ std::string requestedDHCPState = value.substr(loc + 1); ++ std::string mappedDHCPState = mapDHCPToSystemd[requestedDHCPState]; ++ stream << "DHCP="s + mappedDHCPState + "\n"; ++ ++ bool dhcpv6Requested = dhcpToBeEnabled(IP::Protocol::IPv6, mappedDHCPState); ++ bool dhcpv4Requested = dhcpToBeEnabled(IP::Protocol::IPv4, mappedDHCPState); ++ // Static IP addresses ++ for (const auto& addr : addrs) ++ { ++ bool isValidIPv4 = isValidIP(AF_INET, addr.second->address()); ++ bool isValidIPv6 = isValidIP(AF_INET6, addr.second->address()); ++ if (((!dhcpv4Requested && isValidIPv4) || ++ (!dhcpv6Requested && isValidIPv6)) && ++ addressIsStatic(addr.second->origin())) ++ { ++ // Process all static addresses ++ std::string address = addr.second->address() + "/" + ++ std::to_string(addr.second->prefixLength()); ++ ++ // build the address entries. Do not use [Network] shortcuts to ++ // insert address entries. ++ stream << "[Address]\n"; ++ stream << "Address=" << address << "\n"; ++ } ++ } + +- // When the interface configured as dhcp, we don't need below given entries +- // in config file. +- if (dHCPEnabled() == false) ++ if (manager.getSystemConf()) + { +- // Static +- for (const auto& addr : addrs) ++ const auto& gateway = manager.getSystemConf()->defaultGateway(); ++ if (!gateway.empty()) + { +- if (addr.second->origin() == AddressOrigin::Static +-#ifndef LINK_LOCAL_AUTOCONFIGURATION +- || addr.second->origin() == AddressOrigin::LinkLocal +-#endif +- ) +- { +- std::string address = +- addr.second->address() + "/" + +- std::to_string(addr.second->prefixLength()); +- +- stream << "Address=" << address << "\n"; +- } ++ stream << "Gateway=" << gateway << "\n"; + } +- +- if (manager.getSystemConf()) ++ const auto& gateway6 = manager.getSystemConf()->defaultGateway6(); ++ if (!gateway6.empty()) + { +- const auto& gateway = manager.getSystemConf()->defaultGateway(); +- if (!gateway.empty()) +- { +- stream << "Gateway=" << gateway << "\n"; +- } +- const auto& gateway6 = manager.getSystemConf()->defaultGateway6(); +- if (!gateway6.empty()) +- { +- stream << "Gateway=" << gateway6 << "\n"; +- } ++ stream << "Gateway=" << gateway6 << "\n"; + } + } + +@@ -819,7 +882,7 @@ std::string EthernetInterface::mACAddress(std::string value) + + void EthernetInterface::deleteAll() + { +- if (EthernetInterfaceIntf::dHCPEnabled()) ++ if (dhcpIsEnabled(IP::Protocol::IPv4, true)) + { + log("DHCP enabled on the interface"), + entry("INTERFACE=%s", interfaceName().c_str()); +diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp +index 3e4cf12..a962751 100644 +--- a/ethernet_interface.hpp ++++ b/ethernet_interface.hpp +@@ -91,7 +91,7 @@ class EthernetInterface : public Ifaces + * send. + */ + EthernetInterface(sdbusplus::bus::bus& bus, const std::string& objPath, +- bool dhcpEnabled, Manager& parent, ++ DHCPConf dhcpEnabled, Manager& parent, + bool emitSignal = true); + + /** @brief Function to create ipaddress dbus object. +@@ -157,7 +157,34 @@ class EthernetInterface : public Ifaces + } + + /** Set value of DHCPEnabled */ +- bool dHCPEnabled(bool value) override; ++ DHCPConf dHCPEnabled(DHCPConf value) override; ++ ++ /** @brief Determines if DHCP is active for the IP::Protocol supplied. ++ * @param[in] protocol - Either IPv4 or IPv6 ++ * @param[in] ignoreProtocol - Allows IPv4 and IPv6 to be checked using a ++ * single call. ++ * @returns true/false value if DHCP is active for the input protocol ++ */ ++ bool dhcpIsEnabled(IP::Protocol protocol, bool ignoreProtocol = false); ++ ++ /** @brief Determines if DHCP will be active following next reconfig ++ * @param[in] protocol - Either IPv4 or IPv6 ++ * @param[in] nextDHCPState - The new DHCP mode to take affect ++ * @returns true/false value if DHCP is active for the input protocol ++ */ ++ bool dhcpToBeEnabled(IP::Protocol family, std::string& nextDHCPState); ++ ++ /** @brief Determines if the address is manually assigned ++ * @param[in] origin - The origin entry of the IP::Address ++ * @returns true/false value if the address is static ++ */ ++ bool addressIsStatic(IP::AddressOrigin origin); ++ ++ /** @brief Selectively disables DHCP ++ * @param[in] protocol - The IPv4 or IPv6 protocol to return to static ++ * addressing mode ++ */ ++ void disableDHCP(IP::Protocol protocol); + + /** @brief sets the MAC address. + * @param[in] value - MAC address which needs to be set on the system. +diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp +index 30dee8a..87fd68d 100644 +--- a/test/test_ethernet_interface.cpp ++++ b/test/test_ethernet_interface.cpp +@@ -58,7 +58,8 @@ class TestEthernetInterface : public testing::Test + { + mock_clear(); + mock_addIF("test0", 1, mac); +- return {bus, "/xyz/openbmc_test/network/test0", false, manager}; ++ return {bus, "/xyz/openbmc_test/network/test0", ++ EthernetInterface::DHCPConf::none, manager}; + } + + int countIPObjects() +diff --git a/test/test_vlan_interface.cpp b/test/test_vlan_interface.cpp +index 1dffc7e..e49b43f 100644 +--- a/test/test_vlan_interface.cpp ++++ b/test/test_vlan_interface.cpp +@@ -50,7 +50,8 @@ class TestVlanInterface : public testing::Test + { + mock_clear(); + mock_addIF("test0", 1); +- return {bus, "/xyz/openbmc_test/network/test0", false, manager}; ++ return {bus, "/xyz/openbmc_test/network/test0", ++ EthernetInterface::DHCPConf::none, manager}; + } + + void setConfDir() +diff --git a/types.hpp b/types.hpp +index 123067a..c4409fe 100644 +--- a/types.hpp ++++ b/types.hpp +@@ -1,5 +1,7 @@ + #pragma once + ++#include "ipaddress.hpp" ++ + #include + #include + #include +@@ -50,6 +52,7 @@ struct AddrInfo + { + uint8_t addrType; + std::string ipaddress; ++ IP::AddressOrigin origin; + uint16_t prefix; + }; + +diff --git a/util.cpp b/util.cpp +index 13a607f..554d7f6 100644 +--- a/util.cpp ++++ b/util.cpp +@@ -410,9 +410,11 @@ std::optional interfaceToUbootEthAddr(const char* intf) + return "eth" + std::to_string(idx) + "addr"; + } + +-bool getDHCPValue(const std::string& confDir, const std::string& intf) ++EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir, ++ const std::string& intf) + { +- bool dhcp = false; ++ EthernetInterfaceIntf::DHCPConf dhcp = ++ EthernetInterfaceIntf::DHCPConf::none; + // Get the interface mode value from systemd conf + // using namespace std::string_literals; + fs::path confPath = confDir; +@@ -434,7 +436,15 @@ bool getDHCPValue(const std::string& confDir, const std::string& intf) + // There will be only single value for DHCP key. + if (values[0] == "true") + { +- dhcp = true; ++ dhcp = EthernetInterfaceIntf::DHCPConf::both; ++ } ++ else if (values[0] == "ipv4") ++ { ++ dhcp = EthernetInterfaceIntf::DHCPConf::v4; ++ } ++ else if (values[0] == "ipv6") ++ { ++ dhcp = EthernetInterfaceIntf::DHCPConf::v6; + } + return dhcp; + } +diff --git a/util.hpp b/util.hpp +index 251aa0d..ee11f4e 100644 +--- a/util.hpp ++++ b/util.hpp +@@ -13,12 +13,16 @@ + #include + #include + #include ++#include + + namespace phosphor + { + namespace network + { + ++using EthernetInterfaceIntf = ++ sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface; ++ + constexpr auto IPV4_MIN_PREFIX_LENGTH = 1; + constexpr auto IPV4_MAX_PREFIX_LENGTH = 32; + constexpr auto IPV6_MAX_PREFIX_LENGTH = 64; +@@ -156,7 +160,8 @@ std::optional interfaceToUbootEthAddr(const char* intf); + * @param[in] confDir - Network configuration directory. + * @param[in] intf - Interface name. + */ +-bool getDHCPValue(const std::string& confDir, const std::string& intf); ++EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir, ++ const std::string& intf); + + namespace internal + { +diff --git a/vlan_interface.cpp b/vlan_interface.cpp +index 73de4e8..26282cb 100644 +--- a/vlan_interface.cpp ++++ b/vlan_interface.cpp +@@ -22,7 +22,7 @@ using namespace phosphor::logging; + using namespace sdbusplus::xyz::openbmc_project::Common::Error; + + VlanInterface::VlanInterface(sdbusplus::bus::bus& bus, +- const std::string& objPath, bool dhcpEnabled, ++ const std::string& objPath, DHCPConf dhcpEnabled, + uint32_t vlanID, EthernetInterface& intf, + Manager& parent) : + VlanIface(bus, objPath.c_str()), +diff --git a/vlan_interface.hpp b/vlan_interface.hpp +index a994d05..37ae7ee 100644 +--- a/vlan_interface.hpp ++++ b/vlan_interface.hpp +@@ -45,8 +45,8 @@ class VlanInterface : public VlanIface, + * @param[in] manager - network manager object. + */ + VlanInterface(sdbusplus::bus::bus& bus, const std::string& objPath, +- bool dhcpEnabled, uint32_t vlanID, EthernetInterface& intf, +- Manager& manager); ++ DHCPConf dhcpEnabled, uint32_t vlanID, ++ EthernetInterface& intf, Manager& manager); + + /** @brief Delete this d-bus object. + */ +-- +2.24.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch new file mode 100644 index 000000000..c05088990 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch @@ -0,0 +1,120 @@ +From 6d3d50c506e2d6b4982ff6040af9fd61edaa8beb Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey +Date: Fri, 24 Jan 2020 13:30:39 -0800 +Subject: [PATCH] Enable conditional use of ETHTOOL features in the NIC driver + +The retrieval of the NIC speed, duplex, and autonegotiation +capabilities using the ETHTOOL driver extensions is not supported in +every NIC. + +Depending on the driver, the use of the ETHTOOL_GSET command may +result in undesirable messages being printed by the kernel. In order +to avoid these kernel messages a compile time switch is added. By +default the switch disables the use of the ETHTOOL features. Enable +the ETHTOOL feature by adding: + EXTRA_OECONF_append = " --enable-nic-ethtool=yes" +to the phosphor-network bbappend file. + +Tested: +Compiled the source without changing the bbappend file. The code +compiled as is, and after code was added that would cause a compile +time failure. +Loaded the code, and performed a Redfish read of the NIC. The +SpeedMbps field was confirmed to be set to 0. + +Enabled compiling the code by adding the EXTRA_OECONF entry to the +bbappend file. The code compiled as is, and failed to compile after +adding invalid code to the protected blocks. +Loaded the code, and performed a Redfish read of the NIC. The +SpeedMbps reported the correct link speed. + +Change-Id: If03e7d473d439ebb4a01b5d3f45e37ede2a5a84f +Signed-off-by: Johnathan Mantey +--- + Makefile.am | 3 +++ + configure.ac | 10 ++++++++++ + ethernet_interface.cpp | 13 ++++++++----- + 3 files changed, 21 insertions(+), 5 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 2a54797..ff252fc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -99,6 +99,9 @@ phosphor_network_manager_CXXFLAGS = \ + $(PHOSPHOR_LOGGING_CFLAGS) \ + -DBOOST_ASIO_DISABLE_THREADS \ + -flto ++if FEATURE_NIC_ETHTOOL ++phosphor_network_manager_CXXFLAGS += -DNIC_SUPPORTS_ETHTOOL ++endif + + xyz/openbmc_project/Network/VLAN/Create/server.cpp: xyz/openbmc_project/Network/VLAN/Create.interface.yaml xyz/openbmc_project/Network/VLAN/Create/server.hpp + @mkdir -p `dirname $@` +diff --git a/configure.ac b/configure.ac +index 00b23bc..fed3e09 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -114,6 +114,16 @@ AC_SUBST(DEFAULT_BUSNAME, ["$DEFAULT_BUSNAME"]) + AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service") + AS_IF([test "x$SYSTEMD_TARGET" == "x"], [SYSTEMD_TARGET="multi-user.target"]) + ++AC_ARG_ENABLE([nic_ethtool], ++ [ --enable-nic-ethtool Enable/disable the use of ETHTOOL features in the NIC driver], ++ [case "${enableval}" in ++ yes) nic_ethtool=true ;; ++ no) nic_ethtool=false ;; ++ *) AC_MSG_ERROR([bad value ${nic_ethtool} for --enable-nic-ethtool]) ;; ++ esac],[nic_ethtool=false] ++ ) ++AM_CONDITIONAL([FEATURE_NIC_ETHTOOL], [test x$nic_ethtool = xtrue]) ++ + # Create configured output. + AC_CONFIG_FILES([Makefile test/Makefile]) + AC_CONFIG_FILES([xyz.openbmc_project.Network.service]) +diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp +index 7f81003..ba6195e 100644 +--- a/ethernet_interface.cpp ++++ b/ethernet_interface.cpp +@@ -57,10 +57,12 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, + MacAddressIntf::mACAddress(getMACAddress(intfName)); + EthernetInterfaceIntf::nTPServers(getNTPServersFromConf()); + EthernetInterfaceIntf::nameservers(getNameServerFromConf()); ++#if NIC_SUPPORTS_ETHTOOL + InterfaceInfo ifInfo = EthernetInterface::getInterfaceInfo(); + + EthernetInterfaceIntf::autoNeg(std::get<2>(ifInfo)); + EthernetInterfaceIntf::speed(std::get<0>(ifInfo)); ++#endif + getChannelPrivilege(intfName); + + // Emit deferred signal. +@@ -283,13 +285,13 @@ ObjectPath EthernetInterface::neighbor(std::string iPAddress, + return objectPath; + } + ++#if NIC_SUPPORTS_ETHTOOL + /* +-Note: We don't have support for ethtool now +-will enable this code once we bring the ethtool +-in the image. +-TODO: https://github.com/openbmc/openbmc/issues/1484 ++ Enable this code if your NIC driver supports the ETHTOOL features. ++ Do this by adding the following to your phosphor-network*.bbappend file. ++ EXTRA_OECONF_append = " --enable-nic-ethtool=yes" ++ The default compile mode is to omit getInterfaceInfo() + */ +- + InterfaceInfo EthernetInterface::getInterfaceInfo() const + { + int sock{-1}; +@@ -330,6 +332,7 @@ InterfaceInfo EthernetInterface::getInterfaceInfo() const + } + return std::make_tuple(speed, duplex, autoneg); + } ++#endif + + /** @brief get the mac address of the interface. + * @return macaddress on success +-- +2.24.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0008-Added-enable-disable-control-of-the-Network-Interfac.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0008-Added-enable-disable-control-of-the-Network-Interfac.patch new file mode 100644 index 000000000..e1972e815 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0008-Added-enable-disable-control-of-the-Network-Interfac.patch @@ -0,0 +1,191 @@ +From 0e415f23b7a97e9a0f0fa616b6bcccec6035bbed Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey +Date: Tue, 29 Oct 2019 16:20:28 -0700 +Subject: [PATCH] Added enable/disable control of the Network Interface Card + +Implemented enable/disable function to perform +"ip link set eth(x) up" +"ip link set eth(x) down" +functionality from DBus. + +Tested: + +Confirmed Redfish PATCH commands on the InterfaceEnabled property +changes the NIC state. Confirmed the NIC is DOWN/UP using "ip link". +Confirmed "ip link" state changes can be obsserved from dbus-send +commands, and from Redfish GET actions. + +Confirmed the link is inactive after a reboot. + +Confirmed link stays down despite assigning an IP manually. + +Confirmed link stays down despite enabling DHCP. + +Change-Id: I4152b53055e6546f7a6ca81b5a5eef6f689bcc66 +Signed-off-by: Johnathan Mantey +--- + ethernet_interface.cpp | 70 ++++++++++++++++++++++++++++++++++++++++-- + ethernet_interface.hpp | 7 ++++- + 2 files changed, 74 insertions(+), 3 deletions(-) + +diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp +index ba6195e..671e8c4 100644 +--- a/ethernet_interface.cpp ++++ b/ethernet_interface.cpp +@@ -60,6 +60,7 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, + #if NIC_SUPPORTS_ETHTOOL + InterfaceInfo ifInfo = EthernetInterface::getInterfaceInfo(); + ++ EthernetInterfaceIntf::nICEnabled(std::get<3>(ifInfo)); + EthernetInterfaceIntf::autoNeg(std::get<2>(ifInfo)); + EthernetInterfaceIntf::speed(std::get<0>(ifInfo)); + #endif +@@ -300,6 +301,7 @@ InterfaceInfo EthernetInterface::getInterfaceInfo() const + LinkSpeed speed{0}; + Autoneg autoneg{0}; + DuplexMode duplex{0}; ++ NICEnabled nicEnabled{false}; + do + { + sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); +@@ -324,13 +326,21 @@ InterfaceInfo EthernetInterface::getInterfaceInfo() const + speed = edata.speed; + duplex = edata.duplex; + autoneg = edata.autoneg; ++ ++ if (ioctl(sock, SIOCGIFFLAGS, &ifr) < 0) ++ { ++ log("ioctl failed for SIOCGIFFLAGS:", ++ entry("ERROR=%s", strerror(errno))); ++ break; ++ } ++ nicEnabled = static_cast(ifr.ifr_flags & IFF_UP); + } while (0); + +- if (sock) ++ if (sock >= 0) + { + close(sock); + } +- return std::make_tuple(speed, duplex, autoneg); ++ return std::make_tuple(speed, duplex, autoneg, nicEnabled); + } + #endif + +@@ -355,9 +365,11 @@ std::string + { + log("ioctl failed for SIOCGIFHWADDR:", + entry("ERROR=%s", strerror(errno))); ++ close(sock); + elog(); + } + ++ close(sock); + static_assert(sizeof(ifr.ifr_hwaddr.sa_data) >= sizeof(ether_addr)); + std::string_view hwaddr(reinterpret_cast(ifr.ifr_hwaddr.sa_data), + sizeof(ifr.ifr_hwaddr.sa_data)); +@@ -514,6 +526,55 @@ EthernetInterface::DHCPConf EthernetInterface::dHCPEnabled(DHCPConf value) + return value; + } + ++bool EthernetInterface::nICEnabled(bool value) ++{ ++ if (value == EthernetInterfaceIntf::nICEnabled()) ++ { ++ return value; ++ } ++ ++ int sock{-1}; ++ ifreq ifr{0}; ++ EthernetInterfaceIntf::nICEnabled(value); ++ sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); ++ if (sock < 0) ++ { ++ log("socket creation failed:", ++ entry("ERROR=%s", strerror(errno))); ++ return value; ++ } ++ ++ do ++ { ++ std::strncpy(ifr.ifr_name, interfaceName().c_str(), IF_NAMESIZE); ++ if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) ++ { ++ log("ioctl failed for SIOCGIFFLAGS:", ++ entry("ERROR=%s", strerror(errno))); ++ break; ++ } ++ ++ ifr.ifr_flags &= ~IFF_UP; ++ if (value) ++ { ++ ifr.ifr_flags |= IFF_UP; ++ } ++ ++ if (ioctl(sock, SIOCSIFFLAGS, &ifr) != 0) ++ { ++ log("ioctl failed for SIOCSIFFLAGS:", ++ entry("ERROR=%s", strerror(errno))); ++ break; ++ } ++ } while (0); ++ ++ close(sock); ++ writeConfigurationFile(); ++ manager.restartSystemdUnit(networkdService); ++ ++ return value; ++} ++ + ServerList EthernetInterface::nameservers(ServerList value) + { + for (const auto& nameserverip : value) +@@ -704,6 +765,11 @@ void EthernetInterface::writeConfigurationFile() + stream << "MACAddress=" << mac << "\n"; + } + ++ if (!nICEnabled()) ++ { ++ stream << "Unmanaged=yes\n"; ++ } ++ + // write the network section + stream << "[Network]\n"; + #ifdef LINK_LOCAL_AUTOCONFIGURATION +diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp +index a962751..3dee311 100644 +--- a/ethernet_interface.hpp ++++ b/ethernet_interface.hpp +@@ -59,9 +59,10 @@ class Neighbor; + using LinkSpeed = uint16_t; + using DuplexMode = uint8_t; + using Autoneg = uint8_t; ++using NICEnabled = bool; + using VlanId = uint32_t; + using InterfaceName = std::string; +-using InterfaceInfo = std::tuple; ++using InterfaceInfo = std::tuple; + using AddressMap = std::map>; + using NeighborMap = std::map>; + using VlanInterfaceMap = +@@ -186,6 +187,9 @@ class EthernetInterface : public Ifaces + */ + void disableDHCP(IP::Protocol protocol); + ++ /** Set value of NICEnabled */ ++ bool nICEnabled(bool value) override; ++ + /** @brief sets the MAC address. + * @param[in] value - MAC address which needs to be set on the system. + * @returns macAddress of the interface or throws an error. +@@ -241,6 +245,7 @@ class EthernetInterface : public Ifaces + using ChannelAccessIntf::maxPrivilege; + using EthernetInterfaceIntf::dHCPEnabled; + using EthernetInterfaceIntf::interfaceName; ++ using EthernetInterfaceIntf::nICEnabled; + using MacAddressIntf::mACAddress; + + /** @brief Absolute path of the resolv conf file */ +-- +2.24.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch new file mode 100644 index 000000000..b6cf8f77d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch @@ -0,0 +1,504 @@ +From 42f361622a9c029221c8a90f92104703166e48c2 Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey +Date: Thu, 30 Jan 2020 15:07:39 -0800 +Subject: [PATCH] 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. + +Tested: +Using dbus-send or busctl: +Disabled DHCP, and confirmed only link local addresses were present. + +Assigned only static addresses. Both with/and without the gateway set +to 0.0.0.0 + +Deleted static IPv4 addresses. +Reassigned static addresses. + +Enabled DHCP for ipv4 only, and witnessed a DHCP server assign a valid +address. + +Assigned static IPv4 address. +Assigned static IPv6 address. +Confirmed both IPv4 and IPv6 static addresses are active. + +Enabled DHCP for ipv6 only, and confirmed the static v4 address +remains. The ipv6 address is removed, waiting for a DHCP6 server. + +Enabled DHCP for both ipv4 and ipv6. IPv4 address was assigned. IPv6 +address is assumed to succeed, as systemd config file enables IPv6 +DHCP. + +Change-Id: I2e0ff80ac3a5e88bcff28adac419bf21e37be162 +Signed-off-by: Johnathan Mantey +--- + Makefile.am | 1 + + configure.ac | 1 + + ethernet_interface.cpp | 147 ++++++++++++++++++++++--------- + ethernet_interface.hpp | 31 ++++++- + test/test_ethernet_interface.cpp | 3 +- + test/test_vlan_interface.cpp | 3 +- + types.hpp | 3 + + util.cpp | 16 +++- + util.hpp | 7 +- + vlan_interface.cpp | 2 +- + vlan_interface.hpp | 4 +- + 11 files changed, 165 insertions(+), 53 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 1c47747..ff252fc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -97,6 +97,7 @@ phosphor_network_manager_CXXFLAGS = \ + $(SDEVENTPLUS_CFLAGS) \ + $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \ + $(PHOSPHOR_LOGGING_CFLAGS) \ ++ -DBOOST_ASIO_DISABLE_THREADS \ + -flto + if FEATURE_NIC_ETHTOOL + phosphor_network_manager_CXXFLAGS += -DNIC_SUPPORTS_ETHTOOL +diff --git a/configure.ac b/configure.ac +index 12d6caa..fed3e09 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -36,6 +36,7 @@ AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) + PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) + PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) + PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0]) ++AC_CHECK_HEADER(boost/algorithm/string/split.hpp, [], [AC_MSG_ERROR([Could not find boost/algorithm/string/split.hpp])]) + + # Checks for header files. + AC_CHECK_HEADER(systemd/sd-bus.h, ,\ +diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp +index 73fd8fe..ba6195e 100644 +--- a/ethernet_interface.cpp ++++ b/ethernet_interface.cpp +@@ -3,7 +3,6 @@ + #include "ethernet_interface.hpp" + + #include "config_parser.hpp" +-#include "ipaddress.hpp" + #include "neighbor.hpp" + #include "network_manager.hpp" + #include "vlan_interface.hpp" +@@ -40,9 +39,12 @@ using Argument = xyz::openbmc_project::Common::InvalidArgument; + static constexpr const char* networkChannelCfgFile = + "/var/channel_intf_data.json"; + static constexpr const char* defaultChannelPriv = "priv-admin"; ++std::map mapDHCPToSystemd = { ++ {"both", "true"}, {"v4", "ipv4"}, {"v6", "ipv6"}, {"none", "false"}}; ++ + EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, + const std::string& objPath, +- bool dhcpEnabled, Manager& parent, ++ DHCPConf dhcpEnabled, Manager& parent, + bool emitSignal) : + Ifaces(bus, objPath.c_str(), true), + bus(bus), manager(parent), objPath(objPath) +@@ -83,6 +85,65 @@ static IP::Protocol convertFamily(int family) + throw std::invalid_argument("Bad address family"); + } + ++void EthernetInterface::disableDHCP(IP::Protocol protocol) ++{ ++ DHCPConf dhcpState = EthernetInterfaceIntf::dHCPEnabled(); ++ if (dhcpState == EthernetInterface::DHCPConf::both) ++ { ++ if (protocol == IP::Protocol::IPv4) ++ { ++ dHCPEnabled(EthernetInterface::DHCPConf::v6); ++ } ++ else if (protocol == IP::Protocol::IPv6) ++ { ++ dHCPEnabled(EthernetInterface::DHCPConf::v4); ++ } ++ } ++ else if ((dhcpState == EthernetInterface::DHCPConf::v4) && ++ (protocol == IP::Protocol::IPv4)) ++ { ++ dHCPEnabled(EthernetInterface::DHCPConf::none); ++ } ++ else if ((dhcpState == EthernetInterface::DHCPConf::v6) && ++ (protocol == IP::Protocol::IPv6)) ++ { ++ dHCPEnabled(EthernetInterface::DHCPConf::none); ++ } ++} ++ ++bool EthernetInterface::dhcpIsEnabled(IP::Protocol family, bool ignoreProtocol) ++{ ++ return ((EthernetInterfaceIntf::dHCPEnabled() == ++ EthernetInterface::DHCPConf::both) || ++ ((EthernetInterfaceIntf::dHCPEnabled() == ++ EthernetInterface::DHCPConf::v6) && ++ ((family == IP::Protocol::IPv6) || ignoreProtocol)) || ++ ((EthernetInterfaceIntf::dHCPEnabled() == ++ EthernetInterface::DHCPConf::v4) && ++ ((family == IP::Protocol::IPv4) || ignoreProtocol))); ++} ++ ++bool EthernetInterface::dhcpToBeEnabled(IP::Protocol family, ++ std::string& nextDHCPState) ++{ ++ return ((nextDHCPState == "true") || ++ ((nextDHCPState == "ipv6") && (family == IP::Protocol::IPv6)) || ++ ((nextDHCPState == "ipv4") && (family == IP::Protocol::IPv4))); ++} ++ ++bool EthernetInterface::addressIsStatic(IP::AddressOrigin origin) ++{ ++ return ( ++#ifdef LINK_LOCAL_AUTOCONFIGURATION ++ (origin == IP::AddressOrigin::Static) ++#else ++ (origin == IP::AddressOrigin::Static || ++ origin == IP::AddressOrigin::LinkLocal) ++#endif ++ ++ ); ++} ++ + void EthernetInterface::createIPAddressObjects() + { + addrs.clear(); +@@ -93,7 +154,7 @@ void EthernetInterface::createIPAddressObjects() + { + IP::Protocol addressType = convertFamily(addr.addrType); + IP::AddressOrigin origin = IP::AddressOrigin::Static; +- if (dHCPEnabled()) ++ if (dhcpIsEnabled(addressType)) + { + origin = IP::AddressOrigin::DHCP; + } +@@ -154,11 +215,11 @@ ObjectPath EthernetInterface::iP(IP::Protocol protType, std::string ipaddress, + uint8_t prefixLength, std::string gateway) + { + +- if (dHCPEnabled()) ++ if (dhcpIsEnabled(protType)) + { + log("DHCP enabled on the interface"), + entry("INTERFACE=%s", interfaceName().c_str()); +- dHCPEnabled(false); ++ disableDHCP(protType); + } + + IP::AddressOrigin origin = IP::AddressOrigin::Static; +@@ -441,7 +502,7 @@ bool EthernetInterface::iPv6AcceptRA(bool value) + return value; + } + +-bool EthernetInterface::dHCPEnabled(bool value) ++EthernetInterface::DHCPConf EthernetInterface::dHCPEnabled(DHCPConf value) + { + if (value == EthernetInterfaceIntf::dHCPEnabled()) + { +@@ -508,7 +569,7 @@ void EthernetInterface::loadVLAN(VlanId id) + std::string path = objPath; + path += "_" + std::to_string(id); + +- auto dhcpEnabled = ++ DHCPConf dhcpEnabled = + getDHCPValue(manager.getConfDir().string(), vlanInterfaceName); + + auto vlanIntf = std::make_unique( +@@ -530,7 +591,8 @@ ObjectPath EthernetInterface::createVLAN(VlanId id) + path += "_" + std::to_string(id); + + auto vlanIntf = std::make_unique( +- bus, path.c_str(), false, id, *this, manager); ++ bus, path.c_str(), EthernetInterface::DHCPConf::none, id, *this, ++ manager); + + // write the device file for the vlan interface. + vlanIntf->writeDeviceFile(); +@@ -603,8 +665,6 @@ void EthernetInterface::writeConfigurationFile() + // write all the static ip address in the systemd-network conf file + + using namespace std::string_literals; +- using AddressOrigin = +- sdbusplus::xyz::openbmc_project::Network::server::IP::AddressOrigin; + namespace fs = std::experimental::filesystem; + + // if there is vlan interafce then write the configuration file +@@ -673,42 +733,45 @@ void EthernetInterface::writeConfigurationFile() + } + + // Add the DHCP entry +- auto value = dHCPEnabled() ? "true"s : "false"s; +- stream << "DHCP="s + value + "\n"; ++ std::string value = convertForMessage(EthernetInterfaceIntf::dHCPEnabled()); ++ std::string::size_type loc = value.rfind("."); ++ std::string requestedDHCPState = value.substr(loc + 1); ++ std::string mappedDHCPState = mapDHCPToSystemd[requestedDHCPState]; ++ stream << "DHCP="s + mappedDHCPState + "\n"; ++ ++ bool dhcpv6Requested = dhcpToBeEnabled(IP::Protocol::IPv6, mappedDHCPState); ++ bool dhcpv4Requested = dhcpToBeEnabled(IP::Protocol::IPv4, mappedDHCPState); ++ // Static IP addresses ++ for (const auto& addr : addrs) ++ { ++ bool isValidIPv4 = isValidIP(AF_INET, addr.second->address()); ++ bool isValidIPv6 = isValidIP(AF_INET6, addr.second->address()); ++ if (((!dhcpv4Requested && isValidIPv4) || ++ (!dhcpv6Requested && isValidIPv6)) && ++ addressIsStatic(addr.second->origin())) ++ { ++ // Process all static addresses ++ std::string address = addr.second->address() + "/" + ++ std::to_string(addr.second->prefixLength()); ++ ++ // build the address entries. Do not use [Network] shortcuts to ++ // insert address entries. ++ stream << "[Address]\n"; ++ stream << "Address=" << address << "\n"; ++ } ++ } + +- // When the interface configured as dhcp, we don't need below given entries +- // in config file. +- if (dHCPEnabled() == false) ++ if (manager.getSystemConf()) + { +- // Static +- for (const auto& addr : addrs) ++ const auto& gateway = manager.getSystemConf()->defaultGateway(); ++ if (!gateway.empty()) + { +- if (addr.second->origin() == AddressOrigin::Static +-#ifndef LINK_LOCAL_AUTOCONFIGURATION +- || addr.second->origin() == AddressOrigin::LinkLocal +-#endif +- ) +- { +- std::string address = +- addr.second->address() + "/" + +- std::to_string(addr.second->prefixLength()); +- +- stream << "Address=" << address << "\n"; +- } ++ stream << "Gateway=" << gateway << "\n"; + } +- +- if (manager.getSystemConf()) ++ const auto& gateway6 = manager.getSystemConf()->defaultGateway6(); ++ if (!gateway6.empty()) + { +- const auto& gateway = manager.getSystemConf()->defaultGateway(); +- if (!gateway.empty()) +- { +- stream << "Gateway=" << gateway << "\n"; +- } +- const auto& gateway6 = manager.getSystemConf()->defaultGateway6(); +- if (!gateway6.empty()) +- { +- stream << "Gateway=" << gateway6 << "\n"; +- } ++ stream << "Gateway=" << gateway6 << "\n"; + } + } + +@@ -819,7 +882,7 @@ std::string EthernetInterface::mACAddress(std::string value) + + void EthernetInterface::deleteAll() + { +- if (EthernetInterfaceIntf::dHCPEnabled()) ++ if (dhcpIsEnabled(IP::Protocol::IPv4, true)) + { + log("DHCP enabled on the interface"), + entry("INTERFACE=%s", interfaceName().c_str()); +diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp +index 3e4cf12..a962751 100644 +--- a/ethernet_interface.hpp ++++ b/ethernet_interface.hpp +@@ -91,7 +91,7 @@ class EthernetInterface : public Ifaces + * send. + */ + EthernetInterface(sdbusplus::bus::bus& bus, const std::string& objPath, +- bool dhcpEnabled, Manager& parent, ++ DHCPConf dhcpEnabled, Manager& parent, + bool emitSignal = true); + + /** @brief Function to create ipaddress dbus object. +@@ -157,7 +157,34 @@ class EthernetInterface : public Ifaces + } + + /** Set value of DHCPEnabled */ +- bool dHCPEnabled(bool value) override; ++ DHCPConf dHCPEnabled(DHCPConf value) override; ++ ++ /** @brief Determines if DHCP is active for the IP::Protocol supplied. ++ * @param[in] protocol - Either IPv4 or IPv6 ++ * @param[in] ignoreProtocol - Allows IPv4 and IPv6 to be checked using a ++ * single call. ++ * @returns true/false value if DHCP is active for the input protocol ++ */ ++ bool dhcpIsEnabled(IP::Protocol protocol, bool ignoreProtocol = false); ++ ++ /** @brief Determines if DHCP will be active following next reconfig ++ * @param[in] protocol - Either IPv4 or IPv6 ++ * @param[in] nextDHCPState - The new DHCP mode to take affect ++ * @returns true/false value if DHCP is active for the input protocol ++ */ ++ bool dhcpToBeEnabled(IP::Protocol family, std::string& nextDHCPState); ++ ++ /** @brief Determines if the address is manually assigned ++ * @param[in] origin - The origin entry of the IP::Address ++ * @returns true/false value if the address is static ++ */ ++ bool addressIsStatic(IP::AddressOrigin origin); ++ ++ /** @brief Selectively disables DHCP ++ * @param[in] protocol - The IPv4 or IPv6 protocol to return to static ++ * addressing mode ++ */ ++ void disableDHCP(IP::Protocol protocol); + + /** @brief sets the MAC address. + * @param[in] value - MAC address which needs to be set on the system. +diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp +index 30dee8a..87fd68d 100644 +--- a/test/test_ethernet_interface.cpp ++++ b/test/test_ethernet_interface.cpp +@@ -58,7 +58,8 @@ class TestEthernetInterface : public testing::Test + { + mock_clear(); + mock_addIF("test0", 1, mac); +- return {bus, "/xyz/openbmc_test/network/test0", false, manager}; ++ return {bus, "/xyz/openbmc_test/network/test0", ++ EthernetInterface::DHCPConf::none, manager}; + } + + int countIPObjects() +diff --git a/test/test_vlan_interface.cpp b/test/test_vlan_interface.cpp +index 1dffc7e..e49b43f 100644 +--- a/test/test_vlan_interface.cpp ++++ b/test/test_vlan_interface.cpp +@@ -50,7 +50,8 @@ class TestVlanInterface : public testing::Test + { + mock_clear(); + mock_addIF("test0", 1); +- return {bus, "/xyz/openbmc_test/network/test0", false, manager}; ++ return {bus, "/xyz/openbmc_test/network/test0", ++ EthernetInterface::DHCPConf::none, manager}; + } + + void setConfDir() +diff --git a/types.hpp b/types.hpp +index 123067a..c4409fe 100644 +--- a/types.hpp ++++ b/types.hpp +@@ -1,5 +1,7 @@ + #pragma once + ++#include "ipaddress.hpp" ++ + #include + #include + #include +@@ -50,6 +52,7 @@ struct AddrInfo + { + uint8_t addrType; + std::string ipaddress; ++ IP::AddressOrigin origin; + uint16_t prefix; + }; + +diff --git a/util.cpp b/util.cpp +index 13a607f..554d7f6 100644 +--- a/util.cpp ++++ b/util.cpp +@@ -410,9 +410,11 @@ std::optional interfaceToUbootEthAddr(const char* intf) + return "eth" + std::to_string(idx) + "addr"; + } + +-bool getDHCPValue(const std::string& confDir, const std::string& intf) ++EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir, ++ const std::string& intf) + { +- bool dhcp = false; ++ EthernetInterfaceIntf::DHCPConf dhcp = ++ EthernetInterfaceIntf::DHCPConf::none; + // Get the interface mode value from systemd conf + // using namespace std::string_literals; + fs::path confPath = confDir; +@@ -434,7 +436,15 @@ bool getDHCPValue(const std::string& confDir, const std::string& intf) + // There will be only single value for DHCP key. + if (values[0] == "true") + { +- dhcp = true; ++ dhcp = EthernetInterfaceIntf::DHCPConf::both; ++ } ++ else if (values[0] == "ipv4") ++ { ++ dhcp = EthernetInterfaceIntf::DHCPConf::v4; ++ } ++ else if (values[0] == "ipv6") ++ { ++ dhcp = EthernetInterfaceIntf::DHCPConf::v6; + } + return dhcp; + } +diff --git a/util.hpp b/util.hpp +index 251aa0d..ee11f4e 100644 +--- a/util.hpp ++++ b/util.hpp +@@ -13,12 +13,16 @@ + #include + #include + #include ++#include + + namespace phosphor + { + namespace network + { + ++using EthernetInterfaceIntf = ++ sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface; ++ + constexpr auto IPV4_MIN_PREFIX_LENGTH = 1; + constexpr auto IPV4_MAX_PREFIX_LENGTH = 32; + constexpr auto IPV6_MAX_PREFIX_LENGTH = 64; +@@ -156,7 +160,8 @@ std::optional interfaceToUbootEthAddr(const char* intf); + * @param[in] confDir - Network configuration directory. + * @param[in] intf - Interface name. + */ +-bool getDHCPValue(const std::string& confDir, const std::string& intf); ++EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir, ++ const std::string& intf); + + namespace internal + { +diff --git a/vlan_interface.cpp b/vlan_interface.cpp +index 73de4e8..26282cb 100644 +--- a/vlan_interface.cpp ++++ b/vlan_interface.cpp +@@ -22,7 +22,7 @@ using namespace phosphor::logging; + using namespace sdbusplus::xyz::openbmc_project::Common::Error; + + VlanInterface::VlanInterface(sdbusplus::bus::bus& bus, +- const std::string& objPath, bool dhcpEnabled, ++ const std::string& objPath, DHCPConf dhcpEnabled, + uint32_t vlanID, EthernetInterface& intf, + Manager& parent) : + VlanIface(bus, objPath.c_str()), +diff --git a/vlan_interface.hpp b/vlan_interface.hpp +index a994d05..37ae7ee 100644 +--- a/vlan_interface.hpp ++++ b/vlan_interface.hpp +@@ -45,8 +45,8 @@ class VlanInterface : public VlanIface, + * @param[in] manager - network manager object. + */ + VlanInterface(sdbusplus::bus::bus& bus, const std::string& objPath, +- bool dhcpEnabled, uint32_t vlanID, EthernetInterface& intf, +- Manager& manager); ++ DHCPConf dhcpEnabled, uint32_t vlanID, ++ EthernetInterface& intf, Manager& manager); + + /** @brief Delete this d-bus object. + */ +-- +2.24.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0010-Enable-the-network-link-carrier-state-to-be-reported.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0010-Enable-the-network-link-carrier-state-to-be-reported.patch new file mode 100644 index 000000000..51957ffff --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0010-Enable-the-network-link-carrier-state-to-be-reported.patch @@ -0,0 +1,282 @@ +From 8f6f3ccb1f5a4af8065485c2e683402ec2b38abf Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey +Date: Wed, 8 Jan 2020 10:38:58 -0800 +Subject: [PATCH] Enable the network link carrier state to be reported. + +This change allows networkd to keep track of, and report, the state of +the network carrier signal. When a NIC cable is pulled, or inserted, a +DBus client is able identify the condition. + +Tested: +ip link set down dev eth0 # take eth0 down +Get bmc/EthernetInterfaces/eth0 from Redfish # LinkStatus = LinkDown + # InterfaceEnabled = false +ip link set up dev eth0 # bring eth0 back +Get bmc/EthernetInterfaces/eth0 from Redfish # LinkStatus = Linkup + # InterfaceEnabled = true +Pull eth0 cable +Get bmc/EthernetInterfaces/eth0 from Redfish # LinkStatus = LinkDown + # InterfaceEnabled = true +Insert eth0 cable +Get bmc/EthernetInterfaces/eth0 from Redfish # LinkStatus = Linkup + # InterfaceEnabled = true + +Change-Id: I5530cf7882cfbfdba1436dd34b3219c735047c5e +Signed-off-by: Johnathan Mantey +--- + ethernet_interface.cpp | 141 +++++++++++++++++++++++++---------------- + ethernet_interface.hpp | 8 ++- + 2 files changed, 92 insertions(+), 57 deletions(-) + +diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp +index 671e8c4..018f2e1 100644 +--- a/ethernet_interface.cpp ++++ b/ethernet_interface.cpp +@@ -42,6 +42,28 @@ static constexpr const char* defaultChannelPriv = "priv-admin"; + std::map mapDHCPToSystemd = { + {"both", "true"}, {"v4", "ipv4"}, {"v6", "ipv6"}, {"none", "false"}}; + ++struct EthernetIntfSocket ++{ ++ EthernetIntfSocket(int domain, int type, int protocol) ++ { ++ if ((sock = socket(domain, type, protocol)) < 0) ++ { ++ log("socket creation failed:", ++ entry("ERROR=%s", strerror(errno))); ++ } ++ } ++ ++ ~EthernetIntfSocket() ++ { ++ if (sock > 0) ++ { ++ close(sock); ++ } ++ } ++ ++ int sock{-1}; ++}; ++ + EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, + const std::string& objPath, + DHCPConf dhcpEnabled, Manager& parent, +@@ -57,12 +79,12 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, + MacAddressIntf::mACAddress(getMACAddress(intfName)); + EthernetInterfaceIntf::nTPServers(getNTPServersFromConf()); + EthernetInterfaceIntf::nameservers(getNameServerFromConf()); +-#if NIC_SUPPORTS_ETHTOOL + InterfaceInfo ifInfo = EthernetInterface::getInterfaceInfo(); +- +- EthernetInterfaceIntf::nICEnabled(std::get<3>(ifInfo)); ++#if NIC_SUPPORTS_ETHTOOL + EthernetInterfaceIntf::autoNeg(std::get<2>(ifInfo)); + EthernetInterfaceIntf::speed(std::get<0>(ifInfo)); ++ EthernetInterfaceIntf::nICEnabled(std::get<3>(ifInfo)); ++ EthernetInterfaceIntf::linkUp(std::get<4>(ifInfo)); + #endif + getChannelPrivilege(intfName); + +@@ -286,63 +308,47 @@ ObjectPath EthernetInterface::neighbor(std::string iPAddress, + return objectPath; + } + +-#if NIC_SUPPORTS_ETHTOOL +-/* +- Enable this code if your NIC driver supports the ETHTOOL features. +- Do this by adding the following to your phosphor-network*.bbappend file. +- EXTRA_OECONF_append = " --enable-nic-ethtool=yes" +- The default compile mode is to omit getInterfaceInfo() +-*/ + InterfaceInfo EthernetInterface::getInterfaceInfo() const + { +- int sock{-1}; +- ifreq ifr{0}; +- ethtool_cmd edata{0}; + LinkSpeed speed{0}; + Autoneg autoneg{0}; + DuplexMode duplex{0}; + NICEnabled nicEnabled{false}; +- do +- { +- sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); +- if (sock < 0) +- { +- log("socket creation failed:", +- entry("ERROR=%s", strerror(errno))); +- break; +- } ++ LinkUp linkState{false}; + +- strcpy(ifr.ifr_name, interfaceName().c_str()); +- ifr.ifr_data = reinterpret_cast(&edata); ++#if NIC_SUPPORTS_ETHTOOL ++ /* ++ Enable this code if your NIC driver supports the ETHTOOL features. ++ Do this by adding the following to your phosphor-network*.bbappend ++ file. EXTRA_OECONF_append = " --enable-nic-ethtool=yes" The ++ default compile mode is to omit getInterfaceInfo() ++ */ ++ ifreq ifr{0}; ++ ethtool_cmd edata{0}; ++ EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); + +- edata.cmd = ETHTOOL_GSET; ++ if (eifSocket.sock < 0) ++ { ++ return std::make_tuple(speed, duplex, autoneg, nicEnabled, linkState); ++ } + +- if (ioctl(sock, SIOCETHTOOL, &ifr) < 0) +- { +- log("ioctl failed for SIOCETHTOOL:", +- entry("ERROR=%s", strerror(errno))); +- break; +- } ++ std::strncpy(ifr.ifr_name, interfaceName().c_str(), IFNAMSIZ - 1); ++ ifr.ifr_data = reinterpret_cast(&edata); ++ ++ edata.cmd = ETHTOOL_GSET; ++ if (ioctl(eifSocket.sock, SIOCETHTOOL, &ifr) >= 0) ++ { + speed = edata.speed; + duplex = edata.duplex; + autoneg = edata.autoneg; ++ } ++#endif + +- if (ioctl(sock, SIOCGIFFLAGS, &ifr) < 0) +- { +- log("ioctl failed for SIOCGIFFLAGS:", +- entry("ERROR=%s", strerror(errno))); +- break; +- } +- nicEnabled = static_cast(ifr.ifr_flags & IFF_UP); +- } while (0); ++ nicEnabled = nICEnabled(); ++ linkState = linkUp(); + +- if (sock >= 0) +- { +- close(sock); +- } +- return std::make_tuple(speed, duplex, autoneg, nicEnabled); ++ return std::make_tuple(speed, duplex, autoneg, nicEnabled, linkState); + } +-#endif + + /** @brief get the mac address of the interface. + * @return macaddress on success +@@ -351,25 +357,23 @@ InterfaceInfo EthernetInterface::getInterfaceInfo() const + std::string + EthernetInterface::getMACAddress(const std::string& interfaceName) const + { +- ifreq ifr{}; +- int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); +- if (sock < 0) ++ std::string activeMACAddr = MacAddressIntf::mACAddress(); ++ EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); ++ ++ if (eifSocket.sock < 0) + { +- log("socket creation failed:", +- entry("ERROR=%s", strerror(errno))); +- elog(); ++ return activeMACAddr; + } + +- std::strcpy(ifr.ifr_name, interfaceName.c_str()); +- if (ioctl(sock, SIOCGIFHWADDR, &ifr) != 0) ++ ifreq ifr{0}; ++ std::strncpy(ifr.ifr_name, interfaceName.c_str(), IFNAMSIZ - 1); ++ if (ioctl(eifSocket.sock, SIOCGIFHWADDR, &ifr) != 0) + { + log("ioctl failed for SIOCGIFHWADDR:", + entry("ERROR=%s", strerror(errno))); +- close(sock); + elog(); + } + +- close(sock); + static_assert(sizeof(ifr.ifr_hwaddr.sa_data) >= sizeof(ether_addr)); + std::string_view hwaddr(reinterpret_cast(ifr.ifr_hwaddr.sa_data), + sizeof(ifr.ifr_hwaddr.sa_data)); +@@ -546,7 +550,7 @@ bool EthernetInterface::nICEnabled(bool value) + + do + { +- std::strncpy(ifr.ifr_name, interfaceName().c_str(), IF_NAMESIZE); ++ std::strncpy(ifr.ifr_name, interfaceName().c_str(), IF_NAMESIZE - 1); + if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) + { + log("ioctl failed for SIOCGIFFLAGS:", +@@ -575,6 +579,31 @@ bool EthernetInterface::nICEnabled(bool value) + return value; + } + ++bool EthernetInterface::linkUp() const ++{ ++ EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); ++ bool value = EthernetInterfaceIntf::linkUp(); ++ ++ if (eifSocket.sock < 0) ++ { ++ return value; ++ } ++ ++ ifreq ifr{0}; ++ std::strncpy(ifr.ifr_name, interfaceName().c_str(), IF_NAMESIZE - 1); ++ if (ioctl(eifSocket.sock, SIOCGIFFLAGS, &ifr) == 0) ++ { ++ value = static_cast(ifr.ifr_flags & IFF_RUNNING); ++ } ++ else ++ { ++ log("ioctl failed for SIOCGIFFLAGS:", ++ entry("ERROR=%s", strerror(errno))); ++ } ++ ++ return value; ++} ++ + ServerList EthernetInterface::nameservers(ServerList value) + { + for (const auto& nameserverip : value) +diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp +index 3dee311..83d7cb5 100644 +--- a/ethernet_interface.hpp ++++ b/ethernet_interface.hpp +@@ -60,9 +60,11 @@ using LinkSpeed = uint16_t; + using DuplexMode = uint8_t; + using Autoneg = uint8_t; + using NICEnabled = bool; ++using LinkUp = bool; + using VlanId = uint32_t; + using InterfaceName = std::string; +-using InterfaceInfo = std::tuple; ++using InterfaceInfo = ++ std::tuple; + using AddressMap = std::map>; + using NeighborMap = std::map>; + using VlanInterfaceMap = +@@ -190,6 +192,9 @@ class EthernetInterface : public Ifaces + /** Set value of NICEnabled */ + bool nICEnabled(bool value) override; + ++ /** Retrieve Link State */ ++ bool linkUp() const override; ++ + /** @brief sets the MAC address. + * @param[in] value - MAC address which needs to be set on the system. + * @returns macAddress of the interface or throws an error. +@@ -245,6 +250,7 @@ class EthernetInterface : public Ifaces + using ChannelAccessIntf::maxPrivilege; + using EthernetInterfaceIntf::dHCPEnabled; + using EthernetInterfaceIntf::interfaceName; ++ using EthernetInterfaceIntf::linkUp; + using EthernetInterfaceIntf::nICEnabled; + using MacAddressIntf::mACAddress; + +-- +2.24.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend index db231d42f..5279b2e52 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend @@ -4,6 +4,11 @@ DEPENDS += "nlohmann-json boost" SRC_URI += "git://github.com/openbmc/phosphor-networkd" SRC_URI += "file://0003-Adding-channel-specific-privilege-to-network.patch \ - file://0001-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch \ + file://0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch \ + file://0008-Added-enable-disable-control-of-the-Network-Interfac.patch \ + file://0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch \ + file://0010-Enable-the-network-link-carrier-state-to-be-reported.patch \ " -SRCREV = "cb42fe26febc9e457a9c4279278bd8c85f60851a" +SRCREV = "dbd328d7e037b1af13fb0f20f3708e2261b9e0b6" + +EXTRA_OECONF_append = " --enable-nic-ethtool=yes" 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 ff89f2ad2..9a25eafa9 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 = "01542d2af1b1f45335cc8813fffcd3ed07f22989" +SRCREV = "41622a95da34e3aacbf2b70d687d3a3a7c816c8a" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0016-Add-DBUS-interface-of-SMBIOS-MDR-V2.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0016-Add-DBUS-interface-of-SMBIOS-MDR-V2.patch deleted file mode 100644 index 576bae81a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0016-Add-DBUS-interface-of-SMBIOS-MDR-V2.patch +++ /dev/null @@ -1,227 +0,0 @@ -From 9490574667485cd407193ff9f0d6a96f8c2c87d3 Mon Sep 17 00:00:00 2001 -From: cyang29 -Date: Wed, 12 Sep 2018 00:27:23 +0800 -Subject: [PATCH] Add DBUS interface of SMBIOS MDR V2 - -Support: - SMBIOS MDR V2 service interface. - SMBIOS MDR V2 IPMI Command - SMBIOS MDR V2 Redfish interface. -Base on SMBIOS spec DSP0134_3.0.0 and Managed Data Region -Specification Revision 4 ---- - xyz/openbmc_project/Smbios/MDR_V2.errors.yaml | 9 + - xyz/openbmc_project/Smbios/MDR_V2.interface.yaml | 158 +++++++++++++++++++++++ - xyz/openbmc_project/Smbios/README.md | 21 +++ - 3 files changed, 188 insertions(+) - create mode 100644 xyz/openbmc_project/Smbios/MDR_V2.errors.yaml - create mode 100644 xyz/openbmc_project/Smbios/MDR_V2.interface.yaml - create mode 100644 xyz/openbmc_project/Smbios/README.md - -diff --git a/xyz/openbmc_project/Smbios/MDR_V2.errors.yaml b/xyz/openbmc_project/Smbios/MDR_V2.errors.yaml -new file mode 100644 -index 0000000..88bd6db ---- /dev/null -+++ b/xyz/openbmc_project/Smbios/MDR_V2.errors.yaml -@@ -0,0 +1,9 @@ -+- name: InvalidParameter -+ description: > -+ An invalid parameter is attempted. -+- name: UpdateInProgress -+ description: > -+ Update is in progress. -+- name: InvalidId -+ description: > -+ An invalid Id is attempted. -diff --git a/xyz/openbmc_project/Smbios/MDR_V2.interface.yaml b/xyz/openbmc_project/Smbios/MDR_V2.interface.yaml -new file mode 100644 -index 0000000..f97700a ---- /dev/null -+++ b/xyz/openbmc_project/Smbios/MDR_V2.interface.yaml -@@ -0,0 +1,158 @@ -+description: > -+ SMBIOS MDR V2 service -+methods: -+ - name: GetDirectoryInformation -+ description: > -+ Get the directory with directory index. -+ parameters: -+ - name: dirIndex -+ type: byte -+ description: > -+ Directory index of SMBIOS. -+ returns: -+ - name: dir -+ type: array[byte] -+ description: > -+ Directory of agent. -+ errors: -+ - self.Error.InvalidParameter -+ -+ - name: GetDataInformation -+ description: > -+ Get the data info with id index and data set ID. -+ parameters: -+ - name: idIndex -+ type: byte -+ description: > -+ Index of SMBIOS directory. -+ returns: -+ - name: dataInfo -+ type: array[byte] -+ description: > -+ Data information of SMBIOS. -+ errors: -+ - self.Error.InvalidParameter -+ -+ - name: SendDirectoryInformation -+ description: > -+ Send directory information to SMBIOS directory. -+ parameters: -+ - name: dirVersion -+ type: byte -+ description: > -+ A counter which increments each time directory updated. -+ - name: dirIndex -+ type: byte -+ description: > -+ Directory index of SMBIOS. -+ - name: returnedEntries -+ type: byte -+ description: > -+ Indicates number of directory entries. -+ - name: remainingEntries -+ type: byte -+ description: > -+ Remaining entries which are higher than index in this transfer. -+ - name: dirEntry -+ type: array[byte] -+ description: > -+ Data set ID of SMBIOS table. -+ returns: -+ - name: status -+ type: boolean -+ description: > -+ Need to continue directory transmisson or not. -+ errors: -+ - self.Error.InvalidParameter -+ -+ - name: GetDataOffer -+ description: > -+ Get data set ID. -+ returns: -+ - name: offer -+ type: array[byte] -+ description: > -+ Data set ID. -+ errors: -+ - self.Error.UpdateInProgress -+ -+ - name: SendDataInformation -+ description: > -+ Send data information with directory index. -+ parameters: -+ - name: idIndex -+ type: byte -+ description: > -+ Index of SMBIOS directory. -+ - name: flag -+ type: byte -+ description: > -+ Valid flag to set dir entry status. -+ - name: dataLen -+ type: uint32 -+ description: > -+ The length of the data in bytes. -+ - name: dataVer -+ type: uint32 -+ description: > -+ The version number of this data. -+ - name: timeStamp -+ type: uint32 -+ description: > -+ Timestamp determinded by the agent. -+ returns: -+ - name: status -+ type: boolean -+ description: > -+ Whether data changes. -+ errors: -+ - self.Error.InvalidParameter -+ -+ - name: FindIdIndex -+ description: > -+ Find id index by data info. -+ parameters: -+ - name: dataInfo -+ type: array[byte] -+ description: > -+ Data info of data entry. -+ returns: -+ - name: idIndex -+ type: int32 -+ description: > -+ Id index of data entry. -+ errors: -+ - self.Error.InvalidId -+ -+ - name: AgentSynchronizeData -+ description: > -+ Synchronize SMBIOS data from file. -+ returns: -+ - name: status -+ type: boolean -+ description: > -+ Whether synchronization succeed or not. -+ -+ - name: SynchronizeDirectoryCommonData -+ description: > -+ Synchronize directory common data. -+ parameters: -+ - name: idIndex -+ type: byte -+ description: > -+ Index of SMBIOS directory. -+ - name: size -+ type: uint32 -+ description: > -+ Size of data that BIOS prepare to transfer. -+ returns: -+ - name: commonData -+ type: array[uint32] -+ description: > -+ Directory common data includes data size, version and timestamp. -+ -+properties: -+ - name: DirectoryEntries -+ type: byte -+ description: > -+ Numbers of directory entries. -diff --git a/xyz/openbmc_project/Smbios/README.md b/xyz/openbmc_project/Smbios/README.md -new file mode 100644 -index 0000000..415ac52 ---- /dev/null -+++ b/xyz/openbmc_project/Smbios/README.md -@@ -0,0 +1,22 @@ -+# SMBIOS MDR V2 -+ -+## Overview -+SMBIOS MDR V2 service exposes D-Bus methods for SMBIOS Version 2 operations. -+ -+### SMBIOS MDR V2 Interface -+SMBIOS MDR V2 interface `xyz.openbmc_project.Smbios.MDR_V2` provides following -+methods. -+#### methods -+* GetDirectoryInformation - Get the directory with directory index. -+* GetDataInformation - Get the data information with id index and data set ID. -+* SendDirectoryInformation - Send directory information to SMBIOS directory. -+* GetDataOffer - Get data set ID. -+* SendDataInformation - Send data information with directory index. -+* FindIdIndex - Find id index by data info. -+* SynchronizeDirectoryCommonData - Synchronize directory common data before -+SMBIOS data start to transfer. -+* AgentSynchronizeData - Synchronize SMBIOS data from file after data transfer -+complete. -+ -+#### properties -+* DirEntries - Numbers of directory entries. Default: 0 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0020-Create-dbus-interface-for-SOL-commands.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0020-Create-dbus-interface-for-SOL-commands.patch deleted file mode 100644 index 68d2c92b7..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0020-Create-dbus-interface-for-SOL-commands.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 2820ca36ab21c52341cdbde477756f960eaeb68b Mon Sep 17 00:00:00 2001 -From: Cheng C Yang -Date: Wed, 13 Mar 2019 11:19:07 +0800 -Subject: [PATCH] Create dbus interface for SOL commands - -Create dbus properties for Set/Get SOL config parameter command. -Some platforms need to call Set/Get SOL config parameter command -through KCS, and since sol manager in net-ipmid cannot be accessed -by commands in host-ipmid, need to create a dbus interface in -phospher-settings to transfer properties from host-ipmid to -net-ipmid. - -TestedBy: -With the related code change in net-ipmid, busctl introspect -xyz.openbmc_project.Ipmi.SOL /xyz/openbmc_project/SOL -can show all the properties needed. - -Signed-off-by: Cheng C Yang ---- - xyz/openbmc_project/Ipmi/SOL.interface.yaml | 44 ++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - create mode 100644 xyz/openbmc_project/Ipmi/SOL.interface.yaml - -diff --git a/xyz/openbmc_project/Ipmi/SOL.interface.yaml b/xyz/openbmc_project/Ipmi/SOL.interface.yaml -new file mode 100644 -index 0000000..94db59f ---- /dev/null -+++ b/xyz/openbmc_project/Ipmi/SOL.interface.yaml -@@ -0,0 +1,44 @@ -+description: > -+ SOL properties use for Get/Set SOL config parameter command in host-ipmid -+ sending config to SOL process in net-ipmid. -+ Since some platforms need to access Get/Set SOL config parameter command -+ through KCS, and current sol manager is implemented in net-ipmid and -+ cannot be accessed by host-ipmid, add a dbus interface for host-ipmid -+ command to transfer properties to net-ipmid. -+ This interface will be implemented in phosphor-settings. -+properties: -+ - name: Progress -+ type: byte -+ description: > -+ Set In Progress property, indicate when any parameters are being -+ updated. -+ - name: Enable -+ type: boolean -+ description: > -+ SOL Enable property, this controls whether the SOL payload type -+ can be activated. -+ - name: Authentication -+ type: byte -+ description: > -+ If SOL enable Force Payload Encryption and Authenticaton. -+ And the minimun operating privilege level SOL required. -+ - name: AccumulateIntervalMS -+ type: byte -+ description: > -+ Character Accumulate Interval in 5ms increments. -+ BMC will wait this time before transmitting a packet. -+ - name: Threshold -+ type: byte -+ description: > -+ BMC will automatically send an SOL character data packet containing -+ this number of characters as soon as this number of characters -+ (or greater) has been accepted from the baseboard serial controller. -+ - name: RetryCount -+ type: byte -+ description: > -+ Packet will be dropped if no ACK/NACK received by time retries -+ expire. -+ - name: RetryIntervalMS -+ type: byte -+ description: > -+ Retry Interval in 10ms increments. --- -2.16.2 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0022-Add-chassis-power-cycle-and-reset-to-Chassis-State.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0022-Add-chassis-power-cycle-and-reset-to-Chassis-State.patch deleted file mode 100644 index 181d12428..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0022-Add-chassis-power-cycle-and-reset-to-Chassis-State.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b55c6847b18fdee5a72d601b871d73085481e4d9 Mon Sep 17 00:00:00 2001 -From: "Jason M. Bills" -Date: Mon, 3 Jun 2019 16:31:29 -0700 -Subject: [PATCH] Add chassis power-cycle and reset to Chassis State - -This adds chassis PowerCycle and Reset as possible Transition -values for the Chassis State. These are to support chassis -power cycle and a chassis reset button, respectively. - -Signed-off-by: Jason M. Bills ---- - xyz/openbmc_project/State/Chassis.interface.yaml | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/xyz/openbmc_project/State/Chassis.interface.yaml b/xyz/openbmc_project/State/Chassis.interface.yaml -index 4ae6274..470a3a2 100644 ---- a/xyz/openbmc_project/State/Chassis.interface.yaml -+++ b/xyz/openbmc_project/State/Chassis.interface.yaml -@@ -31,10 +31,17 @@ enumerations: - values: - - name: 'Off' - description: > -- Chassis power should be off -+ Chassis power should be off - - name: 'On' - description: > - Chassis power should be on -+ - name: 'PowerCycle' -+ description: > -+ Chassis power should be cycled -+ - name: 'Reset' -+ description: > -+ Chassis should be reset -+ - - - name: PowerState - description: > --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0026-Add-StandbySpare-support-for-software-inventory.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0026-Add-StandbySpare-support-for-software-inventory.patch index cbf966a37..36c63ec58 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0026-Add-StandbySpare-support-for-software-inventory.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0026-Add-StandbySpare-support-for-software-inventory.patch @@ -1,6 +1,6 @@ -From ae9e4b2a166dc4f34b255ed5338abbfa8aa37778 Mon Sep 17 00:00:00 2001 -From: Vikram Bodireddy -Date: Sat, 30 Nov 2019 18:20:13 +0530 +From 0d6556539be9bda478a3cabb6127eace5764fa11 Mon Sep 17 00:00:00 2001 +From: Vikram Bodireddy +Date: Wed, 15 Jan 2020 10:01:04 +0800 Subject: [PATCH] Add StandbySpare support for software inventory Add support to allow update for active / recovery @@ -9,14 +9,13 @@ the backend modules to advertise whether the software object is active or recovery (StandbySpare) image. -Change-Id: I0d46206463ba566bcaa710fb271aa4d795fa49cd -Signed-off-by: Vikram Bodireddy +Signed-off-by: Vikram Bodireddy --- xyz/openbmc_project/Software/Activation.interface.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xyz/openbmc_project/Software/Activation.interface.yaml b/xyz/openbmc_project/Software/Activation.interface.yaml -index 37c9cb9..b71b8e7 100644 +index efeeeb6..6c9ce75 100644 --- a/xyz/openbmc_project/Software/Activation.interface.yaml +++ b/xyz/openbmc_project/Software/Activation.interface.yaml @@ -28,12 +28,20 @@ enumerations: @@ -37,10 +36,10 @@ index 37c9cb9..b71b8e7 100644 + description: > + The Software.Version is part of a redundancy set and awaits + a failover or external action to activate. - - name: RequestedActivations - description: > - The possible RequestedActivation states of a Software.Version. -@@ -44,6 +52,10 @@ enumerations: + - name: Staged + description: > + The Software.Version is currently in staged flash area. +@@ -48,6 +56,10 @@ enumerations: - name: Active description: > The Software.Version has been requested for Activation. 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 d9240f760..9690ec20f 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,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git" -SRCREV = "1b02c38979ab4fa2649699a26266367b115eee7c" +SRCREV = "79064a8e0c49b35cfa1c343cef31f21ebfd7298d" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" @@ -8,8 +8,6 @@ SRC_URI += "file://0005-Add-DBUS-interface-of-CPU-and-Memory-s-properties.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://0016-Add-DBUS-interface-of-SMBIOS-MDR-V2.patch \ - file://0022-Add-chassis-power-cycle-and-reset-to-Chassis-State.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 \ 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 34d5b6e67..92b3ced38 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 @@ -99,12 +99,15 @@ diff --git a/item_updater.cpp b/item_updater.cpp index 21fb6e0..fd76a7f 100644 --- a/item_updater.cpp +++ b/item_updater.cpp -@@ -64,7 +64,8 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) +@@ -64,10 +64,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) auto value = SVersion::convertVersionPurposeFromString( variant_ns::get(property.second)); if (value == VersionPurpose::BMC || +-#ifdef HOST_BIOS_UPGRADE ++#if defined(HOST_BIOS_UPGRADE) || defined(PFR_UPDATE) + value == VersionPurpose::Host || + #endif - value == VersionPurpose::System) -+ value == VersionPurpose::Host || + value == VersionPurpose::Other) { purpose = value; 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-support-for-StandBySpare.patch index 9e7cdf768..dc3ec060e 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-support-for-StandBySpare.patch @@ -1,6 +1,6 @@ -From ba9d7f8443716887bc101e300b06c570f7da8159 Mon Sep 17 00:00:00 2001 -From: Vikram Bodireddy -Date: Thu, 5 Dec 2019 15:13:52 +0530 +From 17caf10b048450979dcd95a9f9333bbaa8c307ec Mon Sep 17 00:00:00 2001 +From: AppaRao Puli +Date: Fri, 10 Jan 2020 08:16:10 +0530 Subject: [PATCH] Firmware update support for StandBySpare Firmware update support for StandBySpare. This will @@ -28,12 +28,13 @@ Tested: Change-Id: I59f317ac001ebf56bbf30e7f43dbec5d69fa249a Signed-off-by: Vikram Bodireddy +Signed-off-by: AppaRao Puli --- - redfish-core/lib/update_service.hpp | 285 ++++++++++++++++++++++++++++++------ - 1 file changed, 241 insertions(+), 44 deletions(-) + redfish-core/lib/update_service.hpp | 284 ++++++++++++++++++++++++++++++------ + 1 file changed, 241 insertions(+), 43 deletions(-) diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp -index 57dcc07..c189d5a 100644 +index ec9600e..9daf6ce 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -30,6 +30,17 @@ static std::unique_ptr fwUpdateMatcher; @@ -448,18 +449,17 @@ index 57dcc07..c189d5a 100644 std::string filepath( "/tmp/images/" + -@@ -569,9 +770,7 @@ class SoftwareInventoryCollection : public Node - "xyz.openbmc_project.ObjectMapper", +@@ -574,8 +775,7 @@ class SoftwareInventoryCollection : public Node "/xyz/openbmc_project/object_mapper", - "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", -- static_cast(0), + "xyz.openbmc_project.ObjectMapper", "GetSubTree", + "/xyz/openbmc_project/software", static_cast(0), - std::array{ - "xyz.openbmc_project.Software.Version"}); -+ static_cast(0), std::array{versionIntf}); ++ std::array{versionIntf}); } }; -@@ -756,7 +955,7 @@ class SoftwareInventory : public Node +@@ -760,7 +960,7 @@ class SoftwareInventory : public Node }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", @@ -468,7 +468,7 @@ index 57dcc07..c189d5a 100644 } if (!found) { -@@ -778,9 +977,7 @@ class SoftwareInventory : public Node +@@ -781,9 +981,7 @@ class SoftwareInventory : public Node "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", 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 3c679fc51..795d34daf 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "123e823757a6efc08b215766124ba7321e3cca55" +SRCREV = "f723d7332bbdd7b0d4fbe4aa730b63dfd8db7eff" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" @@ -9,18 +9,8 @@ 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 \ - " - -# Enable CPU Log and Raw PECI support -EXTRA_OECMAKE += "-DBMCWEB_ENABLE_REDFISH_CPU_LOG=ON" -EXTRA_OECMAKE += "-DBMCWEB_ENABLE_REDFISH_RAW_PECI=ON" - -# Enable Redfish BMC Journal support -EXTRA_OECMAKE += "-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL=ON" +SRC_URI += "file://0001-Firmware-update-support-for-StandBySpare.patch" # Enable PFR support EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE=ON', '', d)}" -#Disable the Dbus interface -EXTRA_OECMAKE += "-DBMCWEB_ENABLE_DBUS_REST=OFF" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/ipmitool_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/ipmitool_%.bbappend new file mode 100644 index 000000000..84e250b66 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/ipmitool_%.bbappend @@ -0,0 +1,6 @@ + +# Disable the shell to remove the usage of readline lib +# to fix the license conflict issue. More information: +# https://lists.ozlabs.org/pipermail/openbmc/2019-November/019678.html + +EXTRA_OECONF_append = " --disable-ipmishell" 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 index 1e4d3b0a9..7e3f92dbc 100644 --- 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 @@ -1,4 +1,4 @@ -From 3db78afe49a662ce7e90f3f5ce40d625a54d576b Mon Sep 17 00:00:00 2001 +From 8e9fba263179ccc87be7212c7dbd87cd7a37ac30 Mon Sep 17 00:00:00 2001 From: Johnathan Mantey Date: Thu, 14 Nov 2019 11:24:19 -0800 Subject: [PATCH] Modify Get Lan Configuration IP Address Source to use correct @@ -27,24 +27,24 @@ ipmitool raw 0xc 2 3 4 0 0 # returns correct state Change-Id: Ia66f7fcf3d5ad0a383b06658b18e8ce2b282e052 Signed-off-by: Johnathan Mantey --- - transporthandler.cpp | 88 ++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 73 insertions(+), 15 deletions(-) + transporthandler.cpp | 97 ++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 79 insertions(+), 18 deletions(-) diff --git a/transporthandler.cpp b/transporthandler.cpp -index 09df184..8dc5677 100644 +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 const char* dhcpv4v6 = ++static constexpr auto dhcpv4v6 = + "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.both"; -+static const char* dhcpv6 = ++static constexpr auto dhcpv6 = + "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.v6"; -+static const char* dhcpv4 = ++static constexpr auto dhcpv4 = + "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.v4"; -+static const char* dhcpoff = ++static constexpr auto dhcpoff = + "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.none"; + +static std::array dhcpEnumerations = {dhcpv4v6, dhcpv4, dhcpv6, @@ -134,7 +134,17 @@ index 09df184..8dc5677 100644 } /** @brief Creates a new VLAN on the specified interface -@@ -1395,7 +1445,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, +@@ -1401,7 +1451,8 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, + } + case LanParam::IP: + { +- if (channelCall(channel)) ++ std::string dhcpSetting = channelCall(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: { @@ -147,7 +157,7 @@ index 09df184..8dc5677 100644 return responseSuccess(); } case IPSrc::Unspecified: -@@ -1403,7 +1457,7 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, +@@ -1439,7 +1494,7 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, case IPSrc::BIOS: case IPSrc::BMC: { @@ -156,27 +166,47 @@ index 09df184..8dc5677 100644 return responseSuccess(); } } -@@ -1540,7 +1594,8 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, +@@ -1464,7 +1519,8 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, + } + case LanParam::SubnetMask: + { +- if (channelCall(channel)) ++ std::string dhcpSetting = channelCall(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(channel)) ++ std::string dhcpSetting = channelCall(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(channel)) + std::string dhcp = channelCall(channel); -+ if ((dhcp == dhcpv4v6) | (dhcp == dhcpv6)) ++ if ((dhcp == dhcpv4v6) || (dhcp == dhcpv6)) { expected[IPv6RouterControlFlag::Dynamic] = 1; } -@@ -1690,7 +1745,8 @@ RspType getLan(uint4_t channelBits, uint3_t, bool revOnly, +@@ -1756,7 +1814,8 @@ RspType getLan(uint4_t channelBits, uint3_t, bool revOnly, case LanParam::IPSrc: { auto src = IPSrc::Static; - if (channelCall(channel)) -+ std::string dhcpSetting = channelCall(channel); -+ if ((dhcpSetting == dhcpv4) || (dhcpSetting == dhcpv4v6)) ++ std::string dhcp = channelCall(channel); ++ if ((dhcp == dhcpv4) || (dhcp == dhcpv4v6)) { src = IPSrc::DHCP; } -@@ -1811,7 +1867,8 @@ RspType getLan(uint4_t channelBits, uint3_t, bool revOnly, +@@ -1877,7 +1936,8 @@ RspType getLan(uint4_t channelBits, uint3_t, bool revOnly, case LanParam::IPv6RouterControl: { std::bitset<8> control; @@ -186,7 +216,7 @@ index 09df184..8dc5677 100644 { control[IPv6RouterControlFlag::Dynamic] = 1; } -@@ -1825,7 +1882,8 @@ RspType getLan(uint4_t channelBits, uint3_t, bool revOnly, +@@ -1891,7 +1951,8 @@ RspType getLan(uint4_t channelBits, uint3_t, bool revOnly, case LanParam::IPv6StaticRouter1IP: { in6_addr gateway{}; @@ -197,5 +227,5 @@ index 09df184..8dc5677 100644 gateway = channelCall>(channel).value_or( -- -2.21.0 +2.24.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Fixed-issue-in-setLan-command-for-IP-source.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Fixed-issue-in-setLan-command-for-IP-source.patch deleted file mode 100644 index 6f080a4f4..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Fixed-issue-in-setLan-command-for-IP-source.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 12ebdc2d53a18d286e34abf0f1553ca423ca6ca5 Mon Sep 17 00:00:00 2001 -From: Rajashekar Gade Reddy -Date: Wed, 18 Dec 2019 12:01:36 +0530 -Subject: [PATCH] Fixed issue in setLan command for IP source. - -Issue: returns success completion code for multiple requests which -is not correct as per IPMI spec. - -Fix: Added proper conditional checks - -Tested: -//IP Address Source: 0x0 (unspecified) -ipmitool -I lanplus -U root -P 0penBmc -H raw 0x0c 0x01 0x03 0x04 0x0 -0xCC// Invalid data field in request - -//IP Address Source: 0x1 (static address) -ipmitool -I lanplus -U root -P 0penBmc -H raw 0x0c 0x01 0x03 0x04 0x1 -0x00 //Success - -//IP Address Source: 0x2 (address obtained by BMC running DHCP) -ipmitool -I lanplus -U root -P 0penBmc -H raw 0x0c 0x01 0x03 0x04 0x2 -0x00 //Success - -//IP Address Source: 0x3 (address loaded by the BIOS or system software) -ipmitool -I lanplus -U root -P 0penBmc -H raw 0x0c 0x01 0x03 0x04 0x3 -0xCC// Invalid data field in request - -//IP Address Source: 0x4 (address obtained by BMC running other address assignment protocol) -ipmitool -I lanplus -U root -P 0penBmc -H raw 0x0c 0x01 0x03 0x04 0x4 -0xCC// Invalid data field in request - -ipmitool -I lanplus -U root -P 0penBmc -H raw 0x0c 0x01 0x03 0x04 0x5 -0x80 // param not supported - -Signed-off-by: Rajashekar Gade Reddy - -%% original patch: 0002-Fixed-issue-in-setLan-command-for-IP-source.patch ---- - transporthandler.cpp | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/transporthandler.cpp b/transporthandler.cpp -index 7407396..2df3e45 100644 ---- a/transporthandler.cpp -+++ b/transporthandler.cpp -@@ -1453,9 +1453,12 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - return responseSuccess(); - } - case IPSrc::Unspecified: -- case IPSrc::Static: - case IPSrc::BIOS: - case IPSrc::BMC: -+ { -+ return responseInvalidFieldRequest(); -+ } -+ case IPSrc::Static: - { - channelCall(channel, dhcpoff); - return responseSuccess(); --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-for-return-CC-in-setLan-command-cases.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-for-return-CC-in-setLan-command-cases.patch deleted file mode 100644 index bab451f32..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-for-return-CC-in-setLan-command-cases.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 8b3cb6842746d43c0cab3d32821dc5239768642f Mon Sep 17 00:00:00 2001 -From: "Joshi, Mansi" -Date: Wed, 18 Dec 2019 15:10:25 +0530 -Subject: [PATCH] Fix for return CC in setLan command cases - -Issue: When DHCP is enabled, setting ip and setting subnet mask returns -completion code 0xff. Setting default gateway returns 0x00. - -Fix: Returns CC 0xd5 because this parameter is R/W. It is only unable -to be updated because the current state blocks it (i.e. 0xd5). - -Tested: -ipmitool raw 0x0c 0x01 0x03 0x03 0x00 0x00 0x00 0x00 //setting ip -0xd5 //Command, or request parameter, not supported in present state. - -ipmitool raw 0x0c 0x01 0x03 0x06 0xff 0xff 0xf0 0x00 //subnet mask -0xd5 //Command, or request parameter, not supported in present state. - -ipmitool raw 0x0c 0x01 0x03 0x0c 0x0a 0xfe 0xef 0x77 //default gateway -0xd5 //Command, or request parameter, not supported in present state. - -%% original patch: 0065-Fix-for-return-CC-in-setLan-command-cases.patch ---- - transporthandler.cpp | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/transporthandler.cpp b/transporthandler.cpp -index 7407396..7b9ff3d 100644 ---- a/transporthandler.cpp -+++ b/transporthandler.cpp -@@ -1423,6 +1423,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - } - case LanParam::IP: - { -+ std::string dhcp = channelCall(channel); -+ if ((dhcp == dhcpv4) || (dhcp == dhcpv4v6)) -+ { -+ return responseCommandNotAvailable(); -+ } - in_addr ip; - std::array bytes; - if (req.unpack(bytes) != 0 || !req.fullyUnpacked()) -@@ -1477,6 +1482,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - } - case LanParam::SubnetMask: - { -+ std::string dhcp = channelCall(channel); -+ if ((dhcp == dhcpv4) || (dhcp == dhcpv4v6)) -+ { -+ return responseCommandNotAvailable(); -+ } - in_addr netmask; - std::array bytes; - if (req.unpack(bytes) != 0 || !req.fullyUnpacked()) -@@ -1490,6 +1500,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, - } - case LanParam::Gateway1: - { -+ std::string dhcp = channelCall(channel); -+ if ((dhcp == dhcpv4) || (dhcp == dhcpv4v6)) -+ { -+ return responseCommandNotAvailable(); -+ } - in_addr gateway; - std::array bytes; - if (req.unpack(bytes) != 0 || !req.fullyUnpacked()) --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch deleted file mode 100644 index c862a306a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch +++ /dev/null @@ -1,877 +0,0 @@ -From c20bc8eb6a08d177d951012eb91b37398b15d81d Mon Sep 17 00:00:00 2001 -From: Vernon Mauery -Date: Tue, 27 Nov 2018 11:01:15 -0800 -Subject: [PATCH] IPv6 Network changes - -Allow IPv6 IPMI set/get commands - -Signed-off-by: David Cobbley -Signed-off-by: Yong Li -Signed-off-by: Vernon Mauery - -Change-Id: If5528d3b7294c5f8c17db5919439235d0fad0446 ---- - include/ipmid/types.hpp | 9 + - include/ipmid/utils.hpp | 1 + - transporthandler.cpp | 654 +++++++++++++++++++++++++++++++++++++++- - transporthandler.hpp | 50 +++ - 4 files changed, 713 insertions(+), 1 deletion(-) - -Index: phosphor-host-ipmid.clean/include/ipmid/types.hpp -=================================================================== ---- phosphor-host-ipmid.clean.orig/include/ipmid/types.hpp -+++ phosphor-host-ipmid.clean/include/ipmid/types.hpp -@@ -224,6 +224,7 @@ constexpr auto ADDR_TYPE_FORMAT = "%hhx" - - constexpr auto IPV4_ADDRESS_SIZE_BYTE = 4; - constexpr auto IPV6_ADDRESS_SIZE_BYTE = 16; -+constexpr auto IPV6_ADDRESS_STATUS_SIZE = 22; - - constexpr auto DEFAULT_MAC_ADDRESS = "00:00:00:00:00:00"; - constexpr auto DEFAULT_ADDRESS = "0.0.0.0"; -@@ -235,6 +236,7 @@ constexpr auto BITS_32 = 32; - constexpr auto MASK_32_BIT = 0xFFFFFFFF; - constexpr auto VLAN_ID_MASK = 0x00000FFF; - constexpr auto VLAN_ENABLE_MASK = 0x8000; -+constexpr auto IPV6_DUID_SIZE = 18; - - enum class IPOrigin : uint8_t - { -@@ -243,5 +245,12 @@ enum class IPOrigin : uint8_t - DHCP = 2, - }; - -+enum class AddressingEnables : uint8_t -+{ -+ IPv4Only = 0, -+ IPv6Only = 1, -+ IPv4AndIPv6 = 2, -+}; -+ - } // namespace network - } // namespace ipmi -Index: phosphor-host-ipmid.clean/include/ipmid/utils.hpp -=================================================================== ---- phosphor-host-ipmid.clean.orig/include/ipmid/utils.hpp -+++ phosphor-host-ipmid.clean/include/ipmid/utils.hpp -@@ -256,6 +256,7 @@ namespace network - constexpr auto ROOT = "/xyz/openbmc_project/network"; - constexpr auto SERVICE = "xyz.openbmc_project.Network"; - constexpr auto IP_TYPE = "ipv4"; -+constexpr auto IPV6_TYPE = "ipv6"; - constexpr auto IPV4_PREFIX = "169.254"; - constexpr auto IPV6_PREFIX = "fe80"; - constexpr auto IP_INTERFACE = "xyz.openbmc_project.Network.IP"; -Index: phosphor-host-ipmid.clean/transporthandler.cpp -=================================================================== ---- phosphor-host-ipmid.clean.orig/transporthandler.cpp -+++ phosphor-host-ipmid.clean/transporthandler.cpp -@@ -29,6 +29,12 @@ std::unique_ptr network - - const int SIZE_MAC = 18; // xx:xx:xx:xx:xx:xx - constexpr auto ipv4Protocol = "xyz.openbmc_project.Network.IP.Protocol.IPv4"; -+constexpr auto ipv6Protocol = "xyz.openbmc_project.Network.IP.Protocol.IPv6"; -+ -+static const std::array ipAddressEnablesType = { -+ "xyz.openbmc_project.Network.EthernetInterface.IPAllowed.IPv4Only", -+ "xyz.openbmc_project.Network.EthernetInterface.IPAllowed.IPv6Only", -+ "xyz.openbmc_project.Network.EthernetInterface.IPAllowed.IPv4AndIPv6"}; - - std::map> channelConfig; - -@@ -445,6 +451,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n - { - case LanParam::IP: - { -+ if (reqLen != lanParamIPSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ - std::snprintf(ipaddr, INET_ADDRSTRLEN, - ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], - reqptr->data[1], reqptr->data[2], reqptr->data[3]); -@@ -455,6 +466,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n - - case LanParam::IPSRC: - { -+ if (reqLen != lanParamIPSrcSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ - uint8_t ipsrc{}; - std::memcpy(&ipsrc, reqptr->data, ipmi::network::IPSRC_SIZE_BYTE); - channelConf->ipsrc = static_cast(ipsrc); -@@ -463,6 +479,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n - - case LanParam::MAC: - { -+ if (reqLen != lanParamMACSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ - char mac[SIZE_MAC]; - - std::snprintf(mac, SIZE_MAC, ipmi::network::MAC_ADDRESS_FORMAT, -@@ -483,6 +504,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n - - case LanParam::SUBNET: - { -+ if (reqLen != lanParamSubnetSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ - std::snprintf(netmask, INET_ADDRSTRLEN, - ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], - reqptr->data[1], reqptr->data[2], reqptr->data[3]); -@@ -492,6 +518,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n - - case LanParam::GATEWAY: - { -+ if (reqLen != lanParamGatewaySize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ - std::snprintf(gateway, INET_ADDRSTRLEN, - ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], - reqptr->data[1], reqptr->data[2], reqptr->data[3]); -@@ -522,6 +553,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n - - case LanParam::INPROGRESS: - { -+ if (reqLen != lanParamInProgressSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ - if (reqptr->data[0] == SET_COMPLETE) - { - channelConf->lan_set_in_progress = SET_COMPLETE; -@@ -540,6 +576,122 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n - } - break; - -+ case LanParam::IPV6_AND_IPV4_ENABLES: -+ { -+ if (reqLen != lanParamIPv6AndIPv4EnablesSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ channelConf->ipv6AddressingEnables = reqptr->data[0]; -+ break; -+ } -+ -+ case LanParam::IPV6_STATIC_ADDRESSES: -+ { -+ if (reqLen != lanParamIPv6StaticAddressesSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ channelConf->ipv6AddressSource = -+ reqptr->data[1] & 0x81; // Looking at bit 0 and bit 7 -+ char tmpIPV6[INET6_ADDRSTRLEN]; -+ inet_ntop(AF_INET6, &reqptr->data[2], tmpIPV6, INET6_ADDRSTRLEN); -+ channelConf->ipv6Addr.assign(tmpIPV6); -+ channelConf->ipv6Prefix = reqptr->data[19]; -+ break; -+ } -+ -+ case LanParam::IPV6_ROUTER_ADDRESS_CONF_CTRL: -+ { -+ if (reqLen != lanParamIPv6RouterAddressConfCtrlSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ channelConf->ipv6RouterAddressConfigControl = reqptr->data[0]; -+ break; -+ } -+ -+ case LanParam::IPV6_STATIC_ROUTER_1_IP_ADDR: -+ { -+ if (reqLen != lanParamIPv6StaticRouter1IPAddrSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ char tmpIPV6[INET6_ADDRSTRLEN]; -+ inet_ntop(AF_INET6, reinterpret_cast(reqptr->data), -+ tmpIPV6, INET6_ADDRSTRLEN); -+ channelConf->ipv6GatewayAddr.assign(tmpIPV6); -+ break; -+ } -+ -+ case LanParam::IPV6_STATIC_ROUTER_1_PREFIX_LEN: -+ { -+ if (reqLen != lanParamIPv6StaticRouter1PrefixLenSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ channelConf->ipv6GatewayPrefixLength = reqptr->data[0]; -+ break; -+ } -+ -+ case LanParam::IPV6_STATIC_ROUTER_1_PREFIX_VAL: -+ { -+ if (reqLen != lanParamIPv6StaticRouter1PrefixValSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ char tmpIPV6[INET6_ADDRSTRLEN]; -+ inet_ntop(AF_INET6, reinterpret_cast(reqptr->data), -+ tmpIPV6, INET6_ADDRSTRLEN); -+ channelConf->ipv6GatewayPrefixValue.assign(tmpIPV6); -+ break; -+ } -+ -+ case LanParam::IPV6_STATIC_ROUTER_2_IP_ADDR: -+ { -+ if (reqLen != lanParamIPv6StaticRouter2IPAddrSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ char tmpIPV6[INET6_ADDRSTRLEN]; -+ inet_ntop(AF_INET6, reinterpret_cast(reqptr->data), -+ tmpIPV6, INET6_ADDRSTRLEN); -+ channelConf->ipv6BackupGatewayAddr.assign(tmpIPV6); -+ break; -+ } -+ -+ case LanParam::IPV6_STATIC_ROUTER_2_PREFIX_LEN: -+ { -+ if (reqLen != lanParamIPv6StaticRouter2PrefixLenSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ channelConf->ipv6BackupGatewayPrefixLength = reqptr->data[0]; -+ break; -+ } -+ -+ case LanParam::IPV6_STATIC_ROUTER_2_PREFIX_VAL: -+ { -+ if (reqLen != lanParamIPv6StaticRouter2PrefixValSize) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ -+ char tmpIPV6[INET6_ADDRSTRLEN]; -+ inet_ntop(AF_INET6, reinterpret_cast(reqptr->data), -+ tmpIPV6, INET6_ADDRSTRLEN); -+ channelConf->ipv6BackupGatewayPrefixValue.assign(tmpIPV6); -+ break; -+ } -+ - default: - { - rc = IPMI_CC_PARM_NOT_SUPPORTED; -@@ -568,6 +720,7 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_n - ipmi_ret_t rc = IPMI_CC_OK; - *data_len = 0; - const uint8_t current_revision = 0x11; // Current rev per IPMI Spec 2.0 -+ sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; - - get_lan_t* reqptr = (get_lan_t*)request; - // channel number is the lower nibble -@@ -713,6 +866,476 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_n - static_cast(cipherList.size()); - break; - } -+ case LanParam::IPV6_AND_IPV4_SUPPORTED: -+ { -+ uint8_t addressSupport = -+ 0x1; // Allow both IPv4 & IPv6 simultaneously -+ std::array buf = {current_revision, addressSupport}; -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_AND_IPV4_ENABLES: -+ { -+ // If DHCP, check if you have an ipv6 and ipv4 address. If static -+ // return not supported -+ -+ // 00h check if conf DHCP == ipv4 or off -+ // 01h check if conf DHCP == ipv6 -+ // 02h check if DHCP == true -+ -+ auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE; -+ std::string networkInterfacePath; -+ uint8_t ipVAddressEnables = 0; -+ -+ if (channelConf->lan_set_in_progress == SET_COMPLETE) -+ { -+ try -+ { -+ ipmi::ObjectTree ancestorMap; -+ // if the system has an ip object,then -+ // get the IP object. -+ auto ipObject = -+ ipmi::getDbusObject(bus, ipmi::network::IP_INTERFACE, -+ ipmi::network::ROOT, ethIP); -+ // Get the parent interface of the IP object. -+ try -+ { -+ ipmi::InterfaceList interfaces; -+ interfaces.emplace_back( -+ ipmi::network::ETHERNET_INTERFACE); -+ -+ ancestorMap = ipmi::getAllAncestors( -+ bus, ipObject.first, std::move(interfaces)); -+ } -+ catch (InternalFailure& e) -+ { -+ // if unable to get the parent interface -+ // then commit the error and return. -+ log( -+ "Unable to get the parent interface", -+ entry("PATH=%s", ipObject.first.c_str()), -+ entry("INTERFACE=%s", -+ ipmi::network::ETHERNET_INTERFACE)); -+ return IPMI_CC_UNSPECIFIED_ERROR; -+ } -+ // for an ip object there would be single parent -+ // interface. -+ networkInterfacePath = ancestorMap.begin()->first; -+ } -+ catch (InternalFailure& e) -+ { -+ // if there is no ip configured on the system,then -+ // get the network interface object. -+ auto networkInterfaceObject = ipmi::getDbusObject( -+ bus, ipmi::network::ETHERNET_INTERFACE, -+ ipmi::network::ROOT, ethdevice); -+ -+ networkInterfacePath = networkInterfaceObject.first; -+ } -+ -+ ipmi::Value ipEnablesProp = ipmi::getDbusProperty( -+ bus, ipmi::network::SERVICE, networkInterfacePath, -+ ipmi::network::ETHERNET_INTERFACE, "IPAddressEnables"); -+ std::string ipEnables = std::get(ipEnablesProp); -+ -+ // check if on off ipv4 ipv6, etc. -+ bool found = false; -+ for (uint8_t ii = 0; ii < ipAddressEnablesType.size(); ii++) -+ { -+ if (ipEnables == ipAddressEnablesType[ii]) -+ { -+ ipVAddressEnables = ii; -+ found = true; -+ break; -+ } -+ } -+ if (!found) -+ { -+ return IPMI_CC_PARM_NOT_SUPPORTED; -+ } -+ } -+ else -+ { -+ ipVAddressEnables = channelConf->ipv6AddressingEnables; -+ } -+ -+ std::array buf = {current_revision, ipVAddressEnables}; -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_STATUS: -+ { -+ // Number of IPV6 addresses that are supported -+ constexpr std::array statusData = {1, 1, 3}; -+ -+ std::array buf = {current_revision, statusData[0], -+ statusData[1], statusData[2]}; -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_STATIC_ADDRESSES: -+ { -+ // Only return set selector 0 -+ uint8_t ipv6SetSelector = 0; -+ std::string ipaddress; -+ auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE; -+ uint8_t ipv6AddressSource = 0; -+ uint8_t prefixLength = 0; -+ uint8_t status = 0; -+ if (channelConf->lan_set_in_progress == SET_COMPLETE) -+ { -+ try -+ { -+ auto ipObjectInfo = -+ ipmi::getIPObject(bus, ipmi::network::IP_INTERFACE, -+ ipmi::network::ROOT, ethIP); -+ -+ auto properties = ipmi::getAllDbusProperties( -+ bus, ipObjectInfo.second, ipObjectInfo.first, -+ ipmi::network::IP_INTERFACE); -+ -+ if (std::get(properties["Origin"]) == -+ "xyz.openbmc_project.Network.IP.AddressOrigin.Static") -+ { -+ ipaddress = -+ std::get(properties["Address"]); -+ ipv6AddressSource = 0x81; // Looking at bit 0 and bit 7 -+ prefixLength = -+ std::get(properties["PrefixLength"]); -+ status = 0; -+ } -+ } -+ // ignore the exception, as it is a valid condition that -+ // the system is not configured with any IP. -+ catch (InternalFailure& e) -+ { -+ // nothing to do. -+ } -+ } -+ else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS) -+ { -+ ipv6AddressSource = channelConf->ipv6AddressSource; -+ ipaddress = channelConf->ipv6Addr.c_str(); -+ prefixLength = channelConf->ipv6Prefix; -+ status = 1; -+ } -+ -+ std::array buf = { -+ current_revision, ipv6SetSelector, ipv6AddressSource}; -+ inet_pton(AF_INET6, ipaddress.c_str(), -+ reinterpret_cast(&buf[3])); -+ buf[20] = prefixLength; -+ buf[21] = status; -+ -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_DHCPV6_STATIC_DUID_STORAGE_LENGTH: -+ { -+ // DHCP unique identified -+ // Only 1 read-only 16-byte Block needed -+ uint8_t duidLength = 1; -+ std::array buf = {current_revision, duidLength}; -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_DHCPV6_STATIC_DUIDS: -+ { -+ std::string macAddress; -+ if (channelConf->lan_set_in_progress == SET_COMPLETE) -+ { -+ auto macObjectInfo = -+ ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE, -+ ipmi::network::ROOT, ethdevice); -+ -+ auto variant = ipmi::getDbusProperty( -+ bus, macObjectInfo.second, macObjectInfo.first, -+ ipmi::network::MAC_INTERFACE, "MACAddress"); -+ -+ macAddress = std::get(variant); -+ } -+ else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS) -+ { -+ macAddress = channelConf->macAddress; -+ } -+ -+ std::array -+ buf; -+ buf = {current_revision, -+ reqptr->parameter_set, -+ reqptr->parameter_block, -+ DUID_LEN, -+ 0, // Filler byte -+ DUID_LL_TYPE, -+ 0, // Filler byte -+ DUIC_ETH_HW_TYPE}; -+ sscanf(macAddress.c_str(), ipmi::network::MAC_ADDRESS_FORMAT, -+ (&buf[8]), (&buf[9]), (&buf[10]), (&buf[11]), (&buf[12]), -+ (&buf[13])); -+ -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_DYNAMIC_ADDRESSES: -+ { -+ std::string ipaddress; -+ uint8_t ipv6AddressSource = 0; -+ uint8_t prefixLength = 0; -+ uint8_t status = 0; -+ auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE; -+ -+ if (channelConf->lan_set_in_progress == SET_COMPLETE) -+ { -+ try -+ { -+ auto ipObjectInfo = -+ ipmi::getIPObject(bus, ipmi::network::IP_INTERFACE, -+ ipmi::network::ROOT, ethIP); -+ -+ auto properties = ipmi::getAllDbusProperties( -+ bus, ipObjectInfo.second, ipObjectInfo.first, -+ ipmi::network::IP_INTERFACE); -+ -+ if (std::get(properties["Origin"]) == -+ "xyz.openbmc_project.Network.IP.AddressOrigin.DHCP") -+ { -+ ipaddress = -+ std::get(properties["Address"]); -+ ipv6AddressSource = 0x81; // Looking at bit 0 and bit 7 -+ prefixLength = -+ std::get(properties["PrefixLength"]); -+ status = 0; -+ } -+ else -+ { -+ status = 1; -+ } -+ } -+ // ignore the exception, as it is a valid condition that -+ // the system is not configured with any IP. -+ catch (InternalFailure& e) -+ { -+ // nothing to do. -+ } -+ } -+ else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS) -+ { -+ ipaddress = channelConf->ipv6Addr; -+ ipv6AddressSource = channelConf->ipv6AddressSource; -+ prefixLength = channelConf->ipv6Prefix; -+ status = channelConf->ipv6AddressStatus; -+ } -+ -+ uint8_t ipv6SetSelector = 0; -+ std::array buf = {current_revision, ipv6SetSelector, -+ ipv6AddressSource}; -+ inet_pton(AF_INET6, ipaddress.c_str(), -+ reinterpret_cast(&buf[3])); -+ buf[20] = prefixLength; -+ buf[21] = status; -+ -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_DHCPV6_DYNAMIC_DUID_STOR_LEN: -+ { -+ uint8_t duidLength = 0; -+ // Only 1 read-only 16-byte Block needed -+ duidLength = 1; -+ -+ std::array buf = {current_revision, duidLength}; -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_DHCPV6_DYNAMIC_DUIDS: -+ { -+ std::string macAddress; -+ if (channelConf->lan_set_in_progress == SET_COMPLETE) -+ { -+ auto macObjectInfo = -+ ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE, -+ ipmi::network::ROOT, ethdevice); -+ -+ auto variant = ipmi::getDbusProperty( -+ bus, macObjectInfo.second, macObjectInfo.first, -+ ipmi::network::MAC_INTERFACE, "MACAddress"); -+ -+ macAddress = std::get(variant); -+ } -+ else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS) -+ { -+ macAddress = channelConf->macAddress; -+ } -+ -+ std::array -+ buf; -+ buf = {current_revision, -+ reqptr->parameter_set, -+ reqptr->parameter_block, -+ DUID_LEN, -+ 0, // Filler byte -+ DUID_LL_TYPE, -+ 0, // Filler byte -+ DUIC_ETH_HW_TYPE}; -+ -+ sscanf(macAddress.c_str(), ipmi::network::MAC_ADDRESS_FORMAT, -+ (&buf[8]), (&buf[9]), (&buf[10]), (&buf[11]), (&buf[12]), -+ (&buf[13])); -+ -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_ROUTER_ADDRESS_CONF_CTRL: -+ { -+ // Determine if automated router discovery occurs when static -+ // addresses are used for the bmc -+ -+ auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE; -+ std::string networkInterfacePath; -+ uint8_t dynamicRA; -+ if (channelConf->lan_set_in_progress == SET_COMPLETE) -+ { -+ -+ try -+ { -+ ipmi::ObjectTree ancestorMap; -+ // if the system is having ip object,then -+ // get the IP object. -+ auto ipObject = -+ ipmi::getDbusObject(bus, ipmi::network::IP_INTERFACE, -+ ipmi::network::ROOT, ethIP); -+ -+ // Get the parent interface of the IP object. -+ try -+ { -+ ipmi::InterfaceList interfaces; -+ interfaces.emplace_back( -+ ipmi::network::ETHERNET_INTERFACE); -+ -+ ancestorMap = ipmi::getAllAncestors( -+ bus, ipObject.first, std::move(interfaces)); -+ } -+ catch (InternalFailure& e) -+ { -+ // if unable to get the parent interface -+ // then commit the error and return. -+ log( -+ "Unable to get the parent interface", -+ entry("PATH=%s", ipObject.first.c_str()), -+ entry("INTERFACE=%s", -+ ipmi::network::ETHERNET_INTERFACE)); -+ return IPMI_CC_UNSPECIFIED_ERROR; -+ } -+ // for an ip object there would be single parent -+ // interface. -+ networkInterfacePath = ancestorMap.begin()->first; -+ } -+ catch (InternalFailure& e) -+ { -+ // if there is no ip configured on the system,then -+ // get the network interface object. -+ auto networkInterfaceObject = ipmi::getDbusObject( -+ bus, ipmi::network::ETHERNET_INTERFACE, -+ ipmi::network::ROOT, ethdevice); -+ -+ networkInterfacePath = networkInterfaceObject.first; -+ } -+ -+ auto variant = ipmi::getDbusProperty( -+ bus, ipmi::network::SERVICE, networkInterfacePath, -+ ipmi::network::ETHERNET_INTERFACE, "IPv6AcceptRA"); -+ dynamicRA = std::get(variant); -+ } -+ else -+ { -+ dynamicRA = channelConf->ipv6RouterAddressConfigControl; -+ } -+ -+ std::array buf = {current_revision, dynamicRA}; -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_STATIC_ROUTER_1_IP_ADDR: -+ { -+ std::array -+ buf = {current_revision}; -+ inet_pton(AF_INET6, channelConf->ipv6GatewayAddr.c_str(), -+ reinterpret_cast(&buf[1])); -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_STATIC_ROUTER_1_PREFIX_LEN: -+ { -+ std::array buf = {current_revision, -+ channelConf->ipv6GatewayPrefixLength}; -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_STATIC_ROUTER_1_PREFIX_VAL: -+ { -+ constexpr uint8_t setSelector = 0; -+ std::array -+ buf = {current_revision, setSelector}; -+ -+ inet_pton(AF_INET6, channelConf->ipv6GatewayPrefixValue.c_str(), -+ reinterpret_cast(&buf[2])); -+ -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_STATIC_ROUTER_2_IP_ADDR: -+ { -+ std::array -+ buf = {current_revision}; -+ inet_pton(AF_INET6, channelConf->ipv6BackupGatewayAddr.c_str(), -+ reinterpret_cast(&buf[1])); -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_STATIC_ROUTER_2_PREFIX_LEN: -+ { -+ std::array buf = { -+ current_revision, channelConf->ipv6BackupGatewayPrefixLength}; -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } -+ case LanParam::IPV6_STATIC_ROUTER_2_PREFIX_VAL: -+ { -+ -+ constexpr uint8_t setSelector = 0; -+ std::array -+ buf = {current_revision, setSelector}; -+ inet_pton(AF_INET6, -+ channelConf->ipv6BackupGatewayPrefixValue.c_str(), -+ reinterpret_cast(&buf[2])); -+ -+ std::copy(buf.begin(), buf.end(), static_cast(response)); -+ *data_len = buf.size(); -+ break; -+ } - default: - log("Unsupported parameter", - entry("PARAMETER=0x%x", reqptr->parameter)); -@@ -957,6 +1580,16 @@ void applyChanges(int channel) - ipaddress, prefix); - } - -+ if (!channelConf->ipv6Addr.empty() && -+ channelConf->ipv6AddressSource == -+ 0x80) // Check if IPv6 static addresses are enabled -+ { -+ ipmi::network::createIP(bus, ipmi::network::SERVICE, -+ networkInterfacePath, ipv6Protocol, -+ channelConf->ipv6Addr, -+ channelConf->ipv6Prefix); -+ } -+ - if (!gateway.empty()) - { - ipmi::setDbusProperty(bus, systemObject.second, -@@ -964,7 +1597,24 @@ void applyChanges(int channel) - ipmi::network::SYSTEMCONFIG_INTERFACE, - "DefaultGateway", std::string(gateway)); - } -+ else if (!channelConf->ipv6GatewayAddr.empty()) -+ { -+ ipmi::setDbusProperty( -+ bus, systemObject.second, systemObject.first, -+ ipmi::network::SYSTEMCONFIG_INTERFACE, "DefaultGateway", -+ std::string(channelConf->ipv6GatewayAddr)); -+ } - } -+ // set IPAddress Enables -+ ipmi::setDbusProperty( -+ bus, ipmi::network::SERVICE, networkInterfaceObject.first, -+ ipmi::network::ETHERNET_INTERFACE, "IPAddressEnables", -+ ipAddressEnablesType[channelConf->ipv6AddressingEnables]); -+ -+ ipmi::setDbusProperty( -+ bus, ipmi::network::SERVICE, networkInterfaceObject.first, -+ ipmi::network::ETHERNET_INTERFACE, "IPv6AcceptRA", -+ (bool)channelConf->ipv6RouterAddressConfigControl); - } - catch (sdbusplus::exception::exception& e) - { -Index: phosphor-host-ipmid.clean/transporthandler.hpp -=================================================================== ---- phosphor-host-ipmid.clean.orig/transporthandler.hpp -+++ phosphor-host-ipmid.clean/transporthandler.hpp -@@ -79,8 +79,27 @@ enum class LanParam : uint8_t - IPV6_NEIGHBOR_TIMING_CONFIGURATION = 80, - }; - -+constexpr uint8_t DUID_LEN = 10; -+constexpr uint8_t DUID_LL_TYPE = 3; -+constexpr uint8_t DUIC_ETH_HW_TYPE = 1; -+ - // Data length of parameters - constexpr size_t lanParamVLANSize = 4; -+constexpr size_t lanParamInProgressSize = 3; -+constexpr size_t lanParamIPSize = 6; -+constexpr size_t lanParamIPSrcSize = 3; -+constexpr size_t lanParamMACSize = 8; -+constexpr size_t lanParamSubnetSize = 6; -+constexpr size_t lanParamGatewaySize = 6; -+constexpr size_t lanParamIPv6AndIPv4EnablesSize = 3; -+constexpr size_t lanParamIPv6StaticAddressesSize = 23; -+constexpr size_t lanParamIPv6RouterAddressConfCtrlSize = 3; -+constexpr size_t lanParamIPv6StaticRouter1IPAddrSize = 18; -+constexpr size_t lanParamIPv6StaticRouter1PrefixLenSize = 3; -+constexpr size_t lanParamIPv6StaticRouter1PrefixValSize = 19; -+constexpr size_t lanParamIPv6StaticRouter2IPAddrSize = 18; -+constexpr size_t lanParamIPv6StaticRouter2PrefixLenSize = 3; -+constexpr size_t lanParamIPv6StaticRouter2PrefixValSize = 19; - constexpr uint8_t SET_COMPLETE = 0; - constexpr uint8_t SET_IN_PROGRESS = 1; - constexpr uint8_t SET_COMMIT_WRITE = 2; // Optional -@@ -103,6 +122,20 @@ struct ChannelConfig_t - uint8_t lan_set_in_progress = SET_COMPLETE; - bool flush = false; - -+ // IPV6 parameters -+ uint8_t ipv6AddressSource = 0x0; -+ uint8_t ipv6AddressingEnables = 0x2; -+ std::string ipv6Addr; -+ uint8_t ipv6Prefix = 32; -+ uint8_t ipv6AddressStatus = 0x0; -+ uint8_t ipv6RouterAddressConfigControl = 0x0; -+ std::string ipv6GatewayAddr; -+ std::string ipv6BackupGatewayAddr; -+ uint8_t ipv6GatewayPrefixLength; -+ std::string ipv6GatewayPrefixValue; -+ uint8_t ipv6BackupGatewayPrefixLength = 0x0; -+ std::string ipv6BackupGatewayPrefixValue; -+ - void clear() - { - ipaddr.clear(); -@@ -113,6 +146,20 @@ struct ChannelConfig_t - ipsrc = ipmi::network::IPOrigin::UNSPECIFIED; - lan_set_in_progress = SET_COMPLETE; - flush = false; -+ -+ // IPv6 -+ ipv6Addr.clear(); -+ ipv6GatewayAddr.clear(); -+ ipv6BackupGatewayAddr.clear(); -+ ipv6AddressingEnables = 0x2; -+ ipv6AddressSource = 0x0; -+ ipv6Prefix = 32; -+ ipv6AddressStatus = 0x0; -+ ipv6RouterAddressConfigControl = 0x0; -+ ipv6GatewayPrefixLength = 0x0; -+ ipv6GatewayPrefixValue.clear(); -+ ipv6BackupGatewayPrefixLength = 0x0; -+ ipv6BackupGatewayPrefixValue.clear(); - } - }; - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0010-fix-get-system-GUID-ipmi-command.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0010-fix-get-system-GUID-ipmi-command.patch index efee7cc26..ccf326a91 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0010-fix-get-system-GUID-ipmi-command.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0010-fix-get-system-GUID-ipmi-command.patch @@ -1,22 +1,24 @@ -commit 72e6573f36fd3b9ce018e71b07bc1be63275d1f8 -Author: Vernon Mauery -Date: Fri Jun 21 12:27:20 2019 -0700 +From c1925ab965271875d4e9333be85cdfe8e1516948 Mon Sep 17 00:00:00 2001 +From: Vernon Mauery +Date: Fri, 14 Feb 2020 13:13:06 -0800 +Subject: [PATCH] Fix 'Get System GUID' to use settings UUID - Fix 'Get System GUID' to use settings UUID - - The upstream Get System GUID command looks first for a BMC interface - and then assumes that the UUID interface is next to that. But that is - not the case on Intel systems where the system GUID is found in the - settings daemon. - - Change-Id: I924bd05e0a546f2b30288c1faf72157296ab6579 - Signed-off-by: Vernon Mauery +The upstream Get System GUID command looks first for a BMC interface +and then assumes that the UUID interface is next to that. But that is +not the case on Intel systems where the system GUID is found in the +settings daemon. + +Change-Id: I924bd05e0a546f2b30288c1faf72157296ab6579 +Signed-off-by: Vernon Mauery +--- + apphandler.cpp | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apphandler.cpp b/apphandler.cpp -index 280d0db..25af6bb 100644 +index dcfda11..780afbc 100644 --- a/apphandler.cpp +++ b/apphandler.cpp -@@ -799,8 +799,6 @@ auto ipmiAppGetBtCapabilities() +@@ -784,8 +784,6 @@ auto ipmiAppGetBtCapabilities() auto ipmiAppGetSystemGuid() -> ipmi::RspType> { @@ -25,7 +27,7 @@ index 280d0db..25af6bb 100644 static constexpr auto uuidInterface = "xyz.openbmc_project.Common.UUID"; static constexpr auto uuidProperty = "UUID"; -@@ -809,7 +807,7 @@ auto ipmiAppGetSystemGuid() -> ipmi::RspType> +@@ -794,7 +792,7 @@ auto ipmiAppGetSystemGuid() -> ipmi::RspType> { // Get the Inventory object implementing BMC interface auto busPtr = getSdBus(); @@ -34,3 +36,6 @@ index 280d0db..25af6bb 100644 // Read UUID property value from bmcObject // UUID is in RFC4122 format Ex: 61a39523-78f2-11e5-9862-e6402cfc3223 +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0054-Fix-User-commands-require-channel-layer-lib.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0054-Fix-User-commands-require-channel-layer-lib.patch deleted file mode 100644 index bf6f672cf..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0054-Fix-User-commands-require-channel-layer-lib.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 5d0c9d2217dbe369daffb8a92d7b5e7d7d34d566 Mon Sep 17 00:00:00 2001 -From: Richard Marian Thomaiyar -Date: Sat, 2 Mar 2019 20:08:32 +0530 -Subject: [PATCH] Fix: User commands require channel layer lib - -As channel layer is separated out from user layer lib, it -has to be manually included in libusercommands, as user -command handlers use channel layer API's - -Tested-by: -1. Made sure that libusercommands are loaded on it's own -without any undefined symbol error. -2. ipmitool user list 1 works on host interface - -Change-Id: I6652ad248e01afc1349e3a9612754dbdb84b96ad -Signed-off-by: Richard Marian Thomaiyar ---- - Makefile.am | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index bb7bdbf..4e9101e 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -120,7 +120,8 @@ libipmi20_la_CXXFLAGS = $(COMMON_CXX) - providers_LTLIBRARIES += libusercmds.la - libusercmds_la_LIBADD = \ - libipmid/libipmid.la \ -- user_channel/libuserlayer.la -+ user_channel/libuserlayer.la \ -+ user_channel/libchannellayer.la - libusercmds_la_SOURCES = \ - user_channel/usercommands.cpp - libusercmds_la_LDFLAGS = \ --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch index 6c61e0995..96e45cad3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch @@ -1,12 +1,14 @@ -From 959030b7ee71a7b23d1c081a0aadaa4eedbc0f63 Mon Sep 17 00:00:00 2001 +From 92bdbcd90a445e49ba2f8e483d44ec41152d32b4 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Mon, 3 Jun 2019 17:01:47 -0700 Subject: [PATCH] Update IPMI Chassis Control command This change updates the IPMI Chassis Control command to use the new -chassis state transitions. This allows each chassis control action +host state transitions. This allows each chassis control action to more closely follow the behavior defined in the IPMI spec. +ref: https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/22358 + Tested: Ran each IPMI chassis control command to confirm the expected behavior: @@ -19,11 +21,11 @@ ipmitool power soft: soft power-off requested from system software Change-Id: Ic9fba3ca4abd9a758eb88f1e6ee09f7ca64ff80a Signed-off-by: Jason M. Bills --- - chassishandler.cpp | 205 +++++++++++++---------------------------------------- - 1 file changed, 50 insertions(+), 155 deletions(-) + chassishandler.cpp | 206 +++++++++++++---------------------------------------- + 1 file changed, 50 insertions(+), 156 deletions(-) diff --git a/chassishandler.cpp b/chassishandler.cpp -index 053f29a..53b25b8 100644 +index 0326806..8bfab88 100644 --- a/chassishandler.cpp +++ b/chassishandler.cpp @@ -31,6 +31,7 @@ @@ -34,7 +36,7 @@ index 053f29a..53b25b8 100644 #include #include -@@ -712,59 +713,63 @@ ipmi::RspType<> ipmiSetChassisCap(bool intrusion, bool fpLockout, +@@ -717,59 +718,63 @@ ipmi::RspType<> ipmiSetChassisCap(bool intrusion, bool fpLockout, //------------------------------------------ // Calls into Host State Manager Dbus object //------------------------------------------ @@ -108,10 +110,11 @@ index 053f29a..53b25b8 100644 - HOST_STATE_MANAGER_IFACE, PROPERTY, "s", - request.c_str()); - if (rc < 0) -+ try - { +- { - log("Failed to initiate transition", - entry("ERRNO=0x%X, REQUEST=%s", -rc, request.c_str())); ++ try ++ { + ipmi::setDbusProperty(*getSdBus(), service, chassisStatePath, + chassisStateIntf, "RequestedPowerTransition", + request); @@ -134,7 +137,7 @@ index 053f29a..53b25b8 100644 } //------------------------------------------ -@@ -1065,76 +1070,6 @@ ipmi::RspType ipmiChassisControl(uint8_t chassisControl) +@@ -1153,63 +1088,22 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) switch (chassisControl) { case CMD_POWER_ON: @@ -256,8 +259,8 @@ index 053f29a..53b25b8 100644 break; - case CMD_HARD_RESET: -+ rc = initiateChassisStateTransition( -+ State::Chassis::Transition::Reset); ++ rc = initiateHostStateTransition( ++ State::Host::Transition::ForceWarmReboot); + break; case CMD_POWER_CYCLE: - // SPEC has a section that says certain implementations can trigger @@ -271,8 +274,7 @@ index 053f29a..53b25b8 100644 - indicate_no_softoff_needed(); - - rc = initiate_state_transition(State::Host::Transition::Reboot); -+ rc = initiateChassisStateTransition( -+ State::Chassis::Transition::PowerCycle); ++ rc = initiateHostStateTransition(State::Host::Transition::Reboot); break; - case CMD_SOFT_OFF_VIA_OVER_TEMP: diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Update-provisioning-mode-filter-logic.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Update-provisioning-mode-filter-logic.patch deleted file mode 100644 index 5cd8b3ec4..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Update-provisioning-mode-filter-logic.patch +++ /dev/null @@ -1,301 +0,0 @@ -From dcfce847654bd7e2475ad74bedf569b6120701dd Mon Sep 17 00:00:00 2001 -From: Richard Marian Thomaiyar -Date: Tue, 18 Jun 2019 19:42:30 +0530 -Subject: [PATCH 1/1] Update provisioning mode filter logic - -Updated provisioning mode filtering logic support. Based on the -RestrictionMode property, Host (system) interface commands will be -filtered as per the allowed list in ProvisionedHostWhitelist once -POST complete is achieved. No commands will be allowed in -ProvisionedHostDisabled after POST complete and in all other cases -filterning logic will not be applied. - -Tested -1. Verified the filtering logic through EFI shell and made sure -filtering logic is applied when RestrictionMode is in -ProvisionedHostWhitelist mode -2. Verified no filtering logic is applied in normal modes -3. Made sure BIOS is able to execute commands, which are not in -whitelist (Note: New whitelist conf is under review). - -Change-Id: I7a14e827d70e2d8d6975e600a0fd00e2a790bc22 -Signed-off-by: Richard Marian Thomaiyar -Signed-off-by: James Feist ---- - whitelist-filter.cpp | 191 ++++++++++++++++++++++++++++++------------- - 1 file changed, 136 insertions(+), 55 deletions(-) - -diff --git a/whitelist-filter.cpp b/whitelist-filter.cpp -index 9f1e7c8..53461b4 100644 ---- a/whitelist-filter.cpp -+++ b/whitelist-filter.cpp -@@ -25,6 +25,7 @@ namespace - */ - class WhitelistFilter - { -+ - public: - WhitelistFilter(); - ~WhitelistFilter() = default; -@@ -35,17 +36,24 @@ class WhitelistFilter - - private: - void postInit(); -- void cacheRestrictedMode(); -+ void cacheRestrictedAndPostCompleteMode(); - void handleRestrictedModeChange(sdbusplus::message::message& m); -+ void handlePostCompleteChange(sdbusplus::message::message& m); - ipmi::Cc filterMessage(ipmi::message::Request::ptr request); - -- bool restrictedMode = true; -+ sdbusplus::xyz::openbmc_project::Control::Security::server:: -+ RestrictionMode::Modes restrictionMode = -+ sdbusplus::xyz::openbmc_project::Control::Security::server:: -+ RestrictionMode::Modes::ProvisionedHostWhitelist; -+ bool postCompleted = false; - std::shared_ptr bus; -- std::unique_ptr objects; - std::unique_ptr modeChangeMatch; -+ std::unique_ptr postCompleteMatch; - - static constexpr const char restrictionModeIntf[] = - "xyz.openbmc_project.Control.Security.RestrictionMode"; -+ static constexpr const char* systemOsStatusIntf = -+ "xyz.openbmc_project.State.OperatingSystem.Status"; - }; - - WhitelistFilter::WhitelistFilter() -@@ -63,43 +71,83 @@ WhitelistFilter::WhitelistFilter() - post_work([this]() { postInit(); }); - } - --void WhitelistFilter::cacheRestrictedMode() -+void WhitelistFilter::cacheRestrictedAndPostCompleteMode() - { - using namespace sdbusplus::xyz::openbmc_project::Control::Security::server; -+ - std::string restrictionModeSetting; - std::string restrictionModeService; -+ std::string systemOsStatusPath; -+ std::string systemOsStatusService; - try - { -- restrictionModeSetting = objects->map.at(restrictionModeIntf).at(0); -+ auto objects = settings::Objects( -+ *bus, std::vector({restrictionModeIntf})); -+ auto postCompleteObj = settings::Objects( -+ *bus, std::vector({systemOsStatusIntf})); -+ -+ restrictionModeSetting = objects.map.at(restrictionModeIntf).at(0); - restrictionModeService = -- objects->service(restrictionModeSetting, restrictionModeIntf); -+ objects.service(restrictionModeSetting, restrictionModeIntf); -+ -+ systemOsStatusPath = postCompleteObj.map.at(systemOsStatusIntf).at(0); -+ systemOsStatusService = -+ postCompleteObj.service(systemOsStatusPath, systemOsStatusIntf); - } - catch (const std::out_of_range& e) - { -- log( -- "Could not look up restriction mode interface from cache"); -+ log( -+ "Could not initialize provisioning mode, defaulting to restricted"); -+ return; -+ } -+ catch (const std::exception&) -+ { -+ log( -+ "Could not initialize provisioning mode, defaulting to restricted"); - return; - } -+ - bus->async_method_call( - [this](boost::system::error_code ec, ipmi::Value v) { - if (ec) - { -- log("Error in RestrictionMode Get"); -- // Fail-safe to true. -- restrictedMode = true; -+ log("Could not initialize provisioning mode, " -+ "defaulting to restricted"); - return; - } - auto mode = std::get(v); -- auto restrictionMode = -- RestrictionMode::convertModesFromString(mode); -- restrictedMode = -- (restrictionMode == RestrictionMode::Modes::Whitelist); -- log((restrictedMode ? "Set restrictedMode = true" -- : "Set restrictedMode = false")); -+ restrictionMode = RestrictionMode::convertModesFromString(mode); -+ log( -+ "Read restriction mode", -+ entry("VALUE=%d", static_cast(restrictionMode))); - }, - restrictionModeService, restrictionModeSetting, - "org.freedesktop.DBus.Properties", "Get", restrictionModeIntf, - "RestrictionMode"); -+ -+ bus->async_method_call( -+ [this](boost::system::error_code ec, const ipmi::Value& v) { -+ if (ec) -+ { -+ log("Error in OperatingSystemState Get"); -+ postCompleted = true; -+ return; -+ } -+ auto value = std::get(v); -+ if (value == "Standby") -+ { -+ postCompleted = true; -+ } -+ else -+ { -+ postCompleted = false; -+ } -+ log("Read POST complete value", -+ entry("VALUE=%d", postCompleted)); -+ }, -+ systemOsStatusService, systemOsStatusPath, -+ "org.freedesktop.DBus.Properties", "Get", systemOsStatusIntf, -+ "OperatingSystemState"); - } - - void WhitelistFilter::handleRestrictedModeChange(sdbusplus::message::message& m) -@@ -112,61 +160,94 @@ void WhitelistFilter::handleRestrictedModeChange(sdbusplus::message::message& m) - { - if (property.first == "RestrictionMode") - { -- RestrictionMode::Modes restrictionMode = -- RestrictionMode::convertModesFromString( -- std::get(property.second)); -- restrictedMode = -- (restrictionMode == RestrictionMode::Modes::Whitelist); -- log((restrictedMode -- ? "Updated restrictedMode = true" -- : "Updated restrictedMode = false")); -+ restrictionMode = RestrictionMode::convertModesFromString( -+ std::get(property.second)); -+ log( -+ "Updated restriction mode", -+ entry("VALUE=%d", static_cast(restrictionMode))); - } - } - } -- --void WhitelistFilter::postInit() -+void WhitelistFilter::handlePostCompleteChange(sdbusplus::message::message& m) - { -- objects = std::make_unique( -- *bus, std::vector({restrictionModeIntf})); -- if (!objects) -+ std::string intf; -+ std::vector> propertyList; -+ m.read(intf, propertyList); -+ for (const auto& property : propertyList) - { -- log( -- "Failed to create settings object; defaulting to restricted mode"); -- return; -+ if (property.first == "OperatingSystemState") -+ { -+ std::string value = std::get(property.second); -+ if (value == "Standby") -+ { -+ postCompleted = true; -+ } -+ else -+ { -+ postCompleted = false; -+ } -+ log(postCompleted ? "Updated to POST Complete" -+ : "Updated to !POST Complete"); -+ } - } -- -+} -+void WhitelistFilter::postInit() -+{ - // Initialize restricted mode -- cacheRestrictedMode(); -+ cacheRestrictedAndPostCompleteMode(); - // Wait for changes on Restricted mode -- std::string filterStr; -- try -- { -- filterStr = sdbusplus::bus::match::rules::propertiesChanged( -- objects->map.at(restrictionModeIntf).at(0), restrictionModeIntf); -- } -- catch (const std::out_of_range& e) -- { -- log("Failed to determine restriction mode filter string"); -- return; -- } -+ namespace rules = sdbusplus::bus::match::rules; -+ const std::string filterStrModeChange = -+ rules::type::signal() + rules::member("PropertiesChanged") + -+ rules::interface("org.freedesktop.DBus.Properties") + -+ rules::argN(0, restrictionModeIntf); -+ -+ const std::string filterStrPostComplete = -+ rules::type::signal() + rules::member("PropertiesChanged") + -+ rules::interface("org.freedesktop.DBus.Properties") + -+ rules::argN(0, systemOsStatusIntf); -+ - modeChangeMatch = std::make_unique( -- *bus, filterStr, [this](sdbusplus::message::message& m) { -+ *bus, filterStrModeChange, [this](sdbusplus::message::message& m) { - handleRestrictedModeChange(m); - }); -+ postCompleteMatch = std::make_unique( -+ *bus, filterStrPostComplete, [this](sdbusplus::message::message& m) { -+ handlePostCompleteChange(m); -+ }); - } - - ipmi::Cc WhitelistFilter::filterMessage(ipmi::message::Request::ptr request) - { -- if (request->ctx->channel == ipmi::channelSystemIface && restrictedMode) -+ using namespace sdbusplus::xyz::openbmc_project::Control::Security::server; -+ -+ if (request->ctx->channel == ipmi::channelSystemIface && -+ (restrictionMode != RestrictionMode::Modes::None && -+ restrictionMode != RestrictionMode::Modes::Provisioning)) - { -- if (!std::binary_search( -- whitelist.cbegin(), whitelist.cend(), -- std::make_pair(request->ctx->netFn, request->ctx->cmd))) -+ if (!postCompleted) -+ { -+ // Allow all commands, till POST is not completed -+ return ipmi::ccSuccess; -+ } -+ switch (restrictionMode) - { -- log("Net function not whitelisted", -- entry("NETFN=0x%X", int(request->ctx->netFn)), -- entry("CMD=0x%X", int(request->ctx->cmd))); -- return ipmi::ccInsufficientPrivilege; -+ case RestrictionMode::Modes::ProvisionedHostWhitelist: -+ { -+ if (!std::binary_search( -+ whitelist.cbegin(), whitelist.cend(), -+ std::make_pair(request->ctx->netFn, request->ctx->cmd))) -+ { -+ log( -+ "Net function not whitelisted", -+ entry("NETFN=0x%X", int(request->ctx->netFn)), -+ entry("CMD=0x%X", int(request->ctx->cmd))); -+ return ipmi::ccInsufficientPrivilege; -+ } -+ break; -+ } -+ default: // for whitelist, blacklist & HostDisabled -+ return ipmi::ccInsufficientPrivilege; - } - } - return ipmi::ccSuccess; --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf deleted file mode 100644 index 268e12848..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf +++ /dev/null @@ -1,200 +0,0 @@ -#: -#IPMI whitelist command list version 9b -0x00:0x00 //: -0x00:0x01 //: -0x00:0x04 //: -0x00:0x07 //: -0x00:0x09 //: -0x00:0x0A //: -0x00:0x0F //: -0x04:0x01 //: -0x04:0x02 //: -0x04:0x10 //: -0x04:0x13 //: -0x04:0x15 //: -0x04:0x20 //: -0x04:0x21 //: -0x04:0x23 //: -0x04:0x25 //: -0x04:0x27 //: -0x04:0x29 //: -0x04:0x2B //: -0x04:0x2D //: -0x04:0x2F //: -0x06:0x01 //: -0x06:0x04 //: -0x06:0x06 //: -0x06:0x07 //: -0x06:0x08 //: -0x06:0x22 //: -0x06:0x24 //: -0x06:0x25 //: -0x06:0x2F //: -0x06:0x30 //: -0x06:0x31 //: -0x06:0x33 //: -0x06:0x35 //: -0x06:0x37 //: -0x06:0x38 //: -0x06:0x39 //: -0x06:0x3D //: -0x06:0x3F //: -0x06:0x41 //: -0x06:0x42 //: -0x06:0x44 //: -0x06:0x46 //: -0x06:0x4A //: -0x06:0x4B //: -0x06:0x4D //: -0x06:0x4E //: -0x06:0x4F //: -0x06:0x50 //: -0x06:0x54 //: -0x06:0x57 //: -0x08:0x20 //: -0x08:0x21 //: -0x08:0x22 //: -0x08:0x23 //: -0x08:0x24 //: -0x08:0x25 //: -0x08:0x26 //: -0x08:0x27 //: -0x08:0x28 //: -0x08:0x29 //: -0x08:0x2A //: -0x08:0x2B //: -0x08:0x2C //: -0x08:0x2D //: -0x08:0xE0 //: -0x0A:0x10 //: -0x0A:0x11 //: -0x0A:0x20 //: -0x0A:0x21 //: -0x0A:0x23 //: -0x0A:0x28 //: -0x0A:0x40 //: -0x0A:0x41 //: -0x0A:0x43 //: -0x0A:0x48 //: -0x0A:0x5A //: -0x0A:0x5C //: -0x0C:0x02 //: -0x0C:0x04 //: -0x0C:0x11 //: -0x0C:0x21 //: -0x0C:0x22 //: -0x2C:0x1F //: -0x2C:0x20 //: -0x2C:0x21 //: -0x2C:0x22 //: -0x2C:0x23 //: -0x2C:0x24 //: -0x2C:0x25 //: -0x2C:0x29 //: -0x2C:0x37 //: -0x30:0x04 //: -0x30:0x05 //: -0x30:0x09 //: -0x30:0x14 //: -0x30:0x19 //: -0x30:0x1A //: -0x30:0x1B //: -0x30:0x1D //: -0x30:0x1F //: -0x30:0x20 //: -0x30:0x21 //: -0x30:0x22 //: -0x30:0x23 //: -0x30:0x26 //: -0x30:0x27 //: -0x30:0x2E //: -0x30:0x30 //: -0x30:0x31 //: -0x30:0x33 //: -0x30:0x38 //: -0x30:0x39 //: -0x30:0x3C //: -0x30:0x41 //: -0x30:0x43 //: -0x30:0x44 //: -0x30:0x47 //: -0x30:0x54 //: -0x30:0x55 //: -0x30:0x55 //: -0x30:0x58 //: -0x30:0x62 //: -0x30:0x63 //: -0x30:0x65 //: -0x30:0x66 //: -0x30:0x71 //: -0x30:0x73 //: -0x30:0x74 //: -0x30:0x75 //: -0x30:0x80 //: -0x30:0x81 //: -0x30:0x82 //: -0x30:0x85 //: -0x30:0x8A //: -0x30:0x8B //: -0x30:0x8D //: -0x30:0x8F //: -0x30:0x91 //: -0x30:0x92 //: -0x30:0x93 //: -0x30:0x94 //: -0x30:0x95 //: -0x30:0x9A //: -0x30:0x9B //: -0x30:0x9D //: -0x30:0xB0 //: -0x30:0xB2 //: -0x30:0xB3 //: -0x30:0xBB //: -0x30:0xC2 //: -0x30:0xC6 //: -0x30:0xC7 //: -0x30:0xC9 //: -0x30:0xCA //: -0x30:0xCB //: -0x30:0xCC //: -0x30:0xCD //: -0x30:0xD0 //: -0x30:0xD1 //: -0x30:0xD4 //: -0x30:0xE2 //: -0x30:0xE5 //: -0x30:0xE8 //: -0x30:0xE9 //: -0x30:0xF9 //: -0x30:0xFD //: -0x32:0x60 //: -0x32:0x63 //: -0x32:0x8D //: -0x3E:0x02 //: -0x3E:0x20 //: -0x3E:0x21 //: -0x3E:0x22 //: -0x3E:0x23 //: -0x3E:0x24 //: -0x3E:0x25 //: -0x3E:0x28 //: -0x3E:0x30 //: -0x3E:0x31 //: -0x3E:0x32 //: -0x3E:0x33 //: -0x3E:0x34 //: -0x3E:0x35 //: -0x3E:0x38 //: -0x3E:0x39 //: -0x3E:0x3A //: -0x3E:0x3B //: -0x3E:0x3C //: -0x3E:0x3D //: -0x3E:0x41 //: -0x3E:0x42 //: -0x3E:0x43 //: -0x3E:0x44 //: -0x3E:0x50 //: -0x3E:0x51 //: -0x3E:0x52 //: -0x3E:0x75 //: diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/transporthandler_oem.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/transporthandler_oem.cpp index 3cb79dc3f..856a80fbc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/transporthandler_oem.cpp +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/transporthandler_oem.cpp @@ -59,7 +59,8 @@ RspType<> setLanOem(uint8_t channel, uint8_t parameter, message::Payload& req) } size_t numDataBytes = req.size() - 4; - if (numDataBytes > IpmiHostnameLen) + if ((numDataBytes > IpmiHostnameLen) || + (!complete && (numDataBytes < IpmiHostnameLen))) { return responseReqDataLenInvalid(); } 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 ba148779f..e1311a70d 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 @@ -2,10 +2,9 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" SRC_URI = "git://github.com/openbmc/phosphor-host-ipmid" -SRCREV = "ebc53cb165ea26aa48f0bbf01d9bce0e4abb0b7d" +SRCREV = "86d8bd793968e9251f41dbb8eaea482490e68eb1" SRC_URI += "file://phosphor-ipmi-host.service \ - file://host-ipmid-whitelist.conf \ file://0010-fix-get-system-GUID-ipmi-command.patch \ file://0053-Fix-keep-looping-issue-when-entering-OS.patch \ file://0056-add-SetInProgress-to-get-set-boot-option-cmd.patch \ @@ -13,15 +12,13 @@ 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://0064-Update-provisioning-mode-filter-logic.patch \ file://0001-Modify-Get-Lan-Configuration-IP-Address-Source-to-us.patch \ - file://0002-Fixed-issue-in-setLan-command-for-IP-source.patch \ - file://0003-Fix-for-return-CC-in-setLan-command-cases.patch \ " EXTRA_OECONF_append = " --disable-i2c-whitelist-check" EXTRA_OECONF_append = " --enable-transport-oem=yes" EXTRA_OECONF_append = " --disable-boot-flag-safe-mode-support" +EXTRA_OECONF_append = " --disable-ipmi-whitelist" RDEPENDS_${PN}_remove = "clear-once" @@ -37,10 +34,6 @@ FILES_${PN}_remove = " \ ${systemd_unitdir}/system/obmc-host-shutdown@0.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \ " -do_configure_append(){ - cp -f ${WORKDIR}/host-ipmid-whitelist.conf ${S} -} - do_compile_prepend(){ cp -f ${PROJECT_SRC_DIR}/transporthandler_oem.cpp ${S} } 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 016dd0002..69b730221 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,2 +1,2 @@ SRC_URI = "git://github.com/openbmc/ipmbbridge.git" -SRCREV = "43c89138ea759b4e47f6cef481f677b9f421d148" +SRCREV = "a86059348fe133725f4616f3e46ff0d555db4039" 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 614133645..c82736781 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 = "46bec0f60a201a644c1f3af4cec2f31da58a0595" +SRCREV = "2555e2ec1c5bd6636eb67a1a2cdf6b8b567772c9" 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 9f657e39b..36d65fd72 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 = "ddba32d5ac94cdd8db19e18215535d7fe86675e6" +SRCREV = "de212d839bb515939bd089c66072e4fcf33b8653" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl.bb new file mode 100644 index 000000000..c47a581f6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl.bb @@ -0,0 +1,27 @@ +SUMMARY = "Multi-node Non-legacy" +DESCRIPTION = "New systemd target for non-legacy nodes on multi-node platform" + +inherit systemd + +SYSTEMD_SERVICE_${PN} = "multi-node-nl.target" +SYSTEMD_SERVICE_${PN} += "nonLegacyNode.service" + +S = "${WORKDIR}" +SRC_URI = "file://multi-node-nl.target \ + file://nonLegacyNode.service \ + file://nonLegacyNode.sh \ + " + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" + +RDEPENDS_${PN} = "bash" + +do_install_append() { + install -d ${D}${bindir} + install -m 0755 ${S}/nonLegacyNode.sh ${D}/${bindir}/nonLegacyNode.sh + + install -d ${D}${base_libdir}/systemd/system + install -m 0644 ${S}/multi-node-nl.target ${D}${base_libdir}/systemd/system + install -m 0644 ${S}/nonLegacyNode.service ${D}${base_libdir}/systemd/system +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/multi-node-nl.target b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/multi-node-nl.target new file mode 100644 index 000000000..32b50532f --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/multi-node-nl.target @@ -0,0 +1,4 @@ +[Unit] +Description=Target for non-legacy node in multi-node system +Documentation=man:systemd.special(7) + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/nonLegacyNode.service b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/nonLegacyNode.service new file mode 100644 index 000000000..8e3d07ba4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/nonLegacyNode.service @@ -0,0 +1,9 @@ +[Unit] +Description=Non Legacy node + +[Service] +ExecStart=/usr/bin/nonLegacyNode.sh +Type=exec + +[Install] +WantedBy=multi-node-nl.target diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/nonLegacyNode.sh b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/nonLegacyNode.sh new file mode 100755 index 000000000..2a1a5ea3b --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/multi-node-nl/multi-node-nl/nonLegacyNode.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +PWM_FILE="/sys/class/hwmon/hwmon0/pwm" +FAN_SPEED=$((255 * 80 / 100)) + +set_fan_speed() { + local idx=0 + for ((idx=1; idx<=8; idx++)) + do + if [ -f $PWM_FILE$idx ]; then + echo $FAN_SPEED > $PWM_FILE$idx + fi + done +} + +$(set_fan_speed) + +export TERM=xterm +# Autologin root user to serial console (ttyS4) on boot +exec /sbin/agetty -a root -J -8 -L ttyS4 115200 $TERM 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 12cb4ef78..2a561dbe1 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=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.U_Boot.Environment.Manager.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 0e38f3aeb..e954d7757 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 @@ -115,41 +115,15 @@ full_clean() { done sync } -# attach a UBI device to the MTD device -prepare_ubi_volume() { - local nv_num="$1" - local mtd="/dev/mtd${nv_num}" - local ubi="/dev/ubi${nv_num}" - if [ ! -e $ubi ]; then - if ! ubiattach -m "$nv_num" -d "$nv_num"; then - # the attach failed, so format the MTD device and try again - log "Warning! Failed to attach $ubi to $mtd." - log "UBI-formatting $mtd to attach again. Data on this device will be lost." - ubiformat -y "$mtd" - ubiattach -m "$nv_num" -d "$nv_num" - fi - fi - - # make a UBI volume on the UBI device - local vol="${ubi}_0" - if [ ! -e $vol ]; then - ubimkvol "$ubi" -N "$mtd" -m - fi -} -reformat_ubi_volume() { - local nv_num="$1" +reformat_jffs2_partition() { + local mtd_name="$1" local mnt="$2" - local mtd="/dev/mtd${nv_num}" - local ubi="/dev/ubi${nv_num}" - local vol="${ubi}_0" - # unmount the volume to reformat it + # unmount the partition to reformat it umount -f "$mnt" - ubidetach -m $nv_num - ubiformat -y "$mtd" - prepare_ubi_volume $nv_num - # remount the UBIFS on the UBI volume - mount -t ubifs -o sync "$vol" "$mnt" + flash_eraseall "$(mtd_by_name ${mtd_name})" + # remount the JFFS2 + mount -t jffs2 -o sync mtd:"$mtd_name" "$mnt" if [ $? -ne 0 ]; then log "Failed to mount reformatted NV volume; system unstable" fi @@ -162,14 +136,13 @@ clear_ubenv() { # mount NV filesystem mkdir -p "$RWFS_MNT" -prepare_ubi_volume $NV_MTD_NUM -mount -t ubifs -o sync "/dev/ubi${NV_MTD_NUM}_0" "$RWFS_MNT" +mount -t jffs2 -o sync mtd:"$NV_MTD" "$RWFS_MNT" if [ $? -ne 0 ]; then log "Failed to mount NV volume; attempting recovery" - reformat_ubi_volume $NV_MTD_NUM $RWFS_MNT + reformat_jffs2_partition $NV_MTD $RWFS_MNT fi -# check for full factory reset: if so, ubiformat $NV_MTD_DEV +# check for full factory reset: if so, format $NV_MTD_DEV RESTORE_FLAG=$RWFS_MNT/.restore_op restore_op=$(cat $RESTORE_FLAG) # read from NV restore_op=${restore_op:-0} # set default value 0 @@ -181,7 +154,7 @@ elif [ $restore_op -eq 2 ]; then clear_ubenv elif [ $restore_op -eq 3 ]; then log "restore-defaults: reformat" - reformat_ubi_volume $NV_MTD_NUM $RWFS_MNT + reformat_jffs2_partition $NV_MTD $RWFS_MNT clear_ubenv fi rm -f $RESTORE_FLAG @@ -229,15 +202,57 @@ if ! grep -q sofs /proc/mounts; then SOFS_MTD=sofs SOFS_MTD_NUM="$(mtdnum_by_name ${SOFS_MTD})" - # mount a UBIFS on the UBI volume - prepare_ubi_volume $SOFS_MTD_NUM - mount -t ubifs -o sync "/dev/ubi${SOFS_MTD_NUM}_0" "$SOFS_MNT" + # mount a JFFS2 on the partition + mount -t jffs2 -o sync mtd:"$SOFS_MTD" "$SOFS_MNT" if [ $? -ne 0 ]; then log "Failed to mount SOFS volume; attempting recovery" - reformat_ubi_volume $SOFS_MTD_NUM $SOFS_MNT + reformat_jffs2_partition $SOFS_MTD $SOFS_MNT fi fi log "Finished mounting nv and overlays" + +# Detect the non-legacy node in cooper city and boot in to special mode. + +readonly COOPER_CITY=40 # Board id of cooper city + +is_nl_node() { + typeset -i nid1=$(gpioget $(gpiofind "FM_NODE_ID_1")) + typeset -i nid2=$(gpioget $(gpiofind "FM_NODE_ID_2")) + echo $((nid1|nid2)) +} + +read_board_id() { + local idx=0 + local result=0 + local value=0 + for ((idx=0; idx<6; idx++)) + do + typeset -i value=$(gpioget $(gpiofind "FM_BMC_BOARD_SKU_ID${idx}_N")) + value=$((value << idx)) + result=$((result | value)) + done + echo $result +} + +pfr_write() { + [ $# -ne 2 ] && return 1 + local PFR_BUS=4 + local PFR_ADDR=0x38 + local reg=$1 + local val=$2 + i2cset -y $PFR_BUS $PFR_ADDR $reg $val >&/dev/null +} + +board_id=$(read_board_id) +if [ $board_id -eq $COOPER_CITY ]; then + if [ $(is_nl_node) -ne 0 ]; then + systemctl set-default multi-node-nl.target + PFR_BMC_CHECKPOINT_REG=0xf + PFR_BMC_CHECKPOINT_COMPLETE=0x9 + pfr_write $PFR_BMC_CHECKPOINT_REG $PFR_BMC_CHECKPOINT_COMPLETE + fi +fi + exec /lib/systemd/systemd 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 146d2e523..9db4eeb56 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/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" 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 8faa23f97..64201acc1 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 @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe inherit cmake systemd SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.SecurityManager.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 5511e3b0f..ec101469e 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,7 +1,9 @@ -SRCREV = "347dd4e7a0a4923583151e4d9eb483b65dba9e7b" +SRCREV = "d9d8cafcb1f4096e579188478b88cb8cefca8bd4" SRC_URI = "git://github.com/openbmc/dbus-sensors.git" DEPENDS_append = " libgpiod libmctp" FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" +EXTRA_OECMAKE += "-DDISABLE_NVME=OFF" +SYSTEMD_SERVICE_${PN} += " xyz.openbmc_project.nvmesensor.service" 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 314e31779..e49a410cb 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/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" 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 2c4cb80a7..2690169ff 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/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" inherit cmake systemd @@ -21,6 +21,7 @@ DEPENDS += " \ sdbusplus-native \ phosphor-logging \ boost \ + libpam \ " RDEPENDS_${PN} += " \ libsystemd \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb index 6cef4c3ea..b1ac1fbc1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "srvcfg-manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-state-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-state-manager_%.bbappend new file mode 100644 index 000000000..aef2a020f --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-state-manager_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +DEPENDS += "gtest" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager_git.bb index 98e0706fa..97896d72a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager_git.bb @@ -18,6 +18,7 @@ SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.State.Boot.PostCode.service" DEPENDS += " \ autoconf-archive-native \ systemd \ + boost \ sdbusplus \ sdbusplus-native \ phosphor-dbus-interfaces \ 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 910bf9fae..cc84015f4 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 @@ -7,7 +7,7 @@ inherit cmake systemd DEPENDS = "boost sdbusplus" PV = "0.1+git${SRCPV}" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" S = "${WORKDIR}/git/callback-manager" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch new file mode 100644 index 000000000..12a2bda3e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch @@ -0,0 +1,73 @@ +From c0bf911cbc33659adddebde767029ffc23251c61 Mon Sep 17 00:00:00 2001 +From: Richard Marian Thomaiyar +Date: Mon, 24 Feb 2020 13:37:12 +0530 +Subject: [PATCH] Use groupmems instead of getgrnam_r due to overlay + +With JFFS2 overlay, getgrnam_r during initial time returns the +old group details as per the lower dir, instead of the overlay one +but at the same time groupmems where returning proper values, which +reads the file everytime. Hence replacing getgrnam_r with groupmems + +Tested: +1. Verified that when added multiple user and then doing +BMC reset using ipmitool raw 6 2 doesn't reproduce the issue of +user with only ssh group. (on 38 version source + this fix) +2. Updated using redfish to version 39 + this fix, and made sure +issue doesn't happen. + +Note: For testing purpose added debug statements to dump ouput of +both getgrnam_r & groupmems and able to see proper list only +in groupmems when the issue is reproduced + +Signed-off-by: Richard Marian Thomaiyar +--- + user_service.cpp | 26 +++++++++++--------------- + 1 file changed, 11 insertions(+), 15 deletions(-) + +diff --git a/user_service.cpp b/user_service.cpp +index c3c45bd..4fdf7a1 100644 +--- a/user_service.cpp ++++ b/user_service.cpp +@@ -143,28 +143,24 @@ class ShadowService : public phosphor::user::UserServiceInterface + getUsersInGroup(const std::string &groupName) const override + { + std::vector usersInGroup; +- // Should be more than enough to get the pwd structure. +- std::array buffer{}; +- struct group grp; +- struct group *grpPtr = &grp; +- struct group *resultPtr; +- +- int status = getgrnam_r(groupName.c_str(), grpPtr, buffer.data(), +- buffer.max_size(), &resultPtr); +- +- if (!status && (grpPtr == resultPtr)) ++ std::vector output; ++ try + { +- for (; *(grp.gr_mem) != NULL; ++(grp.gr_mem)) +- { +- usersInGroup.emplace_back(*(grp.gr_mem)); +- } ++ output = phosphor::user::executeCmd("/usr/sbin/groupmems", "-l", ++ "-g", groupName.c_str()); + } +- else ++ catch (const phosphor::user::InternalFailure &e) + { + phosphor::logging::log( + "Group not found", + phosphor::logging::entry("GROUP=%s", groupName.c_str())); + // Don't throw error, just return empty usersInGroup - fallback ++ return usersInGroup; ++ } ++ if (!output.empty()) ++ { ++ boost::algorithm::split(usersInGroup, output[0], ++ boost::algorithm::is_any_of(" ")); + } + return usersInGroup; + } +-- +2.7.4 + 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 f7a3a7875..238511ed5 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 @@ -7,4 +7,5 @@ EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'a SRC_URI += " \ file://0005-Added-suport-for-multiple-user-manager-services.patch \ + file://0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb index 007265667..da60ca67e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb @@ -2,7 +2,7 @@ SUMMARY = "Virtual Media Service" DESCRIPTION = "Virtual Media Service" SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "5a03fdc6a119b65ecf320622ce2809e340749fa9" +SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" S = "${WORKDIR}/git/virtual-media/" PV = "1.0+git${SRCPV}" 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 bd72b27be..e16e658a1 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,2 +1,2 @@ SRC_URI = "git://github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel2" -SRCREV = "376cb79388c70253cc8c2b2f8eb40e0f5833ac40" +SRCREV = "68c48ed0e48f57bf3092bc5a5bd4b8ac336a4d93" diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/files/lpc_cmds.c b/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/files/lpc_cmds.c index 467231372..bc215f60b 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/files/lpc_cmds.c +++ b/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/files/lpc_cmds.c @@ -321,6 +321,27 @@ static void SIOGetPFailStatus() close(fd); } +static void SIOSetBMCSCIEvent(unsigned short set) +{ + int fd; + struct sio_ioctl_data sio_data; + + fd = open(SIO_DEVICE_NAME, O_RDWR | O_CLOEXEC); + if (fd < 0) { + printf("Error open %s\n", SIO_DEVICE_NAME); + exit(1); + } + + sio_data.sio_cmd = SIO_SET_BMC_SCI_EVENT; + sio_data.param = set; + + if (ioctl(fd, SIO_IOC_COMMAND, &sio_data) == 0) + printf("BMC SCI event is %s\n", + sio_data.data ? "set" : "cleared"); + + close(fd); +} + /*********************************************************************************/ #if SUPPORT_MAILBOX @@ -390,6 +411,8 @@ static void usage(void) "\tlpc_cmds sio get_pwrbtn_override_status\n" "\tlpc_cmds sio get_pwrbtn_override_status_clear\n" "\tlpc_cmds sio get_pfail_status\n" + "\tlpc_cmds sio set_bmc_sci_event\n" + "\tlpc_cmds sio clear_bmc_sci_event\n" "\n" #if SUPPORT_KCS_ADDR_CMD "\tlpc_cmds kcs [1 ~ 4] (getaddr / setaddr / quiet)\n" @@ -445,6 +468,10 @@ int main(int argc, char** argv) SIOGetPWRBTNOverride(1); else if (strcmp(argv[2], "get_pfail_status") == 0) SIOGetPFailStatus(); + else if (strcmp(argv[2], "set_bmc_sci_event") == 0) + SIOSetBMCSCIEvent(1); + else if (strcmp(argv[2], "clear_bmc_sci_event") == 0) + SIOSetBMCSCIEvent(0); } else if (strcmp(cmd, "kcs") == 0) { int ifc; diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/files/lpc_drv.h b/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/files/lpc_drv.h index 56c79d1c1..793e8b49c 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/files/lpc_drv.h +++ b/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/files/lpc_drv.h @@ -55,6 +55,7 @@ enum SIO_CMD { SIO_SET_ONCTL_GPIO, SIO_GET_PWRBTN_OVERRIDE, SIO_GET_PFAIL_STATUS, /* Start from AC Loss */ + SIO_SET_BMC_SCI_EVENT, SIO_MAX_CMD }; diff --git a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend index 554d44ece..0f84062d1 100755 --- a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend @@ -1,3 +1,3 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/x86-power-control.git;protocol=ssh" -SRCREV = "8d6602196d496a8611a789cd36036b2f4ea14f76" +SRCREV = "e7520ba18a5b5ba6c8eb7a9d543704f9699295a1" diff --git a/meta-openbmc-mods/meta-egs/conf/bblayers.conf.sample b/meta-openbmc-mods/meta-egs/conf/bblayers.conf.sample index 3879d00a1..a7c1dd44d 100644 --- a/meta-openbmc-mods/meta-egs/conf/bblayers.conf.sample +++ b/meta-openbmc-mods/meta-egs/conf/bblayers.conf.sample @@ -1,6 +1,6 @@ # LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf # changes incompatibly -LCONF_VERSION = "10" +LCONF_VERSION = "11" BBPATH = "${TOPDIR}" BBFILES ?= "" diff --git a/meta-openbmc-mods/meta-egs/conf/local.conf.sample b/meta-openbmc-mods/meta-egs/conf/local.conf.sample index 3cf6a01b3..369a6f0e1 100644 --- a/meta-openbmc-mods/meta-egs/conf/local.conf.sample +++ b/meta-openbmc-mods/meta-egs/conf/local.conf.sample @@ -2,7 +2,9 @@ MACHINE ??= "intel-ast2600" DISTRO ?= "openbmc-phosphor" PACKAGE_CLASSES ?= "package_rpm" SANITY_TESTED_DISTROS_append ?= " RedHatEnterpriseWorkstation-6.*" -EXTRA_IMAGE_FEATURES = "debug-tweaks" +EXTRA_IMAGE_FEATURES = "validation-unsecure" +# Uncomment the following line to enable debug features / default user account. +#EXTRA_IMAGE_FEATURES += "debug-tweaks" USER_CLASSES ?= "buildstats image-mklibs image-prelink" PATCHRESOLVE = "noop" diff --git a/meta-openbmc-mods/meta-wht/conf/bblayers.conf.sample b/meta-openbmc-mods/meta-wht/conf/bblayers.conf.sample index 09c2bbc4a..d0d291a92 100644 --- a/meta-openbmc-mods/meta-wht/conf/bblayers.conf.sample +++ b/meta-openbmc-mods/meta-wht/conf/bblayers.conf.sample @@ -1,6 +1,6 @@ # LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf # changes incompatibly -LCONF_VERSION = "10" +LCONF_VERSION = "11" BBPATH = "${TOPDIR}" BBFILES ?= "" diff --git a/meta-openbmc-mods/meta-wht/conf/local.conf.sample b/meta-openbmc-mods/meta-wht/conf/local.conf.sample index aaf295ba4..e5c860f60 100644 --- a/meta-openbmc-mods/meta-wht/conf/local.conf.sample +++ b/meta-openbmc-mods/meta-wht/conf/local.conf.sample @@ -4,7 +4,9 @@ MACHINE ??= "intel-ast2500" DISTRO ?= "openbmc-phosphor" PACKAGE_CLASSES ?= "package_rpm" SANITY_TESTED_DISTROS_append ?= " RedHatEnterpriseWorkstation-6.*" -EXTRA_IMAGE_FEATURES = "debug-tweaks validation-unsecure" +EXTRA_IMAGE_FEATURES = "validation-unsecure" +# Uncomment the following line to enable debug features / default user account. +#EXTRA_IMAGE_FEATURES += "debug-tweaks" USER_CLASSES ?= "buildstats image-mklibs image-prelink" PATCHRESOLVE = "noop" diff --git a/meta-openbmc-mods/meta-wolfpass/conf/bblayers.conf.sample b/meta-openbmc-mods/meta-wolfpass/conf/bblayers.conf.sample index f3a4bc513..27d0d5fa4 100644 --- a/meta-openbmc-mods/meta-wolfpass/conf/bblayers.conf.sample +++ b/meta-openbmc-mods/meta-wolfpass/conf/bblayers.conf.sample @@ -1,6 +1,6 @@ # LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf # changes incompatibly -LCONF_VERSION = "10" +LCONF_VERSION = "11" BBPATH = "${TOPDIR}" BBFILES ?= "" diff --git a/meta-openbmc-mods/meta-wolfpass/conf/local.conf.sample b/meta-openbmc-mods/meta-wolfpass/conf/local.conf.sample index e4962ad81..d20f54810 100644 --- a/meta-openbmc-mods/meta-wolfpass/conf/local.conf.sample +++ b/meta-openbmc-mods/meta-wolfpass/conf/local.conf.sample @@ -4,7 +4,9 @@ MACHINE ??= "intel-ast2500" DISTRO ?= "openbmc-phosphor" PACKAGE_CLASSES ?= "package_rpm" SANITY_TESTED_DISTROS_append ?= " RedHatEnterpriseWorkstation-6.*" -EXTRA_IMAGE_FEATURES = "debug-tweaks validation-unsecure" +EXTRA_IMAGE_FEATURES = "validation-unsecure" +# Uncomment the following line to enable debug features / default user account. +#EXTRA_IMAGE_FEATURES += "debug-tweaks" USER_CLASSES ?= "buildstats image-mklibs image-prelink" PATCHRESOLVE = "noop" BB_DISKMON_DIRS = "\ -- cgit v1.2.3