diff options
Diffstat (limited to 'meta-quanta/meta-gbs')
139 files changed, 8818 insertions, 4 deletions
diff --git a/meta-quanta/meta-gbs/conf/machine/gbs.conf b/meta-quanta/meta-gbs/conf/machine/gbs.conf index 32dae060f..d5a6e7859 100644 --- a/meta-quanta/meta-gbs/conf/machine/gbs.conf +++ b/meta-quanta/meta-gbs/conf/machine/gbs.conf @@ -1,17 +1,19 @@ KMACHINE = "nuvoton" KERNEL_DEVICETREE = "${KMACHINE}-npcm730-gbs.dtb" -UBOOT_MACHINE = "PolegSVB_config" +UBOOT_MACHINE = "PolegSVB_spinor_minimal_config" +UBOOT_DEVICETREE = "nuvoton-npcm730-gbs" IGPS_MACHINE = "GBS" -FLASH_SIZE = "32768" - MACHINEOVERRIDES .= ":npcm7xx" require conf/machine/include/npcm7xx.inc require conf/machine/include/obmc-bsp-common.inc -SERIAL_CONSOLES = "115200;ttyS0" +# Overwrite flash offsets +FLASH_ROFS_OFFSET = "7296" +FLASH_RWFS_OFFSET = "61440" +FLASH_SIZE = "65536" OBMC_MACHINE_FEATURES += "\ obmc-phosphor-fan-mgmt \ diff --git a/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native/BootBlockAndHeader_GBS.xml b/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native/BootBlockAndHeader_GBS.xml new file mode 100644 index 000000000..3c1e3be9e --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native/BootBlockAndHeader_GBS.xml @@ -0,0 +1,276 @@ +<!-- SPDX-License-Identifier: GPL-2.0 +# +# Nuvoton IGPS: Image Generation And Programming Scripts For Poleg BMC +# +# Copyright (C) 2018 Nuvoton Technologies, All Rights Reserved +#---------------------------------------------------------------------------> + +<?xml version="1.0" encoding="UTF-8"?> + +<Bin_Ecc_Map> + <!-- BMC mandatory fields --> + <ImageProperties> + <BinSize>0</BinSize> <!-- If 0 the binary size will be calculated by the tool --> + <PadValue>0xFF</PadValue> <!-- Byte value to pad the empty areas, default is 0 --> + </ImageProperties> + + <BinField> + <!-- BootBlock tag (0x50 0x07 0x55 0xAA 0x54 0x4F 0x4F 0x42) or + uboot tag (0x55 0x42 0x4F 0x4F 0x54 0x42 0x4C 0x4B) --> + <name>StartTag</name> <!-- name of field --> + <config> + <offset>0</offset> + <size>0x8</size> + </config> + <content format='bytes'>0x50 0x07 0x55 0xAA 0x54 0x4F 0x4F 0x42</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Code destination address, 32-bit aligned: for BootBlock should be 0xFFFD5E00 so code will run in 0xFFFD6000 as linked for --> + <name>DestAddr</name> <!-- name of field --> + <config> + <offset>0x140</offset> + <size>0x4</size> + </config> + <content format='32bit'>0xFFFD5E00</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- BootBlock or u-boot Code size --> + <name>CodeSize</name> <!-- name of field --> + <config> + <offset>0x144</offset> + <size>0x4</size> + </config> + <content format='FileSize'>Poleg_bootblock.bin</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- The BootBlock or u-boot binary file --> + <name>Code</name> <!-- name of field --> + <config> + <offset>0x200</offset> + <size format='FileSize'>Poleg_bootblock.bin</size> <!-- size in the header calculated by tool--> + </config> + <content format='FileContent'>Poleg_bootblock.bin</content> <!-- content the user should fill --> + </BinField> + + <!-- BMC optional fields --> + <BinField> + <!-- Word contents copied by ROM code to FIU0 FIU_DRD_CFG register --> + <name>FIU0_DRD_CFG_Set</name> <!-- name of field --> + <config> + <offset>0x108</offset> + <size>0x4</size> + </config> + <content format='32bit'>0x0300100B</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Defines the clock divide ratio from AHB to FIU0 clock --> + <name>FIU_Clk_Divider</name> <!-- name of field --> + <config> + <offset>0x10C</offset> + <size>0x1</size> + </config> + <content format='bytes'>0x0A</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Version (Major.Minor) --> + <name>Version</name> <!-- name of field --> + <config> + <offset>0x148</offset> + <size>0x4</size> + </config> + <content format='32bit'>0x0201</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Board manufaturer ( Dell = 0, Nuvoton = 100, Google = 1, MS = 2) --> + <name>BOARD_VENDOR</name> <!-- name of field --> + <config> + <offset>0x14C</offset> + <size>0x4</size> + </config> + <content format='32bit'>100</content> <!--Board_manufacturer: Nuvoton--> + </BinField> + <BinField> + <!-- Board type ( DRB = 0, SVB = 1, EB = 2,HORIZON = 3, SANDSTORM = 4, ROCKAWAY = 100 RunBMC = 10) --> + <!-- WARNING: Currently this value is only printed to serial. Set BOARD_VENDOR to 1 get Dell specific customization. --> + <name>BOARD_TYPE</name> <!-- name of field --> + <config> + <offset>0x150</offset> + <size>0x4</size> + </config> + <content format='32bit'>0x64</content> <!--Board_type: EB--> + </BinField> + + <!-- the next two fields are available since version 10.7.0 --> + <BinField> + <!-- supported values: 333,444,500,600,666,700,720,750,775,787,800,825,850,900,950,1000,1060 --> + <name>MC_FREQ_IN_MHZ</name> <!-- name of field --> + <config> + <offset>0x11C</offset> + <size>0x2</size> + </config> + <content format='32bit'>800</content> + </BinField> + <BinField> + <!-- supporeted values: 333,500,600,666,700,720,750,800,825,850,900,950,1000,1060 --> + <name>CPU_FREQ_IN_MHZ</name> <!-- name of field --> + <config> + <offset>0x154</offset> + <size>0x2</size> + </config> + <content format='32bit'>800</content> + </BinField> + + <BinField> + <!-- MC_CONFIG. + Bit 0: MC_DISABLE_CAPABILITY_INPUT_DQS_ENHANCE_TRAINING (0x01) + Bit 1: MC_CAPABILITY_IGNORE_ECC_DEVICE (0x02) --> + <name>MC_CONFIG</name> <!-- name of field --> + <config> + <offset>0x156</offset> + <size>0x1</size> + </config> + <content format='32bit'>0x01</content> + </BinField> + + <BinField> + <!-- HOST_IF. + 0xFF: LPC backward compatible + 0x00: LPC. + 0x01: eSPI + 0x02: GPIOs TRIS. --> + <name>HOST_IF</name> <!-- name of field --> + <config> + <offset>0x157</offset> + <size>0x1</size> + </config> + <content format='32bit'>0x00</content> + </BinField> + + <BinField> + <!-- SECURITY_LEVEL_T. + 0xFF: SECURITY_LEVEL_UNKNOWN: backward compatible + 0x00: SECURITY_LEVEL_NONE. + 0x01: SECURITY_LEVEL_STANDARD + 0x02: SECURITY_LEVEL_NIST. (require BootBlock with NIST support) --> + <name>SECURITY_LEVEL_T</name> <!-- name of field --> + <config> + <offset>0x15C</offset> + <size>0x1</size> + </config> + <content format='32bit'>0xFF</content> + </BinField> + + <BinField> + <!-- Key revoke (bitwise). Set bit 0 to revoke key 0 etc. --> + <name>SECURITY_REVOKE_KEYS</name> <!-- name of field --> + <config> + <offset>0x1D7</offset> + <size>0x1</size> + </config> + <content format='bytes'>0x00</content> + </BinField> + + <BinField> + <!-- security log offset --> + <name>SECURITY_LOG</name> <!-- name of field --> + <config> + <offset>0x1D8</offset> + <size>0x4</size> + </config> + <content format='32bit'>0x090000</content> + </BinField> + <BinField> + <!-- hole 0 size: used for NIST security. --> + <name>SECURITY_LOG_SIZE</name> <!-- name of field --> + <config> + <offset>0x1DC</offset> + <size>0x4</size> + </config> + <content format='32bit'>0x3000</content> + </BinField> + + + <BinField> + <!-- hole 0: used for NIST security. --> + <name>HOLE0</name> <!-- name of field --> + <config> + <offset>0x1E0</offset> + <size>0x4</size> + </config> + <content format='32bit'>0x0A0000</content> + </BinField> + <BinField> + <!-- hole 0 size: used for NIST security. --> + <name>HOLE0_SIZE</name> <!-- name of field --> + <config> + <offset>0x1E4</offset> + <size>0x4</size> + </config> + <content format='32bit'>0xF70000</content> + </BinField> + + <BinField> + <!-- hole 1: used for NIST security. --> + <name>HOLE1</name> <!-- name of field --> + <config> + <offset>0x1E8</offset> + <size>0x4</size> + </config> + <content format='32bit'>0</content> + </BinField> + <BinField> + <!-- hole 1 size: used for NIST security. --> + <name>HOLE1_SIZE</name> <!-- name of field --> + <config> + <offset>0x1EC</offset> + <size>0x4</size> + </config> + <content format='32bit'>0</content> + </BinField> + + + <BinField> + <!-- hole 2: used for NIST security. --> + <name>HOLE2</name> <!-- name of field --> + <config> + <offset>0x1F0</offset> + <size>0x4</size> + </config> + <content format='32bit'>0xFFFFFFFF</content> + </BinField> + <BinField> + <!-- hole 2 size: used for NIST security. --> + <name>HOLE2_SIZE</name> <!-- name of field --> + <config> + <offset>0x1F4</offset> + <size>0x4</size> + </config> + <content format='32bit'>0</content> + </BinField> + + <BinField> + <!-- hole 3: used for NIST security. --> + <name>HOLE3</name> <!-- name of field --> + <config> + <offset>0x1F8</offset> + <size>0x4</size> + </config> + <content format='32bit'>0</content> + </BinField> + <BinField> + <!-- hole 3 size: used for NIST security. --> + <name>HOLE3_SIZE</name> <!-- name of field --> + <config> + <offset>0x1FC</offset> + <size>0x4</size> + </config> + <content format='32bit'>0</content> + </BinField> + +</Bin_Ecc_Map> diff --git a/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native/UbootHeader_GBS.xml b/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native/UbootHeader_GBS.xml new file mode 100644 index 000000000..b99e7e618 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native/UbootHeader_GBS.xml @@ -0,0 +1,194 @@ +<!-- SPDX-License-Identifier: GPL-2.0 +# +# Nuvoton IGPS: Image Generation And Programming Scripts For Poleg BMC +# +# Copyright (C) 2018 Nuvoton Technologies, All Rights Reserved +#---------------------------------------------------------------------------> + +<?xml version="1.0" encoding="UTF-8"?> + +<Bin_Ecc_Map> + <!-- BMC mandatory fields --> + <ImageProperties> + <BinSize>0</BinSize> <!-- If 0 the binary size will be calculated by the tool --> + <PadValue>0xFF</PadValue> <!-- Byte value to pad the empty areas, default is 0 --> + </ImageProperties> + + <BinField> + <!-- BootBlock tag (0x50 0x07 0x55 0xAA 0x54 0x4F 0x4F 0x42) or + uboot tag (0x55 0x42 0x4F 0x4F 0x54 0x42 0x4C 0x4B) --> + <name>StartTag</name> <!-- name of field --> + <config> + <offset>0</offset> <!-- offset in the header --> + <size>0x8</size> <!-- size in the header --> + </config> + <content format='bytes'>0x55 0x42 0x4F 0x4F 0x54 0x42 0x4C 0x4B</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Code destination address, 32-bit aligned: for u-boot should be 0x80005000 so code will run in 0x80005200 as linked for --> + <name>DestAddr</name> <!-- name of field --> + <config> + <offset>0x140</offset> <!-- offset in the header --> + <size>0x4</size> <!-- size in the header --> + </config> + <content format='32bit'>0x8000</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- BootBlock or u-boot Code size --> + <name>CodeSize</name> <!-- name of field --> + <config> + <offset>0x144</offset> <!-- offset in the header --> + <size>0x4</size> <!-- size in the header --> + </config> + <content format='FileSize'>u-boot.bin</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- The BootBlock or u-boot binary file --> + <name>Code</name> <!-- name of field --> + <config> + <offset>0x200</offset> <!-- offset in the header --> + <size format='FileSize'>u-boot.bin</size> <!-- size in the header calculated by tool--> + </config> + <content format='FileContent'>u-boot.bin</content> <!-- content the user should fill --> + </BinField> + + <!-- BMC optional fields --> + <BinField> + <!-- Word contents copied by ROM code to FIU0 FIU_DRD_CFG register --> + <name>FIU0_DRD_CFG_Set</name> <!-- name of field --> + <config> + <offset>0x108</offset> <!-- offset in the header --> + <size>0x4</size> <!-- size in the header --> + </config> + <content format='32bit'>0x0300100B</content> <!-- content the user should fill 0x030032EB --> + </BinField> + + <BinField> + <!-- Defines the clock divide ratio from AHB to FIU0 clock --> + <name>FIU0_Clk_Divider</name> <!-- name of field --> + <config> + <offset>0x10C</offset> <!-- offset in the header --> + <size>0x1</size> <!-- size in the header --> + </config> + <content format='bytes'>0</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Defines if FIU0 CS1 is enabled --> + <name>fiu0_cs1_en</name> <!-- name of field --> + <config> + <offset>0x10D</offset> <!-- offset in the header --> + <size>0x1</size> <!-- size in the header --> + </config> + <content format='bytes'>0x0</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Defines if FIU0 CS2 is enabled --> + <name>fiu0_cs2_en</name> <!-- name of field --> + <config> + <offset>0x10E</offset> <!-- offset in the header --> + <size>0x1</size> <!-- size in the header --> + </config> + <content format='bytes'>0x0</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Defines if FIU0 CS3 is enabled --> + <name>fiu0_cs3_en</name> <!-- name of field --> + <config> + <offset>0x10F</offset> <!-- offset in the header --> + <size>0x1</size> <!-- size in the header --> + </config> + <content format='bytes'>0x0</content> <!-- content the user should fill --> + </BinField> + + <!-- BMC optional fields --> + <BinField> + <!-- Word contents copied by ROM code to FIU3 FIU_DRD_CFG register --> + <name>FIU3_DRD_CFG_Set</name> <!-- name of field --> + <config> + <offset>0x110</offset> <!-- offset in the header --> + <size>0x4</size> <!-- size in the header --> + </config> + <content format='32bit'>0x0</content> <!-- content the user should fill --> + </BinField> + + <!-- BMC optional fields --> + <BinField> + <!-- Word contents copied by ROM code to FIU3 FIU_DRD_CFG register --> + <name>FIU3_DWR_CFG_Set</name> <!-- name of field --> + <config> + <offset>0x114</offset> <!-- offset in the header --> + <size>0x4</size> <!-- size in the header --> + </config> + <content format='32bit'>0x0</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Defines the clock divide ratio from AHB to FIU3 clock --> + <name>FIU3_Clk_Divider</name> <!-- name of field --> + <config> + <offset>0x118</offset> <!-- offset in the header --> + <size>0x1</size> <!-- size in the header --> + </config> + <content format='bytes'>0x0</content> <!-- content the user should fill --> + </BinField> + + + <BinField> + <!-- Defines if FIU3 CS1 is enabled --> + <name>fiu3_cs1_en</name> <!-- name of field --> + <config> + <offset>0x119</offset> <!-- offset in the header --> + <size>0x1</size> <!-- size in the header --> + </config> + <content format='bytes'>0x0</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Defines if FIU3 CS2 is enabled --> + <name>fiu3_cs2_en</name> <!-- name of field --> + <config> + <offset>0x11A</offset> <!-- offset in the header --> + <size>0x1</size> <!-- size in the header --> + </config> + <content format='bytes'>0x0</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Defines if FIU3 CS3 is enabled --> + <name>fiu3_cs3_en</name> <!-- name of field --> + <config> + <offset>0x11B</offset> <!-- offset in the header --> + <size>0x1</size> <!-- size in the header --> + </config> + <content format='bytes'>0x0</content> <!-- content the user should fill --> + </BinField> + + <BinField> + <!-- Version (Major.Minor) --> + <name>Version</name> <!-- name of field --> + <config> + <offset>0x148</offset> <!-- offset in the header --> + <size>0x4</size> <!-- size in the header --> + </config> + <content format='32bit'>0</content> <!-- content the user should fill --> + </BinField> + + <!-- BMC optional fields --> + <BinField> + <!-- Word contents copied by BB code to FIU0 FIU_DWR_CFG register --> + <name>FIU0_DWR_CFG_Set</name> <!-- name of field --> + <config> + <offset>0x14C</offset> <!-- offset in the header --> + <size>0x4</size> <!-- size in the header --> + </config> + <content format='32bit'>0x03001102</content> <!-- content the user should fill --> + </BinField> + + +</Bin_Ecc_Map> diff --git a/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native_%.bbappend b/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native_%.bbappend new file mode 100644 index 000000000..06bc31f6a --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-bsp/images/npcm7xx-igps-native_%.bbappend @@ -0,0 +1,12 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI_append += "file://BootBlockAndHeader_GBS.xml" +SRC_URI_append += "file://UbootHeader_GBS.xml" + +# Prepare the Bootblock XMLs. +do_gbs_prepare_xmls() { + cp ${WORKDIR}/BootBlockAndHeader_GBS.xml ${S}/ImageGeneration/references/ + cp ${WORKDIR}/UbootHeader_GBS.xml ${S}/ImageGeneration/references/ +} + +addtask do_gbs_prepare_xmls after do_patch before do_install diff --git a/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton/fw_env.config b/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton/fw_env.config new file mode 100644 index 000000000..0c384273f --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton/fw_env.config @@ -0,0 +1,24 @@ +# Configuration file for fw_(printenv/setenv) utility. +# Up to two entries are valid, in this case the redundant +# environment sector is assumed present. +# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash. +# Futhermore, if the Flash sector size is ommitted, this value is assumed to +# be the same as the Environment size, which is valid for NOR and SPI-dataflash + +# NOR example +# MTD device name Device offset Env. size Flash sector size Number of sectors +/dev/mtd2 0x0000 0x40000 0x4000 + +# MTD SPI-dataflash example +# MTD device name Device offset Env. size Flash sector size Number of sectors +#/dev/mtd5 0x4200 0x4200 +#/dev/mtd6 0x4200 0x4200 + +# NAND example +#/dev/mtd0 0x4000 0x4000 0x20000 2 + +# Block device example +#/dev/mmcblk0 0xc0000 0x20000 + +# VFAT example +#/boot/uboot.env 0x0000 0x4000 diff --git a/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton_%.bbappend b/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton_%.bbappend new file mode 100644 index 000000000..8b66271a5 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-bsp/u-boot/u-boot-fw-utils-nuvoton_%.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://fw_env.config" + +do_install_append_gbs() { + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config +} diff --git a/meta-quanta/meta-gbs/recipes-core/busybox/busybox/busybox.cfg b/meta-quanta/meta-gbs/recipes-core/busybox/busybox/busybox.cfg new file mode 100644 index 000000000..4010eb573 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-core/busybox/busybox/busybox.cfg @@ -0,0 +1,2 @@ +CONFIG_LSUSB=y +CONFIG_DEVMEM=y diff --git a/meta-quanta/meta-gbs/recipes-core/busybox/busybox_%.bbappend b/meta-quanta/meta-gbs/recipes-core/busybox/busybox_%.bbappend new file mode 100644 index 000000000..6947a4cbb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-core/busybox/busybox_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://busybox.cfg" diff --git a/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.service b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.service new file mode 100644 index 000000000..ea44dda2d --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.service @@ -0,0 +1,13 @@ +[Unit] +Description=Boot Status LED Manager +After=xyz.openbmc_project.LED.GroupManager.service +Wants=xyz.openbmc_project.LED.GroupManager.service + +[Service] +ExecStart=/usr/bin/boot-status-led.sh +StandardOutput=syslog +Type=simple +Restart=yes + +[Install] +WantedBy=multi-user.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh new file mode 100644 index 000000000..a80082a1c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +BOOT_SERVICE_NAME="xyz.openbmc_project.State.Host" +BOOT_STATUS_OBJPATH="/xyz/openbmc_project/state/os" +BOOT_INTERFACE_NAME="xyz.openbmc_project.State.OperatingSystem.Status" +BOOT_Property="OperatingSystemState" + +LED_SERVICE_NAME="xyz.openbmc_project.LED.GroupManager" +LED_INACTIVE_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_inactive" +LED_STANDBY_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_standby" +LED_INTERFACE_NAME="xyz.openbmc_project.Led.Group" +LED_Property="Asserted" + +PWR_STATE_SERVICE="xyz.openbmc_project.State.Chassis" +PWR_STATE_OBJPATH="/xyz/openbmc_project/state/chassis0" +PWR_STATE_INTERFACE_NAME="xyz.openbmc_project.State.Chassis" +PWR_STATE_Property="CurrentPowerState" + +boot_status="" +power_state="" +led_status="" + +mapper wait $LED_INACTIVE_OBJPATH +mapper wait $LED_STANDBY_OBJPATH +while true; do + power_state="$(busctl get-property $PWR_STATE_SERVICE $PWR_STATE_OBJPATH $PWR_STATE_INTERFACE_NAME $PWR_STATE_Property | awk '{print $2}')" + + boot_status="$(busctl get-property $BOOT_SERVICE_NAME $BOOT_STATUS_OBJPATH $BOOT_INTERFACE_NAME $BOOT_Property | awk '{print $2}')" + + if [[ $power_state != "\"xyz.openbmc_project.State.Chassis.PowerState.On\"" ]];then + if [[ $led_status != "OFF" ]];then + busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false + busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b false + led_status="OFF" + fi + continue + else + if [[ $boot_status != "\"Standby\"" ]] && [[ $led_status != "BLINKING" ]];then + busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b true + led_status="BLINKING" + elif [[ $boot_status == "\"Standby\"" ]] && [[ $led_status != "ON" ]];then + busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false + busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b true + led_status="ON" + fi + fi + sleep 1 +done + +exit 0 diff --git a/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/gbs-boot-status-led.bb b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/gbs-boot-status-led.bb new file mode 100644 index 000000000..61c6ed407 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/gbs-boot-status-led.bb @@ -0,0 +1,25 @@ +SUMMARY = "OpenBMC Quanta Boot Status LED Service" +DESCRIPTION = "OpenBMC Quanta Boot Status LED Daemon." +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd + +DEPENDS += "systemd" +RDEPENDS_${PN} += "bash" + +SRC_URI = " file://boot-status-led.sh \ + file://boot-status-led.service \ + " + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/boot-status-led.sh ${D}${bindir}/ + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/boot-status-led.service ${D}${systemd_system_unitdir} +} + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "boot-status-led.service" diff --git a/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/files/cpld-version.service b/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/files/cpld-version.service new file mode 100644 index 000000000..87f42ae05 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/files/cpld-version.service @@ -0,0 +1,10 @@ +[Unit] +Description=Report CPLD Version + +[Service] +RemainAfterExit=yes +Type=oneshot +ExecStart=/usr/bin/cpld_version.sh + +[Install] +WantedBy=multi-user.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/files/cpld_version.sh b/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/files/cpld_version.sh new file mode 100644 index 000000000..c69949cc9 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/files/cpld_version.sh @@ -0,0 +1,124 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +################################################################# +# Prints CPLD version and save it in file /run/cpld0.version +# +# CPLD version format: Major.Minor.Point.Subpoint +# +# Major/Minor: base vendor image version, encoded in register 0x0 of the CPLD +# I2C bus. +# Major = higher 4 bits of register 0x00 +# Minor = lower 4 bits of register 0x00 +# Point/SubPoint: reserved as 0x0 for now +# +# e.g. reg[0] = 0x25 -> ver 2.5.0.0 +# +################################################################# + +CPLD_I2C_BUS_NUM=13 +CPLD_I2C_BUS_ADDR='0x21' +CPLD_I2C_BASEVER_REG='0x00' +VER_ENV_FILE='/run/cpld0.version' + +################################################################# +# Parse the byte value from i2cget and sanity checks the hex format +# Arguments: +# $1: i2c_bus_num +# $2: i2c_bus_addr +# $3: i2c_reg +# Global: +# 'byte_val' will be written with the numeric value from i2cget +# Returns: +# 0 if success, non-zero if failed to get the value or value is malformed +################################################################# +read_and_check_i2c_get() { + if ! (( $# == 3 )); then + echo "Usage: read_and_check_i2c_get i2c_bus_num i2c_bus_addr i2c_reg" + return 1 + fi + + local i2c_bus_num=$1 + local i2c_bus_addr=$2 + local i2c_reg=$3 + + local i2c_val_raw + i2c_val_raw=$(i2cget -y "${i2c_bus_num}" "${i2c_bus_addr}" "${i2c_reg}") || return + + # Verify that it is of format 0x[hex][hex]. + local HEXBYTE_RE='^0x[0-9A-Fa-f]{2}$' + if ! [[ ${i2c_val_raw} =~ ${HEXBYTE_RE} ]]; then + echo "i2cget $* outputs invalid value: ${i2c_val_raw}" + return 1 + fi + + ((byte_val = i2c_val_raw)) + return 0 +} + +################################################################# +# Prints CPLD version in Major.Minor.Point.Subpoint format. +# Each dot separated field is decimal number with no leading zeros. +# Arguments: +# None +# Globals: +# Write parsed version into the following global variables: +# cpld_ver_major +# cpld_ver_minor +# cpld_point +# cpld_subpoint +# Returns: +# 0 if success, non-zero otherwise +################################################################# +parse_cpld_ver() { + # Stores the output of read_and_check_i2c_get + local byte_val + + # Read a byte, assign higher 4 bits to cpld_ver_major and lower 4 bits to + # cpld_ver_minor. + # e.g. cpld_ver_raw = 0x09 => major_hex = 0, minor_hex = 9 + read_and_check_i2c_get ${CPLD_I2C_BUS_NUM} ${CPLD_I2C_BUS_ADDR} ${CPLD_I2C_BASEVER_REG} || + return + local cpld_ver + ((cpld_ver = byte_val)) + ((cpld_ver_major = cpld_ver >> 4)) + ((cpld_ver_minor = cpld_ver & 0xf)) + ((cpld_point = 0)) + ((cpld_subpoint = 0)) + + return 0 +} + +main() { + local cpld_ver_major + local cpld_ver_minor + local cpld_point + local cpld_subpoint + + parse_cpld_ver || return + + # Write CPLD version to file. + cpld_ver="${cpld_ver_major}.${cpld_ver_minor}.${cpld_point}.${cpld_subpoint}" + echo "CPLD version ${cpld_ver}" + echo "${cpld_ver}" > "${VER_ENV_FILE}" + + return 0 +} + +# Exit without running main() if sourced +return 0 2>/dev/null + +main "$@" diff --git a/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/gbs-cpld-ver-check.bb b/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/gbs-cpld-ver-check.bb new file mode 100644 index 000000000..afe91fc60 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/cpld-ver-check/gbs-cpld-ver-check.bb @@ -0,0 +1,25 @@ +DESCRIPTION = "Report CPLD Version" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd + +SRC_URI = " file://cpld_version.sh \ + file://cpld-version.service \ + " + +S = "${WORKDIR}" + +DEPENDS = "systemd" +RDEPENDS_${PN} = "bash" + +SYSTEMD_SERVICE_${PN} = "cpld-version.service" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${S}/cpld_version.sh ${D}${bindir}/ + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/cpld-version.service ${D}${systemd_system_unitdir} +} diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh new file mode 100644 index 000000000..3a215fa50 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh @@ -0,0 +1,84 @@ +#!/bin/sh +# Copyright 2020 Google LLC +# Copyright 2020 Quanta Computer Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Global variables + +# GPIO to control the host SPI mux +SPI_SW_SELECT=169 + +# Kernel control string for bind/unbind +KERNEL_FIU_ID="c0000000.fiu" + +# Kernel sysfs path for bind/unbind +KERNEL_SYSFS_FIU="/sys/bus/platform/drivers/NPCM-FIU" + +IMAGE_FILE="/tmp/image-bios" + +# Taken from /run/initramfs/update +# Given label name, return mtd node. e.g. `findmtd bmc` returns 'mtd0' +findmtd() { + m=$(grep -xl "$1" /sys/class/mtd/*/name) + m=${m%/name} + m=${m##*/} + echo $m +} + +cleanup() { + if [ -d "${KERNEL_SYSFS_FIU}/${KERNEL_FIU_ID}" ]; then + echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/unbind + fi + echo low > /sys/class/gpio/gpio${SPI_SW_SELECT}/direction # Switch mux to host + rm -f ${IMAGE_FILE} +} +trap cleanup EXIT SIGHUP SIGINT SIGTERM + +main() { + if [ ! -f ${IMAGE_FILE} ]; then + echo "Invalid bios image file!" + exit 1 + fi + + echo "Starting bios update..." + if [ ! -d "/sys/class/gpio/gpio${SPI_SW_SELECT}" ]; then + echo "${SPI_SW_SELECT}" > /sys/class/gpio/export + fi + + echo high > /sys/class/gpio/gpio${SPI_SW_SELECT}/direction # Switch mux to BMC + + if [ -d "${KERNEL_SYSFS_FIU}/${KERNEL_FIU_ID}" ]; then + echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/unbind + fi + echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/bind + + # BIOS flash is labelled 'pnor' + pnor_mtd=$(findmtd pnor) + if [ -z "${pnor_mtd}" ]; then + echo "Cannot find bios flash mtd partition!" + exit 1 + fi + + flashcp -v $IMAGE_FILE /dev/"${pnor_mtd}" + if [ $? -eq 0 ]; then + echo "bios update successfully..." + else + echo "bios update failed..." + exit 1 + fi +} +# Exit without running main() if sourced +return 0 2>/dev/null + +main "$@" diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh new file mode 100644 index 000000000..3da25e483 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# Copyright (c) 2019-present Lenovo +# Copyright (c) 2020 Quanta Computer Inc. +# Licensed under BSD-3, see COPYING.BSD file for details. + +IMAGE_FILE="/tmp/bios-image" +SIG_FILE="/tmp/bmc.sig" +BURN_IMAGE="/tmp/image-bios" +sha256_image="FFFF" +sha256_file="EEEE" + +echo "Verify bios image..." + +if [ -e $IMAGE_FILE ] && [ -e $SIG_FILE ]; +then + sha256_image=`sha256sum "$IMAGE_FILE" | awk '{print $1}'` + sha256_file=`awk '{print $1}' $SIG_FILE` +fi + +if [[ $sha256_image != $sha256_file ]]; +then + echo "bios image verify fail." + rm -f $IMAGE_FILE + echo "Remove bios image" + exit 1 +else + echo "bios image verify ok." + mv $IMAGE_FILE $BURN_IMAGE + rm -f $SIG_FILE + exit 0 +fi diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/config-bios.json b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/config-bios.json new file mode 100644 index 000000000..efbe6f830 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/config-bios.json @@ -0,0 +1,20 @@ +[{ + "blob": "/flash/bios", + "handler": { + "type": "file", + "path": "/tmp/bios-image" + }, + "actions": { + "preparation": { + "type": "skip" + }, + "verification": { + "type": "systemd", + "unit": "phosphor-ipmi-flash-bios-verify.service" + }, + "update": { + "type": "systemd", + "unit": "phosphor-ipmi-flash-bios-update.service" + } + } +}] diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/phosphor-ipmi-flash-bios-update.service b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/phosphor-ipmi-flash-bios-update.service new file mode 100644 index 000000000..a08816a4c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/phosphor-ipmi-flash-bios-update.service @@ -0,0 +1,9 @@ +[Unit] +Description=Phosphor-ipmi-flash update BIOS service + +[Service] +ExecStart=/usr/bin/bios-update.sh +Type=oneshot + +[Install] +WantedBy=phosphor-ipmi-flash-bios-update.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/phosphor-ipmi-flash-bios-verify.service b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/phosphor-ipmi-flash-bios-verify.service new file mode 100644 index 000000000..af0e196b4 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/phosphor-ipmi-flash-bios-verify.service @@ -0,0 +1,9 @@ +[Unit] +Description=Phosphor-ipmi-flash verify BIOS service + +[Service] +ExecStart=/usr/bin/bios-verify.sh +Type=oneshot + +[Install] +WantedBy=phosphor-ipmi-flash-bios-verify.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/gbs-bios-update.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/gbs-bios-update.bb new file mode 100644 index 000000000..32b9d512b --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/gbs-bios-update.bb @@ -0,0 +1,39 @@ +PR = "r1" +LICENSE = "Apache-2.0 & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \ + file://${COREBASE}/meta/files/common-licenses/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ + " + +inherit systemd +inherit obmc-phosphor-systemd + + +DEPENDS += "systemd" +DEPENDS += "phosphor-ipmi-flash" +RDEPENDS_${PN} += "bash" + +SRC_URI += " file://bios-verify.sh \ + file://bios-update.sh \ + file://phosphor-ipmi-flash-bios-verify.service \ + file://phosphor-ipmi-flash-bios-update.service \ + file://config-bios.json \ + " + +FILES_${PN} += "${datadir}/phosphor-ipmi-flash/config-bios.json" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/bios-verify.sh ${D}${bindir}/ + install -m 0755 ${WORKDIR}/bios-update.sh ${D}${bindir}/ + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bios-verify.service ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bios-update.service ${D}${systemd_system_unitdir} + + install -d ${D}${datadir}/phosphor-ipmi-flash + install -m 0644 ${WORKDIR}/config-bios.json ${D}${datadir}/phosphor-ipmi-flash +} + + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "phosphor-ipmi-flash-bios-verify.service phosphor-ipmi-flash-bios-update.service" diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh new file mode 100644 index 000000000..bbaf15d7d --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +sigfile="/tmp/bmc.sig" +imagebmc="/run/initramfs/image-bmc" +bmcimage="/run/initramfs/bmc-image" +publickey="/etc/activationdata/OpenBMC/publickey" +bmclog="/tmp/update-bmc.log" + +if [ -f $publickey ];then + r="$(openssl dgst -verify $publickey -sha256 -signature $sigfile $bmcimage)" + echo "$r" > $bmclog + if [[ "Verified OK" == "$r" ]]; then + mv $bmcimage $imagebmc + rm -f $sigfile + exit 0 + else + exit 1 + fi +else + echo "No $publickey file" > $bmclog + exit 1 +fi diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/config-bmc.json b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/config-bmc.json new file mode 100644 index 000000000..16c7151ed --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/config-bmc.json @@ -0,0 +1,21 @@ +[{ + "blob": "/flash/image", + "handler": { + "type": "file", + "path": "/run/initramfs/bmc-image" + }, + "actions": { + "preparation": { + "type": "skip" + }, + "verification": { + "type": "systemd", + "unit": "phosphor-ipmi-flash-bmc-verify.service" + }, + "update": { + "type": "systemd", + "unit": "reboot.target", + "mode": "replace-irreversibly" + } + } +}] diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/phosphor-ipmi-flash-bmc-verify.service b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/phosphor-ipmi-flash-bmc-verify.service new file mode 100644 index 000000000..574b318ef --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/phosphor-ipmi-flash-bmc-verify.service @@ -0,0 +1,9 @@ +[Unit] +Description=Phosphor-ipmi-flash bmc verify service + +[Service] +ExecStart=/usr/bin/bmc-verify.sh +Type=oneshot + +[Install] +WantedBy=phosphor-ipmi-flash-bmc-verify.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/gbs-bmc-update.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/gbs-bmc-update.bb new file mode 100644 index 000000000..a177586ca --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/gbs-bmc-update.bb @@ -0,0 +1,34 @@ +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + + +inherit systemd +inherit obmc-phosphor-systemd + + +SRC_URI = " file://phosphor-ipmi-flash-bmc-verify.service \ + file://bmc-verify.sh \ + file://config-bmc.json \ + " + +FILES_${PN} += "${datadir}/phosphor-ipmi-flash/config-bmc.json" + +DEPENDS += "systemd" +DEPENDS += "phosphor-ipmi-flash" +RDEPENDS_${PN} = "bash" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/bmc-verify.sh ${D}${bindir}/ + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bmc-verify.service ${D}${systemd_system_unitdir} + + install -d ${D}${datadir}/phosphor-ipmi-flash + install -m 0644 ${WORKDIR}/config-bmc.json ${D}${datadir}/phosphor-ipmi-flash +} + + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "phosphor-ipmi-flash-bmc-verify.service" diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/files/gbs-detect-fan-fail.service b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/files/gbs-detect-fan-fail.service new file mode 100644 index 000000000..ecdc95399 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/files/gbs-detect-fan-fail.service @@ -0,0 +1,11 @@ +[Unit] +Description=Detect Fan Fail Manager +After=phosphor-pid-control.service + +[Service] +ExecStart=/usr/bin/gbs-detect-fan-fail.sh +Restart=always +StandardOutput=syslog + +[Install] +WantedBy=multi-user.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/files/gbs-detect-fan-fail.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/files/gbs-detect-fan-fail.sh new file mode 100644 index 000000000..56ae7bbc5 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/files/gbs-detect-fan-fail.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +## + # This script is to handle fan fail condition which is described below. + # Fan fail means one fan RPM is under its CriticalLow. If BMC encounters + # such situation, then sets other fans to full speed. + # + +# get fan state +function get_fan_state() { + get_property_path='xyz.openbmc_project.Sensor.Threshold.Critical CriticalAlarmLow' + fan_state="$(busctl get-property $1 $2 $get_property_path | awk '{print $2}')" + echo "$fan_state" +} + +# check fan fail +function is_fan_fail() { + fan_state=("$@") + + for i in "${fan_state[@]}" + do + if [ ! -z "$i" ] + then + if [ $i == "true" ] + then + echo 1 + return + fi + fi + done + echo 0 +} + +fan_tach_path=( '/xyz/openbmc_project/sensors/fan_tach/fan0' + '/xyz/openbmc_project/sensors/fan_tach/fan1' + '/xyz/openbmc_project/sensors/fan_tach/fb_fan0' + '/xyz/openbmc_project/sensors/fan_tach/fb_fan1' + '/xyz/openbmc_project/sensors/fan_tach/fb_fan2' + ) + +check_fail_flag=0 +is_fan_fail_flag=0 +current_fan_state=() + +while true +do + for i in ${!fan_tach_path[@]} + do + mapper wait ${fan_tach_path[$i]} + hwmon_path="$(mapper get-service ${fan_tach_path[0]})" + current_fan_state[$i]=$(get_fan_state $hwmon_path ${fan_tach_path[$i]}) + done + + is_fan_fail_flag=$(is_fan_fail "${current_fan_state[@]}") + + # if fan fails then set all fans to full speed + if [ $is_fan_fail_flag -eq 1 ] && [ $check_fail_flag -eq 0 ] + then + check_fail_flag=1 + systemctl stop phosphor-pid-control.service + + # fans recover to normal state + elif [ $is_fan_fail_flag -eq 0 ] && [ $check_fail_flag -eq 1 ] + then + check_fail_flag=0 + systemctl restart phosphor-pid-control.service + fi + + sleep 2 +done diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/gbs-detect-fan-fail.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/gbs-detect-fan-fail.bb new file mode 100644 index 000000000..5befec8d6 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-fan-fail/gbs-detect-fan-fail.bb @@ -0,0 +1,25 @@ +SUMMARY = "OpenBMC Quanta Detect Fan Fail Service" +DESCRIPTION = "OpenBMC Quanta Detect Fan Fail Daemon." +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd + +DEPENDS += "systemd" +RDEPENDS_${PN} += "bash" + +SRC_URI = " file://gbs-detect-fan-fail.sh \ + file://gbs-detect-fan-fail.service \ + " + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/gbs-detect-fan-fail.sh ${D}${bindir}/ + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/gbs-detect-fan-fail.service ${D}${systemd_system_unitdir} +} + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "gbs-detect-fan-fail.service" diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.service b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.service new file mode 100644 index 000000000..982ae6f5a --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.service @@ -0,0 +1,12 @@ +[Unit] +Description=Detect GPIO Present Manager +After=phosphor-gpio-presence@.service +Wants=phosphor-gpio-presence@.service + +[Service] +ExecStart=/usr/bin/detect-gpio-present.sh +StandardOutput=syslog +Type=simple + +[Install] +WantedBy=multi-user.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh new file mode 100644 index 000000000..2bbe46e84 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +SERVICE_NAME="xyz.openbmc_project.Inventory.Manager" +PRESENT_OBJPATH=("/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab0_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab1_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab2_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab3_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/cable/hsbp_cab_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/cable/fanbd_cab_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/cable/bp12v_cab_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/entity/sata0_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/entity/pe_slot0_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/entity/pe_slot1_prsnt") +INTERFACE_NAME="xyz.openbmc_project.Inventory.Item" + +IPMI_LOG_SERVICE="xyz.openbmc_project.Logging.IPMI" +IPMI_LOG_OBJPATH="/xyz/openbmc_project/Logging/IPMI" +IPMI_LOG_INTERFACE="xyz.openbmc_project.Logging.IPMI" +IPMI_LOG_FUNCT="IpmiSelAdd" +IPMI_LOG_PARA_FORMAT="ssaybq" #5 parameters, s : string, s : string, ay : byte array, b : boolean, y : UINT16 +LOG_ERR="Configuration Error(Incorrect_interconnection)" +LOG_EVENT_DATA="3 0x01 0xff 0xfe" +LOG_ASSERT_FLAG="true" +LOG_DEASSERT_FLAG="false" +LOG_GENID_FLAG="0x0020" +present_state=("true" "true" "true" "true" "true" "true" "true" "true" "true" "true") + +while true; do + for i in ${!PRESENT_OBJPATH[@]} + do + mapper wait ${PRESENT_OBJPATH[$i]} + boot_status="$(busctl get-property $SERVICE_NAME ${PRESENT_OBJPATH[$i]} $INTERFACE_NAME Present | awk '{print $2}')" + + if [ $boot_status == "false" ] && [ ${present_state[$i]} == "true" ];then + echo "Update cable $(($i+1)) state." + present_state[$i]="false" + busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" ${PRESENT_OBJPATH[$i]} $LOG_EVENT_DATA $LOG_ASSERT_FLAG $LOG_GENID_FLAG + elif [ $boot_status == "true" ] && [ ${present_state[$i]} == "false" ];then + echo "Update cable $(($i+1)) state." + present_state[$i]="true" + busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" ${PRESENT_OBJPATH[$i]} $LOG_EVENT_DATA $LOG_DEASSERT_FLAG $LOG_GENID_FLAG + fi + done + sleep 1 +done + +exit 0 diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/gbs-detect-gpio-present.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/gbs-detect-gpio-present.bb new file mode 100644 index 000000000..3e1a6d8ac --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/gbs-detect-gpio-present.bb @@ -0,0 +1,25 @@ +SUMMARY = "OpenBMC Quanta Detect Present Service" +DESCRIPTION = "OpenBMC Quanta Detect Present Daemon." +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd + +DEPENDS += "systemd" +RDEPENDS_${PN} += "bash" + +SRC_URI = " file://detect-gpio-present.sh \ + file://detect-gpio-present.service \ + " + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/detect-gpio-present.sh ${D}${bindir}/ + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/detect-gpio-present.service ${D}${systemd_system_unitdir} +} + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "detect-gpio-present.service" diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-ipmi-entity-association-map/files/entity_association_map.json b/meta-quanta/meta-gbs/recipes-gbs/gbs-ipmi-entity-association-map/files/entity_association_map.json new file mode 100644 index 000000000..f4e453a9a --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-ipmi-entity-association-map/files/entity_association_map.json @@ -0,0 +1,29 @@ +{ + "system_board": [ + {"instance": 1, "name": "/"}, + {"instance": 28, "name": "/i2cool_0"}, + {"instance": 29, "name": "/i2cool_1"}, + {"instance": 30, "name": "/i2cool_2"} + ], + "system_internal_expansion_board": [ + {"instance": 1, "name": "/"} + ], + "power_system_board": [ + {"instance": 1, "name": "/"} + ], + "add_in_card": [ + {"instance": 0, "name": "/PE0"}, + {"instance": 1, "name": "/PE1"} + ], + "fan": [ + {"instance": 0, "name": "/fan0"}, + {"instance": 1, "name": "/fan1"}, + {"instance": 2, "name": "/fb_fan0"}, + {"instance": 3, "name": "/fb_fan1"}, + {"instance": 4, "name": "/fb_fan2"} + ], + "cooling_unit": [ + {"instance": 0, "name": "/ZONE0"}, + {"instance": 1, "name": "/ZONE1"} + ] +} diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-ipmi-entity-association-map/gbs-ipmi-entity-association-map.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-ipmi-entity-association-map/gbs-ipmi-entity-association-map.bb new file mode 100644 index 000000000..8b5551e79 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-ipmi-entity-association-map/gbs-ipmi-entity-association-map.bb @@ -0,0 +1,16 @@ +SUMMARY = "GBS IPMI Entity association mapping." +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI += "file://entity_association_map.json" + +FILES_${PN} = " \ + ${datadir}/ipmi-entity-association/entity_association_map.json \ + " + +do_install() { + install -d ${D}${datadir}/ipmi-entity-association + install -m 0644 -D ${WORKDIR}/entity_association_map.json \ + ${D}${datadir}/ipmi-entity-association/entity_association_map.json +} diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-nvme-pwr-ctrl/gbs-nvme-pwr-ctrl.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-nvme-pwr-ctrl/gbs-nvme-pwr-ctrl.bb new file mode 100644 index 000000000..a3f0c58d9 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-nvme-pwr-ctrl/gbs-nvme-pwr-ctrl.bb @@ -0,0 +1,19 @@ +SUMMARY = "NVMe Drives Power Control" +DESCRIPTION = "Daemon to monitor and control the power of NVMe drives" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit meson pkgconfig +inherit systemd + +DEPENDS += "sdbusplus" +DEPENDS += "boost" +DEPENDS += "libgpiod" + +SRC_URI = "git://github.com/quanta-bmc/nvme-power-control;protocol=git" +SRCREV = "f7d2dbd6b48f3992d4a2fb1c0fe2afd746b8428a" + +S = "${WORKDIR}/git" + +SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.Control.Nvme.Power.service" diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-gpio-common.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-gpio-common.sh new file mode 100644 index 000000000..55f631a5d --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-gpio-common.sh @@ -0,0 +1,165 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# Copyright 2020 Quanta Computer Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Common GPIO functions. + +# Map names of GPIOs to GPIO number +declare -A GPIO_NAMES_TO_NUMBER=( + ['RST_BMC_PHY_N']=15 + ['BMC_BRD_REV_ID6']=37 + ['BMC_BRD_REV_ID5']=38 + ['BMC_BRD_SKU_ID3']=39 + ['BMC_BRD_SKU_ID2']=40 + ['FM_BMC_CPU_UART_EN']=76 + ['RST_BMC_RSMRST_N']=87 + ['RST_KBRST_BMC_CPLD_N']=94 + ['FAN_BRD_REV_ID0']=122 + ['FAN_BRD_REV_ID1']=123 + ['HSBP_BRD_REV_ID3']=124 + ['HSBP_BRD_REV_ID2']=125 + ['HSBP_BRD_REV_ID1']=126 + ['BMC_BRD_REV_ID0']=136 + ['BMC_BRD_REV_ID1']=137 + ['BMC_BRD_REV_ID2']=138 + ['BMC_BRD_REV_ID3']=139 + ['BMC_BRD_REV_ID4']=140 + ['BMC_BRD_SKU_ID0']=141 + ['BMC_BRD_SKU_ID1']=142 + ['HDD_PRSNT_N']=160 + ['SPI_SW_SELECT']=169 + ['BMC_BRD_REV_ID7']=194 + ['HSBP_BRD_REV_ID0']=196 +) + +# 1 is active_low 0 is active_high +declare -A GPIO_NAMES_TO_ACTIVE_LOW=( + ['RST_BMC_PHY_N']=1 + ['BMC_BRD_REV_ID6']=0 + ['BMC_BRD_REV_ID5']=0 + ['BMC_BRD_SKU_ID3']=0 + ['BMC_BRD_SKU_ID2']=0 + ['FM_BMC_CPU_UART_EN']=0 + ['RST_BMC_RSMRST_N']=1 + ['RST_KBRST_BMC_CPLD_N']=1 + ['FAN_BRD_REV_ID0']=0 + ['FAN_BRD_REV_ID1']=0 + ['HSBP_BRD_REV_ID3']=0 + ['HSBP_BRD_REV_ID2']=0 + ['HSBP_BRD_REV_ID1']=0 + ['BMC_BRD_REV_ID0']=0 + ['BMC_BRD_REV_ID1']=0 + ['BMC_BRD_REV_ID2']=0 + ['BMC_BRD_REV_ID3']=0 + ['BMC_BRD_REV_ID4']=0 + ['BMC_BRD_SKU_ID0']=0 + ['BMC_BRD_SKU_ID1']=0 + ['HDD_PRSNT_N']=1 + ['SPI_SW_SELECT']=0 + ['BMC_BRD_REV_ID7']=0 + ['HSBP_BRD_REV_ID0']=0 +) + +################################################## +# Initializes the gpio state +# This operation is idempotent and can be applied +# repeatedly to the same gpio. It will make sure the +# gpio ends up in the initialized state even if it +# was. +# Arguments: +# $1: GPIO name +# Return: +# 0 if success, non-zero if error +################################################## +init_gpio() { + if (( $# != 1 )); then + echo "Usage: init_gpio name" >&2 + return 1 + fi + + local name=$1 + + local number=${GPIO_NAMES_TO_NUMBER["${name}"]} + if [[ -z ${number} ]]; then + echo "Missing number info for: ${name}" >&2 + return 2 + fi + + local active_low=${GPIO_NAMES_TO_ACTIVE_LOW["${name}"]} + if [[ -z ${active_low} ]]; then + echo "Missing active_low info for: ${name}" >&2 + return 2 + fi + + if [[ ! -e "/sys/class/gpio/gpio${number}" ]]; then + echo "${number}" >'/sys/class/gpio/export' + fi + echo "${active_low}" >"/sys/class/gpio/gpio${number}/active_low" +} + +################################################## +# Set output GPIO direction. +# Arguments: +# $1: GPIO name +# $2: GPIO direction, "high" or "low" +# Return: +# 0 if success, non-zero if error +################################################## +set_gpio_direction() { + if (( $# != 2 )); then + echo 'Usage: set_gpio_direction name direction' >&2 + return 1 + fi + + local name=$1 + local direction=$2 + + local number=${GPIO_NAMES_TO_NUMBER["${name}"]} + if [[ -z ${number} ]]; then + echo "Missing number info for: ${name}" >&2 + return 2 + fi + + init_gpio "${name}" || return + echo "${direction}" >"/sys/class/gpio/gpio${number}/direction" + echo "Set gpio ${name} #${number} to direction ${direction}" >&2 +} + +################################################## +# Get GPIO value +# Arguments: +# $1: GPIO name +# Return: +# 0 if success, non-zero if error +# stdout: The value of the gpio +################################################## +get_gpio_value() { + if (( $# != 1 )); then + echo 'Usage: get_gpio_value name' >&2 + return 1 + fi + + local name=$1 + + local number=${GPIO_NAMES_TO_NUMBER["${name}"]} + if [[ -z ${number} ]]; then + echo "Missing number info for: ${name}" >&2 + return 2 + fi + + init_gpio "${name}" || return + cat "/sys/class/gpio/gpio${number}/value" +} diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.service b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.service new file mode 100644 index 000000000..645136b85 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.service @@ -0,0 +1,13 @@ +[Unit] +Description = Initialization for GBS boot up +Wants=mapper-wait@-xyz-openbmc_project-inventory.service +After=mapper-wait@-xyz-openbmc_project-inventory.service +Wants=mapper-wait@-xyz-openbmc_project-control-nvme.service +After=mapper-wait@-xyz-openbmc_project-control-nvme.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/gbs-sysinit.sh + +[Install] +WantedBy=multi-user.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh new file mode 100644 index 000000000..68adfedef --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh @@ -0,0 +1,272 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# Copyright 2020 Quanta Computer Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +source /usr/libexec/gbs-gpio-common.sh + +WD1RCR_ADDR=0xf080103c +CORSTC_ADDR=0xf080105c +BOARD_VER="" # Set by check_board_ver +pe_eeprom_addr=( 50 54 ) + +SERVICE_NAME="xyz.openbmc_project.Inventory.Manager" +INTERFACE_NAME="xyz.openbmc_project.Inventory.Item" + +PE_PRESENT_OBJPATH=("/xyz/openbmc_project/inventory/system/chassis/entity/pe_slot0_prsnt" +"/xyz/openbmc_project/inventory/system/chassis/entity/pe_slot1_prsnt") +SATA0_PRESENT_OBJPATH="/xyz/openbmc_project/inventory/system/chassis/entity/sata0_prsnt" + +set_gpio_persistence() { + reg_val=$(devmem ${WD1RCR_ADDR} 32) + # Clear bit 16-23 to perserve all GPIO states across warm resets + reg_val=$(printf "0x%08x" $((reg_val & ~0xff0000))) + echo "Setting WD1RCR_ADDR to ${reg_val}" + devmem "${WD1RCR_ADDR}" 32 "${reg_val}" + + reg_val=$(devmem ${CORSTC_ADDR} 32) + # Clear bit 16-23 of CORSTC + reg_val=$(printf "0x%08x" $((reg_val & ~0xff0000))) + echo "Setting CORSTC_ADDR to ${reg_val}" + devmem "${CORSTC_ADDR}" 32 "${reg_val}" +} + +get_board_rev_id() { + echo $(get_gpio_value 'BMC_BRD_REV_ID7')\ + $(get_gpio_value 'BMC_BRD_REV_ID6')\ + $(get_gpio_value 'BMC_BRD_REV_ID5')\ + $(get_gpio_value 'BMC_BRD_REV_ID4')\ + $(get_gpio_value 'BMC_BRD_REV_ID3')\ + $(get_gpio_value 'BMC_BRD_REV_ID2')\ + $(get_gpio_value 'BMC_BRD_REV_ID1')\ + $(get_gpio_value 'BMC_BRD_REV_ID0')\ + | sed 's/ //g' > ~/board_rev_id.txt +} + +get_board_sku_id() { + echo $(get_gpio_value 'BMC_BRD_SKU_ID3')\ + $(get_gpio_value 'BMC_BRD_SKU_ID2')\ + $(get_gpio_value 'BMC_BRD_SKU_ID1')\ + $(get_gpio_value 'BMC_BRD_SKU_ID0')\ + | sed 's/ //g' > ~/board_sku_id.txt +} + +get_hsbp_board_rev_id() { + echo $(get_gpio_value 'HSBP_BRD_REV_ID3')\ + $(get_gpio_value 'HSBP_BRD_REV_ID2')\ + $(get_gpio_value 'HSBP_BRD_REV_ID1')\ + $(get_gpio_value 'HSBP_BRD_REV_ID0')\ + | sed 's/ //g' > ~/hsbp_board_rev_id.txt +} + +get_fan_board_rev_id() { + echo $(get_gpio_value 'FAN_BRD_REV_ID1')\ + $(get_gpio_value 'FAN_BRD_REV_ID0')\ + | sed 's/ //g' > ~/fan_board_rev_id.txt +} + +check_board_ver() { + # Sets BOARD_VER to either "PREPVT" or "PVT" + # + # BOARD_REV_ID[7:6] = + # 0x00 - EVT + # 0x01 - DVT + # 0x10 - PVT + # 0x11 - MP + + rev7_val=$(get_gpio_value 'BMC_BRD_REV_ID7') + if (( rev7_val == 0 )); then + echo "EVT/DVT rev!" + BOARD_VER="PREPVT" + else + echo "PVT/MP rev!" + BOARD_VER="PVT" + fi +} + +check_board_sku() { + sku1_val=$(get_gpio_value 'BMC_BRD_SKU_ID1') + if (( sku1_val == 1 )); then + echo "GBS SKU!" + BOARD_SKU="GBS" + else + echo "Other SKU!" + BOARD_SKU="TBD" + fi +} + +set_uart_en_low() { + # GPIO76 UART_EN polarity inverted between DVT/PVT + # Pin direction was set high in the kernel. + set_gpio_direction 'FM_BMC_CPU_UART_EN' low +} + +set_hdd_prsnt() { + # On PVT need to forward SATA0_PRSNT_N to HDD_PRSNT_N + # The signal is safe to set on DVT boards so just set universally. + sata_prsnt_n="$(busctl get-property $SERVICE_NAME ${SATA0_PRESENT_OBJPATH} \ + $INTERFACE_NAME Present)" + if [[ "$?" == "0" && ${sata_prsnt_n} == "b false" ]]; then + return 1 + fi + # sata_prsnt_n is active low => value "true" means low + if [[ ${sata_prsnt_n} == "b true" ]]; then + set_gpio_direction 'HDD_PRSNT_N' low + else + set_gpio_direction 'HDD_PRSNT_N' high + fi +} + +KERNEL_FIU_ID="c0000000.fiu" +KERNEL_SYSFS_FIU="/sys/bus/platform/drivers/NPCM-FIU" + +bind_host_mtd() { + set_gpio_direction 'SPI_SW_SELECT' high + if [[ -d ${KERNEL_SYSFS_FIU}/${KERNEL_FIU_ID} ]]; then + echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/unbind + fi + echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/bind +} + +unbind_host_mtd() { + if [[ -d ${KERNEL_SYSFS_FIU}/${KERNEL_FIU_ID} ]]; then + echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/unbind + fi + set_gpio_direction 'SPI_SW_SELECT' low +} +trap unbind_host_mtd EXIT SIGHUP SIGINT SIGTERM + +# Taken from /run/initramfs/update +# Given label name, return mtd node. e.g. `findmtd bmc` returns 'mtd0' +findmtd() { + m=$(grep -xl "$1" /sys/class/mtd/*/name) + m=${m%/name} + m=${m##*/} + echo $m +} + +verify_host_bios() { + echo "BIOS verification start!" + + # placeholder for verifying host BIOS. For now time BIOS read + # with dd + bind_host_mtd || { echo "Failed to bind FIU driver for host MTD"; return 1; } + + pnor_mtd=$(findmtd pnor) + [[ -z "${pnor_mtd}" ]] && { echo "Failed to find host MTD partition!"; return 1; } + + # Test timing by computing SHA256SUM. + sha256sum /dev/${pnor_mtd}ro + + echo "BIOS verification complete!" + unbind_host_mtd +} + +reset_phy() { + ifconfig eth1 down + set_gpio_direction 'RST_BMC_PHY_N' low + set_gpio_direction 'RST_BMC_PHY_N' high + ifconfig eth1 up +} + +parse_pe_fru() { + pe_fruid=3 + for i in {1..2}; + do + pe_prsnt_n="$(busctl get-property $SERVICE_NAME ${PE_PRESENT_OBJPATH[$(($i-1))]} \ + $INTERFACE_NAME Present)" + + if [[ "$?" == "0" && ${pe_prsnt_n} == "b false" ]]; then + pe_fruid=$(($pe_fruid+1)) + continue + fi + + # Output is the i2c bus number for the PCIE cards on PE0/PE1 + # i2c-0 -> i2c mux (addr: 0x71) -> PE0/PE1 + # PE0: channel 0 + # PE1: channel 1 + pe_fru_bus="$(ls -al /sys/bus/i2c/drivers/pca954x/0-0071/ | grep channel \ + | awk -F "/" '{print $(NF)}' | awk -F "-" '{print $2}' | sed -n "${i}p")" + + # If the PE FRU EEPROM syspath does not exist, create it ("24c02" is the + # EEPROM part number) and perform a phosphor-read-eeprom + for ((j=0; j < ${#pe_eeprom_addr[@]}; j++)); + do + i2cget -f -y $pe_fru_bus "0x${pe_eeprom_addr[$j]}" 0x01 > /dev/null 2>&1 + if [ $? -eq 0 ]; then + if [ ! -f "/sys/bus/i2c/devices/$pe_fru_bus-00${pe_eeprom_addr[$j]}/eeprom" ]; then + echo 24c02 "0x${pe_eeprom_addr[$j]}" > "/sys/bus/i2c/devices/i2c-$pe_fru_bus/new_device" + fi + pe_fru_bus="/sys/bus/i2c/devices/$pe_fru_bus-00${pe_eeprom_addr[$j]}/eeprom" + phosphor-read-eeprom --eeprom $pe_fru_bus --fruid $pe_fruid + break + fi + done + pe_fruid=$(($pe_fruid+1)) + done +} + +check_power_status() { + res0="$(busctl get-property -j xyz.openbmc_project.State.Chassis \ + /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis \ + CurrentPowerState | jq -r '.["data"]')" + echo $res0 +} + +main() { + get_board_rev_id + get_board_sku_id + get_hsbp_board_rev_id + get_fan_board_rev_id + + check_board_ver + if [[ "${BOARD_VER}" == "PREPVT" ]]; then + set_uart_en_low + fi + + check_board_sku + + set_hdd_prsnt + + reset_phy + + if [[ $(check_power_status) != \ + 'xyz.openbmc_project.State.Chassis.PowerState.On' ]]; then + verify_host_bios + + echo "Release host from reset!" >&2 + set_gpio_direction 'RST_BMC_RSMRST_N' high + set_gpio_direction 'RST_KBRST_BMC_CPLD_N' high + # TODO: remove the hack once kernel driver is ready + # Set the GPIO states to preserve across reboots + set_gpio_persistence + + echo "Starting host power!" >&2 + busctl set-property xyz.openbmc_project.State.Host \ + /xyz/openbmc_project/state/host0 \ + xyz.openbmc_project.State.Host \ + RequestedHostTransition s \ + xyz.openbmc_project.State.Host.Transition.On + else + echo "Host is already running, doing nothing!" >&2 + fi + + parse_pe_fru +} + +# Exit without running main() if sourced +return 0 2>/dev/null + +main "$@" diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/gbs-sysinit.bb b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/gbs-sysinit.bb new file mode 100644 index 000000000..68a9cf181 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/gbs-sysinit.bb @@ -0,0 +1,31 @@ +SUMMARY = "Phosphor OpenBMC Quanta GBS System Initialization Service" +DESCRIPTION = "Phosphor OpenBMC Quanta GBS System Init" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd + +DEPENDS += "systemd" +RDEPENDS_${PN} += "bash" +RDEPENDS_${PN} += "libsystemd" +RDEPENDS_${PN} += "jq" + +SRC_URI = "file://gbs-sysinit.sh \ + file://gbs-gpio-common.sh \ + file://gbs-sysinit.service \ + " + +do_install () { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/gbs-sysinit.sh ${D}${bindir}/ + + install -d ${D}${libexecdir} + install -m 0755 ${WORKDIR}/gbs-gpio-common.sh ${D}${libexecdir}/ + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/gbs-sysinit.service ${D}${systemd_system_unitdir} +} + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "gbs-sysinit.service" diff --git a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/hotswap-power-cycle.service b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/hotswap-power-cycle.service new file mode 100644 index 000000000..054b2fe6d --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/hotswap-power-cycle.service @@ -0,0 +1,10 @@ +[Unit] +Description=Power Cycle by Hotswap Controller + +[Service] +Type=oneshot +EnvironmentFile=-/run/psu_timedelay +ExecStart=/usr/bin/tray_powercycle.sh + +[Install] +WantedBy=gbmc-psu-hardreset.target diff --git a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh new file mode 100644 index 000000000..5cbf49bb5 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# PSU hard reset (power cycle) script. +# +# Power cycle the entire tray by setting the PSU hotswap reset (GPIO218) to high +# +# Global variable: PSU_HARDRESET_DELAY specifies the number of seconds to wait +# before pulling the trigger. If not specified or zero, the script power cycles +# immediately. +main() { + # Sleep PSU_HARDRESET_DELAY seconds + local psu_delay=$((PSU_HARDRESET_DELAY)) + if ((psu_delay > 0)); then + echo "Sleeping ${psu_delay} seconds before PSU hard reset!" + sleep "${psu_delay}" + fi + + gpioset gpiochip6 26=1 +} + +# Exit without running main() if sourced +return 0 2>/dev/null + +main "$@" diff --git a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/gbs-hotswap-power-cycle.bb b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/gbs-hotswap-power-cycle.bb new file mode 100644 index 000000000..6bf7bb69f --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/gbs-hotswap-power-cycle.bb @@ -0,0 +1,26 @@ +SUMMARY = "Power Cycle by Hotswap Controller" +DESCRIPTION = "Power Cycle by Hotswap Controller Daemon" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd + +DEPENDS += "systemd" +RDEPENDS_${PN} += "bash" + +SRC_URI = " file://hotswap-power-cycle.service \ + file://tray_powercycle.sh \ + " + +do_install() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/hotswap-power-cycle.service ${D}${systemd_system_unitdir} + + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/tray_powercycle.sh ${D}${bindir} +} + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "hotswap-power-cycle.service" + diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0001-meta-gbs-Enable-adm1272-ADM1272_TEMP1_EN.patch b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0001-meta-gbs-Enable-adm1272-ADM1272_TEMP1_EN.patch new file mode 100644 index 000000000..1cfd330ab --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0001-meta-gbs-Enable-adm1272-ADM1272_TEMP1_EN.patch @@ -0,0 +1,45 @@ +From 8e211c8bc64521d772c4389219889a240b40307b Mon Sep 17 00:00:00 2001 +From: Charles <Charles.Hsu@quantatw.com> +Date: Fri, 14 Aug 2020 18:06:22 +0800 +Subject: [PATCH] meta-gis: Enable adm1272 ADM1272_TEMP1_EN + +--- + drivers/hwmon/pmbus/adm1275.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c +index 5caa37fbfc18..550b9a8388f6 100644 +--- a/drivers/hwmon/pmbus/adm1275.c ++++ b/drivers/hwmon/pmbus/adm1275.c +@@ -595,11 +595,13 @@ static int adm1275_probe(struct i2c_client *client, + tindex = 8; + + info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT | +- PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT; ++ PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | ++ PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; + +- /* Enable VOUT if not enabled (it is disabled by default) */ +- if (!(config & ADM1278_VOUT_EN)) { +- config |= ADM1278_VOUT_EN; ++ ++ /* Enable VOUT & TEMP1 if not enabled (it is disabled by default) */ ++ if ((config & (ADM1278_VOUT_EN | ADM1278_TEMP1_EN)) != (ADM1278_VOUT_EN | ADM1278_TEMP1_EN)) { ++ config |= ADM1278_VOUT_EN | ADM1278_TEMP1_EN; + ret = i2c_smbus_write_byte_data(client, + ADM1275_PMON_CONFIG, + config); +@@ -610,9 +612,7 @@ static int adm1275_probe(struct i2c_client *client, + } + } + +- if (config & ADM1278_TEMP1_EN) +- info->func[0] |= +- PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; ++ + if (config & ADM1278_VIN_EN) + info->func[0] |= PMBUS_HAVE_VIN; + break; +-- +2.25.1 + diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0003-Add-basic-support-for-SB-TSI-sensors.patch b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0003-Add-basic-support-for-SB-TSI-sensors.patch new file mode 100644 index 000000000..b690a9813 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0003-Add-basic-support-for-SB-TSI-sensors.patch @@ -0,0 +1,327 @@ +SB Temperature Sensor Interface (SB-TSI) is an SMBus compatible +interface that reports AMD SoC's Ttcl (normalized temperature), +and resembles a typical 8-pin remote temperature sensor's I2C interface +to BMC. + +This commit adds basic support using this interface to read CPU +temperature, and read/write high/low CPU temp thresholds. + +To instantiate this driver on an AMD CPU with SB-TSI +support, the i2c bus number would be the bus connected from the board +management controller (BMC) to the CPU. The i2c address is specified in +Section 6.3.1 of the spec [1]: The SB-TSI address is normally 98h for socket 0 +and 90h for socket 1, but it could vary based on hardware address select pins. + +[1]: https://www.amd.com/system/files/TechDocs/56255_OSRR.pdf + +Test status: tested reading temp1_input, and reading/writing +temp1_max/min. + +Signed-off-by: Kun Yi <kunyi at google.com> +--- + drivers/hwmon/Kconfig | 10 ++ + drivers/hwmon/Makefile | 1 + + drivers/hwmon/sbtsi_temp.c | 259 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 270 insertions(+) + create mode 100644 drivers/hwmon/sbtsi_temp.c + +diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig +index 05a30832c6ba..9585dcd01d1b 100644 +--- a/drivers/hwmon/Kconfig ++++ b/drivers/hwmon/Kconfig +@@ -1412,6 +1412,16 @@ config SENSORS_RASPBERRYPI_HWMON + This driver can also be built as a module. If so, the module + will be called raspberrypi-hwmon. + ++config SENSORS_SBTSI ++ tristate "Emulated SB-TSI temperature sensor" ++ depends on I2C ++ help ++ If you say yes here you get support for emulated temperature ++ sensors on AMD SoCs with SB-TSI interface connected to a BMC device. ++ ++ This driver can also be built as a module. If so, the module will ++ be called sbtsi_temp. ++ + config SENSORS_SHT15 + tristate "Sensiron humidity and temperature sensors. SHT15 and compat." + depends on GPIOLIB || COMPILE_TEST +diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile +index b0b9c8e57176..cd109f003ce4 100644 +--- a/drivers/hwmon/Makefile ++++ b/drivers/hwmon/Makefile +@@ -152,6 +152,7 @@ obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o + obj-$(CONFIG_SENSORS_PWM_FAN) += pwm-fan.o + obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON) += raspberrypi-hwmon.o + obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o ++obj-$(CONFIG_SENSORS_SBTSI) += sbtsi_temp.o + obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o + obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o + obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o +diff --git a/drivers/hwmon/sbtsi_temp.c b/drivers/hwmon/sbtsi_temp.c +new file mode 100644 +index 000000000000..e3ad6a9f7ec1 +--- /dev/null ++++ b/drivers/hwmon/sbtsi_temp.c +@@ -0,0 +1,259 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * sbtsi_temp.c - hwmon driver for a SBI Temperature Sensor Interface (SB-TSI) ++ * compliant AMD SoC temperature device. ++ * ++ * Copyright (c) 2020, Google Inc. ++ * Copyright (c) 2020, Kun Yi <kunyi at google.com> ++ */ ++ ++#include <linux/err.h> ++#include <linux/i2c.h> ++#include <linux/init.h> ++#include <linux/hwmon.h> ++#include <linux/module.h> ++#include <linux/mutex.h> ++#include <linux/of_device.h> ++#include <linux/of.h> ++ ++/* ++ * SB-TSI registers only support SMBus byte data access. "_INT" registers are ++ * the integer part of a temperature value or limit, and "_DEC" registers are ++ * corresponding decimal parts. ++ */ ++#define SBTSI_REG_TEMP_INT 0x01 /* RO */ ++#define SBTSI_REG_STATUS 0x02 /* RO */ ++#define SBTSI_REG_CONFIG 0x03 /* RO */ ++#define SBTSI_REG_TEMP_HIGH_INT 0x07 /* RW */ ++#define SBTSI_REG_TEMP_LOW_INT 0x08 /* RW */ ++#define SBTSI_REG_TEMP_DEC 0x10 /* RW */ ++#define SBTSI_REG_TEMP_HIGH_DEC 0x13 /* RW */ ++#define SBTSI_REG_TEMP_LOW_DEC 0x14 /* RW */ ++#define SBTSI_REG_REV 0xFF /* RO */ ++ ++#define SBTSI_CONFIG_READ_ORDER_SHIFT 5 ++ ++#define SBTSI_TEMP_MIN 0 ++#define SBTSI_TEMP_MAX 255875 ++#define SBTSI_REV_MAX_VALID_ID 4 ++ ++/* Each client has this additional data */ ++struct sbtsi_data { ++ struct i2c_client *client; ++ struct mutex lock; ++}; ++ ++/* ++ * From SB-TSI spec: CPU temperature readings and limit registers encode the ++ * temperature in increments of 0.125 from 0 to 255.875. The "high byte" ++ * register encodes the base-2 of the integer portion, and the upper 3 bits of ++ * the "low byte" encode in base-2 the decimal portion. ++ * ++ * e.g. INT=0x19, DEC=0x20 represents 25.125 degrees Celsius ++ * ++ * Therefore temperature in millidegree Celsius = ++ * (INT + DEC / 256) * 1000 = (INT * 8 + DEC / 32) * 125 ++ */ ++static inline int sbtsi_reg_to_mc(s32 integer, s32 decimal) ++{ ++ return ((integer << 3) + (decimal >> 5)) * 125; ++} ++ ++/* ++ * Inversely, given temperature in millidegree Celsius ++ * INT = (TEMP / 125) / 8 ++ * DEC = ((TEMP / 125) % 8) * 32 ++ * Caller have to make sure temp doesn't exceed 255875, the max valid value. ++ */ ++static inline void sbtsi_mc_to_reg(s32 temp, u8 *integer, u8 *decimal) ++{ ++ temp /= 125; ++ *integer = temp >> 3; ++ *decimal = (temp & 0x7) << 5; ++} ++ ++static int sbtsi_read(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long *val) ++{ ++ struct sbtsi_data *data = dev_get_drvdata(dev); ++ s32 temp_int, temp_dec; ++ int err, reg_int, reg_dec; ++ u8 read_order; ++ ++ if (type != hwmon_temp) ++ return -EINVAL; ++ ++ read_order = 0; ++ switch (attr) { ++ case hwmon_temp_input: ++ /* ++ * ReadOrder bit specifies the reading order of integer and ++ * decimal part of CPU temp for atomic reads. If bit == 0, ++ * reading integer part triggers latching of the decimal part, ++ * so integer part should be read first. If bit == 1, read ++ * order should be reversed. ++ */ ++ err = i2c_smbus_read_byte_data(data->client, SBTSI_REG_CONFIG); ++ if (err < 0) ++ return err; ++ ++ read_order = (u8)err & BIT(SBTSI_CONFIG_READ_ORDER_SHIFT); ++ reg_int = SBTSI_REG_TEMP_INT; ++ reg_dec = SBTSI_REG_TEMP_DEC; ++ break; ++ case hwmon_temp_max: ++ reg_int = SBTSI_REG_TEMP_HIGH_INT; ++ reg_dec = SBTSI_REG_TEMP_HIGH_DEC; ++ break; ++ case hwmon_temp_min: ++ reg_int = SBTSI_REG_TEMP_LOW_INT; ++ reg_dec = SBTSI_REG_TEMP_LOW_DEC; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (read_order == 0) { ++ temp_int = i2c_smbus_read_byte_data(data->client, reg_int); ++ temp_dec = i2c_smbus_read_byte_data(data->client, reg_dec); ++ } else { ++ temp_dec = i2c_smbus_read_byte_data(data->client, reg_dec); ++ temp_int = i2c_smbus_read_byte_data(data->client, reg_int); ++ } ++ ++ if (temp_int < 0) ++ return temp_int; ++ if (temp_dec < 0) ++ return temp_dec; ++ ++ *val = sbtsi_reg_to_mc(temp_int, temp_dec); ++ ++ return 0; ++} ++ ++static int sbtsi_write(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long val) ++{ ++ struct sbtsi_data *data = dev_get_drvdata(dev); ++ int reg_int, reg_dec, err; ++ u8 temp_int, temp_dec; ++ ++ if (type != hwmon_temp) ++ return -EINVAL; ++ ++ switch (attr) { ++ case hwmon_temp_max: ++ reg_int = SBTSI_REG_TEMP_HIGH_INT; ++ reg_dec = SBTSI_REG_TEMP_HIGH_DEC; ++ break; ++ case hwmon_temp_min: ++ reg_int = SBTSI_REG_TEMP_LOW_INT; ++ reg_dec = SBTSI_REG_TEMP_LOW_DEC; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ val = clamp_val(val, SBTSI_TEMP_MIN, SBTSI_TEMP_MAX); ++ mutex_lock(&data->lock); ++ sbtsi_mc_to_reg(val, &temp_int, &temp_dec); ++ err = i2c_smbus_write_byte_data(data->client, reg_int, temp_int); ++ if (err) ++ goto exit; ++ ++ err = i2c_smbus_write_byte_data(data->client, reg_dec, temp_dec); ++exit: ++ mutex_unlock(&data->lock); ++ return err; ++} ++ ++static umode_t sbtsi_is_visible(const void *data, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel) ++{ ++ switch (type) { ++ case hwmon_temp: ++ switch (attr) { ++ case hwmon_temp_input: ++ return 0444; ++ case hwmon_temp_min: ++ return 0644; ++ case hwmon_temp_max: ++ return 0644; ++ } ++ break; ++ default: ++ break; ++ } ++ return 0; ++} ++ ++static const struct hwmon_channel_info *sbtsi_info[] = { ++ HWMON_CHANNEL_INFO(chip, ++ HWMON_C_REGISTER_TZ), ++ HWMON_CHANNEL_INFO(temp, ++ HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX), ++ NULL ++}; ++ ++static const struct hwmon_ops sbtsi_hwmon_ops = { ++ .is_visible = sbtsi_is_visible, ++ .read = sbtsi_read, ++ .write = sbtsi_write, ++}; ++ ++static const struct hwmon_chip_info sbtsi_chip_info = { ++ .ops = &sbtsi_hwmon_ops, ++ .info = sbtsi_info, ++}; ++ ++static int sbtsi_probe(struct i2c_client *client, ++ const struct i2c_device_id *id) ++{ ++ struct device *dev = &client->dev; ++ struct device *hwmon_dev; ++ struct sbtsi_data *data; ++ ++ data = devm_kzalloc(dev, sizeof(struct sbtsi_data), GFP_KERNEL); ++ if (!data) ++ return -ENOMEM; ++ ++ data->client = client; ++ mutex_init(&data->lock); ++ ++ hwmon_dev = ++ devm_hwmon_device_register_with_info(dev, client->name, data, ++ &sbtsi_chip_info, NULL); ++ ++ return PTR_ERR_OR_ZERO(hwmon_dev); ++} ++ ++static const struct i2c_device_id sbtsi_id[] = { ++ {"sbtsi", 0}, ++ {} ++}; ++MODULE_DEVICE_TABLE(i2c, sbtsi_id); ++ ++static const struct of_device_id __maybe_unused sbtsi_of_match[] = { ++ { ++ .compatible = "amd,sbtsi", ++ }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, sbtsi_of_match); ++ ++static struct i2c_driver sbtsi_driver = { ++ .class = I2C_CLASS_HWMON, ++ .driver = { ++ .name = "sbtsi", ++ .of_match_table = of_match_ptr(sbtsi_of_match), ++ }, ++ .probe = sbtsi_probe, ++ .id_table = sbtsi_id, ++}; ++ ++module_i2c_driver(sbtsi_driver); ++ ++MODULE_AUTHOR("Kun Yi <kunyi at google.com>"); ++MODULE_DESCRIPTION("Hwmon driver for AMD SB-TSI emulated sensor"); ++MODULE_LICENSE("GPL"); +-- +2.26.0.292.g33ef6b2f38-goog
\ No newline at end of file diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-Add-kernel-seven-seg-display-support.patch b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-Add-kernel-seven-seg-display-support.patch new file mode 100644 index 000000000..a21707d8a --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-Add-kernel-seven-seg-display-support.patch @@ -0,0 +1,10 @@ +diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile +index b9e6d4c3e906..aa7ce9d72d2c 100644 +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -59,3 +59,5 @@ obj-$(CONFIG_HABANA_AI) += habanalabs/ + obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o + obj-$(CONFIG_NPCM7XX_LPC_BPC) += npcm7xx-lpc-bpc.o + obj-$(CONFIG_NPCM7XX_PCI_MBOX) += npcm7xx-pci-mbox.o ++obj-$(CONFIG_SEVEN_SEGMENT_DISPLAY) += seven_seg_disp.o ++obj-$(CONFIG_SEVEN_SEGMENT_GPIO) += seven_seg_gpio.o diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-ben-drivers-misc-Character-device-driver-for-seven-segme.patch b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-ben-drivers-misc-Character-device-driver-for-seven-segme.patch new file mode 100644 index 000000000..8ae624a51 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-ben-drivers-misc-Character-device-driver-for-seven-segme.patch @@ -0,0 +1,293 @@ +From 2d46e81d9bbb624695bac8400a4ac41b7f116ec4 Mon Sep 17 00:00:00 2001 +From: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> +Date: Fri, 27 Jul 2018 12:34:54 -0700 +Subject: [PATCH 2/3] drivers: misc: Character device driver for seven segment + display + +Character device driver which implements the user-space +API for letting a user write to two 7-segment displays including +any conversion methods necessary to map the user input +to two 7-segment displays. + +Signed-off-by: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> +Signed-off-by: Kun Yi <kunyi@google.com> +Signed-off-by: Benjamin Fair <benjaminfair@google.com> +--- + drivers/misc/Kconfig | 8 ++ + drivers/misc/Makefile | 1 + + drivers/misc/seven_seg_disp.c | 201 ++++++++++++++++++++++++++++++++++ + drivers/misc/seven_seg_disp.h | 34 ++++++ + 4 files changed, 244 insertions(+) + create mode 100644 drivers/misc/seven_seg_disp.c + create mode 100644 drivers/misc/seven_seg_disp.h + +diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig +index 9d96469fb41c..d443de886346 100644 +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -473,6 +473,14 @@ config VEXPRESS_SYSCFG + bus. System Configuration interface is one of the possible means + of generating transactions on this bus. + ++config SEVEN_SEGMENT_DISPLAY ++ tristate "Character driver for seven segment display support" ++ help ++ Character device driver which implements the user-space ++ API for letting a user write to two 7-segment displays including ++ any conversion methods necessary to map the user input ++ to two 7-segment displays. ++ + config PCI_ENDPOINT_TEST + depends on PCI + select CRC32 + +diff --git a/drivers/misc/seven_seg_disp.c b/drivers/misc/seven_seg_disp.c +new file mode 100644 +index 000000000000..db1c571f68e5 +--- /dev/null ++++ b/drivers/misc/seven_seg_disp.c +@@ -0,0 +1,201 @@ ++/* ++ * Copyright (c) 2016 Google, Inc ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 or later as ++ * published by the Free Software Foundation. ++ */ ++ ++#include <linux/module.h> ++#include <linux/version.h> ++#include <linux/kernel.h> ++#include <linux/types.h> ++#include <linux/kdev_t.h> ++#include <linux/fs.h> ++#include <linux/uaccess.h> ++#include <linux/ctype.h> ++#include <linux/of.h> ++#include <linux/io.h> ++#include <linux/slab.h> ++#include <linux/platform_device.h> ++ ++#include "seven_seg_disp.h" ++ ++#define LED_DOT 0x01 ++ ++/* ++ * 0 1 2 3 4 5 6 7 8 9 A B C D E F ++ * _ _ _ _ _ _ _ _ _ _ _ _ ++ * | | | _| _| |_| |_ |_ | |_| |_| |_| |_ | _| |_ |_ ++ * |_| | |_ _| | _| |_| | |_| | | | |_| |_ |_| |_ | ++ * ++ * data[7:1] = led[a:g] ++ */ ++const u8 seven_seg_bits[] = { ++ 0xFC, 0x60, 0xDA, 0xF2, 0x66, 0xB6, 0xBE, 0xE0, ++ 0xFE, 0xF6, 0xEE, 0x3E, 0x9C, 0x7A, 0x9E, 0x8E ++ }; ++ ++/* ++ * 0 1 2 3 4 5 6 7 8 9 A B C D E F ++ * _ _ _ _ _ ++ * | |_ |_| |_ _ _ _ _ _ _ _ |_ _| _| | | ++ * |_ |_ | | _| |_| |_| | | ++ * ++ * data[7:1] = led[a:g] ++ */ ++const u8 special_seven_seg_bits[] = { ++ 0x00, 0x9C, 0x1E, 0xCE, 0x8E, 0x02, 0x02, 0x02, ++ 0x02, 0x02, 0x02, 0x02, 0xB6, 0x7A, 0x7A, 0xEC ++ }; ++ ++static dev_t seven_seg_devno; ++static struct class *seven_seg_disp_class; ++ ++static int seven_seg_disp_open(struct inode *inode, struct file *filp) ++{ ++ struct seven_seg_disp_dev *disp_dev; ++ ++ disp_dev = container_of(inode->i_cdev, ++ struct seven_seg_disp_dev, cdev); ++ filp->private_data = disp_dev; ++ return 0; ++} ++ ++static int seven_seg_disp_close(struct inode *inode, struct file *filp) ++{ ++ filp->private_data = NULL; ++ return 0; ++} ++ ++static ssize_t seven_seg_disp_read(struct file *filp, char __user *buf, size_t ++ len, loff_t *off) ++{ ++ struct seven_seg_disp_dev *disp_dev = filp->private_data; ++ ++ if (disp_dev->disp_data_valid) ++ return -EINVAL; ++ ++ if (copy_to_user(buf, disp_dev->seven_seg_disp_data_array, ++ MAX_DISP_CHAR_SIZE) != 0) { ++ return -EFAULT; ++ } ++ ++ return 0; ++} ++ ++static u16 convert_to_disp_data(char *buf) ++{ ++ u8 low_display; ++ u8 high_display; ++ u16 led_value; ++ ++ low_display = seven_seg_bits[hex_to_bin(buf[2])]; ++ ++ high_display = (buf[0] == '1') ? ++ special_seven_seg_bits[hex_to_bin(buf[1])] : ++ seven_seg_bits[hex_to_bin(buf[1])]; ++ ++ led_value = low_display | (high_display << 8); ++ if (buf[0] == '1') ++ led_value |= LED_DOT | (LED_DOT << 8); ++ ++ return led_value; ++} ++ ++static ssize_t seven_seg_disp_write(struct file *filp, const char __user *buf, ++ size_t len, loff_t *off) ++{ ++ int length = len - 1; ++ int i; ++ ++ struct seven_seg_disp_dev *disp_dev = filp->private_data; ++ ++ if (length != MAX_DISP_CHAR_SIZE) ++ return -EINVAL; ++ ++ if (copy_from_user(disp_dev->seven_seg_disp_data_array, ++ buf, length) != 0) { ++ return -EFAULT; ++ } ++ ++ for (i = 0; i < MAX_DISP_CHAR_SIZE; i++) { ++ if (!isxdigit(disp_dev->seven_seg_disp_data_array[i])) ++ return -EINVAL; ++ } ++ ++ disp_dev->current_seven_seg_disp_data = convert_to_disp_data( ++ disp_dev->seven_seg_disp_data_array); ++ disp_dev->disp_data_valid = true; ++ disp_dev->update_seven_seg_data(&disp_dev->parent, ++ disp_dev->current_seven_seg_disp_data); ++ ++ return len; ++} ++ ++static const struct file_operations seven_seg_disp_fops = { ++ ++ .owner = THIS_MODULE, ++ .open = seven_seg_disp_open, ++ .release = seven_seg_disp_close, ++ .read = seven_seg_disp_read, ++ .write = seven_seg_disp_write ++}; ++ ++void seven_seg_rem_cdev(struct seven_seg_disp_dev *disp_dev) ++{ ++ cdev_del(&disp_dev->cdev); ++ device_destroy(seven_seg_disp_class, seven_seg_devno); ++} ++ ++int seven_seg_setup_cdev(struct seven_seg_disp_dev *disp_dev, ++ void (*update_disp_data)(struct device *, u16 data)) ++{ ++ struct device *dev; ++ int err; ++ ++ dev = device_create(seven_seg_disp_class, NULL, ++ seven_seg_devno, ++ NULL, "seven_seg_disp_val"); ++ if (dev == NULL) ++ return -EIO; ++ disp_dev->dev = dev; ++ disp_dev->update_seven_seg_data = update_disp_data; ++ disp_dev->disp_data_valid = false; ++ ++ cdev_init(&disp_dev->cdev, &seven_seg_disp_fops); ++ err = cdev_add(&disp_dev->cdev, seven_seg_devno, 1); ++ if (err) ++ device_destroy(seven_seg_disp_class, seven_seg_devno); ++ return err; ++} ++ ++static int __init seven_seg_disp_init(void) ++{ ++ int err = alloc_chrdev_region(&seven_seg_devno, 0, 1, "disp_state"); ++ ++ if (err < 0) ++ return err; ++ ++ seven_seg_disp_class = class_create(THIS_MODULE, "disp_state"); ++ if (seven_seg_disp_class == NULL) ++ goto unreg_chrdev; ++ ++ return 0; ++ ++unreg_chrdev: ++ unregister_chrdev_region(seven_seg_devno, 1); ++ return -EIO; ++} ++ ++static void __exit seven_seg_disp_exit(void) ++{ ++ class_destroy(seven_seg_disp_class); ++ unregister_chrdev_region(seven_seg_devno, 1); ++} ++ ++module_init(seven_seg_disp_init); ++module_exit(seven_seg_disp_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>"); ++MODULE_DESCRIPTION("Seven segment display character driver"); +diff --git a/drivers/misc/seven_seg_disp.h b/drivers/misc/seven_seg_disp.h +new file mode 100644 +index 000000000000..0ebed0802747 +--- /dev/null ++++ b/drivers/misc/seven_seg_disp.h +@@ -0,0 +1,34 @@ ++/* ++ * Copyright (c) 2016 Google, Inc ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 or later as ++ * published by the Free Software Foundation. ++ */ ++ ++#ifndef SEVEN_SEG_DISP_H ++#define SEVEN_SEG_DISP_H ++ ++#include <linux/device.h> ++#include <linux/cdev.h> ++ ++#define MAX_DISP_CHAR_SIZE 3 ++ ++#define DEFAULT_REFRESH_INTERVAL_MS 600 ++ ++struct seven_seg_disp_dev { ++ bool disp_data_valid; ++ u16 current_seven_seg_disp_data; ++ char seven_seg_disp_data_array[MAX_DISP_CHAR_SIZE]; ++ struct device parent; ++ struct device *dev; ++ struct cdev cdev; ++ void (*update_seven_seg_data)(struct device *, u16 data); ++}; ++ ++int seven_seg_setup_cdev(struct seven_seg_disp_dev *disp_dev, ++ void (*update_disp_data)(struct device *, u16 data)); ++ ++void seven_seg_rem_cdev(struct seven_seg_disp_dev *disp_dev); ++ ++#endif +-- +2.22.0.770.g0f2c4a37fd-goog + diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-ben-drivers-misc-Platform-driver-for-seven-segment-displ.patch b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-ben-drivers-misc-Platform-driver-for-seven-segment-displ.patch new file mode 100644 index 000000000..b166c78b8 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/0004-ben-drivers-misc-Platform-driver-for-seven-segment-displ.patch @@ -0,0 +1,267 @@ +From ea3e732d2c4a609e621346a96d37713820640196 Mon Sep 17 00:00:00 2001 +From: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> +Date: Fri, 27 Jul 2018 12:36:24 -0700 +Subject: [PATCH 3/3] drivers: misc: Platform driver for seven segment display + support + +Platform device driver which provides an API for displaying on two +7-segment displays, and implements the required bit-banging. +The hardware assumed is 74HC164 wired to two 7-segment displays. + +Signed-off-by: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com> +Signed-off-by: Kun Yi <kunyi@google.com> +Signed-off-by: Benjamin Fair <benjaminfair@google.com> +--- + drivers/misc/Kconfig | 8 ++ +# drivers/misc/Makefile | 2 ++ + drivers/misc/seven_seg_gpio.c | 205 ++++++++++++++++++++++++++++++++++ + 3 files changed, 215 insertions(+) + create mode 100644 drivers/misc/seven_seg_gpio.c + +diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig +index d443de886346..e10984e3288f 100644 +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -481,6 +481,14 @@ config SEVEN_SEGMENT_DISPLAY + any conversion methods necessary to map the user input + to two 7-segment displays. + ++config SEVEN_SEGMENT_GPIO ++ tristate "Platform driver to update seven segment display" ++ depends on SEVEN_SEGMENT_DISPLAY ++ help ++ Platform device driver which provides an API for displaying on two ++ 7-segment displays, and implements the required bit-banging. ++ The hardware assumed is 74HC164 wired to two 7-segment displays. ++ + config PCI_ENDPOINT_TEST + depends on PCI + select CRC32 +# diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile +# index 402bcc3c9961..f39bec664d92 100644 +# --- a/drivers/misc/Makefile +# +++ b/drivers/misc/Makefile +# @@ -53,6 +53,8 @@ obj-$(CONFIG_GENWQE) += genwqe/ +# obj-$(CONFIG_ECHO) += echo/ +# obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o +# obj-$(CONFIG_CXL_BASE) += cxl/ +# +obj-$(CONFIG_SEVEN_SEGMENT_DISPLAY) += seven_seg_disp.o +# +obj-$(CONFIG_SEVEN_SEGMENT_GPIO) += seven_seg_gpio.o +# obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o +# obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o +# obj-$(CONFIG_ASPEED_LPC_MBOX) += aspeed-lpc-mbox.o + +diff --git a/drivers/misc/seven_seg_gpio.c b/drivers/misc/seven_seg_gpio.c +new file mode 100644 +index 000000000000..e03ea7f8b848 +--- /dev/null ++++ b/drivers/misc/seven_seg_gpio.c +@@ -0,0 +1,205 @@ ++/* ++ * Copyright (C) 2016 Google, Inc ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 or later as ++ * published by the Free Software Foundation. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/timer.h> ++#include <linux/jiffies.h> ++#include <linux/sizes.h> ++#include <linux/io.h> ++#include <linux/delay.h> ++#include <linux/uaccess.h> ++#include <linux/mutex.h> ++#include <linux/of_platform.h> ++#include <linux/gpio/consumer.h> ++ ++#include "seven_seg_disp.h" ++ ++#define DELAY_INTVL_US 1 ++ ++#define CLOCK_GPIO_NAME "clock" ++#define DATA_GPIO_NAME "data" ++#define CLEAR_GPIO_NAME "clear" ++ ++struct seven_seg_gpio_info { ++ u16 curr_disp_value; ++ u16 refresh_interval; ++ struct timer_list update_timer; ++ struct gpio_desc *clock_gpio; ++ struct gpio_desc *data_gpio; ++ struct gpio_desc *clear_gpio; ++}; ++ ++static void update_seven_seg_gpio_data(struct device *dev, u16 data) ++{ ++ struct platform_device *pdev; ++ struct seven_seg_gpio_info *gpio_info; ++ ++ pdev = container_of(dev, struct platform_device, dev); ++ if (pdev == NULL) { ++ pr_err("invalid NULL platform_device\n"); ++ return; ++ } ++ ++ gpio_info = platform_get_drvdata(pdev); ++ if (gpio_info == NULL) { ++ pr_err("invalid NULL gpio_info\n"); ++ return; ++ } ++ ++ gpio_info->curr_disp_value = data; ++} ++ ++static void clear_seven_seg_gpio_data(struct device *dev, u16 data) ++{ ++ struct platform_device *pdev; ++ struct seven_seg_gpio_info *gpio_info; ++ ++ pdev = container_of(dev, struct platform_device, dev); ++ if (pdev == NULL) { ++ pr_err("invalid NULL platform_device\n"); ++ return; ++ } ++ ++ gpio_info = platform_get_drvdata(pdev); ++ if (gpio_info == NULL) { ++ pr_err("invalid NULL gpio_info\n"); ++ return; ++ } ++ ++ gpio_info->curr_disp_value = 0; ++} ++ ++static void send_seven_seg_gpio_data(u16 disp_data, ++ struct seven_seg_gpio_info *gpio_info) ++{ ++ int i; ++ ++ gpiod_set_value(gpio_info->clear_gpio, 0); ++ udelay(DELAY_INTVL_US); ++ gpiod_set_value(gpio_info->clear_gpio, 1); ++ udelay(DELAY_INTVL_US); ++ ++ for (i = 0; i < 16; i++) { ++ if (disp_data & 0x01) ++ gpiod_set_value(gpio_info->data_gpio, 1); ++ else ++ gpiod_set_value(gpio_info->data_gpio, 0); ++ ++ udelay(DELAY_INTVL_US); ++ ++ gpiod_set_value(gpio_info->clock_gpio, 0); ++ udelay(DELAY_INTVL_US); ++ gpiod_set_value(gpio_info->clock_gpio, 1); ++ udelay(DELAY_INTVL_US); ++ ++ disp_data >>= 1; ++ } ++} ++ ++static void disp_refresh_timer_handler(struct timer_list *t) ++{ ++ u16 disp_data; ++ struct seven_seg_gpio_info *gpio_info = ++ from_timer(gpio_info, t, update_timer); ++ disp_data = gpio_info->curr_disp_value; ++ ++ send_seven_seg_gpio_data(disp_data, gpio_info); ++ mod_timer(&gpio_info->update_timer, ++ jiffies + msecs_to_jiffies(gpio_info->refresh_interval)); ++} ++ ++static const struct of_device_id of_seven_seg_gpio_match[] = { ++ { .compatible = "seven-seg-gpio-dev" }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, of_seven_seg_gpio_match); ++ ++static int seven_seg_gpio_probe(struct platform_device *pdev) ++{ ++ u16 interval; ++ int result; ++ struct seven_seg_gpio_info *gpio_info; ++ struct device *dev = &pdev->dev; ++ struct seven_seg_disp_dev *disp_dev; ++ ++ gpio_info = devm_kzalloc(dev, ++ sizeof(struct seven_seg_gpio_info), ++ GFP_KERNEL); ++ if (gpio_info == NULL) ++ return -ENOMEM; ++ ++ /* Requesting the clock gpio */ ++ gpio_info->clock_gpio = devm_gpiod_get(dev, CLOCK_GPIO_NAME, ++ GPIOD_OUT_HIGH); ++ if (IS_ERR(gpio_info->clock_gpio)) ++ return PTR_ERR(gpio_info->clock_gpio); ++ ++ /* Requesting the data gpio */ ++ gpio_info->data_gpio = devm_gpiod_get(dev, DATA_GPIO_NAME, ++ GPIOD_OUT_HIGH); ++ if (IS_ERR(gpio_info->data_gpio)) ++ return PTR_ERR(gpio_info->data_gpio); ++ ++ /* Requesting the clear gpio */ ++ gpio_info->clear_gpio = devm_gpiod_get(dev, CLEAR_GPIO_NAME, ++ GPIOD_OUT_HIGH); ++ if (IS_ERR(gpio_info->clear_gpio)) ++ return PTR_ERR(gpio_info->clear_gpio); ++ ++ result = of_property_read_u16(pdev->dev.of_node, ++ "refresh-interval-ms", &interval); ++ gpio_info->refresh_interval = result ? DEFAULT_REFRESH_INTERVAL_MS : ++ interval; ++ ++ /* Start timer to update seven segment display every second */ ++ timer_setup(&gpio_info->update_timer, disp_refresh_timer_handler, 0); ++ result = mod_timer(&gpio_info->update_timer, ++ jiffies + ++ msecs_to_jiffies(gpio_info->refresh_interval)); ++ if (result) ++ return result; ++ ++ gpio_info->curr_disp_value = 0; ++ ++ platform_set_drvdata(pdev, gpio_info); ++ ++ disp_dev = devm_kzalloc(dev, sizeof(struct seven_seg_disp_dev), ++ GFP_KERNEL); ++ disp_dev->parent = *dev; ++ seven_seg_setup_cdev(disp_dev, &update_seven_seg_gpio_data); ++ return 0; ++} ++ ++static int seven_seg_gpio_remove(struct platform_device *pdev) ++{ ++ struct seven_seg_gpio_info *gpio_info = platform_get_drvdata(pdev); ++ struct seven_seg_disp_dev *disp_dev = ++ container_of(&pdev->dev, ++ struct seven_seg_disp_dev, parent); ++ seven_seg_rem_cdev(disp_dev); ++ del_timer_sync(&gpio_info->update_timer); ++ platform_set_drvdata(pdev, NULL); ++ return 0; ++} ++ ++static struct platform_driver seven_seg_gpio_driver = { ++ .probe = seven_seg_gpio_probe, ++ .remove = seven_seg_gpio_remove, ++ .driver = { ++ .name = "seven-seg-gpio", ++ .of_match_table = of_seven_seg_gpio_match, ++ }, ++}; ++ ++module_platform_driver(seven_seg_gpio_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>"); ++MODULE_DESCRIPTION("Seven segment display driver using GPIO config"); +-- +2.22.0.770.g0f2c4a37fd-goog + diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg new file mode 100644 index 000000000..edd009c47 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton/gbs.cfg @@ -0,0 +1,110 @@ +# Support full 1G memory for userspace on BMC +CONFIG_VMSPLIT_3G_OPT=y +CONFIG_NET_NCSI=y +# Enable available sensors +CONFIG_HWMON=y +CONFIG_PMBUS=y +CONFIG_SENSORS_PMBUS=y +CONFIG_SENSORS_MAX34440=y +CONFIG_SENSORS_LM75=y +CONFIG_SENSORS_SBTSI=y +CONFIG_SENSORS_ISL68137=y +CONFIG_SENSORS_ADM1275=y +CONFIG_NPCM7XX_ADC=y +CONFIG_SENSORS_IIO_HWMON=y +CONFIG_SENSORS_FAN=y +CONFIG_SENSORS_JC42=y +CONFIG_SENSORS_MAX31790=y +CONFIG_SENSORS_UCD9000=y + +# Enable for firmware update LPC. +CONFIG_DEVMEM=y + +# Enable seven seg display +CONFIG_SEVEN_SEGMENT_DISPLAY=y +CONFIG_SEVEN_SEGMENT_GPIO=y + +# Enable GPIO LEDS +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y // Allow userspace to blink LEDs +CONFIG_LEDS_TRIGGER_PANIC=y // Blink BMC fault when kernel panics +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y + +# Enable pstore(ramoops) to capture kernel panics +CONFIG_PSTORE=y +CONFIG_PSTORE_RAM=y +CONFIG_PSTORE_DEFLATE_COMPRESS=y + +# Enable Nuvoton ECC +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_DEBUG=y +CONFIG_EDAC_LEGACY_SYSFS=y +CONFIG_EDAC_NPCM7XX=y +CONFIG_EDAC_SUPPORT=y +CONFIG_EDAC=y +CONFIG_RAS=y + +# Enable Nuvoton JTAG +CONFIG_NPCM7XX_JTAG_MASTER=y + +# USB +CONFIG_USB_CONFIGFS_ECM_SUBSET=y +CONFIG_USB_CONFIGFS_ECM=y +CONFIG_USB_CONFIGFS_EEM=y +CONFIG_USB_CONFIGFS_F_HID=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_RNDIS=y +CONFIG_USB_CONFIGFS=y +CONFIG_USB_F_ECM=y +CONFIG_USB_F_EEM=y +CONFIG_USB_F_MASS_STORAGE=y +CONFIG_USB_F_RNDIS=y +CONFIG_USB_F_SUBSET=y +CONFIG_USB_GADGET_NPCM_USB2=y +CONFIG_USB_NPCM_UDC=y +CONFIG_USB_OHCI_HCD_NPCM7XX=y +CONFIG_USB_SERIAL_CP210X=y +CONFIG_USB_U_ETHER=y + +#SPI +CONFIG_SPI=y +CONFIG_SPI_NPCM_FIU=y +CONFIG_SPI_NPCM_PSPI=y + +#I2C support +CONFIG_I2C_MUX_LTC4306=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_I2C_MUX=y +CONFIG_I2C_SLAVE_EEPROM=y +CONFIG_I2C_SLAVE_MQUEUE=y +CONFIG_I2C_SLAVE=y + +#I2C GPIO expanders +CONFIG_GPIO_PCA953X_IRQ=y +CONFIG_GPIO_PCA953X=y +CONFIG_GPIO_PCF857X=y + +# Misc +CONFIG_OVERLAY_FS=y +CONFIG_JFFS2_FS=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS=y +CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_NPCM=y +CONFIG_IPVLAN=y +CONFIG_VLAN_8021Q=y +CONFIG_DEVKMEM=y +CONFIG_EEPROM_AT24=y +CONFIG_FORCE_MAX_ZONEORDER=12 +CONFIG_IIO_MUX=y +CONFIG_IIO=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MFD_SYSCON=y +CONFIG_MTD_M25P80=y +CONFIG_MUX_MMIO=y +CONFIG_NPCM7XX_LPC_BPC=y +CONFIG_MTD_PARTITIONED_MASTER=y diff --git a/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend new file mode 100644 index 000000000..4de4ca900 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-kernel/linux/linux-nuvoton_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/linux-nuvoton:" +SRC_URI_append_gbs = " file://gbs.cfg" +SRC_URI_append_gbs = " file://0003-Add-basic-support-for-SB-TSI-sensors.patch" +SRC_URI_append_gbs = " file://0004-Add-kernel-seven-seg-display-support.patch" +SRC_URI_append_gbs = " file://0004-ben-drivers-misc-Character-device-driver-for-seven-segme.patch" +SRC_URI_append_gbs = " file://0004-ben-drivers-misc-Platform-driver-for-seven-segment-displ.patch" +SRC_URI_append_gbs = " file://0001-meta-gbs-Enable-adm1272-ADM1272_TEMP1_EN.patch" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config.bb b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config.bb new file mode 100644 index 000000000..cd632e132 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config.bb @@ -0,0 +1,31 @@ +SUMMARY = "YAML configuration for gbs" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit allarch + +SRC_URI = " \ + file://gbs-ipmi-fru.yaml \ + file://gbs-ipmi-sensors.yaml \ + file://gbs-ipmi-fru-properties.yaml \ + " + +S = "${WORKDIR}" + +do_install() { + install -m 0644 -D gbs-ipmi-fru.yaml \ + ${D}${datadir}/${BPN}/ipmi-fru-read.yaml + install -m 0644 -D gbs-ipmi-sensors.yaml \ + ${D}${datadir}/${BPN}/ipmi-sensors.yaml + install -m 0644 -D gbs-ipmi-fru-properties.yaml \ + ${D}${datadir}/${BPN}/ipmi-extra-properties.yaml +} + +FILES_${PN}-dev = " \ + ${datadir}/${BPN}/ipmi-fru-read.yaml \ + ${datadir}/${BPN}/ipmi-sensors.yaml \ + ${datadir}/${BPN}/ipmi-extra-properties.yaml \ + " + +ALLOW_EMPTY_${PN} = "1" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-fru-properties.yaml b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-fru-properties.yaml new file mode 100644 index 000000000..2dce3030c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-fru-properties.yaml @@ -0,0 +1,183 @@ +/system/chassis/motherboard: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/hsbp: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/fan: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/PE0: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/PE0/PE0: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/PE1: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/PE1/PE1: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme0: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme1: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme2: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme3: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme4: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme5: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme6: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme7: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme8: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme9: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme10: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme11: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme12: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme13: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme14: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' + +/system/chassis/motherboard/nvme15: + xyz.openbmc_project.Inventory.Decorator.Replaceable: + FieldReplaceable: 'true' + xyz.openbmc_project.Inventory.Decorator.Cacheable: + Cached: 'true' + xyz.openbmc_project.Inventory.Item: + Present: 'true' diff --git a/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-fru.yaml b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-fru.yaml new file mode 100644 index 000000000..53cc486eb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-fru.yaml @@ -0,0 +1,228 @@ +0x00: + /system/chassis/motherboard: + entityID: 7 + entityInstance: 0x00 + interfaces: + xyz.openbmc_project.Inventory.Decorator.Asset: + BuildDate: + IPMIFruProperty: Mfg Date + IPMIFruSection: Board + Manufacturer: + IPMIFruProperty: Manufacturer + IPMIFruSection: Board + SerialNumber: + IPMIFruProperty: Serial Number + IPMIFruSection: Board + PartNumber: + IPMIFruProperty: Part Number + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Item: + PrettyName: + IPMIFruProperty: Name + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Decorator.Revision: + Version: + IPMIFruProperty: FRU File ID + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Item.System: + +0x01: + /system/chassis/hsbp: + entityID: 7 + entityInstance: 0x01 + interfaces: + xyz.openbmc_project.Inventory.Decorator.Asset: + BuildDate: + IPMIFruProperty: Mfg Date + IPMIFruSection: Board + SerialNumber: + IPMIFruProperty: Serial Number + IPMIFruSection: Board + PartNumber: + IPMIFruProperty: Part Number + IPMIFruSection: Board + Manufacturer: + IPMIFruProperty: Manufacturer + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Item: + PrettyName: + IPMIFruProperty: Name + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Decorator.Revision: + Version: + IPMIFruProperty: FRU File ID + IPMIFruSection: Board + +0x02: + /system/chassis/fan: + entityID: 7 + entityInstance: 0x02 + interfaces: + xyz.openbmc_project.Inventory.Decorator.Asset: + BuildDate: + IPMIFruProperty: Mfg Date + IPMIFruSection: Board + SerialNumber: + IPMIFruProperty: Serial Number + IPMIFruSection: Board + PartNumber: + IPMIFruProperty: Part Number + IPMIFruSection: Board + Manufacturer: + IPMIFruProperty: Manufacturer + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Item: + PrettyName: + IPMIFruProperty: Name + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Decorator.Revision: + Version: + IPMIFruProperty: FRU File ID + IPMIFruSection: Board + +0x03: + /system/chassis/PE0: &ADD_IN_CARD_BOARD_DEFAULTS + entityID: 11 + entityInstance: 0x00 + interfaces: + xyz.openbmc_project.Inventory.Decorator.Asset: + BuildDate: + IPMIFruProperty: Mfg Date + IPMIFruSection: Board + SerialNumber: + IPMIFruProperty: Serial Number + IPMIFruSection: Board + PartNumber: + IPMIFruProperty: Part Number + IPMIFruSection: Board + Manufacturer: + IPMIFruProperty: Manufacturer + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Item: + PrettyName: + IPMIFruProperty: Name + IPMIFruSection: Board + xyz.openbmc_project.Inventory.Decorator.Revision: + Version: + IPMIFruProperty: FRU File ID + IPMIFruSection: Board + /system/chassis/PE0/PE0: &ADD_IN_CARD_PRODUCT_DEFAULTS + entityID: 11 + entityInstance: 0x00 + interfaces: + xyz.openbmc_project.Inventory.Decorator.Asset: + BuildDate: + IPMIFruProperty: Mfg Date + IPMIFruSection: Product + SerialNumber: + IPMIFruProperty: Serial Number + IPMIFruSection: Product + Model: + IPMIFruProperty: Model Number + IPMIFruSection: Product + Manufacturer: + IPMIFruProperty: Manufacturer + IPMIFruSection: Product + xyz.openbmc_project.Inventory.Item: + PrettyName: + IPMIFruProperty: Name + IPMIFruSection: Product + +0x04: + /system/chassis/PE1: + entityInstance: 0x01 + <<: *ADD_IN_CARD_BOARD_DEFAULTS + /system/chassis/PE1/PE1: + entityInstance: 0x01 + <<: *ADD_IN_CARD_PRODUCT_DEFAULTS + +0x05: + /system/chassis/motherboard/nvme0: &NVME_BOARD_DEFAULTS + entityID: 4 + entityInstance: 0x60 + interfaces: + xyz.openbmc_project.Inventory.Decorator.Asset: + Manufacturer: + IPMIFruProperty: Manufacturer + IPMIFruSection: Product + SerialNumber: + IPMIFruProperty: Serial Number + IPMIFruSection: Product + Model: + IPMIFruProperty: Model Number + IPMIFruSection: Product + +0x06: + /system/chassis/motherboard/nvme1: + entityInstance: 0x61 + <<: *NVME_BOARD_DEFAULTS + +0x07: + /system/chassis/motherboard/nvme2: + entityInstance: 0x62 + <<: *NVME_BOARD_DEFAULTS + +0x08: + /system/chassis/motherboard/nvme3: + entityInstance: 0x63 + <<: *NVME_BOARD_DEFAULTS + +0x09: + /system/chassis/motherboard/nvme4: + entityInstance: 0x64 + <<: *NVME_BOARD_DEFAULTS + +0x0A: + /system/chassis/motherboard/nvme5: + entityInstance: 0x65 + <<: *NVME_BOARD_DEFAULTS + +0x0B: + /system/chassis/motherboard/nvme6: + entityInstance: 0x66 + <<: *NVME_BOARD_DEFAULTS + +0x0C: + /system/chassis/motherboard/nvme7: + entityInstance: 0x67 + <<: *NVME_BOARD_DEFAULTS + +0x0D: + /system/chassis/motherboard/nvme8: + entityInstance: 0x68 + <<: *NVME_BOARD_DEFAULTS + +0x0E: + /system/chassis/motherboard/nvme9: + entityInstance: 0x69 + <<: *NVME_BOARD_DEFAULTS + +0x0F: + /system/chassis/motherboard/nvme10: + entityInstance: 0x6A + <<: *NVME_BOARD_DEFAULTS + +0x10: + /system/chassis/motherboard/nvme11: + entityInstance: 0x6B + <<: *NVME_BOARD_DEFAULTS + +0x11: + /system/chassis/motherboard/nvme12: + entityInstance: 0x6C + <<: *NVME_BOARD_DEFAULTS + +0x12: + /system/chassis/motherboard/nvme13: + entityInstance: 0x6D + <<: *NVME_BOARD_DEFAULTS + +0x13: + /system/chassis/motherboard/nvme14: + entityInstance: 0x6E + <<: *NVME_BOARD_DEFAULTS + +0x14: + /system/chassis/motherboard/nvme15: + entityInstance: 0x6F + <<: *NVME_BOARD_DEFAULTS diff --git a/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-sensors.yaml b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-sensors.yaml new file mode 100644 index 000000000..929a566a2 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/configuration/gbs-yaml-config/gbs-ipmi-sensors.yaml @@ -0,0 +1,1254 @@ +0x10: &temperature + entityID: 0x07 + entityInstance: 0x1c + sensorType: 0x01 + path: /xyz/openbmc_project/sensors/temperature/i2cool_0 + sensorReadingType: 0x01 + multiplierM: 1 + offsetB: 0 + bExp: 0 + rExp: 0 + unit: xyz.openbmc_project.Sensor.Value.Unit.DegreesC + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData + sensorUnits1: 0x80 + interfaces: + xyz.openbmc_project.Sensor.Value: + Value: + Offsets: + 0xFF: + type: double + +0x11: + <<: *temperature + entityInstance: 0x1d + path: /xyz/openbmc_project/sensors/temperature/i2cool_1 + +0x12: + <<: *temperature + entityInstance: 0x1e + path: /xyz/openbmc_project/sensors/temperature/i2cool_2 + +0x13: + <<: *temperature + entityInstance: 0x1f + path: /xyz/openbmc_project/sensors/temperature/powerseq_temp + +0x14: + <<: *temperature + entityID: 0x03 + entityInstance: 0x00 + path: /xyz/openbmc_project/sensors/temperature/cputemp + +0x15: &nvme_temperature + entityID: 0x04 + entityInstance: 0x00 + sensorType: 0x01 + path: /xyz/openbmc_project/sensors/temperature/nvme0 + sensorReadingType: 0x01 + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData + sensorNamePattern: nameLeaf + sensorUnits1: 0x80 + unit: xyz.openbmc_project.Sensor.Value.Unit.DegreesC + interfaces: + xyz.openbmc_project.Sensor.Value: + Value: + Offsets: + 0xFF: + type: double + +0x16: + <<: *nvme_temperature + entityInstance: 0x01 + path: /xyz/openbmc_project/sensors/temperature/nvme1 + +0x17: + <<: *nvme_temperature + entityInstance: 0x02 + path: /xyz/openbmc_project/sensors/temperature/nvme2 + +0x18: + <<: *nvme_temperature + entityInstance: 0x03 + path: /xyz/openbmc_project/sensors/temperature/nvme3 + +0x19: + <<: *nvme_temperature + entityInstance: 0x04 + path: /xyz/openbmc_project/sensors/temperature/nvme4 + +0x1A: + <<: *nvme_temperature + entityInstance: 0x05 + path: /xyz/openbmc_project/sensors/temperature/nvme5 + +0x1B: + <<: *nvme_temperature + entityInstance: 0x06 + path: /xyz/openbmc_project/sensors/temperature/nvme6 + +0x1C: + <<: *nvme_temperature + entityInstance: 0x07 + path: /xyz/openbmc_project/sensors/temperature/nvme7 + +0x1D: + <<: *nvme_temperature + entityInstance: 0x08 + path: /xyz/openbmc_project/sensors/temperature/nvme8 + +0x1E: + <<: *nvme_temperature + entityInstance: 0x09 + path: /xyz/openbmc_project/sensors/temperature/nvme9 + +0x1F: + <<: *nvme_temperature + entityInstance: 0x0a + path: /xyz/openbmc_project/sensors/temperature/nvme10 + +0x20: + <<: *nvme_temperature + entityInstance: 0x0b + path: /xyz/openbmc_project/sensors/temperature/nvme11 + +0x21: + <<: *nvme_temperature + entityInstance: 0x0c + path: /xyz/openbmc_project/sensors/temperature/nvme12 + +0x22: + <<: *nvme_temperature + entityInstance: 0x0d + path: /xyz/openbmc_project/sensors/temperature/nvme13 + +0x23: + <<: *nvme_temperature + entityInstance: 0x0e + path: /xyz/openbmc_project/sensors/temperature/nvme14 + +0x24: + <<: *nvme_temperature + entityInstance: 0x0f + path: /xyz/openbmc_project/sensors/temperature/nvme15 + +# Virtual Sensors +0x25: + <<: *temperature + entityID: 0x1E + entityInstance: 0x00 + path: /xyz/openbmc_project/extsensors/margin/fleeting0 + +0x26: + <<: *temperature + entityID: 0x1E + entityInstance: 0x01 + path: /xyz/openbmc_project/extsensors/margin/fleeting1 + +0x30: &voltage + entityID: 0x07 + entityInstance: 0x00 + sensorType: 0x02 + path: /xyz/openbmc_project/sensors/voltage/p1v8_stby + sensorReadingType: 0x01 + multiplierM: 78 + offsetB: 0 + bExp: 0 + rExp: -4 + unit: xyz.openbmc_project.Sensor.Value.Unit.Volts + mutability: Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Sensor.Value: + Value: + Offsets: + 0xFF: + type: double + +0x31: + <<: *voltage + entityInstance: 0x01 + path: /xyz/openbmc_project/sensors/voltage/vddcr_soc_stby + multiplierM: 392 + rExp: -5 + +0x32: + <<: *voltage + entityInstance: 0x02 + path: /xyz/openbmc_project/sensors/voltage/p2v5_stby + multiplierM: 118 + rExp: -4 + +0x33: + <<: *voltage + entityInstance: 0x03 + path: /xyz/openbmc_project/sensors/voltage/p1v2_stby + multiplierM: 78 + rExp: -4 + +0x34: + <<: *voltage + entityInstance: 0x04 + path: /xyz/openbmc_project/sensors/voltage/p1v175_stby + multiplierM: 78 + rExp: -4 + +0x35: + <<: *voltage + entityInstance: 0x05 + path: /xyz/openbmc_project/sensors/voltage/p1v8 + multiplierM: 78 + rExp: -4 + +0x36: + <<: *voltage + entityInstance: 0x06 + path: /xyz/openbmc_project/sensors/voltage/p3v3 + multiplierM: 157 + rExp: -4 + +0x37: + <<: *voltage + entityInstance: 0x07 + path: /xyz/openbmc_project/sensors/voltage/pwrgd_pvpp + multiplierM: 235 + rExp: -4 + +0x38: + <<: *voltage + entityInstance: 0x08 + path: /xyz/openbmc_project/sensors/voltage/pwrgd_pvddio + multiplierM: 235 + rExp: -4 + +0x39: + <<: *voltage + entityInstance: 0x09 + path: /xyz/openbmc_project/sensors/voltage/pwrgd_cpuvr + multiplierM: 235 + rExp: -4 + +0x3A: + <<: *voltage + entityInstance: 0x0a + path: /xyz/openbmc_project/sensors/voltage/p3v3_stby + multiplierM: 157 + rExp: -4 + +0x3B: + <<: *voltage + entityInstance: 0x0b + path: /xyz/openbmc_project/sensors/voltage/p5v_stby + multiplierM: 235 + rExp: -4 + +# ADC sensor +0x46: + <<: *voltage + entityID: 0x28 + entityInstance: 0 + path: /xyz/openbmc_project/sensors/voltage/p3v_bat_adc + multiplierM: 157 + offsetB: 0 + bExp: 0 + rExp: -4 + +# VRM sensors +# PVDDCR_CPU +# VRM input voltage for various rails are around 13.5V. Use the same config. +0x3C: &voltage_13v5_in + entityID: 0x07 + sensorType: 0x02 + entityInstance: 0x0c + path: /xyz/openbmc_project/sensors/voltage/vddcr_cpu_in + sensorReadingType: 0x01 + multiplierM: 55 + offsetB: 0 + bExp: 0 + unit: xyz.openbmc_project.Sensor.Value.Unit.Volts + rExp: -3 + mutability: Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData + interfaces: + xyz.openbmc_project.Sensor.Value: + Value: + Offsets: + 0xFF: + type: double + +0x3D: + <<: *voltage + entityInstance: 0x0d + path: /xyz/openbmc_project/sensors/voltage/vddcr_cpu_out + multiplierM: 78 + rExp: -4 + +0x50: ¤t + entityID: 0x07 + entityInstance: 0x14 + sensorType: 0x03 + path: /xyz/openbmc_project/sensors/current/vddcr_cpu_in + sensorReadingType: 0x01 + multiplierM: 86 + rExp: -3 + unit: xyz.openbmc_project.Sensor.Value.Unit.Amperes + mutability: Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Sensor.Value: + Value: + Offsets: + 0xFF: + type: double + +0x51: + <<: *current + entityInstance: 0x15 + path: /xyz/openbmc_project/sensors/current/vddcr_cpu_out + multiplierM: 1 + rExp: 0 + +0x27: + <<: *temperature + entityInstance: 0x28 + path: /xyz/openbmc_project/sensors/temperature/vddcr_cpu + +# PVDDCR_SOC0 +0x3E: + <<: *voltage_13v5_in + entityInstance: 0x0e + path: /xyz/openbmc_project/sensors/voltage/vddcr_soc_in + multiplierM: 55 + rExp: -3 + +0x3F: + <<: *voltage + entityInstance: 0x0f + path: /xyz/openbmc_project/sensors/voltage/vddcr_soc_out + multiplierM: 78 + rExp: -4 + +0x52: + <<: *current + entityInstance: 0x16 + path: /xyz/openbmc_project/sensors/current/vddcr_soc_in + multiplierM: 353 + rExp: -4 + +0x53: + <<: *current + entityInstance: 0x17 + path: /xyz/openbmc_project/sensors/current/vddcr_soc_out + multiplierM: 345 + rExp: -3 + +0x28: + <<: *temperature + entityInstance: 0x29 + path: /xyz/openbmc_project/sensors/temperature/vddcr_soc + +# PVDDIO_ABCD +0x40: + <<: *voltage + entityInstance: 0x10 + path: /xyz/openbmc_project/sensors/voltage/vddio_abcd_out + multiplierM: 78 + rExp: -4 + +0x41: + <<: *voltage_13v5_in + entityInstance: 0x11 + path: /xyz/openbmc_project/sensors/voltage/vddio_abcd_in + multiplierM: 55 + rExp: -3 + +0x55: + <<: *current + entityInstance: 0x19 + path: /xyz/openbmc_project/sensors/current/vddio_abcd_in + multiplierM: 353 + rExp: -4 + +0x54: + <<: *current + entityInstance: 0x18 + path: /xyz/openbmc_project/sensors/current/vddio_abcd_out + multiplierM: 345 + rExp: -3 + +0x29: + <<: *temperature + entityInstance: 0x2a + path: /xyz/openbmc_project/sensors/temperature/vddio_abcd + +# PVDDIO_EFGH +0x42: + <<: *voltage + entityInstance: 0x12 + path: /xyz/openbmc_project/sensors/voltage/vddio_efgh_out + multiplierM: 78 + rExp: -4 + +0x43: + <<: *voltage_13v5_in + entityInstance: 0x13 + path: /xyz/openbmc_project/sensors/voltage/vddio_efgh_in + multiplierM: 55 + rExp: -3 + +0x57: + <<: *current + entityInstance: 0x1b + path: /xyz/openbmc_project/sensors/current/vddio_efgh_in + multiplierM: 353 + rExp: -4 + +0x56: + <<: *current + entityInstance: 0x1a + path: /xyz/openbmc_project/sensors/current/vddio_efgh_out + multiplierM: 345 + rExp: -3 + +0x2A: + <<: *temperature + entityInstance: 0x2b + path: /xyz/openbmc_project/sensors/temperature/vddio_efgh + +# P12V_1 +0x47: + <<: *voltage + entityInstance: 0x20 + path: /xyz/openbmc_project/sensors/voltage/p12v_mobo_out + multiplierM: 55 + rExp: -3 + +0x48: + <<: *voltage_13v5_in + entityInstance: 0x21 + path: /xyz/openbmc_project/sensors/voltage/p12v_mobo_in + multiplierM: 255 + rExp: -3 + +0x5A: + <<: *current + entityInstance: 0x25 + path: /xyz/openbmc_project/sensors/current/p12v_mobo_in + multiplierM: 137 + rExp: -3 + +0x59: + <<: *current + entityInstance: 0x24 + path: /xyz/openbmc_project/sensors/current/p12v_mobo_out + multiplierM: 59 + rExp: -2 + +0x2B: + <<: *temperature + entityInstance: 0x2c + path: /xyz/openbmc_project/sensors/temperature/p12v_mobo + +# P12V_2 +0x49: + <<: *voltage + entityInstance: 0x22 + path: /xyz/openbmc_project/sensors/voltage/p12v_fan_out + multiplierM: 55 + rExp: -3 + +0x4A: + <<: *voltage_13v5_in + entityInstance: 0x23 + path: /xyz/openbmc_project/sensors/voltage/p12v_fan_in + multiplierM: 255 + rExp: -3 + +0x5C: + <<: *current + entityInstance: 0x27 + path: /xyz/openbmc_project/sensors/current/p12v_fan_in + multiplierM: 137 + rExp: -3 + +0x5B: + <<: *current + entityInstance: 0x26 + path: /xyz/openbmc_project/sensors/current/p12v_fan_out + multiplierM: 59 + rExp: -2 + +0x2C: + <<: *temperature + entityInstance: 0x2d + path: /xyz/openbmc_project/sensors/temperature/p12v_fan + +# Hotswap controller +0x44: + <<: *voltage + entityID: 0x0E + entityInstance: 0x00 + path: /xyz/openbmc_project/sensors/voltage/hotswap_vin + multiplierM: 259 + rExp: -3 + +0x45: + <<: *voltage + entityID: 0x0E + entityInstance: 0x01 + path: /xyz/openbmc_project/sensors/voltage/hotswap_vout + multiplierM: 259 + rExp: -3 + +0x58: + <<: *current + entityID: 0x0E + entityInstance: 0x02 + path: /xyz/openbmc_project/sensors/current/hotswap_iout + multiplierM: 216 + rExp: -3 + +0x70: + entityID: 0x0E + entityInstance: 0x03 + sensorType: 0x0B + path: /xyz/openbmc_project/sensors/power/hotswap_pout + sensorReadingType: 0x01 + multiplierM: 86 + offsetB: 0 + bExp: 0 + rExp: -1 + unit: xyz.openbmc_project.Sensor.Value.Unit.Watts + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Sensor.Value: + Value: + Offsets: + 0xFF: + type: double + +0x2D: + <<: *temperature + entityInstance: 0x2e + path: /xyz/openbmc_project/sensors/temperature/hotswap + +# fan/pwm mapping +# fan0/1 on Mobo, fb_fan0/1/2 on fan board +# PWM0 => fan tach 0 +# PWM1 => fan tach 1 +# PWM2 => fan tach 2 +# PWM3 => fan tach 3 +# PWM4 => fan tach 4 +0x60: &fan_rpm_read + entityID: 0x1D + entityInstance: 0x00 + sensorType: 0x04 + path: /xyz/openbmc_project/sensors/fan_tach/fan0 + sensorReadingType: 0x01 + multiplierM: 81 + offsetB: 0 + bExp: 0 + rExp: 0 + unit: xyz.openbmc_project.Sensor.Value.Unit.RPMS + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Sensor.Value: + Value: + Offsets: + 0xFF: + type: double + +0x61: + <<: *fan_rpm_read + entityInstance: 0x01 + path: /xyz/openbmc_project/sensors/fan_tach/fan1 + +0x62: + <<: *fan_rpm_read + entityInstance: 0x02 + path: /xyz/openbmc_project/sensors/fan_tach/fb_fan0 + +0x63: + <<: *fan_rpm_read + entityInstance: 0x03 + path: /xyz/openbmc_project/sensors/fan_tach/fb_fan1 + +0x64: + <<: *fan_rpm_read + entityInstance: 0x04 + path: /xyz/openbmc_project/sensors/fan_tach/fb_fan2 + +0x65: &fan_pwm + entityID: 0x1D + sensorType: 0x04 + entityInstance: 0x05 + path: /xyz/openbmc_project/sensors/fan_tach/fan0 + sensorReadingType: 0x01 + multiplierM: 1 + offsetB: 0 + bExp: 0 + mutability: Mutability::Write + serviceInterface: org.freedesktop.DBus.Properties + readingType: readingData + interfaces: + xyz.openbmc_project.Control.FanPwm: + Target: + Offsets: + 0xFF: + type: uint64_t + +0x66: + <<: *fan_pwm + entityInstance: 0x06 + path: /xyz/openbmc_project/sensors/fan_tach/fan1 + +0x67: + <<: *fan_pwm + entityInstance: 0x07 + path: /xyz/openbmc_project/sensors/fan_tach/fb_fan0 + +0x68: + <<: *fan_pwm + entityInstance: 0x08 + path: /xyz/openbmc_project/sensors/fan_tach/fb_fan1 + +0x69: + <<: *fan_pwm + entityInstance: 0x09 + path: /xyz/openbmc_project/sensors/fan_tach/fb_fan2 + +# NVME SSD locate/fault LEDs +0x71: &locateled + entityID: 0x04 + entityInstance: 0x10 + sensorType: 0x21 + path: /xyz/openbmc_project/led/groups/led_u2_0_locate + sensorReadingType: 0x6F + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: assertion + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Led.Group: + Asserted: + Offsets: + 0x01: + type: bool + assert: true + +0x72: + <<: *locateled + entityInstance: 0x11 + path: /xyz/openbmc_project/led/groups/led_u2_1_locate + +0x73: + <<: *locateled + entityInstance: 0x12 + path: /xyz/openbmc_project/led/groups/led_u2_2_locate + +0x74: + <<: *locateled + entityInstance: 0x13 + path: /xyz/openbmc_project/led/groups/led_u2_3_locate + +0x75: + <<: *locateled + entityInstance: 0x14 + path: /xyz/openbmc_project/led/groups/led_u2_4_locate + +0x76: + <<: *locateled + entityInstance: 0x15 + path: /xyz/openbmc_project/led/groups/led_u2_5_locate + +0x77: + <<: *locateled + entityInstance: 0x16 + path: /xyz/openbmc_project/led/groups/led_u2_6_locate + +0x78: + <<: *locateled + entityInstance: 0x17 + path: /xyz/openbmc_project/led/groups/led_u2_7_locate + +0x79: + <<: *locateled + entityInstance: 0x18 + path: /xyz/openbmc_project/led/groups/led_u2_8_locate + +0x7A: + <<: *locateled + entityInstance: 0x19 + path: /xyz/openbmc_project/led/groups/led_u2_9_locate + +0x7B: + <<: *locateled + entityInstance: 0x1a + path: /xyz/openbmc_project/led/groups/led_u2_10_locate + +0x7C: + <<: *locateled + entityInstance: 0x1b + path: /xyz/openbmc_project/led/groups/led_u2_11_locate + +0x7D: + <<: *locateled + entityInstance: 0x1c + path: /xyz/openbmc_project/led/groups/led_u2_12_locate + +0x7E: + <<: *locateled + entityInstance: 0x1d + path: /xyz/openbmc_project/led/groups/led_u2_13_locate + +0x7F: + <<: *locateled + entityInstance: 0x1e + path: /xyz/openbmc_project/led/groups/led_u2_14_locate + +0x80: + <<: *locateled + entityInstance: 0x1f + path: /xyz/openbmc_project/led/groups/led_u2_15_locate + +0x81: &faultled + entityID: 0x04 + entityInstance: 0x20 + sensorType: 0x21 + path: /xyz/openbmc_project/led/groups/led_u2_0_fault + sensorReadingType: 0x6F + mutability: Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: assertion + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Led.Group: + Asserted: + Offsets: + 0x00: + type: bool + assert: true + +0x82: + <<: *faultled + entityInstance: 0x21 + path: /xyz/openbmc_project/led/groups/led_u2_1_fault + +0x83: + <<: *faultled + entityInstance: 0x22 + path: /xyz/openbmc_project/led/groups/led_u2_2_fault + +0x84: + <<: *faultled + entityInstance: 0x23 + path: /xyz/openbmc_project/led/groups/led_u2_3_fault + +0x85: + <<: *faultled + entityInstance: 0x24 + path: /xyz/openbmc_project/led/groups/led_u2_4_fault + +0x86: + <<: *faultled + entityInstance: 0x25 + path: /xyz/openbmc_project/led/groups/led_u2_5_fault + +0x87: + <<: *faultled + entityInstance: 0x26 + path: /xyz/openbmc_project/led/groups/led_u2_6_fault + +0x88: + <<: *faultled + entityInstance: 0x27 + path: /xyz/openbmc_project/led/groups/led_u2_7_fault + +0x89: + <<: *faultled + entityInstance: 0x28 + path: /xyz/openbmc_project/led/groups/led_u2_8_fault + +0x8A: + <<: *faultled + entityInstance: 0x29 + path: /xyz/openbmc_project/led/groups/led_u2_9_fault + +0x8B: + <<: *faultled + entityInstance: 0x2a + path: /xyz/openbmc_project/led/groups/led_u2_10_fault + +0x8C: + <<: *faultled + entityInstance: 0x2b + path: /xyz/openbmc_project/led/groups/led_u2_11_fault + +0x8D: + <<: *faultled + entityInstance: 0x2c + path: /xyz/openbmc_project/led/groups/led_u2_12_fault + +0x8E: + <<: *faultled + entityInstance: 0x2d + path: /xyz/openbmc_project/led/groups/led_u2_13_fault + +0x8F: + <<: *faultled + entityInstance: 0x2e + path: /xyz/openbmc_project/led/groups/led_u2_14_fault + +0x90: + <<: *faultled + entityInstance: 0x2f + path: /xyz/openbmc_project/led/groups/led_u2_15_fault + +# NVME SSD presence +0xB0: &present + entityID: 0x04 + entityInstance: 0x30 + sensorType: 0x25 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme0 + sensorReadingType: 0x6F + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: assertion + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Inventory.Item: + Present: + Offsets: + 0x00: + assert: true + type: bool + 0x01: + assert: false + type: bool + +0xB1: + <<: *present + entityInstance: 0x31 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme1 + +0xB2: + <<: *present + entityInstance: 0x32 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme2 + +0xB3: + <<: *present + entityInstance: 0x33 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme3 + +0xB4: + <<: *present + entityInstance: 0x34 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme4 + +0xB5: + <<: *present + entityInstance: 0x35 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme5 + +0xB6: + <<: *present + entityInstance: 0x36 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme6 + +0xB7: + <<: *present + entityInstance: 0x37 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme7 + +0xB8: + <<: *present + entityInstance: 0x38 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme8 + +0xB9: + <<: *present + entityInstance: 0x39 + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme9 + +0xBA: + <<: *present + entityInstance: 0x3a + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme10 + +0xBB: + <<: *present + entityInstance: 0x3b + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme11 + +0xBC: + <<: *present + entityInstance: 0x3c + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme12 + +0xBD: + <<: *present + entityInstance: 0x3d + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme13 + +0xBE: + <<: *present + entityInstance: 0x3e + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme14 + +0xBF: + <<: *present + entityInstance: 0x3f + path: /xyz/openbmc_project/inventory/system/chassis/motherboard/nvme15 + +0xC0: &nvme_pwrdis + entityID: 0x04 + entityInstance: 0x40 + sensorType: 0x21 + path: /xyz/openbmc_project/control/nvme/u2_0_pwr_dis + sensorReadingType: 0x6F + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: assertion + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Control.Nvme.Power: + Asserted: + Offsets: + 0x08: + type: string + assert: xyz.openbmc_project.Control.Nvme.Power.SlotDisabled + deassert: xyz.openbmc_project.Control.Nvme.Power.SlotEnabled + +0xC1: + <<: *nvme_pwrdis + entityInstance: 0x41 + path: /xyz/openbmc_project/control/nvme/u2_1_pwr_dis + +0xC2: + <<: *nvme_pwrdis + entityInstance: 0x42 + path: /xyz/openbmc_project/control/nvme/u2_2_pwr_dis + +0xC3: + <<: *nvme_pwrdis + entityInstance: 0x43 + path: /xyz/openbmc_project/control/nvme/u2_3_pwr_dis + +0xC4: + <<: *nvme_pwrdis + entityInstance: 0x44 + path: /xyz/openbmc_project/control/nvme/u2_4_pwr_dis + +0xC5: + <<: *nvme_pwrdis + entityInstance: 0x45 + path: /xyz/openbmc_project/control/nvme/u2_5_pwr_dis + +0xC6: + <<: *nvme_pwrdis + entityInstance: 0x46 + path: /xyz/openbmc_project/control/nvme/u2_6_pwr_dis + +0xC7: + <<: *nvme_pwrdis + entityInstance: 0x47 + path: /xyz/openbmc_project/control/nvme/u2_7_pwr_dis + +0xC8: + <<: *nvme_pwrdis + entityInstance: 0x48 + path: /xyz/openbmc_project/control/nvme/u2_8_pwr_dis + +0xC9: + <<: *nvme_pwrdis + entityInstance: 0x49 + path: /xyz/openbmc_project/control/nvme/u2_9_pwr_dis + +0xCA: + <<: *nvme_pwrdis + entityInstance: 0x4A + path: /xyz/openbmc_project/control/nvme/u2_10_pwr_dis + +0xCB: + <<: *nvme_pwrdis + entityInstance: 0x4B + path: /xyz/openbmc_project/control/nvme/u2_11_pwr_dis + +0xCC: + <<: *nvme_pwrdis + entityInstance: 0x4C + path: /xyz/openbmc_project/control/nvme/u2_12_pwr_dis + +0xCD: + <<: *nvme_pwrdis + entityInstance: 0x4D + path: /xyz/openbmc_project/control/nvme/u2_13_pwr_dis + +0xCE: + <<: *nvme_pwrdis + entityInstance: 0x4E + path: /xyz/openbmc_project/control/nvme/u2_14_pwr_dis + +0xCF: + <<: *nvme_pwrdis + entityInstance: 0x4F + path: /xyz/openbmc_project/control/nvme/u2_15_pwr_dis + +0xD0: &nvme_pwren + entityID: 0x04 + entityInstance: 0x50 + sensorType: 0x21 + path: /xyz/openbmc_project/control/nvme/pwr_u2_0_en + sensorReadingType: 0x6F + mutability: Mutability::Write|Mutability::Read + serviceInterface: org.freedesktop.DBus.Properties + readingType: assertion + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Control.Nvme.Power: + Asserted: + Offsets: + 0x05: + type: string + assert: xyz.openbmc_project.Control.Nvme.Power.Off + deassert: xyz.openbmc_project.Control.Nvme.Power.On + +0xD1: + <<: *nvme_pwren + entityInstance: 0x51 + path: /xyz/openbmc_project/control/nvme/pwr_u2_1_en + +0xD2: + <<: *nvme_pwren + entityInstance: 0x52 + path: /xyz/openbmc_project/control/nvme/pwr_u2_2_en + +0xD3: + <<: *nvme_pwren + entityInstance: 0x53 + path: /xyz/openbmc_project/control/nvme/pwr_u2_3_en + +0xD4: + <<: *nvme_pwren + entityInstance: 0x54 + path: /xyz/openbmc_project/control/nvme/pwr_u2_4_en + +0xD5: + <<: *nvme_pwren + entityInstance: 0x55 + path: /xyz/openbmc_project/control/nvme/pwr_u2_5_en + +0xD6: + <<: *nvme_pwren + entityInstance: 0x56 + path: /xyz/openbmc_project/control/nvme/pwr_u2_6_en + +0xD7: + <<: *nvme_pwren + entityInstance: 0x57 + path: /xyz/openbmc_project/control/nvme/pwr_u2_7_en + +0xD8: + <<: *nvme_pwren + entityInstance: 0x58 + path: /xyz/openbmc_project/control/nvme/pwr_u2_8_en + +0xD9: + <<: *nvme_pwren + entityInstance: 0x59 + path: /xyz/openbmc_project/control/nvme/pwr_u2_9_en + +0xDA: + <<: *nvme_pwren + entityInstance: 0x5A + path: /xyz/openbmc_project/control/nvme/pwr_u2_10_en + +0xDB: + <<: *nvme_pwren + entityInstance: 0x5B + path: /xyz/openbmc_project/control/nvme/pwr_u2_11_en + +0xDC: + <<: *nvme_pwren + entityInstance: 0x5C + path: /xyz/openbmc_project/control/nvme/pwr_u2_12_en + +0xDD: + <<: *nvme_pwren + entityInstance: 0x5D + path: /xyz/openbmc_project/control/nvme/pwr_u2_13_en + +0xDE: + <<: *nvme_pwren + entityInstance: 0x5E + path: /xyz/openbmc_project/control/nvme/pwr_u2_14_en + +0xDF: + <<: *nvme_pwren + entityInstance: 0x5F + path: /xyz/openbmc_project/control/nvme/pwr_u2_15_en + +0xF0: + entityID: 0x20 + entityInstance: 0 + sensorType: 0x0C + path: /xyz/openbmc_project/metrics/memory/BmcECC + sensorReadingType: 0x6F + serviceInterface: org.freedesktop.DBus.Properties + readingType: assertion + mutability: Mutability::Read + sensorNamePattern: nameLeaf + interfaces: + xyz.openbmc_project.Memory.MemoryECC: + state: + Offsets: + 0x00: + type: string + assert: xyz.openbmc_project.Memory.MemoryECC.ECCStatus.CE + 0x01: + type: string + assert: xyz.openbmc_project.Memory.MemoryECC.ECCStatus.UE + 0x05: + type: string + assert: xyz.openbmc_project.Memory.MemoryECC.ECCStatus.LogFull + +#GPIO present connection +0xF1: &gpio_prsnt + entityID: 0x1F + entityInstance: 0 + interfaces: + xyz.openbmc_project.Inventory.Item: + Present: + Offsets: + 0x00: + assert: true + type: bool + 0x01: + assert: false + type: bool + mutability: Mutability::Write|Mutability::Read + path: /xyz/openbmc_project/inventory/system/chassis/cable/ss_cab0_prsnt + readingType: assertion + sensorNamePattern: nameLeaf + sensorReadingType: 0x6f + sensorType: 0x1B + serviceInterface: org.freedesktop.DBus.Properties + +0xF2: + <<: *gpio_prsnt + entityInstance: 1 + path: /xyz/openbmc_project/inventory/system/chassis/cable/ss_cab1_prsnt + +0xF3: + <<: *gpio_prsnt + entityInstance: 2 + path: /xyz/openbmc_project/inventory/system/chassis/cable/ss_cab2_prsnt + +0xF4: + <<: *gpio_prsnt + entityInstance: 3 + path: /xyz/openbmc_project/inventory/system/chassis/cable/ss_cab3_prsnt + +0xF5: + entityID: 0x1A + entityInstance: 0 + interfaces: + xyz.openbmc_project.Inventory.Item: + Present: + Offsets: + 0x00: + assert: true + type: bool + 0x01: + assert: false + type: bool + mutability: Mutability::Write|Mutability::Read + path: /xyz/openbmc_project/inventory/system/chassis/entity/sata0_prsnt + readingType: assertion + sensorNamePattern: nameLeaf + sensorReadingType: 0x6f + sensorType: 0x25 + serviceInterface: org.freedesktop.DBus.Properties + +0xF6: + <<: *gpio_prsnt + entityInstance: 4 + path: /xyz/openbmc_project/inventory/system/chassis/cable/hsbp_cab_prsnt + +0xF7: + <<: *gpio_prsnt + entityInstance: 5 + path: /xyz/openbmc_project/inventory/system/chassis/cable/fanbd_cab_prsnt + +0xF8: + <<: *gpio_prsnt + entityInstance: 6 + path: /xyz/openbmc_project/inventory/system/chassis/cable/bp12v_cab_prsnt + +0xF9: &card_prsnt + entityID: 0x0B + entityInstance: 0 + interfaces: + xyz.openbmc_project.Inventory.Item: + Present: + Offsets: + 0x00: + assert: true + type: bool + 0x01: + assert: false + type: bool + mutability: Mutability::Write|Mutability::Read + path: /xyz/openbmc_project/inventory/system/chassis/entity/pe_slot0_prsnt + readingType: assertion + sensorNamePattern: nameLeaf + sensorReadingType: 0x6f + sensorType: 0x25 + serviceInterface: org.freedesktop.DBus.Properties + +0xFA: + <<: *card_prsnt + entityInstance: 1 + path: /xyz/openbmc_project/inventory/system/chassis/entity/pe_slot1_prsnt + +0xFB: + entityID: 0x21 + entityInstance: 0 + interfaces: + xyz.openbmc_project.State.Watchdog: + ExpireAction: + Offsets: + 0x00: + assert: xyz.openbmc_project.State.Watchdog.Action.None + type: string + 0x01: + assert: xyz.openbmc_project.State.Watchdog.Action.HardReset + type: string + 0x02: + assert: xyz.openbmc_project.State.Watchdog.Action.PowerOff + type: string + 0x03: + assert: xyz.openbmc_project.State.Watchdog.Action.PowerCycle + type: string + mutability: Mutability::Write|Mutability::Read + path: /xyz/openbmc_project/watchdog/host0 + readingType: assertion + sensorNamePattern: nameLeaf + sensorReadingType: 0x6F + sensorType: 0x23 + serviceInterface: org.freedesktop.DBus.Properties diff --git a/meta-quanta/meta-gbs/recipes-phosphor/console/files/80-gbs-nuvoton-sol.rules b/meta-quanta/meta-gbs/recipes-phosphor/console/files/80-gbs-nuvoton-sol.rules new file mode 100644 index 000000000..3d0670bc3 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/console/files/80-gbs-nuvoton-sol.rules @@ -0,0 +1 @@ +SUBSYSTEM=="tty", ATTRS{iomem_base}=="0xF0002000", ENV{SYSTEMD_WANTS}="obmc-console@ttyS1" SYMLINK+="ttyS1", TAG+="systemd" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/console/files/obmc-console.conf b/meta-quanta/meta-gbs/recipes-phosphor/console/files/obmc-console.conf new file mode 100644 index 000000000..666e66aac --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/console/files/obmc-console.conf @@ -0,0 +1 @@ +baud = 115200 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/console/obmc-console_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/console/obmc-console_%.bbappend new file mode 100644 index 000000000..f78e3c22d --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/console/obmc-console_%.bbappend @@ -0,0 +1,13 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/files:" +SRC_URI_append_gbs = " file://80-gbs-nuvoton-sol.rules" + +do_install_append_gbs() { + install -m 0755 -d ${D}${sysconfdir}/${BPN} + rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf + install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/ + ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.ttyS1.conf + + install -d ${D}/lib/udev/rules.d + rm -f ${D}/lib/udev/rules.d/80-obmc-console-uart.rules + install -m 0644 ${WORKDIR}/80-gbs-nuvoton-sol.rules ${D}/lib/udev/rules.d +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch new file mode 100644 index 000000000..67fa59090 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch @@ -0,0 +1,57 @@ +From 6e9a19c43acac7d4254910906329d98d7b59085a Mon Sep 17 00:00:00 2001 +From: Ren Yu <yux.ren@intel.com> +Date: Fri, 24 May 2019 14:55:10 +0800 +Subject: [PATCH] Add the pre-timeout interrupt defined in IPMI spec + +The IPMI watchdog pre-timeout interrupt is used to set the different +pre-timeout interrupt source. Add them as a dbus property, +IPMI set/get watchdog commands will use it. + +Signed-off-by: Ren Yu <yux.ren@intel.com> +--- + xyz/openbmc_project/State/Watchdog.interface.yaml | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/xyz/openbmc_project/State/Watchdog.interface.yaml b/xyz/openbmc_project/State/Watchdog.interface.yaml +index 2fc47d8..6dfa9b9 100644 +--- a/xyz/openbmc_project/State/Watchdog.interface.yaml ++++ b/xyz/openbmc_project/State/Watchdog.interface.yaml +@@ -33,6 +33,11 @@ properties: + description: > + The action the watchdog should perform when it expires. + default: 'HardReset' ++ - name: PreTimeoutInterrupt ++ type: enum[self.PreTimeoutInterruptAction] ++ description: > ++ The BMC generates the selected interrupt before the timer expires. ++ default: 'None' + - name: Interval + type: uint64 + description: > +@@ -73,6 +78,23 @@ enumerations: + description: > + Perform a power cycle of the system. + ++ - name: PreTimeoutInterruptAction ++ description: > ++ The type of PreTimeout Interrupt. ++ values: ++ - name: 'None' ++ description: > ++ Do nothing. ++ - name: 'SMI' ++ description: > ++ SMI. ++ - name: 'NMI' ++ description: > ++ NMI / Diagnostic Interrupt. ++ - name: 'MI' ++ description: > ++ Messaging Interrupt. ++ + - name: TimerUse + description: > + The type of timer use. +-- +2.7.4 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0025-Add-PreInterruptFlag-properity-in-DBUS.patch b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0025-Add-PreInterruptFlag-properity-in-DBUS.patch new file mode 100644 index 000000000..d7e66abd2 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces/0025-Add-PreInterruptFlag-properity-in-DBUS.patch @@ -0,0 +1,39 @@ +From b7c487750c05dcc081219ccdd4ef539beef6aa30 Mon Sep 17 00:00:00 2001 +From: Ren Yu <yux.ren@intel.com> +Date: Mon, 29 Jul 2019 10:51:12 +0800 +Subject: [PATCH] Add PreInterruptFlag properity in DBUS. + +PreTimeoutInterruptOccurFlag in DBUS would be set 'true' +when watchdog pre-timeout interrupt occurred. + +Tested: +Enable command(raw 0x06 0x31) that get message flag +can set right bit about watchdog, +need record PreTimeoutInterruptOccurFlag +at xyz.openbmmc_project.State.Watchdog when watchdog +pre-timeout interrupt occurred. + +Signed-off-by: Ren Yu <yux.ren@intel.com> +--- + xyz/openbmc_project/State/Watchdog.interface.yaml | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/xyz/openbmc_project/State/Watchdog.interface.yaml b/xyz/openbmc_project/State/Watchdog.interface.yaml +index bf4cca0..6579368 100644 +--- a/xyz/openbmc_project/State/Watchdog.interface.yaml ++++ b/xyz/openbmc_project/State/Watchdog.interface.yaml +@@ -59,6 +59,11 @@ properties: + description: > + The timer user at the time of expiration. + default: 'Reserved' ++ - name: PreTimeoutInterruptOccurFlag ++ type: boolean ++ description: > ++ PreTimeoutInterruptOccurFlag that preTimeoutInterrupt action occurred. ++ default: false + + enumerations: + - name: Action +-- +2.7.4 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend new file mode 100644 index 000000000..0b5bff905 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend @@ -0,0 +1,5 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" + +SRC_URI_append_gbs = " file://0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch \ + file://0025-Add-PreInterruptFlag-properity-in-DBUS.patch \ + " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json new file mode 100644 index 000000000..7c817d420 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json @@ -0,0 +1,342 @@ +{ + "version" : "R02", + "sensors" : [ + { + "name": "fan0", + "type": "fan", + "readPath": "/xyz/openbmc_project/sensors/fan_tach/fan0", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm1", + "min": 0, + "max": 255 + }, + { + "name": "fan1", + "type": "fan", + "readPath": "/xyz/openbmc_project/sensors/fan_tach/fan1", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm2", + "min": 0, + "max": 255 + }, + { + "name": "fb_fan0", + "type": "fan", + "readPath": "/xyz/openbmc_project/sensors/fan_tach/fb_fan0", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm3", + "min": 0, + "max": 255 + }, + { + "name": "fb_fan1", + "type": "fan", + "readPath": "/xyz/openbmc_project/sensors/fan_tach/fb_fan1", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm4", + "min": 0, + "max": 255 + }, + { + "name": "fb_fan2", + "type": "fan", + "readPath": "/xyz/openbmc_project/sensors/fan_tach/fb_fan2", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm5", + "min": 0, + "max": 255 + }, + { + "name": "fleeting0", + "type": "margin", + "readPath": "/xyz/openbmc_project/extsensors/margin/fleeting0", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "fleeting1", + "type": "margin", + "readPath": "/xyz/openbmc_project/extsensors/margin/fleeting1", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "cputemp", + "type": "margin", + "readPath": "/xyz/openbmc_project/extsensors/margin/cputemp", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "zone0_vr", + "type": "margin", + "readPath": "/xyz/openbmc_project/extsensors/margin/zone0_vr", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme", + "type": "margin", + "readPath": "/xyz/openbmc_project/extsensors/margin/nvme", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "p12v_fan", + "type": "margin", + "readPath": "/xyz/openbmc_project/extsensors/margin/p12v_fan", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + } + ], + "zones" : [ + { + "id": 0, + "minThermalOutput": 0.0, + "failsafePercent": 100.0, + "pids": [ + { + "name": "fan0", + "type": "fan", + "inputs": ["fan0"], + "setpoint": 0.0, + "pid": { + "samplePeriod": 0.1, + "proportionalCoeff": 0.0, + "integralCoeff": 0.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0056, + "integralLimit_min": 0.0, + "integralLimit_max": 0.0, + "outLim_min": 10.0, + "outLim_max": 100.0, + "slewNeg": 0.0, + "slewPos": 0.0 + } + }, + { + "name": "fan1", + "type": "fan", + "inputs": ["fan1"], + "setpoint": 0.0, + "pid": { + "samplePeriod": 0.1, + "proportionalCoeff": 0.0, + "integralCoeff": 0.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0056, + "integralLimit_min": 0.0, + "integralLimit_max": 0.0, + "outLim_min": 10.0, + "outLim_max": 100.0, + "slewNeg": 0.0, + "slewPos": 0.0 + } + }, + { + "name": "cputemp", + "type": "margin", + "inputs": ["cputemp"], + "setpoint": 10.0, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": 714.0, + "integralCoeff": 9.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 1786.0, + "integralLimit_max": 18000.0, + "outLim_min": 1786.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "zone0_vr", + "type": "margin", + "inputs": ["zone0_vr"], + "setpoint": 10.0, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": 536.0, + "integralCoeff": 9.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 1786.0, + "integralLimit_max": 18000.0, + "outLim_min": 1786.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "fleeting0", + "type": "margin", + "inputs": ["fleeting0"], + "setpoint": 10.0, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": 536.0, + "integralCoeff": 9.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 1786.0, + "integralLimit_max": 18000.0, + "outLim_min": 1786.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "fleeting1", + "type": "margin", + "inputs": ["fleeting1"], + "setpoint": 10.0, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": 536.0, + "integralCoeff": 18.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 1786.0, + "integralLimit_max": 18000.0, + "outLim_min": 1786.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + } + ] + }, + { + "id": 1, + "minThermalOutput": 0.0, + "failsafePercent": 100.0, + "pids": [ + { + "name": "fb_fan0", + "type": "fan", + "inputs": ["fb_fan0"], + "setpoint": 0.0, + "pid": { + "samplePeriod": 0.1, + "proportionalCoeff": 0.0, + "integralCoeff": 0.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0056, + "integralLimit_min": 0.0, + "integralLimit_max": 0.0, + "outLim_min": 10.0, + "outLim_max": 100.0, + "slewNeg": 0.0, + "slewPos": 0.0 + } + }, + { + "name": "fb_fan1", + "type": "fan", + "inputs": ["fb_fan1"], + "setpoint": 0.0, + "pid": { + "samplePeriod": 0.1, + "proportionalCoeff": 0.0, + "integralCoeff": 0.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0056, + "integralLimit_min": 0.0, + "integralLimit_max": 0.0, + "outLim_min": 10.0, + "outLim_max": 100.0, + "slewNeg": 0.0, + "slewPos": 0.0 + } + }, + { + "name": "fb_fan2", + "type": "fan", + "inputs": ["fb_fan2"], + "setpoint": 0.0, + "pid": { + "samplePeriod": 0.1, + "proportionalCoeff": 0.0, + "integralCoeff": 0.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0056, + "integralLimit_min": 0.0, + "integralLimit_max": 0.0, + "outLim_min": 10.0, + "outLim_max": 100.0, + "slewNeg": 0.0, + "slewPos": 0.0 + } + }, + { + "name": "nvme", + "type": "margin", + "inputs": ["nvme"], + "setpoint": 10.0, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": 1786.0, + "integralCoeff": 36.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 1786.0, + "integralLimit_max": 18000.0, + "outLim_min": 1786.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "p12v_fan", + "type": "margin", + "inputs": ["p12v_fan"], + "setpoint": 10.0, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": 268.0, + "integralCoeff": 4.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 1786.0, + "integralLimit_max": 18000.0, + "outLim_min": 1786.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + } + ] + } + ] +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh new file mode 100644 index 000000000..22cfab582 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +for i in {1..5}; +do + echo 255 > /sys/class/hwmon/*/pwm${i} +done diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service new file mode 100644 index 000000000..681bdbe00 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service @@ -0,0 +1,12 @@ +[Unit] +Description=Set Fan to Default Duty as Rebooting +DefaultDependencies=no +After=shutdown.target + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=/usr/bin/fan-default-speed.sh + +[Install] +WantedBy=shutdown.target diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh new file mode 100644 index 000000000..5706a73fb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# wait for fan dbus +mapper wait /xyz/openbmc_project/sensors/fan_tach/fan0 +mapper wait /xyz/openbmc_project/sensors/fan_tach/fan1 +mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan0 +mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan1 +mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan2 + +/usr/bin/fan-default-speed.sh + +# generate fan table writePath +Fan_0_To_4_Hwmon="$(ls -la /sys/class/hwmon |grep pwm | head -n 1| tail -n +1|cut -d '/' -f 9)" + +if [[ "$Fan_0_To_4_Hwmon" != "" ]] +then + sed -i "s/Fan_0_To_4_Hwmon/$Fan_0_To_4_Hwmon/g" /usr/share/swampd/config.json +fi + +# start read margin temp wait +/usr/bin/read-margin-temp-wait.sh & + +exit 0 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service new file mode 100644 index 000000000..33a441928 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service @@ -0,0 +1,15 @@ +[Unit] +Description=Swampd Margin-based Fan Control Daemon +After=xyz.openbmc_project.Hwmon@-ahb-apb-pwm\x2dfan\x2dcontroller\x40103000.service + +[Service] +Type=simple +ExecStartPre=/usr/bin/fan-table-init.sh +ExecStart=/usr/bin/swampd +Restart=always +RestartSec=5 +StartLimitInterval=0 +ExecStopPost=/usr/bin/fan-default-speed.sh + +[Install] +WantedBy=basic.target diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend new file mode 100644 index 000000000..f87a49394 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend @@ -0,0 +1,31 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://config.json" +SRC_URI_append_gbs = " file://fan-table-init.sh" +SRC_URI_append_gbs = " file://fan-default-speed.sh" +SRC_URI_append_gbs = " file://phosphor-pid-control.service" +SRC_URI_append_gbs = " file://fan-reboot-control.service" + +FILES_${PN}_append_gbs = " ${datadir}/swampd/config.json" +FILES_${PN}_append_gbs = " ${bindir}/fan-default-speed.sh" +FILES_${PN}_append_gbs = " ${bindir}/fan-table-init.sh" + +RDEPENDS_${PN} += "bash" + +SYSTEMD_SERVICE_${PN}_append_gbs = " phosphor-pid-control.service" +SYSTEMD_SERVICE_${PN}_append_gbs = " fan-reboot-control.service" + +do_install_append_gbs() { + install -d ${D}/${bindir} + install -m 0755 ${WORKDIR}/fan-default-speed.sh ${D}/${bindir} + install -m 0755 ${WORKDIR}/fan-table-init.sh ${D}/${bindir} + + install -d ${D}${datadir}/swampd + install -m 0644 -D ${WORKDIR}/config.json \ + ${D}${datadir}/swampd/config.json + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/phosphor-pid-control.service \ + ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/fan-reboot-control.service \ + ${D}${systemd_system_unitdir} +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-0.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-0.conf new file mode 100644 index 000000000..e26c8f50e --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-0.conf @@ -0,0 +1,6 @@ +#The gpio 70 is a real gpio, which is used to +#store the sas cable 0 present signal +INVENTORY=/system/chassis/cable/ss_cab0_prsnt +DEVPATH=/dev/input/event0 +KEY=70 +NAME=ss_cab0_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-1.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-1.conf new file mode 100644 index 000000000..e6a18ee6c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-1.conf @@ -0,0 +1,6 @@ +#The gpio 71 is a real gpio, which is used to +#store the sas cable 1 present signal +INVENTORY=/system/chassis/cable/ss_cab1_prsnt +DEVPATH=/dev/input/event0 +KEY=71 +NAME=ss_cab1_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-2.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-2.conf new file mode 100644 index 000000000..490f97f49 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-2.conf @@ -0,0 +1,6 @@ +#The gpio 72 is a real gpio, which is used to +#store the sas cable 2 present signal +INVENTORY=/system/chassis/cable/ss_cab2_prsnt +DEVPATH=/dev/input/event0 +KEY=72 +NAME=ss_cab2_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-3.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-3.conf new file mode 100644 index 000000000..f3579ab97 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-3.conf @@ -0,0 +1,6 @@ +#The gpio 73 is a real gpio, which is used to +#store the sas cable 3 present signal +INVENTORY=/system/chassis/cable/ss_cab3_prsnt +DEVPATH=/dev/input/event0 +KEY=73 +NAME=ss_cab3_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-4.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-4.conf new file mode 100644 index 000000000..be6ed95af --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-4.conf @@ -0,0 +1,6 @@ +#The gpio 57 is a real gpio, which is used to +#store the HSBP cable present signal +INVENTORY=/system/chassis/cable/hsbp_cab_prsnt +DEVPATH=/dev/input/event0 +KEY=57 +NAME=hsbp_cab_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-5.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-5.conf new file mode 100644 index 000000000..223ef4a7c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-5.conf @@ -0,0 +1,6 @@ +#The gpio 58 is a real gpio, which is used to +#store the fan board cable present signal +INVENTORY=/system/chassis/cable/fanbd_cab_prsnt +DEVPATH=/dev/input/event0 +KEY=58 +NAME=fanbd_cab_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-6.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-6.conf new file mode 100644 index 000000000..c32fb3c97 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-6.conf @@ -0,0 +1,6 @@ +#The gpio 69 is a real gpio, which is used to +#store the HSBP 12V standby cable present signal +INVENTORY=/system/chassis/cable/bp12v_cab_prsnt +DEVPATH=/dev/input/event0 +KEY=69 +NAME=bp12v_cab_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-7.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-7.conf new file mode 100644 index 000000000..1cc7da265 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-7.conf @@ -0,0 +1,6 @@ +#The gpio 5 is a real gpio, which is used to +#store the SATA0 present signal +INVENTORY=/system/chassis/entity/sata0_prsnt +DEVPATH=/dev/input/event0 +KEY=5 +NAME=sata0_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-8.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-8.conf new file mode 100644 index 000000000..38c72e11e --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-8.conf @@ -0,0 +1,6 @@ +#The gpio 120 is a real gpio, which is used to +#store the PE0 present signal +INVENTORY=/system/chassis/entity/pe_slot0_prsnt +DEVPATH=/dev/input/event0 +KEY=120 +NAME=pe_slot0_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-9.conf b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-9.conf new file mode 100644 index 000000000..007229d44 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/gpios-9.conf @@ -0,0 +1,6 @@ +#The gpio 121 is a real gpio, which is used to +#store the PE1 present signal +INVENTORY=/system/chassis/entity/pe_slot1_prsnt +DEVPATH=/dev/input/event0 +KEY=121 +NAME=pe_slot1_prsnt diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-gpio-presence@.service.replace b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-gpio-presence@.service.replace new file mode 100644 index 000000000..15341cbfb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-gpio-presence@.service.replace @@ -0,0 +1,14 @@ +[Unit] +Description=Phosphor GPIO %I Presence +Wants=mapper-wait@-xyz-openbmc_project-inventory.service +After=mapper-wait@-xyz-openbmc_project-inventory.service +ConditionPathExists=/etc/default/obmc/gpio/gpios-%i.conf +StartLimitBurst=10 + +[Service] +Restart=on-failure +EnvironmentFile=/etc/default/obmc/gpio/gpios-%i.conf +ExecStart=/usr/bin/phosphor-gpio-presence --path=${DEVPATH} --inventory=${INVENTORY} --key=${KEY} --name=${NAME} --drivers=${DRIVERS} --extra-ifaces=${EXTRA_IFACES} + +[Install] +RequiredBy=multi-user.target diff --git a/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend new file mode 100644 index 000000000..d45636609 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend @@ -0,0 +1,32 @@ +inherit obmc-phosphor-systemd + +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" + +SRC_URI_append_gbs = " file://phosphor-gpio-presence@.service.replace" + +TMPL_PRESENT = "phosphor-gpio-presence@.service" +INSTFMT_PRESENT = "phosphor-gpio-presence@{0}.service" +PRESENT_TGT = "multi-user.target" +FMT_PRESENT = "../${TMPL_PRESENT}:${PRESENT_TGT}.requires/${INSTFMT_PRESENT}" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-0.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-1.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-2.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-3.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-4.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-5.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-6.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-7.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-8.conf" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs +="obmc/gpio/gpios-9.conf" +GBS_OBMC_PRESENT_INSTANCES = "0 1 2 3 4 5 6 7 8 9" + +SYSTEMD_LINK_${PN}-presence_append_gbs = " ${@compose_list(d, 'FMT_PRESENT', 'GBS_OBMC_PRESENT_INSTANCES')}" + +GBS_PRESENT_ENV_FMT = "obmc/gpio/gpios-{0}.conf" + +SYSTEMD_ENVIRONMENT_FILE_${PN}-presence_gbs = " ${@compose_list(d, 'GBS_PRESENT_ENV_FMT', 'GBS_OBMC_PRESENT_INSTANCES')}" + +do_install_append_gbs() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/phosphor-gpio-presence@.service.replace ${D}${systemd_system_unitdir}/phosphor-gpio-presence@.service +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/host/phosphor-host-postd_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/host/phosphor-host-postd_%.bbappend new file mode 100644 index 000000000..ef3ecb2e4 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/host/phosphor-host-postd_%.bbappend @@ -0,0 +1,2 @@ +SNOOP_DEVICE_gbs = "npcm7xx-lpc-bpc0" +PACKAGECONFIG_append_gbs = " 7seg" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/images/obmc-phosphor-image.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/images/obmc-phosphor-image.bbappend new file mode 100644 index 000000000..3b83932e7 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/images/obmc-phosphor-image.bbappend @@ -0,0 +1,23 @@ +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " phosphor-host-postd" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " phosphor-sel-logger" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " google-ipmi-sys" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " google-ipmi-i2c" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-hotswap-power-cycle" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " loadsvf" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-cpld-ver-check" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " memtester" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " net-tools" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-boot-status-led" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " phosphor-nvme" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-detect-gpio-present" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " phosphor-ecc" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-sysinit" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-ipmi-entity-association-map" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-detect-fan-fail" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " usb-network" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " mac-address" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " phosphor-image-signing" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " openssl-bin" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " phosphor-ipmi-blobs-binarystore" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " gbs-nvme-pwr-ctrl" +OBMC_IMAGE_EXTRA_INSTALL_append_gbs = " read-margin-temp" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/interfaces/bmcweb_%.bbappend new file mode 100755 index 000000000..87ecf4fa3 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -0,0 +1,3 @@ +EXTRA_OECMAKE_append_gbs = " \ + -DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES=ON \ + " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/inventory/inventory-cleanup.bb b/meta-quanta/meta-gbs/recipes-phosphor/inventory/inventory-cleanup.bb new file mode 100644 index 000000000..0c4b56f72 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/inventory/inventory-cleanup.bb @@ -0,0 +1,17 @@ +SUMMARY = "Copy the inventory cleanup yaml for inventory manager" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit allarch +inherit phosphor-inventory-manager + +S = "${WORKDIR}" + +SRC_URI = "file://inventory-cleanup.yaml" + +do_install() { + install -D inventory-cleanup.yaml ${D}${base_datadir}/events.d/inventory-cleanup.yaml +} + +FILES_${PN} += "${base_datadir}/events.d/inventory-cleanup.yaml" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/inventory/inventory-cleanup/inventory-cleanup.yaml b/meta-quanta/meta-gbs/recipes-phosphor/inventory/inventory-cleanup/inventory-cleanup.yaml new file mode 100644 index 000000000..78e03fee0 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/inventory/inventory-cleanup/inventory-cleanup.yaml @@ -0,0 +1,16 @@ +description: > + GBS inventory fixups + +events: + - name: Add Chassis interface + description: > + Add the chassis interface on the chassis inventory path + type: startup + actions: + - name: createObjects + objs: + /system/chassis: + xyz.openbmc_project.Inventory.Item.Chassis: + Type: + value: "RackMount" + type: string diff --git a/meta-quanta/meta-gbs/recipes-phosphor/inventory/phosphor-inventory-manager/associations.json b/meta-quanta/meta-gbs/recipes-phosphor/inventory/phosphor-inventory-manager/associations.json new file mode 100644 index 000000000..b834fa876 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/inventory/phosphor-inventory-manager/associations.json @@ -0,0 +1,487 @@ +[ + { + "path": "system/chassis/motherboard/nvme0", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme0" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme1", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme1" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme2", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme2" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme3", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme3" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme4", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme4" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme5", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme5" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme6", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme6" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme7", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme7" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme8", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme8" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme9", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme9" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme10", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme10" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme11", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme11" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme12", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme12" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme13", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme13" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme14", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme14" + ] + } + ] + }, + { + "path": "system/chassis/motherboard/nvme15", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/nvme15" + ] + } + ] + }, + { + "path": "system/chassis/fan", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/fan_tach/fan0", + "/xyz/openbmc_project/sensors/fan_tach/fan1", + "/xyz/openbmc_project/sensors/fan_tach/fb_fan0", + "/xyz/openbmc_project/sensors/fan_tach/fb_fan1", + "/xyz/openbmc_project/sensors/fan_tach/fb_fan2" + ] + } + ] + }, + { + "path": "system/chassis/motherboard", + "endpoints": + [ + { + "types": + { + "rType": "inventory", + "fType": "sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/i2cool_0", + "/xyz/openbmc_project/sensors/temperature/i2cool_1", + "/xyz/openbmc_project/sensors/temperature/i2cool_2", + "/xyz/openbmc_project/sensors/temperature/powerseq_temp", + "/xyz/openbmc_project/sensors/temperature/cputemp", + "/xyz/openbmc_project/sensors/temperature/nvme0", + "/xyz/openbmc_project/sensors/temperature/nvme1", + "/xyz/openbmc_project/sensors/temperature/nvme2", + "/xyz/openbmc_project/sensors/temperature/nvme3", + "/xyz/openbmc_project/sensors/temperature/nvme4", + "/xyz/openbmc_project/sensors/temperature/nvme5", + "/xyz/openbmc_project/sensors/temperature/nvme6", + "/xyz/openbmc_project/sensors/temperature/nvme7", + "/xyz/openbmc_project/sensors/temperature/nvme8", + "/xyz/openbmc_project/sensors/temperature/nvme9", + "/xyz/openbmc_project/sensors/temperature/nvme10", + "/xyz/openbmc_project/sensors/temperature/nvme11", + "/xyz/openbmc_project/sensors/temperature/nvme12", + "/xyz/openbmc_project/sensors/temperature/nvme13", + "/xyz/openbmc_project/sensors/temperature/nvme14", + "/xyz/openbmc_project/sensors/temperature/nvme15", + + "/xyz/openbmc_project/sensors/voltage/p1v8_stby", + "/xyz/openbmc_project/sensors/voltage/vddcr_soc_stby", + "/xyz/openbmc_project/sensors/voltage/p2v5_stby", + "/xyz/openbmc_project/sensors/voltage/p1v2_stby", + "/xyz/openbmc_project/sensors/voltage/p1v175_stby", + "/xyz/openbmc_project/sensors/voltage/p1v8", + "/xyz/openbmc_project/sensors/voltage/p3v3", + "/xyz/openbmc_project/sensors/voltage/pwrgd_pvpp", + "/xyz/openbmc_project/sensors/voltage/pwrgd_pvddio", + "/xyz/openbmc_project/sensors/voltage/pwrgd_cpuvr", + "/xyz/openbmc_project/sensors/voltage/p3v3_stby", + "/xyz/openbmc_project/sensors/voltage/p5v_stby", + "/xyz/openbmc_project/sensors/voltage/p3v_bat_adc", + + "/xyz/openbmc_project/sensors/voltage/vddcr_cpu_in", + "/xyz/openbmc_project/sensors/voltage/vddcr_cpu_out", + "/xyz/openbmc_project/sensors/current/vddcr_cpu_in", + "/xyz/openbmc_project/sensors/current/vddcr_cpu_out", + "/xyz/openbmc_project/sensors/temperature/vddcr_cpu", + + "/xyz/openbmc_project/sensors/voltage/vddcr_soc_in", + "/xyz/openbmc_project/sensors/voltage/vddcr_soc_out", + "/xyz/openbmc_project/sensors/current/vddcr_soc_in", + "/xyz/openbmc_project/sensors/current/vddcr_soc_out", + "/xyz/openbmc_project/sensors/temperature/vddcr_soc", + + "/xyz/openbmc_project/sensors/voltage/vddio_abcd_out", + "/xyz/openbmc_project/sensors/voltage/vddio_abcd_in", + "/xyz/openbmc_project/sensors/current/vddio_abcd_in", + "/xyz/openbmc_project/sensors/current/vddio_abcd_out", + "/xyz/openbmc_project/sensors/temperature/vddio_abcd", + + "/xyz/openbmc_project/sensors/voltage/vddio_efgh_out", + "/xyz/openbmc_project/sensors/voltage/vddio_efgh_in", + "/xyz/openbmc_project/sensors/current/vddio_efgh_in", + "/xyz/openbmc_project/sensors/current/vddio_efgh_out", + "/xyz/openbmc_project/sensors/temperature/vddio_efgh", + + "/xyz/openbmc_project/sensors/voltage/p12v_mobo_out", + "/xyz/openbmc_project/sensors/voltage/p12v_mobo_in", + "/xyz/openbmc_project/sensors/current/p12v_mobo_in", + "/xyz/openbmc_project/sensors/current/p12v_mobo_out", + "/xyz/openbmc_project/sensors/temperature/p12v_mobo", + + "/xyz/openbmc_project/sensors/voltage/p12v_fan_out", + "/xyz/openbmc_project/sensors/voltage/p12v_fan_in", + "/xyz/openbmc_project/sensors/current/p12v_fan_in", + "/xyz/openbmc_project/sensors/current/p12v_fan_out", + "/xyz/openbmc_project/sensors/temperature/p12v_fan", + + "/xyz/openbmc_project/sensors/voltage/hotswap_vin", + "/xyz/openbmc_project/sensors/voltage/hotswap_vout", + "/xyz/openbmc_project/sensors/current/hotswap_iout", + "/xyz/openbmc_project/sensors/power/hotswap_pout", + "/xyz/openbmc_project/sensors/temperature/hotswap" + ] + } + ] + }, + { + "path": "system/chassis", + "endpoints": + [ + { + "types": + { + "rType": "chassis", + "fType": "all_sensors" + }, + "paths": + [ + "/xyz/openbmc_project/sensors/temperature/i2cool_0", + "/xyz/openbmc_project/sensors/temperature/i2cool_1", + "/xyz/openbmc_project/sensors/temperature/i2cool_2", + "/xyz/openbmc_project/sensors/temperature/powerseq_temp", + "/xyz/openbmc_project/sensors/temperature/cputemp", + "/xyz/openbmc_project/sensors/temperature/nvme0", + "/xyz/openbmc_project/sensors/temperature/nvme1", + "/xyz/openbmc_project/sensors/temperature/nvme2", + "/xyz/openbmc_project/sensors/temperature/nvme3", + "/xyz/openbmc_project/sensors/temperature/nvme4", + "/xyz/openbmc_project/sensors/temperature/nvme5", + "/xyz/openbmc_project/sensors/temperature/nvme6", + "/xyz/openbmc_project/sensors/temperature/nvme7", + "/xyz/openbmc_project/sensors/temperature/nvme8", + "/xyz/openbmc_project/sensors/temperature/nvme9", + "/xyz/openbmc_project/sensors/temperature/nvme10", + "/xyz/openbmc_project/sensors/temperature/nvme11", + "/xyz/openbmc_project/sensors/temperature/nvme12", + "/xyz/openbmc_project/sensors/temperature/nvme13", + "/xyz/openbmc_project/sensors/temperature/nvme14", + "/xyz/openbmc_project/sensors/temperature/nvme15", + + "/xyz/openbmc_project/sensors/voltage/p1v8_stby", + "/xyz/openbmc_project/sensors/voltage/vddcr_soc_stby", + "/xyz/openbmc_project/sensors/voltage/p2v5_stby", + "/xyz/openbmc_project/sensors/voltage/p1v2_stby", + "/xyz/openbmc_project/sensors/voltage/p1v175_stby", + "/xyz/openbmc_project/sensors/voltage/p1v8", + "/xyz/openbmc_project/sensors/voltage/p3v3", + "/xyz/openbmc_project/sensors/voltage/pwrgd_pvpp", + "/xyz/openbmc_project/sensors/voltage/pwrgd_pvddio", + "/xyz/openbmc_project/sensors/voltage/pwrgd_cpuvr", + "/xyz/openbmc_project/sensors/voltage/p3v3_stby", + "/xyz/openbmc_project/sensors/voltage/p5v_stby", + "/xyz/openbmc_project/sensors/voltage/p3v_bat_adc", + + "/xyz/openbmc_project/sensors/voltage/vddcr_cpu_in", + "/xyz/openbmc_project/sensors/voltage/vddcr_cpu_out", + "/xyz/openbmc_project/sensors/current/vddcr_cpu_in", + "/xyz/openbmc_project/sensors/current/vddcr_cpu_out", + "/xyz/openbmc_project/sensors/temperature/vddcr_cpu", + + "/xyz/openbmc_project/sensors/voltage/vddcr_soc_in", + "/xyz/openbmc_project/sensors/voltage/vddcr_soc_out", + "/xyz/openbmc_project/sensors/current/vddcr_soc_in", + "/xyz/openbmc_project/sensors/current/vddcr_soc_out", + "/xyz/openbmc_project/sensors/temperature/vddcr_soc", + + "/xyz/openbmc_project/sensors/voltage/vddio_abcd_out", + "/xyz/openbmc_project/sensors/voltage/vddio_abcd_in", + "/xyz/openbmc_project/sensors/current/vddio_abcd_in", + "/xyz/openbmc_project/sensors/current/vddio_abcd_out", + "/xyz/openbmc_project/sensors/temperature/vddio_abcd", + + "/xyz/openbmc_project/sensors/voltage/vddio_efgh_out", + "/xyz/openbmc_project/sensors/voltage/vddio_efgh_in", + "/xyz/openbmc_project/sensors/current/vddio_efgh_in", + "/xyz/openbmc_project/sensors/current/vddio_efgh_out", + "/xyz/openbmc_project/sensors/temperature/vddio_efgh", + + "/xyz/openbmc_project/sensors/voltage/p12v_mobo_out", + "/xyz/openbmc_project/sensors/voltage/p12v_mobo_in", + "/xyz/openbmc_project/sensors/current/p12v_mobo_in", + "/xyz/openbmc_project/sensors/current/p12v_mobo_out", + "/xyz/openbmc_project/sensors/temperature/p12v_mobo", + + "/xyz/openbmc_project/sensors/voltage/p12v_fan_out", + "/xyz/openbmc_project/sensors/voltage/p12v_fan_in", + "/xyz/openbmc_project/sensors/current/p12v_fan_in", + "/xyz/openbmc_project/sensors/current/p12v_fan_out", + "/xyz/openbmc_project/sensors/temperature/p12v_fan", + + "/xyz/openbmc_project/sensors/voltage/hotswap_vin", + "/xyz/openbmc_project/sensors/voltage/hotswap_vout", + "/xyz/openbmc_project/sensors/current/hotswap_iout", + "/xyz/openbmc_project/sensors/power/hotswap_pout", + "/xyz/openbmc_project/sensors/temperature/hotswap", + + "/xyz/openbmc_project/sensors/fan_tach/fan0", + "/xyz/openbmc_project/sensors/fan_tach/fan1", + "/xyz/openbmc_project/sensors/fan_tach/fb_fan0", + "/xyz/openbmc_project/sensors/fan_tach/fb_fan1", + "/xyz/openbmc_project/sensors/fan_tach/fb_fan2" + ] + } + ] + } +] diff --git a/meta-quanta/meta-gbs/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend new file mode 100644 index 000000000..205822cb9 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend @@ -0,0 +1,9 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +PACKAGECONFIG_append_gbs = " associations" +SRC_URI_append_gbs = " file://associations.json" +DEPENDS_append_gbs = " inventory-cleanup" + +do_install_append_gbs() { + install -d ${D}${base_datadir} + install -m 0755 ${WORKDIR}/associations.json ${D}${base_datadir}/associations.json +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-blobs-binarystore/config.json b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-blobs-binarystore/config.json new file mode 100644 index 000000000..4ad11bc6e --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-blobs-binarystore/config.json @@ -0,0 +1,5 @@ +[{ + "blobBaseId": "/skm/hss/", + "sysFilePath": "/sys/class/i2c-adapter/i2c-5/5-0050/5-00500/nvmem", + "offsetBytes": 256 +}] diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-blobs-binarystore_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-blobs-binarystore_%.bbappend new file mode 100644 index 000000000..1dba2ec35 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-blobs-binarystore_%.bbappend @@ -0,0 +1,8 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://config.json" +FILES_${PN}_append_gbs = " ${datadir}/binaryblob/config.json" + +do_install_append_gbs() { + install -d ${D}${datadir}/binaryblob/ + install ${WORKDIR}/config.json ${D}${datadir}/binaryblob/config.json +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend new file mode 100644 index 000000000..ca7172498 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json new file mode 100644 index 000000000..bc98176b5 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json @@ -0,0 +1,2 @@ +{"id": 32, "revision": 129, "addn_dev_support": 141, + "manuf_id": 7244, "prod_id": 14401, "aux": 0} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config/entity-map.json b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config/entity-map.json new file mode 100644 index 000000000..cb08553b3 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-config/entity-map.json @@ -0,0 +1,28 @@ +[ + { + "id": 1, + "containerEntityId" : 30, + "containerEntityInstance" : 0, + "isList" : false, + "isLinked" : false, + "entities" : [ + {"id" : 11, "instance" : 0}, + {"id" : 11, "instance" : 1}, + {"id" : 29, "instance" : 0}, + {"id" : 29, "instance" : 1} + ] + }, + { + "id": 2, + "containerEntityId" : 30, + "containerEntityInstance" : 1, + "isList" : false, + "isLinked" : false, + "entities" : [ + {"id" : 29, "instance" : 2}, + {"id" : 29, "instance" : 4}, + {"id" : 0, "instance" : 0}, + {"id" : 0, "instance" : 0} + ] + } +] diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend new file mode 100644 index 000000000..9f4c89026 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend @@ -0,0 +1,5 @@ +NUVOTON_FLASH_PCIMBOX = "0xF0848000" + +EXTRA_OECONF_append_gbs = " --enable-nuvoton-p2a-mbox" + +IPMI_FLASH_BMC_ADDRESS_gbs = "${NUVOTON_FLASH_PCIMBOX}" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/fan b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/fan new file mode 100644 index 000000000..9bb4f2c09 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/fan @@ -0,0 +1,3 @@ +OF_NAME=fan_fru +SYSFS_PATH=/no-such-path/eeprom +FRUID=0x02 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/hsbp b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/hsbp new file mode 100644 index 000000000..cb099974c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/hsbp @@ -0,0 +1,3 @@ +OF_NAME=hsbp_fru +SYSFS_PATH=/no-such-path/eeprom +FRUID=0x01 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard new file mode 100644 index 000000000..0b36379f7 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard @@ -0,0 +1,3 @@ +OF_NAME=mb_fru +SYSFS_PATH=/sys/bus/i2c/devices/5-0050/eeprom +FRUID=0x00 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend new file mode 100644 index 000000000..877129716 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend @@ -0,0 +1,26 @@ +inherit obmc-phosphor-systemd +DEPENDS_append_gbs = " gbs-yaml-config" + +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" + +EEPROM_NAMES = "motherboard hsbp fan" + +EEPROMFMT = "system/chassis/{0}" +EEPROM_ESCAPEDFMT = "system-chassis-{0}" +EEPROMS = "${@compose_list(d, 'EEPROMFMT', 'EEPROM_NAMES')}" +EEPROMS_ESCAPED = "${@compose_list(d, 'EEPROM_ESCAPEDFMT', 'EEPROM_NAMES')}" + +ENVFMT = "obmc/eeproms/{0}" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs := " ${@compose_list(d, 'ENVFMT', 'EEPROMS')}" + +TMPL = "obmc-read-eeprom@.service" +TGT = "multi-user.target" +INSTFMT = "obmc-read-eeprom@{0}.service" +FMT = "../${TMPL}:${TGT}.wants/${INSTFMT}" + +SYSTEMD_LINK_${PN}_append_gbs := " ${@compose_list(d, 'FMT', 'EEPROMS_ESCAPED')}" + +EXTRA_OECONF_append_gbs = " \ + YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-fru-read.yaml \ + PROP_YAML=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-extra-properties.yaml \ + " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch new file mode 100644 index 000000000..d815cde72 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch @@ -0,0 +1,138 @@ +From 9deb72959477700216326c033c930236e58f965f Mon Sep 17 00:00:00 2001 +From: Ren Yu <yux.ren@intel.com> +Date: Tue, 28 May 2019 17:11:17 +0800 +Subject: [PATCH] Save the pre-timeout interrupt in dbus property + +Get the watchdog pre-timeout interrupt value from ipmi watchdog set command, +and store it into dbus property. + +Tested: +Config IPMI watchdog: BIOS FRB2 Power Cycle after 1 seconds: +ipmitool raw 0x06 0x24 0x01 0x13 0x0 0x2 0xa 0x00 +Start watchdog: +Ipmitool mc watchdog reset +Check the watchdog pre-timeout interrupt in below: +https://BMCIP/redfish/v1/Systems/system/LogServices/EventLog/Entries + +Signed-off-by: Ren Yu <yux.ren@intel.com> + +--- + app/watchdog.cpp | 47 ++++++++++++++++++++++++++++++++++++++++ + app/watchdog_service.cpp | 6 +++++ + app/watchdog_service.hpp | 9 ++++++++ + 3 files changed, 62 insertions(+) + +diff --git a/app/watchdog.cpp b/app/watchdog.cpp +index 03c373e..cb0b1fd 100644 +--- a/app/watchdog.cpp ++++ b/app/watchdog.cpp +@@ -80,6 +80,7 @@ ipmi::RspType<> ipmiAppResetWatchdogTimer() + + static constexpr uint8_t wd_dont_stop = 0x1 << 6; + static constexpr uint8_t wd_timeout_action_mask = 0x3; ++static constexpr uint8_t wdPreTimeoutInterruptMask = 0x3; + + static constexpr uint8_t wdTimerUseResTimer1 = 0x0; + static constexpr uint8_t wdTimerUseResTimer2 = 0x6; +@@ -127,6 +128,45 @@ WatchdogService::Action ipmiActionToWdAction(IpmiAction ipmi_action) + } + } + ++enum class IpmiPreTimeoutInterrupt : uint8_t ++{ ++ None = 0x0, ++ SMI = 0x1, ++ NMI = 0x2, ++ MI = 0x3, ++}; ++/** @brief Converts an IPMI Watchdog PreTimeoutInterrupt to DBUS defined action ++ * @param[in] ipmi_action The IPMI Watchdog PreTimeoutInterrupt ++ * @return The Watchdog PreTimeoutInterrupt that the ipmi_action maps to ++ */ ++WatchdogService::PreTimeoutInterruptAction ipmiPreTimeoutInterruptToWdAction( ++ IpmiPreTimeoutInterrupt ipmiPreTimeOutInterrupt) ++{ ++ switch (ipmiPreTimeOutInterrupt) ++ { ++ case IpmiPreTimeoutInterrupt::None: ++ { ++ return WatchdogService::PreTimeoutInterruptAction::None; ++ } ++ case IpmiPreTimeoutInterrupt::SMI: ++ { ++ return WatchdogService::PreTimeoutInterruptAction::SMI; ++ } ++ case IpmiPreTimeoutInterrupt::NMI: ++ { ++ return WatchdogService::PreTimeoutInterruptAction::NMI; ++ } ++ case IpmiPreTimeoutInterrupt::MI: ++ { ++ return WatchdogService::PreTimeoutInterruptAction::MI; ++ } ++ default: ++ { ++ throw std::domain_error("IPMI PreTimeoutInterrupt is invalid"); ++ } ++ } ++} ++ + enum class IpmiTimerUse : uint8_t + { + Reserved = 0x0, +@@ -250,6 +290,13 @@ ipmi::RspType<> + // Mark as initialized so that future resets behave correctly + wd_service.setInitialized(true); + ++ // pretimeOutAction ++ const auto ipmiPreTimeoutInterrupt = ++ static_cast<IpmiPreTimeoutInterrupt>(wdPreTimeoutInterruptMask & ++ (static_cast<uint8_t>(preTimeoutInterrupt))); ++ wd_service.setPreTimeoutInterrupt( ++ ipmiPreTimeoutInterruptToWdAction(ipmiPreTimeoutInterrupt)); ++ + lastCallSuccessful = true; + return ipmi::responseSuccess(); + } +diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp +index 3534e89..4df1ab6 100644 +--- a/app/watchdog_service.cpp ++++ b/app/watchdog_service.cpp +@@ -198,3 +198,9 @@ void WatchdogService::setInterval(uint64_t interval) + { + setProperty("Interval", interval); + } ++ ++void WatchdogService::setPreTimeoutInterrupt( ++ PreTimeoutInterruptAction preTimeoutInterrupt) ++{ ++ setProperty("PreTimeoutInterrupt", convertForMessage(preTimeoutInterrupt)); ++} +\ No newline at end of file +diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp +index 141bdb7..32b7461 100644 +--- a/app/watchdog_service.hpp ++++ b/app/watchdog_service.hpp +@@ -15,6 +15,8 @@ class WatchdogService + + using Action = + sdbusplus::xyz::openbmc_project::State::server::Watchdog::Action; ++ using PreTimeoutInterruptAction = sdbusplus::xyz::openbmc_project::State:: ++ server::Watchdog::PreTimeoutInterruptAction; + using TimerUse = + sdbusplus::xyz::openbmc_project::State::server::Watchdog::TimerUse; + +@@ -92,6 +94,13 @@ class WatchdogService + */ + void setInterval(uint64_t interval); + ++ /** @brief Sets the value of the PreTimeoutInterrupt property on the host ++ * watchdog ++ * ++ * @param[in] PreTimeoutInterrupt - The new PreTimeoutInterrupt value ++ */ ++ void setPreTimeoutInterrupt(PreTimeoutInterruptAction preTimeoutInterrupt); ++ + private: + /** @brief sdbusplus handle */ + sdbusplus::bus::bus bus; diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf new file mode 100644 index 000000000..359c7dbeb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host/gbs-ipmid-whitelist.conf @@ -0,0 +1,79 @@ +#<NetFn>:<Command> +0x00:0x00 //<Chassis>:<Chassis Capabiliti> +0x00:0x01 //<Chassis>:<Get Chassis Status> +0x00:0x02 //<Chassis>:<Chassis Control> +0x00:0x04 //<Chassis>:<Chassis Identify> +0x00:0x05 //<Chassis>:<Set Chassis Capabilities> +0x00:0x06 //<Chassis>:<Set Power Restore Policy> +0x00:0x08 //<Chassis>:<Set System Boot Options> +0x00:0x09 //<Chassis>:<Get System Boot Options> +0x00:0x0F //<Chassis>:<Get POH Counter> +0x04:0x02 //<Sensor/Event>:<Platform Event> +0x04:0x20 //<Sensor/Event>:<Get Device SDR Info> +0x04:0x21 //<Sensor/Event>:<Get Device SDR> +0x04:0x22 //<Sensor/Event>:<Reserve Device SDR Repository> +0x04:0x27 //<Sensor/Event>:<Get Sensor Threshold> +0x04:0x29 //<Sensor/Event>:<Get Sensor Event Enable> +0x04:0x2B //<Sensor/Event>:<Get Sensor Event Status> +0x04:0x2D //<Sensor/Event>:<Get Sensor Reading> +0x04:0x2F //<Sensor/Event>:<Get Sensor Type> +0x04:0x30 //<Sensor/Event>:<Set Sensor Reading and Event Status> +0x06:0x01 //<App>:<Get Device ID> +0x06:0x02 //<App>:<Cold Reset> +0x06:0x03 //<App>:<Warm Reset> +0x06:0x04 //<App>:<Get Self Test Results> +0x06:0x06 //<App>:<Set ACPI Power State> +0x06:0x07 //<App>:<Get ACPI Power State> +0x06:0x08 //<App>:<Get Device GUID> +0x06:0x22 //<App>:<Reset Watchdog Timer> +0x06:0x24 //<App>:<Set Watchdog Timer> +0x06:0x25 //<App>:<Get Watchdog Timer> +0x06:0x35 //<App>:<Read Event Message Buffer> +0x06:0x3D //<App>:<Get Session Info> +0x06:0x40 //<App>:<Set Channel Access> +0x06:0x41 //<App>:<Get Channel Access> +0x06:0x42 //<App>:<Get Channel Info> +0x06:0x43 //<App>:<Set User Access> +0x06:0x44 //<App>:<Get User Access> +0x06:0x45 //<App>:<Set User Name> +0x06:0x46 //<App>:<Get User Name> +0x06:0x47 //<App>:<Set User Password> +0x06:0x48 //<App>:<Activate Payload> +0x06:0x49 //<App>:<Deactivate Payload> +0x06:0x4A //<App>:<Get Payload Activation Status> +0x06:0x4B //<App>:<Get Payload Instance Info> +0x06:0x54 //<App>:<Get Channel Cipher Suites> +0x06:0x58 //<App>:<Set System Info Parameters> +0x06:0x59 //<App>:<Get System Info Parameters> +0x0A:0x10 //<Storage>:<Get FRU Inventory Area Info> +0x0A:0x11 //<Storage>:<Read FRU Data> +0x0A:0x20 //<Storage>:<Get SDR Repository Info> +0x0A:0x22 //<Storage>:<Reserve SDR Repository> +0x0A:0x23 //<Storage>:<Get SDR> +0x0A:0x40 //<Storage>:<Get SEL Info> +0x0A:0x42 //<Storage>:<Reserve SEL> +0x0A:0x43 //<Storage>:<Get SEL Entry> +0x0A:0x44 //<Storage>:<Add SEL Entry> +0x0A:0x46 //<Storage>:<Delete SEL Entry> +0x0A:0x47 //<Storage>:<Clear SEL> +0x0A:0x48 //<Storage>:<Get SEL Time> +0x0A:0x49 //<Storage>:<Set SEL Time> +0x0C:0x01 //<Transport>:<Set LAN Configuration Parameters> +0x0C:0x02 //<Transport>:<Get LAN Configuration Parameters> +0x2C:0x00 //<Group Extension>:<Group Extension Command> +0x2C:0x01 //<Group Extension>:<Get DCMI Capabilities> +0x2C:0x02 //<Group Extension>:<Get Power Reading> +0x2C:0x03 //<Group Extension>:<Get Power Limit> +0x2C:0x06 //<Group Extension>:<Get Asset Tag> +0x2C:0x07 //<Group Extension>:<Get Sensor Info> +0x2C:0x09 //<Group Extension>:<Get Management Controller Identifier String> +0x2C:0x0A //<Group Extension>:<Set Management Controller Identifier String> +0x2C:0x10 //<Group Extension>:<Get Temperature Readings> +0x2C:0x12 //<Group Extension>:<Set DCMI Configuration Parameters> +0x2C:0x13 //<Group Extension>:<Get DCMI Configuration Parameters> +0x2C:0x3E //<Group Extension>:<Get HPM.x Capabilities> +0x2E:0x02 //<Google OEM>:<I2C via Proxy Adapter> +0x2E:0x04 //<Google OEM>:<Fan Manual Control Mode> +0x2E:0x30 //<Google OEM>:<Ethernet Statistics> +0x2E:0x32 //<Google OEM>:<Sys Commands> +0x2E:0x80 //<Google OEM>:<Blob Commands> diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend new file mode 100644 index 000000000..bf2986c47 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -0,0 +1,18 @@ +DEPENDS_append_gbs = " gbs-yaml-config" + +SRC_URI_remove_gbs = "git://github.com/openbmc/phosphor-host-ipmid" +SRC_URI_prepend_gbs = "git://github.com/quanta-bmc/phosphor-host-ipmid.git" + +SRCREV_gbs = "257ea262809c52e51f1f592e047d27125f0273b3" + +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://gbs-ipmid-whitelist.conf \ + file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \ + " + +WHITELIST_CONF_gbs = "${WORKDIR}/gbs-ipmid-whitelist.conf" + +EXTRA_OECONF_append_gbs = " --with-journal-sel \ + SENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-sensors.yaml \ + FRU_YAML_GEN=${STAGING_DIR_HOST}${datadir}/gbs-yaml-config/ipmi-fru-read.yaml \ + " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-kcs/99-ipmi-kcs.rules b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-kcs/99-ipmi-kcs.rules new file mode 100644 index 000000000..1de5562c3 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-kcs/99-ipmi-kcs.rules @@ -0,0 +1 @@ +KERNEL=="ipmi-kcs1", SYMLINK+="ipmi_kcs1" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend new file mode 100644 index 000000000..a7f60d4cc --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend @@ -0,0 +1,9 @@ +KCS_DEVICE_gbs = "ipmi_kcs1" + +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://99-ipmi-kcs.rules" + +do_install_append_gbs() { + install -d ${D}/lib/udev/rules.d + install -m 0644 ${WORKDIR}/99-ipmi-kcs.rules ${D}/lib/udev/rules.d +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/leds/gbs-led-manager-config-native.bb b/meta-quanta/meta-gbs/recipes-phosphor/leds/gbs-led-manager-config-native.bb new file mode 100644 index 000000000..03b562002 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/leds/gbs-led-manager-config-native.bb @@ -0,0 +1,19 @@ +SUMMARY = "Phosphor LED Group Management for GBS" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit native + +PROVIDES += "virtual/phosphor-led-manager-config-native" + +SRC_URI += "file://led.yaml" +S = "${WORKDIR}" + +# Overwrite the example led layout yaml file prior +# to building the phosphor-led-manager package +do_install() { + SRC=${S} + DEST=${D}${datadir}/phosphor-led-manager + install -D ${SRC}/led.yaml ${DEST}/led.yaml +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/leds/gbs-led-manager-config/led.yaml b/meta-quanta/meta-gbs/recipes-phosphor/leds/gbs-led-manager-config/led.yaml new file mode 100644 index 000000000..411e0d4c6 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/leds/gbs-led-manager-config/led.yaml @@ -0,0 +1,239 @@ +bmc_booted: + heartbeat: + Action: 'Blink' + DutyOn: 50 + Period: 1000 + +enclosure_identify: + attention: + Action: 'Blink' + DutyOn: 50 + Period: 1000 + +enclosure_fault: + bmc_fault: + Action: 'On' + DutyOn: 50 + Period: 0 + Priority: 'Blink' + +boot_status_inactive: + sys_boot_status: + Action: 'Blink' + DutyOn: 50 + Period: 1000 + +boot_status_standby: + sys_boot_status: + Action: 'On' + Period: 1000 + +led_u2_0_locate: + led_u2_0_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_0_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_1_locate: + led_u2_1_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_1_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_2_locate: + led_u2_2_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_2_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_3_locate: + led_u2_3_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_3_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_4_locate: + led_u2_4_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_4_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_5_locate: + led_u2_5_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_5_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_6_locate: + led_u2_6_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_6_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_7_locate: + led_u2_7_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_7_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_8_locate: + led_u2_8_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_8_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_9_locate: + led_u2_9_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_9_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_10_locate: + led_u2_10_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_10_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_11_locate: + led_u2_11_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_11_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_12_locate: + led_u2_12_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_12_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_13_locate: + led_u2_13_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_13_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_14_locate: + led_u2_14_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_14_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 +led_u2_15_locate: + led_u2_15_locate: + Action: 'Blink' + DutyOn: 50 + Period: 250 + led_u2_15_fault: + Action: 'Blink' + DutyOn: 50 + Period: 250 + +led_u2_0_fault: + led_u2_0_fault: + Action: 'On' + Period: 1000 +led_u2_1_fault: + led_u2_1_fault: + Action: 'On' + Period: 1000 +led_u2_2_fault: + led_u2_2_fault: + Action: 'On' + Period: 1000 +led_u2_3_fault: + led_u2_3_fault: + Action: 'On' + Period: 1000 +led_u2_4_fault: + led_u2_4_fault: + Action: 'On' + Period: 1000 +led_u2_5_fault: + led_u2_5_fault: + Action: 'On' + Period: 1000 +led_u2_6_fault: + led_u2_6_fault: + Action: 'On' + Period: 1000 +led_u2_7_fault: + led_u2_7_fault: + Action: 'On' + Period: 1000 +led_u2_8_fault: + led_u2_8_fault: + Action: 'On' + Period: 1000 +led_u2_9_fault: + led_u2_9_fault: + Action: 'On' + Period: 1000 +led_u2_10_fault: + led_u2_10_fault: + Action: 'On' + Period: 1000 +led_u2_11_fault: + led_u2_11_fault: + Action: 'On' + Period: 1000 +led_u2_12_fault: + led_u2_12_fault: + Action: 'On' + Period: 1000 +led_u2_13_fault: + led_u2_13_fault: + Action: 'On' + Period: 1000 +led_u2_14_fault: + led_u2_14_fault: + Action: 'On' + Period: 1000 +led_u2_15_fault: + led_u2_15_fault: + Action: 'On' + Period: 1000
\ No newline at end of file diff --git a/meta-quanta/meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend new file mode 100644 index 000000000..49959cc0e --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/network/phosphor-network_%.bbappend @@ -0,0 +1 @@ +EXTRA_OECONF_append_gbs = " --enable-nic-ethtool=yes" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-gbs-apps.bb b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-gbs-apps.bb new file mode 100644 index 000000000..4c1bb123c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-gbs-apps.bb @@ -0,0 +1,36 @@ +SUMMARY = "OpenBMC for GBS system - Applications" +PR = "r1" + +inherit packagegroup + +PROVIDES = "${PACKAGES}" +PACKAGES = " \ + ${PN}-chassis \ + ${PN}-fans \ + ${PN}-flash \ + " + +PROVIDES += "virtual/obmc-chassis-mgmt" +PROVIDES += "virtual/obmc-fan-mgmt" +PROVIDES += "virtual/obmc-flash-mgmt" + +RPROVIDES_${PN}-chassis += "virtual-obmc-chassis-mgmt" +RPROVIDES_${PN}-fans += "virtual-obmc-fan-mgmt" +RPROVIDES_${PN}-flash += "virtual-obmc-flash-mgmt" + +SUMMARY_${PN}-chassis = "GBS Chassis" +RDEPENDS_${PN}-chassis = " \ + x86-power-control \ + " + +SUMMARY_${PN}-fans = "GBS Fans" +RDEPENDS_${PN}-fans = " \ + phosphor-pid-control \ + " + +SUMMARY_${PN}-flash = "GBS Flash" +RDEPENDS_${PN}-flash = " \ + phosphor-ipmi-flash \ + gbs-bmc-update \ + gbs-bios-update \ + " diff --git a/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend new file mode 100644 index 000000000..935c3cebb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/packagegroups/packagegroup-obmc-apps%.bbappend @@ -0,0 +1,2 @@ +RDEPENDS_${PN}-extras_remove_gbs = "obmc-ikvm" +RDEPENDS_${PN}-inventory_append_gbs = " virtual/obmc-gpio-presence" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend new file mode 100644 index 000000000..e0f8e08aa --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend @@ -0,0 +1,5 @@ +SRC_URI_gbs := "git://github.com/quanta-bmc/phosphor-sel-logger.git" +SRCREV_gbs := "6ded68355db28958836aedb40c0d4780d84d2b43" + +# Enable threshold monitoring +EXTRA_OECMAKE_append_gbs = "-DSEL_LOGGER_MONITOR_THRESHOLD_EVENTS=ON" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch new file mode 100644 index 000000000..c279e0b81 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch @@ -0,0 +1,257 @@ +From 2cea5d289b278db4468b16bf6b64102655811fd0 Mon Sep 17 00:00:00 2001 +From: Eddielu <Eddie.Lu@quantatw.com> +Date: Mon, 27 Jul 2020 20:30:22 +0800 +Subject: [PATCH] Update lev-add-poweron-monitor-feature patch. + +--- + Makefile.am | 2 ++ + mainloop.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + sensor.cpp | 11 ++++++- + sensor.hpp | 13 ++++++++ + thresholds.hpp | 2 -- + 5 files changed, 127 insertions(+), 3 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 706a6cc..c620fa4 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -46,6 +46,7 @@ libhwmon_la_LIBADD = \ + $(SDEVENTPLUS_LIBS) \ + $(PHOSPHOR_DBUS_INTERFACES_LIBS) \ + $(PHOSPHOR_LOGGING_LIBS) \ ++ $(PTHREAD_LIBS) \ + $(GPIOPLUS_LIBS) \ + $(STDPLUS_LIBS) \ + $(CODE_COVERAGE_LIBS) \ +@@ -55,6 +56,7 @@ libhwmon_la_CXXFLAGS = \ + $(SDEVENTPLUS_CFLAGS) \ + $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \ + $(PHOSPHOR_LOGGING_CFLAGS) \ ++ $(PTHREAD_CFLAGS) \ + $(STDPLUS_CFLAGS) \ + $(CODE_COVERAGE_CXXFLAGS) + +diff --git a/mainloop.cpp b/mainloop.cpp +index 3e7e0bf..4789a80 100644 +--- a/mainloop.cpp ++++ b/mainloop.cpp +@@ -41,6 +41,12 @@ + #include <string> + #include <unordered_set> + #include <xyz/openbmc_project/Sensor/Device/error.hpp> ++#include <boost/container/flat_map.hpp> ++#include <boost/algorithm/string/predicate.hpp> ++#include <sdbusplus/asio/connection.hpp> ++#include <sdbusplus/asio/object_server.hpp> ++#include <sdbusplus/message/types.hpp> ++#include <sdbusplus/timer.hpp> + + using namespace phosphor::logging; + +@@ -76,6 +82,12 @@ decltype( + Thresholds<CriticalObject>::alarmHi) Thresholds<CriticalObject>::alarmHi = + &CriticalObject::criticalAlarmHigh; + ++static std::unique_ptr<phosphor::Timer> cacheTimer = nullptr; ++static std::unique_ptr<sdbusplus::bus::match::match> powerMatch = nullptr; ++static bool powerStatusOn = false; ++static boost::asio::io_service io; ++static auto conn = std::make_shared<sdbusplus::asio::connection>(io); ++ + void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) + { + for (auto& iface : ifaces) +@@ -103,6 +115,84 @@ void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) + } + } + ++void powerStatusSet() ++{ ++ powerStatusOn = true; ++ return; ++} ++ ++void createTimer() ++{ ++ if (cacheTimer == nullptr) ++ { ++ cacheTimer = std::make_unique<phosphor::Timer>(powerStatusSet); ++ } ++} ++ ++bool isPowerOn(void) ++{ ++ if (!powerMatch) ++ { ++ throw std::runtime_error("Power Match Not Created"); ++ } ++ return powerStatusOn; ++} ++ ++void setupPowerMatch(sdbusplus::bus::bus& bus) ++{ ++ if (powerMatch) ++ { ++ return; ++ } ++ ++ powerMatch = std::make_unique<sdbusplus::bus::match::match>( ++ bus, ++ "type='signal',interface='org.freedesktop.DBus.Properties',path='/xyz/" ++ "openbmc_project/state/" ++ "host0',arg0='xyz.openbmc_project.State.Host'", ++ [](sdbusplus::message::message& message) { ++ std::string objectName; ++ boost::container::flat_map<std::string, std::variant<std::string>> ++ values; ++ message.read(objectName, values); ++ auto findState = values.find("CurrentHostState"); ++ if (findState != values.end()) ++ { ++ bool on = boost::ends_with( ++ std::get<std::string>(findState->second), "Running"); ++ if (!on) ++ { ++ cacheTimer->stop(); ++ powerStatusOn = false; ++ return; ++ } ++ cacheTimer->start(std::chrono::duration_cast<std::chrono::microseconds>( ++ std::chrono::seconds(10))); ++ } ++ else { ++ powerStatusOn = false; ++ } ++ }); ++ ++ conn->async_method_call( ++ [](boost::system::error_code ec, ++ const std::variant<std::string>& state) { ++ if (ec) ++ { ++ return; ++ } ++ powerStatusOn = ++ boost::ends_with(std::get<std::string>(state), "Running"); ++ }, ++ "xyz.openbmc_project.State.Host", ++ "/xyz/openbmc_project/state/host0", ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.State.Host", "CurrentHostState"); ++ ++ createTimer(); ++} ++ ++ + std::string MainLoop::getID(SensorSet::container_t::const_reference sensor) + { + std::string id; +@@ -384,6 +474,7 @@ void MainLoop::init() + _interval = std::strtoull(interval.c_str(), NULL, 10); + } + } ++ setupPowerMatch(_bus); + } + + void MainLoop::read() +@@ -428,6 +519,12 @@ void MainLoop::read() + + try + { ++ if(sensor->pwrOnMonitor() && !isPowerOn()) ++ { ++ statusIface->functional(false); ++ continue; ++ } ++ + if (sensor->hasFaultFile()) + { + auto fault = _ioAccess->read(sensorSysfsType, sensorSysfsNum, +@@ -490,6 +587,11 @@ void MainLoop::read() + } + } + ++ if(sensor->pwrOnMonitor() && !isPowerOn()) ++ { ++ statusIface->functional(false); ++ continue; ++ } + updateSensorInterfaces(obj, value); + } + catch (const std::system_error& e) +diff --git a/sensor.cpp b/sensor.cpp +index 09aeca6..b1cb470 100644 +--- a/sensor.cpp ++++ b/sensor.cpp +@@ -31,7 +31,7 @@ Sensor::Sensor(const SensorSet::key_type& sensor, + const hwmonio::HwmonIOInterface* ioAccess, + const std::string& devPath) : + _sensor(sensor), +- _ioAccess(ioAccess), _devPath(devPath), _scale(0), _hasFaultFile(false) ++ _ioAccess(ioAccess), _devPath(devPath), _scale(0), _hasFaultFile(false), _pwrOnMonitor(false) + { + auto chip = env::getEnv("GPIOCHIP", sensor); + auto access = env::getEnv("GPIO", sensor); +@@ -60,6 +60,15 @@ Sensor::Sensor(const SensorSet::key_type& sensor, + auto senRmRCs = env::getEnv("REMOVERCS", sensor); + // Add sensor removal return codes defined per sensor + addRemoveRCs(senRmRCs); ++ ++ auto pwrOnMon = env::getEnv("PWRONMON", sensor); ++ if (!pwrOnMon.empty()) ++ { ++ if (pwrOnMon == "ON") ++ { ++ _pwrOnMonitor = true; ++ } ++ } + } + + void Sensor::addRemoveRCs(const std::string& rcList) +diff --git a/sensor.hpp b/sensor.hpp +index 4b2d281..369a252 100644 +--- a/sensor.hpp ++++ b/sensor.hpp +@@ -135,6 +135,16 @@ class Sensor + return _hasFaultFile; + } + ++ /** ++ * @brief Get whether the sensor only need to be monitored in power on state or not. ++ * ++ * @return - Boolean on whether the sensor only need to be monitored in power on state ++ */ ++ inline bool pwrOnMonitor(void) const ++ { ++ return _pwrOnMonitor; ++ } ++ + private: + /** @brief Sensor object's identifiers */ + SensorSet::key_type _sensor; +@@ -156,6 +166,9 @@ class Sensor + + /** @brief Tracks whether the sensor has a fault file or not. */ + bool _hasFaultFile; ++ ++ /** @brief Whether the sensor only need to be monitored in power on state or not. */ ++ bool _pwrOnMonitor; + }; + + /** +diff --git a/thresholds.hpp b/thresholds.hpp +index 4d2fcff..972a469 100644 +--- a/thresholds.hpp ++++ b/thresholds.hpp +@@ -101,8 +101,6 @@ auto addThreshold(const std::string& sensorType, const std::string& sensorID, + auto hi = stod(tHi) * std::pow(10, scale); + (*iface.*Thresholds<T>::setLo)(lo); + (*iface.*Thresholds<T>::setHi)(hi); +- (*iface.*Thresholds<T>::alarmLo)(value <= lo); +- (*iface.*Thresholds<T>::alarmHi)(value >= hi); + auto type = Thresholds<T>::type; + obj[type] = iface; + } +-- +2.7.4 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-lev-add-sensors-slow-readings.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-lev-add-sensors-slow-readings.patch new file mode 100644 index 000000000..0ab2f2048 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0002-lev-add-sensors-slow-readings.patch @@ -0,0 +1,295 @@ +From 8eafa1b0513dd2f5898182487b4524a485bf1e21 Mon Sep 17 00:00:00 2001 +From: Eddielu <Eddie.Lu@quantatw.com> +Date: Mon, 27 Jul 2020 20:54:28 +0800 +Subject: [PATCH] Update add sensors slow readings patch. + +--- + mainloop.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- + mainloop.hpp | 3 +++ + meson.build | 1 + + sensor.cpp | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- + sensor.hpp | 20 ++++++++++++++-- + 5 files changed, 158 insertions(+), 14 deletions(-) + +diff --git a/mainloop.cpp b/mainloop.cpp +index 4789a80..98d0658 100644 +--- a/mainloop.cpp ++++ b/mainloop.cpp +@@ -34,6 +34,7 @@ + #include <cassert> + #include <cstdlib> + #include <functional> ++#include <future> + #include <iostream> + #include <memory> + #include <phosphor-logging/elog-errors.hpp> +@@ -299,7 +300,7 @@ std::optional<ObjectStateData> + { + // Add status interface based on _fault file being present + sensorObj->addStatus(info); +- valueInterface = sensorObj->addValue(retryIO, info); ++ valueInterface = sensorObj->addValue(retryIO, info, _timedoutMap); + } + catch (const std::system_error& e) + { +@@ -542,10 +543,74 @@ void MainLoop::read() + // RAII object for GPIO unlock / lock + auto locker = sensor::gpioUnlock(sensor->getGpio()); + +- // Retry for up to a second if device is busy +- // or has a transient error. +- value = _ioAccess->read(sensorSysfsType, sensorSysfsNum, input, ++ // For sensors with attribute ASYNC_READ_TIMEOUT, ++ // spawn a thread with timeout ++ auto asyncRead = ++ env::getEnv("ASYNC_READ_TIMEOUT", sensorSetKey); ++ if (!asyncRead.empty()) ++ { ++ // Default async read timeout ++ std::chrono::milliseconds asyncReadTimeout{ ++ std::stoi(asyncRead)}; ++ bool valueIsValid = false; ++ std::future<int64_t> asyncThread; ++ ++ auto asyncIter = _timedoutMap.find(sensorSetKey); ++ if (asyncIter == _timedoutMap.end()) ++ { ++ // If sensor not found in timedoutMap, spawn an async ++ // thread ++ asyncThread = std::async( ++ std::launch::async, ++ &hwmonio::HwmonIOInterface::read, _ioAccess, ++ sensorSysfsType, sensorSysfsNum, input, ++ hwmonio::retries, hwmonio::delay); ++ valueIsValid = true; ++ } ++ else ++ { ++ // If we already have the async thread in the ++ // timedoutMap, it means this sensor has already timed ++ // out in the previous reads. No need to wait on ++ // subsequent reads ++ asyncReadTimeout = std::chrono::seconds(0); ++ asyncThread = std::move(asyncIter->second); ++ } ++ ++ std::future_status status = ++ asyncThread.wait_for(asyncReadTimeout); ++ switch (status) ++ { ++ // Read has finished ++ case std::future_status::ready: ++ // Read has finished ++ if (valueIsValid) ++ { ++ value = asyncThread.get(); ++ break; ++ // Good sensor reads should skip the code below ++ } ++ // Async read thread has completed, erase from ++ // timedoutMap to allow retry then throw ++ _timedoutMap.erase(sensorSetKey); ++ throw sensor::AsyncSensorReadTimeOut(); ++ default: ++ // Read timed out so add the thread to the ++ // timedoutMap (if the entry already exists, ++ // operator[] updates it) ++ _timedoutMap[sensorSetKey] = std::move(asyncThread); ++ throw sensor::AsyncSensorReadTimeOut(); ++ } ++ } ++ else ++ { ++ // Retry for up to a second if device is busy ++ // or has a transient error. ++ value = ++ _ioAccess->read(sensorSysfsType, sensorSysfsNum, input, + hwmonio::retries, hwmonio::delay); ++ } ++ + // Set functional property to true if we could read sensor + statusIface->functional(true); + +diff --git a/mainloop.hpp b/mainloop.hpp +index b3de022..6803c4b 100644 +--- a/mainloop.hpp ++++ b/mainloop.hpp +@@ -9,6 +9,7 @@ + #include "types.hpp" + + #include <any> ++#include <future> + #include <memory> + #include <optional> + #include <sdbusplus/server.hpp> +@@ -116,6 +117,8 @@ class MainLoop + /** @brief Store the specifications of sensor objects */ + std::map<SensorSet::key_type, std::unique_ptr<sensor::Sensor>> + _sensorObjects; ++ /** @brief Store the async futures of timed out sensor objects */ ++ std::map<SensorSet::key_type, std::future<int64_t>> _timedoutMap; + + /** + * @brief Map of removed sensors +diff --git a/meson.build b/meson.build +index 66e6801..d6a92f8 100644 +--- a/meson.build ++++ b/meson.build +@@ -84,6 +84,7 @@ libhwmon_all = static_library( + gpioplus, + phosphor_dbus_interfaces, + phosphor_logging, ++ threads, + ], + link_with: [ + libaverage, +diff --git a/sensor.cpp b/sensor.cpp +index b1cb470..72b45f8 100644 +--- a/sensor.cpp ++++ b/sensor.cpp +@@ -15,6 +15,7 @@ + #include <cmath> + #include <cstring> + #include <filesystem> ++#include <future> + #include <phosphor-logging/elog-errors.hpp> + #include <thread> + #include <xyz/openbmc_project/Common/error.hpp> +@@ -125,8 +126,9 @@ SensorValueType Sensor::adjustValue(SensorValueType value) + return value; + } + +-std::shared_ptr<ValueObject> Sensor::addValue(const RetryIO& retryIO, +- ObjectInfo& info) ++std::shared_ptr<ValueObject> Sensor::addValue( ++ const RetryIO& retryIO, ObjectInfo& info, ++ std::map<SensorSet::key_type, std::future<int64_t>>& timedoutMap) + { + static constexpr bool deferSignals = true; + +@@ -153,12 +155,69 @@ std::shared_ptr<ValueObject> Sensor::addValue(const RetryIO& retryIO, + // RAII object for GPIO unlock / lock + auto locker = gpioUnlock(getGpio()); + +- // Retry for up to a second if device is busy +- // or has a transient error. +- val = +- _ioAccess->read(_sensor.first, _sensor.second, +- hwmon::entry::cinput, std::get<size_t>(retryIO), +- std::get<std::chrono::milliseconds>(retryIO)); ++ // For sensors with attribute ASYNC_READ_TIMEOUT, ++ // spawn a thread with timeout ++ auto asyncRead = env::getEnv("ASYNC_READ_TIMEOUT", _sensor); ++ if (!asyncRead.empty()) ++ { ++ // Default async read timeout ++ std::chrono::milliseconds asyncReadTimeout{ ++ std::stoi(asyncRead)}; ++ bool valueIsValid = false; ++ std::future<int64_t> asyncThread; ++ ++ auto asyncIter = timedoutMap.find(_sensor); ++ if (asyncIter == timedoutMap.end()) ++ { ++ // If sensor not found in timedoutMap, spawn an async thread ++ asyncThread = std::async( ++ std::launch::async, &hwmonio::HwmonIOInterface::read, ++ _ioAccess, _sensor.first, _sensor.second, ++ hwmon::entry::cinput, std::get<size_t>(retryIO), ++ std::get<std::chrono::milliseconds>(retryIO)); ++ valueIsValid = true; ++ } ++ else ++ { ++ // If we already have the async thread in the timedoutMap, ++ // it means this sensor has already timed out in the ++ // previous reads. No need to wait on subsequent reads ++ asyncReadTimeout = std::chrono::seconds(0); ++ asyncThread = std::move(asyncIter->second); ++ } ++ ++ std::future_status status = ++ asyncThread.wait_for(asyncReadTimeout); ++ switch (status) ++ { ++ case std::future_status::ready: ++ // Read has finished ++ if (valueIsValid) ++ { ++ val = asyncThread.get(); ++ break; ++ // Good sensor reads should skip the code below ++ } ++ // Async read thread has completed, erase from ++ // timedoutMap to allow retry then throw ++ timedoutMap.erase(_sensor); ++ throw AsyncSensorReadTimeOut(); ++ default: ++ // Read timed out so add the thread to the timedoutMap ++ // (if the entry already exists, operator[] updates it) ++ timedoutMap[_sensor] = std::move(asyncThread); ++ throw AsyncSensorReadTimeOut(); ++ } ++ } ++ else ++ { ++ // Retry for up to a second if device is busy ++ // or has a transient error. ++ val = _ioAccess->read( ++ _sensor.first, _sensor.second, hwmon::entry::cinput, ++ std::get<size_t>(retryIO), ++ std::get<std::chrono::milliseconds>(retryIO)); ++ } + } + #ifdef UPDATE_FUNCTIONAL_ON_FAIL + catch (const std::system_error& e) +diff --git a/sensor.hpp b/sensor.hpp +index 369a252..41c0fe7 100644 +--- a/sensor.hpp ++++ b/sensor.hpp +@@ -4,6 +4,8 @@ + #include "sensorset.hpp" + #include "types.hpp" + ++#include <cerrno> ++#include <future> + #include <gpioplus/handle.hpp> + #include <memory> + #include <optional> +@@ -20,6 +22,17 @@ struct valueAdjust + std::unordered_set<int> rmRCs; + }; + ++/** @brief Custom exception for async sensor reading timeout ++ */ ++struct AsyncSensorReadTimeOut : public std::system_error ++{ ++ AsyncSensorReadTimeOut() : ++ system_error(std::error_code(ETIMEDOUT, std::system_category()), ++ "Async sensor read timed out") ++ { ++ } ++}; ++ + /** @class Sensor + * @brief Sensor object based on a SensorSet container's key type + * @details Sensor object to create and modify an associated device's sensor +@@ -87,10 +100,13 @@ class Sensor + * (number of and delay between) + * @param[in] info - Sensor object information + * ++ * @param[in] timedoutMap - Map to track timed out threads ++ * + * @return - Shared pointer to the value object + */ +- std::shared_ptr<ValueObject> addValue(const RetryIO& retryIO, +- ObjectInfo& info); ++ std::shared_ptr<ValueObject> addValue( ++ const RetryIO& retryIO, ObjectInfo& info, ++ std::map<SensorSet::key_type, std::future<int64_t>>& timedoutMap); + + /** + * @brief Add status interface and functional property for sensor +-- +2.7.4 + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@82000/sbtsi@4c.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@82000/sbtsi@4c.conf new file mode 100644 index 000000000..6dcada7b1 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@82000/sbtsi@4c.conf @@ -0,0 +1,9 @@ +LABEL_temp1 = "cputemp" +CRITHI_temp1 = "95000" +CRITLO_temp1 = "0" +WARNHI_temp1 = "95000" +WARNLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +ASYNC_READ_TIMEOUT_temp1 = "500" +PWRONMON_temp1 = "ON" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@0/max31725@54.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@0/max31725@54.conf new file mode 100644 index 000000000..839a7c610 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@0/max31725@54.conf @@ -0,0 +1,8 @@ +LABEL_temp1 = "i2cool_0" +CRITHI_temp1 = "35000" +CRITLO_temp1 = "0" +WARNHI_temp1 = "35000" +WARNLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +ASYNC_READ_TIMEOUT_temp1 = "500" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@1/max31725@55.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@1/max31725@55.conf new file mode 100644 index 000000000..174c62b98 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@1/max31725@55.conf @@ -0,0 +1,8 @@ +LABEL_temp1 = "i2cool_1" +CRITHI_temp1 = "70000" +CRITLO_temp1 = "0" +WARNHI_temp1 = "70000" +WARNLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +ASYNC_READ_TIMEOUT_temp1 = "500" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@2/max31725@5d.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@2/max31725@5d.conf new file mode 100644 index 000000000..3fb0ceeeb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@85000/i2c-switch@71/i2c@2/max31725@5d.conf @@ -0,0 +1,8 @@ +LABEL_temp1 = "i2cool_2" +CRITHI_temp1 = "70000" +CRITLO_temp1 = "0" +WARNHI_temp1 = "70000" +WARNLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +ASYNC_READ_TIMEOUT_temp1 = "500" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@88000/adm1272@10.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@88000/adm1272@10.conf new file mode 100644 index 000000000..41a53c052 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@88000/adm1272@10.conf @@ -0,0 +1,43 @@ +LABEL_in1 = "hotswap_vin" +CRITHI_in1 = "60000" +CRITLO_in1 = "40000" +WARNHI_in1 = "60000" +WARNLO_in1 = "40000" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "66" + +LABEL_in2 = "hotswap_vout" +CRITHI_in2 = "60000" +CRITLO_in2 = "40000" +WARNHI_in2 = "60000" +WARNLO_in2 = "40000" +MINVALUE_in2 = "0" +MAXVALUE_in2 = "66" + +LABEL_curr1= "hotswap_iout" +CRITHI_curr1= "40000" +CRITLO_curr1= "0" +WARNHI_curr1= "40000" +WARNLO_curr1= "0" +MINVALUE_curr1 = "0" +MAXVALUE_curr1 = "55" +# READ_Iout is direct value*0.98 +GAIN_curr1 = "0.98" + +LABEL_power1= "hotswap_pout" +CRITHI_power1= "1920000000" +CRITLO_power1= "0" +WARNHI_power1= "1920000000" +WARNLO_power1= "0" +MINVALUE_power1 = "0" +MAXVALUE_power1 = "2200" +# READ_Pout is direct value*0.98 +GAIN_power1 = "0.98" + +LABEL_temp1= "hotswap" +WARNLO_temp1= "0" +WARNHI_temp1= "125000" +CRITHI_temp1 = "125000" +CRITLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@0/vrm@60.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@0/vrm@60.conf new file mode 100644 index 000000000..79397b06c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@0/vrm@60.conf @@ -0,0 +1,46 @@ +LABEL_in1 = "vddcr_cpu_in" +CRITHI_in1 = "12600" +CRITLO_in1 = "11400" +WARNHI_in1 = "12600" +WARNLO_in1 = "11400" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "14" +# READ_VIN is direct value *10 +GAIN_in1 = "10.0" +PWRONMON_in1 = "ON" + +LABEL_in2 = "vddcr_cpu_out" +CRITHI_in2 = "1300" +CRITLO_in2 = "400" +WARNHI_in2 = "1300" +WARNLO_in2 = "400" +MINVALUE_in2 = "0" +MAXVALUE_in2 = "2" +PWRONMON_in2 = "ON" + +LABEL_curr1 = "vddcr_cpu_in" +CRITHI_curr1 = "21250" +CRITLO_curr1 = "-4000" +WARNHI_curr1 = "21250" +WARNLO_curr1 = "-4000" +MINVALUE_curr1 = "0" +MAXVALUE_curr1 = "22" +PWRONMON_curr1 = "ON" + +LABEL_curr2 = "vddcr_cpu_out" +CRITHI_curr2 = "255000" +CRITLO_curr2 = "-50000" +WARNHI_curr2 = "255000" +WARNLO_curr2 = "-50000" +MINVALUE_curr2 = "0" +MAXVALUE_curr2 = "256" +PWRONMON_curr2 = "ON" + +LABEL_temp1= "vddcr_cpu" +WARNLO_temp1= "0" +WARNHI_temp1= "100000" +CRITHI_temp1 = "100000" +CRITLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +PWRONMON_temp1 = "ON" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@1/vrm@61.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@1/vrm@61.conf new file mode 100644 index 000000000..f21c32a24 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@1/vrm@61.conf @@ -0,0 +1,46 @@ +LABEL_in1 = "vddcr_soc_in" +CRITHI_in1 = "12600" +CRITLO_in1 = "11400" +WARNHI_in1 = "12600" +WARNLO_in1 = "11400" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "14" +# READ_VIN is direct value *10 +GAIN_in1 = "10.0" +PWRONMON_in1 = "ON" + +LABEL_in2 = "vddcr_soc_out" +CRITHI_in2 = "1300" +CRITLO_in2 = "500" +WARNHI_in2 = "1300" +WARNLO_in2 = "500" +MINVALUE_in2 = "0" +MAXVALUE_in2 = "2" +PWRONMON_in2 = "ON" + +LABEL_curr1 = "vddcr_soc_in" +CRITHI_curr1 = "6700" +CRITLO_curr1 = "0" +WARNHI_curr1 = "6700" +WARNLO_curr1 = "0" +MINVALUE_curr1 = "0" +MAXVALUE_curr1 = "9" +PWRONMON_curr1 = "ON" + +LABEL_curr2 = "vddcr_soc_out" +CRITHI_curr2 = "80000" +CRITLO_curr2 = "0" +WARNHI_curr2 = "80000" +WARNLO_curr2 = "0" +MINVALUE_curr2 = "0" +MAXVALUE_curr2 = "88" +PWRONMON_curr2 = "ON" + +LABEL_temp1= "vddcr_soc" +WARNLO_temp1= "0" +WARNHI_temp1= "100000" +CRITHI_temp1 = "100000" +CRITLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +PWRONMON_temp1 = "ON" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@2/vrm@63.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@2/vrm@63.conf new file mode 100644 index 000000000..9cd9a129b --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@2/vrm@63.conf @@ -0,0 +1,46 @@ +LABEL_in1 = "vddio_efgh_in" +CRITHI_in1 = "12600" +CRITLO_in1 = "11400" +WARNHI_in1 = "12600" +WARNLO_in1 = "11400" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "14" +# READ_VIN is direct value *10 +GAIN_in1 = "10.0" +PWRONMON_in1 = "ON" + +LABEL_in2 = "vddio_efgh_out" +CRITHI_in2 = "1320" +CRITLO_in2 = "800" +WARNHI_in2 = "1320" +WARNLO_in2 = "800" +MINVALUE_in2 = "0" +MAXVALUE_in2 = "2" +PWRONMON_in2 = "ON" + +LABEL_curr1 = "vddio_efgh_in" +CRITHI_curr1 = "8400" +CRITLO_curr1 = "0" +WARNHI_curr1 = "8400" +WARNLO_curr1 = "0" +MINVALUE_curr1 = "0" +MAXVALUE_curr1 = "9" +PWRONMON_curr1 = "ON" + +LABEL_curr2 = "vddio_efgh_out" +CRITHI_curr2 = "84000" +CRITLO_curr2 = "0" +WARNHI_curr2 = "84000" +WARNLO_curr2 = "0" +MINVALUE_curr2 = "0" +MAXVALUE_curr2 = "88" +PWRONMON_curr2 = "ON" + +LABEL_temp1= "vddio_efgh" +WARNLO_temp1= "0" +WARNHI_temp1= "100000" +CRITHI_temp1 = "100000" +CRITLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +PWRONMON_temp1 = "ON" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@3/vrm@45.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@3/vrm@45.conf new file mode 100644 index 000000000..762af173b --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@89000/i2c-switch@71/i2c@3/vrm@45.conf @@ -0,0 +1,46 @@ +LABEL_in1 = "vddio_abcd_in" +CRITHI_in1 = "12600" +CRITLO_in1 = "11400" +WARNHI_in1 = "12600" +WARNLO_in1 = "11400" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "14" +# READ_VIN is direct value *10 +GAIN_in1 = "10.0" +PWRONMON_in1 = "ON" + +LABEL_in2 = "vddio_abcd_out" +CRITHI_in2 = "1320" +CRITLO_in2 = "800" +WARNHI_in2 = "1320" +WARNLO_in2 = "800" +MINVALUE_in2 = "0" +MAXVALUE_in2 = "2" +PWRONMON_in2 = "ON" + +LABEL_curr1 = "vddio_abcd_in" +CRITHI_curr1 = "8400" +CRITLO_curr1 = "0" +WARNHI_curr1 = "8400" +WARNLO_curr1 = "0" +MINVALUE_curr1 = "0" +MAXVALUE_curr1 = "9" +PWRONMON_curr1 = "ON" + +LABEL_curr2 = "vddio_abcd_out" +CRITHI_curr2 = "84000" +CRITLO_curr2 = "0" +WARNHI_curr2 = "84000" +WARNLO_curr2 = "0" +MINVALUE_curr2 = "0" +MAXVALUE_curr2 = "88" +PWRONMON_curr2 = "ON" + +LABEL_temp1= "vddio_abcd" +WARNLO_temp1= "0" +WARNHI_temp1= "100000" +CRITHI_temp1 = "100000" +CRITLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +PWRONMON_temp1 = "ON" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/max34451@4e.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/max34451@4e.conf new file mode 100644 index 000000000..9a8a80390 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/max34451@4e.conf @@ -0,0 +1,119 @@ +LABEL_in1 = "p1v8_stby" +CRITHI_in1 = "1890" +CRITLO_in1 = "1710" +WARNHI_in1 = "1890" +WARNLO_in1 = "1710" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "2" +PWRONMON_in1 = "ON" + +LABEL_in2 = "vddcr_soc_stby" +CRITHI_in2 = "945" +CRITLO_in2 = "855" +WARNHI_in2 = "945" +WARNLO_in2 = "855" +MINVALUE_in2 = "0" +MAXVALUE_in2 = "1" +PWRONMON_in2 = "ON" + +LABEL_in3 = "p2v5_stby" +CRITHI_in3 = "2625" +CRITLO_in3 = "2375" +WARNHI_in3 = "2625" +WARNLO_in3 = "2375" +MINVALUE_in3 = "0" +MAXVALUE_in3 = "3" +PWRONMON_in3 = "ON" + +LABEL_in4 = "p1v2_stby" +CRITHI_in4 = "1260" +CRITLO_in4 = "1140" +WARNHI_in4 = "1260" +WARNLO_in4 = "1140" +MINVALUE_in4 = "0" +MAXVALUE_in4 = "2" +PWRONMON_in4 = "ON" + +LABEL_in5 = "p1v175_stby" +CRITHI_in5 = "1234" +CRITLO_in5 = "1116" +WARNHI_in5 = "1234" +WARNLO_in5 = "1116" +MINVALUE_in5 = "0" +MAXVALUE_in5 = "2" +PWRONMON_in5 = "ON" + +LABEL_in6 = "p1v8" +CRITHI_in6 = "1890" +CRITLO_in6 = "1710" +WARNHI_in6 = "1890" +WARNLO_in6 = "1710" +MINVALUE_in6 = "0" +MAXVALUE_in6 = "2" +PWRONMON_in6 = "ON" + +LABEL_in7 = "p3v3" +CRITHI_in7 = "3465" +CRITLO_in7 = "3135" +WARNHI_in7 = "3465" +WARNLO_in7 = "3135" +MINVALUE_in7 = "0" +MAXVALUE_in7 = "4" +PWRONMON_in7 = "ON" + +LABEL_in8 = "pwrgd_pvpp" +CRITHI_in8 = "5760" +CRITLO_in8 = "1600" +WARNHI_in8 = "5760" +WARNLO_in8 = "1600" +MINVALUE_in8 = "0" +MAXVALUE_in8 = "6" +PWRONMON_in8 = "ON" +GAIN_in8 = "1.60" + +LABEL_in9 = "pwrgd_pvddio" +CRITHI_in9 = "5760" +CRITLO_in9 = "1600" +WARNHI_in9 = "5760" +WARNLO_in9 = "1600" +MINVALUE_in9 = "0" +MAXVALUE_in9 = "6" +PWRONMON_in9 = "ON" +GAIN_in9 = "1.60" + +LABEL_in10 = "pwrgd_cpuvr" +CRITHI_in10 = "5760" +CRITLO_in10 = "1600" +WARNHI_in10 = "5760" +WARNLO_in10 = "1600" +MINVALUE_in10 = "0" +MAXVALUE_in10 = "6" +PWRONMON_in10 = "ON" +GAIN_in10 = "1.60" + +LABEL_in11 = "p3v3_stby" +CRITHI_in11 = "3465" +CRITLO_in11 = "3135" +WARNHI_in11 = "3465" +WARNLO_in11 = "3135" +MINVALUE_in11 = "0" +MAXVALUE_in11 = "4" +PWRONMON_in11 = "ON" + +LABEL_in12 = "p5v_stby" +CRITHI_in12 = "5250" +CRITLO_in12 = "4750" +WARNHI_in12 = "5250" +WARNLO_in12 = "4750" +MINVALUE_in12 = "0" +MAXVALUE_in12 = "6" +PWRONMON_in12 = "ON" + +LABEL_temp1 = "powerseq_temp" +CRITHI_temp1 = "99000" +CRITLO_temp1 = "0" +WARNHI_temp1 = "99000" +WARNLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +ASYNC_READ_TIMEOUT_temp1 = "500" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5d.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5d.conf new file mode 100644 index 000000000..427cdabe0 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5d.conf @@ -0,0 +1,50 @@ +LABEL_in1 = "p12v_fan_in" +CRITHI_in1 = "60000" +CRITLO_in1 = "40000" +WARNHI_in1 = "60000" +WARNLO_in1 = "40000" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "65" +# READ_VIN is direct value*100 +GAIN_in1 = "100.0" +PWRONMON_in1 = "ON" + +LABEL_in2 = "p12v_fan_out" +CRITHI_in2 = "12600" +CRITLO_in2 = "11400" +WARNHI_in2 = "12600" +WARNLO_in2 = "11400" +MINVALUE_in2 = "0" +MAXVALUE_in2 = "14" +# READ_VOUT is direct value*5.02 +GAIN_in2 = "5.02" +PWRONMON_in2 = "ON" + +LABEL_curr1 = "p12v_fan_in" +CRITHI_curr1 = "30000" +CRITLO_curr1 = "0" +WARNHI_curr1 = "30000" +WARNLO_curr1 = "0" +MINVALUE_curr1 = "0" +MAXVALUE_curr1 = "35" +# READ_Iin is direct value*0.5 +GAIN_curr1 = "0.5" +PWRONMON_curr1 = "ON" + +LABEL_curr2 = "p12v_fan_out" +CRITHI_curr2 = "100000" +CRITLO_curr2 = "0" +WARNHI_curr2 = "100000" +WARNLO_curr2 = "0" +MINVALUE_curr2 = "0" +MAXVALUE_curr2 = "150" +PWRONMON_curr2 = "ON" + +LABEL_temp1= "p12v_fan" +WARNLO_temp1= "0" +WARNHI_temp1= "114000" +CRITHI_temp1 = "114000" +CRITLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +PWRONMON_temp1 = "ON" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5e.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5e.conf new file mode 100644 index 000000000..c1612d13b --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/i2c@8c000/vrm@5e.conf @@ -0,0 +1,50 @@ +LABEL_in1 = "p12v_mobo_in" +CRITHI_in1 = "60000" +CRITLO_in1 = "40000" +WARNHI_in1 = "60000" +WARNLO_in1 = "40000" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "65" +# READ_VIN is direct value*100 +GAIN_in1 = "100.0" +PWRONMON_in1 = "ON" + +LABEL_in2 = "p12v_mobo_out" +CRITHI_in2 = "12600" +CRITLO_in2 = "11400" +WARNHI_in2 = "12600" +WARNLO_in2 = "11400" +MINVALUE_in2 = "0" +MAXVALUE_in2 = "14" +# READ_VOUT is direct value*5.02 +GAIN_in2 = "5.02" +PWRONMON_in2 = "ON" + +LABEL_curr1 = "p12v_mobo_in" +CRITHI_curr1 = "30000" +CRITLO_curr1 = "0" +WARNHI_curr1 = "30000" +WARNLO_curr1 = "0" +MINVALUE_curr1 = "0" +MAXVALUE_curr1 = "35" +# READ_Iin is direct value*0.5 +GAIN_curr1 = "0.5" +PWRONMON_curr1 = "ON" + +LABEL_curr2 = "p12v_mobo_out" +CRITHI_curr2 = "100000" +CRITLO_curr2 = "0" +WARNHI_curr2 = "100000" +WARNLO_curr2 = "0" +MINVALUE_curr2 = "0" +MAXVALUE_curr2 = "150" +PWRONMON_curr2 = "ON" + +LABEL_temp1= "p12v_mobo" +WARNLO_temp1= "0" +WARNHI_temp1= "114000" +CRITHI_temp1 = "114000" +CRITLO_temp1 = "0" +MINVALUE_temp1 = "-128" +MAXVALUE_temp1 = "127" +PWRONMON_temp1 = "ON" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/pwm-fan-controller@103000.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/pwm-fan-controller@103000.conf new file mode 100644 index 000000000..1a8fafb08 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/ahb/apb/pwm-fan-controller@103000.conf @@ -0,0 +1,44 @@ +LABEL_fan1= "fan0" +WARNHI_fan1= "19800" +WARNLO_fan1= "600" +CRITHI_fan1= "19800" +CRITLO_fan1= "600" +MINVALUE_fan1 = "0" +MAXVALUE_fan1 = "20775" +PWM_TARGET_fan1 = 1 + +LABEL_fan2= "fan1" +WARNHI_fan2= "19800" +WARNLO_fan2= "600" +CRITHI_fan2= "19800" +CRITLO_fan2= "600" +MINVALUE_fan2 = "0" +MAXVALUE_fan2 = "20775" +PWM_TARGET_fan2 = 2 + +LABEL_fan3= "fb_fan0" +WARNHI_fan3= "19800" +WARNLO_fan3= "600" +CRITHI_fan3= "19800" +CRITLO_fan3= "600" +MINVALUE_fan3 = "0" +MAXVALUE_fan3 = "20775" +PWM_TARGET_fan3 = 3 + +LABEL_fan4= "fb_fan1" +WARNHI_fan4= "19800" +WARNLO_fan4= "600" +CRITHI_fan4= "19800" +CRITLO_fan4= "600" +MINVALUE_fan4 = "0" +MAXVALUE_fan4 = "20775" +PWM_TARGET_fan4 = 4 + +LABEL_fan5= "fb_fan2" +WARNHI_fan5= "19800" +WARNLO_fan5= "600" +CRITHI_fan5= "19800" +CRITLO_fan5= "600" +MINVALUE_fan5 = "0" +MAXVALUE_fan5 = "20775" +PWM_TARGET_fan5 = 5 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf new file mode 100644 index 000000000..4ae5a24eb --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/obmc/hwmon/iio-hwmon-battery.conf @@ -0,0 +1,15 @@ +LABEL_in1 = "p3v_bat_adc" +CRITLO_in1 = "2690" +CRITHI_in1 = "3480" +WARNHI_in1 = "3480" +WARNLO_in1 = "2690" +MINVALUE_in1 = "0" +MAXVALUE_in1 = "4" + +# The battery read is controlled by GPIO18 +GPIOCHIP_in1=0 +GPIO_in1=18 +GAIN_in1 = "3.14" + +# Sleep 24hrs per poll. Number is in microseconds. +INTERVAL=86400000000 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend new file mode 100644 index 000000000..c779b85e0 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon_%.bbappend @@ -0,0 +1,35 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" + +SRC_URI_append_gbs = " file://0001-lev-add-poweron-monitor-feature.patch \ + file://0002-lev-add-sensors-slow-readings.patch \ + " + +GBS_NAMES = " \ + i2c@82000/sbtsi@4c \ + i2c@85000/i2c-switch@71/i2c@0/max31725@54 \ + i2c@85000/i2c-switch@71/i2c@1/max31725@55 \ + i2c@85000/i2c-switch@71/i2c@2/max31725@5d \ + i2c@88000/adm1272@10 \ + i2c@89000/i2c-switch@71/i2c@0/vrm@60 \ + i2c@89000/i2c-switch@71/i2c@1/vrm@61 \ + i2c@89000/i2c-switch@71/i2c@2/vrm@63 \ + i2c@89000/i2c-switch@71/i2c@3/vrm@45 \ + i2c@8c000/max34451@4e \ + i2c@8c000/vrm@5d \ + i2c@8c000/vrm@5e \ + " +GBS_ITEMSFMT = "ahb/apb/{0}.conf" + +GBS_ITEMS += "${@compose_list(d, 'GBS_ITEMSFMT', 'GBS_NAMES')}" +GBS_ITEMS_append_gbs += " iio-hwmon-battery.conf" + +ENVS = "obmc/hwmon/{0}" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs = " ${@compose_list(d, 'ENVS', 'GBS_ITEMS')}" + +# Fan sensors +FITEMS = "pwm-fan-controller@103000.conf" +FENVS = "obmc/hwmon/ahb/apb/{0}" +SYSTEMD_ENVIRONMENT_FILE_${PN}_append_gbs = " ${@compose_list(d, 'FENVS', 'FITEMS')}" + + +EXTRA_OECONF_append_gbs = " --enable-update-functional-on-fail" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_config.json b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_config.json new file mode 100644 index 000000000..306e74e2a --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_config.json @@ -0,0 +1,174 @@ +{ + "config": [ + { + "NVMeDriveIndex": 0, + "NVMeDriveBusID": 47, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_0_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_0_locate", + "NVMeDrivePresentPin": 499, + "NVMeDrivePwrGoodPin": 467 + }, + { + "NVMeDriveIndex": 1, + "NVMeDriveBusID": 46, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_1_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_1_locate", + "NVMeDrivePresentPin": 498, + "NVMeDrivePwrGoodPin": 466 + }, + { + "NVMeDriveIndex": 2, + "NVMeDriveBusID": 45, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_2_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_2_locate", + "NVMeDrivePresentPin": 497, + "NVMeDrivePwrGoodPin": 465 + }, + { + "NVMeDriveIndex": 3, + "NVMeDriveBusID": 44, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_3_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_3_locate", + "NVMeDrivePresentPin": 496, + "NVMeDrivePwrGoodPin": 464 + }, + { + "NVMeDriveIndex": 4, + "NVMeDriveBusID": 39, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_4_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_4_locate", + "NVMeDrivePresentPin": 503, + "NVMeDrivePwrGoodPin": 471 + }, + { + "NVMeDriveIndex": 5, + "NVMeDriveBusID": 38, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_5_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_5_locate", + "NVMeDrivePresentPin": 502, + "NVMeDrivePwrGoodPin": 470 + }, + { + "NVMeDriveIndex": 6, + "NVMeDriveBusID": 37, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_6_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_6_locate", + "NVMeDrivePresentPin": 501, + "NVMeDrivePwrGoodPin": 469 + }, + { + "NVMeDriveIndex": 7, + "NVMeDriveBusID": 36, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_7_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_7_locate", + "NVMeDrivePresentPin": 500, + "NVMeDrivePwrGoodPin": 468 + }, + { + "NVMeDriveIndex": 8, + "NVMeDriveBusID": 31, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_8_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_8_locate", + "NVMeDrivePresentPin": 507, + "NVMeDrivePwrGoodPin": 475 + }, + { + "NVMeDriveIndex": 9, + "NVMeDriveBusID": 30, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_9_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_9_locate", + "NVMeDrivePresentPin": 506, + "NVMeDrivePwrGoodPin": 474 + }, + { + "NVMeDriveIndex": 10, + "NVMeDriveBusID": 29, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_10_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_10_locate", + "NVMeDrivePresentPin": 505, + "NVMeDrivePwrGoodPin": 473 + }, + { + "NVMeDriveIndex": 11, + "NVMeDriveBusID": 28, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_11_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_11_locate", + "NVMeDrivePresentPin": 504, + "NVMeDrivePwrGoodPin": 472 + }, + { + "NVMeDriveIndex": 12, + "NVMeDriveBusID": 27, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_12_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_12_locate", + "NVMeDrivePresentPin": 511, + "NVMeDrivePwrGoodPin": 479 + }, + { + "NVMeDriveIndex": 13, + "NVMeDriveBusID": 26, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_13_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_13_locate", + "NVMeDrivePresentPin": 510, + "NVMeDrivePwrGoodPin": 478 + }, + { + "NVMeDriveIndex": 14, + "NVMeDriveBusID": 25, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_14_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_14_locate", + "NVMeDrivePresentPin": 509, + "NVMeDrivePwrGoodPin": 477 + }, + { + "NVMeDriveIndex": 15, + "NVMeDriveBusID": 24, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_15_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_15_locate", + "NVMeDrivePresentPin": 508, + "NVMeDrivePwrGoodPin": 476 + } + ], + "threshold": [ + { + "criticalHigh": 77, + "criticalLow": 0, + "warningHigh": 77, + "warningLow": 0, + "maxValue": 127, + "minValue": -128 + } + ] +}
\ No newline at end of file diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh new file mode 100644 index 000000000..91dcb5cb3 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh @@ -0,0 +1,214 @@ +#!/bin/bash + +TARGET_FILE_NAME="/etc/nvme/nvme_config.json" + +export_gpio() { + if [ ! -d "/sys/class/gpio/gpio$1" ]; then + echo $1 >/sys/class/gpio/export + fi +} + +# Get NVMeDrivePresentPins +# 1-0024 + +# Get NVMeDrivePwrGoodPins +# 1-0021 + +if [ -d "/sys/bus/i2c/drivers/pca953x/1-0024" ]; then + presentPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0024/gpio/gpiochip*/base)" + for i in {0..15}; + do + let presentPinBase[$i]=presentPinBase+$i + export_gpio ${presentPinBase[$i]} + done +else + echo "Can't find present gpio expander (addr: 0x24) !!" +fi + +if [ -d "/sys/bus/i2c/drivers/pca953x/1-0021" ]; then + PwrGoodPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0021/gpio/gpiochip*/base)" + for i in {0..15}; + do + let PwrGoodPinBase[$i]=PwrGoodPinBase+$i + export_gpio ${PwrGoodPinBase[$i]} + done +else + echo "Can't find powergood gpio expander (addr: 0x21) !!" +fi + +cat > $TARGET_FILE_NAME << EOF1 +{ + "config": [ + { + "NVMeDriveIndex": 0, + "NVMeDriveBusID": 47, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_0_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_0_locate", + "NVMeDrivePresentPin": ${presentPinBase[3]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[3]} + }, + { + "NVMeDriveIndex": 1, + "NVMeDriveBusID": 46, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_1_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_1_locate", + "NVMeDrivePresentPin": ${presentPinBase[2]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[2]} + }, + { + "NVMeDriveIndex": 2, + "NVMeDriveBusID": 45, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_2_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_2_locate", + "NVMeDrivePresentPin": ${presentPinBase[1]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[1]} + }, + { + "NVMeDriveIndex": 3, + "NVMeDriveBusID": 44, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_3_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_3_locate", + "NVMeDrivePresentPin": ${presentPinBase[0]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[0]} + }, + { + "NVMeDriveIndex": 4, + "NVMeDriveBusID": 39, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_4_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_4_locate", + "NVMeDrivePresentPin": ${presentPinBase[7]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[7]} + }, + { + "NVMeDriveIndex": 5, + "NVMeDriveBusID": 38, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_5_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_5_locate", + "NVMeDrivePresentPin": ${presentPinBase[6]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[6]} + }, + { + "NVMeDriveIndex": 6, + "NVMeDriveBusID": 37, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_6_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_6_locate", + "NVMeDrivePresentPin": ${presentPinBase[5]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[5]} + }, + { + "NVMeDriveIndex": 7, + "NVMeDriveBusID": 36, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_7_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_7_locate", + "NVMeDrivePresentPin": ${presentPinBase[4]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[4]} + }, + { + "NVMeDriveIndex": 8, + "NVMeDriveBusID": 31, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_8_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_8_locate", + "NVMeDrivePresentPin": ${presentPinBase[11]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[11]} + }, + { + "NVMeDriveIndex": 9, + "NVMeDriveBusID": 30, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_9_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_9_locate", + "NVMeDrivePresentPin": ${presentPinBase[10]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[10]} + }, + { + "NVMeDriveIndex": 10, + "NVMeDriveBusID": 29, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_10_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_10_locate", + "NVMeDrivePresentPin": ${presentPinBase[9]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[9]} + }, + { + "NVMeDriveIndex": 11, + "NVMeDriveBusID": 28, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_11_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_11_locate", + "NVMeDrivePresentPin": ${presentPinBase[8]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[8]} + }, + { + "NVMeDriveIndex": 12, + "NVMeDriveBusID": 27, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_12_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_12_locate", + "NVMeDrivePresentPin": ${presentPinBase[15]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[15]} + }, + { + "NVMeDriveIndex": 13, + "NVMeDriveBusID": 26, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_13_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_13_locate", + "NVMeDrivePresentPin": ${presentPinBase[14]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[14]} + }, + { + "NVMeDriveIndex": 14, + "NVMeDriveBusID": 25, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_14_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_14_locate", + "NVMeDrivePresentPin": ${presentPinBase[13]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[13]} + }, + { + "NVMeDriveIndex": 15, + "NVMeDriveBusID": 24, + "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_fault", + "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_locate", + "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_15_locate", + "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_15_locate", + "NVMeDrivePresentPin": ${presentPinBase[12]}, + "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[12]} + } + ], + "threshold": [ + { + "criticalHigh": 77, + "criticalLow": 0, + "warningHigh": 77, + "warningLow": 0, + "maxValue": 127, + "minValue": -128 + } + ] +} +EOF1 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/xyz.openbmc_project.nvme.manager.service.replace b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/xyz.openbmc_project.nvme.manager.service.replace new file mode 100644 index 000000000..1238b4df3 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/xyz.openbmc_project.nvme.manager.service.replace @@ -0,0 +1,19 @@ +[Unit] +Description=NVMe management +Wants=xyz.openbmc_project.LED.GroupManager.service xyz.openbmc_project.Inventory.Manager.service +After=xyz.openbmc_project.LED.GroupManager.service xyz.openbmc_project.Inventory.Manager.service +Wants=mapper-wait@-xyz-openbmc_project-control-nvme.service +After=mapper-wait@-xyz-openbmc_project-control-nvme.service + +[Service] +ExecStartPre=/usr/bin/nvme_json_rewrite.sh +ExecStart=/usr/bin/nvme_main +Type=dbus +BusName=xyz.openbmc_project.nvme.manager +SyslogIdentifier=phosphor-nvme +Restart=always +RestartSec=3 +StartLimitInterval=0 + +[Install] +WantedBy=multi-user.target
\ No newline at end of file diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme_%.bbappend new file mode 100644 index 000000000..c3db11dad --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme_%.bbappend @@ -0,0 +1,17 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://nvme_config.json" +SRC_URI_append_gbs = " file://nvme_json_rewrite.sh" +SRC_URI_append_gbs = " file://xyz.openbmc_project.nvme.manager.service.replace" + +RDEPENDS_${PN} += "bash" + +do_install_append_gbs() { + install -d ${D}/${sysconfdir}/nvme/ + install -m 0644 ${WORKDIR}/nvme_config.json ${D}/${sysconfdir}/nvme/ + + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/nvme_json_rewrite.sh ${D}${bindir}/ + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/xyz.openbmc_project.nvme.manager.service.replace ${D}${systemd_system_unitdir}/xyz.openbmc_project.nvme.manager.service +} diff --git a/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager/restrictionmode-default-whitelist.override.yml b/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager/restrictionmode-default-whitelist.override.yml new file mode 100644 index 000000000..b0de5dd1a --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager/restrictionmode-default-whitelist.override.yml @@ -0,0 +1,6 @@ +--- +/xyz/openbmc_project/control/host0/restriction_mode: + - Interface: xyz.openbmc_project.Control.Security.RestrictionMode + Properties: + RestrictionMode: + Default: RestrictionMode::Modes::Whitelist diff --git a/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager/time-default.override.yml b/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager/time-default.override.yml new file mode 100644 index 000000000..0096eeb5c --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager/time-default.override.yml @@ -0,0 +1,6 @@ +--- +/xyz/openbmc_project/time/sync_method: + - Interface: xyz.openbmc_project.Time.Synchronization + Properties: + TimeSyncMethod: + Default: Synchronization::Method::Manual diff --git a/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager_%.bbappend new file mode 100644 index 000000000..7e2056844 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/settings/phosphor-settings-manager_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS_append_gbs := ":${THISDIR}/${PN}" +SRC_URI_append_gbs = " file://time-default.override.yml" +SRC_URI_append_gbs = " file://restrictionmode-default-whitelist.override.yml" diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch new file mode 100644 index 000000000..22670d3fc --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch @@ -0,0 +1,313 @@ +From ac0c216ac2c273c620579fd1308c8c225e0cca36 Mon Sep 17 00:00:00 2001 +From: James Feist <james.feist@linux.intel.com> +Date: Mon, 17 Jun 2019 12:00:58 -0700 +Subject: [PATCH] Customize phosphor-watchdog for Intel platforms + +This patch adds various changes to phosphor-watchdog that are +required for compatibility with Intel platforms. + + 1. Add Redfish messages for watchdog timeout and pre-interrupt + 2. Use dbus properties for power control insted of service files + 3. Use host status to enable/disable watchdog + 4. Set preTimeoutInterruptOccurFlag + +Signed-off-by: James Feist <james.feist@linux.intel.com> +Signed-off-by: Ren Yu <yux.ren@intel.com> +Signed-off-by: Yong Li <yong.b.li@linux.intel.com> +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> +--- + watchdog.cpp | 193 ++++++++++++++++++++++++++++++++++++++++++++++++--- + watchdog.hpp | 23 +++++- + 2 files changed, 206 insertions(+), 10 deletions(-) + +diff --git a/watchdog.cpp b/watchdog.cpp +index 57e9050..3b5356f 100644 +--- a/watchdog.cpp ++++ b/watchdog.cpp +@@ -1,11 +1,14 @@ + #include "watchdog.hpp" + ++#include <systemd/sd-journal.h> ++ + #include <algorithm> + #include <chrono> + #include <phosphor-logging/elog.hpp> + #include <phosphor-logging/log.hpp> + #include <sdbusplus/exception.hpp> + #include <xyz/openbmc_project/Common/error.hpp> ++#include <xyz/openbmc_project/State/Host/server.hpp> + + namespace phosphor + { +@@ -18,10 +21,69 @@ using namespace phosphor::logging; + using sdbusplus::exception::SdBusError; + using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; + +-// systemd service to kick start a target. +-constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1"; +-constexpr auto SYSTEMD_ROOT = "/org/freedesktop/systemd1"; +-constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager"; ++const static constexpr char* currentHostState = "CurrentHostState"; ++const static constexpr char* hostStatusOff = ++ "xyz.openbmc_project.State.Host.HostState.Off"; ++ ++const static constexpr char* actionDescription = " due to Watchdog timeout"; ++const static constexpr char* hardResetDescription = "Hard Reset - System reset"; ++const static constexpr char* powerOffDescription = ++ "Power Down - System power down"; ++const static constexpr char* powerCycleDescription = ++ "Power Cycle - System power cycle"; ++const static constexpr char* timerExpiredDescription = "Timer expired"; ++ ++const static constexpr char* preInterruptActionNone = ++ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; ++ ++const static constexpr char* preInterruptDescriptionSMI = "SMI"; ++const static constexpr char* preInterruptDescriptionNMI = "NMI"; ++const static constexpr char* preInterruptDescriptionMI = "Messaging Interrupt"; ++ ++const static constexpr char* reservedDescription = "Reserved"; ++ ++const static constexpr char* timerUseDescriptionBIOSFRB2 = "BIOS FRB2"; ++const static constexpr char* timerUseDescriptionBIOSPOST = "BIOS/POST"; ++const static constexpr char* timerUseDescriptionOSLoad = "OSLoad"; ++const static constexpr char* timerUseDescriptionSMSOS = "SMS/OS"; ++const static constexpr char* timerUseDescriptionOEM = "OEM"; ++ ++namespace restart ++{ ++static constexpr const char* busName = ++ "xyz.openbmc_project.Control.Host.RestartCause"; ++static constexpr const char* path = ++ "/xyz/openbmc_project/control/host0/restart_cause"; ++static constexpr const char* interface = ++ "xyz.openbmc_project.Control.Host.RestartCause"; ++static constexpr const char* property = "RequestedRestartCause"; ++} // namespace restart ++ ++// chassis state manager service ++namespace chassis ++{ ++static constexpr const char* busName = "xyz.openbmc_project.State.Chassis"; ++static constexpr const char* path = "/xyz/openbmc_project/state/chassis0"; ++static constexpr const char* interface = "xyz.openbmc_project.State.Chassis"; ++static constexpr const char* request = "RequestedPowerTransition"; ++} // namespace chassis ++ ++void Watchdog::powerStateChangedHandler( ++ const std::map<std::string, std::variant<std::string>>& props) ++{ ++ const auto iter = props.find(currentHostState); ++ if (iter != props.end()) ++ { ++ const std::string* powerState = std::get_if<std::string>(&iter->second); ++ if (powerState && (*powerState == hostStatusOff)) ++ { ++ if (timerEnabled()) ++ { ++ enabled(false); ++ } ++ } ++ } ++} + + void Watchdog::resetTimeRemaining(bool enableWatchdog) + { +@@ -107,13 +169,102 @@ uint64_t Watchdog::interval(uint64_t value) + // Optional callback function on timer expiration + void Watchdog::timeOutHandler() + { ++ PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt(); ++ std::string preInterruptActionMessageArgs{}; ++ + Action action = expireAction(); ++ std::string actionMessageArgs{}; ++ ++ expiredTimerUse(currentTimerUse()); ++ ++ TimerUse timeUser = expiredTimerUse(); ++ std::string timeUserMessage{}; ++ + if (!this->enabled()) + { + action = fallback->action; + } + +- expiredTimerUse(currentTimerUse()); ++ switch (timeUser) ++ { ++ case Watchdog::TimerUse::BIOSFRB2: ++ timeUserMessage = timerUseDescriptionBIOSFRB2; ++ break; ++ case Watchdog::TimerUse::BIOSPOST: ++ timeUserMessage = timerUseDescriptionBIOSPOST; ++ break; ++ case Watchdog::TimerUse::OSLoad: ++ timeUserMessage = timerUseDescriptionOSLoad; ++ break; ++ case Watchdog::TimerUse::SMSOS: ++ timeUserMessage = timerUseDescriptionSMSOS; ++ break; ++ case Watchdog::TimerUse::OEM: ++ timeUserMessage = timerUseDescriptionOEM; ++ break; ++ default: ++ timeUserMessage = reservedDescription; ++ break; ++ } ++ ++ switch (action) ++ { ++ case Watchdog::Action::HardReset: ++ actionMessageArgs = std::string(hardResetDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::PowerOff: ++ actionMessageArgs = std::string(powerOffDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::PowerCycle: ++ actionMessageArgs = std::string(powerCycleDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::None: ++ actionMessageArgs = timerExpiredDescription; ++ break; ++ default: ++ actionMessageArgs = reservedDescription; ++ break; ++ } ++ ++ // Log into redfish event log ++ sd_journal_send("MESSAGE=IPMIWatchdog: Timed out ACTION=%s", ++ convertForMessage(action).c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.IPMIWatchdog", ++ "REDFISH_MESSAGE_ARGS=%s. timer use: %s", ++ actionMessageArgs.c_str(), timeUserMessage.c_str(), NULL); ++ ++ switch (preTimeoutInterruptAction) ++ { ++ case Watchdog::PreTimeoutInterruptAction::SMI: ++ preInterruptActionMessageArgs = preInterruptDescriptionSMI; ++ break; ++ case Watchdog::PreTimeoutInterruptAction::NMI: ++ preInterruptActionMessageArgs = preInterruptDescriptionNMI; ++ break; ++ case Watchdog::PreTimeoutInterruptAction::MI: ++ preInterruptActionMessageArgs = preInterruptDescriptionMI; ++ break; ++ default: ++ preInterruptActionMessageArgs = reservedDescription; ++ break; ++ } ++ ++ if (preInterruptActionNone != convertForMessage(preTimeoutInterruptAction)) ++ { ++ preTimeoutInterruptOccurFlag(true); ++ ++ sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s", ++ convertForMessage(preTimeoutInterruptAction).c_str(), ++ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.IPMIWatchdog", ++ "REDFISH_MESSAGE_ARGS=Timer interrupt - %s due to " ++ "Watchdog timeout. timer use: %s", ++ preInterruptActionMessageArgs.c_str(), ++ timeUserMessage.c_str(), NULL); ++ } + + auto target = actionTargetMap.find(action); + if (target == actionTargetMap.end()) +@@ -133,10 +284,11 @@ void Watchdog::timeOutHandler() + + try + { +- auto method = bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_ROOT, +- SYSTEMD_INTERFACE, "StartUnit"); +- method.append(target->second); +- method.append("replace"); ++ auto method = ++ bus.new_method_call(chassis::busName, chassis::path, ++ "org.freedesktop.DBus.Properties", "Set"); ++ method.append(chassis::interface, chassis::request, ++ std::variant<std::string>(target->second)); + + bus.call_noreply(method); + } +@@ -147,6 +299,29 @@ void Watchdog::timeOutHandler() + entry("ERROR=%s", e.what())); + commit<InternalFailure>(); + } ++ ++ // set restart cause for watchdog HardReset & PowerCycle actions ++ if ((action == Watchdog::Action::HardReset) || ++ (action == Watchdog::Action::PowerCycle)) ++ { ++ try ++ { ++ auto method = bus.new_method_call( ++ restart::busName, restart::path, ++ "org.freedesktop.DBus.Properties", "Set"); ++ method.append( ++ restart::interface, restart::property, ++ std::variant<std::string>("xyz.openbmc_project.State.Host." ++ "RestartCause.WatchdogTimer")); ++ bus.call(method); ++ } ++ catch (sdbusplus::exception_t& e) ++ { ++ log<level::ERR>("Failed to set HostRestartCause property", ++ entry("ERROR=%s", e.what())); ++ commit<InternalFailure>(); ++ } ++ } + } + + tryFallbackOrDisable(); +diff --git a/watchdog.hpp b/watchdog.hpp +index 7de9bb3..b004b7a 100644 +--- a/watchdog.hpp ++++ b/watchdog.hpp +@@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits + WatchdogInherits(bus, objPath), + bus(bus), actionTargetMap(std::move(actionTargetMap)), + fallback(std::move(fallback)), minInterval(minInterval), +- timer(event, std::bind(&Watchdog::timeOutHandler, this)) ++ timer(event, std::bind(&Watchdog::timeOutHandler, this)), ++ powerStateChangedSignal( ++ bus, ++ sdbusplus::bus::match::rules::propertiesChanged( ++ "/xyz/openbmc_project/state/host0", ++ "xyz.openbmc_project.State.Host"), ++ [this](sdbusplus::message::message& msg) { ++ std::string objectName; ++ std::map<std::string, std::variant<std::string>> props; ++ msg.read(objectName, props); ++ powerStateChangedHandler(props); ++ }) + { + // We set the watchdog interval with the default value. + interval(interval()); +@@ -77,6 +88,12 @@ class Watchdog : public WatchdogInherits + tryFallbackOrDisable(); + } + ++ /** @brief Disable watchdog when power status change meet ++ * the specific requirement ++ */ ++ void powerStateChangedHandler( ++ const std::map<std::string, std::variant<std::string>>& props); ++ + /** @brief Resets the TimeRemaining to the configured Interval + * Optionally enables the watchdog. + * +@@ -165,6 +182,10 @@ class Watchdog : public WatchdogInherits + /** @brief Contained timer object */ + sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer; + ++ /** @brief Optional Callback handler when power status change meet ++ * the specific requirement */ ++ sdbusplus::bus::match_t powerStateChangedSignal; ++ + /** @brief Optional Callback handler on timer expirartion */ + void timeOutHandler(); + diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service new file mode 100644 index 000000000..5ef1a4179 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog/phosphor-watchdog.service @@ -0,0 +1,16 @@ +[Unit] +Description=Phosphor Watchdog + +[Service] +ExecStart=/usr/bin/env phosphor-watchdog --continue --service=xyz.openbmc_project.Watchdog \ + --path=/xyz/openbmc_project/watchdog/host0 \ + --action_target=xyz.openbmc_project.State.Watchdog.Action.HardReset=xyz.openbmc_project.State.Chassis.Transition.Reset \ + --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerOff=xyz.openbmc_project.State.Chassis.Transition.Off \ + --action_target=xyz.openbmc_project.State.Watchdog.Action.PowerCycle=xyz.openbmc_project.State.Chassis.Transition.PowerCycle + +SyslogIdentifier=phosphor-watchdog +BusName =xyz.openbmc_project.Watchdog +Type=dbus + +[Install] +WantedBy=basic.target diff --git a/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend new file mode 100644 index 000000000..9c491ecfc --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" + +SRC_URI_append_gbs = " file://0001-Customize-phosphor-watchdog-for-Intel-platforms.patch" + +# Remove the override to keep service running after DC cycle +SYSTEMD_OVERRIDE_${PN}_remove_gbs = "poweron.conf:phosphor-watchdog@poweron.service.d/poweron.conf" +SYSTEMD_SERVICE_${PN}_gbs = "phosphor-watchdog.service" diff --git a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/config-margin.json b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/config-margin.json new file mode 100644 index 000000000..5ff103dc6 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/config-margin.json @@ -0,0 +1,395 @@ +{ + "sensors" : [ + { + "name": "cputemp", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/cputemp", + "parameters": { + "type": "", + "maxTemp": 95000, + "path": "", + "sysLabel": "", + "targetTemp": -1, + "targetTempOffset": -13000, + "scalar": 1.0 + } + }, + { + "name": "nvme0", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme0", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme1", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme1", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme2", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme2", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme3", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme3", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme4", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme4", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme5", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme5", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme6", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme6", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme7", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme7", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme8", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme8", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme9", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme9", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme10", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme10", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme11", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme11", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme12", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme12", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme13", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme13", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme14", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme14", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "nvme15", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/nvme15", + "parameters": { + "type": "", + "maxTemp": 77000, + "path": "", + "sysLabel": "", + "targetTemp": 67000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "vddcr_cpu", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/vddcr_cpu", + "parameters": { + "type": "", + "maxTemp": 100000, + "path": "", + "sysLabel": "", + "targetTemp": 90000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "vddcr_soc", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/vddcr_soc", + "parameters": { + "type": "", + "maxTemp": 100000, + "path": "", + "sysLabel": "", + "targetTemp": 90000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "vddio_abcd", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/vddio_abcd", + "parameters": { + "type": "", + "maxTemp": 100000, + "path": "", + "sysLabel": "", + "targetTemp": 90000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "vddio_efgh", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/vddio_efgh", + "parameters": { + "type": "", + "maxTemp": 100000, + "path": "", + "sysLabel": "", + "targetTemp": 90000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "p12v_mobo", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/p12v_mobo", + "parameters": { + "type": "", + "maxTemp": 114000, + "path": "", + "sysLabel": "", + "targetTemp": 90000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "powerseq_temp", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/powerseq_temp", + "parameters": { + "type": "", + "maxTemp": 99000, + "path": "", + "sysLabel": "", + "targetTemp": 90000, + "targetTempOffset": 0, + "scalar": 1.0 + } + }, + { + "name": "p12v_fan", + "unit": "millidegree", + "type": "dbus", + "path": "/xyz/openbmc_project/sensors/temperature/p12v_fan", + "parameters": { + "type": "", + "maxTemp": 114000, + "path": "", + "sysLabel": "", + "targetTemp": 90000, + "targetTempOffset": 0, + "scalar": 1.0 + } + } + ], + "skus" : [ + { + "num": 1, + "zones": [ + { + "id": 0, + "zoneSetpoint": 10000, + "target": "/xyz/openbmc_project/extsensors/margin/cputemp", + "components": ["cputemp"] + }, + { + "id": 1, + "zoneSetpoint": 10000, + "target": "/xyz/openbmc_project/extsensors/margin/zone0_vr", + "components": ["vddcr_cpu", "vddcr_soc", "vddio_abcd", "vddio_efgh", "p12v_mobo", "powerseq_temp"] + }, + { + "id": 2, + "zoneSetpoint": 10000, + "target": "/xyz/openbmc_project/extsensors/margin/nvme", + "components": ["nvme0", "nvme1", "nvme2", "nvme3", "nvme4", "nvme5", "nvme6", "nvme7", "nvme8", "nvme9", "nvme10", "nvme11", "nvme12", "nvme13", "nvme14", "nvme15"] + }, + { + "id": 3, + "zoneSetpoint": 10000, + "target": "/xyz/openbmc_project/extsensors/margin/p12v_fan", + "components": ["p12v_fan"] + } + ] + } + ] +} diff --git a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh new file mode 100644 index 000000000..2e44479f6 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +MARGIN_TABLE_FILE="/usr/share/read-margin-temp/config-margin.json" + +target_num="$(cat $MARGIN_TABLE_FILE | grep '"target"' | wc -l)" + +cpu_hwmon="$(ls -la /sys/class/hwmon | grep f0082000 | head -n 1 | tail -n +1 | cut -d '/' -f 11)" + +# replace by the real cpu temperature hwmon path in runtime +if [[ "$cpu_hwmon" != "" ]] +then + sed -i "s/cpu_hwmon/$cpu_hwmon/g" $MARGIN_TABLE_FILE +fi + +# wait target dbus +for ((i=0; i<$target_num; i++)) +do + line_num=$((i+1)) + path="$(cat $MARGIN_TABLE_FILE | grep '"target"' | head -n ${line_num} | tail -n +${line_num} | cut -d '"' -f 4)" + mapper wait $path +done + +# start read margin temp +/usr/bin/read-margin-temp & + +exit 0 diff --git a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp_%.bbappend b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp_%.bbappend new file mode 100644 index 000000000..b3fc4d221 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp_%.bbappend @@ -0,0 +1,16 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://config-margin.json \ + file://read-margin-temp-wait.sh \ + " + +FILES_${PN}_append_gbs = " ${bindir}/read-margin-temp-wait.sh" +FILES_${PN}_append_gbs = " ${datadir}/read-margin-temp/config-margin.json" + +do_install_append_gbs() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/read-margin-temp-wait.sh ${D}${bindir} + + install -d ${D}${datadir}/read-margin-temp + install -m 0644 -D ${WORKDIR}/config-margin.json \ + ${D}${datadir}/read-margin-temp/config-margin.json +} diff --git a/meta-quanta/meta-gbs/recipes-quanta/network/mac-address/config.txt b/meta-quanta/meta-gbs/recipes-quanta/network/mac-address/config.txt new file mode 100644 index 000000000..06818fc0b --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-quanta/network/mac-address/config.txt @@ -0,0 +1,8 @@ +fruBusNum=5 +fruAddr=0x50 +numberMac=4 +mac1=eth1 +mac2=usb0_dev +mac3=usb0_host +mac4=eth0 +USBLAA=true diff --git a/meta-quanta/meta-gbs/recipes-quanta/network/mac-address_%.bbappend b/meta-quanta/meta-gbs/recipes-quanta/network/mac-address_%.bbappend new file mode 100644 index 000000000..d975fe28b --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-quanta/network/mac-address_%.bbappend @@ -0,0 +1,10 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://config.txt" + +FILES_${PN}_append_gbs = " ${datadir}/mac-address/config.txt" + +do_install_append_gbs() { + install -d ${D}${datadir}/mac-address + install -m 0644 -D ${WORKDIR}/config.txt \ + ${D}${datadir}/mac-address/config.txt +} diff --git a/meta-quanta/meta-gbs/recipes-quanta/network/usb-network.bbappend b/meta-quanta/meta-gbs/recipes-quanta/network/usb-network.bbappend new file mode 100644 index 000000000..b6439a158 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-quanta/network/usb-network.bbappend @@ -0,0 +1,16 @@ +FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" +SRC_URI_append_gbs = " file://00-bmc-usb0.network" +SRC_URI_append_gbs = " file://usb-network.conf" + +FILES_${PN}_append_gbs = " ${datadir}/usb-network/usb-network.conf" +FILES_${PN}_append_gbs = " ${sysconfdir_native}/systemd/network/00-bmc-usb0.network" + +do_install_append_gbs() { + install -d ${D}${sysconfdir_native}/systemd/network/ + install -m 0644 ${WORKDIR}/00-bmc-usb0.network \ + ${D}${sysconfdir_native}/systemd/network + + install -d ${D}${datadir}/usb-network + install -m 0644 -D ${WORKDIR}/usb-network.conf \ + ${D}${datadir}/usb-network +} diff --git a/meta-quanta/meta-gbs/recipes-quanta/network/usb-network/00-bmc-usb0.network b/meta-quanta/meta-gbs/recipes-quanta/network/usb-network/00-bmc-usb0.network new file mode 100644 index 000000000..4e5120c34 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-quanta/network/usb-network/00-bmc-usb0.network @@ -0,0 +1,5 @@ +[Match] +Name=usb0 +[Network] +LinkLocalAddressing=yes +IPv6AcceptRA=no diff --git a/meta-quanta/meta-gbs/recipes-quanta/network/usb-network/usb-network.conf b/meta-quanta/meta-gbs/recipes-quanta/network/usb-network/usb-network.conf new file mode 100644 index 000000000..c1057606a --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-quanta/network/usb-network/usb-network.conf @@ -0,0 +1 @@ +UDC="f0835000.udc" diff --git a/meta-quanta/meta-gbs/recipes-x86/chassis/x86-power-control_%.bbappend b/meta-quanta/meta-gbs/recipes-x86/chassis/x86-power-control_%.bbappend new file mode 100644 index 000000000..804fcb022 --- /dev/null +++ b/meta-quanta/meta-gbs/recipes-x86/chassis/x86-power-control_%.bbappend @@ -0,0 +1,4 @@ +SRC_URI_gbs = "git://github.com/quanta-bmc/x86-power-control.git" +SRCREV_gbs = "70389494989e438af6b8b1d3b4db602a68f2f9da" + +SYSTEMD_SERVICE_${PN}_gbs = "xyz.openbmc_project.Chassis.Control.Power.service" |