diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2019-10-23 00:01:54 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2019-10-23 00:48:48 +0300 |
commit | 456380bb272d3a301c887eee513a3937cc1f48e1 (patch) | |
tree | 124399167d539582befbe35ad28377eaea6cc8bc /meta-openbmc-mods/meta-common | |
parent | 9722c6ee87766a45a337c094d1293de81cdcb106 (diff) | |
download | openbmc-456380bb272d3a301c887eee513a3937cc1f48e1.tar.xz |
Update to internal 10-22-19
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common')
168 files changed, 5782 insertions, 3067 deletions
diff --git a/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass b/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass index 9962e7df6..2e36e4d5c 100644 --- a/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass +++ b/meta-openbmc-mods/meta-common/classes/image_types_intel_pfr.bbclass @@ -1,113 +1,121 @@ -
-
-inherit obmc-phosphor-full-fitimage
-DEPENDS += "obmc-intel-pfr-image-native"
-
-require recipes-core/os-release/version-vars.inc
-
-IMAGE_TYPES += "intel-pfr"
-
-IMAGE_TYPEDEP_intel-pfr = "mtd-auto"
-IMAGE_TYPES_MASKED += "intel-pfr"
-
-# PFR macros
-# directory where PFR scripts and key are copied
-PFR_STAGING_DIR = "${STAGING_DIR}/intel-pfr-files"
-# PFR images directory
-PFR_IMAGES_DIR = "${DEPLOY_DIR_IMAGE}/pfr_images"
-
-# Refer flash map in manifest.json for the addresses offset
-PFM_OFFSET = "0x80000"
-
-# 0x80000/1024 = 0x200 or 512, 1K Page size.
-PFM_OFFSET_PAGE = "512"
-
-# RC_IMAGE
-RC_IMAGE_OFFSET = "0x02a00000"
-
-# RC_IMAGE_PAGE= 0x02a00000/1024 = 0xA800 or 43008
-RC_IMAGE_PAGE = "43008"
-
-do_image_pfr () {
- bbplain "Generating Intel PFR compliant BMC image"
-
- bbplain "Build Version = ${build_version}"
- bbplain "Build Number = ${build_number}"
- bbplain "Build Hash = ${build_hash}"
-
- mkdir -p "${PFR_IMAGES_DIR}"
- cd "${PFR_IMAGES_DIR}"
-
- # python script that does the creating PFM, BMC compressed and unsigned images from BMC 128MB raw binary file.
- python ${PFR_STAGING_DIR}/pfr_image.py ${PFR_STAGING_DIR}/pfr_manifest.json ${DEPLOY_DIR_IMAGE}/image-mtd ${build_version} ${build_number} ${build_hash}
-
- # sign the PFM region
- ${PFR_STAGING_DIR}/blocksign -c ${PFR_STAGING_DIR}/pfm_config.xml -o ${PFR_IMAGES_DIR}/pfm_signed.bin ${PFR_IMAGES_DIR}/pfm.bin
-
- # Add the signed PFM to rom image
- dd bs=1k conv=notrunc seek=${PFM_OFFSET_PAGE} if=${PFR_IMAGES_DIR}/pfm_signed.bin of=${PFR_IMAGES_DIR}/image-mtd-pfr
-
- # Create unsigned BMC update capsule - append with 1. pfm_signed, 2. pbc, 3. bmc compressed
- dd if=${PFR_IMAGES_DIR}/pfm_signed.bin bs=1k >> ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin
-
- dd if=${PFR_IMAGES_DIR}/pbc.bin bs=1k >> ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin
-
- dd if=${PFR_IMAGES_DIR}/bmc_compressed.bin bs=1k >> ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin
-
- # Sign the BMC update capsule
- ${PFR_STAGING_DIR}/blocksign -c ${PFR_STAGING_DIR}/bmc_config.xml -o ${PFR_IMAGES_DIR}/bmc_signed_cap.bin ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin
-
- # Add the signed bmc update capsule to full rom image @ 0x2a00000
- dd bs=1k conv=notrunc seek=${RC_IMAGE_PAGE} if=${PFR_IMAGES_DIR}/bmc_signed_cap.bin of=${PFR_IMAGES_DIR}/image-mtd-pfr
-
- # Append date and time to all the PFR images
- mv ${PFR_IMAGES_DIR}/pfm_signed.bin ${PFR_IMAGES_DIR}/pfm_signed-${DATETIME}.bin
- mv ${PFR_IMAGES_DIR}/pfm.bin ${PFR_IMAGES_DIR}/pfm-${DATETIME}.bin
- mv ${PFR_IMAGES_DIR}/pbc.bin ${PFR_IMAGES_DIR}/pbc-${DATETIME}.bin
- mv ${PFR_IMAGES_DIR}/bmc_compressed.bin ${PFR_IMAGES_DIR}/bmc_compressed-${DATETIME}.bin
- mv ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin ${PFR_IMAGES_DIR}/bmc_unsigned-cap_${DATETIME}.bin
- mv ${PFR_IMAGES_DIR}/bmc_signed_cap.bin ${PFR_IMAGES_DIR}/bmc_signed_cap-${DATETIME}.bin
- mv ${PFR_IMAGES_DIR}/image-mtd-pfr ${PFR_IMAGES_DIR}/image-mtd-pfr-${DATETIME}
-}
-
-do_image_pfr[vardepsexclude] += "DATETIME"
-do_image_pfr[vardeps] += "IPMI_MAJOR IPMI_MINOR IPMI_AUX13 IPMI_AUX14 IPMI_AUX15 IPMI_AUX16"
-
-python() {
- types = d.getVar('IMAGE_FSTYPES', True).split()
-
- if 'intel-pfr' in types:
-
- bld_ver1 = d.getVar('IPMI_MAJOR', True)
- bld_ver1 = int(bld_ver1) << 8
-
- bld_ver2 = d.getVar('IPMI_MINOR', True)
- bld_ver2 = int(bld_ver2)
-
- bld_ver = bld_ver1 | bld_ver2
- d.setVar('build_version', str(bld_ver))
-
- bld_num = d.getVar('IPMI_AUX13', True)
-
- d.setVar('build_number', bld_num)
-
- bld_hash1 = d.getVar('IPMI_AUX14', True)
- bld_hash2 = d.getVar('IPMI_AUX15', True)
- bld_hash3 = d.getVar('IPMI_AUX16', True)
-
- bld_hash1 = int(bld_hash1, 16)
- bld_hash2 = int(bld_hash2, 16)
- bld_hash3 = int(bld_hash3, 16)
-
- bld_hash = bld_hash3 << 16
- bld_hash |= bld_hash2 << 8
- bld_hash |= bld_hash1
-
- d.setVar('build_hash', str(bld_hash))
-
- bb.build.addtask(# task, depends_on_task, task_depends_on, d )
- 'do_image_pfr',
- 'do_build',
- 'do_generate_auto', d)
-}
-
+ + +inherit obmc-phosphor-full-fitimage +inherit image_types_phosphor_auto +DEPENDS += "obmc-intel-pfr-image-native python3-native intel-blocksign-native" + +require recipes-core/os-release/version-vars.inc + +IMAGE_TYPES += "intel-pfr" + +IMAGE_TYPEDEP_intel-pfr = "mtd-auto" +IMAGE_TYPES_MASKED += "intel-pfr" + +# PFR images directory +PFR_IMAGES_DIR = "${DEPLOY_DIR_IMAGE}/pfr_images" + +# PFR image generation script directory +PFR_SCRIPT_DIR = "${STAGING_DIR_NATIVE}${bindir}" + +# PFR image config directory +PFR_CFG_DIR = "${STAGING_DIR_NATIVE}${datadir}/pfrconfig" + +# Refer flash map in manifest.json for the addresses offset +PFM_OFFSET = "0x80000" + +# 0x80000/1024 = 0x200 or 512, 1K Page size. +PFM_OFFSET_PAGE = "512" + +# RC_IMAGE +RC_IMAGE_OFFSET = "0x02a00000" + +# RC_IMAGE_PAGE= 0x02a00000/1024 = 0xA800 or 43008 +RC_IMAGE_PAGE = "43008" + +do_image_pfr () { + bbplain "Generating Intel PFR compliant BMC image" + + bbplain "Build Version = ${build_version}" + bbplain "Build Number = ${build_number}" + bbplain "Build Hash = ${build_hash}" + + mkdir -p "${PFR_IMAGES_DIR}" + cd "${PFR_IMAGES_DIR}" + + # python script that does the creating PFM, BMC compressed and unsigned images from BMC 128MB raw binary file. + ${PFR_SCRIPT_DIR}/pfr_image.py ${PFR_CFG_DIR}/pfr_manifest.json ${DEPLOY_DIR_IMAGE}/image-mtd ${build_version} ${build_number} ${build_hash} + + # sign the PFM region + ${PFR_SCRIPT_DIR}/blocksign -c ${PFR_CFG_DIR}/pfm_config.xml -o ${PFR_IMAGES_DIR}/pfm_signed.bin ${PFR_IMAGES_DIR}/pfm.bin + + # Add the signed PFM to rom image + dd bs=1k conv=notrunc seek=${PFM_OFFSET_PAGE} if=${PFR_IMAGES_DIR}/pfm_signed.bin of=${PFR_IMAGES_DIR}/image-mtd-pfr + + # Create unsigned BMC update capsule - append with 1. pfm_signed, 2. pbc, 3. bmc compressed + dd if=${PFR_IMAGES_DIR}/pfm_signed.bin bs=1k >> ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin + + dd if=${PFR_IMAGES_DIR}/pbc.bin bs=1k >> ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin + + dd if=${PFR_IMAGES_DIR}/bmc_compressed.bin bs=1k >> ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin + + # Sign the BMC update capsule + ${PFR_SCRIPT_DIR}/blocksign -c ${PFR_CFG_DIR}/bmc_config.xml -o ${PFR_IMAGES_DIR}/bmc_signed_cap.bin ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin + + # Add the signed bmc update capsule to full rom image @ 0x2a00000 + dd bs=1k conv=notrunc seek=${RC_IMAGE_PAGE} if=${PFR_IMAGES_DIR}/bmc_signed_cap.bin of=${PFR_IMAGES_DIR}/image-mtd-pfr + + # Append date and time to all the PFR images + mv ${PFR_IMAGES_DIR}/pfm_signed.bin ${PFR_IMAGES_DIR}/pfm_signed-${DATETIME}.bin + mv ${PFR_IMAGES_DIR}/pfm.bin ${PFR_IMAGES_DIR}/pfm-${DATETIME}.bin + mv ${PFR_IMAGES_DIR}/pbc.bin ${PFR_IMAGES_DIR}/pbc-${DATETIME}.bin + mv ${PFR_IMAGES_DIR}/bmc_compressed.bin ${PFR_IMAGES_DIR}/bmc_compressed-${DATETIME}.bin + mv ${PFR_IMAGES_DIR}/bmc_unsigned_cap.bin ${PFR_IMAGES_DIR}/bmc_unsigned_cap-${DATETIME}.bin + mv ${PFR_IMAGES_DIR}/bmc_signed_cap.bin ${PFR_IMAGES_DIR}/bmc_signed_cap-${DATETIME}.bin + mv ${PFR_IMAGES_DIR}/image-mtd-pfr ${PFR_IMAGES_DIR}/image-mtd-pfr-${DATETIME}.bin +} + +do_image_pfr[vardepsexclude] += "DATETIME" +do_image_pfr[vardeps] += "IPMI_MAJOR IPMI_MINOR IPMI_AUX13 IPMI_AUX14 IPMI_AUX15 IPMI_AUX16" +do_image_pfr[depends] += " \ + obmc-intel-pfr-image-native:do_populate_sysroot \ + intel-blocksign-native:do_populate_sysroot \ + " + +python() { + types = d.getVar('IMAGE_FSTYPES', True).split() + + if 'intel-pfr' in types: + + bld_ver1 = d.getVar('IPMI_MAJOR', True) + bld_ver1 = int(bld_ver1) << 8 + + bld_ver2 = d.getVar('IPMI_MINOR', True) + bld_ver2 = int(bld_ver2) + + bld_ver = bld_ver1 | bld_ver2 + d.setVar('build_version', str(bld_ver)) + + bld_num = d.getVar('IPMI_AUX13', True) + + d.setVar('build_number', bld_num) + + bld_hash1 = d.getVar('IPMI_AUX14', True) + bld_hash2 = d.getVar('IPMI_AUX15', True) + bld_hash3 = d.getVar('IPMI_AUX16', True) + + bld_hash1 = int(bld_hash1, 16) + bld_hash2 = int(bld_hash2, 16) + bld_hash3 = int(bld_hash3, 16) + + bld_hash = bld_hash3 << 16 + bld_hash |= bld_hash2 << 8 + bld_hash |= bld_hash1 + + d.setVar('build_hash', str(bld_hash)) + + bb.build.addtask(# task, depends_on_task, task_depends_on, d ) + 'do_image_pfr', + 'do_build', + 'do_generate_auto', d) +} + diff --git a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass index 6a3ad73d7..613a076c6 100644 --- a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass +++ b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass @@ -5,7 +5,6 @@ IMAGE_INSTALL_append = " \ bmcweb \ dbus-broker \ dtc \ - dtoverlay \ entity-manager \ ipmitool \ intel-ipmi-oem \ @@ -16,9 +15,9 @@ IMAGE_INSTALL_append = " \ rest-dbus-static \ phosphor-pid-control \ phosphor-host-postd \ - smbios-mdrv1 \ phosphor-certificate-manager \ phosphor-sel-logger \ + smbios-mdrv1 \ smbios-mdrv2 \ obmc-ikvm \ system-watchdog \ @@ -34,9 +33,14 @@ IMAGE_INSTALL_append = " \ phosphor-u-boot-mgr \ prov-mode-mgr \ ac-boot-check \ + host-error-monitor \ beepcode-mgr \ + psu-manager \ + kernel-panic-check \ " +IMAGE_INSTALL_append = "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'intel-pfr-manager', '', d)}" + # this package was flagged as a security risk IMAGE_INSTALL_remove += " lrzsz" diff --git a/meta-openbmc-mods/meta-common/classes/systemd-watchdog.bbclass b/meta-openbmc-mods/meta-common/classes/systemd-watchdog.bbclass index 4cc3845c6..20b77d1be 100644 --- a/meta-openbmc-mods/meta-common/classes/systemd-watchdog.bbclass +++ b/meta-openbmc-mods/meta-common/classes/systemd-watchdog.bbclass @@ -4,7 +4,11 @@ add_watchdog_confs() { count=5 # allowed reboots for service in $(ls $D/lib/systemd/system | grep -o ".*service"); do - if [[ $service == *"mapper-wait"* ]]; then + if [[ "$service" == *"mapper-wait"* ]]; then + continue + fi + + if [ "$service" = "system-watchdog.service" ]; then continue fi diff --git a/meta-openbmc-mods/meta-common/conf/layer.conf b/meta-openbmc-mods/meta-common/conf/layer.conf index 03226a8ed..4c640e868 100644 --- a/meta-openbmc-mods/meta-common/conf/layer.conf +++ b/meta-openbmc-mods/meta-common/conf/layer.conf @@ -8,4 +8,4 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ BBFILE_COLLECTIONS += "common" BBFILE_PATTERN_common = "^${LAYERDIR}/" BBFILE_PRIORITY_common = "10" -LAYERSERIES_COMPAT_common = "warrior" +LAYERSERIES_COMPAT_common = "warrior zeus" diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0012-Add-status-and-ID-LED-support.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0012-Add-status-and-ID-LED-support.patch index 16eb31250..e376001b3 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0012-Add-status-and-ID-LED-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0012-Add-status-and-ID-LED-support.patch @@ -1,4 +1,4 @@ -From bc6ea87d8213ecdc5ab7cced8b2fc4284fdef019 Mon Sep 17 00:00:00 2001 +From 2db86017f1cd48da9f6c102665d5ae3d1efe48cc Mon Sep 17 00:00:00 2001 From: Vernon Mauery <vernon.mauery@linux.intel.com> Date: Wed, 14 Nov 2018 12:16:53 -0800 Subject: [PATCH] Add status and ID LED support @@ -8,17 +8,18 @@ bootloader phase, the LEDs should be blinking. When booting linux, they should turn to a fixed state. Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com> +Signed-off-by: James Feist <james.feist@linux.intel.com> +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: Ic9595621b21000ef465ff57ed2047855296e2714 - --- - board/aspeed/ast-g5/ast-g5-intel.c | 110 +++++++++++++++++++++++++++++++++++++ - 1 file changed, 110 insertions(+) + board/aspeed/ast-g5/ast-g5-intel.c | 113 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 113 insertions(+) diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c -index 6e45cb4..e53f5eb 100644 +index 6e45cb4..e749992 100644 --- a/board/aspeed/ast-g5/ast-g5-intel.c +++ b/board/aspeed/ast-g5/ast-g5-intel.c -@@ -146,6 +146,110 @@ static void sgpio_init(void) +@@ -146,6 +146,112 @@ static void sgpio_init(void) writel(value, AST_GPIO_BASE + GPIO254); } @@ -51,8 +52,10 @@ index 6e45cb4..e53f5eb 100644 +}; + +static struct led_info s_led_info[] = { ++ /* BMC Executing bootloader (Default) :- ++ * ChassisID: Blinking Blue 3Hz, StatusLED: Blinking Green 1Hz */ + [GPIO_ID_LED] = {GPIO_ID_LED, EIDLED_Blink_3HZ, 1, 0}, -+ [GPIO_GREEN_LED] = {GPIO_GREEN_LED, EIDLED_Off, 0, 0}, ++ [GPIO_GREEN_LED] = {GPIO_GREEN_LED, EIDLED_Blink_1HZ, 0, 0}, + [GPIO_AMBER_LED] = {GPIO_AMBER_LED, EIDLED_Off, 0, 0}, +}; + @@ -129,14 +132,18 @@ index 6e45cb4..e53f5eb 100644 int intel_force_firmware_jumper_enabled(void) { return gpio_get_value(GPIO_FF_UPD_JUMPER); -@@ -157,4 +261,10 @@ void ast_g5_intel(void) +@@ -157,4 +263,11 @@ void ast_g5_intel(void) gpio_init(gpio_table, ARRAY_SIZE(gpio_table)); espi_init(); sgpio_init(); + timer8_init(); + if (intel_force_firmware_jumper_enabled()) { ++ /* FFUJ mode:- ChassisID: Solid Blue, StatusLED: Solid Amber */ ++ id_led_control(GPIO_ID_LED, EIDLED_On); ++ id_led_control(GPIO_GREEN_LED, EIDLED_Off); + id_led_control(GPIO_AMBER_LED, EIDLED_On); -+ } else { -+ id_led_control(GPIO_GREEN_LED, EIDLED_On); + } } +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch index 63eebe56b..2b6382967 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch @@ -1,7 +1,7 @@ -From 1264c57a485a238b715c489b7ca14982af396442 Mon Sep 17 00:00:00 2001 +From 6d8db23becf9665193023e350adcad00b75195b0 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Wed, 13 Mar 2019 14:28:05 +0530 -Subject: [PATCH] KCS driver support in uBoot +Subject: [PATCH 1/1] KCS driver support in uBoot Added KCS support in uBoot. This will enable KCS channels and set the specified registers @@ -25,18 +25,18 @@ via KCS interfaces using cmdtool.efi. Res: C1 (Invalid). Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> - +Signed-off-by: James Feist <james.feist@linux.intel.com> --- board/aspeed/ast-g5/Makefile | 1 + board/aspeed/ast-g5/ast-g5-intel.c | 3 + - board/aspeed/ast-g5/ast-g5-kcs.c | 420 +++++++++++++++++++++++++++++++++++++ - board/aspeed/ast-g5/ast-g5-kcs.h | 112 ++++++++++ + board/aspeed/ast-g5/ast-g5-kcs.c | 420 +++++++++++++++++++++++++++++ + board/aspeed/ast-g5/ast-g5-kcs.h | 112 ++++++++ 4 files changed, 536 insertions(+) create mode 100644 board/aspeed/ast-g5/ast-g5-kcs.c create mode 100644 board/aspeed/ast-g5/ast-g5-kcs.h diff --git a/board/aspeed/ast-g5/Makefile b/board/aspeed/ast-g5/Makefile -index 9022433..05972b9 100644 +index 90224333c4..05972b9d17 100644 --- a/board/aspeed/ast-g5/Makefile +++ b/board/aspeed/ast-g5/Makefile @@ -4,3 +4,4 @@ obj-y += ast-g5-espi.o @@ -45,29 +45,28 @@ index 9022433..05972b9 100644 obj-y += ast-g5-timer.o +obj-y += ast-g5-kcs.o diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c -index e19df03..adc6d10 100644 +index 032f716722..c149426947 100644 --- a/board/aspeed/ast-g5/ast-g5-intel.c +++ b/board/aspeed/ast-g5/ast-g5-intel.c -@@ -480,6 +480,7 @@ static void pwm_init(void) +@@ -256,6 +256,7 @@ int intel_force_firmware_jumper_enabled(void) } extern void espi_init(void); +extern void kcs_init(void); void ast_g5_intel(void) { - pwm_init(); -@@ -489,6 +490,8 @@ void ast_g5_intel(void) + gpio_init(gpio_table, ARRAY_SIZE(gpio_table)); +@@ -264,5 +265,7 @@ void ast_g5_intel(void) timer8_init(); if (intel_force_firmware_jumper_enabled()) { id_led_control(GPIO_AMBER_LED, EIDLED_On); + kcs_init(); + /* TODO: need to stop the booting here. */ - } else { - id_led_control(GPIO_GREEN_LED, EIDLED_On); } + } diff --git a/board/aspeed/ast-g5/ast-g5-kcs.c b/board/aspeed/ast-g5/ast-g5-kcs.c new file mode 100644 -index 0000000..7bff26f +index 0000000000..7bff26f9db --- /dev/null +++ b/board/aspeed/ast-g5/ast-g5-kcs.c @@ -0,0 +1,420 @@ @@ -493,7 +492,7 @@ index 0000000..7bff26f +} diff --git a/board/aspeed/ast-g5/ast-g5-kcs.h b/board/aspeed/ast-g5/ast-g5-kcs.h new file mode 100644 -index 0000000..bb697c4 +index 0000000000..bb697c455d --- /dev/null +++ b/board/aspeed/ast-g5/ast-g5-kcs.h @@ -0,0 +1,112 @@ @@ -609,3 +608,6 @@ index 0000000..bb697c4 + u16 data_out_idx; + u8 data_out[MAX_KCS_PKT_SIZE]; +}; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0032-PFR-FW-update-and-checkpoint-support-in-u-boot.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0032-PFR-FW-update-and-checkpoint-support-in-u-boot.patch index 7700e067f..b41403fe3 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0032-PFR-FW-update-and-checkpoint-support-in-u-boot.patch +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0032-PFR-FW-update-and-checkpoint-support-in-u-boot.patch @@ -1,7 +1,7 @@ -From 0c975e64ca8bd5fdaf12f15b4dbc9ceaa942c36c Mon Sep 17 00:00:00 2001 +From 2c5ae4ff71edda4d2d9cc0d289f61635409c3be4 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Wed, 24 Jul 2019 20:11:30 +0530 -Subject: [PATCH] PFR FW update and checkpoint support in u-boot +Subject: [PATCH 2/2] PFR FW update and checkpoint support in u-boot 1) Added firmware update ipmi commands support for PFR images. This enables PFR based firmware @@ -21,21 +21,22 @@ BMC image update via KCS ( In FFUJ mode). cross verified the check-points properly set or not. Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> +Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> --- board/aspeed/ast-g5/Makefile | 1 + - board/aspeed/ast-g5/ast-g5-intel.c | 10 ++++ - board/aspeed/ast-g5/fw-update.c | 112 +++++++++++++++++++------------------ - board/aspeed/ast-g5/fw-update.h | 7 +++ - board/aspeed/ast-g5/ipmi-fwupd.c | 37 ++++++++++++ + board/aspeed/ast-g5/ast-g5-intel.c | 10 +++ + board/aspeed/ast-g5/fw-update.c | 112 +++++++++++++++-------------- + board/aspeed/ast-g5/fw-update.h | 7 ++ + board/aspeed/ast-g5/ipmi-fwupd.c | 37 ++++++++++ board/aspeed/ast-g5/ipmi-fwupd.h | 6 -- - board/aspeed/ast-g5/pfr-mgr.c | 73 ++++++++++++++++++++++++ - board/aspeed/ast-g5/pfr-mgr.h | 73 ++++++++++++++++++++++++ + board/aspeed/ast-g5/pfr-mgr.c | 73 +++++++++++++++++++ + board/aspeed/ast-g5/pfr-mgr.h | 73 +++++++++++++++++++ 8 files changed, 258 insertions(+), 61 deletions(-) create mode 100644 board/aspeed/ast-g5/pfr-mgr.c create mode 100644 board/aspeed/ast-g5/pfr-mgr.h diff --git a/board/aspeed/ast-g5/Makefile b/board/aspeed/ast-g5/Makefile -index 0b2d936..9021d7f 100644 +index 0b2d936c23..9021d7fc08 100644 --- a/board/aspeed/ast-g5/Makefile +++ b/board/aspeed/ast-g5/Makefile @@ -8,3 +8,4 @@ obj-y += ast-g5-kcs.o @@ -44,7 +45,7 @@ index 0b2d936..9021d7f 100644 obj-y += fw-update.o +obj-y += pfr-mgr.o diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c -index e68ab85..cd359ce 100644 +index c58fd3591b..13889594bf 100644 --- a/board/aspeed/ast-g5/ast-g5-intel.c +++ b/board/aspeed/ast-g5/ast-g5-intel.c @@ -16,6 +16,7 @@ @@ -55,10 +56,10 @@ index e68ab85..cd359ce 100644 /* Names to match the GPIOs */ enum gpio_names { -@@ -541,6 +542,10 @@ extern void espi_init(void); - extern void kcs_init(void); - void ast_g5_intel(void) - { +@@ -582,6 +583,10 @@ void ast_g5_intel(void) + ast_scu_write(ast_scu_read(AST_SCU_MISC1_CTRL) | + SCU_MISC_UART_DEBUG_DIS, AST_SCU_MISC1_CTRL); + + /* To notify the CPLD about the start of bootloader + * and hardware initialization */ + set_cpld_reg(PFR_CPLD_BOOT_CHECKPOINT_REG, PFR_CPLD_CHKPOINT_START); @@ -66,8 +67,8 @@ index e68ab85..cd359ce 100644 uart_init(); pwm_init(); gpio_init(gpio_table, ARRAY_SIZE(gpio_table)); -@@ -551,6 +556,11 @@ void ast_g5_intel(void) - if (intel_force_firmware_jumper_enabled()) { +@@ -595,6 +600,11 @@ void ast_g5_intel(void) + id_led_control(GPIO_GREEN_LED, EIDLED_Off); id_led_control(GPIO_AMBER_LED, EIDLED_On); kcs_init(); + /* Notify CPLD about FFUJ jumper set and pause @@ -76,10 +77,10 @@ index e68ab85..cd359ce 100644 + set_cpld_reg(PFR_CPLD_BOOT_CHECKPOINT_REG, + PFR_CPLD_CHKPOINT_FFUJ); /* TODO: need to stop the booting here. */ - } else { - id_led_control(GPIO_GREEN_LED, EIDLED_On); + } + } diff --git a/board/aspeed/ast-g5/fw-update.c b/board/aspeed/ast-g5/fw-update.c -index 9923993..89fe5fd 100644 +index 99239938b5..89fe5fd4fd 100644 --- a/board/aspeed/ast-g5/fw-update.c +++ b/board/aspeed/ast-g5/fw-update.c @@ -6,6 +6,7 @@ @@ -269,7 +270,7 @@ index 9923993..89fe5fd 100644 mdelay(WAIT_STATE_TIMEOUT); } diff --git a/board/aspeed/ast-g5/fw-update.h b/board/aspeed/ast-g5/fw-update.h -index ed033ad..45e46ba 100644 +index ed033adfed..45e46ba596 100644 --- a/board/aspeed/ast-g5/fw-update.h +++ b/board/aspeed/ast-g5/fw-update.h @@ -28,6 +28,12 @@ enum update_status { @@ -291,7 +292,7 @@ index ed033ad..45e46ba 100644 int generate_random_number(void); + diff --git a/board/aspeed/ast-g5/ipmi-fwupd.c b/board/aspeed/ast-g5/ipmi-fwupd.c -index 3eba056..6afc8d6 100644 +index 3eba056e7f..6afc8d66b7 100644 --- a/board/aspeed/ast-g5/ipmi-fwupd.c +++ b/board/aspeed/ast-g5/ipmi-fwupd.c @@ -2,10 +2,14 @@ @@ -350,7 +351,7 @@ index 3eba056..6afc8d6 100644 result->no_of_bytes_written = (u8)req_len; diff --git a/board/aspeed/ast-g5/ipmi-fwupd.h b/board/aspeed/ast-g5/ipmi-fwupd.h -index e490f6b..7409d2e 100644 +index e490f6b527..7409d2e2f9 100644 --- a/board/aspeed/ast-g5/ipmi-fwupd.h +++ b/board/aspeed/ast-g5/ipmi-fwupd.h @@ -19,12 +19,6 @@ enum control_state_bit { @@ -368,7 +369,7 @@ index e490f6b..7409d2e 100644 u8 completion_code; diff --git a/board/aspeed/ast-g5/pfr-mgr.c b/board/aspeed/ast-g5/pfr-mgr.c new file mode 100644 -index 0000000..7713168 +index 0000000000..77131688e7 --- /dev/null +++ b/board/aspeed/ast-g5/pfr-mgr.c @@ -0,0 +1,73 @@ @@ -447,7 +448,7 @@ index 0000000..7713168 + diff --git a/board/aspeed/ast-g5/pfr-mgr.h b/board/aspeed/ast-g5/pfr-mgr.h new file mode 100644 -index 0000000..6cf8c6d +index 0000000000..6cf8c6d5b9 --- /dev/null +++ b/board/aspeed/ast-g5/pfr-mgr.h @@ -0,0 +1,73 @@ @@ -525,5 +526,5 @@ index 0000000..6cf8c6d +ulong get_flash_region_offset(u32 type); +ulong get_image_max_size(u32 type); -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0034-Disable-uart-debug-interface.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0034-Disable-uart-debug-interface.patch new file mode 100644 index 000000000..941dc7d0d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0034-Disable-uart-debug-interface.patch @@ -0,0 +1,54 @@ +From 961561c437c8a3f3de1753c502a20c334966354e Mon Sep 17 00:00:00 2001 +From: Yong Li <yong.b.li@linux.intel.com> +Date: Tue, 20 Aug 2019 16:10:03 +0800 +Subject: [PATCH 1/2] Disable uart debug interface + +AST2500 SOC integrates a UART debug interface which can +input commands to AST2500 by using simple terminal +program without the assistance of CPU. + +For security requirements, we need to disable this feature, +set SCU2C[]10 = 1 to disable it. + +Tested: +Flash the u-boot.bin and dump SCU2C as below: +md 0x1e6e202c +1e6e202c: 00200400 + +Signed-off-by: Yong Li <yong.b.li@linux.intel.com> +Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> +--- + arch/arm/include/asm/arch-aspeed/regs-scu.h | 1 + + board/aspeed/ast-g5/ast-g5-intel.c | 4 ++++ + 2 files changed, 5 insertions(+) + +diff --git a/arch/arm/include/asm/arch-aspeed/regs-scu.h b/arch/arm/include/asm/arch-aspeed/regs-scu.h +index 8a596ceafc..8333ba1c59 100644 +--- a/arch/arm/include/asm/arch-aspeed/regs-scu.h ++++ b/arch/arm/include/asm/arch-aspeed/regs-scu.h +@@ -467,6 +467,7 @@ + #define SCU_MISC_VUART_TO_CTRL (0x1 << 13) + #define SCU_MISC_DIV13_EN (0x1 << 12) + #define SCU_MISC_Y_CLK_INVERT (0x1 << 11) ++#define SCU_MISC_UART_DEBUG_DIS (0x1 << 10) + #define SCU_MISC_OUT_DELAY (0x1 << 9) + #define SCU_MISC_PCI_TO_AHB_DIS (0x1 << 8) + #define SCU_MISC_2D_CRT_EN (0x1 << 7) +diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c +index 324387a4bc..c58fd3591b 100644 +--- a/board/aspeed/ast-g5/ast-g5-intel.c ++++ b/board/aspeed/ast-g5/ast-g5-intel.c +@@ -578,6 +578,10 @@ extern void espi_init(void); + extern void kcs_init(void); + void ast_g5_intel(void) + { ++ /* Disable uart port debug function */ ++ ast_scu_write(ast_scu_read(AST_SCU_MISC1_CTRL) | ++ SCU_MISC_UART_DEBUG_DIS, AST_SCU_MISC1_CTRL); ++ + uart_init(); + pwm_init(); + gpio_init(gpio_table, ARRAY_SIZE(gpio_table)); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0035-PFR-platform-EXTRST-reset-mask-selection.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0035-PFR-platform-EXTRST-reset-mask-selection.patch new file mode 100644 index 000000000..193101370 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0035-PFR-platform-EXTRST-reset-mask-selection.patch @@ -0,0 +1,124 @@ +From c15d982a36e34f3d3cc69efff7b56a5157be9a5c Mon Sep 17 00:00:00 2001 +From: Vikram Bodireddy <vikram.bodireddy@intel.com> +Date: Thu, 5 Sep 2019 15:03:21 +0530 +Subject: [PATCH] PFR platform - EXTRST# reset mask selection + +This is a fix taken from Purely PFR. +This commit will enable specific reset mask for EXTRST# signal. +On PFR platforms, EXTRST# signal is used by PFR CPLD to put BMC +in reset during firmware authentications, recovery and firmware +update flow, during which certain modules of BMC should be chosen +to be reset so that Host functionality would be intact. + +Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> + + .../include/asm/arch-aspeed/ast-g5-intel.h | 31 +++++++++++++++++++ + arch/arm/include/asm/arch-aspeed/regs-scu.h | 29 +++++++++++++++++ + board/aspeed/ast-g5/ast-g5-intel.c | 9 ++++++ + 3 files changed, 69 insertions(+) + +diff --git a/arch/arm/include/asm/arch-aspeed/ast-g5-intel.h b/arch/arm/include/asm/arch-aspeed/ast-g5-intel.h +index 64f4ed17bf..b9386b2cf6 100644 +--- a/arch/arm/include/asm/arch-aspeed/ast-g5-intel.h ++++ b/arch/arm/include/asm/arch-aspeed/ast-g5-intel.h +@@ -12,6 +12,37 @@ + + #define AST_G5_INTEL 1 + ++/* EXTRST# mask for PFR platform ++ * EXTRST# is used by PFR CPLD to keep BMC in ++ * reset during firmware authentication, updates and recovery ++ * this mask selects the modules to be reset along with BMC so that ++ * Host functions are intact. ++ * (this is fix from Purley PFR ) ++ */ ++#define AST_WDT_RESET_MASK ( \ ++ WDT_RESET_MASK_SPI | \ ++ WDT_RESET_MASK_XDMA | \ ++ WDT_RESET_MASK_MCTP | \ ++ WDT_RESET_MASK_ADC | \ ++ WDT_RESET_MASK_JTAG | \ ++ WDT_RESET_MASK_PECI | \ ++ WDT_RESET_MASK_CRT | \ ++ WDT_RESET_MASK_MIC | \ ++ WDT_RESET_MASK_SDIO | \ ++ WDT_RESET_MASK_HAC | \ ++ WDT_RESET_MASK_VIDEO | \ ++ WDT_RESET_MASK_HID11 | \ ++ WDT_RESET_MASK_USB11 | \ ++ WDT_RESET_MASK_USB20 | \ ++ WDT_RESET_MASK_GRAPHICS | \ ++ WDT_RESET_MASK_MAC2 | \ ++ WDT_RESET_MASK_MAC1 | \ ++ WDT_RESET_MASK_I2C | \ ++ WDT_RESET_MASK_AHB | \ ++ WDT_RESET_MASK_COPROC | \ ++ WDT_RESET_MASK_ARM | \ ++ 0) ++ + #ifndef __ASSEMBLY__ + int intel_force_firmware_jumper_enabled(void); + int intel_failed_boot(void); +diff --git a/arch/arm/include/asm/arch-aspeed/regs-scu.h b/arch/arm/include/asm/arch-aspeed/regs-scu.h +index 8333ba1c59..98895a47bf 100644 +--- a/arch/arm/include/asm/arch-aspeed/regs-scu.h ++++ b/arch/arm/include/asm/arch-aspeed/regs-scu.h +@@ -144,6 +144,35 @@ + #define SCU_RESET_AHB (0x1 << 1) + #define SCU_RESET_SRAM_CTRL (0x1 << 0) + ++/* AST_WDT/EXTRST - 0x9C selection masks */ ++#define WDT_RESET_MASK_MISC (1 << 25) /* Misc. SOC controller (WDT, RTC, Timer, UART, SRAM.) */ ++#define WDT_RESET_MASK_SPI (1 << 24) /* SPI controller */ ++#define WDT_RESET_MASK_XDMA (1 << 23) /* X-DMA controller */ ++#define WDT_RESET_MASK_MCTP (1 << 22) /* MCTP controller */ ++#define WDT_RESET_MASK_GPIO (1 << 21) /* GPIO controller */ ++#define WDT_RESET_MASK_ADC (1 << 20) /* ADC controller */ ++#define WDT_RESET_MASK_JTAG (1 << 19) /* JTAG master controller */ ++#define WDT_RESET_MASK_PECI (1 << 18) /* PECI controller */ ++#define WDT_RESET_MASK_PWM (1 << 17) /* PWM controller */ ++#define WDT_RESET_MASK_CRT (1 << 16) /* CRT mode 2D engine */ ++#define WDT_RESET_MASK_MIC (1 << 15) /* MIC controller */ ++#define WDT_RESET_MASK_SDIO (1 << 14) /* SD/SDIO controller */ ++#define WDT_RESET_MASK_LPC (1 << 13) /* LPC controller */ ++#define WDT_RESET_MASK_HAC (1 << 12) /* HAC engine */ ++#define WDT_RESET_MASK_VIDEO (1 << 11) /* Video engine */ ++#define WDT_RESET_MASK_HID11 (1 << 10) /* USB1.1 HID/USB2.0 Host EHCI2 controller */ ++#define WDT_RESET_MASK_USB11 (1 << 9) /* USB1.1 Host controller */ ++#define WDT_RESET_MASK_USB20 (1 << 8) /* USB2.0 Host/Hub controller */ ++#define WDT_RESET_MASK_GRAPHICS (1 << 7) /* Graphics CRT controller */ ++#define WDT_RESET_MASK_MAC2 (1 << 6) /* MAC#2 controller */ ++#define WDT_RESET_MASK_MAC1 (1 << 5) /* MAC#1 controller */ ++#define WDT_RESET_MASK_I2C (1 << 4) /* I2C controller */ ++#define WDT_RESET_MASK_AHB (1 << 3) /* AHB bridges */ ++#define WDT_RESET_MASK_SDRAM (1 << 2) /* SDRAM controller */ ++#define WDT_RESET_MASK_COPROC (1 << 1) /* Coprocessor */ ++#define WDT_RESET_MASK_ARM (1 << 0) /* ARM */ ++#define WDT_RESET_MASK_ALL 0x03ffffff /* all the bits above: 0-25*/ ++ + /* AST_SCU_RESET2 0xD4 - Reset Control register set 2 */ + #define SCU_RESET_CRT3 (0x1 << 8) + #define SCU_RESET_CRT2 (0x1 << 7) +diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c +index 13889594bf..ce87a46cd1 100644 +--- a/board/aspeed/ast-g5/ast-g5-intel.c ++++ b/board/aspeed/ast-g5/ast-g5-intel.c +@@ -579,6 +579,15 @@ extern void espi_init(void); + extern void kcs_init(void); + void ast_g5_intel(void) + { ++ /* EXTRST# mask for PFR platform ++ * EXTRST# is used by PFR CPLD to keep BMC in ++ * reset during firmware authentication, updates and recovery ++ * this mask selects the modules to be reset along with BMC so that ++ * Host functions are intact. ++ * (this is fix from Purley PFR ) ++ */ ++ ast_scu_write(AST_WDT_RESET_MASK, AST_SCU_WDT_RESET); ++ + /* Disable uart port debug function */ + ast_scu_write(ast_scu_read(AST_SCU_MISC1_CTRL) | + SCU_MISC_UART_DEBUG_DIS, AST_SCU_MISC1_CTRL); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0036-Re-Enable-KCS.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0036-Re-Enable-KCS.patch new file mode 100644 index 000000000..976277f9e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0036-Re-Enable-KCS.patch @@ -0,0 +1,35 @@ +From 6bd4135cd2b8e3a95f5c29e7edaa678e0ca6eded Mon Sep 17 00:00:00 2001 +From: James Feist <james.feist@linux.intel.com> +Date: Thu, 19 Sep 2019 10:15:19 -0700 +Subject: [PATCH 1/1] Re-Enable KCS + +Phosphor-isolation isolates too much and seems to +make KCS not work. This removes the lines from that +patch that seem to be of question. + +Tested: AC/Cycled, cmdtool.efi 20 18 1 works + +Signed-off-by: James Feist <james.feist@linux.intel.com> +--- + board/aspeed/ast-g5/ast-g5.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/board/aspeed/ast-g5/ast-g5.c b/board/aspeed/ast-g5/ast-g5.c +index ead2e1bb63..00bd92ae5f 100644 +--- a/board/aspeed/ast-g5/ast-g5.c ++++ b/board/aspeed/ast-g5/ast-g5.c +@@ -41,11 +41,6 @@ int board_init(void) + bool sdmc_unlocked; + u32 val; + +- /* iLPC2AHB */ +- val = readl(AST_SCU_BASE + AST_SCU_HW_STRAP1); +- val |= SCU_HW_STRAP_LPC_DEC_SUPER_IO; +- writel(val, AST_SCU_BASE + AST_SCU_HW_STRAP1); +- + val = readl(AST_LPC_BASE + AST_LPC_HICRB); + val |= LPC_HICRB_ILPC2AHB; + writel(val, AST_LPC_BASE + AST_LPC_HICRB); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0037-aspeed-ast-scu.c-fix-MAC1LINK-and-MAC2LINK-pin-pads-.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0037-aspeed-ast-scu.c-fix-MAC1LINK-and-MAC2LINK-pin-pads-.patch new file mode 100644 index 000000000..9c176e998 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0037-aspeed-ast-scu.c-fix-MAC1LINK-and-MAC2LINK-pin-pads-.patch @@ -0,0 +1,80 @@ +From 4b96a19bdde82d7fed24cb70e0bcaef16d8711c3 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Date: Fri, 4 Oct 2019 15:54:43 -0700 +Subject: [PATCH] aspeed/ast-scu.c: fix MAC1LINK and MAC2LINK pin pads setting + +Intel platforms don't use these pins as PHY link monitoring inputs +so this commit disables them in SCU pin control register so that +the pins can be used as GPIOs. + +Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +--- + arch/arm/mach-aspeed/ast-scu.c | 37 +++++++++---------------------------- + 1 file changed, 9 insertions(+), 28 deletions(-) + +diff --git a/arch/arm/mach-aspeed/ast-scu.c b/arch/arm/mach-aspeed/ast-scu.c +index 537cd4b3e1c7..28c48c115406 100644 +--- a/arch/arm/mach-aspeed/ast-scu.c ++++ b/arch/arm/mach-aspeed/ast-scu.c +@@ -419,49 +419,30 @@ void ast_scu_multi_func_eth(u8 num) + { + switch (num) { + case 0: +- if (ast_scu_read(AST_SCU_HW_STRAP1) & SCU_HW_STRAP_MAC0_RGMII) { ++ if (ast_scu_read(AST_SCU_HW_STRAP1) & SCU_HW_STRAP_MAC0_RGMII) + printf("MAC0 : RGMII\n"); +- ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) | +- SCU_FUN_PIN_MAC0_PHY_LINK, +- AST_SCU_FUN_PIN_CTRL1); +- } else { ++ else + printf("MAC0 : RMII/NCSI\n"); +- ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) & +- ~SCU_FUN_PIN_MAC0_PHY_LINK, +- AST_SCU_FUN_PIN_CTRL1); +- } +- +-#ifdef AST_SOC_G5 +- ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) | +- SCU_FUN_PIN_MAC0_PHY_LINK, AST_SCU_FUN_PIN_CTRL1); + +-#endif ++ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) & ++ ~SCU_FUN_PIN_MAC0_PHY_LINK, ++ AST_SCU_FUN_PIN_CTRL1); + ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL3) | + SCU_FUN_PIN_MAC0_MDIO | SCU_FUN_PIN_MAC0_MDC, + AST_SCU_FUN_PIN_CTRL3); +- + break; + case 1: +- if (ast_scu_read(AST_SCU_HW_STRAP1) & SCU_HW_STRAP_MAC1_RGMII) { ++ if (ast_scu_read(AST_SCU_HW_STRAP1) & SCU_HW_STRAP_MAC1_RGMII) + printf("MAC1 : RGMII\n"); +- ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) | +- SCU_FUN_PIN_MAC1_PHY_LINK, +- AST_SCU_FUN_PIN_CTRL1); +- } else { ++ else + printf("MAC1 : RMII/NCSI\n"); +- ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) & +- ~SCU_FUN_PIN_MAC1_PHY_LINK, +- AST_SCU_FUN_PIN_CTRL1); +- } + +- ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) | +- SCU_FUN_PIN_MAC1_PHY_LINK, ++ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) & ++ ~SCU_FUN_PIN_MAC1_PHY_LINK, + AST_SCU_FUN_PIN_CTRL1); +- + ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) | + SCU_FUC_PIN_MAC1_MDIO, + AST_SCU_FUN_PIN_CTRL5); +- + break; + } + } +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend index 09544cfb2..0f0cf2b78 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend @@ -34,10 +34,14 @@ SRC_URI_append_intel-ast2500 = " \ file://0030-Support-Get-Set-Security-mode-command.patch \ file://0031-Make-it-so-TFTP-port-can-be-modified.patch \ file://0033-Reboot-into-UBOOT-on-Watchdog-Failures.patch \ + file://0034-Disable-uart-debug-interface.patch \ + file://0036-Re-Enable-KCS.patch \ + file://0037-aspeed-ast-scu.c-fix-MAC1LINK-and-MAC2LINK-pin-pads-.patch \ " PFR_SRC_URI = " \ file://0022-u-boot-env-change-for-PFR-image.patch \ file://0032-PFR-FW-update-and-checkpoint-support-in-u-boot.patch \ + file://0035-PFR-platform-EXTRST-reset-mask-selection.patch \ " SRC_URI_append_intel-ast2500 += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', PFR_SRC_URI, '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-fw-utils-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-fw-utils-aspeed_%.bbappend index 09544cfb2..0f0cf2b78 100644 --- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-fw-utils-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/u-boot-fw-utils-aspeed_%.bbappend @@ -34,10 +34,14 @@ SRC_URI_append_intel-ast2500 = " \ file://0030-Support-Get-Set-Security-mode-command.patch \ file://0031-Make-it-so-TFTP-port-can-be-modified.patch \ file://0033-Reboot-into-UBOOT-on-Watchdog-Failures.patch \ + file://0034-Disable-uart-debug-interface.patch \ + file://0036-Re-Enable-KCS.patch \ + file://0037-aspeed-ast-scu.c-fix-MAC1LINK-and-MAC2LINK-pin-pads-.patch \ " PFR_SRC_URI = " \ file://0022-u-boot-env-change-for-PFR-image.patch \ file://0032-PFR-FW-update-and-checkpoint-support-in-u-boot.patch \ + file://0035-PFR-platform-EXTRST-reset-mask-selection.patch \ " SRC_URI_append_intel-ast2500 += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', PFR_SRC_URI, '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb index 170f41a94..1c0a5f73a 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb @@ -8,12 +8,12 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=0d1c657b2ba1e8877940a8d1614ec560" inherit cmake -DEPENDS = "sdbusplus openssl libpam" +DEPENDS = "sdbusplus openssl libpam libgpiod" do_configure[depends] += "virtual/kernel:do_shared_workdir" -SRC_URI = "git://git@github.com/Intel-BMC/asd;protocol=ssh;nobranch=1" -SRCREV = "73d4cc11b859ba91f313a7bb85f2dbb26e36d0ee" +SRC_URI = "git://git@github.com/Intel-BMC/asd;protocol=ssh" +SRCREV = "bcc326ea6968ac002bb10b5bc848368d957ba049" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb b/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb index 68a548b02..2d1b5cf29 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/crashdump/crashdump_git.bb @@ -4,7 +4,7 @@ inherit obmc-phosphor-systemd SUMMARY = "CPU Crashdump" DESCRIPTION = "CPU utilities for dumping CPU Crashdump and registers over PECI" -DEPENDS = "boost cjson sdbusplus safec gtest " +DEPENDS = "boost cjson sdbusplus safec gtest libpeci" inherit cmake EXTRA_OECMAKE = "-DCRASHDUMP_BUILD_UT=ON" @@ -12,11 +12,10 @@ EXTRA_OECMAKE = "-DCRASHDUMP_BUILD_UT=ON" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=26bb6d0733830e7bab774914a8f8f20a" -SRC_URI = "git://git@github.com/Intel-BMC/crashdump;protocol=ssh;nobranch=1" -SRCREV = "c99e4fb7727545501fe65b90a8a97e84d469d45e" +SRC_URI = "git://git@github.com/Intel-BMC/crashdump;protocol=ssh" +SRCREV = "eda3478a6db7b2f09bb74fd109552c433c885731" S = "${WORKDIR}/git" -PACKAGES += "libpeci" SYSTEMD_SERVICE_${PN} += "com.intel.crashdump.service" DBUS_SERVICE_${PN} += "com.intel.crashdump.service" diff --git a/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh b/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh index dd3b7f69a..889a73c06 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh +++ b/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/fwupd.sh @@ -73,6 +73,74 @@ if [ ! -e $LOCAL_PATH ] || [ $(stat -c %s $LOCAL_PATH) -eq 0 ]; then esac fi +# PFR image update section +# this file being created at build time for PFR images +if [ -e /usr/share/pfr ] +then +# read the image type from the uploaded image +# Byte at location 0x8 gives image type +img_type=$(hexdump -s 8 -n 1 $LOCAL_PATH | cut -b12,1 | sed '2d;') +echo "image-type=$img_type" + +# BMC image - max size 32MB +if [ "$img_type" = '04' ]; then + echo "BMC firmware image" + # 32MB - 33554432 + img_size=33554432 + upd_intent_val=0x08 + # page is at 4KB boundary + img_page_offset=0 + erase_offset=0 + blk_cnt=0x200 +# CPLD image- max size 4MB +elif [ "$img_type" = '00' ]; then + echo "CPLD firmware image" + # 4MB - 4194304 + img_size=4194304 + upd_intent_val=0x04 + # dd command accepts the offset in decimal + # below is the page offset in 4KB boundary + img_page_offset=12288 + erase_offset=0x3000000 + blk_cnt=0x40 +# BIOS image- max size 16MB +elif [ "$img_type" = '02' ]; then + echo "BIOS firmware image" + # 16MB- 16777216 + img_size=16777216 + upd_intent_val=0x01 + # dd command accepts the offset in decimal + # below is the page offset in 4KB boundary + img_page_offset=8192 + erase_offset=0x2000000 + blk_cnt=0x100 +else + echo "${img_type}:Unknown image type, exiting the firmware update script" + exit 1 +fi + +# do a quick sanity check on the image +if [ $(stat -c "%s" "$LOCAL_PATH") -gt $img_size ]; then + echo "Update file "$LOCAL_PATH" is bigger than the supported image size" + exit 1 +fi + +TGT="/dev/mtd/image-stg" +echo "Updating $(basename $TGT)" +flash_erase $TGT $erase_offset $blk_cnt +echo "Writing $(stat -c "%s" "$LOCAL_PATH") bytes" +# cat "$LOCAL_PATH" > "$TGT" +dd bs=4k seek=$img_page_offset if=$LOCAL_PATH of=$TGT +sync +echo "Written $(stat -c "%s" "$LOCAL_PATH") bytes" +# remove the updated image from /tmp +rm -f $LOCAL_PATH +echo "Setting update intent in PFR CPLD" +sleep 5 # delay for sync and to get the above echo messages +# write to PFRCPLD about BMC update intent. +i2cset -y 4 0x70 0x13 $upd_intent_val + +else # Non-PFR image update section # do a quick sanity check on the image if [ $(stat -c "%s" "$LOCAL_PATH") -lt 10000000 ]; then echo "Update file "$LOCAL_PATH" seems to be too small" @@ -84,18 +152,6 @@ if [ $? -ne 0 ]; then exit 1 fi -#this file being created at build time for PFR images -#TODO: Need to do runtime detection of PFR platform -#TODO: Also to check if PFR is provisioned or not -if [ -e /usr/share/pfr ] -then -TGT="/dev/mtd/image-stg" -echo "Updating $(basename $TGT)" -flash_erase $TGT 0 0 -echo "Writing $(stat -c "%s" "$LOCAL_PATH") bytes" -cat "$LOCAL_PATH" > "$TGT" -#TODO: Add I2C command to write to PFRCPLD about BMC update intent. -else # guess based on fw_env which partition we booted from BOOTADDR=$(fw_printenv bootcmd | awk '{print $2}') diff --git a/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb b/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb index d7595696e..7c994053e 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/fw-update/intel-fw-update.bb @@ -7,7 +7,7 @@ RDEPENDS_intel-fw-update += "mtd-utils" # wget tftp scp RDEPENDS_intel-fw-update += "busybox dropbear" # mkfs.vfat, parted -RDEPENDS_intel-fw-update += "dosfstools parted" +RDEPENDS_intel-fw-update += "dosfstools" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" diff --git a/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_git.bb b/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_git.bb index 483a9bf12..8556f3310 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/host-error-monitor/host-error-monitor_git.bb @@ -2,13 +2,20 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" inherit cmake systemd -SRC_URI = "git://git@github.com/Intel-BMC/at-scale-debug;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -DEPENDS = "boost sdbusplus libgpiod" +DEPENDS = "boost sdbusplus libgpiod libpeci" PV = "0.1+git${SRCPV}" -SRCREV = "6ed87657134c7379da1febcccd5d87617c702347" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" S = "${WORKDIR}/git/host_error_monitor" SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.HostErrorMonitor.service" + +# linux-libc-headers guides this way to include custom uapi headers +CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include/uapi" +CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" +CXXFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include/uapi" +CXXFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" +do_configure[depends] += "virtual/kernel:do_shared_workdir" diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Add-smbus-support-to-Cmake-Lists.patch b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Add-smbus-support-to-Cmake-Lists.patch deleted file mode 100644 index 8bb9ce485..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Add-smbus-support-to-Cmake-Lists.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 21f2f29129a7eba8aecdf07875004bafc6a74269 Mon Sep 17 00:00:00 2001 -From: James Feist <james.feist@linux.intel.com> -Date: Thu, 20 Jun 2019 08:58:44 -0700 -Subject: [PATCH] Add smbus support to Cmake Lists - -This adds smbus changes needed for libmctp. - -Change-Id: I06fc950337e6f3d5b1cef0fb445be2d448d49e44 -Signed-off-by: James Feist <james.feist@linux.intel.com> ---- - CMakeLists.txt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a5b1042..04c4bdf 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.5 FATAL_ERROR) - add_definitions (-DMCTP_LOG_STDERR) - add_definitions (-DMCTP_FILEIO) - --add_library (libmctp STATIC alloc.c core.c log.c libmctp.h serial.c) -+add_library (libmctp STATIC alloc.c core.c log.c libmctp.h serial.c smbus.c) - - target_include_directories (libmctp PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> -@@ -18,5 +18,5 @@ add_executable (test_seq tests/test_seq.c tests/test-utils.c) - target_link_libraries (test_seq libmctp) - - install (TARGETS libmctp DESTINATION lib) --install (FILES libmctp.h DESTINATION include) -+install (FILES libmctp.h libmctp-smbus.h libmctp-serial.h DESTINATION include) - --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch new file mode 100644 index 000000000..e456c10ad --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/0001-Smbus-changes-for-libmctp.patch @@ -0,0 +1,148 @@ +From cb330f4bf1f519032ee50d60f473c28df7b772d8 Mon Sep 17 00:00:00 2001 +From: Nikhil Potade <nikhil.potade@linux.intel.com> +Date: Tue, 19 Feb 2019 14:16:20 +0800 +Subject: [PATCH] Smbus changes for libmctp + +--- + CMakeLists.txt | 6 ++++-- + core.c | 2 ++ + libmctp.h | 40 ++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 46 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a5b1042..249b12b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,8 +2,9 @@ cmake_minimum_required (VERSION 3.5 FATAL_ERROR) + + add_definitions (-DMCTP_LOG_STDERR) + add_definitions (-DMCTP_FILEIO) ++add_definitions (-DMCTP_DEFAULT_ALLOC) + +-add_library (libmctp STATIC alloc.c core.c log.c libmctp.h serial.c) ++add_library (libmctp STATIC alloc.c core.c log.c libmctp.h serial.c smbus.c crc32c.c) + + target_include_directories (libmctp PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> +@@ -18,5 +19,6 @@ add_executable (test_seq tests/test_seq.c tests/test-utils.c) + target_link_libraries (test_seq libmctp) + + install (TARGETS libmctp DESTINATION lib) +-install (FILES libmctp.h DESTINATION include) ++install (FILES libmctp.h libmctp-smbus.h libmctp-serial.h crc32c.h DESTINATION ++ include) + +diff --git a/core.c b/core.c +index b855ced..8be7407 100644 +--- a/core.c ++++ b/core.c +@@ -17,6 +17,7 @@ + + /* Internal data structures */ + ++/* clang-format off */ + struct mctp_bus { + mctp_eid_t eid; + struct mctp_binding *binding; +@@ -50,6 +51,7 @@ struct mctp { + */ + struct mctp_msg_ctx msg_ctxs[16]; + }; ++/* clang-format on */ + + #ifndef BUILD_ASSERT + #define BUILD_ASSERT(x) \ +diff --git a/libmctp.h b/libmctp.h +index f0633e3..cec7c00 100644 +--- a/libmctp.h ++++ b/libmctp.h +@@ -15,6 +15,7 @@ extern "C" { + typedef uint8_t mctp_eid_t; + + /* MCTP packet definitions */ ++/* clang-format off */ + struct mctp_hdr { + uint8_t ver; + uint8_t dest; +@@ -30,12 +31,47 @@ struct mctp_hdr { + #define MCTP_HDR_SEQ_MASK (0x3) + #define MCTP_HDR_TAG_SHIFT (0) + #define MCTP_HDR_TAG_MASK (0x7) ++/* clang-format on */ + + /* Maximum size of *payload* data in a MCTP packet + * @todo: dynamic sixing based on channel implementation. + */ + #define MCTP_MTU 64 + ++#define MCTP_CONTROL_MESSAGE_TYPE 0x00 ++ ++enum MCTP_COMMAND_CODE { ++ MCTP_COMMAND_CODE_SET_EID = 0x01, ++ MCTP_COMMAND_CODE_GET_EID = 0x02, ++ MCTP_COMMAND_CODE_GET_ENDPOINT_UUID = 0x03, ++ MCTP_COMMAND_CODE_GET_MCTP_VERSION_SUPPORT = 0x04, ++ MCTP_COMMAND_CODE_GET_MESSAGE_TYPE_SUPPORT = 0x05, ++ MCTP_COMMAND_CODE_GET_VENDOR_DEFINED_MSG_SUPPORT= 0x06, ++ MCTP_COMMAND_CODE_RESOLVE_ENDPOINT_ID = 0x07, ++ MCTP_COMMAND_CODE_ALLOCATE_ENDPOINT_IDS = 0x08, ++ MCTP_COMMAND_CODE_ROUTING_INFORMATION_UPDATE = 0x09, ++ MCTP_COMMAND_CODE_GET_ROUTING_TABLE_ENTRIES = 0x0A, ++ MCTP_COMMAND_CODE_PREPARE_FOR_ENDPOINT_DISCOVERY= 0x0B, ++ MCTP_COMMAND_CODE_ENDPOINT_DISCOVERY = 0x0C, ++ MCTP_COMMAND_CODE_DISCOVERY_NOTIFY = 0x0D, ++ MCTP_COMMAND_CODE_GET_NETWORK_ID = 0x0E, ++ MCTP_COMMAND_CODE_QUERY_HOP = 0x0F, ++ MCTP_COMMAND_CODE_RESOLVE_UUID = 0x10, ++ MCTP_COMMAND_CODE_QUERY_RATE_LIMIT = 0x11, ++ MCTP_COMMAND_CODE_REQUEST_TX_RATE_LIMIT = 0x12, ++ MCTP_COMMAND_CODE_UPDATE_RATE_LIMIT = 0x13, ++ MCTP_COMMAND_CODE_QUERY_SUPPORTED_INTERFACES = 0x14 ++}; ++ ++enum MCTP_CONTROL_MSG_COMPLETION_CODE { ++ MCTP_CONTROL_MSG_STATUS_SUCCESS = 0x00, ++ MCTP_CONTROL_MSG_STATUS_ERROR = 0x01, ++ MCTP_CONTROL_MSG_STATUS_ERROR_INVALID_DATA = 0x02, ++ MCTP_CONTROL_MSG_STATUS_ERROR_INVALID_LENGTH = 0x03, ++ MCTP_CONTROL_MSG_STATUS_ERROR_NOT_READY = 0x04, ++ MCTP_CONTROL_MSG_STATUS_ERROR_UNSUPPORTED_CMD = 0x05 ++}; ++ + /* packet buffers */ + + /* Allow a little space before the MCTP header in the packet, for bindings that +@@ -46,12 +82,14 @@ struct mctp_hdr { + #define MCTP_PKTBUF_SIZE (MCTP_PKTBUF_BINDING_PAD + \ + (sizeof(struct mctp_hdr) + MCTP_MTU)) + ++/* clang-format off */ + struct mctp_pktbuf { + unsigned char data[MCTP_PKTBUF_SIZE]; + uint8_t start, end; + uint8_t mctp_hdr_off; + struct mctp_pktbuf *next; + }; ++/* clang-format on */ + + struct mctp_pktbuf *mctp_pktbuf_alloc(uint8_t len); + void mctp_pktbuf_free(struct mctp_pktbuf *pkt); +@@ -85,6 +123,7 @@ int mctp_message_tx(struct mctp *mctp, mctp_eid_t eid, + void *msg, size_t msg_len); + + /* hardware bindings */ ++/* clang-format off */ + struct mctp_binding { + const char *name; + uint8_t version; +@@ -93,6 +132,7 @@ struct mctp_binding { + int (*tx)(struct mctp_binding *binding, + struct mctp_pktbuf *pkt); + }; ++/* clang-format on */ + + void mctp_binding_set_tx_enabled(struct mctp_binding *binding, bool enable); + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/crc32c.h b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/crc32c.h index d6b1d11e2..4586547e6 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/crc32c.h +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/crc32c.h @@ -1,9 +1,16 @@ #ifndef CRC32C_H #define CRC32C_H +#ifdef __cplusplus +extern "C" { +#endif + #include <stdint.h> #include <stdlib.h> uint32_t crc32c(uint8_t *buf, int len); +#ifdef __cplusplus +} +#endif #endif /* CRC32C_H */ diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/libmctp-smbus.h b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/libmctp-smbus.h index b3beadb0c..5ecaa6b74 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/libmctp-smbus.h +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/libmctp-smbus.h @@ -3,6 +3,10 @@ #ifndef _LIBMCTP_SMBUS_H #define _LIBMCTP_SMBUS_H +#ifdef __cplusplus +extern "C" { +#endif + #include "libmctp.h" struct mctp_binding_smbus; @@ -15,4 +19,9 @@ void mctp_smbus_register_bus(struct mctp_binding_smbus *smbus, int mctp_smbus_read(struct mctp_binding_smbus *smbus); int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, int root_bus_num); +void mctp_smbus_free(struct mctp_binding_smbus *smbus); + +#ifdef __cplusplus +} +#endif #endif /* _LIBMCTP_SMBUS_H */ diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c index 8679a5185..d7c396444 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp/smbus.c @@ -2,6 +2,7 @@ #include <assert.h> #include <stdbool.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -24,7 +25,6 @@ struct mctp_binding_smbus { struct mctp_binding binding; - struct mctp *mctp; int out_fd; int in_fd; @@ -50,6 +50,8 @@ struct mctp_binding_smbus { #define MCTP_SOURCE_SLAVE_ADDRESS 0x21 #define SMBUS_PEC_BYTE_SIZE 1 +#define SMBUS_COMMAND_CODE_SIZE 1 +#define SMBUS_LENGTH_FIELD_SIZE 1 struct mctp_smbus_header_tx { uint8_t source_slave_address; @@ -62,54 +64,133 @@ struct mctp_smbus_header_rx { uint8_t source_slave_address; }; +#define POLYCHECK (0x1070U << 3) +static uint8_t crc8_calculate(uint16_t d) +{ + int i; + + for (i = 0; i < 8; i++) { + if (d & 0x8000) { + d = d ^ POLYCHECK; + } + d = d << 1; + } + + return (uint8_t)(d >> 8); +} + +/* Incremental CRC8 over count bytes in the array pointed to by p */ +static uint8_t pec_calculate(uint8_t crc, uint8_t *p, size_t count) +{ + int i; + + for (i = 0; i < count; i++) { + crc = crc8_calculate((crc ^ p[i]) << 8); + } + + return crc; +} + +static uint8_t calculate_pec_byte(uint8_t *buf, size_t len, uint8_t address, + uint16_t flags) +{ + uint8_t addr = (address << 1) | (flags & I2C_M_RD ? 1 : 0); + uint8_t pec = pec_calculate(0, &addr, 1); + pec = pec_calculate(pec, buf, len); + + return pec; +} + +static int mctp_smbus_tx(struct mctp_binding_smbus *smbus, uint8_t len) +{ + +#ifdef I2C_M_HOLD + /* Hold message */ + static uint16_t holdtimeout = 1000; // timeout in ms. + struct i2c_msg msg[2] = +#else // !I2C_M_HOLD + struct i2c_msg msg[1] = +#endif // I2C_M_HOLD + {{.addr = MCTP_SLAVE_ADDRESS, + .flags = 0, + .len = len, + .buf = (__uint8_t *)smbus->txbuf} +#ifdef I2C_M_HOLD + , + {.addr = 0, + .flags = I2C_M_HOLD, + .len = sizeof(holdtimeout), + .buf = (__uint8_t *)&holdtimeout} +#endif // I2C_M_HOLD + }; + +#ifdef I2C_M_HOLD + struct i2c_rdwr_ioctl_data msgrdwr = {&msg, 2}; +#else // !I2C_M_HOLD + struct i2c_rdwr_ioctl_data msgrdwr = {&msg, 1}; +#endif // I2C_M_HOLD + + return ioctl(smbus->out_fd, I2C_RDWR, &msgrdwr); +} + +#ifdef I2C_M_HOLD +static int mctp_smbus_unhold_bus(struct mctp_binding_smbus *smbus) +{ + /* Unhold message */ + static uint16_t holdtimeout = 0; // unhold + struct i2c_msg holdmsg = {0, I2C_M_HOLD, sizeof(holdtimeout), + (__uint8_t *)&holdtimeout}; + + struct i2c_rdwr_ioctl_data msgrdwr = {&holdmsg, 1}; + + return ioctl(smbus->out_fd, I2C_RDWR, &msgrdwr); +} +#endif // I2C_M_HOLD + static int mctp_binding_smbus_tx(struct mctp_binding *b, struct mctp_pktbuf *pkt) { struct mctp_binding_smbus *smbus = binding_to_smbus(b); struct mctp_smbus_header_tx *hdr; - uint8_t *buf; - size_t len; - int r; - struct i2c_msg msg; - struct i2c_rdwr_ioctl_data data; + size_t pkt_length; - data.msgs = &msg; - data.nmsgs = 1; + uint8_t i2c_message_buf[256]; + uint8_t *buf_ptr; + uint8_t i2c_message_len; uint16_t timeout = 1000; - int i; /* the length field in the header excludes smbus framing * and escape sequences */ - len = mctp_pktbuf_size(pkt); + pkt_length = mctp_pktbuf_size(pkt); - hdr = (void *)smbus->txbuf; + buf_ptr = (void *)smbus->txbuf; + *buf_ptr = MCTP_COMMAND_CODE; + buf_ptr++; + *buf_ptr = pkt_length + sizeof(*hdr); + buf_ptr++; - // hdr->len = len + 1; // +1 for PET byte + hdr = (void *)buf_ptr; hdr->source_slave_address = MCTP_SOURCE_SLAVE_ADDRESS; + buf_ptr = (buf_ptr + sizeof(*hdr)); + memcpy(buf_ptr, &pkt->data[pkt->start], pkt_length); + buf_ptr = buf_ptr + pkt_length; - buf = (void *)(hdr + sizeof(*hdr)); + uint8_t pec_byte = calculate_pec_byte( + smbus->txbuf, + SMBUS_COMMAND_CODE_SIZE + SMBUS_LENGTH_FIELD_SIZE + sizeof(*hdr) + + pkt_length, + MCTP_SLAVE_ADDRESS, 0); - if (len + sizeof(*hdr) > sizeof(smbus->txbuf)) - return -1; - - memcpy(buf, &pkt->data[pkt->start], len); + *buf_ptr = pec_byte; - buf += len; + i2c_message_len = SMBUS_COMMAND_CODE_SIZE + SMBUS_LENGTH_FIELD_SIZE + + sizeof(*hdr) + pkt_length + + SMBUS_PEC_BYTE_SIZE; // command code, length, + // header, data, pec byte - if (ioctl(smbus->out_fd, I2C_SLAVE, MCTP_SLAVE_ADDRESS) < 0) { - mctp_prerr("Can't set slave"); - return -1; - } - if (ioctl(smbus->out_fd, I2C_PEC, 1) < 0) { - mctp_prerr("Cant set PEC byte"); - return -1; - } - - if (i2c_smbus_write_block_data(smbus->out_fd, MCTP_COMMAND_CODE, - sizeof(*hdr) + len, (void *)smbus->txbuf) - < 0) { - mctp_prerr("Failed to send"); + if (mctp_smbus_tx(smbus, i2c_message_len)) { + mctp_prerr("Can't hold mux"); return -1; } @@ -119,64 +200,83 @@ static int mctp_binding_smbus_tx(struct mctp_binding *b, #ifdef MCTP_FILEIO int mctp_smbus_read(struct mctp_binding_smbus *smbus) { - ssize_t len; - int r; + ssize_t len = 0; struct mctp_smbus_header_rx *hdr; + int ret = 0; - r = lseek(smbus->in_fd, 0, SEEK_SET); - if (r < 0) { - mctp_prerr("Failed to seek"); - return -1; - } - len = read(smbus->in_fd, smbus->rxbuf, sizeof(smbus->rxbuf)); - if (len < sizeof(*hdr)) { - // TODO Don't return an error here, as it seems to happen from - // time to time, even with a properly written poll loop, - // although it's not clear why. - return 0; - } + do { + ret = lseek(smbus->in_fd, 0, SEEK_SET); + if (ret < 0) { + mctp_prerr("Failed to seek"); + ret = -1; + } - hdr = (void *)smbus->rxbuf; - if (hdr->destination_slave_address - != (MCTP_SOURCE_SLAVE_ADDRESS & ~1)) { - mctp_prerr("Got bad slave address %d", - hdr->destination_slave_address); - return 0; - } - if (hdr->command_code != MCTP_COMMAND_CODE) { - mctp_prerr("Got bad command code %d", hdr->command_code); - // Not a payload intended for us - return 0; - } + len = read(smbus->in_fd, smbus->rxbuf, sizeof(smbus->rxbuf)); + if (len < sizeof(*hdr)) { + // This condition hits from from time to time, even with + // a properly written poll loop, although it's not clear + // why. Return an error so that the upper layer can + // retry. + ret = 0; + break; + } - if (hdr->byte_count != (len - sizeof(*hdr))) { - // Got an incorrectly sized payload - mctp_prerr("Got smbus payload sized %d, expecting %d", - hdr->byte_count, len - sizeof(*hdr)); - return 0; - } + hdr = (void *)smbus->rxbuf; + if (hdr->destination_slave_address + != (MCTP_SOURCE_SLAVE_ADDRESS & ~1)) { + mctp_prerr("Got bad slave address %d", + hdr->destination_slave_address); + ret = 0; + break; + } + if (hdr->command_code != MCTP_COMMAND_CODE) { + mctp_prerr("Got bad command code %d", + hdr->command_code); + // Not a payload intended for us + ret = 0; + break; + } - if (len < 0) { - mctp_prerr("can't read from smbus device: %m"); - return -1; - } + if (hdr->byte_count != (len - sizeof(*hdr))) { + // Got an incorrectly sized payload + mctp_prerr("Got smbus payload sized %d, expecting %d", + hdr->byte_count, len - sizeof(*hdr)); + ret = 0; + break; + } - smbus->rx_pkt = mctp_pktbuf_alloc(0); - assert(smbus->rx_pkt); + if (len < 0) { + mctp_prerr("can't read from smbus device: %m"); + ret = -1; + break; + } - if (mctp_pktbuf_push(smbus->rx_pkt, &smbus->rxbuf[sizeof(*hdr)], - len - sizeof(*hdr) - SMBUS_PEC_BYTE_SIZE) - != 0) { - mctp_prerr("Can't push tok pktbuf: %m"); - return -1; - } + smbus->rx_pkt = mctp_pktbuf_alloc(0); + assert(smbus->rx_pkt); + + if (mctp_pktbuf_push(smbus->rx_pkt, &smbus->rxbuf[sizeof(*hdr)], + len - sizeof(*hdr) - SMBUS_PEC_BYTE_SIZE) + != 0) { + mctp_prerr("Can't push tok pktbuf: %m"); + ret = -1; + break; + } - mctp_bus_rx(&(smbus->binding), smbus->rx_pkt); + mctp_bus_rx(&(smbus->binding), smbus->rx_pkt); - mctp_pktbuf_free(smbus->rx_pkt); - smbus->rx_pkt = NULL; + mctp_pktbuf_free(smbus->rx_pkt); + smbus->rx_pkt = NULL; - return 0; + } while (0); + +#ifdef I2C_M_HOLD + if (mctp_smbus_unhold_bus(smbus)) { + mctp_prerr("Can't hold mux"); + ret = -1; + } +#endif // I2C_M_HOLD + + return ret; } int mctp_smbus_get_in_fd(struct mctp_binding_smbus *smbus) @@ -193,17 +293,13 @@ int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, int root_bus_num) { char filename[60]; - size_t filename_size; + size_t filename_size = 0; char slave_mqueue[20]; - size_t mqueue_size; - - int fd; - - size_t size; - int address_7_bit; + size_t mqueue_size = 0; + int fd = 0; + size_t size = sizeof(filename); + int address_7_bit = MCTP_SOURCE_SLAVE_ADDRESS >> 1; - address_7_bit = MCTP_SOURCE_SLAVE_ADDRESS >> 1; - size = sizeof(filename); snprintf(filename, size, "/sys/bus/i2c/devices/i2c-%d/%d-%04x/slave-mqueue", root_bus_num, root_bus_num, @@ -263,7 +359,6 @@ int mctp_smbus_open_bus(struct mctp_binding_smbus *smbus, int out_bus_num, return 0; } - #endif void mctp_smbus_register_bus(struct mctp_binding_smbus *smbus, @@ -271,8 +366,8 @@ void mctp_smbus_register_bus(struct mctp_binding_smbus *smbus, { assert(smbus->out_fd >= 0); assert(smbus->in_fd >= 0); - smbus->mctp = mctp; smbus->bus_id = mctp_register_bus(mctp, &smbus->binding, eid); + mctp_binding_set_tx_enabled(&smbus->binding, true); } struct mctp_binding_smbus *mctp_smbus_init(void) @@ -291,3 +386,8 @@ struct mctp_binding_smbus *mctp_smbus_init(void) return smbus; } + +void mctp_smbus_free(struct mctp_binding_smbus *smbus) +{ + __mctp_free(smbus); +}
\ No newline at end of file diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb index d9359cfeb..a678fe72f 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb @@ -13,11 +13,14 @@ inherit cmake S = "${WORKDIR}/git" -DEPENDS = "i2c-tools" +DEPENDS += "i2c-tools" + +CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include/uapi" +CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI += "file://0001-Add-smbus-support-to-Cmake-Lists.patch \ +SRC_URI += "file://0001-Smbus-changes-for-libmctp.patch \ file://crc32c.c \ file://crc32c.h \ file://libmctp-smbus.h \ @@ -28,3 +31,10 @@ do_configure_prepend() { cp -f ${WORKDIR}/*.h ${S} } +# linux-libc-headers guides this way to include custom uapi headers +CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include/uapi" +CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" +CXXFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include/uapi" +CXXFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" + +do_configure[depends] += "virtual/kernel:do_shared_workdir"
\ No newline at end of file diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend index 53fc218c6..19f2980c9 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend @@ -1,2 +1,3 @@ +EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DINTEL_PFR_ENABLED=ON', '', d)}" SRC_URI = "git://github.com/openbmc/intel-ipmi-oem.git" -SRCREV = "773703a58db91f69f2ecb32d3c69d9984fba504e" +SRCREV = "ca99ef5912b9296e09c8f9cb246ce291f9970750" diff --git a/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check.bb b/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check.bb new file mode 100644 index 000000000..955ed1921 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check.bb @@ -0,0 +1,26 @@ +SUMMARY = "Kernel panic Check" +DESCRIPTION = "script tool to check if the reboot is caused by kernel panic \ + log the kernel panic to systemd journal, and also log to redfish \ + " + +S = "${WORKDIR}" +SRC_URI = "file://kernel-panic-check.sh \ + file://kernel-panic-check.service \ +" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" +RDEPENDS_${PN} += "bash logger-systemd" + +inherit systemd + +FILES_${PN} += "${systemd_system_unitdir}/kernel-panic-check.service" + +do_install() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/kernel-panic-check.service ${D}${systemd_system_unitdir} + install -d ${D}${bindir} + install -m 0755 ${S}/kernel-panic-check.sh ${D}/${bindir}/kernel-panic-check.sh +} + +SYSTEMD_SERVICE_${PN} += " kernel-panic-check.service" diff --git a/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check/kernel-panic-check.service b/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check/kernel-panic-check.service new file mode 100644 index 000000000..afe017baf --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check/kernel-panic-check.service @@ -0,0 +1,9 @@ +[Unit] +Description=Check for kernel panic + +[Service] +Type=oneshot +ExecStart=/usr/bin/kernel-panic-check.sh + +[Install] +WantedBy=multi-user.target diff --git a/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check/kernel-panic-check.sh b/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check/kernel-panic-check.sh new file mode 100755 index 000000000..815f50b71 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check/kernel-panic-check.sh @@ -0,0 +1,16 @@ +#!/bin/sh +panicFile="/sys/fs/pstore/dmesg-ramoops-0" +if [ -f $panicFile ] +then + # log the detailed last kernel panic messages + logger -t kernel-panic-check "Reboot from kernel panic! Log as following:" + cat $panicFile | logger + # Also log it to redfish + cat <<EOF | logger-systemd --journald +REDFISH_MESSAGE_ID=OpenBMC.0.1.BMCKernelPanic +PRIORITY=4 +MESSAGE=BMC rebooted due to kernel panic +EOF + + rm -rf $panicFile +fi diff --git a/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb b/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb new file mode 100644 index 000000000..22a5058c2 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/libpeci/libpeci_git.bb @@ -0,0 +1,17 @@ +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" +inherit cmake + +SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" + +PV = "0.1+git${SRCPV}" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" + +S = "${WORKDIR}/git/libpeci" + +# linux-libc-headers guides this way to include custom uapi headers +CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include/uapi" +CFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" +CXXFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include/uapi" +CXXFLAGS_append = " -I ${STAGING_KERNEL_DIR}/include" +do_configure[depends] += "virtual/kernel:do_shared_workdir" diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd.inc b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd.inc new file mode 100644 index 000000000..abad9d12d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd.inc @@ -0,0 +1,43 @@ +SUMMARY = "logger tool in util-linux with systemd support" +HOMEPAGE = "http://userweb.kernel.org/~kzak/util-linux/" +DESCRIPTION = "logger tool with systemd support, used to add log to systemd journald." + +SECTION = "base" + +LICENSE = "GPLv2+ & LGPLv2.1+ & BSD-3-Clause & BSD-4-Clause" + +LIC_FILES_CHKSUM = "file://README.licensing;md5=972a134f1e14b2b060e365df2fab0099 \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \ + file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af \ + file://Documentation/licenses/COPYING.BSD-4-Clause-UC;md5=263860f8968d8bafa5392cab74285262 \ + file://libuuid/COPYING;md5=6d2cafc999feb2c2de84d4d24b23290c \ + file://libmount/COPYING;md5=7c7e39fb7d70ffe5d693a643e29987c2 \ + file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04" + +inherit autotools gettext pkgconfig +DEPENDS = "libcap-ng ncurses virtual/crypt zlib systemd " +#DEPENDS_intel-ast2500 += " systemd " +#RDEPENDS_${PN} += " libsystemd" + +MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}" +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${MAJOR_VERSION}.tar.xz \ + " + +S = "${WORKDIR}/util-linux-${MAJOR_VERSION}" + +EXTRA_OECONF = " --disable-nls --disable-all-programs \ + --disable-libuuid --disable-libblkid --disable-libmount \ + --disable-libsmartcols --disable-libfdisk --disable-pylibmount \ + --with-systemd \ + --enable-logger \ + " + +do_install_append () { + mv ${D}${bindir}/logger ${D}${bindir}/logger-systemd + rm -rf ${D}${sbindir} + rm -rf ${D}${base_libdir} + rm -rf ${D}${libdir} + rm -rf ${D}${datadir} +} diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/avoid_parallel_tests.patch b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/avoid_parallel_tests.patch new file mode 100644 index 000000000..748b6ef09 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/avoid_parallel_tests.patch @@ -0,0 +1,20 @@ +Ptest needs buildtest-TESTS and runtest-TESTS targets. +serial-tests is required to generate those targets. +Revert run.sh script accordingly to serialize running tests + +Signed-off-by: Tudor Florea <tudor.florea@enea.com> +Upstream-Status: Inappropriate + +Index: util-linux-2.32/configure.ac +=================================================================== +--- util-linux-2.32.orig/configure.ac ++++ util-linux-2.32/configure.ac +@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4]) + dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run + dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors. + AC_USE_SYSTEM_EXTENSIONS +-AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects]) ++AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests]) + + m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], + [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/configure-sbindir.patch b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/configure-sbindir.patch new file mode 100644 index 000000000..e475289f6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/configure-sbindir.patch @@ -0,0 +1,23 @@ +util-linux: take ${sbindir} from the environment if it is set there +fix the test, the [ ] syntax was getting eaten by autoconf + +Signed-off-by: Phil Blundell <pb@pbcl.net> +Signed-off-by: Saul Wold <sgw@linux.intel.com +Upstream-Status: Inappropriate [configuration] + +Index: util-linux-2.31/configure.ac +=================================================================== +--- util-linux-2.31.orig/configure.ac ++++ util-linux-2.31/configure.ac +@@ -89,7 +89,10 @@ AC_SUBST([runstatedir]) + usrbin_execdir='${exec_prefix}/bin' + AC_SUBST([usrbin_execdir]) + +-usrsbin_execdir='${exec_prefix}/sbin' ++if test -z "$usrsbin_execdir" ; ++then ++ usrsbin_execdir='${exec_prefix}/sbin' ++fi + AC_SUBST([usrsbin_execdir]) + + AS_CASE([$libdir], diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/display_testname_for_subtest.patch b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/display_testname_for_subtest.patch new file mode 100644 index 000000000..417ca1d98 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/display_testname_for_subtest.patch @@ -0,0 +1,25 @@ +Display testname for subtest + +Signed-off-by: Tudor Florea <tudor.florea@enea.com> +Upstream-Status: Pending + +--- + tests/functions.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/functions.sh b/tests/functions.sh +index 5246605..b24dc15 100644 +--- a/tests/functions.sh ++++ b/tests/functions.sh +@@ -320,7 +320,7 @@ function ts_init_subtest { + + if [ "$TS_PARSABLE" != "yes" ]; then + [ $TS_NSUBTESTS -eq 1 ] && echo +- printf "%16s: %-27s ..." "" "$TS_SUBNAME" ++ printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_SUBNAME" + fi + } + +-- +2.8.3 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/ptest.patch b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/ptest.patch new file mode 100644 index 000000000..0537f7d85 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/ptest.patch @@ -0,0 +1,23 @@ +Define TESTS variable + +Signed-off-by: Tudor Florea <tudor.florea@enea.com> +Upstream-Status: Pending +--- + Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Makefile.am b/Makefile.am +index bbaccb1..7d5a6bb 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -48,6 +48,7 @@ systemdsystemunit_DATA = + dist_bashcompletion_DATA = + check_PROGRAMS = + dist_check_SCRIPTS = ++TESTS = $(check_PROGRAMS) + + PATHFILES = + +-- +2.8.3 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/run-ptest b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/run-ptest new file mode 100644 index 000000000..e135ee583 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/run-ptest @@ -0,0 +1,43 @@ +#!/bin/sh + + +# When udevd (from eudev) is running most eject/mount tests will fail because +# of automount. We need to stop udevd before executing util-linux's tests. +# The systemd-udevd daemon doesn't change the outcome of util-linux's tests. +UDEV_PID="`pidof "@base_sbindir@/udevd"`" +if [ "x$UDEV_PID" != "x" ]; then + /etc/init.d/udev stop +fi + +current_path=$(readlink -f $0) +export bindir=$(dirname $current_path) +export PATH=$bindir/bin:$PATH + +cd tests || exit 1 + +comps=$(find ts/ -type f -perm -111 -regex ".*/[^\.~]*" | sort) + + +echo +echo "-------------------- util-linux regression tests --------------------" +echo +echo " For development purpose only. " +echo " Don't execute on production system! " +echo + +res=0 +count=0 +for ts in $comps; +do + $ts | sed -u '{ + s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/ + s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/ + s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/ + }' +done + + +if [ "x$UDEV_PID" != "x" ]; then + /etc/init.d/udev start +fi + diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/runuser-l.pamd b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/runuser-l.pamd new file mode 100644 index 000000000..4b368ccf5 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/runuser-l.pamd @@ -0,0 +1,3 @@ +auth include runuser +session optional pam_keyinit.so force revoke +session include runuser diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/runuser.pamd b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/runuser.pamd new file mode 100644 index 000000000..48d133b9e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd/runuser.pamd @@ -0,0 +1,4 @@ +auth sufficient pam_rootok.so +session optional pam_keyinit.so revoke +session required pam_limits.so +session required pam_unix.so diff --git a/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd_2.34.bb b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd_2.34.bb new file mode 100644 index 000000000..b58628667 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/logger-systemd/logger-systemd_2.34.bb @@ -0,0 +1,12 @@ +require logger-systemd.inc + +SRC_URI += "file://configure-sbindir.patch \ + file://runuser.pamd \ + file://runuser-l.pamd \ + file://ptest.patch \ + file://run-ptest \ + file://display_testname_for_subtest.patch \ + file://avoid_parallel_tests.patch \ +" +SRC_URI[md5sum] = "a78cbeaed9c39094b96a48ba8f891d50" +SRC_URI[sha256sum] = "743f9d0c7252b6db246b659c1e1ce0bd45d8d4508b4dfa427bbb4a3e9b9f62b5"
\ No newline at end of file diff --git a/meta-openbmc-mods/meta-common/recipes-core/microsoft-gsl/microsoft-gsl.bb b/meta-openbmc-mods/meta-common/recipes-core/microsoft-gsl/microsoft-gsl.bb index 8cb593bce..f8e5505ef 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/microsoft-gsl/microsoft-gsl.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/microsoft-gsl/microsoft-gsl.bb @@ -4,7 +4,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://LICENSE;md5=363055e71e77071107ba2bb9a54bd9a7" -SRC_URI = "git://github.com/Microsoft/GSL.git;protocol=https" +SRC_URI = "git://github.com/Microsoft/GSL.git;protocol=https;nobranch=1" # Modify these as desired PV = "1.0+git${SRCPV}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/os-release/version-vars.inc b/meta-openbmc-mods/meta-common/recipes-core/os-release/version-vars.inc index b6a2504a2..0c8f3be56 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/os-release/version-vars.inc +++ b/meta-openbmc-mods/meta-common/recipes-core/os-release/version-vars.inc @@ -67,7 +67,7 @@ python() { d.setVar('VERSION', version) d.setVar('IPMI_MAJOR', versionList[1]) d.setVar('IPMI_MINOR', versionList[2]) - d.setVar('IPMI_AUX13', hex(int(versionList[3]))) + d.setVar('IPMI_AUX13', hex(min(int(versionList[3]), 0xff))) d.setVar('IPMI_AUX14', '0x{}'.format(meta_hash[0:2])) d.setVar('IPMI_AUX15', '0x{}'.format(meta_hash[2:4])) d.setVar('IPMI_AUX16', '0x{}'.format(meta_hash[4:6])) diff --git a/meta-openbmc-mods/meta-common/recipes-core/peci-pcie/peci-pcie_git.bb b/meta-openbmc-mods/meta-common/recipes-core/peci-pcie/peci-pcie_git.bb index e19e5fc93..10b34354c 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/peci-pcie/peci-pcie_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/peci-pcie/peci-pcie_git.bb @@ -7,10 +7,10 @@ inherit cmake systemd SRC_URI = "git://git@github.com/Intel-BMC/at-scale-debug;protocol=ssh" -DEPENDS = "boost sdbusplus crashdump" +DEPENDS = "boost sdbusplus libpeci" PV = "0.1+git${SRCPV}" -SRCREV = "6ed87657134c7379da1febcccd5d87617c702347" +SRCREV = "20016caebaac78c3290462ffa8df10c2efd61261" S = "${WORKDIR}/git/peci_pcie" diff --git a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb b/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb index a6d94fc51..646d9612f 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb @@ -7,7 +7,7 @@ SECTION = "lib" inherit autotools pkgconfig S = "${WORKDIR}/git" -SRCREV = "f1708afcbba69f75e80920b75aa3d7baee3f611d" +SRCREV = "5d92be815bf35137eb31fb653e435321a511311c" SRC_URI = "git://github.com/rurban/safeclib.git" COMPATIBLE_HOST = '(x86_64|i.86|powerpc|powerpc64|arm|aarch64).*-linux' diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/000-ro-rootfs-tmpfile-defaults.patch b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/000-ro-rootfs-tmpfile-defaults.patch deleted file mode 100644 index d16f3a2dc..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/000-ro-rootfs-tmpfile-defaults.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 05e1b853abfd54d117dad25185c602d1791d83f6 Mon Sep 17 00:00:00 2001 -From: David Cobbley <david.j.cobbley@linux.intel.com> -Date: Tue, 26 Jun 2018 16:10:14 -0700 -Subject: [PATCH] ro-rootfs-tmpfile-defaults - ---- - tmpfiles.d/home.conf | 1 - - tmpfiles.d/tmp.conf | 1 - - tmpfiles.d/var.conf.m4 | 5 ++++- - 3 files changed, 4 insertions(+), 3 deletions(-) - -diff --git a/tmpfiles.d/home.conf b/tmpfiles.d/home.conf -index 9f25b83..5c7513a 100644 ---- a/tmpfiles.d/home.conf -+++ b/tmpfiles.d/home.conf -@@ -8,4 +8,3 @@ - # See tmpfiles.d(5) for details - - Q /home 0755 - - - --q /srv 0755 - - - -diff --git a/tmpfiles.d/tmp.conf b/tmpfiles.d/tmp.conf -index 22555a0..aad1b98 100644 ---- a/tmpfiles.d/tmp.conf -+++ b/tmpfiles.d/tmp.conf -@@ -9,7 +9,6 @@ - - # Clear tmp directories separately, to make them easier to override - q /tmp 1777 root root 10d --q /var/tmp 1777 root root 30d - - # Exclude namespace mountpoints created with PrivateTmp=yes - x /tmp/systemd-private-%b-* -diff --git a/tmpfiles.d/var.conf.m4 b/tmpfiles.d/var.conf.m4 -index 0e2c509..fa288b8 100644 ---- a/tmpfiles.d/var.conf.m4 -+++ b/tmpfiles.d/var.conf.m4 -@@ -11,7 +11,10 @@ q /var 0755 - - - - - L /var/run - - - - ../run - --d /var/log 0755 - - - -+# now /var/log and /var/tmp really live in volatile -+L /var/log - - - - volatile/log -+L /var/tmp - - - - volatile/tmp -+ - m4_ifdef(`ENABLE_UTMP', - f /var/log/wtmp 0664 root utmp - - f /var/log/btmp 0660 root utmp - --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch index f72052e0c..5b9f17006 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch +++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch @@ -1,4 +1,4 @@ -From 3016898f4300fdd8db74f821cd6ea54dbf39fdc8 Mon Sep 17 00:00:00 2001 +From e02932693f92d6230b5520f431e127f7b6e2183e Mon Sep 17 00:00:00 2001 From: James Feist <james.feist@linux.intel.com> Date: Tue, 6 Mar 2018 16:06:33 -0800 Subject: [PATCH 1/1] Modfiy system.conf DefaultTimeoutStopSec @@ -7,22 +7,22 @@ Current time is 5 minutes, change it to 10 seconds. Signed-off-by: James Feist <james.feist@linux.intel.com> --- - src/core/system.conf | 2 +- + src/core/system.conf.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/system.conf.in b/src/core/system.conf.in -index 746572b..ba2a265 100644 +index 8112125468..f7a35a56bb 100644 --- a/src/core/system.conf.in +++ b/src/core/system.conf.in -@@ -33,7 +33,7 @@ +@@ -39,7 +39,7 @@ #DefaultStandardOutput=journal #DefaultStandardError=inherit #DefaultTimeoutStartSec=90s -#DefaultTimeoutStopSec=90s +DefaultTimeoutStopSec=10s + #DefaultTimeoutAbortSec= #DefaultRestartSec=100ms #DefaultStartLimitIntervalSec=10s - #DefaultStartLimitBurst=5 -- -2.7.4 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/systemd-timesyncd.service b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/systemd-timesyncd.service deleted file mode 100644 index 9a5fffbb3..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/systemd-timesyncd.service +++ /dev/null @@ -1,53 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Network Time Synchronization -Documentation=man:systemd-timesyncd.service(8) -ConditionCapability=CAP_SYS_TIME -ConditionVirtualization=!container -DefaultDependencies=no -After=systemd-remount-fs.service systemd-sysusers.service var.mount -Before=time-set.target sysinit.target shutdown.target -Conflicts=shutdown.target -Wants=time-set.target time-sync.target - -[Service] -AmbientCapabilities=CAP_SYS_TIME -CapabilityBoundingSet=CAP_SYS_TIME -ExecStart=!!/lib/systemd/systemd-timesyncd -LockPersonality=yes -MemoryDenyWriteExecute=yes -NoNewPrivileges=yes -PrivateDevices=yes -PrivateTmp=yes -ProtectControlGroups=yes -ProtectHome=yes -ProtectHostname=yes -ProtectKernelModules=yes -ProtectKernelTunables=yes -ProtectSystem=strict -Restart=always -RestartSec=0 -RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 -RestrictNamespaces=yes -RestrictRealtime=yes -RestrictSUIDSGID=yes -RuntimeDirectory=systemd/timesync -StateDirectory=systemd/timesync -SystemCallArchitectures=native -SystemCallErrorNumber=EPERM -SystemCallFilter=@system-service @clock -Type=notify -User=systemd-timesync -WatchdogSec=3min - -[Install] -WantedBy=sysinit.target -Alias=dbus-org.freedesktop.timesync1.service diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend index 3e5adf7ce..d80714589 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend @@ -4,8 +4,7 @@ LICENSE = "GPL-2.0" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI += "file://000-ro-rootfs-tmpfile-defaults.patch \ - file://0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch \ +SRC_URI += "file://0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch \ file://systemd-time-wait-sync.service \ " diff --git a/meta-openbmc-mods/meta-common/recipes-devtools/dtoverlay/dtoverlay.bb b/meta-openbmc-mods/meta-common/recipes-devtools/dtoverlay/dtoverlay.bb deleted file mode 100644 index 66107d81b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-devtools/dtoverlay/dtoverlay.bb +++ /dev/null @@ -1,31 +0,0 @@ -SUMMARY = "dtoverlay" -DESCRIPTION = "device tree overlay application" - -SRC_URI = "git://github.com/raspberrypi/userland.git" -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://LICENCE;md5=0448d6488ef8cc380632b1569ee6d196" - -SRCREV = "11389772c79685442e0ab8aa9be8ad0e32703f68" -requires = "chrpath-native" - -S = "${WORKDIR}/git" - -PV = "1" - -inherit cmake - -FILES_${PN} += "${libdir} ${libdir}libdtovl.so.${PV}" - -do_compile_append(){ - chrpath -d ${S}/build/bin/dtoverlay -} - -do_install() { - install -d ${D}${libdir} - install -m 0644 ${S}/build/lib/libdtovl.so ${D}${libdir}/libdtovl.so.${PV} - install -d ${D}${bindir} - install -m 0755 ${S}/build/bin/dtoverlay ${D}${bindir}/dtoverlay - - ln -sf libdtovl.so.${PV} ${D}{libdir}libdtovl.so -} - diff --git a/meta-openbmc-mods/meta-common/recipes-extended/rsyslog/rsyslog/rsyslog.conf b/meta-openbmc-mods/meta-common/recipes-extended/rsyslog/rsyslog/rsyslog.conf index f00046b45..46a287eef 100644 --- a/meta-openbmc-mods/meta-common/recipes-extended/rsyslog/rsyslog/rsyslog.conf +++ b/meta-openbmc-mods/meta-common/recipes-extended/rsyslog/rsyslog/rsyslog.conf @@ -44,6 +44,18 @@ template(name="RedfishTemplate" type="list") { constant(value="\n") } +# Template for Application Crashes +# "<timestamp> <MessageId>,<MessageArgs>" +template(name="CrashTemplate" type="list") { + property(name="timereported" dateFormat="rfc3339") + constant(value=" ") + constant(value="OpenBMC.0.1.ServiceFailure") + constant(value=",") + property(name="$!UNIT") + constant(value="\n") +} + + # If the journal entry has the IPMI SEL MESSAGE_ID, save as IPMI SEL # The MESSAGE_ID string is generated using journalctl and must match the # MESSAGE_ID used in IPMI to correctly find the SEL entries. @@ -56,6 +68,11 @@ if ($!REDFISH_MESSAGE_ID != "") then { action(type="omfile" file="/var/log/redfish" template="RedfishTemplate") } +# If the journal entry has a Exit Code, save as a Redfish event +if ($!EXIT_STATUS != "" and $!EXIT_STATUS != "0") then { + action(type="omfile" file="/var/log/redfish" template="CrashTemplate") +} + # # Include all config files in /etc/rsyslog.d/ # diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend index 0d9012235..000b24b39 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend @@ -2,4 +2,4 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" # Use the latest to support obmc-ikvm properly #SRC_URI = "git://github.com/LibVNC/libvncserver" -SRCREV = "091b9eb739a95c8c969e2e6865c255b0d170f95f" +SRCREV = "864c2fd337029c92959303f4348099b31eec0aed" diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0001-Add-flow-control-to-prevent-buffer-over-run.patch b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0001-Add-flow-control-to-prevent-buffer-over-run.patch deleted file mode 100644 index 70f2da4a0..000000000 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0001-Add-flow-control-to-prevent-buffer-over-run.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 88337ce8246a453cd3c6e60e96aead43549a5e1d Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> -Date: Thu, 9 May 2019 16:26:53 -0700 -Subject: [PATCH] Add flow control to prevent buffer over run - -This service uses direct frame update with bypassing image -compression and invalidating logic in libvncserver to achieve -better performance by using of H/W compressed JPEG frames as those -come from the video engine driver. - -This behavior helps quick frame update using very small amount of -CPU resources but it causes a side effect which crashes bmcweb -by OOM killer due to a buffer over run issue. Usually, this issue -happens often in a slow speed connection because this service -keeps sending all frames without any handshaking with clients so -a session buffer in the bmcweb gets bigger and bigger since the -low speed connection can't send all stream data on time. - -To fix this issue, this commit adds flow control logic to make -frame updating handshakes with client so that it'll send frames -only when it recieved client frame update messages. All other -frames when the client doesn't request will be dropped out to -prevent the buffer over run issue. - -Tested: -bmcweb didn't keep increasing its KVM session buffer. -KVM worked well with showing good refresh speed. - -resolves https://github.com/openbmc/bmcweb/issues/80 - -Change-Id: I6b09a711137d15a38fce59adada9bf3d00afde86 -Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> ---- - ikvm_server.cpp | 20 ++++++++++++++++++++ - ikvm_server.hpp | 11 +++++++++++ - 2 files changed, 31 insertions(+) - -diff --git a/ikvm_server.cpp b/ikvm_server.cpp -index 35310da292be..dfafe3a82e64 100644 ---- a/ikvm_server.cpp -+++ b/ikvm_server.cpp -@@ -119,6 +119,12 @@ void Server::sendFrame() - continue; - } - -+ if (!cd->needUpdate) -+ { -+ continue; -+ } -+ cd->needUpdate = false; -+ - if (cl->enableLastRectEncoding) - { - fu->nRects = 0xFFFF; -@@ -149,6 +155,19 @@ void Server::sendFrame() - rfbReleaseClientIterator(it); - } - -+void Server::clientFramebufferUpdateRequest( -+ rfbClientPtr cl, rfbFramebufferUpdateRequestMsg *furMsg) -+{ -+ ClientData *cd = (ClientData *)cl->clientData; -+ -+ if (!cd) -+ return; -+ -+ // Ignore the furMsg info. This service uses full frame update always. -+ -+ cd->needUpdate = true; -+} -+ - void Server::clientGone(rfbClientPtr cl) - { - Server* server = (Server*)cl->screen->screenData; -@@ -170,6 +189,7 @@ enum rfbNewClientAction Server::newClient(rfbClientPtr cl) - cl->clientData = - new ClientData(server->video.getFrameRate(), &server->input); - cl->clientGoneHook = clientGone; -+ cl->clientFramebufferUpdateRequestHook = clientFramebufferUpdateRequest; - if (!server->numClients++) - { - server->pendingResize = false; -diff --git a/ikvm_server.hpp b/ikvm_server.hpp -index b8062017b8ca..ebe4ad2b287e 100644 ---- a/ikvm_server.hpp -+++ b/ikvm_server.hpp -@@ -32,6 +32,7 @@ class Server - */ - ClientData(int s, Input* i) : skipFrame(s), input(i) - { -+ needUpdate = false; - } - ~ClientData() = default; - ClientData(const ClientData&) = default; -@@ -41,6 +42,7 @@ class Server - - int skipFrame; - Input* input; -+ bool needUpdate; - }; - - /* -@@ -85,6 +87,15 @@ class Server - - private: - /* -+ * @brief Handler for a client frame update message -+ * -+ * @param[in] cl - Handle to the client object -+ * @param[in] furMsg - Pointer of the FUR message -+ */ -+ static void -+ clientFramebufferUpdateRequest(rfbClientPtr cl, -+ rfbFramebufferUpdateRequestMsg *furMsg); -+ /* - * @brief Handler for a client disconnecting - * - * @param[in] cl - Handle to the client object --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch new file mode 100644 index 000000000..43600ac8a --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch @@ -0,0 +1,162 @@ +From 0c0b7b5da551c99161bda98820a529ba29cbaac1 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> +Date: Wed, 21 Aug 2019 16:52:30 -0700 +Subject: [PATCH] Fix keyboard and mouse input events dropping issue + +Restarting of HID input devices causes input events dropping issue +which is critical for BMC KVM uses. For an example, user can't enter +to BIOS by doing keep pressing 'F2' or 'Del' key because of this issue. + +To fix the issue, this commit removes the input device restarting +logic and refines error log journaling logic using errno checking. + +Tested: + 1. Open BMCweb -> Server control -> KVM. + 2. Make a host reset and keep pressing 'F2' key. + 3. Was able to enter to BIOS using the key press. + +Change-Id: Iec1bfad1d9e5825858844cab658bbfa3e6bc24f6 +Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> +--- + ikvm_input.cpp | 58 +++++++--------------------------------------------------- + ikvm_input.hpp | 4 ---- + ikvm_video.cpp | 3 +-- + 3 files changed, 8 insertions(+), 57 deletions(-) + +diff --git a/ikvm_input.cpp b/ikvm_input.cpp +index d95e6313f62c..df12f2715585 100644 +--- a/ikvm_input.cpp ++++ b/ikvm_input.cpp +@@ -23,9 +23,9 @@ using namespace phosphor::logging; + using namespace sdbusplus::xyz::openbmc_project::Common::File::Error; + + Input::Input(const std::string& kbdPath, const std::string& ptrPath) : +- pointerError(false), sendKeyboard(false), sendPointer(false), +- keyboardFd(-1), pointerFd(-1), keyboardReport{0}, pointerReport{0}, +- keyboardPath(kbdPath), pointerPath(ptrPath) ++ sendKeyboard(false), sendPointer(false), keyboardFd(-1), pointerFd(-1), ++ keyboardReport{0}, pointerReport{0}, keyboardPath(kbdPath), ++ pointerPath(ptrPath) + { + if (!keyboardPath.empty()) + { +@@ -156,36 +156,6 @@ void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) + rfbDefaultPtrAddEvent(buttonMask, x, y, cl); + } + +-void Input::restart() +-{ +- if (!keyboardPath.empty() && keyboardFd < 0) +- { +- keyboardFd = open(keyboardPath.c_str(), O_RDWR | O_CLOEXEC); +- if (keyboardFd < 0) +- { +- log<level::ERR>("Failed to open input device", +- entry("PATH=%s", keyboardPath.c_str()), +- entry("ERROR=%s", strerror(errno))); +- } +- +- sendKeyboard = false; +- } +- +- if (!pointerPath.empty() && pointerFd < 0) +- { +- pointerFd = open(pointerPath.c_str(), O_RDWR | O_CLOEXEC | O_NONBLOCK); +- if (pointerFd < 0) +- { +- log<level::ERR>("Failed to open input device", +- entry("PATH=%s", pointerPath.c_str()), +- entry("ERROR=%s", strerror(errno))); +- } +- +- pointerError = false; +- sendPointer = false; +- } +-} +- + void Input::sendWakeupPacket() + { + uint8_t wakeupReport[KEY_REPORT_LENGTH] = {0}; +@@ -459,13 +429,10 @@ bool Input::writeKeyboard(const uint8_t *report) + { + if (write(keyboardFd, report, KEY_REPORT_LENGTH) != KEY_REPORT_LENGTH) + { +- log<level::ERR>("Failed to write keyboard report", +- entry("ERROR=%s", strerror(errno))); +- +- if (errno == ESHUTDOWN) ++ if (errno != ESHUTDOWN && errno != EAGAIN) + { +- close(keyboardFd); +- keyboardFd = -1; ++ log<level::ERR>("Failed to write keyboard report", ++ entry("ERROR=%s", strerror(errno))); + } + + return false; +@@ -478,23 +445,12 @@ void Input::writePointer(const uint8_t *report) + { + if (write(pointerFd, report, PTR_REPORT_LENGTH) != PTR_REPORT_LENGTH) + { +- if (!pointerError) ++ if (errno != ESHUTDOWN && errno != EAGAIN) + { + log<level::ERR>("Failed to write pointer report", + entry("ERROR=%s", strerror(errno))); +- pointerError = true; +- } +- +- if (errno == ESHUTDOWN) +- { +- close(pointerFd); +- pointerFd = -1; + } + } +- else +- { +- pointerError = false; +- } + } + + } // namespace ikvm +diff --git a/ikvm_input.hpp b/ikvm_input.hpp +index 953333263e2d..2adc7c106755 100644 +--- a/ikvm_input.hpp ++++ b/ikvm_input.hpp +@@ -48,8 +48,6 @@ class Input + */ + static void pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl); + +- /* @brief Re-opens USB device in case the endpoint shutdown */ +- void restart(); + /* @brief Sends a wakeup data packet to the USB input device */ + void sendWakeupPacket(); + /* @brief Sends an HID report to the USB input device */ +@@ -90,8 +88,6 @@ class Input + bool writeKeyboard(const uint8_t *report); + void writePointer(const uint8_t *report); + +- /* @brief Indicates whether or not a pointer report error has occurred */ +- bool pointerError; + /* @brief Indicates whether or not to send a keyboard report */ + bool sendKeyboard; + /* @brief Indicates whether or not to send a pointer report */ +diff --git a/ikvm_video.cpp b/ikvm_video.cpp +index 6a5aa6c10927..7bd4b4eb6c98 100644 +--- a/ikvm_video.cpp ++++ b/ikvm_video.cpp +@@ -163,10 +163,9 @@ bool Video::needsResize() + restart(); + return false; + } +- else if (timingsError) ++ else + { + timingsError = false; +- input.restart(); + } + + if (timings.bt.width != width || timings.bt.height != height) +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend index cc18a9b43..2118baa8a 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend @@ -1,6 +1,8 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" #SRC_URI = "git://github.com/openbmc/obmc-ikvm" -SRCREV = "95a3b35bf30f730d2bc512bd42aea45746c625e6" +SRCREV = "7cf1f1d43ef9b4c312bfb2c7c61514ca93a53ee6" -SRC_URI += "file://0001-Add-flow-control-to-prevent-buffer-over-run.patch" +SRC_URI += " \ + file://0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch \ + " diff --git a/meta-openbmc-mods/meta-common/recipes-intel/chassis/intel-chassis-control.bb b/meta-openbmc-mods/meta-common/recipes-intel/chassis/intel-chassis-control.bb index f727b4536..193ad8ba0 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/chassis/intel-chassis-control.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/chassis/intel-chassis-control.bb @@ -2,7 +2,7 @@ SUMMARY = "Chassis Power Control service for Intel based platform" DESCRIPTION = "Chassis Power Control service for Intel based platfrom" SRC_URI = "git://git@github.com/Intel-BMC/intel-chassis-control.git;protocol=ssh" -SRCREV = "b9e1b13e42359baf21592480874a176548071cf2" +SRCREV = "0d766e3ea2af610ca63c8c828cb284da0e706b19" S = "${WORKDIR}/git/services/chassis/" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb new file mode 100644 index 000000000..c92ea6d01 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb @@ -0,0 +1,21 @@ +SUMMARY = "HSBP Manager" +DESCRIPTION = "HSBP Manager monitors HSBPs through SMBUS" + +SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" +PV = "0.1+git${SRCPV}" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SYSTEMD_SERVICE_${PN} = "hsbp-manager.service" + +DEPENDS = "boost \ + i2c-tools \ + sdbusplus" + +S = "${WORKDIR}/git/hsbp-manager" +inherit cmake systemd + +EXTRA_OECMAKE = "-DYOCTO=1" + diff --git a/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb b/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb index 545ecae7f..8fa7ba865 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/images/intel-platforms.bb @@ -3,7 +3,6 @@ DESCRIPTION = "Image with Intel content based upon Phosphor, an OpenBMC framewor inherit obmc-phosphor-full-fitimage inherit obmc-phosphor-image-common inherit obmc-phosphor-image-dev -inherit ${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'image_types_intel_pfr', '', d)} DEPENDS += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'obmc-intel-pfr-image-native', '', d)}" DEPENDS += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'intel-pfr-manager', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py index 5cda38b79..c2c18247d 100755 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py @@ -1,4 +1,4 @@ -#/usr/bin/env python3 +#!/usr/bin/env python3 # coding: utf-8 # our image is contained as parts, including the hash # then it gets zipped up and signed again @@ -46,7 +46,7 @@ PFM_SPI = 0x1 PFM_I2C = 0x2 SHA256 = 0x1 SHA256_SIZE = 32 -PFM_DEF_SIZE = 16 +PFM_DEF_SIZE = 32 # 32 bytes of PFM header PFM_SPI_SIZE_DEF = 16 # 16 bytes of SPI PFM PFM_SPI_SIZE_HASH = 32 # 32 bytes of SPI region HASH PFM_I2C_SIZE = 40 # 40 bytes of i2c rules region in PFM @@ -102,7 +102,6 @@ class pfr_bmc_image(object): for p in self.manifest['image-parts']: # the json should have in the order- filename, index, offset, size and protection byte self.image_parts.append((p['name'], p['index'], p['offset'], p['size'], p['prot_mask'], p['pfm'], p['hash'], p['compress'])) - print(self.image_parts) self.act_dgst = hashlib.sha256() @@ -124,7 +123,6 @@ class pfr_bmc_image(object): for i in self.manifest['i2c-rules']: # the json should have in the order- bus-id, rule-id, address, size and cmd-whitelist self.i2c_rules.append((i['bus-id'], i['rule-id'], i['address'], i['cmd-whitelist'])) - print(self.i2c_rules) # I2C rules PFM array self.pfm_i2c_rules = [] @@ -205,7 +203,7 @@ class pfr_bmc_image(object): if pfm_flag == 1: self.pfm_bytes += PFM_SPI_SIZE_DEF - hash = b'\x00' * 32 + hash = bytearray(32) hash_pres = 0 if hash_flag == 1: @@ -232,7 +230,7 @@ class pfr_bmc_image(object): whitelist_map[i] = 0xff break else: - idx = int(c,16) / 8 # index in the 32 bytes of white list i2c cmds + idx = int(c,16) // 8 # index in the 32 bytes of white list i2c cmds bit = int(c,16) % 8 # bit position to set whitelist_map[idx] |= (1 << bit) @@ -241,7 +239,6 @@ class pfr_bmc_image(object): def build_i2c_rules(self): for i in self.i2c_rules: - print(i[0], i[1], i[2], i[3]) self.add_i2c_rules(i) def hash_and_map(self): @@ -327,10 +324,15 @@ class pfr_bmc_image(object): } # PFM should be 128bytes aligned, find the padding bytes - padding_bytes = 128 - (self.pfm_bytes % 128) + padding_bytes = 0 + if (self.pfm_bytes % 128) != 0: + padding_bytes = 128 - (self.pfm_bytes % 128) + + print("padding={}".format(padding_bytes)) + print("PFM size1={}".format(self.pfm_bytes)) self.pfm_bytes += padding_bytes parts['pfm_len'] = struct.pack('<I', self.pfm_bytes) - print("PFM size={}".format(self.pfm_bytes)) + print("PFM size2={}".format(self.pfm_bytes)) with open("pfm.bin", "wb+") as f: f.write(b''.join([parts[n] for n in names])) @@ -343,7 +345,7 @@ class pfr_bmc_image(object): f.write(struct.pack('<I', int(i.spi_end_addr))) if i.spi_hash_pres == 1: - f.write(i.spi_hash.decode('hex')) + f.write(bytearray.fromhex(i.spi_hash)) for r in self.pfm_i2c_rules: f.write(struct.pack('<B', int(r.i2c_pfm))) diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json index adea41eab..c9f7d0746 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json @@ -81,24 +81,24 @@ } ], "i2c-rules": [{ - "bus-id": 5, - "rule-id": 1, + "bus-id": 3, + "rule-id": 3, "address": "0xD0", "cmd-whitelist": ["0x00", "0x01", "0x02", "0x03", "0x04", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F", "0x10", "0x13", "0x17", "0x1B", "0x1C", "0x1D", "0x02", "0x021", "0x22", "0x23", "0x25", "0x30", "0x31", "0x32", "0x33", "0x035", "0x36", "0x37", "0x38", "0x39", "0x3A", "0x3B", "0x3C", "0x3D"] }, { - "bus-id": 5, - "rule-id": 2, - "address": "0xD6", + "bus-id": 3, + "rule-id": 4, + "address": "0xD8", "cmd-whitelist": ["0x00", "0x01", "0x02", "0x03", "0x04", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F", "0x10", "0x13", "0x17", "0x1B", "0x1C", "0x1D", "0x02", "0x021", "0x22", "0x23", "0x25", "0x30", "0x31", "0x32", "0x33", "0x035", "0x36", "0x37", "0x38", "0x39", "0x3A", "0x3B", "0x3C", "0x3D"] }, { - "bus-id": 8, - "rule-id": 3, + "bus-id": 1, + "rule-id": 6, "address": "0xB0", "cmd-whitelist": ["0x03", "0x05", "0x06", "0x19", "0x1A", "0x30", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F", "0x79", "0x7A", "0x7B", "0x7C", "0x7D", "0x7E", "0x7F", "0x81", "0x82", "0x86", "0x87", "0x88", @@ -107,7 +107,7 @@ "0xD9", "0xDC", "0xDD", "0xDE", "0xDE"] }, { - "bus-id": 8, + "bus-id": 1, "rule-id": 4, "address": "0xB2", "cmd-whitelist": ["0x03", "0x05", "0x06", "0x19", "0x1A", "0x30", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F", diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb index 12394dd91..3f7776e06 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-blocksign-native.bb @@ -1,20 +1,20 @@ -SUMMARY = "Intel Blocksign tool for PFR image"
-DESCRIPTION = "Image signing tool for BMC PFR image"
-
-inherit native cmake
-
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
-
-DEPENDS = "openssl-native libxml2-native "
-
-SRC_URI = "git://git@github.com/Intel-BMC/blocksign;protocol=ssh"
-
-SRCREV = "60d76db038a0d85851098b13451246abb0d876ed"
-
-S = "${WORKDIR}/git/"
-
-do_install_append() {
- install -d ${STAGING_DIR}/intel-pfr-files
- install -m 775 ${B}/blocksign ${STAGING_DIR}/intel-pfr-files
-}
+SUMMARY = "Intel Blocksign tool for PFR image" +DESCRIPTION = "Image signing tool for BMC PFR image" + +inherit native cmake + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" + +DEPENDS = "openssl-native libxml2-native " + +SRC_URI = "git://git@github.com/Intel-BMC/blocksign;protocol=ssh" + +SRCREV = "60d76db038a0d85851098b13451246abb0d876ed" + +S = "${WORKDIR}/git/" + +do_install_append() { + install -d ${D}/${bindir} + install -m 775 ${B}/blocksign ${D}/${bindir} +} diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-manager_git.bb index 96bfec0a8..a832a5952 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-manager_git.bb @@ -9,10 +9,10 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd -SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.Intel.PFR.Manager.service" +SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.PFR.Manager.service" DEPENDS += " \ sdbusplus \ diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bb index 307fe1829..910e61142 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/obmc-intel-pfr-image-native.bb @@ -1,37 +1,36 @@ -SUMMARY = "Intel PFR manifest and signing key for development and testing"
-DESCRIPTION = "Do not use this signing keys to sign CI and release images."
-
-PR = "r1"
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
-
-inherit native
-
-PFR_KEY_NAME ?= "pfr-dev-key"
-PFR_SIGN_UTIL ?= "blocksign"
-DEPENDS += " intel-blocksign-native"
-
-SRC_URI = " \
- file://pfr_manifest.json \
- file://pfr_image.py \
- file://pfm_config.xml \
- file://bmc_config.xml \
- file://csk_prv.pem \
- file://csk_pub.pem \
- file://rk_pub.pem \
- file://rk_prv.pem \
- "
-
-do_install() {
- bbplain "Copying the intel pfr image generation scripts and image signing keys"
-
- install -d ${STAGING_DIR}/intel-pfr-files
- install -m 400 ${WORKDIR}/pfr_manifest.json ${STAGING_DIR}/intel-pfr-files
- install -m 400 ${WORKDIR}/pfm_config.xml ${STAGING_DIR}/intel-pfr-files
- install -m 400 ${WORKDIR}/bmc_config.xml ${STAGING_DIR}/intel-pfr-files
- install -m 775 ${WORKDIR}/pfr_image.py ${STAGING_DIR}/intel-pfr-files
- install -m 400 ${WORKDIR}/csk_prv.pem ${STAGING_DIR}/intel-pfr-files
- install -m 400 ${WORKDIR}/csk_pub.pem ${STAGING_DIR}/intel-pfr-files
- install -m 400 ${WORKDIR}/rk_pub.pem ${STAGING_DIR}/intel-pfr-files
- install -m 400 ${WORKDIR}/rk_prv.pem ${STAGING_DIR}/intel-pfr-files
-}
+SUMMARY = "Intel PFR image manifest and image signing keys" +DESCRIPTION = "This copies PFR image generation scripts and image signing keys to staging area" + +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" + +inherit native + +DEPENDS += " intel-blocksign-native" + +SRC_URI = " \ + file://pfr_manifest.json \ + file://pfr_image.py \ + file://pfm_config.xml \ + file://bmc_config.xml \ + file://csk_prv.pem \ + file://csk_pub.pem \ + file://rk_pub.pem \ + file://rk_prv.pem \ + " + +do_install() { + bbplain "Copying intel pfr image generation scripts and image signing keys" + + install -d ${D}/${bindir} + install -d ${D}/${datadir}/pfrconfig + install -m 775 ${WORKDIR}/pfr_image.py ${D}${bindir} + install -m 400 ${WORKDIR}/pfr_manifest.json ${D}/${datadir}/pfrconfig + install -m 400 ${WORKDIR}/pfm_config.xml ${D}/${datadir}/pfrconfig + install -m 400 ${WORKDIR}/bmc_config.xml ${D}/${datadir}/pfrconfig + install -m 400 ${WORKDIR}/csk_prv.pem ${D}/${datadir}/pfrconfig + install -m 400 ${WORKDIR}/csk_pub.pem ${D}/${datadir}/pfrconfig + install -m 400 ${WORKDIR}/rk_pub.pem ${D}/${datadir}/pfrconfig + install -m 400 ${WORKDIR}/rk_prv.pem ${D}/${datadir}/pfrconfig +} diff --git a/meta-openbmc-mods/meta-common/recipes-intel/ipccli/ipccli_svn.bb b/meta-openbmc-mods/meta-common/recipes-intel/ipccli/ipccli_svn.bb deleted file mode 100644 index ce7d79975..000000000 --- a/meta-openbmc-mods/meta-common/recipes-intel/ipccli/ipccli_svn.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "ipccli" -HOMEPAGE = "https://www.intel.com" -LICENSE = "CLOSED" -LIC_FILES_CHKSUM = "" - -SRC_URI[md5sum] = "917092bfe4244aa4312b572c2c9c303f" -SRC_URI = "svn://ssvn.pdx.intel.com/deg/pve/csv/pythonsv/subprojects/;module=ipccli;rev=804701;protocol=https;user=etanous;pswd=Cardinal2bali!" - -DEPENDS_${PN} += "python-setuptools-native" - -S = "${WORKDIR}/ipccli/trunk" -inherit setuptools - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/packagegroups/packagegroup-obmc-apps.bbappend b/meta-openbmc-mods/meta-common/recipes-intel/packagegroups/packagegroup-obmc-apps.bbappend index d3b283202..c3443107d 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/packagegroups/packagegroup-obmc-apps.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-intel/packagegroups/packagegroup-obmc-apps.bbappend @@ -1 +1,2 @@ RDEPENDS_${PN}-extrasdevtools = "libgpiod-tools" +RDEPENDS_${PN}-chassis-state-mgmt_remove = "obmc-phosphor-power" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb index 63576a3de..88b49a2fd 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb @@ -1,8 +1,8 @@ SUMMARY = "Power supply manager for Intel based platform" DESCRIPTION = "Power supply manager which include PSU Cold Redundancy service" -SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh;nobranch=1" -SRCREV = "fe33964c744f871f3e024dd8d0b6ffba67394c30" +SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" S = "${WORKDIR}/git/psu-manager/" @@ -14,7 +14,7 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" inherit cmake inherit systemd -SYSTEMD_SERVICE_${PN} += "cold-redundancy.service" +SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.coldredundancy.service" DEPENDS += " \ systemd \ diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb index 0f6893ed6..be97ab43d 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb @@ -2,7 +2,7 @@ SUMMARY = "SMBIOS MDR version 1 service for Intel based platform" DESCRIPTION = "SMBIOS MDR version 1 service for Intel based platfrom" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" S = "${WORKDIR}/git/services/smbios/" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb index 71ac31348..0d8da0db1 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb @@ -2,7 +2,7 @@ SUMMARY = "SMBIOS MDR version 2 service for Intel based platform" DESCRIPTION = "SMBIOS MDR version 2 service for Intel based platfrom" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" S = "${WORKDIR}/git/services/smbios-mdrv2/" diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-platforms.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-platforms.patch new file mode 100644 index 000000000..d185171f6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-platforms.patch @@ -0,0 +1,473 @@ +From 965806acbf8eb3f38367958594f0651e1893ddb8 Mon Sep 17 00:00:00 2001 +From: Yuan Li <yuan.li@linux.intel.com> +Date: Tue, 19 Sep 2017 15:55:39 +0800 +Subject: [PATCH] arm: dts: add DTS for Intel platforms + +Add the DTS file for Intel systems. + +Signed-off-by: Yuan Li <yuan.li@linux.intel.com> +Signed-off-by: Yong Li <yong.b.li@linux.intel.com> +Signed-off-by: James Feist <james.feist@linux.intel.com> +Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> +Signed-off-by: Zhu, Yunge <yunge.zhu@linux.intel.com> +Signed-off-by: Qiang XU <qiang.xu@linux.intel.com> +Signed-off-by: Chen Yugang <yugang.chen@linux.intel.com> +--- + arch/arm/boot/dts/aspeed-bmc-intel-purley.dts | 444 ++++++++++++++++++++++++++ + 1 file changed, 444 insertions(+) + create mode 100644 arch/arm/boot/dts/aspeed-bmc-intel-purley.dts + +diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts +new file mode 100644 +index 0000000..b901d98 +--- /dev/null ++++ b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts +@@ -0,0 +1,444 @@ ++/dts-v1/; ++ ++#include "aspeed-g5.dtsi" ++#include <dt-bindings/gpio/aspeed-gpio.h> ++#include <dt-bindings/i2c/i2c.h> ++ ++/ { ++ model = "Purley BMC"; ++ compatible = "intel,purley-bmc", "aspeed,ast2500"; ++ ++ aliases { ++ serial4 = &uart5; ++ }; ++ ++ chosen { ++ stdout-path = &uart5; ++ bootargs = "console=ttyS4,115200 earlyprintk"; ++ }; ++ ++ memory@80000000 { ++ reg = <0x80000000 0x20000000>; ++ }; ++ ++ reserved-memory { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ ++ vga_memory: framebuffer@7f000000 { ++ no-map; ++ reg = <0x7f000000 0x01000000>; ++ }; ++ ++ gfx_memory: framebuffer { ++ size = <0x01000000>; ++ alignment = <0x01000000>; ++ compatible = "shared-dma-pool"; ++ reusable; ++ }; ++ ++ video_engine_memory: jpegbuffer { ++ size = <0x02000000>; /* 32M */ ++ alignment = <0x01000000>; ++ compatible = "shared-dma-pool"; ++ reusable; ++ }; ++ ++ ramoops@9eff0000{ ++ compatible = "ramoops"; ++ reg = <0x9eff0000 0x10000>; ++ record-size = <0x2000>; ++ console-size = <0x2000>; ++ }; ++ }; ++ ++ vga-shared-memory { ++ compatible = "aspeed,ast2500-vga-sharedmem"; ++ reg = <0x9ff00000 0x100000>; ++ }; ++ ++ iio-hwmon { ++ compatible = "iio-hwmon"; ++ io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>, ++ <&adc 4>, <&adc 5>, <&adc 6>, <&adc 7>, ++ <&adc 8>, <&adc 9>, <&adc 10>, <&adc 11>, ++ <&adc 12>, <&adc 13>, <&adc 14>, <&adc 15>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ identify { ++ default-state = "off"; ++ gpios = <&gpio ASPEED_GPIO(S, 6) GPIO_ACTIVE_LOW>; ++ }; ++ ++ status_amber { ++ default-state = "off"; ++ gpios = <&gpio ASPEED_GPIO(S, 5) GPIO_ACTIVE_LOW>; ++ }; ++ ++ status_green { ++ default-state = "keep"; ++ gpios = <&gpio ASPEED_GPIO(S, 4) GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ beeper { ++ compatible = "pwm-beeper"; ++ pwms = <&timer 5 1000000 0>; ++ }; ++}; ++ ++&fmc { ++ status = "okay"; ++ flash@0 { ++ status = "okay"; ++ m25p,fast-read; ++#include "openbmc-flash-layout-intel-64MB.dtsi" ++ }; ++}; ++ ++&espi { ++ status = "okay"; ++}; ++ ++&jtag { ++ status = "okay"; ++}; ++ ++&peci0 { ++ status = "okay"; ++ gpios = <&gpio ASPEED_GPIO(F, 6) 0>; ++}; ++ ++&syscon { ++ uart-clock-high-speed; ++ status = "okay"; ++}; ++ ++&adc { ++ status = "okay"; ++}; ++ ++&gpio { ++ status = "okay"; ++ gpio-line-names = ++ /*A0-A7*/ "","","","","","","","", ++ /*B0-B7*/ "FM_BMC_BOARD_SKU_ID0_N","FM_BMC_BOARD_SKU_ID1_N","FM_BMC_BOARD_SKU_ID2_N","FM_BMC_BOARD_SKU_ID3_N","FM_BMC_BOARD_SKU_ID4_N","","","", ++ /*C0-C7*/ "","","","","","","","", ++ /*D0-D7*/ "","","","","","","","", ++ /*E0-E7*/ "RESET_BUTTON","RESET_OUT","POWER_BUTTON","POWER_OUT","","DEBUG_EN_N","","", ++ /*F0-F7*/ "NMI_OUT","","","","CPU_ERR0","CPU_ERR1","PLTRST_N","PRDY_N", ++ /*G0-G7*/ "CPU_ERR2","CPU_CATERR","PCH_BMC_THERMTRIP","","","FM_BMC_BOARD_SKU_ID5_N","","", ++ /*H0-H7*/ "","","","","","","","", ++ /*I0-I7*/ "","","","","","","","", ++ /*J0-J7*/ "","","","","","","","", ++ /*K0-K7*/ "","","","","","","","", ++ /*L0-L7*/ "","","","","","","","", ++ /*M0-M7*/ "","","","","","","","", ++ /*N0-N7*/ "","","","","","","","", ++ /*O0-O7*/ "","","","","","","","", ++ /*P0-P7*/ "","","","","","","","", ++ /*Q0-Q7*/ "","","","","","","","PWR_DEBUG_N", ++ /*R0-R7*/ "","XDP_PRST_N","","","","","","", ++ /*S0-S7*/ "","SYSPWROK","RSMRST_N","","","","","", ++ /*T0-T7*/ "","","","","","","","", ++ /*U0-U7*/ "","","","","","","","", ++ /*V0-V7*/ "","","","","","","","", ++ /*W0-W7*/ "","","","","","","","", ++ /*X0-X7*/ "","","","","","","","", ++ /*Y0-Y7*/ "SIO_S3","SIO_S5","","SIO_ONCONTROL","","","","", ++ /*Z0-Z7*/ "","SIO_POWER_GOOD","","","","","","", ++ /*AA0-AA7*/ "P3VBAT_BRIDGE_EN","","","","PREQ_N","TCK_MUX_SEL","SMI","POST_COMPLETE", ++ /*AB0-AB7*/ "","NMI_BUTTON","ID_BUTTON","PS_PWROK","","","","", ++ /*AC0-AC7*/ "","","","","","","",""; ++}; ++ ++&sgpio { ++ status = "okay"; ++ gpio-line-names = ++ /* SGPIO output lines */ ++ /*OA0-OA7*/ "","","","","","","","", ++ /*OB0-OB7*/ "LED_CPU1_CH1_DIMM1_FAULT","LED_CPU1_CH1_DIMM2_FAULT","LED_CPU1_CH2_DIMM1_FAULT","LED_CPU1_CH2_DIMM2_FAULT","LED_CPU1_CH3_DIMM1_FAULT","LED_CPU1_CH3_DIMM2_FAULT","LED_CPU1_CH4_DIMM1_FAULT","LED_CPU1_CH4_DIMM2_FAULT", ++ /*OC0-OC7*/ "LED_CPU1_CH5_DIMM1_FAULT","LED_CPU1_CH5_DIMM2_FAULT","LED_CPU1_CH6_DIMM1_FAULT","LED_CPU1_CH6_DIMM2_FAULT","LED_FAN1_FAULT","LED_FAN2_FAULT","LED_FAN3_FAULT","LED_FAN4_FAULT", ++ /*OD0-OD7*/ "LED_FAN5_FAULT","LED_FAN6_FAULT","LED_FAN7_FAULT","LED_FAN8_FAULT","LED_CPU2_CH1_DIMM1_FAULT","LED_CPU1_CH1_DIMM2_FAULT","LED_CPU2_CH2_DIMM1_FAULT","LED_CPU2_CH2_DIMM2_FAULT", ++ /*OE0-OE7*/ "LED_CPU2_CH3_DIMM1_FAULT","LED_CPU2_CH3_DIMM2_FAULT","LED_CPU2_CH4_DIMM1_FAULT","LED_CPU2_CH4_DIMM2_FAULT","LED_CPU2_CH5_DIMM1_FAULT","LED_CPU2_CH5_DIMM2_FAULT","LED_CPU2_CH6_DIMM1_FAULT","LED_CPU2_CH6_DIMM2_FAULT", ++ /*OF0-OF7*/ "LED_CPU3_CH1_DIMM1_FAULT","LED_CPU3_CH1_DIMM2_FAULT","LED_CPU3_CH2_DIMM1_FAULT","LED_CPU3_CH2_DIMM2_FAULT","LED_CPU3_CH3_DIMM1_FAULT","LED_CPU3_CH3_DIMM2_FAULT","LED_CPU3_CH4_DIMM1_FAULT","LED_CPU3_CH4_DIMM2_FAULT", ++ /*OG0-OG7*/ "LED_CPU3_CH5_DIMM1_FAULT","LED_CPU3_CH5_DIMM2_FAULT","LED_CPU3_CH6_DIMM1_FAULT","LED_CPU3_CH6_DIMM2_FAULT","LED_CPU4_CH1_DIMM1_FAULT","LED_CPU4_CH1_DIMM2_FAULT","LED_CPU4_CH2_DIMM1_FAULT","LED_CPU4_CH2_DIMM2_FAULT", ++ /*OH0-OH7*/ "LED_CPU4_CH3_DIMM1_FAULT","LED_CPU4_CH3_DIMM2_FAULT","LED_CPU4_CH4_DIMM1_FAULT","LED_CPU4_CH4_DIMM2_FAULT","LED_CPU4_CH5_DIMM1_FAULT","LED_CPU4_CH5_DIMM2_FAULT","LED_CPU4_CH6_DIMM1_FAULT","LED_CPU4_CH6_DIMM2_FAULT", ++ /*OI0-OI7*/ "","","","","","","","", ++ /*OJ0-OJ7*/ "","","","","","","","", ++ /*DUMMY*/ "","","","","","","","", ++ /*DUMMY*/ "","","","","","","","", ++ ++ /* SGPIO input lines */ ++ /*IA0-IA7*/ "CPU1_PRESENCE","CPU1_THERMTRIP","CPU1_VRHOT","CPU1_FIVR_FAULT","CPU1_MEM_ABCD_VRHOT","CPU1_MEM_EFGH_VRHOT","","", ++ /*IB0-IB7*/ "","","CPU2_PRESENCE","CPU2_THERMTRIP","CPU2_VRHOT","CPU2_FIVR_FAULT","CPU2_MEM_ABCD_VRHOT","CPU2_MEM_EFGH_VRHOT", ++ /*IC0-IC7*/ "","","","","","","","", ++ /*ID0-ID7*/ "","","","","","","","", ++ /*IE0-IE7*/ "","","","","","","","", ++ /*IF0-IF7*/ "","","","","","","","", ++ /*IG0-IG7*/ "","","","","","","","", ++ /*IH0-IH7*/ "","","","","","","","", ++ /*II0-II7*/ "","","","","","","","", ++ /*IJ0-IJ7*/ "","","","","","","",""; ++}; ++ ++&kcs3 { ++ kcs_addr = <0xCA2>; ++ status = "okay"; ++}; ++ ++&kcs4 { ++ kcs_addr = <0xCA4>; ++ status = "okay"; ++}; ++ ++&lpc_sio { ++ status = "okay"; ++}; ++ ++&lpc_snoop { ++ snoop-ports = <0x80>; ++ status = "okay"; ++}; ++ ++&mbox { ++ status = "okay"; ++}; ++ ++/** ++ * SAFS through SPI1 is available only on Wilson Point. ++ * These pins are used as fan presence checking gpios in WFP ++ * so commenting it out for now. ++ * &spi1 { ++ * status = "okay"; ++ * ++ * flash@0 { ++ * m25p,fast-read; ++ * status = "okay"; ++ * }; ++ *}; ++ */ ++ ++&uart1 { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_txd1_default ++ &pinctrl_rxd1_default ++ &pinctrl_nrts1_default ++ &pinctrl_ndtr1_default ++ &pinctrl_ndsr1_default ++ &pinctrl_ncts1_default ++ &pinctrl_ndcd1_default ++ &pinctrl_nri1_default>; ++}; ++ ++&uart2 { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_txd2_default ++ &pinctrl_rxd2_default ++ &pinctrl_nrts2_default ++ &pinctrl_ndtr2_default ++ &pinctrl_ndsr2_default ++ &pinctrl_ncts2_default ++ &pinctrl_ndcd2_default ++ &pinctrl_nri2_default>; ++}; ++ ++&uart3 { ++ status = "okay"; ++}; ++ ++&uart4 { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <>; ++}; ++ ++&uart5 { ++ status = "okay"; ++}; ++ ++&mac1 { ++ status = "okay"; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_rgmii2_default &pinctrl_mdio2_default>; ++}; ++ ++&mac0 { ++ status = "okay"; ++ use-ncsi; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_rmii1_default>; ++}; ++ ++&i2c0 { ++ multi-master; ++ general-call; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&i2c1 { ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&i2c2 { ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&i2c3 { ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&i2c4 { ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++ ++ hsbp0@10 { ++ compatible = "slave-mqueue"; ++ reg = <(0x10 | I2C_OWN_SLAVE_ADDRESS)>; ++ }; ++}; ++ ++&i2c5 { ++ bus-frequency = <1000000>; ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++ ++ smlink0@10 { ++ compatible = "slave-mqueue"; ++ reg = <(0x10 | I2C_OWN_SLAVE_ADDRESS)>; ++ }; ++}; ++ ++&i2c6 { ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&i2c7 { ++ multi-master; ++ #retries = <3>; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&i2c9 { ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&i2c11 { ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&i2c13 { ++ multi-master; ++ aspeed,dma-buf-size = <4095>; ++ aspeed,hw-timeout-ms = <300>; ++ status = "okay"; ++}; ++ ++&gfx { ++ status = "okay"; ++ memory-region = <&gfx_memory>; ++}; ++ ++&vuart { ++ status = "okay"; ++}; ++ ++&pwm_tacho { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_pwm0_default &pinctrl_pwm1_default ++ &pinctrl_pwm2_default &pinctrl_pwm3_default ++ &pinctrl_pwm4_default &pinctrl_pwm5_default ++ &pinctrl_pwm6_default &pinctrl_pwm7_default>; ++ ++ fan@0 { ++ reg = <0x00>; ++ aspeed,fan-tach-ch = /bits/ 8 <0x00 0x01>; ++ }; ++ fan@1 { ++ reg = <0x01>; ++ aspeed,fan-tach-ch = /bits/ 8 <0x02 0x03>; ++ }; ++ fan@2 { ++ reg = <0x02>; ++ aspeed,fan-tach-ch = /bits/ 8 <0x04 0x05>; ++ }; ++ fan@3 { ++ reg = <0x03>; ++ aspeed,fan-tach-ch = /bits/ 8 <0x06 0x07>; ++ }; ++ fan@4 { ++ reg = <0x04>; ++ aspeed,fan-tach-ch = /bits/ 8 <0x08 0x09>; ++ }; ++ fan@5 { ++ reg = <0x05>; ++ aspeed,fan-tach-ch = /bits/ 8 <0x0A 0x0B>; ++ }; ++ fan@6 { ++ reg = <0x06>; ++ aspeed,fan-tach-ch = /bits/ 8 <0x0C 0x0D>; ++ }; ++ fan@7 { ++ reg = <0x07>; ++ aspeed,fan-tach-ch = /bits/ 8 <0x0E 0x0F>; ++ }; ++ ++}; ++ ++&timer { ++/* ++ * Available settings: ++ * fttmr010,pwm-outputs = <5>, <6>, <7>, <8>; ++ * pinctrl-0 = <&pinctrl_timer5_default &pinctrl_timer6_default ++ * &pinctrl_timer7_default &pinctrl_timer8_default>; ++ */ ++ fttmr010,pwm-outputs = <5>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_timer5_default>; ++ #pwm-cells = <3>; ++ status = "okay"; ++}; ++ ++&video { ++ status = "okay"; ++ memory-region = <&video_engine_memory>; ++}; ++ ++&vhub { ++ status = "okay"; ++}; +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0002-Enable-pass-through-on-GPIOE1-and-GPIOE3-free.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0002-Enable-pass-through-on-GPIOE1-and-GPIOE3-free.patch new file mode 100644 index 000000000..ecee21f1c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0002-Enable-pass-through-on-GPIOE1-and-GPIOE3-free.patch @@ -0,0 +1,121 @@ +From ae2bcda6000d7ec278ea78d1eda6e8aacbe5a741 Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" <jason.m.bills@linux.intel.com> +Date: Fri, 3 May 2019 16:12:39 -0700 +Subject: [PATCH] Enable pass-through on GPIOE1 and GPIOE3 free + +This change adds a gpio_disable_free() implementation that checks +if the GPIO being freed is GPIOE1 (33) or GPIOE3 (35) and will +re-enable the pass-through mux. + +Tested: +Requested GPIOs 33 and 35 and used devmem to check that pass-through +was disabled. Then freed them and checked that pass-through was +enabled again. + +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> +--- + drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 1 + + drivers/pinctrl/aspeed/pinctrl-aspeed.c | 60 ++++++++++++++++++++++++++++++ + drivers/pinctrl/aspeed/pinctrl-aspeed.h | 3 ++ + 3 files changed, 64 insertions(+) + +diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +index d8a804b9f958..5e7f53fab76e 100644 +--- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c ++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +@@ -2805,6 +2805,7 @@ static const struct pinmux_ops aspeed_g5_pinmux_ops = { + .get_function_groups = aspeed_pinmux_get_fn_groups, + .set_mux = aspeed_pinmux_set_mux, + .gpio_request_enable = aspeed_gpio_request_enable, ++ .gpio_disable_free = aspeed_gpio_disable_free, + .strict = true, + }; + +diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c +index 54933665b5f8..aa7d56e99824 100644 +--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c ++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c +@@ -356,6 +356,66 @@ int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev, + return aspeed_sig_expr_enable(&pdata->pinmux, expr); + } + ++void aspeed_gpio_disable_free(struct pinctrl_dev *pctldev, ++ struct pinctrl_gpio_range *range, ++ unsigned int offset) ++{ ++ const struct aspeed_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); ++ const struct aspeed_pin_desc *pdesc = pdata->pins[offset].drv_data; ++ const struct aspeed_sig_expr ***prios, **funcs, *expr; ++ int ret; ++ ++ /* ++ * If we're freeing GPIOE1 (33) or GPIOE3 (35) then re-enable the ++ * pass-through mux setting; otherwise, do nothing. ++ */ ++ if (offset != 33 && offset != 35) ++ return; ++ ++ dev_dbg(pctldev->dev, ++ "Freeing pass-through pin %s (%d). Re-enabling pass-through.\n", ++ pdesc->name, offset); ++ ++ if (!pdesc) ++ return; ++ ++ prios = pdesc->prios; ++ ++ if (!prios) ++ return; ++ ++ /* Disable any functions of higher priority than GPIO just in case */ ++ while ((funcs = *prios)) { ++ if (aspeed_gpio_in_exprs(funcs)) ++ break; ++ ++ ret = aspeed_disable_sig(&pdata->pinmux, funcs); ++ if (ret) ++ return; ++ ++ prios++; ++ } ++ ++ if (!funcs) { ++ char *signals = get_defined_signals(pdesc); ++ ++ pr_warn("No GPIO signal type found on pin %s (%d). Found: %s\n", ++ pdesc->name, offset, signals); ++ kfree(signals); ++ ++ return; ++ } ++ ++ /* ++ * Pass-through should be one priority higher than the GPIO function, ++ * so decrement our prios and enable that function ++ */ ++ prios--; ++ funcs = *prios; ++ expr = *funcs; ++ aspeed_sig_expr_enable(&pdata->pinmux, expr); ++} ++ + int aspeed_pinctrl_probe(struct platform_device *pdev, + struct pinctrl_desc *pdesc, + struct aspeed_pinctrl_data *pdata) +diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.h b/drivers/pinctrl/aspeed/pinctrl-aspeed.h +index a5d83986f32e..c1104341e202 100644 +--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.h ++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.h +@@ -67,6 +67,9 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, + int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev, + struct pinctrl_gpio_range *range, + unsigned int offset); ++void aspeed_gpio_disable_free(struct pinctrl_dev *pctldev, ++ struct pinctrl_gpio_range *range, ++ unsigned int offset); + int aspeed_pinctrl_probe(struct platform_device *pdev, + struct pinctrl_desc *pdesc, + struct aspeed_pinctrl_data *pdata); +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0003-Enable-GPIOE0-and-GPIOE2-pass-through-by-default.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0003-Enable-GPIOE0-and-GPIOE2-pass-through-by-default.patch new file mode 100644 index 000000000..a5bd4d08e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0003-Enable-GPIOE0-and-GPIOE2-pass-through-by-default.patch @@ -0,0 +1,70 @@ +From fa75e700680ea87ab5aa9722bde1667c572f2fe8 Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" <jason.m.bills@linux.intel.com> +Date: Mon, 6 May 2019 14:18:27 -0700 +Subject: [PATCH] Enable GPIOE0 and GPIOE2 pass-through by default + +This change sets the gpio DT pinctrl default configuration to +enable GPIOE0 and GPIOE2 pass-through. Since this causes +pinctrl_get_select_default() to be called automatically for +the gpio driver to claim the GPIO pins in those groups, we +also need to call pinctrl_put() to release claim on the +pass-through GPIOs so they can be requested at runtime. + +Tested: +Disabled pass-through in uboot and confirmed that after booting +Linux, pass-through is enabled and 'cat /sys/kernel/debug/pinctrl/ +1e6e2000.syscon\:pinctrl-aspeed-g5-pinctrl/pinmux-pins' shows that +the pass-through GPIOs are UNCLAIMED. + +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> +--- + arch/arm/boot/dts/aspeed-bmc-intel-purley.dts | 4 ++++ + drivers/gpio/gpio-aspeed.c | 10 ++++++++++ + 2 files changed, 14 insertions(+) + +diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts +index 040b345f55e1..bc6bb41a8e68 100644 +--- a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts ++++ b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts +@@ -117,6 +117,10 @@ + + &gpio { + status = "okay"; ++ /* Enable GPIOE0 and GPIOE2 pass-through by default */ ++ pinctrl-names = "pass-through"; ++ pinctrl-0 = <&pinctrl_gpie0_default ++ &pinctrl_gpie2_default>; + gpio-line-names = + /*A0-A7*/ "","","","","","","","", + /*B0-B7*/ "","","","","","","","", +diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c +index 09e53c5f3b0a..ac33f8134fe6 100644 +--- a/drivers/gpio/gpio-aspeed.c ++++ b/drivers/gpio/gpio-aspeed.c +@@ -1140,6 +1140,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) + { + const struct of_device_id *gpio_id; + struct aspeed_gpio *gpio; ++ struct pinctrl *pinctrl; + int rc, i, banks, err; + u32 ngpio; + +@@ -1190,6 +1191,15 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) + return -ENOMEM; + + /* ++ * Select the pass-through pinctrl config to enable the pass-through ++ * mux for GPIOs E0 and E2. Then call pinctrl_put() to release claim ++ * of the GPIO pins, so they can be requested at runtime. ++ */ ++ pinctrl = pinctrl_get_select(&pdev->dev, "pass-through"); ++ if (pinctrl) ++ pinctrl_put(pinctrl); ++ ++ /* + * Populate it with initial values read from the HW and switch + * all command sources to the ARM by default + */ +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-128MB-flashmap-for-PFR.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-128MB-flashmap-for-PFR.patch new file mode 100644 index 000000000..14b7154bf --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-128MB-flashmap-for-PFR.patch @@ -0,0 +1,30 @@ +From 9a71adc7aecbfdf066ba54c763c2ecd8fb09d3cd Mon Sep 17 00:00:00 2001 +From: Vikram Bodireddy <vikram.bodireddy@intel.com> +Date: Wed, 6 Feb 2019 15:59:34 +0530 +Subject: [PATCH] Selecting 128MB for PFR + +PFR platforms requires 128MB flash mapping. +This will override the existing 64MB flash map +and loads 128MB flash map. + +Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> +--- + arch/arm/boot/dts/aspeed-bmc-intel-purley.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts +index 4815104459f1..df02bb1aaf36 100644 +--- a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts ++++ b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts +@@ -89,7 +89,7 @@ + flash@0 { + status = "okay"; + m25p,fast-read; +-#include "openbmc-flash-layout-intel-64MB.dtsi" ++#include "openbmc-flash-layout-intel-128MB.dtsi" + }; + }; + +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0006-Allow-monitoring-of-power-control-input-GPIOs.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0006-Allow-monitoring-of-power-control-input-GPIOs.patch new file mode 100644 index 000000000..c84746359 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0006-Allow-monitoring-of-power-control-input-GPIOs.patch @@ -0,0 +1,80 @@ +From e9d15bf9fdec1cd17c2ed335566b7d463d63fbdb Mon Sep 17 00:00:00 2001 +From: "Jason M. Bills" <jason.m.bills@linux.intel.com> +Date: Fri, 24 May 2019 12:42:59 -0700 +Subject: [PATCH] Allow monitoring of power control input GPIOs + +The pass-through input GPIOs cannot be monitored because when +requested, pass-through is disabled which causes a change on the +pass-through output. + +The SIO GPIOs cannot be monitored because when requested, the +request is rejected based on the value of the ACPI strap. + +This change removes the register check condition from the pass- +through and desired SIO GPIOs so they can be requsted and +monitored from power control. + +Tested: +For pass-through, I used gpioset to hold a request on the input +GPIOs and confirmed that pass-through remained enabled. + +For SIO, I used gpioget to confirm that I can successfully request +and read the GPIO value. + +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> +--- + drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +index 5e7f53fab76e..b08b5325edb1 100644 +--- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c ++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +@@ -279,7 +279,7 @@ FUNC_GROUP_DECL(SD2, F19, E21, F20, D20, D21, E20, G18, C21); + + #define B20 32 + SIG_EXPR_LIST_DECL_SINGLE(B20, NCTS3, NCTS3, SIG_DESC_SET(SCU80, 16)); +-SIG_EXPR_DECL_SINGLE(GPIE0IN, GPIE0, GPIE0_DESC); ++SIG_EXPR_DECL_SINGLE(GPIE0IN, GPIE0); + SIG_EXPR_DECL_SINGLE(GPIE0IN, GPIE, GPIE_DESC); + SIG_EXPR_LIST_DECL_DUAL(B20, GPIE0IN, GPIE0, GPIE); + PIN_DECL_2(B20, GPIOE0, NCTS3, GPIE0IN); +@@ -299,7 +299,7 @@ FUNC_GROUP_DECL(GPIE0, B20, C20); + + #define F18 34 + SIG_EXPR_LIST_DECL_SINGLE(F18, NDSR3, NDSR3, SIG_DESC_SET(SCU80, 18)); +-SIG_EXPR_DECL_SINGLE(GPIE2IN, GPIE2, GPIE2_DESC); ++SIG_EXPR_DECL_SINGLE(GPIE2IN, GPIE2); + SIG_EXPR_DECL_SINGLE(GPIE2IN, GPIE, GPIE_DESC); + SIG_EXPR_LIST_DECL_DUAL(F18, GPIE2IN, GPIE2, GPIE); + PIN_DECL_2(F18, GPIOE2, NDSR3, GPIE2IN); +@@ -1412,7 +1412,7 @@ FUNC_GROUP_DECL(ADC15, H4); + + #define R22 192 + SIG_EXPR_DECL_SINGLE(SIOS3, SIOS3, SIG_DESC_SET(SCUA4, 8)); +-SIG_EXPR_DECL_SINGLE(SIOS3, ACPI, ACPI_DESC); ++SIG_EXPR_DECL_SINGLE(SIOS3, ACPI); + SIG_EXPR_LIST_DECL_DUAL(R22, SIOS3, SIOS3, ACPI); + SIG_EXPR_LIST_DECL_SINGLE(R22, DASHR22, DASHR22, SIG_DESC_SET(SCU94, 10)); + PIN_DECL_2(R22, GPIOY0, SIOS3, DASHR22); +@@ -1420,7 +1420,7 @@ FUNC_GROUP_DECL(SIOS3, R22); + + #define R21 193 + SIG_EXPR_DECL_SINGLE(SIOS5, SIOS5, SIG_DESC_SET(SCUA4, 9)); +-SIG_EXPR_DECL_SINGLE(SIOS5, ACPI, ACPI_DESC); ++SIG_EXPR_DECL_SINGLE(SIOS5, ACPI); + SIG_EXPR_LIST_DECL_DUAL(R21, SIOS5, SIOS5, ACPI); + SIG_EXPR_LIST_DECL_SINGLE(R21, DASHR21, DASHR21, SIG_DESC_SET(SCU94, 10)); + PIN_DECL_2(R21, GPIOY1, SIOS5, DASHR21); +@@ -1436,7 +1436,7 @@ FUNC_GROUP_DECL(SIOPWREQ, P22); + + #define P21 195 + SIG_EXPR_DECL_SINGLE(SIOONCTRL, SIOONCTRL, SIG_DESC_SET(SCUA4, 11)); +-SIG_EXPR_DECL_SINGLE(SIOONCTRL, ACPI, ACPI_DESC); ++SIG_EXPR_DECL_SINGLE(SIOONCTRL, ACPI); + SIG_EXPR_LIST_DECL_DUAL(P21, SIOONCTRL, SIOONCTRL, ACPI); + SIG_EXPR_LIST_DECL_SINGLE(P21, DASHP21, DASHP21, SIG_DESC_SET(SCU94, 11)); + PIN_DECL_2(P21, GPIOY3, SIOONCTRL, DASHP21); +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-aspeed-pwm-tacho-change-default-fan-speed.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-aspeed-pwm-tacho-change-default-fan-speed.patch new file mode 100644 index 000000000..476a07043 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-aspeed-pwm-tacho-change-default-fan-speed.patch @@ -0,0 +1,28 @@ +From b7e8941cf3b1c1c42330207600c91fb23781a77b Mon Sep 17 00:00:00 2001 +From: James Feist <james.feist@linux.intel.com> +Date: Tue, 2 Jul 2019 10:14:59 -0700 +Subject: [PATCH] aspeed-pwm-tacho: change default fan speed + +Change it from max to 58% + +Signed-off-by: James Feist <james.feist@linux.intel.com> +--- + drivers/hwmon/aspeed-pwm-tacho.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c +index 40c489be62ea..ae5771f881b5 100644 +--- a/drivers/hwmon/aspeed-pwm-tacho.c ++++ b/drivers/hwmon/aspeed-pwm-tacho.c +@@ -160,7 +160,7 @@ + */ + #define M_TACH_MODE 0x02 /* 10b */ + #define M_TACH_UNIT 0x0210 +-#define INIT_FAN_CTRL 0xFF ++#define INIT_FAN_CTRL 150 /* 58% */ + + /* How long we sleep in us while waiting for an RPM result. */ + #define ASPEED_RPM_STATUS_SLEEP_USEC 500 +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Report-link-statistics-for-the-NCSI-channel.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Report-link-statistics-for-the-NCSI-channel.patch new file mode 100644 index 000000000..643deb659 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Report-link-statistics-for-the-NCSI-channel.patch @@ -0,0 +1,54 @@ +From f3300099b6638df5829e75b1fbfbb6e7ebc8b2b9 Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey <johnathanx.mantey@intel.com> +Date: Thu, 1 Aug 2019 11:29:41 -0700 +Subject: [PATCH] Report link statistics for the NCSI channel + +The ftgmac driver does not report the link statistics for the NCSI +channel used for the shared NICs attached to the BMC. Report a fixed +value for the NSCI interface. + +Change-Id: Idb65ca1ce07f06a883417ee44df30ea2c8483107 +Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com> +--- + drivers/net/ethernet/faraday/ftgmac100.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c +index 9b7af94a40bb..4cd679233795 100644 +--- a/drivers/net/ethernet/faraday/ftgmac100.c ++++ b/drivers/net/ethernet/faraday/ftgmac100.c +@@ -1216,10 +1216,30 @@ static int ftgmac100_set_pauseparam(struct net_device *netdev, + return 0; + } + ++int ftgmac100_ethtool_get_link_ksettings(struct net_device *netdev, ++ struct ethtool_link_ksettings *cmd) ++{ ++ struct phy_device *phydev = netdev->phydev; ++ struct ftgmac100 *priv = netdev_priv(netdev); ++ int retval = 0; ++ ++ if (phydev) { ++ phy_ethtool_ksettings_get(phydev, cmd); ++ } else if (priv->use_ncsi) { ++ cmd->base.speed = SPEED_100; ++ cmd->base.duplex = DUPLEX_FULL; ++ cmd->base.autoneg = 0; ++ } else { ++ retval = -ENODEV; ++ } ++ ++ return retval; ++} ++ + static const struct ethtool_ops ftgmac100_ethtool_ops = { + .get_drvinfo = ftgmac100_get_drvinfo, + .get_link = ethtool_op_get_link, +- .get_link_ksettings = phy_ethtool_get_link_ksettings, ++ .get_link_ksettings = ftgmac100_ethtool_get_link_ksettings, + .set_link_ksettings = phy_ethtool_set_link_ksettings, + .nway_reset = phy_ethtool_nway_reset, + .get_ringparam = ftgmac100_get_ringparam, +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-arm-dts-aspeed-g5-add-espi.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0014-arm-dts-aspeed-g5-add-espi.patch index 165596f25..094fc8396 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-arm-dts-aspeed-g5-add-espi.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0014-arm-dts-aspeed-g5-add-espi.patch @@ -1,4 +1,4 @@ -From f72d4767835e530ce6bc4673ff30cc1099c88af5 Mon Sep 17 00:00:00 2001 +From b70fe24abeef901b3ba8e32b5e5d8aaf35ec061d Mon Sep 17 00:00:00 2001 From: Juston Li <juston.li@intel.com> Date: Mon, 27 Mar 2017 11:16:00 -0700 Subject: [PATCH] arm: dts: aspeed-g5: add espi @@ -9,19 +9,19 @@ Signed-off-by: Juston Li <juston.li@intel.com> 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index dc58eb8c6969..db82f47339aa 100644 +index 00f05bd3375d..271f3c96456a 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -283,7 +283,7 @@ +@@ -311,7 +311,7 @@ #gpio-cells = <2>; gpio-controller; compatible = "aspeed,ast2500-gpio"; - reg = <0x1e780000 0x1000>; + reg = <0x1e780000 0x0200>; interrupts = <20>; - gpio-ranges = <&pinctrl 0 0 220>; + gpio-ranges = <&pinctrl 0 0 232>; clocks = <&syscon ASPEED_CLK_APB>; -@@ -291,6 +291,15 @@ +@@ -319,6 +319,15 @@ #interrupt-cells = <2>; }; @@ -37,7 +37,7 @@ index dc58eb8c6969..db82f47339aa 100644 rtc: rtc@1e781000 { compatible = "aspeed,ast2500-rtc"; reg = <0x1e781000 0x18>; -@@ -366,6 +375,13 @@ +@@ -394,6 +403,13 @@ status = "disabled"; }; diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-New-flash-map-for-intel.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0015-New-flash-map-for-intel.patch index 695491d28..695491d28 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-New-flash-map-for-intel.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0015-New-flash-map-for-intel.patch diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Add-ASPEED-SGPIO-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0016-Add-ASPEED-SGPIO-driver.patch index 146a725dd..07bdf60af 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Add-ASPEED-SGPIO-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0016-Add-ASPEED-SGPIO-driver.patch @@ -1,4 +1,4 @@ -From e6923abbc90b5b00bc9ea401fbb2a28971d19cbe Mon Sep 17 00:00:00 2001 +From ab104c6067683a3a251e2814991474243b7e1cb8 Mon Sep 17 00:00:00 2001 From: "Feist, James" <james.feist@intel.com> Date: Tue, 4 Jun 2019 14:00:39 -0700 Subject: [PATCH] gpio: aspeed: add ASPEED SGPIO driver @@ -10,21 +10,21 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> --- drivers/gpio/Kconfig | 8 + drivers/gpio/Makefile | 1 + - drivers/gpio/sgpio-aspeed.c | 708 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 717 insertions(+) + drivers/gpio/sgpio-aspeed.c | 703 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 712 insertions(+) create mode 100644 drivers/gpio/sgpio-aspeed.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig -index acd40eb51c46..20808e48229a 100644 +index bb13c266c329..4061686d8651 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -124,6 +124,14 @@ config GPIO_ASPEED +@@ -120,6 +120,14 @@ config GPIO_ASPEED help Say Y here to support Aspeed AST2400 and AST2500 GPIO controllers. +config SGPIO_ASPEED -+ bool "ASPEED SGPIO support" -+ depends on ARCH_ASPEED ++ tristate "ASPEED SGPIO support" ++ depends on (ARCH_ASPEED || COMPILE_TEST) && OF_GPIO + select GPIO_GENERIC + select GPIOLIB_IRQCHIP + help @@ -34,23 +34,23 @@ index acd40eb51c46..20808e48229a 100644 tristate "Atheros AR71XX/AR724X/AR913X GPIO support" default y if ATH79 diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile -index 6700eee860b7..77c6ec0ee98f 100644 +index a4e91175c708..bebbd8205c11 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile -@@ -33,6 +33,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o - obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o - obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o - obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o -+obj-$(CONFIG_SGPIO_ASPEED) += sgpio-aspeed.o - obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o - obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o - obj-$(CONFIG_GPIO_BD9571MWV) += gpio-bd9571mwv.o +@@ -32,6 +32,7 @@ obj-$(CONFIG_GPIO_AMD_FCH) += gpio-amd-fch.o + obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o + obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o + obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o ++obj-$(CONFIG_SGPIO_ASPEED) += sgpio-aspeed.o + obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o + obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o + obj-$(CONFIG_GPIO_BD70528) += gpio-bd70528.o diff --git a/drivers/gpio/sgpio-aspeed.c b/drivers/gpio/sgpio-aspeed.c new file mode 100644 -index 000000000000..6fb402a3f74d +index 000000000000..b6e9ccee774d --- /dev/null +++ b/drivers/gpio/sgpio-aspeed.c -@@ -0,0 +1,708 @@ +@@ -0,0 +1,703 @@ +// SPDX-License-Identifier: GPL-2.0+ +// Copyright (c) 2019 Intel Corporation + @@ -87,12 +87,11 @@ index 000000000000..6fb402a3f74d + +struct aspeed_sgpio { + struct gpio_chip chip; ++ struct irq_chip irqc; + spinlock_t lock; + void __iomem *base; + int irq; + const struct aspeed_sgpio_config *config; -+ -+ u32 *dcache; +}; + +struct aspeed_sgpio_bank { @@ -310,6 +309,8 @@ index 000000000000..6fb402a3f74d + if (!have_output(gpio, offset)) + return -ENOTSUPP; + ++ aspeed_sgpio_set(gc, offset, val); ++ + return 0; +} + @@ -498,16 +499,11 @@ index 000000000000..6fb402a3f74d + chained_irq_exit(ic, desc); +} + -+static struct irq_chip aspeed_sgpio_irqchip = { -+ .name = "aspeed-sgpio", -+ .irq_ack = aspeed_sgpio_irq_ack, -+ .irq_mask = aspeed_sgpio_irq_mask, -+ .irq_unmask = aspeed_sgpio_irq_unmask, -+ .irq_set_type = aspeed_sgpio_set_type, -+}; -+ -+static void set_irq_valid_mask(struct aspeed_sgpio *gpio) ++static void aspeed_sgpio_init_irq_valid_mask(struct gpio_chip *gc, ++ unsigned long *valid_mask, ++ unsigned int ngpios) +{ ++ struct aspeed_sgpio *gpio = gpiochip_get_data(gc); + const struct aspeed_bank_props *props = gpio->config->props; + + while (!is_bank_props_sentinel(props)) { @@ -518,10 +514,10 @@ index 000000000000..6fb402a3f74d + for_each_clear_bit(offset, &input, 32) { + unsigned int i = props->bank * 32 + offset; + -+ if (i >= gpio->config->nr_gpios) ++ if (i >= gpio->chip.ngpio) + break; + -+ clear_bit(i, gpio->chip.irq.valid_mask); ++ clear_bit(i, valid_mask); + } + + props++; @@ -529,9 +525,10 @@ index 000000000000..6fb402a3f74d +} + +static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio, -+ struct platform_device *pdev) ++ struct platform_device *pdev) +{ + const struct aspeed_sgpio_bank *bank; ++ struct gpio_irq_chip *girq; + int rc, i; + + /* Initialize IRQ and tolerant settings */ @@ -561,18 +558,24 @@ index 000000000000..6fb402a3f74d + return rc; + + gpio->irq = rc; -+ -+ set_irq_valid_mask(gpio); -+ -+ rc = gpiochip_irqchip_add(&gpio->chip, &aspeed_sgpio_irqchip, -+ 0, handle_bad_irq, IRQ_TYPE_NONE); -+ if (rc) { -+ dev_info(&pdev->dev, "Could not add irqchip\n"); -+ return rc; -+ } -+ -+ gpiochip_set_chained_irqchip(&gpio->chip, &aspeed_sgpio_irqchip, -+ gpio->irq, aspeed_sgpio_irq_handler); ++ girq = &gpio->chip.irq; ++ girq->chip = &gpio->irqc; ++ girq->chip->name = dev_name(&pdev->dev); ++ girq->chip->irq_ack = aspeed_sgpio_irq_ack; ++ girq->chip->irq_mask = aspeed_sgpio_irq_mask; ++ girq->chip->irq_unmask = aspeed_sgpio_irq_unmask; ++ girq->chip->irq_set_type = aspeed_sgpio_set_type; ++ girq->parent_handler = aspeed_sgpio_irq_handler; ++ girq->num_parents = 1; ++ girq->parents = devm_kcalloc(&pdev->dev, 1, ++ sizeof(*girq->parents), ++ GFP_KERNEL); ++ if (!girq->parents) ++ return -ENOMEM; ++ girq->parents[0] = gpio->irq; ++ girq->default_type = IRQ_TYPE_NONE; ++ girq->handler = handle_bad_irq; ++ girq->init_valid_mask = aspeed_sgpio_init_irq_valid_mask; + + return 0; +} @@ -658,7 +661,7 @@ index 000000000000..6fb402a3f74d + struct aspeed_sgpio *gpio; + unsigned long src_freq; + struct clk *clk; -+ int rc, banks; ++ int rc; + + gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); + if (!gpio) @@ -684,8 +687,10 @@ index 000000000000..6fb402a3f74d + + clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(clk)) { -+ dev_err(&pdev->dev, "Failed to get clk source.\n"); -+ return PTR_ERR(clk); ++ rc = PTR_ERR(clk); ++ if (rc != -EPROBE_DEFER) ++ dev_err(&pdev->dev, "Failed to get clk source.\n"); ++ return rc; + } + + /* @@ -729,22 +734,12 @@ index 000000000000..6fb402a3f74d + gpio->chip.set_config = aspeed_sgpio_set_config; + gpio->chip.label = dev_name(&pdev->dev); + gpio->chip.base = -1; -+ gpio->chip.irq.need_valid_mask = true; -+ -+ /* Allocate a cache of the output registers */ -+ banks = gpio->config->nr_gpios >> 5; -+ -+ gpio->dcache = devm_kcalloc(&pdev->dev, -+ banks, sizeof(u32), GFP_KERNEL); -+ -+ if (!gpio->dcache) -+ return -ENOMEM; + -+ rc = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); ++ rc = aspeed_sgpio_setup_irqs(gpio, pdev); + if (rc < 0) + return rc; + -+ return aspeed_sgpio_setup_irqs(gpio, pdev); ++ return devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); +} + +static struct platform_driver aspeed_sgpio_driver = { diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-SGPIO-DT-and-pinctrl-fixup.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0017-SGPIO-DT-and-pinctrl-fixup.patch index 4210d9f67..6bfcb43c4 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-SGPIO-DT-and-pinctrl-fixup.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0017-SGPIO-DT-and-pinctrl-fixup.patch @@ -1,4 +1,4 @@ -From 0f63ecc25766fdf66610d08441e59147a4cbde78 Mon Sep 17 00:00:00 2001 +From 4c5ab7c103b693096ae719abd16bc80b81043beb Mon Sep 17 00:00:00 2001 From: Vernon Mauery <vernon.mauery@intel.com> Date: Wed, 16 May 2018 10:03:14 -0700 Subject: [PATCH] SGPIO DT and pinctrl fixup @@ -9,16 +9,15 @@ Signed-off-by: Vernon Mauery <vernon.mauery@intel.com> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> --- arch/arm/boot/dts/aspeed-g4.dtsi | 56 +++++++++++------------------- - arch/arm/boot/dts/aspeed-g5.dtsi | 10 ++++++ + arch/arm/boot/dts/aspeed-g5.dtsi | 5 +++ drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c | 48 ++++++++++++------------- - drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 4 +++ - 4 files changed, 58 insertions(+), 60 deletions(-) + 3 files changed, 49 insertions(+), 60 deletions(-) diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi -index fd857be397bf..58306a8232c9 100644 +index cc78564b2f8d..ee86b41af291 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi -@@ -207,6 +207,20 @@ +@@ -255,6 +255,20 @@ #interrupt-cells = <2>; }; @@ -39,7 +38,7 @@ index fd857be397bf..58306a8232c9 100644 timer: timer@1e782000 { /* This timer is a Faraday FTTMR010 derivative */ compatible = "aspeed,ast2400-timer"; -@@ -1180,44 +1194,14 @@ +@@ -1228,44 +1242,14 @@ groups = "SD2"; }; @@ -91,10 +90,10 @@ index fd857be397bf..58306a8232c9 100644 pinctrl_sioonctrl_default: sioonctrl_default { diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index db82f47339aa..425a542690de 100644 +index 271f3c96456a..128e0b5bbae2 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -298,6 +298,11 @@ +@@ -326,6 +326,11 @@ reg = <0x1e780200 0x0100>; interrupts = <40>; interrupt-controller; @@ -106,77 +105,65 @@ index db82f47339aa..425a542690de 100644 }; rtc: rtc@1e781000 { -@@ -1403,6 +1408,11 @@ - groups = "SDA2"; - }; - -+ pinctrl_sgpm_default: sgpm_default { -+ function = "SGPM"; -+ groups = "SGPM"; -+ }; -+ - pinctrl_sgps1_default: sgps1_default { - function = "SGPS1"; - groups = "SGPS1"; diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c -index 384396cbb22d..a78ed8c33e96 100644 +index 95ea593fa29d..70284c5f9ad9 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c -@@ -423,16 +423,22 @@ SSSF_PIN_DECL(E16, GPIOF6, TXD4, SIG_DESC_SET(SCU80, 30)); +@@ -430,16 +430,22 @@ SSSF_PIN_DECL(E16, GPIOF6, TXD4, SIG_DESC_SET(SCU80, 30)); SSSF_PIN_DECL(C17, GPIOF7, RXD4, SIG_DESC_SET(SCU80, 31)); #define A14 48 -SSSF_PIN_DECL(A14, GPIOG0, SGPSCK, SIG_DESC_SET(SCU84, 0)); -+SIG_EXPR_LIST_DECL_SINGLE(SGPSCK, SGPS, SIG_DESC_SET(SCU84, 0)); -+SS_PIN_DECL(A14, GPIOG0, SGPSCK); ++SIG_EXPR_LIST_DECL_SINGLE(A14, SGPSCK, SGPS, SIG_DESC_SET(SCU84, 0)); ++PIN_DECL_1(A14, GPIOG0, SGPSCK); #define E13 49 -SSSF_PIN_DECL(E13, GPIOG1, SGPSLD, SIG_DESC_SET(SCU84, 1)); -+SIG_EXPR_LIST_DECL_SINGLE(SGPSLD, SGPS, SIG_DESC_SET(SCU84, 1)); -+SS_PIN_DECL(E13, GPIOG1, SGPSLD); ++SIG_EXPR_LIST_DECL_SINGLE(E13, SGPSLD, SGPS, SIG_DESC_SET(SCU84, 1)); ++PIN_DECL_1(E13, GPIOG1, SGPSLD); #define D13 50 -SSSF_PIN_DECL(D13, GPIOG2, SGPSI0, SIG_DESC_SET(SCU84, 2)); -+SIG_EXPR_LIST_DECL_SINGLE(SGPSIO, SGPS, SIG_DESC_SET(SCU84, 2)); -+SS_PIN_DECL(D13, GPIOG2, SGPSIO); ++SIG_EXPR_LIST_DECL_SINGLE(D13, SGPSIO, SGPS, SIG_DESC_SET(SCU84, 2)); ++PIN_DECL_1(D13, GPIOG2, SGPSIO); #define C13 51 -SSSF_PIN_DECL(C13, GPIOG3, SGPSI1, SIG_DESC_SET(SCU84, 3)); -+SIG_EXPR_LIST_DECL_SINGLE(SGPSI1, SGPS, SIG_DESC_SET(SCU84, 3)); -+SS_PIN_DECL(C13, GPIOG3, SGPSI1); ++SIG_EXPR_LIST_DECL_SINGLE(C13, SGPSI1, SGPS, SIG_DESC_SET(SCU84, 3)); ++PIN_DECL_1(C13, GPIOG3, SGPSI1); + +FUNC_GROUP_DECL(SGPS, A14, E13, D13, C13); #define B13 52 - SIG_EXPR_LIST_DECL_SINGLE(OSCCLK, OSCCLK, SIG_DESC_SET(SCU2C, 1)); -@@ -598,16 +604,22 @@ FUNC_GROUP_DECL(SPI1PASSTHRU, C22, G18, D19, C20, B22, G19, C18, E20); + SIG_EXPR_LIST_DECL_SINGLE(B13, OSCCLK, OSCCLK, SIG_DESC_SET(SCU2C, 1)); +@@ -613,16 +619,22 @@ FUNC_GROUP_DECL(SPI1PASSTHRU, C22, G18, D19, C20, B22, G19, C18, E20); FUNC_GROUP_DECL(VGABIOS_ROM, B22, G19, C18, E20); #define J5 72 -SSSF_PIN_DECL(J5, GPIOJ0, SGPMCK, SIG_DESC_SET(SCU84, 8)); -+SIG_EXPR_LIST_DECL_SINGLE(SGPMCK, SGPM, SIG_DESC_SET(SCU84, 8)); -+SS_PIN_DECL(J5, GPIOJ0, SGPMCK); ++SIG_EXPR_LIST_DECL_SINGLE(J5, SGPMCK, SGPM, SIG_DESC_SET(SCU84, 8)); ++PIN_DECL_1(J5, GPIOJ0, SGPMCK); #define J4 73 -SSSF_PIN_DECL(J4, GPIOJ1, SGPMLD, SIG_DESC_SET(SCU84, 9)); -+SIG_EXPR_LIST_DECL_SINGLE(SGPMLD, SGPM, SIG_DESC_SET(SCU84, 9)); -+SS_PIN_DECL(J4, GPIOJ1, SGPMLD); ++SIG_EXPR_LIST_DECL_SINGLE(J4, SGPMLD, SGPM, SIG_DESC_SET(SCU84, 9)); ++PIN_DECL_1(J4, GPIOJ1, SGPMLD); #define K5 74 -SSSF_PIN_DECL(K5, GPIOJ2, SGPMO, SIG_DESC_SET(SCU84, 10)); -+SIG_EXPR_LIST_DECL_SINGLE(SGPMO, SGPM, SIG_DESC_SET(SCU84, 10)); -+SS_PIN_DECL(K5, GPIOJ2, SGPMO); ++SIG_EXPR_LIST_DECL_SINGLE(K5, SGPMO, SGPM, SIG_DESC_SET(SCU84, 10)); ++PIN_DECL_1(K5, GPIOJ2, SGPMO); #define J3 75 -SSSF_PIN_DECL(J3, GPIOJ3, SGPMI, SIG_DESC_SET(SCU84, 11)); -+SIG_EXPR_LIST_DECL_SINGLE(SGPMI, SGPM, SIG_DESC_SET(SCU84, 11)); -+SS_PIN_DECL(J3, GPIOJ3, SGPMI); ++SIG_EXPR_LIST_DECL_SINGLE(J3, SGPMI, SGPM, SIG_DESC_SET(SCU84, 11)); ++PIN_DECL_1(J3, GPIOJ3, SGPMI); + +FUNC_GROUP_DECL(SGPM, J5, J4, K5, J3); #define T4 76 SSSF_PIN_DECL(T4, GPIOJ4, VGAHS, SIG_DESC_SET(SCU84, 12)); -@@ -2105,14 +2117,8 @@ static const struct aspeed_pin_group aspeed_g4_groups[] = { +@@ -2234,14 +2246,8 @@ static const struct aspeed_pin_group aspeed_g4_groups[] = { ASPEED_PINCTRL_GROUP(SALT4), ASPEED_PINCTRL_GROUP(SD1), ASPEED_PINCTRL_GROUP(SD2), @@ -193,7 +180,7 @@ index 384396cbb22d..a78ed8c33e96 100644 ASPEED_PINCTRL_GROUP(SIOONCTRL), ASPEED_PINCTRL_GROUP(SIOPBI), ASPEED_PINCTRL_GROUP(SIOPBO), -@@ -2260,14 +2266,8 @@ static const struct aspeed_pin_function aspeed_g4_functions[] = { +@@ -2389,14 +2395,8 @@ static const struct aspeed_pin_function aspeed_g4_functions[] = { ASPEED_PINCTRL_FUNC(SALT4), ASPEED_PINCTRL_FUNC(SD1), ASPEED_PINCTRL_FUNC(SD2), @@ -210,35 +197,6 @@ index 384396cbb22d..a78ed8c33e96 100644 ASPEED_PINCTRL_FUNC(SIOONCTRL), ASPEED_PINCTRL_FUNC(SIOPBI), ASPEED_PINCTRL_FUNC(SIOPBO), -diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c -index 6f151e7c8d81..c088f010c554 100644 ---- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c -+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c -@@ -599,6 +599,8 @@ SS_PIN_DECL(N3, GPIOJ2, SGPMO); - SIG_EXPR_LIST_DECL_SINGLE(SGPMI, SGPM, SIG_DESC_SET(SCU84, 11)); - SS_PIN_DECL(N4, GPIOJ3, SGPMI); - -+FUNC_GROUP_DECL(SGPM, R2, L2, N3, N4); -+ - #define N5 76 - SIG_EXPR_LIST_DECL_SINGLE(VGAHS, VGAHS, SIG_DESC_SET(SCU84, 12)); - SIG_EXPR_LIST_DECL_SINGLE(DASHN5, DASHN5, SIG_DESC_SET(SCU94, 8)); -@@ -2149,6 +2151,7 @@ static const struct aspeed_pin_group aspeed_g5_groups[] = { - ASPEED_PINCTRL_GROUP(SD2), - ASPEED_PINCTRL_GROUP(SDA1), - ASPEED_PINCTRL_GROUP(SDA2), -+ ASPEED_PINCTRL_GROUP(SGPM), - ASPEED_PINCTRL_GROUP(SGPS1), - ASPEED_PINCTRL_GROUP(SGPS2), - ASPEED_PINCTRL_GROUP(SIOONCTRL), -@@ -2318,6 +2321,7 @@ static const struct aspeed_pin_function aspeed_g5_functions[] = { - ASPEED_PINCTRL_FUNC(SD2), - ASPEED_PINCTRL_FUNC(SDA1), - ASPEED_PINCTRL_FUNC(SDA2), -+ ASPEED_PINCTRL_FUNC(SGPM), - ASPEED_PINCTRL_FUNC(SGPS1), - ASPEED_PINCTRL_FUNC(SGPS2), - ASPEED_PINCTRL_FUNC(SIOONCTRL), -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0018-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch index 329a92cd6..77e413125 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0018-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch @@ -1,4 +1,4 @@ -From 691b8580a1592eddb919e8dd295e6c1f136a4c00 Mon Sep 17 00:00:00 2001 +From edeea958f026102ce28c8b760f7a96b9ffd7f65a Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Mon, 7 Jan 2019 09:56:10 -0800 Subject: [PATCH] Update PECI drivers to sync with linux upstreaming version @@ -7,10 +7,11 @@ Upstreaming is in holding. It's for adding DTS sensor with PECI subsystem code update. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> --- Documentation/hwmon/peci-cputemp | 34 +- drivers/hwmon/Kconfig | 4 +- - drivers/hwmon/peci-cputemp.c | 171 ++++--- + drivers/hwmon/peci-cputemp.c | 171 +++--- drivers/hwmon/peci-dimmtemp.c | 184 +++++-- drivers/hwmon/peci-hwmon.h | 9 +- drivers/mfd/Kconfig | 5 +- @@ -19,16 +20,16 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> drivers/peci/Makefile | 7 +- drivers/peci/busses/Kconfig | 32 ++ drivers/peci/busses/Makefile | 7 + - drivers/peci/busses/peci-aspeed.c | 492 ++++++++++++++++++ + drivers/peci/busses/peci-aspeed.c | 492 +++++++++++++++++ drivers/peci/busses/peci-npcm.c | 410 +++++++++++++++ - drivers/peci/peci-aspeed.c | 505 ------------------- - drivers/peci/peci-core.c | 914 ++++++++++++++++++---------------- - drivers/peci/peci-dev.c | 346 +++++++++++++ + drivers/peci/peci-aspeed.c | 505 ------------------ + drivers/peci/peci-core.c | 959 +++++++++++++++++++--------------- + drivers/peci/peci-dev.c | 346 ++++++++++++ drivers/peci/peci-npcm.c | 410 --------------- include/linux/mfd/intel-peci-client.h | 31 +- include/linux/peci.h | 30 +- - include/uapi/linux/peci-ioctl.h | 416 +++++++++------- - 20 files changed, 2402 insertions(+), 1702 deletions(-) + include/uapi/linux/peci-ioctl.h | 416 +++++++++------ + 20 files changed, 2446 insertions(+), 1703 deletions(-) create mode 100644 drivers/peci/busses/Kconfig create mode 100644 drivers/peci/busses/Makefile create mode 100644 drivers/peci/busses/peci-aspeed.c @@ -38,7 +39,7 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> delete mode 100644 drivers/peci/peci-npcm.c diff --git a/Documentation/hwmon/peci-cputemp b/Documentation/hwmon/peci-cputemp -index 821a9258f2e6..a3a3e465c888 100644 +index 821a925..a3a3e46 100644 --- a/Documentation/hwmon/peci-cputemp +++ b/Documentation/hwmon/peci-cputemp @@ -51,28 +51,38 @@ temp1_crit Provides shutdown temperature of the CPU package which @@ -93,7 +94,7 @@ index 821a9258f2e6..a3a3e465c888 100644 +temp[6-*]_crit_hyst Provides the hysteresis value from Tcontrol to Tjmax of the core. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig -index c0623fa5ba41..7399c3cef30c 100644 +index c0623fa..7399c3c 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1333,7 +1333,7 @@ config SENSORS_PECI_CPUTEMP @@ -115,7 +116,7 @@ index c0623fa5ba41..7399c3cef30c 100644 source "drivers/hwmon/pmbus/Kconfig" diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c -index 11880c86a854..d0d68e88889f 100644 +index 11880c8..d0d68e8 100644 --- a/drivers/hwmon/peci-cputemp.c +++ b/drivers/hwmon/peci-cputemp.c @@ -1,5 +1,5 @@ @@ -477,7 +478,7 @@ index 11880c86a854..d0d68e88889f 100644 module_platform_driver(peci_cputemp_driver); diff --git a/drivers/hwmon/peci-dimmtemp.c b/drivers/hwmon/peci-dimmtemp.c -index 86a45a90805b..a404b6ea4ba3 100644 +index 86a45a9..a404b6e 100644 --- a/drivers/hwmon/peci-dimmtemp.c +++ b/drivers/hwmon/peci-dimmtemp.c @@ -1,5 +1,5 @@ @@ -795,7 +796,7 @@ index 86a45a90805b..a404b6ea4ba3 100644 module_platform_driver(peci_dimmtemp_driver); diff --git a/drivers/hwmon/peci-hwmon.h b/drivers/hwmon/peci-hwmon.h -index 6ca1855a86bb..ce6b470eae63 100644 +index 6ca1855..ce6b470 100644 --- a/drivers/hwmon/peci-hwmon.h +++ b/drivers/hwmon/peci-hwmon.h @@ -1,5 +1,5 @@ @@ -820,10 +821,10 @@ index 6ca1855a86bb..ce6b470eae63 100644 /** diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig -index 75dbcc7da87c..6f7ee4dd08f6 100644 +index 5d89546..46f52a3 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig -@@ -616,7 +616,7 @@ config MFD_INTEL_MSIC +@@ -630,7 +630,7 @@ config MFD_INTEL_MSIC devices used in Intel Medfield platforms. config MFD_INTEL_PECI_CLIENT @@ -832,7 +833,7 @@ index 75dbcc7da87c..6f7ee4dd08f6 100644 depends on (PECI || COMPILE_TEST) select MFD_CORE help -@@ -629,6 +629,9 @@ config MFD_INTEL_PECI_CLIENT +@@ -643,6 +643,9 @@ config MFD_INTEL_PECI_CLIENT Additional drivers must be enabled in order to use the functionality of the device. @@ -843,7 +844,7 @@ index 75dbcc7da87c..6f7ee4dd08f6 100644 bool "Atmel Micro ASIC (iPAQ h3100/h3600/h3700) Support" depends on SA1100_H3100 || SA1100_H3600 diff --git a/drivers/mfd/intel-peci-client.c b/drivers/mfd/intel-peci-client.c -index d53e4f1078ac..18bf0af0e09e 100644 +index d53e4f1..18bf0af 100644 --- a/drivers/mfd/intel-peci-client.c +++ b/drivers/mfd/intel-peci-client.c @@ -1,12 +1,12 @@ @@ -989,7 +990,7 @@ index d53e4f1078ac..18bf0af0e09e 100644 }, }; diff --git a/drivers/peci/Kconfig b/drivers/peci/Kconfig -index 7293108fb543..9752feee2454 100644 +index 7293108..9752fee 100644 --- a/drivers/peci/Kconfig +++ b/drivers/peci/Kconfig @@ -2,10 +2,12 @@ @@ -1059,7 +1060,7 @@ index 7293108fb543..9752feee2454 100644 + +endmenu diff --git a/drivers/peci/Makefile b/drivers/peci/Makefile -index 3326da54a21a..da8b0a33fa42 100644 +index 3326da5..da8b0a3 100644 --- a/drivers/peci/Makefile +++ b/drivers/peci/Makefile @@ -1,10 +1,11 @@ @@ -1079,7 +1080,7 @@ index 3326da54a21a..da8b0a33fa42 100644 +obj-y += busses/ diff --git a/drivers/peci/busses/Kconfig b/drivers/peci/busses/Kconfig new file mode 100644 -index 000000000000..bfacafb7a7ba +index 0000000..bfacafb --- /dev/null +++ b/drivers/peci/busses/Kconfig @@ -0,0 +1,32 @@ @@ -1117,7 +1118,7 @@ index 000000000000..bfacafb7a7ba +endmenu diff --git a/drivers/peci/busses/Makefile b/drivers/peci/busses/Makefile new file mode 100644 -index 000000000000..aa8ce3ae5947 +index 0000000..aa8ce3a --- /dev/null +++ b/drivers/peci/busses/Makefile @@ -0,0 +1,7 @@ @@ -1130,7 +1131,7 @@ index 000000000000..aa8ce3ae5947 +obj-$(CONFIG_PECI_NPCM) += peci-npcm.o diff --git a/drivers/peci/busses/peci-aspeed.c b/drivers/peci/busses/peci-aspeed.c new file mode 100644 -index 000000000000..851b71e32eac +index 0000000..851b71e3 --- /dev/null +++ b/drivers/peci/busses/peci-aspeed.c @@ -0,0 +1,492 @@ @@ -1628,7 +1629,7 @@ index 000000000000..851b71e32eac +MODULE_LICENSE("GPL v2"); diff --git a/drivers/peci/busses/peci-npcm.c b/drivers/peci/busses/peci-npcm.c new file mode 100644 -index 000000000000..f632365b1416 +index 0000000..f632365 --- /dev/null +++ b/drivers/peci/busses/peci-npcm.c @@ -0,0 +1,410 @@ @@ -2044,7 +2045,7 @@ index 000000000000..f632365b1416 +MODULE_LICENSE("GPL v2"); diff --git a/drivers/peci/peci-aspeed.c b/drivers/peci/peci-aspeed.c deleted file mode 100644 -index 51cb2563ceb6..000000000000 +index 51cb256..0000000 --- a/drivers/peci/peci-aspeed.c +++ /dev/null @@ -1,505 +0,0 @@ @@ -2554,7 +2555,7 @@ index 51cb2563ceb6..000000000000 -MODULE_DESCRIPTION("ASPEED PECI driver"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c -index 6f241469ec7e..48f29de09311 100644 +index 6f24146..2a6be04 100644 --- a/drivers/peci/peci-core.c +++ b/drivers/peci/peci-core.c @@ -1,38 +1,31 @@ @@ -2654,8 +2655,7 @@ index 6f241469ec7e..48f29de09311 100644 + * This function must only be called from process context! + */ +struct peci_xfer_msg *peci_get_xfer_msg(u8 tx_len, u8 rx_len) - { -- return crc8(peci_crc8_table, data, (size_t)len, 0); ++{ + struct peci_xfer_msg *msg; + u8 *tx_buf, *rx_buf; + @@ -2712,7 +2712,8 @@ index 6f241469ec7e..48f29de09311 100644 + +/* Calculate an Assured Write Frame Check Sequence byte */ +static int peci_aw_fcs(struct peci_xfer_msg *msg, int len, u8 *aw_fcs) -+{ + { +- return crc8(peci_crc8_table, data, (size_t)len, 0); + u8 *tmp_buf; + + /* Allocate a temporary buffer to use a contiguous byte array */ @@ -2804,11 +2805,11 @@ index 6f241469ec7e..48f29de09311 100644 + ret = peci_aw_fcs(msg, 2 + msg->tx_len, &aw_fcs); + if (ret) + break; -+ -+ msg->tx_buf[msg->tx_len - 1] = 0x80 ^ aw_fcs; -+ } - /** ++ msg->tx_buf[msg->tx_len - 1] = 0x80 ^ aw_fcs; ++ } ++ + /* * Retry for at least 250ms before returning an error. * Retry interval guideline: @@ -2910,7 +2911,7 @@ index 6f241469ec7e..48f29de09311 100644 { if (!(adapter->cmd_mask & BIT(PECI_CMD_PING)) && peci_scan_cmd_mask(adapter) < 0) { -@@ -262,70 +363,87 @@ static int peci_cmd_support(struct peci_adapter *adapter, enum peci_cmd cmd) +@@ -262,70 +363,130 @@ static int peci_cmd_support(struct peci_adapter *adapter, enum peci_cmd cmd) return 0; } @@ -2918,8 +2919,52 @@ index 6f241469ec7e..48f29de09311 100644 +static int peci_cmd_xfer(struct peci_adapter *adapter, void *vmsg) { struct peci_xfer_msg *msg = vmsg; ++ u8 aw_fcs; ++ int ret; ++ ++ if (!msg->tx_len) { ++ ret = peci_xfer(adapter, msg); ++ } else { ++ switch (msg->tx_buf[0]) { ++ case PECI_RDPKGCFG_CMD: ++ case PECI_RDIAMSR_CMD: ++ case PECI_RDPCICFG_CMD: ++ case PECI_RDPCICFGLOCAL_CMD: ++ ret = peci_xfer_with_retries(adapter, msg, false); ++ break; ++ case PECI_WRPKGCFG_CMD: ++ case PECI_WRIAMSR_CMD: ++ case PECI_WRPCICFG_CMD: ++ case PECI_WRPCICFGLOCAL_CMD: ++ /* Check if the AW FCS byte is already provided */ ++ ret = peci_aw_fcs(msg, 2 + msg->tx_len, &aw_fcs); ++ if (ret) ++ break; ++ ++ if (msg->tx_buf[msg->tx_len - 1] != (0x80 ^ aw_fcs)) { ++ /* Add an Assured Write Frame Check Sequence byte */ ++ /* Increment the tx_len to include the new byte */ ++ msg->tx_len++; ++ ret = peci_aw_fcs(msg, 2 + msg->tx_len, ++ &aw_fcs); ++ if (ret) ++ break; ++ ++ msg->tx_buf[msg->tx_len - 1] = 0x80 ^ aw_fcs; ++ } ++ ++ ret = peci_xfer_with_retries(adapter, msg, true); ++ break; ++ case PECI_GET_DIB_CMD: ++ case PECI_GET_TEMP_CMD: ++ default: ++ ret = peci_xfer(adapter, msg); ++ break; ++ } ++ } - return peci_xfer(adapter, msg); +- return peci_xfer(adapter, msg); ++ return ret; } -static int peci_ioctl_ping(struct peci_adapter *adapter, void *vmsg) @@ -2933,15 +2978,15 @@ index 6f241469ec7e..48f29de09311 100644 + msg = peci_get_xfer_msg(0, 0); + if (!msg) + return -ENOMEM; -+ -+ msg->addr = umsg->addr; - msg.addr = umsg->addr; - msg.tx_len = 0; - msg.rx_len = 0; -+ ret = peci_xfer(adapter, msg); ++ msg->addr = umsg->addr; - return peci_xfer(adapter, &msg); ++ ret = peci_xfer(adapter, msg); ++ + peci_put_xfer_msg(msg); + + return ret; @@ -3032,7 +3077,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Per the PECI spec, the read length must be a byte, word, or dword */ if (umsg->rx_len != 1 && umsg->rx_len != 2 && umsg->rx_len != 4) { -@@ -334,29 +452,35 @@ static int peci_ioctl_rd_pkg_cfg(struct peci_adapter *adapter, void *vmsg) +@@ -334,29 +495,35 @@ static int peci_ioctl_rd_pkg_cfg(struct peci_adapter *adapter, void *vmsg) return -EINVAL; } @@ -3058,18 +3103,18 @@ index 6f241469ec7e..48f29de09311 100644 + msg->tx_buf[2] = umsg->index; /* RdPkgConfig index */ + msg->tx_buf[3] = (u8)umsg->param; /* LSB - Config parameter */ + msg->tx_buf[4] = (u8)(umsg->param >> 8); /* MSB - Config parameter */ - -- rc = peci_xfer_with_retries(adapter, &msg, false); -- if (!rc) -- memcpy(umsg->pkg_config, &msg.rx_buf[1], umsg->rx_len); ++ + ret = peci_xfer_with_retries(adapter, msg, false); + if (!ret) + memcpy(umsg->pkg_config, &msg->rx_buf[1], umsg->rx_len); -- return rc; +- rc = peci_xfer_with_retries(adapter, &msg, false); +- if (!rc) +- memcpy(umsg->pkg_config, &msg.rx_buf[1], umsg->rx_len); + umsg->cc = msg->rx_buf[0]; + peci_put_xfer_msg(msg); -+ + +- return rc; + return ret; } @@ -3085,7 +3130,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Per the PECI spec, the write length must be a dword */ if (umsg->tx_len != 4) { -@@ -365,86 +489,116 @@ static int peci_ioctl_wr_pkg_cfg(struct peci_adapter *adapter, void *vmsg) +@@ -365,86 +532,116 @@ static int peci_ioctl_wr_pkg_cfg(struct peci_adapter *adapter, void *vmsg) return -EINVAL; } @@ -3118,20 +3163,20 @@ index 6f241469ec7e..48f29de09311 100644 + ret = peci_aw_fcs(msg, 8 + umsg->tx_len, &aw_fcs); + if (ret) + goto out; ++ ++ msg->tx_buf[5 + i] = 0x80 ^ aw_fcs; - /* Add an Assure Write Frame Check Sequence byte */ - msg.tx_buf[5 + i] = 0x80 ^ - peci_aw_fcs((u8 *)&msg, 8 + umsg->tx_len); -+ msg->tx_buf[5 + i] = 0x80 ^ aw_fcs; - -- rc = peci_xfer_with_retries(adapter, &msg, true); + ret = peci_xfer_with_retries(adapter, msg, true); -- return rc; +- rc = peci_xfer_with_retries(adapter, &msg, true); +out: + umsg->cc = msg->rx_buf[0]; + peci_put_xfer_msg(msg); -+ + +- return rc; + return ret; } @@ -3226,23 +3271,23 @@ index 6f241469ec7e..48f29de09311 100644 + ret = peci_xfer_with_retries(adapter, msg, false); + if (!ret) + memcpy(umsg->pci_config, &msg->rx_buf[1], 4); ++ ++ umsg->cc = msg->rx_buf[0]; ++ peci_put_xfer_msg(msg); - rc = peci_xfer_with_retries(adapter, &msg, false); - if (!rc) - memcpy(umsg->pci_config, &msg.rx_buf[1], 4); -+ umsg->cc = msg->rx_buf[0]; -+ peci_put_xfer_msg(msg); - -- return rc; + return ret; - } ++} --static int peci_ioctl_rd_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) +- return rc; +static int peci_cmd_wr_pci_cfg(struct peci_adapter *adapter, void *vmsg) +{ + return -ENOSYS; /* Not implemented yet */ -+} -+ + } + +-static int peci_ioctl_rd_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) +static int peci_cmd_rd_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) { struct peci_rd_pci_cfg_local_msg *umsg = vmsg; @@ -3254,7 +3299,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Per the PECI spec, the read length must be a byte, word, or dword */ if (umsg->rx_len != 1 && umsg->rx_len != 2 && umsg->rx_len != 4) { -@@ -453,34 +607,42 @@ static int peci_ioctl_rd_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) +@@ -453,34 +650,42 @@ static int peci_ioctl_rd_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) return -EINVAL; } @@ -3313,7 +3358,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Per the PECI spec, the write length must be a byte, word, or dword */ if (umsg->tx_len != 1 && umsg->tx_len != 2 && umsg->tx_len != 4) { -@@ -489,47 +651,57 @@ static int peci_ioctl_wr_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) +@@ -489,47 +694,57 @@ static int peci_ioctl_wr_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) return -EINVAL; } @@ -3351,20 +3396,20 @@ index 6f241469ec7e..48f29de09311 100644 + ret = peci_aw_fcs(msg, 8 + umsg->tx_len, &aw_fcs); + if (ret) + goto out; -+ -+ msg->tx_buf[5 + i] = 0x80 ^ aw_fcs; - /* Add an Assure Write Frame Check Sequence byte */ - msg.tx_buf[5 + i] = 0x80 ^ - peci_aw_fcs((u8 *)&msg, 8 + umsg->tx_len); -+ ret = peci_xfer_with_retries(adapter, msg, true); ++ msg->tx_buf[5 + i] = 0x80 ^ aw_fcs; - rc = peci_xfer_with_retries(adapter, &msg, true); ++ ret = peci_xfer_with_retries(adapter, msg, true); + +- return rc; +out: + umsg->cc = msg->rx_buf[0]; + peci_put_xfer_msg(msg); - -- return rc; ++ + return ret; } @@ -3401,7 +3446,7 @@ index 6f241469ec7e..48f29de09311 100644 }; /** -@@ -545,109 +717,28 @@ static const peci_ioctl_fn_type peci_ioctl_fn[PECI_CMD_MAX] = { +@@ -545,109 +760,28 @@ static const peci_ioctl_fn_type peci_ioctl_fn[PECI_CMD_MAX] = { */ int peci_command(struct peci_adapter *adapter, enum peci_cmd cmd, void *vmsg) { @@ -3520,7 +3565,7 @@ index 6f241469ec7e..48f29de09311 100644 static int peci_detect(struct peci_adapter *adapter, u8 addr) { struct peci_ping_msg msg; -@@ -666,9 +757,9 @@ peci_of_match_device(const struct of_device_id *matches, +@@ -666,9 +800,9 @@ peci_of_match_device(const struct of_device_id *matches, return NULL; return of_match_device(matches, &client->dev); @@ -3532,7 +3577,7 @@ index 6f241469ec7e..48f29de09311 100644 } static const struct peci_device_id * -@@ -737,6 +828,7 @@ static int peci_device_probe(struct device *dev) +@@ -737,6 +871,7 @@ static int peci_device_probe(struct device *dev) err_detach_pm_domain: dev_pm_domain_detach(&client->dev, true); @@ -3540,7 +3585,7 @@ index 6f241469ec7e..48f29de09311 100644 return status; } -@@ -775,13 +867,14 @@ static void peci_device_shutdown(struct device *dev) +@@ -775,13 +910,14 @@ static void peci_device_shutdown(struct device *dev) driver->shutdown(client); } @@ -3556,7 +3601,7 @@ index 6f241469ec7e..48f29de09311 100644 static int peci_check_addr_validity(u8 addr) { -@@ -814,18 +907,22 @@ static int peci_check_client_busy(struct device *dev, void *client_new_p) +@@ -814,18 +950,22 @@ static int peci_check_client_busy(struct device *dev, void *client_new_p) int peci_get_cpu_id(struct peci_adapter *adapter, u8 addr, u32 *cpu_id) { struct peci_rd_pkg_cfg_msg msg; @@ -3586,7 +3631,7 @@ index 6f241469ec7e..48f29de09311 100644 } EXPORT_SYMBOL_GPL(peci_get_cpu_id); -@@ -833,7 +930,7 @@ static struct peci_client *peci_new_device(struct peci_adapter *adapter, +@@ -833,7 +973,7 @@ static struct peci_client *peci_new_device(struct peci_adapter *adapter, struct peci_board_info const *info) { struct peci_client *client; @@ -3595,7 +3640,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Increase reference count for the adapter assigned */ if (!peci_get_adapter(adapter->nr)) -@@ -847,46 +944,49 @@ static struct peci_client *peci_new_device(struct peci_adapter *adapter, +@@ -847,46 +987,49 @@ static struct peci_client *peci_new_device(struct peci_adapter *adapter, client->addr = info->addr; strlcpy(client->name, info->type, sizeof(client->name)); @@ -3657,7 +3702,7 @@ index 6f241469ec7e..48f29de09311 100644 return NULL; } -@@ -895,8 +995,10 @@ static void peci_unregister_device(struct peci_client *client) +@@ -895,8 +1038,10 @@ static void peci_unregister_device(struct peci_client *client) if (!client) return; @@ -3669,7 +3714,7 @@ index 6f241469ec7e..48f29de09311 100644 device_unregister(&client->dev); } -@@ -916,7 +1018,7 @@ static void peci_adapter_dev_release(struct device *dev) +@@ -916,7 +1061,7 @@ static void peci_adapter_dev_release(struct device *dev) dev_dbg(dev, "%s: %s\n", __func__, adapter->name); mutex_destroy(&adapter->userspace_clients_lock); @@ -3678,7 +3723,7 @@ index 6f241469ec7e..48f29de09311 100644 kfree(adapter); } -@@ -928,7 +1030,8 @@ static ssize_t peci_sysfs_new_device(struct device *dev, +@@ -928,7 +1073,8 @@ static ssize_t peci_sysfs_new_device(struct device *dev, struct peci_board_info info = {}; struct peci_client *client; char *blank, end; @@ -3688,7 +3733,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Parse device type */ blank = strchr(buf, ' '); -@@ -943,16 +1046,17 @@ static ssize_t peci_sysfs_new_device(struct device *dev, +@@ -943,16 +1089,17 @@ static ssize_t peci_sysfs_new_device(struct device *dev, memcpy(info.type, buf, blank - buf); /* Parse remaining parameters, reject extra parameters */ @@ -3709,7 +3754,7 @@ index 6f241469ec7e..48f29de09311 100644 client = peci_new_device(adapter, &info); if (!client) return -EINVAL; -@@ -961,8 +1065,8 @@ static ssize_t peci_sysfs_new_device(struct device *dev, +@@ -961,8 +1108,8 @@ static ssize_t peci_sysfs_new_device(struct device *dev, mutex_lock(&adapter->userspace_clients_lock); list_add_tail(&client->detected, &adapter->userspace_clients); mutex_unlock(&adapter->userspace_clients_lock); @@ -3720,7 +3765,7 @@ index 6f241469ec7e..48f29de09311 100644 return count; } -@@ -975,9 +1079,9 @@ static ssize_t peci_sysfs_delete_device(struct device *dev, +@@ -975,9 +1122,9 @@ static ssize_t peci_sysfs_delete_device(struct device *dev, struct peci_adapter *adapter = to_peci_adapter(dev); struct peci_client *client, *next; struct peci_board_info info = {}; @@ -3732,7 +3777,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Parse device type */ blank = strchr(buf, ' '); -@@ -992,41 +1096,41 @@ static ssize_t peci_sysfs_delete_device(struct device *dev, +@@ -992,41 +1139,41 @@ static ssize_t peci_sysfs_delete_device(struct device *dev, memcpy(info.type, buf, blank - buf); /* Parse remaining parameters, reject extra parameters */ @@ -3786,7 +3831,7 @@ index 6f241469ec7e..48f29de09311 100644 } static DEVICE_ATTR_IGNORE_LOCKDEP(delete_device, 0200, NULL, peci_sysfs_delete_device); -@@ -1039,10 +1143,11 @@ static struct attribute *peci_adapter_attrs[] = { +@@ -1039,10 +1186,11 @@ static struct attribute *peci_adapter_attrs[] = { }; ATTRIBUTE_GROUPS(peci_adapter); @@ -3799,7 +3844,7 @@ index 6f241469ec7e..48f29de09311 100644 /** * peci_verify_adapter - return parameter as peci_adapter, or NULL -@@ -1063,32 +1168,26 @@ static struct peci_client *peci_of_register_device(struct peci_adapter *adapter, +@@ -1063,32 +1211,26 @@ static struct peci_client *peci_of_register_device(struct peci_adapter *adapter, struct device_node *node) { struct peci_board_info info = {}; @@ -3844,7 +3889,7 @@ index 6f241469ec7e..48f29de09311 100644 } static void peci_of_register_devices(struct peci_adapter *adapter) -@@ -1119,7 +1218,7 @@ static void peci_of_register_devices(struct peci_adapter *adapter) +@@ -1119,7 +1261,7 @@ static void peci_of_register_devices(struct peci_adapter *adapter) of_node_put(bus); } @@ -3853,7 +3898,7 @@ index 6f241469ec7e..48f29de09311 100644 static void peci_of_register_devices(struct peci_adapter *adapter) { } #endif /* CONFIG_OF */ -@@ -1163,9 +1262,7 @@ static struct peci_adapter *peci_of_find_adapter(struct device_node *node) +@@ -1163,9 +1305,7 @@ static struct peci_adapter *peci_of_find_adapter(struct device_node *node) return adapter; } @@ -3864,7 +3909,7 @@ index 6f241469ec7e..48f29de09311 100644 { struct of_reconfig_data *rd = arg; struct peci_adapter *adapter; -@@ -1216,7 +1313,7 @@ static int peci_of_notify(struct notifier_block *nb, +@@ -1216,7 +1356,7 @@ static int peci_of_notify(struct notifier_block *nb, static struct notifier_block peci_of_notifier = { .notifier_call = peci_of_notify, }; @@ -3873,7 +3918,7 @@ index 6f241469ec7e..48f29de09311 100644 extern struct notifier_block peci_of_notifier; #endif /* CONFIG_OF_DYNAMIC */ -@@ -1240,7 +1337,7 @@ extern struct notifier_block peci_of_notifier; +@@ -1240,7 +1380,7 @@ extern struct notifier_block peci_of_notifier; * * Return: the peci_adapter structure on success, else NULL. */ @@ -3882,7 +3927,7 @@ index 6f241469ec7e..48f29de09311 100644 { struct peci_adapter *adapter; -@@ -1263,7 +1360,7 @@ EXPORT_SYMBOL_GPL(peci_alloc_adapter); +@@ -1263,7 +1403,7 @@ EXPORT_SYMBOL_GPL(peci_alloc_adapter); static int peci_register_adapter(struct peci_adapter *adapter) { @@ -3891,7 +3936,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Can't register until after driver model init */ if (WARN_ON(!is_registered)) -@@ -1275,27 +1372,17 @@ static int peci_register_adapter(struct peci_adapter *adapter) +@@ -1275,27 +1415,17 @@ static int peci_register_adapter(struct peci_adapter *adapter) if (WARN(!adapter->xfer, "peci adapter has no xfer function\n")) goto err_free_idr; @@ -3924,7 +3969,7 @@ index 6f241469ec7e..48f29de09311 100644 } dev_dbg(&adapter->dev, "adapter [%s] registered\n", adapter->name); -@@ -1309,13 +1396,11 @@ static int peci_register_adapter(struct peci_adapter *adapter) +@@ -1309,13 +1439,11 @@ static int peci_register_adapter(struct peci_adapter *adapter) return 0; @@ -3939,7 +3984,7 @@ index 6f241469ec7e..48f29de09311 100644 } static int peci_add_numbered_adapter(struct peci_adapter *adapter) -@@ -1354,12 +1439,10 @@ int peci_add_adapter(struct peci_adapter *adapter) +@@ -1354,12 +1482,10 @@ int peci_add_adapter(struct peci_adapter *adapter) struct device *dev = &adapter->dev; int id; @@ -3956,7 +4001,7 @@ index 6f241469ec7e..48f29de09311 100644 } mutex_lock(&core_lock); -@@ -1411,7 +1494,7 @@ void peci_del_adapter(struct peci_adapter *adapter) +@@ -1411,7 +1537,7 @@ void peci_del_adapter(struct peci_adapter *adapter) } mutex_unlock(&adapter->userspace_clients_lock); @@ -3965,7 +4010,7 @@ index 6f241469ec7e..48f29de09311 100644 * Detach any active clients. This can't fail, thus we do not * check the returned value. */ -@@ -1420,13 +1503,8 @@ void peci_del_adapter(struct peci_adapter *adapter) +@@ -1420,13 +1546,8 @@ void peci_del_adapter(struct peci_adapter *adapter) /* device name is gone after device_unregister */ dev_dbg(&adapter->dev, "adapter [%s] unregistered\n", adapter->name); @@ -3979,7 +4024,7 @@ index 6f241469ec7e..48f29de09311 100644 device_unregister(&adapter->dev); /* free bus id */ -@@ -1436,6 +1514,18 @@ void peci_del_adapter(struct peci_adapter *adapter) +@@ -1436,6 +1557,18 @@ void peci_del_adapter(struct peci_adapter *adapter) } EXPORT_SYMBOL_GPL(peci_del_adapter); @@ -3998,7 +4043,7 @@ index 6f241469ec7e..48f29de09311 100644 /** * peci_register_driver - register a PECI driver * @owner: owner module of the driver being registered -@@ -1446,7 +1536,7 @@ EXPORT_SYMBOL_GPL(peci_del_adapter); +@@ -1446,7 +1579,7 @@ EXPORT_SYMBOL_GPL(peci_del_adapter); */ int peci_register_driver(struct module *owner, struct peci_driver *driver) { @@ -4007,7 +4052,7 @@ index 6f241469ec7e..48f29de09311 100644 /* Can't register until after driver model init */ if (WARN_ON(!is_registered)) -@@ -1456,13 +1546,13 @@ int peci_register_driver(struct module *owner, struct peci_driver *driver) +@@ -1456,13 +1589,13 @@ int peci_register_driver(struct module *owner, struct peci_driver *driver) driver->driver.owner = owner; driver->driver.bus = &peci_bus_type; @@ -4025,7 +4070,7 @@ index 6f241469ec7e..48f29de09311 100644 pr_debug("driver [%s] registered\n", driver->driver.name); -@@ -1492,13 +1582,6 @@ static int __init peci_init(void) +@@ -1492,13 +1625,6 @@ static int __init peci_init(void) return ret; } @@ -4039,7 +4084,7 @@ index 6f241469ec7e..48f29de09311 100644 crc8_populate_msb(peci_crc8_table, PECI_CRC8_POLYNOMIAL); if (IS_ENABLED(CONFIG_OF_DYNAMIC)) -@@ -1514,11 +1597,10 @@ static void __exit peci_exit(void) +@@ -1514,11 +1640,10 @@ static void __exit peci_exit(void) if (IS_ENABLED(CONFIG_OF_DYNAMIC)) WARN_ON(of_reconfig_notifier_unregister(&peci_of_notifier)); @@ -4054,7 +4099,7 @@ index 6f241469ec7e..48f29de09311 100644 MODULE_AUTHOR("Jason M Biils <jason.m.bills@linux.intel.com>"); diff --git a/drivers/peci/peci-dev.c b/drivers/peci/peci-dev.c new file mode 100644 -index 000000000000..ac9cba0fb429 +index 0000000..ac9cba0 --- /dev/null +++ b/drivers/peci/peci-dev.c @@ -0,0 +1,346 @@ @@ -4406,7 +4451,7 @@ index 000000000000..ac9cba0fb429 +MODULE_LICENSE("GPL v2"); diff --git a/drivers/peci/peci-npcm.c b/drivers/peci/peci-npcm.c deleted file mode 100644 -index f632365b1416..000000000000 +index f632365..0000000 --- a/drivers/peci/peci-npcm.c +++ /dev/null @@ -1,410 +0,0 @@ @@ -4821,7 +4866,7 @@ index f632365b1416..000000000000 -MODULE_DESCRIPTION("NPCM Platform Environment Control Interface (PECI) driver"); -MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/intel-peci-client.h b/include/linux/mfd/intel-peci-client.h -index 8f6d823a59cd..9854303bbc26 100644 +index 8f6d823..9854303 100644 --- a/include/linux/mfd/intel-peci-client.h +++ b/include/linux/mfd/intel-peci-client.h @@ -1,5 +1,5 @@ @@ -4907,7 +4952,7 @@ index 8f6d823a59cd..9854303bbc26 100644 #endif /* __LINUX_MFD_INTEL_PECI_CLIENT_H */ diff --git a/include/linux/peci.h b/include/linux/peci.h -index d0e47d45d1d0..6fc424dc2a73 100644 +index d0e47d4..6fc424d 100644 --- a/include/linux/peci.h +++ b/include/linux/peci.h @@ -1,19 +1,18 @@ @@ -5003,7 +5048,7 @@ index d0e47d45d1d0..6fc424dc2a73 100644 int peci_get_cpu_id(struct peci_adapter *adapter, u8 addr, u32 *cpu_id); diff --git a/include/uapi/linux/peci-ioctl.h b/include/uapi/linux/peci-ioctl.h -index a6dae71cbff5..253fb42e38b7 100644 +index a6dae71..253fb42 100644 --- a/include/uapi/linux/peci-ioctl.h +++ b/include/uapi/linux/peci-ioctl.h @@ -1,5 +1,5 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0020-misc-aspeed-add-lpc-mbox-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0020-misc-aspeed-add-lpc-mbox-driver.patch index 884a7018c..a444d39b3 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0020-misc-aspeed-add-lpc-mbox-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0020-misc-aspeed-add-lpc-mbox-driver.patch @@ -1,4 +1,4 @@ -From efa7ad95db45494b2c3685c0688f00174e517e34 Mon Sep 17 00:00:00 2001 +From c1567ac196f176b19b53b6c4e7949809fd01e334 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Wed, 10 Jul 2019 16:19:33 -0700 Subject: [PATCH] misc: aspeed: add lpc mbox driver @@ -20,10 +20,10 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> create mode 100644 drivers/soc/aspeed/aspeed-lpc-mbox.c diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi -index 00848693f455..4b8b0be22cd4 100644 +index ee86b41af291..b7b6e8aa3a12 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi -@@ -344,6 +344,15 @@ +@@ -394,6 +394,15 @@ sio_regs: regs { compatible = "aspeed,bmc-misc"; }; @@ -40,10 +40,10 @@ index 00848693f455..4b8b0be22cd4 100644 }; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 8406da6f62a5..9f3bd5bafab5 100644 +index 128e0b5bbae2..12a81155f1ab 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -473,6 +473,15 @@ +@@ -503,6 +503,15 @@ sio_regs: regs { compatible = "aspeed,bmc-misc"; }; diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch index b347894be..24eca1bb9 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch @@ -1,4 +1,4 @@ -From 3d1ddeb903f6eaeb06ddc1d6cfbed6374ef31f36 Mon Sep 17 00:00:00 2001 +From 450b6d6e58ca9954fd4b675da8b6bb25d21c020f Mon Sep 17 00:00:00 2001 From: Yong Li <yong.b.li@intel.com> Date: Mon, 13 Nov 2017 16:29:44 +0800 Subject: [PATCH] Aspeed LPC SIO driver @@ -44,10 +44,10 @@ index 000000000000..c74ea3a4e5ac + status = "disabled"; +}; diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi -index 07758c9b900b..3df43f925848 100644 +index b7b6e8aa3a12..71563972d2fe 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi -@@ -345,6 +345,13 @@ +@@ -395,6 +395,13 @@ compatible = "aspeed,bmc-misc"; }; @@ -62,10 +62,10 @@ index 07758c9b900b..3df43f925848 100644 compatible = "aspeed,ast2400-mbox"; reg = <0x180 0x5c>; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 2387e2d1ff9e..2d6f730a7101 100644 +index 12a81155f1ab..88f75736fe48 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -474,6 +474,13 @@ +@@ -504,6 +504,13 @@ compatible = "aspeed,bmc-misc"; }; diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch index a44667436..07283f54d 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch @@ -1,4 +1,4 @@ -From 0f0e0a03218f6a7bdcdd78d319959e6bb974502c Mon Sep 17 00:00:00 2001 +From 6e55e28db5eed85b7717aa4fc92c064f11429f6d Mon Sep 17 00:00:00 2001 From: Haiyue Wang <haiyue.wang@linux.intel.com> Date: Sat, 24 Feb 2018 11:12:32 +0800 Subject: [PATCH] eSPI: add ASPEED AST2500 eSPI driver to boot a host with PCH @@ -16,15 +16,20 @@ Also for the host power on / off actions, from BMC side, the following VW 3. OOB_RESET_ACK 4. HOST_RESET_ACK +Also, it provides monitoring interface of PLTRST_N signal through +/dev/espi-pltrstn + Signed-off-by: Haiyue Wang <haiyue.wang@linux.intel.com> +Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Signed-off-by: James Feist <james.feist@linux.intel.com> --- - .../devicetree/bindings/misc/aspeed,espi-slave.txt | 19 ++ - Documentation/misc-devices/espi-slave.rst | 118 +++++++ + .../devicetree/bindings/misc/aspeed,espi-slave.txt | 19 + + Documentation/misc-devices/espi-slave.rst | 118 ++++++ arch/arm/boot/dts/aspeed-g5.dtsi | 4 + drivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + - drivers/misc/aspeed-espi-slave.c | 353 +++++++++++++++++++++ - 6 files changed, 503 insertions(+) + drivers/misc/aspeed-espi-slave.c | 420 +++++++++++++++++++++ + 6 files changed, 570 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/aspeed,espi-slave.txt create mode 100644 Documentation/misc-devices/espi-slave.rst create mode 100644 drivers/misc/aspeed-espi-slave.c @@ -179,10 +184,10 @@ index 000000000000..887a69a7130a +- Interface Base Specification (for Client and Server Platforms) +<https://www.intel.com/content/dam/support/us/en/documents/software/chipset-software/327432-004_espi_base_specification_rev1.0.pdf>`_ diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 2d6f730a7101..0e7f1d2fa08e 100644 +index 88f75736fe48..26671cc4dbd5 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -289,6 +289,7 @@ +@@ -317,6 +317,7 @@ clocks = <&syscon ASPEED_CLK_APB>; interrupt-controller; #interrupt-cells = <2>; @@ -190,7 +195,7 @@ index 2d6f730a7101..0e7f1d2fa08e 100644 }; sgpio: sgpio@1e780200 { -@@ -383,6 +384,9 @@ +@@ -413,6 +414,9 @@ reg = <0x1e6ee000 0x100>; interrupts = <23>; status = "disabled"; @@ -201,10 +206,10 @@ index 2d6f730a7101..0e7f1d2fa08e 100644 lpc: lpc@1e789000 { diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index 9d96469fb41c..b6acddaa9421 100644 +index d681b7201f8c..50814caba1d3 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig -@@ -473,6 +473,14 @@ config VEXPRESS_SYSCFG +@@ -455,6 +455,14 @@ config VEXPRESS_SYSCFG bus. System Configuration interface is one of the possible means of generating transactions on this bus. @@ -220,10 +225,10 @@ index 9d96469fb41c..b6acddaa9421 100644 depends on PCI select CRC32 diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index e13de4f0798f..f91f66a15484 100644 +index fdd404120ed8..f168e6713440 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile -@@ -54,6 +54,7 @@ obj-$(CONFIG_GENWQE) += genwqe/ +@@ -53,6 +53,7 @@ obj-$(CONFIG_GENWQE) += genwqe/ obj-$(CONFIG_ECHO) += echo/ obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o obj-$(CONFIG_CXL_BASE) += cxl/ @@ -233,363 +238,430 @@ index e13de4f0798f..f91f66a15484 100644 obj-y += cardreader/ diff --git a/drivers/misc/aspeed-espi-slave.c b/drivers/misc/aspeed-espi-slave.c new file mode 100644 -index 000000000000..36ae867ca6f9 +index 000000000000..b0fc01692d3a --- /dev/null +++ b/drivers/misc/aspeed-espi-slave.c -@@ -0,0 +1,353 @@ +@@ -0,0 +1,420 @@ +// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Copyright (C) 2012-2015, ASPEED Technology Inc. -+ * Copyright (c) 2015-2018, Intel Corporation. -+ */ ++// Copyright (c) 2015-2019, Intel Corporation. + -+#include <linux/atomic.h> +#include <linux/clk.h> -+#include <linux/errno.h> ++#include <linux/fs.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/miscdevice.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> -+#include <linux/poll.h> +#include <linux/regmap.h> -+#include <linux/sched.h> -+#include <linux/slab.h> -+#include <linux/timer.h> -+ -+#define DEVICE_NAME "aspeed-espi-slave" -+ -+#define ESPI_CTRL 0x00 -+#define ESPI_CTRL_SW_RESET GENMASK(31, 24) -+#define ESPI_CTRL_OOB_CHRDY BIT(4) -+#define ESPI_ISR 0x08 -+#define ESPI_ISR_HW_RESET BIT(31) -+#define ESPI_ISR_VW_SYS_EVT1 BIT(22) -+#define ESPI_ISR_VW_SYS_EVT BIT(8) -+#define ESPI_IER 0x0C -+#define ESPI_DATA_PORT 0x28 -+#define ESPI_DATA_PORT_ASPEED 0xa8 -+#define ESPI_SYS_IER 0x94 -+#define ESPI_SYS_EVENT 0x98 -+#define ESPI_SYS_INT_T0 0x110 -+#define ESPI_SYS_INT_T1 0x114 -+#define ESPI_SYS_INT_T2 0x118 -+#define ESPI_SYS_ISR 0x11C -+#define ESPI_SYSEVT_HOST_RST_ACK BIT(27) -+#define ESPI_SYSEVT_SLAVE_BOOT_STATUS BIT(23) -+#define ESPI_SYSEVT_SLAVE_BOOT_DONE BIT(20) -+#define ESPI_SYSEVT_OOB_RST_ACK BIT(16) -+#define ESPI_SYSEVT_HOST_RST_WARN BIT(8) -+#define ESPI_SYSEVT_OOB_RST_WARN BIT(6) -+#define ESPI_SYSEVT_PLT_RST_N BIT(5) -+#define ESPI_SYS1_IER 0x100 -+#define ESPI_SYS1_EVENT 0x104 -+#define ESPI_SYS1_INT_T0 0x120 -+#define ESPI_SYS1_INT_T1 0x124 -+#define ESPI_SYS1_INT_T2 0x128 -+#define ESPI_SYS1_ISR 0x12C -+#define ESPI_SYSEVT1_SUS_ACK BIT(20) -+#define ESPI_SYSEVT1_SUS_WARN BIT(0) -+ -+struct aspeed_espi_slave_data { -+ struct regmap *map; -+ struct clk *clk; ++#include <linux/sched/signal.h> ++#include <linux/spinlock.h> ++#include <linux/uaccess.h> ++ ++#define ASPEED_ESPI_CTRL 0x00 ++#define ASPEED_ESPI_CTRL_SW_RESET GENMASK(31, 24) ++#define ASPEED_ESPI_CTRL_OOB_CHRDY BIT(4) ++#define ASPEED_ESPI_INT_STS 0x08 ++#define ASPEED_ESPI_HW_RESET BIT(31) ++#define ASPEED_ESPI_VW_SYSEVT1 BIT(22) ++#define ASPEED_ESPI_VW_SYSEVT BIT(8) ++#define ASPEED_ESPI_INT_EN 0x0C ++#define ASPEED_ESPI_DATA_PORT 0x28 ++#define ASPEED_ESPI_SYSEVT_INT_EN 0x94 ++#define ASPEED_ESPI_SYSEVT 0x98 ++#define ASPEED_ESPI_SYSEVT_HOST_RST_ACK BIT(27) ++#define ASPEED_ESPI_SYSEVT_SLAVE_BOOT_STATUS BIT(23) ++#define ASPEED_ESPI_SYSEVT_SLAVE_BOOT_DONE BIT(20) ++#define ASPEED_ESPI_SYSEVT_OOB_RST_ACK BIT(16) ++#define ASPEED_ESPI_SYSEVT_INT_T0 0x110 ++#define ASPEED_ESPI_SYSEVT_INT_T1 0x114 ++#define ASPEED_ESPI_SYSEVT_INT_T2 0x118 ++#define ASPEED_ESPI_SYSEVT_INT_STS 0x11C ++#define ASPEED_ESPI_SYSEVT_HOST_RST_WARN BIT(8) ++#define ASPEED_ESPI_SYSEVT_OOB_RST_WARN BIT(6) ++#define ASPEED_ESPI_SYSEVT_PLTRSTN BIT(5) ++#define ASPEED_ESPI_SYSEVT1_INT_EN 0x100 ++#define ASPEED_ESPI_SYSEVT1 0x104 ++#define ASPEED_ESPI_SYSEVT1_SUS_ACK BIT(20) ++#define ASPEED_ESPI_SYSEVT1_INT_T0 0x120 ++#define ASPEED_ESPI_SYSEVT1_INT_T1 0x124 ++#define ASPEED_ESPI_SYSEVT1_INT_T2 0x128 ++#define ASPEED_ESPI_SYSEVT1_INT_STS 0x12C ++#define ASPEED_ESPI_SYSEVT1_SUS_WARN BIT(0) ++ ++#define ASPEED_ESPI_INT_MASK \ ++ (ASPEED_ESPI_HW_RESET | \ ++ ASPEED_ESPI_VW_SYSEVT1 | \ ++ ASPEED_ESPI_VW_SYSEVT) ++ ++/* ++ * Setup Interrupt Type / Enable of System Event from Master ++ * T2 T1 T0 ++ * 1) HOST_RST_WARN : Dual Edge 1 0 0 ++ * 2) OOB_RST_WARN : Dual Edge 1 0 0 ++ * 3) PLTRSTN : Dual Edge 1 0 0 ++ */ ++#define ASPEED_ESPI_SYSEVT_INT_T0_MASK 0 ++#define ASPEED_ESPI_SYSEVT_INT_T1_MASK 0 ++#define ASPEED_ESPI_SYSEVT_INT_T2_MASK \ ++ (ASPEED_ESPI_SYSEVT_HOST_RST_WARN | \ ++ ASPEED_ESPI_SYSEVT_OOB_RST_WARN | \ ++ ASPEED_ESPI_SYSEVT_PLTRSTN) ++#define ASPEED_ESPI_SYSEVT_INT_MASK \ ++ (ASPEED_ESPI_SYSEVT_INT_T0_MASK | \ ++ ASPEED_ESPI_SYSEVT_INT_T1_MASK | \ ++ ASPEED_ESPI_SYSEVT_INT_T2_MASK) ++ ++/* ++ * Setup Interrupt Type / Enable of System Event 1 from Master ++ * T2 T1 T0 ++ * 1) SUS_WARN : Rising Edge 0 0 1 ++ */ ++#define ASPEED_ESPI_SYSEVT1_INT_T0_MASK ASPEED_ESPI_SYSEVT1_SUS_WARN ++#define ASPEED_ESPI_SYSEVT1_INT_T1_MASK 0 ++#define ASPEED_ESPI_SYSEVT1_INT_T2_MASK 0 ++#define ASPEED_ESPI_SYSEVT1_INT_MASK \ ++ (ASPEED_ESPI_SYSEVT1_INT_T0_MASK | \ ++ ASPEED_ESPI_SYSEVT1_INT_T1_MASK | \ ++ ASPEED_ESPI_SYSEVT1_INT_T2_MASK) ++ ++struct aspeed_espi { ++ struct regmap *map; ++ struct clk *clk; ++ struct device *dev; ++ int irq; ++ ++ /* for PLTRST_N signal monitoring interface */ ++ struct miscdevice pltrstn_miscdev; ++ spinlock_t pltrstn_lock; /* for PLTRST_N signal sampling */ ++ wait_queue_head_t pltrstn_waitq; ++ char pltrstn; +}; + -+static void aspeed_espi_slave_sys_event(struct platform_device *pdev) ++static void aspeed_espi_sys_event(struct aspeed_espi *priv) +{ -+ struct aspeed_espi_slave_data *priv = platform_get_drvdata(pdev); -+ struct device *dev = &pdev->dev; + u32 sts, evt; + -+ if (regmap_read(priv->map, ESPI_SYS_ISR, &sts) != 0 || -+ regmap_read(priv->map, ESPI_SYS_EVENT, &evt) != 0) { -+ dev_err(dev, "regmap_read failed\n"); -+ return; -+ } ++ regmap_read(priv->map, ASPEED_ESPI_SYSEVT_INT_STS, &sts); ++ regmap_read(priv->map, ASPEED_ESPI_SYSEVT, &evt); + -+ dev_dbg(dev, "sys: sts = %08x, evt = %08x\n", sts, evt); ++ dev_dbg(priv->dev, "sys: sts = %08x, evt = %08x\n", sts, evt); + -+ if ((evt & ESPI_SYSEVT_SLAVE_BOOT_STATUS) == 0) { -+ dev_info(dev, "Setting espi slave boot done\n"); -+ regmap_write(priv->map, ESPI_SYS_EVENT, -+ evt | ESPI_SYSEVT_SLAVE_BOOT_STATUS | -+ ESPI_SYSEVT_SLAVE_BOOT_DONE); ++ if (!(evt & ASPEED_ESPI_SYSEVT_SLAVE_BOOT_STATUS)) { ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT, ++ evt | ASPEED_ESPI_SYSEVT_SLAVE_BOOT_STATUS | ++ ASPEED_ESPI_SYSEVT_SLAVE_BOOT_DONE); ++ dev_dbg(priv->dev, "Setting espi slave boot done\n"); + } -+#if 0 -+ if (sts & ESPI_SYSEVT_HOST_RST_WARN) { -+ dev_info(dev, "ESPI_SYSEVT_HOST_RST_WARN; %s ack\n", -+ (evt & ESPI_SYSEVT_HOST_RST_WARN ? "send" : "clr")); -+ regmap_write_bits(priv->map, ESPI_SYS_EVENT, -+ ESPI_SYSEVT_HOST_RST_ACK, -+ evt & ESPI_SYSEVT_HOST_RST_WARN ? -+ ESPI_SYSEVT_HOST_RST_ACK : 0); ++ if (sts & ASPEED_ESPI_SYSEVT_HOST_RST_WARN && ++ evt & ASPEED_ESPI_SYSEVT_HOST_RST_WARN) { ++ regmap_write_bits(priv->map, ASPEED_ESPI_SYSEVT, ++ ASPEED_ESPI_SYSEVT_HOST_RST_ACK, ++ ASPEED_ESPI_SYSEVT_HOST_RST_ACK); ++ dev_dbg(priv->dev, "SYSEVT_HOST_RST_WARN: acked\n"); + } -+ if (sts & ESPI_SYSEVT_OOB_RST_WARN) { -+ dev_info(dev, "ESPI_SYSEVT_OOB_RST_WARN; %s ack\n", -+ (evt & ESPI_SYSEVT_OOB_RST_WARN ? "send" : "clr")); -+ regmap_write_bits(priv->map, ESPI_SYS_EVENT, -+ ESPI_SYSEVT_OOB_RST_ACK, -+ evt & ESPI_SYSEVT_OOB_RST_WARN ? -+ ESPI_SYSEVT_OOB_RST_ACK : 0); ++ if (sts & ASPEED_ESPI_SYSEVT_OOB_RST_WARN && ++ evt & ASPEED_ESPI_SYSEVT_OOB_RST_WARN) { ++ regmap_write_bits(priv->map, ASPEED_ESPI_SYSEVT, ++ ASPEED_ESPI_SYSEVT_OOB_RST_ACK, ++ ASPEED_ESPI_SYSEVT_OOB_RST_ACK); ++ dev_dbg(priv->dev, "SYSEVT_OOB_RST_WARN: acked\n"); + } -+#else -+ if (sts & ESPI_SYSEVT_HOST_RST_WARN) { -+ if (evt & ESPI_SYSEVT_HOST_RST_WARN) { -+ dev_info(dev, "ESPI_SYSEVT_HOST_RST_WARN; send ack\n"); -+ regmap_write_bits(priv->map, ESPI_SYS_EVENT, -+ ESPI_SYSEVT_HOST_RST_ACK, ESPI_SYSEVT_HOST_RST_ACK); -+ } ++ if (sts & ASPEED_ESPI_SYSEVT_PLTRSTN || priv->pltrstn == 'U') { ++ priv->pltrstn = (evt & ASPEED_ESPI_SYSEVT_PLTRSTN) ? '1' : '0'; ++ wake_up_interruptible(&priv->pltrstn_waitq); ++ dev_dbg(priv->dev, "SYSEVT_PLTRSTN: %c\n", priv->pltrstn); + } -+ if (sts & ESPI_SYSEVT_OOB_RST_WARN) { -+ if (evt & ESPI_SYSEVT_OOB_RST_WARN) { -+ dev_info(dev, "ESPI_SYSEVT_OOB_RST_WARN; send ack\n"); -+ regmap_write_bits(priv->map, ESPI_SYS_EVENT, -+ ESPI_SYSEVT_OOB_RST_ACK, ESPI_SYSEVT_OOB_RST_ACK); -+ } -+ } -+#endif -+ regmap_write(priv->map, ESPI_SYS_ISR, sts); ++ ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT_INT_STS, sts); +} + -+static void aspeed_espi_slave_sys1_event(struct platform_device *pdev) ++static void aspeed_espi_sys_event1(struct aspeed_espi *priv) +{ -+ struct aspeed_espi_slave_data *priv = platform_get_drvdata(pdev); -+ struct device *dev = &pdev->dev; + u32 sts, evt; + -+ if (regmap_read(priv->map, ESPI_SYS1_ISR, &sts) != 0 || -+ regmap_read(priv->map, ESPI_SYS1_EVENT, &evt) != 0) { -+ dev_err(dev, "regmap_read failed\n"); -+ return; -+ } -+ dev_dbg(dev, "sys1: sts = %08x, evt = %08x\n", sts, evt); -+ -+#if 0 -+ if (sts & ESPI_SYSEVT1_SUS_WARN) { -+ dev_info(dev, "ESPI_SYSEVT1_SUS_WARN; %s ack\n", -+ (evt & ESPI_SYSEVT1_SUS_WARN ? "send" : "clr")); -+ regmap_write_bits(priv->map, ESPI_SYS1_EVENT, -+ ESPI_SYSEVT1_SUS_ACK, -+ evt & ESPI_SYSEVT1_SUS_WARN ? -+ ESPI_SYSEVT1_SUS_ACK : 0); -+ } -+#else -+ if (sts & ESPI_SYSEVT1_SUS_WARN) { -+ if (evt & ESPI_SYSEVT1_SUS_WARN) { -+ dev_info(dev, "ESPI_SYSEVT_OOB_RST_WARN; send ack\n"); -+ regmap_write_bits(priv->map, ESPI_SYS1_EVENT, -+ ESPI_SYSEVT1_SUS_ACK, ESPI_SYSEVT1_SUS_ACK); -+ } ++ regmap_read(priv->map, ASPEED_ESPI_SYSEVT1_INT_STS, &sts); ++ regmap_read(priv->map, ASPEED_ESPI_SYSEVT1, &evt); ++ ++ dev_dbg(priv->dev, "sys event1: sts = %08x, evt = %08x\n", sts, evt); ++ ++ if (sts & ASPEED_ESPI_SYSEVT1_SUS_WARN && ++ evt & ASPEED_ESPI_SYSEVT1_SUS_WARN) { ++ regmap_write_bits(priv->map, ASPEED_ESPI_SYSEVT1, ++ ASPEED_ESPI_SYSEVT1_SUS_ACK, ++ ASPEED_ESPI_SYSEVT1_SUS_ACK); ++ dev_dbg(priv->dev, "SYSEVT1_SUS_WARN: acked\n"); + } -+#endif -+ regmap_write(priv->map, ESPI_SYS1_ISR, sts); ++ ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT1_INT_STS, sts); +} + -+static void aspeed_espi_slave_boot_ack(struct platform_device *pdev) ++static void aspeed_espi_boot_ack(struct aspeed_espi *priv) +{ -+ struct aspeed_espi_slave_data *priv = platform_get_drvdata(pdev); -+ struct device *dev = &pdev->dev; + u32 evt; + -+ if (regmap_read(priv->map, ESPI_SYS_EVENT, &evt) == 0 && -+ (evt & ESPI_SYSEVT_SLAVE_BOOT_STATUS) == 0) { -+ dev_info(dev, "Setting espi slave boot done\n"); -+ regmap_write(priv->map, ESPI_SYS_EVENT, -+ evt | ESPI_SYSEVT_SLAVE_BOOT_STATUS | -+ ESPI_SYSEVT_SLAVE_BOOT_DONE); ++ regmap_read(priv->map, ASPEED_ESPI_SYSEVT, &evt); ++ if (!(evt & ASPEED_ESPI_SYSEVT_SLAVE_BOOT_STATUS)) { ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT, ++ evt | ASPEED_ESPI_SYSEVT_SLAVE_BOOT_STATUS | ++ ASPEED_ESPI_SYSEVT_SLAVE_BOOT_DONE); ++ dev_dbg(priv->dev, "Setting espi slave boot done\n"); + } + -+ if (regmap_read(priv->map, ESPI_SYS1_EVENT, &evt) == 0 && -+ (evt & ESPI_SYSEVT1_SUS_WARN) != 0 && -+ (evt & ESPI_SYSEVT1_SUS_ACK) == 0) { -+ dev_info(dev, "Boot SUS WARN set; send ack\n"); -+ regmap_write(priv->map, ESPI_SYS1_EVENT, -+ evt | ESPI_SYSEVT1_SUS_ACK); ++ regmap_read(priv->map, ASPEED_ESPI_SYSEVT1, &evt); ++ if (evt & ASPEED_ESPI_SYSEVT1_SUS_WARN && ++ !(evt & ASPEED_ESPI_SYSEVT1_SUS_ACK)) { ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT1, ++ evt | ASPEED_ESPI_SYSEVT1_SUS_ACK); ++ dev_dbg(priv->dev, "Boot SYSEVT1_SUS_WARN: acked\n"); + } +} + -+static irqreturn_t aspeed_espi_slave_irq(int irq, void *arg) ++static irqreturn_t aspeed_espi_irq(int irq, void *arg) +{ -+ struct platform_device *pdev = arg; -+ struct aspeed_espi_slave_data *priv = platform_get_drvdata(pdev); -+ struct device *dev = &pdev->dev; -+ u32 sts; -+ -+ if (regmap_read(priv->map, ESPI_ISR, &sts) != 0) { -+ dev_err(dev, "regmap_read failed\n"); -+ return IRQ_NONE; -+ } ++ struct aspeed_espi *priv = arg; ++ u32 sts, sts_handled = 0; + -+ dev_dbg(dev, "ESPI_ISR: %08x\n", sts); ++ regmap_read(priv->map, ASPEED_ESPI_INT_STS, &sts); + -+ if (sts & ESPI_ISR_VW_SYS_EVT) -+ aspeed_espi_slave_sys_event(pdev); ++ dev_dbg(priv->dev, "INT_STS: 0x%08x\n", sts); + -+ if (sts & ESPI_ISR_VW_SYS_EVT1) -+ aspeed_espi_slave_sys1_event(pdev); ++ if (sts & ASPEED_ESPI_VW_SYSEVT) { ++ aspeed_espi_sys_event(priv); ++ sts_handled |= ASPEED_ESPI_VW_SYSEVT; ++ } + -+ /* -+ if (sts & ESPI_ISR_HW_RESET) { -+ regmap_write_bits(priv->map, ESPI_CTRL, -+ ESPI_CTRL_SW_RESET, 0); -+ regmap_write_bits(priv->map, ESPI_CTRL, -+ ESPI_CTRL_SW_RESET, ESPI_CTRL_SW_RESET); ++ if (sts & ASPEED_ESPI_VW_SYSEVT1) { ++ aspeed_espi_sys_event1(priv); ++ sts_handled |= ASPEED_ESPI_VW_SYSEVT1; ++ } + -+ aspeed_espi_slave_boot_ack(pdev); ++ if (sts & ASPEED_ESPI_HW_RESET) { ++ regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, ++ ASPEED_ESPI_CTRL_SW_RESET, 0); ++ regmap_write_bits(priv->map, ASPEED_ESPI_CTRL, ++ ASPEED_ESPI_CTRL_SW_RESET, ++ ASPEED_ESPI_CTRL_SW_RESET); ++ aspeed_espi_boot_ack(priv); ++ sts_handled |= ASPEED_ESPI_HW_RESET; + } -+ */ + -+ regmap_write(priv->map, ESPI_ISR, sts); ++ regmap_write(priv->map, ASPEED_ESPI_INT_STS, sts); + -+ return IRQ_HANDLED; ++ return sts != sts_handled ? IRQ_NONE : IRQ_HANDLED; +} + -+/* Setup Interrupt Type/Enable of System Event from Master -+ * T2 T1 T0 -+ * 1). HOST_RST_WARN : Dual Edge 1 0 0 -+ * 2). OOB_RST_WARN : Dual Edge 1 0 0 -+ * 3). PLTRST_N : Dual Edge 1 0 0 -+ */ -+#define ESPI_SYS_INT_T0_SET 0x00000000 -+#define ESPI_SYS_INT_T1_SET 0x00000000 -+#define ESPI_SYS_INT_T2_SET \ -+(ESPI_SYSEVT_HOST_RST_WARN | ESPI_SYSEVT_OOB_RST_WARN | ESPI_SYSEVT_PLT_RST_N) -+#define ESPI_SYS_INT_SET \ -+(ESPI_SYSEVT_HOST_RST_WARN | ESPI_SYSEVT_OOB_RST_WARN | ESPI_SYSEVT_PLT_RST_N) -+ -+/* Setup Interrupt Type/Enable of System Event 1 from Master -+ * T2 T1 T0 -+ * 1). SUS_WARN : Rising Edge 0 0 1 -+ */ -+#define ESPI_SYS1_INT_T0_SET ESPI_SYSEVT1_SUS_WARN -+#define ESPI_SYS1_INT_T1_SET 0x00000000 -+#define ESPI_SYS1_INT_T2_SET 0x00000000 -+#define ESPI_SYS1_INT_SET ESPI_SYSEVT1_SUS_WARN ++static void aspeed_espi_config_irq(struct aspeed_espi *priv) ++{ ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT_INT_T0, ++ ASPEED_ESPI_SYSEVT_INT_T0_MASK); ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT_INT_T1, ++ ASPEED_ESPI_SYSEVT_INT_T1_MASK); ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT_INT_T2, ++ ASPEED_ESPI_SYSEVT_INT_T2_MASK); ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT_INT_EN, ++ ASPEED_ESPI_SYSEVT_INT_MASK); ++ ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT1_INT_T0, ++ ASPEED_ESPI_SYSEVT1_INT_T0_MASK); ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT1_INT_T1, ++ ASPEED_ESPI_SYSEVT1_INT_T1_MASK); ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT1_INT_T2, ++ ASPEED_ESPI_SYSEVT1_INT_T2_MASK); ++ regmap_write(priv->map, ASPEED_ESPI_SYSEVT1_INT_EN, ++ ASPEED_ESPI_SYSEVT1_INT_MASK); ++ ++ regmap_write(priv->map, ASPEED_ESPI_INT_EN, ASPEED_ESPI_INT_MASK); ++ ++ aspeed_espi_boot_ack(priv); ++} + -+static int aspeed_espi_slave_config_irq(struct platform_device *pdev) ++static inline struct aspeed_espi *to_aspeed_espi(struct file *filp) +{ -+ struct aspeed_espi_slave_data *priv = platform_get_drvdata(pdev); -+ struct device *dev = &pdev->dev; -+ int irq; -+ int rc; ++ return container_of(filp->private_data, struct aspeed_espi, ++ pltrstn_miscdev); ++} + -+ irq = platform_get_irq(pdev, 0); -+ if (irq < 0) -+ return irq; ++static int aspeed_espi_pltrstn_open(struct inode *inode, struct file *filp) ++{ ++ if ((filp->f_flags & O_ACCMODE) != O_RDONLY) ++ return -EACCES; + -+ regmap_write_bits(priv->map, ESPI_CTRL, ESPI_CTRL_OOB_CHRDY, -+ ESPI_CTRL_OOB_CHRDY); ++ return 0; ++} + -+ regmap_write(priv->map, ESPI_SYS_INT_T0, ESPI_SYS_INT_T0_SET); -+ regmap_write(priv->map, ESPI_SYS_INT_T1, ESPI_SYS_INT_T1_SET); -+ regmap_write(priv->map, ESPI_SYS_INT_T2, ESPI_SYS_INT_T2_SET); -+ regmap_write(priv->map, ESPI_SYS_IER, ESPI_SYS_INT_SET); ++static ssize_t aspeed_espi_pltrstn_read(struct file *filp, char __user *buf, ++ size_t count, loff_t *offset) ++{ ++ struct aspeed_espi *priv = to_aspeed_espi(filp); ++ DECLARE_WAITQUEUE(wait, current); ++ unsigned long flags; ++ char old_sample; ++ int ret = 0; + -+ regmap_write(priv->map, ESPI_SYS1_INT_T0, ESPI_SYS1_INT_T0_SET); -+ regmap_write(priv->map, ESPI_SYS1_INT_T1, ESPI_SYS1_INT_T1_SET); -+ regmap_write(priv->map, ESPI_SYS1_INT_T2, ESPI_SYS1_INT_T2_SET); -+ regmap_write(priv->map, ESPI_SYS1_IER, ESPI_SYS1_INT_SET); ++ spin_lock_irqsave(&priv->pltrstn_lock, flags); + -+ regmap_write(priv->map, ESPI_IER, 0xFFFFFFFF); ++ add_wait_queue(&priv->pltrstn_waitq, &wait); ++ set_current_state(TASK_INTERRUPTIBLE); + -+ aspeed_espi_slave_boot_ack(pdev); ++ old_sample = priv->pltrstn; + -+ rc = devm_request_irq(dev, irq, aspeed_espi_slave_irq, IRQF_SHARED, -+ dev_name(dev), pdev); -+ if (rc < 0) -+ return rc; ++ do { ++ char new_sample = priv->pltrstn; + -+ return 0; ++ if (filp->f_flags & O_NONBLOCK || old_sample != new_sample) { ++ ret = put_user(new_sample, (unsigned long __user *)buf); ++ if (!ret) ++ ret = sizeof(new_sample); ++ } else if (signal_pending(current)) { ++ ret = -ERESTARTSYS; ++ } ++ ++ if (!ret) { ++ spin_unlock_irqrestore(&priv->pltrstn_lock, flags); ++ schedule(); ++ spin_lock_irqsave(&priv->pltrstn_lock, flags); ++ } ++ } while (!ret); ++ ++ remove_wait_queue(&priv->pltrstn_waitq, &wait); ++ set_current_state(TASK_RUNNING); ++ ++ spin_unlock_irqrestore(&priv->pltrstn_lock, flags); ++ ++ return ret; +} + -+static const struct regmap_config espi_slave_regmap_cfg = { -+ .reg_bits = 32, -+ .reg_stride = 4, -+ .val_bits = 32, -+ .max_register = ESPI_SYS1_ISR, ++static const struct file_operations aspeed_espi_pltrstn_fops = { ++ .owner = THIS_MODULE, ++ .open = aspeed_espi_pltrstn_open, ++ .read = aspeed_espi_pltrstn_read, ++}; ++ ++static const struct regmap_config aspeed_espi_regmap_cfg = { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = ASPEED_ESPI_SYSEVT1_INT_STS, +}; + -+static int aspeed_espi_slave_probe(struct platform_device *pdev) ++static int aspeed_espi_probe(struct platform_device *pdev) +{ -+ struct aspeed_espi_slave_data *priv; -+ struct device *dev = &pdev->dev; ++ struct aspeed_espi *priv; + struct resource *res; + void __iomem *regs; -+ int rc; ++ u32 ctrl; ++ int ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ regs = devm_ioremap_resource(dev, res); ++ regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(regs)) + return PTR_ERR(regs); + -+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + -+ priv->map = devm_regmap_init_mmio(dev, regs, &espi_slave_regmap_cfg); ++ dev_set_drvdata(&pdev->dev, priv); ++ priv->dev = &pdev->dev; ++ ++ priv->map = devm_regmap_init_mmio(&pdev->dev, regs, ++ &aspeed_espi_regmap_cfg); + if (IS_ERR(priv->map)) + return PTR_ERR(priv->map); + -+ priv->clk = devm_clk_get(dev, NULL); ++ spin_lock_init(&priv->pltrstn_lock); ++ init_waitqueue_head(&priv->pltrstn_waitq); ++ priv->pltrstn = 'U'; /* means it's not reported yet from master */ ++ ++ priv->irq = platform_get_irq(pdev, 0); ++ if (priv->irq < 0) ++ return priv->irq; ++ ++ aspeed_espi_config_irq(priv); ++ ++ ret = devm_request_irq(&pdev->dev, priv->irq, aspeed_espi_irq, 0, ++ "aspeed-espi-irq", priv); ++ if (ret) ++ return ret; ++ ++ priv->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(priv->clk)) { -+ dev_err(dev, "couldn't get clock\n"); -+ return PTR_ERR(priv->clk); ++ ret = PTR_ERR(priv->clk); ++ if (ret != -EPROBE_DEFER) ++ dev_err(&pdev->dev, "couldn't get clock\n"); ++ return ret; + } -+ rc = clk_prepare_enable(priv->clk); -+ if (rc) { -+ dev_err(dev, "couldn't enable clock\n"); -+ return rc; ++ ret = clk_prepare_enable(priv->clk); ++ if (ret) { ++ dev_err(&pdev->dev, "couldn't enable clock\n"); ++ return ret; + } + -+ dev_set_name(dev, DEVICE_NAME); -+ -+ platform_set_drvdata(pdev, priv); -+ -+ rc = aspeed_espi_slave_config_irq(pdev); -+ if (rc) { -+ platform_set_drvdata(pdev, NULL); -+ goto err; ++ /* ++ * We check that the regmap works on this very first access, but as this ++ * is an MMIO-backed regmap, subsequent regmap access is not going to ++ * fail and we skip error checks from this point. ++ */ ++ ret = regmap_read(priv->map, ASPEED_ESPI_CTRL, &ctrl); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to read ctrl register\n"); ++ goto err_clk_disable_out; ++ } ++ regmap_write(priv->map, ASPEED_ESPI_CTRL, ++ ctrl | ASPEED_ESPI_CTRL_OOB_CHRDY); ++ ++ priv->pltrstn_miscdev.minor = MISC_DYNAMIC_MINOR; ++ priv->pltrstn_miscdev.name = "espi-pltrstn"; ++ priv->pltrstn_miscdev.fops = &aspeed_espi_pltrstn_fops; ++ priv->pltrstn_miscdev.parent = &pdev->dev; ++ ++ ret = misc_register(&priv->pltrstn_miscdev); ++ if (ret) { ++ dev_err(&pdev->dev, "Unable to register device\n"); ++ goto err_clk_disable_out; + } + -+ dev_info(dev, "aspeed,ast2500-espi-slave probe complete\n"); ++ dev_info(&pdev->dev, "eSPI registered, irq %d\n", priv->irq); ++ + return 0; + -+err: ++err_clk_disable_out: + clk_disable_unprepare(priv->clk); -+ return rc; -+} + ++ return ret; ++} + -+static int aspeed_espi_slave_remove(struct platform_device *pdev) ++static int aspeed_espi_remove(struct platform_device *pdev) +{ -+ struct aspeed_espi_slave_data *priv = platform_get_drvdata(pdev); ++ struct aspeed_espi *priv = dev_get_drvdata(&pdev->dev); + ++ misc_deregister(&priv->pltrstn_miscdev); + clk_disable_unprepare(priv->clk); + + return 0; +} + -+static const struct of_device_id of_espi_slave_match_table[] = { ++static const struct of_device_id of_espi_match_table[] = { + { .compatible = "aspeed,ast2500-espi-slave" }, + { } +}; -+MODULE_DEVICE_TABLE(of, of_espi_slave_match_table); ++MODULE_DEVICE_TABLE(of, of_espi_match_table); + -+static struct platform_driver aspeed_espi_slave_driver = { -+ .driver = { -+ .name = DEVICE_NAME, -+ .of_match_table = of_match_ptr(of_espi_slave_match_table), ++static struct platform_driver aspeed_espi_driver = { ++ .driver = { ++ .name = KBUILD_MODNAME, ++ .of_match_table = of_match_ptr(of_espi_match_table), + }, -+ .probe = aspeed_espi_slave_probe, -+ .remove = aspeed_espi_slave_remove, ++ .probe = aspeed_espi_probe, ++ .remove = aspeed_espi_remove, +}; -+module_platform_driver(aspeed_espi_slave_driver); ++module_platform_driver(aspeed_espi_driver); + -+MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Haiyue Wang <haiyue.wang@linux.intel.com>"); -+MODULE_DESCRIPTION("Linux device interface to the eSPI slave"); ++MODULE_AUTHOR("Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>"); ++MODULE_DESCRIPTION("Aspeed eSPI driver"); ++MODULE_LICENSE("GPL v2"); -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch index 53060daf7..4dc14d3b1 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch @@ -1,24 +1,26 @@ -From 8d5f080b38d1b652eb5fdd3a7b74164906680ab7 Mon Sep 17 00:00:00 2001 +From 5f43a95bd032279440196a1c9802e1dec5d24a65 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" <jason.m.bills@intel.com> Date: Wed, 4 Apr 2018 13:52:39 -0700 Subject: [PATCH] Add support for new PECI commands Signed-off-by: Jason M. Bills <jason.m.bills@intel.com> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Signed-off-by: Zhu, Yunge <yunge.zhu@linux.intel.com> --- - drivers/peci/peci-core.c | 396 ++++++++++++++++++++++++++++++++++++++++ - include/uapi/linux/peci-ioctl.h | 146 +++++++++++++++ - 2 files changed, 542 insertions(+) + drivers/peci/peci-core.c | 430 ++++++++++++++++++++++++++++++++++++++++ + include/uapi/linux/peci-ioctl.h | 179 +++++++++++++++++ + 2 files changed, 609 insertions(+) diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c -index d1f0df8b139a..b99ba788a032 100644 +index 2a6be04..43a86a0 100644 --- a/drivers/peci/peci-core.c +++ b/drivers/peci/peci-core.c -@@ -318,6 +318,12 @@ static int peci_scan_cmd_mask(struct peci_adapter *adapter) +@@ -318,6 +318,13 @@ static int peci_scan_cmd_mask(struct peci_adapter *adapter) * See PECI Spec Table 3-1. */ revision = FIELD_GET(REVISION_NUM_MASK, dib); + if (revision >= 0x40) { /* Rev. 4.0 */ ++ adapter->cmd_mask |= BIT(PECI_CMD_RD_IA_MSREX); + adapter->cmd_mask |= BIT(PECI_CMD_RD_END_PT_CFG); + adapter->cmd_mask |= BIT(PECI_CMD_WR_END_PT_CFG); + adapter->cmd_mask |= BIT(PECI_CMD_CRASHDUMP_DISC); @@ -27,7 +29,61 @@ index d1f0df8b139a..b99ba788a032 100644 if (revision >= 0x36) /* Rev. 3.6 */ adapter->cmd_mask |= BIT(PECI_CMD_WR_IA_MSR); if (revision >= 0x35) /* Rev. 3.5 */ -@@ -687,6 +693,392 @@ static int peci_cmd_wr_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) +@@ -375,14 +382,18 @@ static int peci_cmd_xfer(struct peci_adapter *adapter, void *vmsg) + switch (msg->tx_buf[0]) { + case PECI_RDPKGCFG_CMD: + case PECI_RDIAMSR_CMD: ++ case PECI_RDIAMSREX_CMD: + case PECI_RDPCICFG_CMD: + case PECI_RDPCICFGLOCAL_CMD: ++ case PECI_RDENDPTCFG_CMD: ++ case PECI_CRASHDUMP_CMD: + ret = peci_xfer_with_retries(adapter, msg, false); + break; + case PECI_WRPKGCFG_CMD: + case PECI_WRIAMSR_CMD: + case PECI_WRPCICFG_CMD: + case PECI_WRPCICFGLOCAL_CMD: ++ case PECI_WRENDPTCFG_CMD: + /* Check if the AW FCS byte is already provided */ + ret = peci_aw_fcs(msg, 2 + msg->tx_len, &aw_fcs); + if (ret) +@@ -590,6 +601,34 @@ static int peci_cmd_rd_ia_msr(struct peci_adapter *adapter, void *vmsg) + return ret; + } + ++static int peci_cmd_rd_ia_msrex(struct peci_adapter *adapter, void *vmsg) ++{ ++ struct peci_rd_ia_msrex_msg *umsg = vmsg; ++ struct peci_xfer_msg *msg; ++ int ret; ++ ++ msg = peci_get_xfer_msg(PECI_RDIAMSREX_WRITE_LEN, PECI_RDIAMSREX_READ_LEN); ++ if (!msg) ++ return -ENOMEM; ++ ++ msg->addr = umsg->addr; ++ msg->tx_buf[0] = PECI_RDIAMSREX_CMD; ++ msg->tx_buf[1] = 0; ++ msg->tx_buf[2] = (u8)umsg->thread_id; ++ msg->tx_buf[3] = (u8)(umsg->thread_id >> 8); ++ msg->tx_buf[4] = (u8)umsg->address; ++ msg->tx_buf[5] = (u8)(umsg->address >> 8); ++ ++ ret = peci_xfer_with_retries(adapter, msg, false); ++ if (!ret) ++ memcpy(&umsg->value, &msg->rx_buf[1], sizeof(uint64_t)); ++ ++ umsg->cc = msg->rx_buf[0]; ++ peci_put_xfer_msg(msg); ++ ++ return ret; ++} ++ + static int peci_cmd_wr_ia_msr(struct peci_adapter *adapter, void *vmsg) + { + return -ENOSYS; /* Not implemented yet */ +@@ -730,6 +769,392 @@ static int peci_cmd_wr_pci_cfg_local(struct peci_adapter *adapter, void *vmsg) return ret; } @@ -420,7 +476,12 @@ index d1f0df8b139a..b99ba788a032 100644 typedef int (*peci_cmd_fn_type)(struct peci_adapter *, void *); static const peci_cmd_fn_type peci_cmd_fn[PECI_CMD_MAX] = { -@@ -702,6 +1094,10 @@ static const peci_cmd_fn_type peci_cmd_fn[PECI_CMD_MAX] = { +@@ -741,10 +1166,15 @@ static const peci_cmd_fn_type peci_cmd_fn[PECI_CMD_MAX] = { + peci_cmd_wr_pkg_cfg, + peci_cmd_rd_ia_msr, + peci_cmd_wr_ia_msr, ++ peci_cmd_rd_ia_msrex, + peci_cmd_rd_pci_cfg, peci_cmd_wr_pci_cfg, peci_cmd_rd_pci_cfg_local, peci_cmd_wr_pci_cfg_local, @@ -432,10 +493,23 @@ index d1f0df8b139a..b99ba788a032 100644 /** diff --git a/include/uapi/linux/peci-ioctl.h b/include/uapi/linux/peci-ioctl.h -index 253fb42e38b7..405cd8edbcbf 100644 +index 253fb42..1158254 100644 --- a/include/uapi/linux/peci-ioctl.h +++ b/include/uapi/linux/peci-ioctl.h -@@ -71,6 +71,10 @@ enum peci_cmd { +@@ -47,6 +47,7 @@ + * @PECI_CMD_WR_PKG_CFG: write access to the PCS (Package Configuration Space) + * @PECI_CMD_RD_IA_MSR: read access to MSRs (Model Specific Registers) + * @PECI_CMD_WR_IA_MSR: write access to MSRs (Model Specific Registers) ++ * @PECI_CMD_RD_IA_MSREX: read access to MSRs (Model Specific Registers) + * @PECI_CMD_RD_PCI_CFG: sideband read access to the PCI configuration space + * maintained in downstream devices external to the processor + * @PECI_CMD_WR_PCI_CFG: sideband write access to the PCI configuration space +@@ -67,10 +68,15 @@ enum peci_cmd { + PECI_CMD_WR_PKG_CFG, + PECI_CMD_RD_IA_MSR, + PECI_CMD_WR_IA_MSR, ++ PECI_CMD_RD_IA_MSREX, + PECI_CMD_RD_PCI_CFG, PECI_CMD_WR_PCI_CFG, PECI_CMD_RD_PCI_CFG_LOCAL, PECI_CMD_WR_PCI_CFG_LOCAL, @@ -446,7 +520,42 @@ index 253fb42e38b7..405cd8edbcbf 100644 PECI_CMD_MAX }; -@@ -438,6 +442,132 @@ struct peci_wr_pci_cfg_local_msg { +@@ -312,6 +318,34 @@ struct peci_wr_ia_msr_msg { + } __attribute__((__packed__)); + + /** ++ * struct peci_rd_ia_msrex_msg - RdIAMSREX command ++ * @addr: address of the client ++ * @thread_id: ID of the specific logical processor ++ * @address: address of MSR to read from ++ * @cc: completion code ++ * @value: data to be read ++ * ++ * The RdIAMSREX() PECI command provides read access to Model Specific Registers ++ * (MSRs) defined in the processor's Intel Architecture (IA). ++ * The differences between RdIAMSREX() and RdIAMSR() are that: ++ * (1)RdIAMSR() can only read MC registers, RdIAMSREX() can read all MSRs ++ * (2)thread_id of RdIAMSR() is u8, thread_id of RdIAMSREX() is u16 ++ */ ++struct peci_rd_ia_msrex_msg { ++#define PECI_RDIAMSREX_WRITE_LEN 6 ++#define PECI_RDIAMSREX_READ_LEN 9 ++#define PECI_RDIAMSREX_CMD 0xd1 ++ ++ __u8 addr; ++ __u8 padding0; ++ __u16 thread_id; ++ __u16 address; ++ __u8 cc; ++ __u8 padding1; ++ __u64 value; ++} __attribute__((__packed__)); ++ ++/** + * struct peci_rd_pci_cfg_msg - RdPCIConfig command + * @addr: address of the client + * @bus: PCI bus number +@@ -438,6 +472,132 @@ struct peci_wr_pci_cfg_local_msg { __u32 value; } __attribute__((__packed__)); @@ -579,7 +688,17 @@ index 253fb42e38b7..405cd8edbcbf 100644 #define PECI_IOC_BASE 0xb7 #define PECI_IOC_XFER \ -@@ -478,4 +608,20 @@ struct peci_wr_pci_cfg_local_msg { +@@ -464,6 +624,9 @@ struct peci_wr_pci_cfg_local_msg { + #define PECI_IOC_WR_IA_MSR \ + _IOWR(PECI_IOC_BASE, PECI_CMD_WR_IA_MSR, struct peci_wr_ia_msr_msg) + ++#define PECI_IOC_RD_IA_MSREX \ ++ _IOWR(PECI_IOC_BASE, PECI_CMD_RD_IA_MSREX, struct peci_rd_ia_msrex_msg) ++ + #define PECI_IOC_RD_PCI_CFG \ + _IOWR(PECI_IOC_BASE, PECI_CMD_RD_PCI_CFG, struct peci_rd_pci_cfg_msg) + +@@ -478,4 +641,20 @@ struct peci_wr_pci_cfg_local_msg { _IOWR(PECI_IOC_BASE, PECI_CMD_WR_PCI_CFG_LOCAL, \ struct peci_wr_pci_cfg_local_msg) diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch index d828233fe..bef1d0ae8 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch @@ -1,4 +1,4 @@ -From 38c04788647a95e3951674eb802f1f99ecdde164 Mon Sep 17 00:00:00 2001 +From 8b9bca54ec03fb80834eb8d15dd599293af6d971 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Fri, 29 Jun 2018 11:00:02 -0700 Subject: [PATCH] Add dump debug code into I2C drivers @@ -20,7 +20,7 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 2 files changed, 50 insertions(+) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index fa66951b05d0..434b753def3b 100644 +index c2a6e5a27314..e1719b1f2020 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -163,6 +163,21 @@ struct aspeed_i2c_bus { @@ -65,7 +65,7 @@ index fa66951b05d0..434b753def3b 100644 return bus->master_xfer_result; } -@@ -1061,6 +1082,11 @@ static struct platform_driver aspeed_i2c_bus_driver = { +@@ -1065,6 +1086,11 @@ static struct platform_driver aspeed_i2c_bus_driver = { }; module_platform_driver(aspeed_i2c_bus_driver); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch index 803701286..931483954 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch @@ -1,4 +1,4 @@ -From 01c8d6a5146cd39c2286f659e21f1a1042aa741a Mon Sep 17 00:00:00 2001 +From d80fcbb3e9d95a7e926598290012eea88a7c474d Mon Sep 17 00:00:00 2001 From: Yong Li <yong.b.li@linux.intel.com> Date: Wed, 2 Jan 2019 15:06:43 +0800 Subject: [PATCH] Add high speed baud rate support for UART @@ -14,29 +14,29 @@ bootloader(u-boot) will set SCU4C based on the environment configuration Signed-off-by: Yong Li <yong.b.li@linux.intel.com> --- - drivers/clk/clk-aspeed.c | 41 +++++++++++++++++++++++++++----- + drivers/clk/clk-aspeed.c | 44 +++++++++++++++++++++++++++----- include/dt-bindings/clock/aspeed-clock.h | 2 ++ - 2 files changed, 37 insertions(+), 6 deletions(-) + 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c -index 42b4df6ba249..97c27820db3e 100644 +index 9bd5155598d6..24d56a724969 100644 --- a/drivers/clk/clk-aspeed.c +++ b/drivers/clk/clk-aspeed.c @@ -14,7 +14,9 @@ - #include <dt-bindings/clock/aspeed-clock.h> + #include "clk-aspeed.h" --#define ASPEED_NUM_CLKS 36 +-#define ASPEED_NUM_CLKS 38 +#define ASPEED_NUM_CLKS ASPEED_CLK_MAX -+#define UART_HIGH_SPEED_CLK 192000000 -+#define UART_LOW_SPEED_CLK 24000000 ++#define UART_HIGH_SPEED_CLK 192000000 ++#define UART_LOW_SPEED_CLK 24000000 #define ASPEED_RESET2_OFFSET 32 -@@ -28,6 +30,12 @@ - #define AST2400_HPLL_BYPASS_EN BIT(17) +@@ -29,6 +31,12 @@ #define ASPEED_MISC_CTRL 0x2c #define UART_DIV13_EN BIT(12) + #define ASPEED_MAC_CLK_DLY 0x48 +#define ASPEED_MISC2_CTRL 0x4c +#define UART1_HS_CLK_EN BIT(24) +#define UART2_HS_CLK_EN BIT(25) @@ -46,35 +46,38 @@ index 42b4df6ba249..97c27820db3e 100644 #define ASPEED_STRAP 0x70 #define CLKIN_25MHZ_EN BIT(23) #define AST2400_CLK_SOURCE_SEL BIT(18) -@@ -446,7 +454,7 @@ static int aspeed_clk_probe(struct platform_device *pdev) +@@ -386,7 +394,7 @@ static int aspeed_clk_probe(struct platform_device *pdev) struct aspeed_reset *ar; struct regmap *map; struct clk_hw *hw; - u32 val, rate; -+ u32 val, uart_clock_div; ++ u32 val, rate, rate_hi; int i, ret; map = syscon_node_to_regmap(dev->of_node); -@@ -481,15 +489,23 @@ static int aspeed_clk_probe(struct platform_device *pdev) +@@ -420,16 +428,25 @@ static int aspeed_clk_probe(struct platform_device *pdev) + /* UART clock div13 setting */ regmap_read(map, ASPEED_MISC_CTRL, &val); - if (val & UART_DIV13_EN) +- if (val & UART_DIV13_EN) - rate = 24000000 / 13; -+ uart_clock_div = 13; - else +- else - rate = 24000000; -+ uart_clock_div = 1; -+ ++ if (val & UART_DIV13_EN) { ++ rate = UART_LOW_SPEED_CLK / 13; ++ rate_hi = UART_HIGH_SPEED_CLK / 13; ++ } else { ++ rate = UART_LOW_SPEED_CLK; ++ rate_hi = UART_HIGH_SPEED_CLK; ++ } /* TODO: Find the parent data for the uart clock */ -- hw = clk_hw_register_fixed_rate(dev, "uart", NULL, 0, rate); -+ hw = clk_hw_register_fixed_rate(dev, "uart", NULL, 0, -+ UART_LOW_SPEED_CLK / uart_clock_div); + hw = clk_hw_register_fixed_rate(dev, "uart", NULL, 0, rate); if (IS_ERR(hw)) return PTR_ERR(hw); aspeed_clk_data->hws[ASPEED_CLK_UART] = hw; + hw = clk_hw_register_fixed_rate(dev, "uart-hs", "usb-port1-gate", 0, -+ UART_HIGH_SPEED_CLK / uart_clock_div); ++ rate_hi); + if (IS_ERR(hw)) + return PTR_ERR(hw); + aspeed_clk_data->hws[ASPEED_CLK_UART_HS] = hw; @@ -82,7 +85,7 @@ index 42b4df6ba249..97c27820db3e 100644 /* * Memory controller (M-PLL) PLL. This clock is configured by the * bootloader, and is exposed to Linux as a read-only clock rate. -@@ -570,9 +586,22 @@ static int aspeed_clk_probe(struct platform_device *pdev) +@@ -539,9 +556,22 @@ static int aspeed_clk_probe(struct platform_device *pdev) * UART[1..5] clock source mux */ @@ -105,7 +108,7 @@ index 42b4df6ba249..97c27820db3e 100644 /* Special case: the USB port 1 clock (bit 14) is always * working the opposite way from the other ones. -@@ -580,7 +609,7 @@ static int aspeed_clk_probe(struct platform_device *pdev) +@@ -549,7 +579,7 @@ static int aspeed_clk_probe(struct platform_device *pdev) gate_flags = (gd->clock_idx == 14) ? 0 : CLK_GATE_SET_TO_DISABLE; hw = aspeed_clk_hw_register_gate(dev, gd->name, @@ -115,15 +118,15 @@ index 42b4df6ba249..97c27820db3e 100644 map, gd->clock_idx, diff --git a/include/dt-bindings/clock/aspeed-clock.h b/include/dt-bindings/clock/aspeed-clock.h -index f43738607d77..335879505a72 100644 +index 64e245fb113f..df2f9fdfe5c1 100644 --- a/include/dt-bindings/clock/aspeed-clock.h +++ b/include/dt-bindings/clock/aspeed-clock.h -@@ -39,6 +39,8 @@ - #define ASPEED_CLK_BCLK 33 - #define ASPEED_CLK_MPLL 34 +@@ -41,6 +41,8 @@ #define ASPEED_CLK_24M 35 -+#define ASPEED_CLK_UART_HS 36 -+#define ASPEED_CLK_MAX 37 + #define ASPEED_CLK_GATE_MAC1RCLK 36 + #define ASPEED_CLK_GATE_MAC2RCLK 37 ++#define ASPEED_CLK_UART_HS 38 ++#define ASPEED_CLK_MAX 39 #define ASPEED_RESET_XDMA 0 #define ASPEED_RESET_MCTP 1 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch index 8c18e87ef..82e90c059 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch @@ -1,4 +1,4 @@ -From 0928704f3b593217662f980221406fcf6db39377 Mon Sep 17 00:00:00 2001 +From af686df07d23080834332b63fe37ee28b630ca2f Mon Sep 17 00:00:00 2001 From: Oskar Senft <osk@google.com> Date: Wed, 8 Aug 2018 10:15:05 -0400 Subject: [PATCH] misc: aspeed: Add Aspeed UART routing control driver. @@ -102,10 +102,10 @@ index 000000000000..afaf17cb7eda +$ cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 +io1 io2 io3 io4 uart2 [uart3] uart4 io6 diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts -index 4815104459f1..3094e90c9def 100644 +index 0aa2ac82cae4..403f29a74281 100644 --- a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts +++ b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts -@@ -233,6 +233,10 @@ +@@ -260,6 +260,10 @@ status = "okay"; }; @@ -117,10 +117,10 @@ index 4815104459f1..3094e90c9def 100644 status = "okay"; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 0e7f1d2fa08e..6e0b40eb939f 100644 +index 26671cc4dbd5..8288002e4f02 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -493,6 +493,12 @@ +@@ -524,6 +524,12 @@ status = "disabled"; }; }; @@ -134,10 +134,10 @@ index 0e7f1d2fa08e..6e0b40eb939f 100644 peci: bus@1e78b000 { diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index b6acddaa9421..78e8fc892209 100644 +index 50814caba1d3..439f3b0de702 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig -@@ -481,6 +481,12 @@ config ASPEED_ESPI_SLAVE +@@ -463,6 +463,12 @@ config ASPEED_ESPI_SLAVE Control Aspeed ast2500 eSPI slave controller to handle event which needs the firmware's processing. @@ -151,10 +151,10 @@ index b6acddaa9421..78e8fc892209 100644 depends on PCI select CRC32 diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index f91f66a15484..7337b8bcd0a3 100644 +index f168e6713440..87958cb74d00 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile -@@ -55,6 +55,7 @@ obj-$(CONFIG_ECHO) += echo/ +@@ -54,6 +54,7 @@ obj-$(CONFIG_ECHO) += echo/ obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o obj-$(CONFIG_CXL_BASE) += cxl/ obj-$(CONFIG_ASPEED_ESPI_SLAVE) += aspeed-espi-slave.o diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch index 7f556de64..08f406ac1 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch @@ -1,4 +1,4 @@ -From fcea191a6e0eb869c62b5d1ea8a6e914a540fcfb Mon Sep 17 00:00:00 2001 +From 89112c3971a540302834e5e987a1dec236bd752d Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Wed, 3 Oct 2018 10:17:58 -0700 Subject: [PATCH] arm: dts: aspeed: Swap the mac nodes numbering @@ -13,10 +13,10 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi -index 3df43f925848..618abeab539b 100644 +index 71563972d2fe..78251541a109 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi -@@ -101,14 +101,6 @@ +@@ -121,14 +121,6 @@ reg = <0x1e6c2000 0x80>; }; @@ -31,7 +31,7 @@ index 3df43f925848..618abeab539b 100644 mac1: ethernet@1e680000 { compatible = "aspeed,ast2400-mac", "faraday,ftgmac100"; reg = <0x1e680000 0x180>; -@@ -117,6 +109,14 @@ +@@ -137,6 +129,14 @@ status = "disabled"; }; @@ -47,7 +47,7 @@ index 3df43f925848..618abeab539b 100644 compatible = "aspeed,ast2400-ehci", "generic-ehci"; reg = <0x1e6a1000 0x100>; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 6e0b40eb939f..b8c85fad2a39 100644 +index 8288002e4f02..6d2c4494ce04 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -149,14 +149,6 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch index c115d23d0..6d8ec4883 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch @@ -1,4 +1,4 @@ -From 7ac4709dd92c608ca4c8ff0046a434c8f465a80c Mon Sep 17 00:00:00 2001 +From e2df269568c6c0c8c8edbca73118c2dbdaea75bd Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Mon, 11 Feb 2019 17:02:35 -0800 Subject: [PATCH] Add Aspeed PWM driver which uses FTTMR010 timer IP @@ -18,10 +18,10 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> create mode 100644 drivers/pwm/pwm-fttmr010.c diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index b8c85fad2a39..88ac8e08b6ae 100644 +index 6d2c4494ce04..653e03a0fa4c 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -312,7 +312,7 @@ +@@ -342,7 +342,7 @@ timer: timer@1e782000 { /* This timer is a Faraday FTTMR010 derivative */ @@ -31,7 +31,7 @@ index b8c85fad2a39..88ac8e08b6ae 100644 interrupts = <16 17 18 35 36 37 38 39>; clocks = <&syscon ASPEED_CLK_APB>; diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig -index dff5a93f7daa..5759439a3947 100644 +index a7e57516959e..3388f837fcf9 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -171,6 +171,15 @@ config PWM_FSL_FTM @@ -51,7 +51,7 @@ index dff5a93f7daa..5759439a3947 100644 tristate "HiSilicon BVT PWM support" depends on ARCH_HISI || COMPILE_TEST diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile -index c368599d36c0..937d212bb02a 100644 +index 76b555b51887..19ecfd82d8c5 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -15,6 +15,7 @@ obj-$(CONFIG_PWM_CRC) += pwm-crc.o diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch index b2057d247..ce77494f4 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch @@ -1,4 +1,4 @@ -From ed13e7eb07e6cb8bdc1eb4563de30b469a9beb26 Mon Sep 17 00:00:00 2001 +From be693c1c21979c067623434aa653f85a83c8eac7 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Fri, 15 Feb 2019 16:05:09 -0800 Subject: [PATCH] i2c: Add mux hold/unhold msg types @@ -48,7 +48,7 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 6 files changed, 214 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c -index 9e43508d4567..8a480d269542 100644 +index 9c440fa6a3dd..53ff27cae5d3 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -1299,6 +1299,25 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr) @@ -100,7 +100,7 @@ index 9e43508d4567..8a480d269542 100644 */ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { -+ enum i2c_hold_msg_type hold_msg; ++ enum i2c_hold_msg_type hold_msg = I2C_HOLD_MSG_NONE; unsigned long orig_jiffies; + unsigned long timeout; int ret, try; @@ -219,18 +219,18 @@ index 3ac426a8ab5a..f7bf95101e34 100644 return res; } diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c -index 603252fa1284..d3f55243e701 100644 +index 774507b54b57..c6e433238b22 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c -@@ -26,6 +26,7 @@ - #include <linux/module.h> +@@ -27,6 +27,7 @@ #include <linux/of.h> #include <linux/slab.h> + #include <linux/sysfs.h> +#include <linux/timer.h> /* multiplexer per channel data */ struct i2c_mux_priv { -@@ -35,21 +36,57 @@ struct i2c_mux_priv { +@@ -36,21 +37,57 @@ struct i2c_mux_priv { u32 chan_id; }; @@ -290,7 +290,7 @@ index 603252fa1284..d3f55243e701 100644 return ret; } -@@ -60,15 +97,32 @@ static int i2c_mux_master_xfer(struct i2c_adapter *adap, +@@ -61,15 +98,32 @@ static int i2c_mux_master_xfer(struct i2c_adapter *adap, struct i2c_mux_priv *priv = adap->algo_data; struct i2c_mux_core *muxc = priv->muxc; struct i2c_adapter *parent = muxc->parent; @@ -325,7 +325,7 @@ index 603252fa1284..d3f55243e701 100644 return ret; } -@@ -81,16 +135,33 @@ static int __i2c_mux_smbus_xfer(struct i2c_adapter *adap, +@@ -82,16 +136,33 @@ static int __i2c_mux_smbus_xfer(struct i2c_adapter *adap, struct i2c_mux_priv *priv = adap->algo_data; struct i2c_mux_core *muxc = priv->muxc; struct i2c_adapter *parent = muxc->parent; @@ -361,7 +361,7 @@ index 603252fa1284..d3f55243e701 100644 return ret; } -@@ -103,16 +174,33 @@ static int i2c_mux_smbus_xfer(struct i2c_adapter *adap, +@@ -104,16 +175,33 @@ static int i2c_mux_smbus_xfer(struct i2c_adapter *adap, struct i2c_mux_priv *priv = adap->algo_data; struct i2c_mux_core *muxc = priv->muxc; struct i2c_adapter *parent = muxc->parent; @@ -431,10 +431,10 @@ index c5a977320f82..47f8763d6ed2 100644 int max_adapters; struct i2c_adapter *adapter[0]; diff --git a/include/linux/i2c.h b/include/linux/i2c.h -index 1308126fc384..3ee92c6a442d 100644 +index fa5552c2307b..92c795ce9081 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h -@@ -699,6 +699,13 @@ struct i2c_adapter { +@@ -711,6 +711,13 @@ struct i2c_adapter { const struct i2c_adapter_quirks *quirks; struct irq_domain *host_notify_domain; @@ -448,7 +448,7 @@ index 1308126fc384..3ee92c6a442d 100644 }; #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) -@@ -998,4 +1005,22 @@ static inline struct i2c_client *i2c_acpi_new_device(struct device *dev, +@@ -1005,4 +1012,22 @@ static inline struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle ha } #endif /* CONFIG_ACPI */ diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch index 25f494652..0a9bccf23 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch @@ -1,4 +1,4 @@ -From c55d6bb49cfbd39a7c0848076c84166def65936e Mon Sep 17 00:00:00 2001 +From 04af6987c904225fdd4657e7b87874edd11c4e0b Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Thu, 7 Mar 2019 15:17:40 -0800 Subject: [PATCH] Add bus-timeout-ms and #retries device tree properties @@ -59,10 +59,10 @@ index 44efafdfd7f5..e382931cf3d6 100644 used by the device. I2C core will assign "irq" interrupt (or the very first interrupt if not using interrupt names) as primary interrupt for the slave. diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 434b753def3b..99bd30953531 100644 +index e1719b1f2020..58bdbe472721 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -1014,7 +1014,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -1018,7 +1018,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) spin_lock_init(&bus->lock); init_completion(&bus->cmd_complete); bus->adap.owner = THIS_MODULE; @@ -71,7 +71,7 @@ index 434b753def3b..99bd30953531 100644 bus->adap.dev.parent = &pdev->dev; bus->adap.dev.of_node = pdev->dev.of_node; diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c -index 8a480d269542..69b798a2d31e 100644 +index 302d2d0c87d0..825e2d85d5a7 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -1320,6 +1320,7 @@ static void i2c_adapter_hold_timer_callback(struct timer_list *t) diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch index 035945cf3..139d06df0 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch @@ -1,4 +1,4 @@ -From c4e7b89ee20dc28e10fae7eb0859e4fa9d3e8643 Mon Sep 17 00:00:00 2001 +From 4d90c5ba05ee3e8a4bf5e4c1a5fdcf2664b1800b Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Wed, 13 Mar 2019 15:04:16 -0700 Subject: [PATCH] char: ipmi: Add clock control logic into Aspeed LPC BT driver @@ -42,10 +42,10 @@ index 028268fd99ee..d13887d60f19 100644 + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; }; diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi -index 618abeab539b..c2388bb7c678 100644 +index 78251541a109..b3b6720fb6fb 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi -@@ -337,6 +337,7 @@ +@@ -387,6 +387,7 @@ ibt: ibt@c0 { compatible = "aspeed,ast2400-ibt-bmc"; reg = <0xc0 0x18>; @@ -54,10 +54,10 @@ index 618abeab539b..c2388bb7c678 100644 status = "disabled"; }; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 88ac8e08b6ae..88b318fd287b 100644 +index 653e03a0fa4c..49f792eafdd1 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -470,6 +470,7 @@ +@@ -500,6 +500,7 @@ ibt: ibt@c0 { compatible = "aspeed,ast2500-ibt-bmc"; reg = <0xc0 0x18>; diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch index c335fb3ec..cd20e77ac 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch @@ -1,4 +1,4 @@ -From a5bbf0f5943d3a6be6e58a4b78d6d18694ceb859 Mon Sep 17 00:00:00 2001 +From f2e7fb51e4832a0da2fdb8fb267471b54581312b Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Wed, 13 Mar 2019 15:27:48 -0700 Subject: [PATCH] misc: Add clock control logic into Aspeed LPC SNOOP driver @@ -22,10 +22,10 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi -index c2388bb7c678..70aca75d65e0 100644 +index b3b6720fb6fb..58c5148194a3 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi -@@ -320,6 +320,7 @@ +@@ -370,6 +370,7 @@ compatible = "aspeed,ast2400-lpc-snoop"; reg = <0x0 0x80>; interrupts = <8>; @@ -34,10 +34,10 @@ index c2388bb7c678..70aca75d65e0 100644 }; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 88b318fd287b..f4a5d06f1000 100644 +index 49f792eafdd1..955789d8c736 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -453,6 +453,7 @@ +@@ -483,6 +483,7 @@ compatible = "aspeed,ast2500-lpc-snoop"; reg = <0x0 0x80>; interrupts = <8>; diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch index 499662ac3..cfff0a842 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch @@ -1,4 +1,4 @@ -From 27675470115548612cee9153903aaffffb68177b Mon Sep 17 00:00:00 2001 +From 9a6eafbba9f5d972065f65431093ec74968cae39 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Wed, 13 Mar 2019 15:36:34 -0700 Subject: [PATCH] char: ipmi: Add clock control logic into Aspeed LPC KCS @@ -45,10 +45,10 @@ index d98a9bf45d6c..3453eb0bf8f2 100644 kcs_addr = <0xCA2>; status = "okay"; diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi -index 1c00828da913..f04006f4cd27 100644 +index 58c5148194a3..14e5dc260a3b 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi -@@ -298,6 +298,33 @@ +@@ -348,6 +348,33 @@ lpc_bmc: lpc-bmc@0 { compatible = "aspeed,ast2400-lpc-bmc"; reg = <0x0 0x80>; @@ -82,7 +82,7 @@ index 1c00828da913..f04006f4cd27 100644 }; lpc_host: lpc-host@80 { -@@ -309,6 +336,14 @@ +@@ -359,6 +386,14 @@ #size-cells = <1>; ranges = <0x0 0x80 0x1e0>; @@ -98,7 +98,7 @@ index 1c00828da913..f04006f4cd27 100644 compatible = "aspeed,ast2400-lpc-ctrl"; reg = <0x0 0x80>; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index f2292bdfef91..d46b9ffc79de 100644 +index 955789d8c736..19739183c1c8 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -135,7 +135,7 @@ @@ -110,7 +110,7 @@ index f2292bdfef91..d46b9ffc79de 100644 interrupt-controller; #interrupt-cells = <1>; valid-sources = <0xfefff7ff 0x0807ffff>; -@@ -410,18 +410,21 @@ +@@ -440,18 +440,21 @@ compatible = "aspeed,ast2500-kcs-bmc"; interrupts = <8>; kcs_chan = <1>; @@ -132,7 +132,7 @@ index f2292bdfef91..d46b9ffc79de 100644 status = "disabled"; }; }; -@@ -439,6 +442,7 @@ +@@ -469,6 +472,7 @@ compatible = "aspeed,ast2500-kcs-bmc"; interrupts = <8>; kcs_chan = <4>; diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0049-Suppress-excessive-HID-gadget-error-logs.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0049-Suppress-excessive-HID-gadget-error-logs.patch index d0f98b9c1..4a87f2d76 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0049-Suppress-excessive-HID-gadget-error-logs.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0049-Suppress-excessive-HID-gadget-error-logs.patch @@ -1,4 +1,4 @@ -From 7dd0a7c62e5885bb726ef2bd5007e79a50932c38 Mon Sep 17 00:00:00 2001 +From 5b9ec5081492b461710cb82e7ecc93fd3af8ad34 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Mon, 18 Mar 2019 14:06:36 -0700 Subject: [PATCH] Suppress excessive HID gadget error logs @@ -18,13 +18,22 @@ This should be a downstream only customization. Do not upstream it. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> --- - drivers/usb/gadget/function/f_hid.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) + drivers/usb/gadget/function/f_hid.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c -index f3816a5c861e..3a94584a9dbc 100644 +index f3816a5c861e..c96c0f6f1df0 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c +@@ -320,7 +320,7 @@ static void f_hidg_req_complete(struct usb_ep *ep, struct usb_request *req) + struct f_hidg *hidg = (struct f_hidg *)ep->driver_data; + unsigned long flags; + +- if (req->status != 0) { ++ if (req->status != 0 && req->status != -ESHUTDOWN) { + ERROR(hidg->func.config->cdev, + "End Point Request ERROR: %d\n", req->status); + } @@ -395,8 +395,10 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch index d9379f565..02bb6527f 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch @@ -1,4 +1,4 @@ -From 278740d23c1eac792c64608af4bfa3fae640965f Mon Sep 17 00:00:00 2001 +From ce35414258a8541a8b81a4a8a929bcf9cdface97 Mon Sep 17 00:00:00 2001 From: "Hunt, Bryan" <bryan.hunt@intel.com> Date: Mon, 6 May 2019 10:02:14 -0700 Subject: [PATCH] Add AST2500d JTAG driver @@ -11,10 +11,10 @@ Signed-off-by: Hunt, Bryan <bryan.hunt@intel.com> 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index ed0b7217f55f..89a9febf6f14 100644 +index 19739183c1c8..3d615708a0cd 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -389,6 +389,15 @@ +@@ -419,6 +419,15 @@ pinctrl-0 = <&pinctrl_espi_default>; }; diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch index 3047746ca..4162046e7 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch @@ -1,4 +1,4 @@ -From 520416545a47cffe66815f31bc1465eab8864554 Mon Sep 17 00:00:00 2001 +From 45dd8ca9bb83b688aa0d0b5472fd0b1ed9fcf29a Mon Sep 17 00:00:00 2001 From: "Corona, Ernesto" <ernesto.corona@intel.com> Date: Fri, 7 Jun 2019 07:37:39 -0800 Subject: [PATCH v29 1/6] drivers: jtag: Add JTAG core driver @@ -267,20 +267,20 @@ Comments pointed by Tobias Klauser <tklauser@distanz.ch> create mode 100644 include/uapi/linux/jtag.h diff --git a/drivers/Kconfig b/drivers/Kconfig -index 339ac306ded6..fb970bbe6b03 100644 +index 92f4a9bb83f1..7403af7ffa85 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig -@@ -234,4 +234,5 @@ source "drivers/counter/Kconfig" +@@ -232,4 +232,5 @@ source "drivers/counter/Kconfig" source "drivers/peci/Kconfig" +source "drivers/jtag/Kconfig" endmenu diff --git a/drivers/Makefile b/drivers/Makefile -index 18d91cd5ac0f..b4d21c963923 100644 +index 47cad1b9f992..cd240910c56e 100644 --- a/drivers/Makefile +++ b/drivers/Makefile -@@ -189,3 +189,4 @@ obj-$(CONFIG_GNSS) += gnss/ +@@ -188,3 +188,4 @@ obj-$(CONFIG_GNSS) += gnss/ obj-$(CONFIG_INTERCONNECT) += interconnect/ obj-$(CONFIG_COUNTER) += counter/ obj-$(CONFIG_PECI) += peci/ diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0056-Documentation-jtag-Add-JTAG-core-driver-ioctl-number.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0056-Documentation-jtag-Add-JTAG-core-driver-ioctl-number.patch index a7dccc4b6..3efe2c5f3 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0056-Documentation-jtag-Add-JTAG-core-driver-ioctl-number.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0056-Documentation-jtag-Add-JTAG-core-driver-ioctl-number.patch @@ -1,7 +1,7 @@ -From ba0c35ae070cffcb384fc76e23a38e00142b128d Mon Sep 17 00:00:00 2001 +From d5efb0ec2b28bc1074472ab4eaa937dcbe490f6a Mon Sep 17 00:00:00 2001 From: "Corona, Ernesto" <ernesto.corona@intel.com> -Date: Wed, 10 Mar 2019 11:48:18 -0800 -Subject: [PATCH v29 5/6] Documentation jtag: Add JTAG core driver ioctl number +Date: Sun, 10 Mar 2019 11:48:18 -0800 +Subject: [PATCH] Documentation jtag: Add JTAG core driver ioctl number JTAG class driver provide infrastructure to support hardware/software JTAG platform drivers. It provide user layer API interface for flashing @@ -36,22 +36,22 @@ Cc: Arnd Bergmann <arnd@arndb.de> Cc: Steven A Filary <steven.a.filary@intel.com> Cc: Bryan Hunt <bryan.hunt@intel.com> --- - Documentation/ioctl/ioctl-number.txt | 2 ++ + Documentation/ioctl/ioctl-number.rst | 2 ++ 1 file changed, 2 insertions(+) -diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt -index c955814..f732118 100644 ---- a/Documentation/ioctl/ioctl-number.txt -+++ b/Documentation/ioctl/ioctl-number.txt -@@ -323,6 +323,8 @@ Code Seq#(hex) Include File Comments - 0xB0 all RATIO devices in development: - <mailto:vgo@ratio.de> - 0xB1 00-1F PPPoX <mailto:mostrows@styx.uwaterloo.ca> -+0xB2 00-0F linux/jtag.h JTAG driver -+ <mailto:oleksandrs@mellanox.com> - 0xB3 00 linux/mmc/ioctl.h - 0xB4 00-0F linux/gpio.h <mailto:linux-gpio@vger.kernel.org> - 0xB5 00-0F uapi/linux/rpmsg.h <mailto:linux-remoteproc@vger.kernel.org> +diff --git a/Documentation/ioctl/ioctl-number.rst b/Documentation/ioctl/ioctl-number.rst +index 7f8dcae7a230..4d25966d44e5 100644 +--- a/Documentation/ioctl/ioctl-number.rst ++++ b/Documentation/ioctl/ioctl-number.rst +@@ -332,6 +332,8 @@ Code Seq# Include File Comments + <mailto:vgo@ratio.de> + 0xB1 00-1F PPPoX + <mailto:mostrows@styx.uwaterloo.ca> ++0xB2 00-0F linux/jtag.h JTAG driver ++ <mailto:oleksandrs@mellanox.com> + 0xB3 00 linux/mmc/ioctl.h + 0xB4 00-0F linux/gpio.h <mailto:linux-gpio@vger.kernel.org> + 0xB5 00-0F uapi/linux/rpmsg.h <mailto:linux-remoteproc@vger.kernel.org> -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch index 47a532590..b5f5a93a0 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch @@ -1,4 +1,4 @@ -From 8598b57423967f5851484533a1b09a04bafa235b Mon Sep 17 00:00:00 2001 +From 01fc94b1193f4e97d498e2bcb05dfe21b991b01d Mon Sep 17 00:00:00 2001 From: "Corona, Ernesto" <ernesto.corona@intel.com> Date: Sun, 10 Mar 2019 11:49:37 -0800 Subject: [PATCH v29 6/6] drivers: jtag: Add JTAG core driver Maintainers @@ -24,10 +24,10 @@ Cc: Bryan Hunt <bryan.hunt@intel.com> 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS -index e0925f221e25..2cd0a46f9a1a 100644 +index f5c5eaa69f2f..92b0932c4b9f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -8521,6 +8521,17 @@ L: linux-serial@vger.kernel.org +@@ -8709,6 +8709,17 @@ L: linux-serial@vger.kernel.org S: Orphan F: drivers/tty/serial/jsm/ diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0060-i2c-aspeed-fix-master-pending-state-handling.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0060-i2c-aspeed-fix-master-pending-state-handling.patch new file mode 100644 index 000000000..d38c089af --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0060-i2c-aspeed-fix-master-pending-state-handling.patch @@ -0,0 +1,135 @@ +From ca5e5e784ada4da11caebf6ba6852e1ff8a13bf7 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Date: Tue, 11 Jun 2019 14:59:53 -0700 +Subject: [PATCH] i2c: aspeed: fix master pending state handling + +In case of master pending state, it should not trigger a master +command, otherwise data could be corrupted because this H/W shares +the same data buffer for slave and master operations. It also means +that H/W command queue handling is unreliable because of the buffer +sharing issue. To fix this issue, it clears command queue if a +master command is queued in pending state to use S/W solution +instead of H/W command queue handling. Also, it refines restarting +mechanism of the pending master command. + +Fixes: 2e57b7cebb98 ("i2c: aspeed: Add multi-master use case support") + +Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +--- + drivers/i2c/busses/i2c-aspeed.c | 54 ++++++++++++++++++++++++++--------------- + 1 file changed, 34 insertions(+), 20 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c +index 58bdbe472721..7becfcd67142 100644 +--- a/drivers/i2c/busses/i2c-aspeed.c ++++ b/drivers/i2c/busses/i2c-aspeed.c +@@ -108,6 +108,12 @@ + #define ASPEED_I2CD_S_TX_CMD BIT(2) + #define ASPEED_I2CD_M_TX_CMD BIT(1) + #define ASPEED_I2CD_M_START_CMD BIT(0) ++#define ASPEED_I2CD_MASTER_CMDS_MASK \ ++ (ASPEED_I2CD_M_STOP_CMD | \ ++ ASPEED_I2CD_M_S_RX_CMD_LAST | \ ++ ASPEED_I2CD_M_RX_CMD | \ ++ ASPEED_I2CD_M_TX_CMD | \ ++ ASPEED_I2CD_M_START_CMD) + + /* 0x18 : I2CD Slave Device Address Register */ + #define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0) +@@ -351,18 +357,19 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) + struct i2c_msg *msg = &bus->msgs[bus->msgs_index]; + u8 slave_addr = i2c_8bit_addr_from_msg(msg); + +- bus->master_state = ASPEED_I2C_MASTER_START; +- + #if IS_ENABLED(CONFIG_I2C_SLAVE) + /* + * If it's requested in the middle of a slave session, set the master + * state to 'pending' then H/W will continue handling this master + * command when the bus comes back to the idle state. + */ +- if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) ++ if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) { + bus->master_state = ASPEED_I2C_MASTER_PENDING; ++ return; ++ } + #endif /* CONFIG_I2C_SLAVE */ + ++ bus->master_state = ASPEED_I2C_MASTER_START; + bus->buf_index = 0; + + if (msg->flags & I2C_M_RD) { +@@ -437,20 +444,6 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) + } + } + +-#if IS_ENABLED(CONFIG_I2C_SLAVE) +- /* +- * A pending master command will be started by H/W when the bus comes +- * back to idle state after completing a slave operation so change the +- * master state from 'pending' to 'start' at here if slave is inactive. +- */ +- if (bus->master_state == ASPEED_I2C_MASTER_PENDING) { +- if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) +- goto out_no_complete; +- +- bus->master_state = ASPEED_I2C_MASTER_START; +- } +-#endif /* CONFIG_I2C_SLAVE */ +- + /* Master is not currently active, irq was for someone else. */ + if (bus->master_state == ASPEED_I2C_MASTER_INACTIVE || + bus->master_state == ASPEED_I2C_MASTER_PENDING) +@@ -477,11 +470,15 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) + #if IS_ENABLED(CONFIG_I2C_SLAVE) + /* + * If a peer master starts a xfer immediately after it queues a +- * master command, change its state to 'pending' then H/W will +- * continue the queued master xfer just after completing the +- * slave mode session. ++ * master command, clear the queued master command and change ++ * its state to 'pending'. To simplify handling of pending ++ * cases, it uses S/W solution instead of H/W command queue ++ * handling. + */ + if (unlikely(irq_status & ASPEED_I2CD_INTR_SLAVE_MATCH)) { ++ writel(readl(bus->base + ASPEED_I2C_CMD_REG) & ++ ~ASPEED_I2CD_MASTER_CMDS_MASK, ++ bus->base + ASPEED_I2C_CMD_REG); + bus->master_state = ASPEED_I2C_MASTER_PENDING; + dev_dbg(bus->dev, + "master goes pending due to a slave start\n"); +@@ -644,6 +641,14 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) + irq_handled |= aspeed_i2c_master_irq(bus, + irq_remaining); + } ++ ++ /* ++ * Start a pending master command at here if a slave operation is ++ * completed. ++ */ ++ if (bus->master_state == ASPEED_I2C_MASTER_PENDING && ++ bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE) ++ aspeed_i2c_do_start(bus); + #else + irq_handled = aspeed_i2c_master_irq(bus, irq_remaining); + #endif /* CONFIG_I2C_SLAVE */ +@@ -707,6 +712,15 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap, + ASPEED_I2CD_BUS_BUSY_STS)) + aspeed_i2c_recover_bus(bus); + ++ /* ++ * If timed out and the state is still pending, drop the pending ++ * master command. ++ */ ++ spin_lock_irqsave(&bus->lock, flags); ++ if (bus->master_state == ASPEED_I2C_MASTER_PENDING) ++ bus->master_state = ASPEED_I2C_MASTER_INACTIVE; ++ spin_unlock_irqrestore(&bus->lock, flags); ++ + return -ETIMEDOUT; + } + +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0066-i2c-aspeed-add-buffer-mode-transfer-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0061-i2c-aspeed-add-buffer-mode-transfer-support.patch index 9b96b400b..8e91b5ced 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0066-i2c-aspeed-add-buffer-mode-transfer-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0061-i2c-aspeed-add-buffer-mode-transfer-support.patch @@ -1,4 +1,4 @@ -From 36128aacdc8b642b9ee080e493abbc00de345f1d Mon Sep 17 00:00:00 2001 +From 0bc5efede7c99da41fc0cbadfb1644b428ead9d3 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Tue, 11 Jun 2019 15:07:08 -0700 Subject: [PATCH] i2c: aspeed: add buffer mode transfer support @@ -33,11 +33,12 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> .../devicetree/bindings/i2c/i2c-aspeed.txt | 40 ++- arch/arm/boot/dts/aspeed-g4.dtsi | 47 ++-- arch/arm/boot/dts/aspeed-g5.dtsi | 47 ++-- + arch/arm/boot/dts/aspeed-g6.dtsi | 34 +-- drivers/i2c/busses/i2c-aspeed.c | 294 ++++++++++++++++++--- - 4 files changed, 349 insertions(+), 79 deletions(-) + 5 files changed, 366 insertions(+), 96 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt -index 724ee9f35c10..e1a0ae7a8c08 100644 +index 7da7e813b2b0..0ff3539cee95 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt @@ -3,7 +3,10 @@ Device tree configuration for the I2C busses on the AST24XX and AST25XX SoCs. @@ -52,7 +53,7 @@ index 724ee9f35c10..e1a0ae7a8c08 100644 - compatible : should be "aspeed,ast2400-i2c-bus" or "aspeed,ast2500-i2c-bus" - clocks : root clock of bus, should reference the APB -@@ -29,12 +32,21 @@ i2c { +@@ -28,12 +31,21 @@ i2c { #size-cells = <1>; ranges = <0 0x1e78a000 0x1000>; @@ -79,7 +80,7 @@ index 724ee9f35c10..e1a0ae7a8c08 100644 }; i2c0: i2c-bus@40 { -@@ -42,11 +54,25 @@ i2c { +@@ -41,11 +53,25 @@ i2c { #size-cells = <0>; #interrupt-cells = <1>; reg = <0x40 0x40>; @@ -107,10 +108,10 @@ index 724ee9f35c10..e1a0ae7a8c08 100644 + }; }; diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi -index 47a5029f5bdb..052b1b6b4dc7 100644 +index 14e5dc260a3b..68f40a89c91f 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi -@@ -469,12 +469,21 @@ +@@ -519,12 +519,21 @@ }; &i2c { @@ -137,7 +138,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 }; i2c0: i2c-bus@40 { -@@ -482,7 +491,7 @@ +@@ -532,7 +541,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -146,7 +147,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -498,7 +507,7 @@ +@@ -548,7 +557,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -155,7 +156,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -514,7 +523,7 @@ +@@ -564,7 +573,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -164,7 +165,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -531,7 +540,7 @@ +@@ -581,7 +590,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -173,7 +174,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -548,7 +557,7 @@ +@@ -598,7 +607,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -182,7 +183,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -565,7 +574,7 @@ +@@ -615,7 +624,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -191,7 +192,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -582,7 +591,7 @@ +@@ -632,7 +641,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -200,7 +201,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -599,7 +608,7 @@ +@@ -649,7 +658,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -209,7 +210,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -616,7 +625,7 @@ +@@ -666,7 +675,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -218,7 +219,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -633,7 +642,7 @@ +@@ -683,7 +692,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -227,7 +228,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -650,7 +659,7 @@ +@@ -700,7 +709,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -236,7 +237,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -667,7 +676,7 @@ +@@ -717,7 +726,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -245,7 +246,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -684,7 +693,7 @@ +@@ -734,7 +743,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -254,7 +255,7 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 compatible = "aspeed,ast2400-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -701,7 +710,7 @@ +@@ -751,7 +760,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -264,10 +265,10 @@ index 47a5029f5bdb..052b1b6b4dc7 100644 clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 89a9febf6f14..2d2173d598e4 100644 +index 3d615708a0cd..fdc669ebfb84 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -586,12 +586,21 @@ +@@ -616,12 +616,21 @@ }; &i2c { @@ -294,7 +295,7 @@ index 89a9febf6f14..2d2173d598e4 100644 }; i2c0: i2c-bus@40 { -@@ -599,7 +608,7 @@ +@@ -629,7 +638,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -303,7 +304,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -615,7 +624,7 @@ +@@ -645,7 +654,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -312,7 +313,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -631,7 +640,7 @@ +@@ -661,7 +670,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -321,7 +322,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -648,7 +657,7 @@ +@@ -678,7 +687,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -330,7 +331,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -665,7 +674,7 @@ +@@ -695,7 +704,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -339,7 +340,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -682,7 +691,7 @@ +@@ -712,7 +721,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -348,7 +349,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -699,7 +708,7 @@ +@@ -729,7 +738,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -357,7 +358,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -716,7 +725,7 @@ +@@ -746,7 +755,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -366,7 +367,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -733,7 +742,7 @@ +@@ -763,7 +772,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -375,7 +376,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -750,7 +759,7 @@ +@@ -780,7 +789,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -384,7 +385,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -767,7 +776,7 @@ +@@ -797,7 +806,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -393,7 +394,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -784,7 +793,7 @@ +@@ -814,7 +823,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -402,7 +403,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -801,7 +810,7 @@ +@@ -831,7 +840,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -411,7 +412,7 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; -@@ -818,7 +827,7 @@ +@@ -848,7 +857,7 @@ #size-cells = <0>; #interrupt-cells = <1>; @@ -420,8 +421,161 @@ index 89a9febf6f14..2d2173d598e4 100644 compatible = "aspeed,ast2500-i2c-bus"; clocks = <&syscon ASPEED_CLK_APB>; resets = <&syscon ASPEED_RESET_I2C>; +diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi +index 2ad90a906266..2dd89efee37c 100644 +--- a/arch/arm/boot/dts/aspeed-g6.dtsi ++++ b/arch/arm/boot/dts/aspeed-g6.dtsi +@@ -530,11 +530,11 @@ + #include "aspeed-g6-pinctrl.dtsi" + + &i2c { +- i2c0: i2c-bus@40 { ++ i2c0: i2c-bus@80 { + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x80 0x80>; ++ reg = <0x80 0x80>, <0xc00 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -549,7 +549,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x100 0x80>; ++ reg = <0x100 0x80>, <0xc20 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -564,7 +564,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x180 0x80>; ++ reg = <0x180 0x80>, <0xc40 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -579,7 +579,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x200 0x80>; ++ reg = <0x200 0x80>, <0xc60 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -594,7 +594,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x280 0x80>; ++ reg = <0x280 0x80>, <0xc80 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -609,7 +609,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x300 0x80>; ++ reg = <0x300 0x80>, <0xca0 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -624,7 +624,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x380 0x80>; ++ reg = <0x380 0x80>, <0xcc0 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -639,7 +639,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x400 0x80>; ++ reg = <0x400 0x80>, <0xce0 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -654,7 +654,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x480 0x80>; ++ reg = <0x480 0x80>, <0xd00 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -669,7 +669,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x500 0x80>; ++ reg = <0x500 0x80>, <0xd20 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -684,7 +684,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x580 0x80>; ++ reg = <0x580 0x80>, <0xd40 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -699,7 +699,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x600 0x80>; ++ reg = <0x600 0x80>, <0xd60 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -714,7 +714,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x680 0x80>; ++ reg = <0x680 0x80>, <0xd80 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -729,7 +729,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x700 0x80>; ++ reg = <0x700 0x80>, <0xda0 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -744,7 +744,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x780 0x80>; ++ reg = <0x780 0x80>, <0xdc0 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; +@@ -759,7 +759,7 @@ + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <1>; +- reg = <0x800 0x80>; ++ reg = <0x800 0x80>, <0xde0 0x20>; + compatible = "aspeed,ast2600-i2c-bus"; + clocks = <&syscon ASPEED_CLK_APB1>; + resets = <&syscon ASPEED_RESET_I2C>; diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index d8143c24d3a7..b721fb1d6d4c 100644 +index b9f425739940..3831466912b4 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -7,6 +7,7 @@ @@ -475,7 +629,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 #define ASPEED_I2CD_MULTI_MASTER_DIS BIT(15) #define ASPEED_I2CD_SDA_DRIVE_1T_EN BIT(8) #define ASPEED_I2CD_M_SDA_DRIVE_1T_EN BIT(7) -@@ -104,6 +112,8 @@ +@@ -102,6 +110,8 @@ #define ASPEED_I2CD_BUS_RECOVER_CMD BIT(11) /* Command Bit */ @@ -484,7 +638,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 #define ASPEED_I2CD_M_STOP_CMD BIT(5) #define ASPEED_I2CD_M_S_RX_CMD_LAST BIT(4) #define ASPEED_I2CD_M_RX_CMD BIT(3) -@@ -114,6 +124,13 @@ +@@ -112,6 +122,13 @@ /* 0x18 : I2CD Slave Device Address Register */ #define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0) @@ -498,7 +652,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 enum aspeed_i2c_master_state { ASPEED_I2C_MASTER_INACTIVE, ASPEED_I2C_MASTER_PENDING, -@@ -161,6 +178,11 @@ struct aspeed_i2c_bus { +@@ -157,6 +174,11 @@ struct aspeed_i2c_bus { int master_xfer_result; /* Multi-master */ bool multi_master; @@ -510,7 +664,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 #if IS_ENABLED(CONFIG_I2C_SLAVE) struct i2c_client *slave; enum aspeed_i2c_slave_state slave_state; -@@ -259,6 +281,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -253,6 +275,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) { u32 command, irq_handled = 0; struct i2c_client *slave = bus->slave; @@ -518,7 +672,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 u8 value; if (!slave) -@@ -287,7 +310,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -275,7 +298,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) /* Slave was sent something. */ if (irq_status & ASPEED_I2CD_INTR_RX_DONE) { @@ -532,7 +686,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 /* Handle address frame. */ if (bus->slave_state == ASPEED_I2C_SLAVE_START) { if (value & 0x1) -@@ -317,6 +345,20 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -290,6 +318,20 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) /* Slave was asked to stop. */ if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP) { @@ -553,7 +707,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 irq_handled |= ASPEED_I2CD_INTR_NORMAL_STOP; bus->slave_state = ASPEED_I2C_SLAVE_STOP; } -@@ -349,9 +391,36 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -322,9 +364,36 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) case ASPEED_I2C_SLAVE_WRITE_REQUESTED: bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); @@ -588,9 +742,9 @@ index d8143c24d3a7..b721fb1d6d4c 100644 + bus->base + ASPEED_I2C_CMD_REG); + } break; - case ASPEED_I2C_SLAVE_GCALL_REQUESTED: - bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; -@@ -382,6 +451,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) + case ASPEED_I2C_SLAVE_STOP: + i2c_slave_event(slave, I2C_SLAVE_STOP, &value); +@@ -350,6 +419,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) u32 command = ASPEED_I2CD_M_START_CMD | ASPEED_I2CD_M_TX_CMD; struct i2c_msg *msg = &bus->msgs[bus->msgs_index]; u8 slave_addr = i2c_8bit_addr_from_msg(msg); @@ -599,7 +753,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 #if IS_ENABLED(CONFIG_I2C_SLAVE) /* -@@ -400,12 +471,66 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) +@@ -368,12 +439,66 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) if (msg->flags & I2C_M_RD) { command |= ASPEED_I2CD_M_RX_CMD; @@ -670,7 +824,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 writel(command, bus->base + ASPEED_I2C_CMD_REG); } -@@ -445,7 +570,7 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -413,7 +538,7 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) u32 irq_handled = 0, command = 0; struct i2c_msg *msg; u8 recv_byte; @@ -679,7 +833,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 if (irq_status & ASPEED_I2CD_INTR_BUS_RECOVER_DONE) { bus->master_state = ASPEED_I2C_MASTER_INACTIVE; -@@ -558,11 +683,43 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -526,11 +651,43 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) /* fall through */ case ASPEED_I2C_MASTER_TX_FIRST: if (bus->buf_index < msg->len) { @@ -727,7 +881,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 } else { aspeed_i2c_next_msg_or_stop(bus); } -@@ -579,25 +736,56 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -547,25 +704,56 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) } irq_handled |= ASPEED_I2CD_INTR_RX_DONE; @@ -798,7 +952,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 writel(command, bus->base + ASPEED_I2C_CMD_REG); } else { aspeed_i2c_next_msg_or_stop(bus); -@@ -947,6 +1135,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, +@@ -911,6 +1099,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, if (ret < 0) return ret; @@ -808,7 +962,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 if (of_property_read_bool(pdev->dev.of_node, "multi-master")) bus->multi_master = true; else -@@ -1007,16 +1198,15 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -972,16 +1163,15 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) { const struct of_device_id *match; struct aspeed_i2c_bus *bus; @@ -827,7 +981,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 if (IS_ERR(bus->base)) return PTR_ERR(bus->base); -@@ -1050,6 +1240,42 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -1015,6 +1205,42 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) bus->get_clk_reg_val = (u32 (*)(struct device *, u32)) match->data; @@ -852,10 +1006,10 @@ index d8143c24d3a7..b721fb1d6d4c 100644 + struct resource *res = platform_get_resource(pdev, + IORESOURCE_MEM, 1); + -+ bus->buf_base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(bus->buf_base) || resource_size(res) < 2) { -+ bus->buf_base = NULL; -+ } else { ++ if (res) ++ bus->buf_base = devm_ioremap_resource(&pdev->dev, res); ++ ++ if (!IS_ERR_OR_NULL(bus->buf_base) && resource_size(res) >= 2) { + bus->buf_size = resource_size(res); + if (of_device_is_compatible(pdev->dev.of_node, + "aspeed,ast2400-i2c-bus")) { @@ -870,7 +1024,7 @@ index d8143c24d3a7..b721fb1d6d4c 100644 /* Initialize the I2C adapter */ spin_lock_init(&bus->lock); init_completion(&bus->cmd_complete); -@@ -1085,8 +1311,8 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -1050,8 +1276,8 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) platform_set_drvdata(pdev, bus); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0067-i2c-aspeed-add-DMA-mode-transfer-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0062-i2c-aspeed-add-DMA-mode-transfer-support.patch index a051dbc4d..f3021d410 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0067-i2c-aspeed-add-DMA-mode-transfer-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0062-i2c-aspeed-add-DMA-mode-transfer-support.patch @@ -1,4 +1,4 @@ -From 7defe387ea07af3d48feb4daec78d54a284105f1 Mon Sep 17 00:00:00 2001 +From 09aece99e18a0fd0612c865394424afa74050171 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Tue, 18 Jun 2019 08:47:50 -0700 Subject: [PATCH] i2c: aspeed: add DMA mode transfer support @@ -20,14 +20,14 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 2 files changed, 241 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt -index e1a0ae7a8c08..97142516399a 100644 +index 0ff3539cee95..d3f4a39f7ba6 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt -@@ -19,6 +19,16 @@ Optional Properties: - - bus-frequency : frequency of the bus clock in Hz defaults to 100 kHz when not - specified - - multi-master : states that there is another master active on this bus. -+- aspeed,dma-buf-size : size of DMA buffer (from 2 to 4095 in case of AST2500). +@@ -22,6 +22,16 @@ Optional Properties: + - bus-timeout-ms: bus timeout in milliseconds defaults to 1 second when not + specified. + - #retries : Number of retries for master transfer. ++- aspeed,dma-buf-size : size of DMA buffer (from 2 to 4095 in case of AST2500) + Only AST2500 supports DMA mode under some limitations: + I2C is sharing the DMA H/W with UHCI host controller + and MCTP controller. Since those controllers operate @@ -37,10 +37,10 @@ index e1a0ae7a8c08..97142516399a 100644 + DMA mode instead of PIO or FIFO respectively, I2C + can't use DMA mode. IF both DMA and buffer modes are + enabled, DMA mode will be selected. - - general-call : enables general call receiving. - - bus-timeout-ms: bus timeout in milliseconds defaults to 1 second when not - specified. -@@ -75,4 +85,19 @@ i2c { + + Example: + +@@ -74,4 +84,19 @@ i2c { interrupts = <1>; interrupt-parent = <&i2c_ic>; }; @@ -61,7 +61,7 @@ index e1a0ae7a8c08..97142516399a 100644 + }; }; diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index b721fb1d6d4c..127bc69952ca 100644 +index e37f0764d184..4567ec3498dc 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -10,6 +10,8 @@ @@ -82,7 +82,7 @@ index b721fb1d6d4c..127bc69952ca 100644 /* Device Register Definition */ /* 0x00 : I2CD Function Control Register */ -@@ -112,6 +116,8 @@ +@@ -110,6 +114,8 @@ #define ASPEED_I2CD_BUS_RECOVER_CMD BIT(11) /* Command Bit */ @@ -91,7 +91,7 @@ index b721fb1d6d4c..127bc69952ca 100644 #define ASPEED_I2CD_RX_BUFF_ENABLE BIT(7) #define ASPEED_I2CD_TX_BUFF_ENABLE BIT(6) #define ASPEED_I2CD_M_STOP_CMD BIT(5) -@@ -131,6 +137,14 @@ +@@ -129,6 +135,14 @@ #define ASPEED_I2CD_BUF_TX_COUNT_MASK GENMASK(15, 8) #define ASPEED_I2CD_BUF_OFFSET_MASK GENMASK(5, 0) @@ -106,7 +106,7 @@ index b721fb1d6d4c..127bc69952ca 100644 enum aspeed_i2c_master_state { ASPEED_I2C_MASTER_INACTIVE, ASPEED_I2C_MASTER_PENDING, -@@ -183,6 +197,12 @@ struct aspeed_i2c_bus { +@@ -179,6 +193,12 @@ struct aspeed_i2c_bus { size_t buf_size; u8 buf_offset; u8 buf_page; @@ -119,7 +119,7 @@ index b721fb1d6d4c..127bc69952ca 100644 #if IS_ENABLED(CONFIG_I2C_SLAVE) struct i2c_client *slave; enum aspeed_i2c_slave_state slave_state; -@@ -310,9 +330,13 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -298,9 +318,13 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) /* Slave was sent something. */ if (irq_status & ASPEED_I2CD_INTR_RX_DONE) { @@ -134,7 +134,7 @@ index b721fb1d6d4c..127bc69952ca 100644 value = readb(bus->buf_base); else value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8; -@@ -347,7 +371,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -320,7 +344,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP) { if (bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED && irq_status & ASPEED_I2CD_INTR_RX_DONE) { @@ -154,7 +154,7 @@ index b721fb1d6d4c..127bc69952ca 100644 len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, readl(bus->base + ASPEED_I2C_BUF_CTRL_REG)); -@@ -391,7 +426,15 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -364,7 +399,15 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) case ASPEED_I2C_SLAVE_WRITE_REQUESTED: bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); @@ -171,7 +171,7 @@ index b721fb1d6d4c..127bc69952ca 100644 writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK, bus->buf_size - 1) | FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK, -@@ -403,7 +446,25 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -376,7 +419,25 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) break; case ASPEED_I2C_SLAVE_WRITE_RECEIVED: i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value); @@ -198,7 +198,7 @@ index b721fb1d6d4c..127bc69952ca 100644 len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, readl(bus->base + ASPEED_I2C_BUF_CTRL_REG)); -@@ -472,7 +533,23 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) +@@ -440,7 +501,23 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) if (msg->flags & I2C_M_RD) { command |= ASPEED_I2CD_M_RX_CMD; @@ -223,7 +223,7 @@ index b721fb1d6d4c..127bc69952ca 100644 command |= ASPEED_I2CD_RX_BUFF_ENABLE; if (msg->len > bus->buf_size) { -@@ -493,7 +570,26 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) +@@ -461,7 +538,26 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) command |= ASPEED_I2CD_M_S_RX_CMD_LAST; } } else { @@ -251,7 +251,7 @@ index b721fb1d6d4c..127bc69952ca 100644 int i; command |= ASPEED_I2CD_TX_BUFF_ENABLE; -@@ -529,7 +625,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) +@@ -497,7 +593,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) } } @@ -261,7 +261,7 @@ index b721fb1d6d4c..127bc69952ca 100644 writel(slave_addr, bus->base + ASPEED_I2C_BYTE_BUF_REG); writel(command, bus->base + ASPEED_I2C_CMD_REG); } -@@ -685,7 +782,28 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -653,7 +750,28 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) if (bus->buf_index < msg->len) { command = ASPEED_I2CD_M_TX_CMD; @@ -291,7 +291,7 @@ index b721fb1d6d4c..127bc69952ca 100644 u8 wbuf[4]; int i; -@@ -736,7 +854,15 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -704,7 +822,15 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) } irq_handled |= ASPEED_I2CD_INTR_RX_DONE; @@ -308,7 +308,7 @@ index b721fb1d6d4c..127bc69952ca 100644 len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK, readl(bus->base + ASPEED_I2C_BUF_CTRL_REG)); -@@ -764,7 +890,25 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -732,7 +858,25 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) if (bus->buf_index < msg->len) { command = ASPEED_I2CD_M_RX_CMD; bus->master_state = ASPEED_I2C_MASTER_RX; @@ -335,7 +335,7 @@ index b721fb1d6d4c..127bc69952ca 100644 command |= ASPEED_I2CD_RX_BUFF_ENABLE; if (msg->len - bus->buf_index > -@@ -1257,7 +1401,51 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -1222,7 +1366,51 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) sram_enabled = false; } @@ -388,7 +388,7 @@ index b721fb1d6d4c..127bc69952ca 100644 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 1); -@@ -1297,24 +1485,33 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) +@@ -1262,24 +1450,33 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) */ ret = aspeed_i2c_init(bus, pdev); if (ret < 0) @@ -426,7 +426,7 @@ index b721fb1d6d4c..127bc69952ca 100644 } static int aspeed_i2c_remove_bus(struct platform_device *pdev) -@@ -1332,6 +1529,10 @@ static int aspeed_i2c_remove_bus(struct platform_device *pdev) +@@ -1297,6 +1494,10 @@ static int aspeed_i2c_remove_bus(struct platform_device *pdev) reset_control_assert(bus->rst); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0058-i2c-aspeed-add-general-call-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0063-i2c-aspeed-add-general-call-support.patch index 7d5e006d1..381197a64 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0058-i2c-aspeed-add-general-call-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0063-i2c-aspeed-add-general-call-support.patch @@ -1,4 +1,4 @@ -From f5b6d42c1710a4c1314bc0160f904aa01f501e96 Mon Sep 17 00:00:00 2001 +From f9f2e586985f90197b30208599bd37a9fd7a7f63 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Wed, 1 May 2019 13:27:34 -0700 Subject: [PATCH] i2c: aspeed: add general call support @@ -16,10 +16,10 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt -index 7da7e813b2b0..724ee9f35c10 100644 +index d3f4a39f7ba6..c1ee99398517 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt -@@ -16,6 +16,7 @@ Optional Properties: +@@ -19,6 +19,7 @@ Optional Properties: - bus-frequency : frequency of the bus clock in Hz defaults to 100 kHz when not specified - multi-master : states that there is another master active on this bus. @@ -28,10 +28,10 @@ index 7da7e813b2b0..724ee9f35c10 100644 specified. - #retries : Number of retries for master transfer. diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 99bd30953531..8f26060bd685 100644 +index 4567ec3498dc..3e72068f6a2b 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -47,6 +47,7 @@ +@@ -59,6 +59,7 @@ #define ASPEED_I2CD_SDA_DRIVE_1T_EN BIT(8) #define ASPEED_I2CD_M_SDA_DRIVE_1T_EN BIT(7) #define ASPEED_I2CD_M_HIGH_SPEED_EN BIT(6) @@ -39,7 +39,7 @@ index 99bd30953531..8f26060bd685 100644 #define ASPEED_I2CD_SLAVE_EN BIT(1) #define ASPEED_I2CD_MASTER_EN BIT(0) -@@ -71,6 +72,7 @@ +@@ -83,6 +84,7 @@ */ #define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14) #define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13) @@ -47,7 +47,7 @@ index 99bd30953531..8f26060bd685 100644 #define ASPEED_I2CD_INTR_SLAVE_MATCH BIT(7) #define ASPEED_I2CD_INTR_SCL_TIMEOUT BIT(6) #define ASPEED_I2CD_INTR_ABNORMAL BIT(5) -@@ -130,6 +132,8 @@ enum aspeed_i2c_slave_state { +@@ -161,6 +163,8 @@ enum aspeed_i2c_slave_state { ASPEED_I2C_SLAVE_READ_PROCESSED, ASPEED_I2C_SLAVE_WRITE_REQUESTED, ASPEED_I2C_SLAVE_WRITE_RECEIVED, @@ -56,7 +56,7 @@ index 99bd30953531..8f26060bd685 100644 ASPEED_I2C_SLAVE_STOP, }; -@@ -160,6 +164,8 @@ struct aspeed_i2c_bus { +@@ -202,6 +206,8 @@ struct aspeed_i2c_bus { #if IS_ENABLED(CONFIG_I2C_SLAVE) struct i2c_client *slave; enum aspeed_i2c_slave_state slave_state; @@ -65,7 +65,7 @@ index 99bd30953531..8f26060bd685 100644 #endif /* CONFIG_I2C_SLAVE */ }; -@@ -266,6 +272,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -309,6 +315,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) bus->slave_state = ASPEED_I2C_SLAVE_START; } @@ -78,7 +78,7 @@ index 99bd30953531..8f26060bd685 100644 /* Slave is not currently active, irq was for someone else. */ if (bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE) return irq_handled; -@@ -284,6 +296,21 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -336,6 +348,21 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) else bus->slave_state = ASPEED_I2C_SLAVE_WRITE_REQUESTED; @@ -100,9 +100,9 @@ index 99bd30953531..8f26060bd685 100644 } irq_handled |= ASPEED_I2CD_INTR_RX_DONE; } -@@ -326,11 +353,16 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - case ASPEED_I2C_SLAVE_WRITE_RECEIVED: - i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value); +@@ -456,11 +483,16 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) + bus->base + ASPEED_I2C_CMD_REG); + } break; + case ASPEED_I2C_SLAVE_GCALL_REQUESTED: + bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; @@ -117,7 +117,7 @@ index 99bd30953531..8f26060bd685 100644 /* Slave was just started. Waiting for the next event. */; break; default: -@@ -738,6 +770,8 @@ static void __aspeed_i2c_reg_slave(struct aspeed_i2c_bus *bus, u16 slave_addr) +@@ -1071,6 +1103,8 @@ static void __aspeed_i2c_reg_slave(struct aspeed_i2c_bus *bus, u16 slave_addr) /* Turn on slave mode. */ func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG); func_ctrl_reg_val |= ASPEED_I2CD_SLAVE_EN; @@ -126,7 +126,7 @@ index 99bd30953531..8f26060bd685 100644 writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG); } -@@ -776,6 +810,8 @@ static int aspeed_i2c_unreg_slave(struct i2c_client *client) +@@ -1109,6 +1143,8 @@ static int aspeed_i2c_unreg_slave(struct i2c_client *client) /* Turn off slave mode. */ func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG); func_ctrl_reg_val &= ~ASPEED_I2CD_SLAVE_EN; @@ -135,7 +135,7 @@ index 99bd30953531..8f26060bd685 100644 writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG); bus->slave = NULL; -@@ -920,6 +956,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, +@@ -1256,6 +1292,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, bus->base + ASPEED_I2C_FUN_CTRL_REG); #if IS_ENABLED(CONFIG_I2C_SLAVE) @@ -164,10 +164,10 @@ index 2c7a6038409c..1d4db584b393 100644 case I2C_SLAVE_WRITE_RECEIVED: diff --git a/include/linux/i2c.h b/include/linux/i2c.h -index 3ee92c6a442d..dfdccb2acb24 100644 +index 92c795ce9081..1e5c74888160 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h -@@ -359,6 +359,7 @@ enum i2c_slave_event { +@@ -365,6 +365,7 @@ enum i2c_slave_event { I2C_SLAVE_WRITE_REQUESTED, I2C_SLAVE_READ_PROCESSED, I2C_SLAVE_WRITE_RECEIVED, diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-set-idle-disconnect-to-true-in-all-cases.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0064-set-idle-disconnect-to-true-in-all-cases.patch index 925880eff..925880eff 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-set-idle-disconnect-to-true-in-all-cases.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0064-set-idle-disconnect-to-true-in-all-cases.patch diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0065-i2c-aspeed-fix-master-pending-state-handling.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0065-i2c-aspeed-fix-master-pending-state-handling.patch deleted file mode 100644 index 003a96c8d..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0065-i2c-aspeed-fix-master-pending-state-handling.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 4a05d2506e7cb7fb3ad323a16861f09279b4da39 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> -Date: Tue, 11 Jun 2019 14:59:53 -0700 -Subject: [PATCH] i2c: aspeed: fix master pending state handling - -In case of a master pending state, it should not trigger the master -command because this H/W is sharing the same byte buffer for slave -and master operation, so this commit fixes the issue with making -the master command triggering happens when the state goes to active -state. - -Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> ---- - drivers/i2c/busses/i2c-aspeed.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 8f26060bd685..d8143c24d3a7 100644 ---- a/drivers/i2c/busses/i2c-aspeed.c -+++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -383,18 +383,19 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) - struct i2c_msg *msg = &bus->msgs[bus->msgs_index]; - u8 slave_addr = i2c_8bit_addr_from_msg(msg); - -- bus->master_state = ASPEED_I2C_MASTER_START; -- - #if IS_ENABLED(CONFIG_I2C_SLAVE) - /* - * If it's requested in the middle of a slave session, set the master - * state to 'pending' then H/W will continue handling this master - * command when the bus comes back to the idle state. - */ -- if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) -+ if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) { - bus->master_state = ASPEED_I2C_MASTER_PENDING; -+ return; -+ } - #endif /* CONFIG_I2C_SLAVE */ - -+ bus->master_state = ASPEED_I2C_MASTER_START; - bus->buf_index = 0; - - if (msg->flags & I2C_M_RD) { -@@ -479,7 +480,7 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) - if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) - goto out_no_complete; - -- bus->master_state = ASPEED_I2C_MASTER_START; -+ aspeed_i2c_do_start(bus); - } - #endif /* CONFIG_I2C_SLAVE */ - --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch index f4dfd6cfa..ba564e695 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch @@ -1,4 +1,4 @@ -From 9a43b47fb794fd195912c6956783b021a46307f8 Mon Sep 17 00:00:00 2001 +From 25a38287274f9c39eb8355d51ba06203efdb07aa Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Thu, 11 Jul 2019 13:53:34 -0700 Subject: [PATCH] i2c: aspeed: add H/W timeout support @@ -7,14 +7,22 @@ This commit adds I2C H/W timeout support. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> --- - drivers/i2c/busses/i2c-aspeed.c | 79 +++++++++++++++++++++++++++++++++++++---- - 1 file changed, 73 insertions(+), 6 deletions(-) + drivers/i2c/busses/i2c-aspeed.c | 82 ++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 76 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index 0ed9a27850e6..ecb5793036cc 100644 +index 127bc69952ca..542b0f4017eb 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -71,10 +71,14 @@ +@@ -55,6 +55,7 @@ + /* Device Register Definition */ + /* 0x00 : I2CD Function Control Register */ + #define ASPEED_I2CD_BUFFER_PAGE_SEL_MASK GENMASK(22, 20) ++#define ASPEED_I2CD_BUS_AUTO_RECOVERY_EN BIT(17) + #define ASPEED_I2CD_MULTI_MASTER_DIS BIT(15) + #define ASPEED_I2CD_SDA_DRIVE_1T_EN BIT(8) + #define ASPEED_I2CD_M_SDA_DRIVE_1T_EN BIT(7) +@@ -71,10 +72,14 @@ #define ASPEED_I2CD_TIME_SCL_HIGH_MASK GENMASK(19, 16) #define ASPEED_I2CD_TIME_SCL_LOW_SHIFT 12 #define ASPEED_I2CD_TIME_SCL_LOW_MASK GENMASK(15, 12) @@ -30,7 +38,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 /* 0x0c : I2CD Interrupt Control Register & * 0x10 : I2CD Interrupt Status Register -@@ -82,6 +86,7 @@ +@@ -82,6 +87,7 @@ * These share bit definitions, so use the same values for the enable & * status bits. */ @@ -38,7 +46,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 #define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14) #define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13) #define ASPEED_I2CD_INTR_GCALL_ADDR BIT(8) -@@ -98,8 +103,11 @@ +@@ -98,8 +104,11 @@ ASPEED_I2CD_INTR_SCL_TIMEOUT | \ ASPEED_I2CD_INTR_ABNORMAL | \ ASPEED_I2CD_INTR_ARBIT_LOSS) @@ -51,7 +59,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 ASPEED_I2CD_INTR_BUS_RECOVER_DONE | \ ASPEED_I2CD_INTR_SCL_TIMEOUT | \ ASPEED_I2CD_INTR_ABNORMAL | \ -@@ -180,6 +188,7 @@ struct aspeed_i2c_bus { +@@ -180,6 +189,7 @@ struct aspeed_i2c_bus { u32 divisor); unsigned long parent_clk_frequency; u32 bus_frequency; @@ -59,7 +67,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 /* Transaction state. */ enum aspeed_i2c_master_state master_state; struct i2c_msg *msgs; -@@ -297,6 +306,14 @@ static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus) +@@ -297,6 +307,14 @@ static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus) } #if IS_ENABLED(CONFIG_I2C_SLAVE) @@ -74,7 +82,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) { u32 command, irq_handled = 0; -@@ -307,6 +324,14 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -307,6 +325,14 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) if (!slave) return 0; @@ -89,7 +97,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 command = readl(bus->base + ASPEED_I2C_CMD_REG); /* Slave was requested, restart state machine. */ -@@ -649,7 +674,7 @@ static void aspeed_i2c_next_msg_or_stop(struct aspeed_i2c_bus *bus) +@@ -649,7 +675,7 @@ static void aspeed_i2c_next_msg_or_stop(struct aspeed_i2c_bus *bus) } } @@ -98,7 +106,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 { if (irq_status & ASPEED_I2CD_INTR_ARBIT_LOSS) return -EAGAIN; -@@ -680,9 +705,9 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -680,9 +706,9 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) * should clear the command queue effectively taking us back to the * INACTIVE state. */ @@ -110,7 +118,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 irq_status); irq_handled |= (irq_status & ASPEED_I2CD_INTR_MASTER_ERRORS); if (bus->master_state != ASPEED_I2C_MASTER_INACTIVE) { -@@ -1251,6 +1276,7 @@ static u32 aspeed_i2c_25xx_get_clk_reg_val(struct device *dev, u32 divisor) +@@ -1251,6 +1277,7 @@ static u32 aspeed_i2c_25xx_get_clk_reg_val(struct device *dev, u32 divisor) /* precondition: bus.lock has been acquired. */ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus) { @@ -118,7 +126,7 @@ index 0ed9a27850e6..ecb5793036cc 100644 u32 divisor, clk_reg_val; divisor = DIV_ROUND_UP(bus->parent_clk_frequency, bus->bus_frequency); -@@ -1259,8 +1285,46 @@ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus) +@@ -1259,8 +1286,46 @@ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus) ASPEED_I2CD_TIME_THDSTA_MASK | ASPEED_I2CD_TIME_TACST_MASK); clk_reg_val |= bus->get_clk_reg_val(bus->dev, divisor); @@ -166,16 +174,18 @@ index 0ed9a27850e6..ecb5793036cc 100644 return 0; } -@@ -1464,6 +1528,9 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) - } - } +@@ -1275,6 +1340,11 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, + /* Disable everything. */ + writel(0, bus->base + ASPEED_I2C_FUN_CTRL_REG); + device_property_read_u32(&pdev->dev, "aspeed,hw-timeout-ms", + &bus->hw_timeout_ms); ++ if (bus->hw_timeout_ms) ++ fun_ctrl_reg |= ASPEED_I2CD_BUS_AUTO_RECOVERY_EN; + - /* Initialize the I2C adapter */ - spin_lock_init(&bus->lock); - init_completion(&bus->cmd_complete); + ret = aspeed_i2c_init_clk(bus); + if (ret < 0) + return ret; -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch index dc38c81f3..8fc35243c 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch @@ -1,4 +1,4 @@ -From 085bde1e91d85435c44a752bd59d38cf31465518 Mon Sep 17 00:00:00 2001 +From 6ffb52e1f1d80fd3116fccef045bcdc78d2d361c Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Thu, 11 Jul 2019 14:04:39 -0700 Subject: [PATCH] i2c: aspeed: add SLAVE_ADDR_RECEIVED_PENDING interrupt @@ -15,10 +15,10 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 1 file changed, 13 insertions(+) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c -index d41f377de9dc..46de9a01a0eb 100644 +index bcc354d11e29..0070366e9d6d 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c -@@ -86,6 +86,7 @@ +@@ -87,6 +87,7 @@ * These share bit definitions, so use the same values for the enable & * status bits. */ @@ -26,7 +26,7 @@ index d41f377de9dc..46de9a01a0eb 100644 #define ASPEED_I2CD_INTR_SLAVE_INACTIVE_TIMEOUT BIT(15) #define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14) #define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13) -@@ -353,6 +354,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) +@@ -354,6 +355,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) dev_dbg(bus->dev, "slave irq status 0x%08x, cmd 0x%08x\n", irq_status, command); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0070-gpio-aspeed-temporary-fix-for-gpiochip-range-setting.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0070-gpio-aspeed-temporary-fix-for-gpiochip-range-setting.patch index 4af5be95d..bcee8bc6c 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0070-gpio-aspeed-temporary-fix-for-gpiochip-range-setting.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0070-gpio-aspeed-temporary-fix-for-gpiochip-range-setting.patch @@ -1,4 +1,4 @@ -From 9195eef3fec7022ca52ac9791c19de2362ed042e Mon Sep 17 00:00:00 2001 +From 89e1d083726d4d56703a6787f4707d61a2c0efd1 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Fri, 19 Jul 2019 12:54:38 -0700 Subject: [PATCH] gpio: aspeed: temporary fix for gpiochip range setting @@ -14,31 +14,31 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c -index e426452a28f7..d4aaf7fa8e4b 100644 +index ac33f8134fe6..4f1a40b3a73f 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c -@@ -1189,7 +1189,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) +@@ -1181,7 +1181,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) gpio->chip.set = aspeed_gpio_set; gpio->chip.set_config = aspeed_gpio_set_config; gpio->chip.label = dev_name(&pdev->dev); - gpio->chip.base = -1; + gpio->chip.base = 0; - gpio->chip.irq.need_valid_mask = true; /* Allocate a cache of the output registers */ + banks = DIV_ROUND_UP(gpio->chip.ngpio, 32); diff --git a/drivers/gpio/sgpio-aspeed.c b/drivers/gpio/sgpio-aspeed.c -index 6fb402a3f74d..2f4c0aab0bf2 100644 +index d2dbfce531a4..792ef0d70ecf 100644 --- a/drivers/gpio/sgpio-aspeed.c +++ b/drivers/gpio/sgpio-aspeed.c -@@ -675,7 +675,7 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev) +@@ -678,7 +678,7 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev) gpio->chip.set = aspeed_sgpio_set; gpio->chip.set_config = aspeed_sgpio_set_config; gpio->chip.label = dev_name(&pdev->dev); - gpio->chip.base = -1; + gpio->chip.base = gpio->config->nr_pgpios; - gpio->chip.irq.need_valid_mask = true; - /* Allocate a cache of the output registers */ + rc = aspeed_sgpio_setup_irqs(gpio, pdev); + if (rc < 0) -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch deleted file mode 100644 index e32ec54ac..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 3394fabbd17ad7263feeb0f4ae593056237f0647 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> -Date: Tue, 30 Jul 2019 13:01:58 -0700 -Subject: [PATCH] peci: add a temporary workaround - -To cover a PECI issue, this commit makes PECI driver block all PECI -commands when PLTRST_N signal is 0. - -Also, it adds 'use_wa' module parameter for platforms that don't have -the PLTRST_N gpio input so that the WA can be disabled through the -module parameter. - -This is a temporary workaround. - -Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> ---- - drivers/peci/busses/peci-aspeed.c | 11 +++++++++++ - drivers/peci/peci-core.c | 11 +++++++++++ - include/linux/peci.h | 1 + - 3 files changed, 23 insertions(+) - -diff --git a/drivers/peci/busses/peci-aspeed.c b/drivers/peci/busses/peci-aspeed.c -index 8a0dd40730cc..76394ab32854 100644 ---- a/drivers/peci/busses/peci-aspeed.c -+++ b/drivers/peci/busses/peci-aspeed.c -@@ -10,6 +10,7 @@ - #include <linux/jiffies.h> - #include <linux/module.h> - #include <linux/of.h> -+#include <linux/of_gpio.h> - #include <linux/peci.h> - #include <linux/platform_device.h> - #include <linux/reset.h> -@@ -445,6 +446,16 @@ static int aspeed_peci_probe(struct platform_device *pdev) - if (ret) - goto err_put_adapter_dev; - -+ priv->adapter->pltrst_pin = of_get_gpio(pdev->dev.of_node, 0); -+ if (gpio_is_valid(priv->adapter->pltrst_pin)) { -+ ret = devm_gpio_request(&pdev->dev, priv->adapter->pltrst_pin, -+ "peci-aspeed"); -+ if (ret < 0) { -+ priv->adapter->pltrst_pin = -1; -+ dev_err(&pdev->dev, "error requesting pltrst gpio\n"); -+ } -+ } -+ - ret = peci_add_adapter(priv->adapter); - if (ret) - goto err_put_adapter_dev; -diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c -index b99ba788a032..2e3b9a0c83e9 100644 ---- a/drivers/peci/peci-core.c -+++ b/drivers/peci/peci-core.c -@@ -5,6 +5,7 @@ - #include <linux/crc8.h> - #include <linux/delay.h> - #include <linux/mm.h> -+#include <linux/gpio.h> - #include <linux/module.h> - #include <linux/of_device.h> - #include <linux/peci.h> -@@ -190,6 +191,11 @@ static int peci_aw_fcs(struct peci_xfer_msg *msg, int len, u8 *aw_fcs) - return 0; - } - -+/* Temporary WA */ -+static bool use_wa __read_mostly = true; -+module_param_named(use_wa, use_wa, bool, 0644); -+MODULE_PARM_DESC(use_wa, "flag for enabling of WA"); -+ - static int __peci_xfer(struct peci_adapter *adapter, struct peci_xfer_msg *msg, - bool do_retry, bool has_aw_fcs) - { -@@ -197,6 +203,11 @@ static int __peci_xfer(struct peci_adapter *adapter, struct peci_xfer_msg *msg, - u8 aw_fcs; - int ret; - -+ /* Temporary WA */ -+ if (use_wa && gpio_is_valid(adapter->pltrst_pin) && -+ gpio_get_value(adapter->pltrst_pin) == 0) -+ return -EAGAIN; -+ - /* - * In case if adapter uses DMA, check at here whether tx and rx buffers - * are DMA capable or not. -diff --git a/include/linux/peci.h b/include/linux/peci.h -index 6fc424dc2a73..e589cb258a2a 100644 ---- a/include/linux/peci.h -+++ b/include/linux/peci.h -@@ -44,6 +44,7 @@ struct peci_adapter { - struct peci_xfer_msg *msg); - u32 cmd_mask; - bool use_dma; -+ int pltrst_pin; - }; - - static inline struct peci_adapter *to_peci_adapter(void *d) --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0073-Add-IO-statistics-to-USB-Mass-storage-gadget.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0073-Add-IO-statistics-to-USB-Mass-storage-gadget.patch new file mode 100644 index 000000000..41969349e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0073-Add-IO-statistics-to-USB-Mass-storage-gadget.patch @@ -0,0 +1,155 @@ +From 5c82e0b33f2a373d5e19569635f108cfa096f53e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Adrian=20Ambro=C5=BCewicz?= <adrian.ambrozewicz@intel.com> +Date: Mon, 29 Jul 2019 10:19:00 +0200 +Subject: [PATCH] Add IO stats to USB Mass Storage gadget +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Introduces new attribute to Mass Storage Gadget ConfigFS : stats. +It's read-only attribute which contains statistics of read/write operations +based on LUN transaction counters (IO number and bytes transferred). + +Goal is to provide a way to observe whether simulated device is actually +used by host. Statistics on hosted file / nbd level are not always viable +due to page cache having severe impact on actual IO statistics. +This attribute should provide information about host IO on USB Gadget as +close to endpoint as possible. + +Attribute is tied completely to configFS implementation and it's lifecycle +is managed by Kernel and user. Driver implements a handler which populates +output buffer on read. + +Tests performed: +- mounted USB Mass Storage gadget, new attribute showed up in gadget tree +- attribute was monitored for changes during IO performed on host machine +- removed device, attribute (along with other device attributes) was gone + +Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@intel.com> +--- + drivers/usb/gadget/function/f_mass_storage.c | 12 ++++++++++++ + drivers/usb/gadget/function/storage_common.c | 9 +++++++++ + drivers/usb/gadget/function/storage_common.h | 29 ++++++++++++++++++++++++++++ + 3 files changed, 50 insertions(+) + +diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c +index 7c96c4665178..ecc3c68a7882 100644 +--- a/drivers/usb/gadget/function/f_mass_storage.c ++++ b/drivers/usb/gadget/function/f_mass_storage.c +@@ -710,6 +710,8 @@ static int do_read(struct fsg_common *common) + amount_left -= nread; + common->residue -= nread; + ++ fsg_stats_rd_attempt(&curlun->stats, nread); ++ + /* + * Except at the end of the transfer, nread will be + * equal to the buffer size, which is divisible by the +@@ -907,6 +909,8 @@ static int do_write(struct fsg_common *common) + amount_left_to_write -= nwritten; + common->residue -= nwritten; + ++ fsg_stats_wr_attempt(&curlun->stats, nwritten); ++ + /* If an error occurred, report it and its position */ + if (nwritten < amount) { + curlun->sense_data = SS_WRITE_ERROR; +@@ -3122,6 +3126,13 @@ static ssize_t fsg_lun_opts_inquiry_string_store(struct config_item *item, + + CONFIGFS_ATTR(fsg_lun_opts_, inquiry_string); + ++static ssize_t fsg_lun_opts_stats_show(struct config_item *item, char *page) ++{ ++ return fsg_show_stats(to_fsg_lun_opts(item)->lun, page); ++} ++ ++CONFIGFS_ATTR_RO(fsg_lun_opts_, stats); ++ + static struct configfs_attribute *fsg_lun_attrs[] = { + &fsg_lun_opts_attr_file, + &fsg_lun_opts_attr_ro, +@@ -3129,6 +3140,7 @@ static struct configfs_attribute *fsg_lun_attrs[] = { + &fsg_lun_opts_attr_cdrom, + &fsg_lun_opts_attr_nofua, + &fsg_lun_opts_attr_inquiry_string, ++ &fsg_lun_opts_attr_stats, + NULL, + }; + +diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c +index f7e6c42558eb..2325b97961df 100644 +--- a/drivers/usb/gadget/function/storage_common.c ++++ b/drivers/usb/gadget/function/storage_common.c +@@ -371,6 +371,15 @@ ssize_t fsg_show_inquiry_string(struct fsg_lun *curlun, char *buf) + } + EXPORT_SYMBOL_GPL(fsg_show_inquiry_string); + ++ssize_t fsg_show_stats(struct fsg_lun *curlun, char *buf) ++{ ++ return sprintf(buf, "read cnt: %u\n" "read sum: %llu\n" ++ "write cnt: %u\n" "write sum: %llu\n", ++ curlun->stats.read.count, curlun->stats.read.bytes, ++ curlun->stats.write.count, curlun->stats.write.bytes); ++} ++EXPORT_SYMBOL_GPL(fsg_show_stats); ++ + /* + * The caller must hold fsg->filesem for reading when calling this function. + */ +diff --git a/drivers/usb/gadget/function/storage_common.h b/drivers/usb/gadget/function/storage_common.h +index e5e3a2553aaa..447021ba821a 100644 +--- a/drivers/usb/gadget/function/storage_common.h ++++ b/drivers/usb/gadget/function/storage_common.h +@@ -95,6 +95,32 @@ do { \ + */ + #define INQUIRY_STRING_LEN ((size_t) (8 + 16 + 4 + 1)) + ++struct fsg_stats_cnt { ++ u64 bytes; ++ u32 count; ++}; ++ ++struct fsg_stats { ++ struct fsg_stats_cnt read; ++ struct fsg_stats_cnt write; ++}; ++ ++static inline void fsg_stats_update(struct fsg_stats_cnt *cnt, u64 diff) ++{ ++ cnt->count++; ++ cnt->bytes += diff; ++} ++ ++static inline void fsg_stats_wr_attempt(struct fsg_stats *stats, u64 b_written) ++{ ++ fsg_stats_update(&stats->write, b_written); ++} ++ ++static inline void fsg_stats_rd_attempt(struct fsg_stats *stats, u64 b_read) ++{ ++ fsg_stats_update(&stats->read, b_read); ++} ++ + struct fsg_lun { + struct file *filp; + loff_t file_length; +@@ -120,6 +146,8 @@ struct fsg_lun { + const char *name; /* "lun.name" */ + const char **name_pfx; /* "function.name" */ + char inquiry_string[INQUIRY_STRING_LEN]; ++ ++ struct fsg_stats stats; + }; + + static inline bool fsg_lun_is_open(struct fsg_lun *curlun) +@@ -213,6 +241,7 @@ ssize_t fsg_show_file(struct fsg_lun *curlun, struct rw_semaphore *filesem, + ssize_t fsg_show_inquiry_string(struct fsg_lun *curlun, char *buf); + ssize_t fsg_show_cdrom(struct fsg_lun *curlun, char *buf); + ssize_t fsg_show_removable(struct fsg_lun *curlun, char *buf); ++ssize_t fsg_show_stats(struct fsg_lun *curlun, char *buf); + ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem, + const char *buf, size_t count); + ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count); +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch new file mode 100644 index 000000000..4118e366c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch @@ -0,0 +1,93 @@ +From 1032b062669b7ee041d2f5a9f4729953655efe61 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Date: Wed, 4 Sep 2019 14:52:40 -0700 +Subject: [PATCH] media: aspeed: refine HSYNC/VSYNC polarity setting logic + +Sometimes it detects weird resolutions such as 1024x287 when the +actual resolution is 1280x768. To resolve this issue, this commit +refines HSYNC/VSYNC polarity setting code for mode detection by +clearing the bits as normal polarity at the beginning of the first +mode detection like datasheet suggested, and refines polarity +setting logic so that the bits can be set or cleared properly. + +Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +--- + drivers/media/platform/aspeed-video.c | 45 ++++++++++++++++++----------------- + 1 file changed, 23 insertions(+), 22 deletions(-) + +diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c +index 4ef37cfc8446..455c6af81236 100644 +--- a/drivers/media/platform/aspeed-video.c ++++ b/drivers/media/platform/aspeed-video.c +@@ -614,7 +614,7 @@ static void aspeed_video_check_and_set_polarity(struct aspeed_video *video) + int i; + int hsync_counter = 0; + int vsync_counter = 0; +- u32 sts; ++ u32 sts, ctrl; + + for (i = 0; i < NUM_POLARITY_CHECKS; ++i) { + sts = aspeed_video_read(video, VE_MODE_DETECT_STATUS); +@@ -629,30 +629,29 @@ static void aspeed_video_check_and_set_polarity(struct aspeed_video *video) + hsync_counter++; + } + +- if (hsync_counter < 0 || vsync_counter < 0) { +- u32 ctrl = 0; ++ ctrl = aspeed_video_read(video, VE_CTRL); + +- if (hsync_counter < 0) { +- ctrl = VE_CTRL_HSYNC_POL; +- video->detected_timings.polarities &= +- ~V4L2_DV_HSYNC_POS_POL; +- } else { +- video->detected_timings.polarities |= +- V4L2_DV_HSYNC_POS_POL; +- } +- +- if (vsync_counter < 0) { +- ctrl = VE_CTRL_VSYNC_POL; +- video->detected_timings.polarities &= +- ~V4L2_DV_VSYNC_POS_POL; +- } else { +- video->detected_timings.polarities |= +- V4L2_DV_VSYNC_POS_POL; +- } ++ if (hsync_counter < 0) { ++ ctrl |= VE_CTRL_HSYNC_POL; ++ video->detected_timings.polarities &= ++ ~V4L2_DV_HSYNC_POS_POL; ++ } else { ++ ctrl &= ~VE_CTRL_HSYNC_POL; ++ video->detected_timings.polarities |= ++ V4L2_DV_HSYNC_POS_POL; ++ } + +- if (ctrl) +- aspeed_video_update(video, VE_CTRL, 0, ctrl); ++ if (vsync_counter < 0) { ++ ctrl |= VE_CTRL_VSYNC_POL; ++ video->detected_timings.polarities &= ++ ~V4L2_DV_VSYNC_POS_POL; ++ } else { ++ ctrl &= ~VE_CTRL_VSYNC_POL; ++ video->detected_timings.polarities |= ++ V4L2_DV_VSYNC_POS_POL; + } ++ ++ aspeed_video_write(video, VE_CTRL, ctrl); + } + + static bool aspeed_video_alloc_buf(struct aspeed_video *video, +@@ -741,6 +740,8 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) + } + + set_bit(VIDEO_RES_DETECT, &video->flags); ++ aspeed_video_update(video, VE_CTRL, ++ VE_CTRL_VSYNC_POL | VE_CTRL_HSYNC_POL, 0); + aspeed_video_enable_mode_detect(video); + + rc = wait_event_interruptible_timeout(video->wait, +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0075-Refine-initialization-flow-in-I2C-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0075-Refine-initialization-flow-in-I2C-driver.patch new file mode 100644 index 000000000..363f25368 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0075-Refine-initialization-flow-in-I2C-driver.patch @@ -0,0 +1,64 @@ +From a98e86429ce520cab3505c76ce02703837ef79b9 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Date: Mon, 23 Sep 2019 13:48:49 -0700 +Subject: [PATCH] Refine initialization flow in I2C driver + +Since we enabled I2C busses in u-boot, we need to disable the I2C +bus and clear all garbage interrupts when kernel probes the bus. +This commit refines the initialization flow by adding a bus reset +at the beginning of probe function and by moving bus init function +after interrupt handling setup. + +Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +--- + drivers/i2c/busses/i2c-aspeed.c | 20 +++++++++----------- + 1 file changed, 9 insertions(+), 11 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c +index 0070366e9d6d..ab771a57a252 100644 +--- a/drivers/i2c/busses/i2c-aspeed.c ++++ b/drivers/i2c/busses/i2c-aspeed.c +@@ -1441,6 +1441,11 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + if (IS_ERR(bus->base)) + return PTR_ERR(bus->base); + ++ /* Disable bus and clean up any left over interrupt state. */ ++ writel(0, bus->base + ASPEED_I2C_FUN_CTRL_REG); ++ writel(0, bus->base + ASPEED_I2C_INTR_CTRL_REG); ++ writel(0xffffffff, bus->base + ASPEED_I2C_INTR_STS_REG); ++ + parent_clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(parent_clk)) + return PTR_ERR(parent_clk); +@@ -1563,17 +1568,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + + bus->dev = &pdev->dev; + +- /* Clean up any left over interrupt state. */ +- writel(0, bus->base + ASPEED_I2C_INTR_CTRL_REG); +- writel(0xffffffff, bus->base + ASPEED_I2C_INTR_STS_REG); +- /* +- * bus.lock does not need to be held because the interrupt handler has +- * not been enabled yet. +- */ +- ret = aspeed_i2c_init(bus, pdev); +- if (ret < 0) +- goto out_free_dma_buf; +- + irq = irq_of_parse_and_map(pdev->dev.of_node, 0); + ret = devm_request_irq(&pdev->dev, irq, aspeed_i2c_bus_irq, + 0, dev_name(&pdev->dev), bus); +@@ -1586,6 +1580,10 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + + platform_set_drvdata(pdev, bus); + ++ ret = aspeed_i2c_init(bus, pdev); ++ if (ret < 0) ++ goto out_free_dma_buf; ++ + dev_info(bus->dev, "i2c bus %d registered (%s mode), irq %d\n", + bus->adap.nr, bus->dma_buf ? "dma" : + bus->buf_base ? "buffer" : "byte", +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0076-media-aspeed-clear-garbage-interrupts.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0076-media-aspeed-clear-garbage-interrupts.patch new file mode 100644 index 000000000..0cf9913fe --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0076-media-aspeed-clear-garbage-interrupts.patch @@ -0,0 +1,74 @@ +From 5f89fa4b6468771b5de6e73454bf0ea546249b7b Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Date: Thu, 26 Sep 2019 12:15:23 -0700 +Subject: [PATCH] media: aspeed: clear garbage interrupts + +CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even when these +are disabled in the VE_INTERRUPT_CTRL register and eventually this +behavior causes disabling irq itself like below: + +[10055.108784] irq 23: nobody cared (try booting with the "irqpoll" option) +[10055.115525] CPU: 0 PID: 331 Comm: swampd Tainted: G W 5.3.0-4fde000-dirty-d683e2e #1 +[10055.124565] Hardware name: Generic DT based system +[10055.129355] Backtrace: +[10055.131854] [<80107d7c>] (dump_backtrace) from [<80107fb0>] (show_stack+0x20/0x24) +[10055.139431] r7:00000017 r6:00000001 r5:00000000 r4:9d51dc00 +[10055.145120] [<80107f90>] (show_stack) from [<8074bf50>] (dump_stack+0x20/0x28) +[10055.152361] [<8074bf30>] (dump_stack) from [<80150ffc>] (__report_bad_irq+0x40/0xc0) +[10055.160109] [<80150fbc>] (__report_bad_irq) from [<80150f2c>] (note_interrupt+0x23c/0x294) +[10055.168374] r9:015b6e60 r8:00000000 r7:00000017 r6:00000001 r5:00000000 r4:9d51dc00 +[10055.176136] [<80150cf0>] (note_interrupt) from [<8014df1c>] (handle_irq_event_percpu+0x88/0x98) +[10055.184835] r10:7eff7910 r9:015b6e60 r8:00000000 r7:9d417600 r6:00000001 r5:00000002 +[10055.192657] r4:9d51dc00 r3:00000000 +[10055.196248] [<8014de94>] (handle_irq_event_percpu) from [<8014df64>] (handle_irq_event+0x38/0x4c) +[10055.205113] r5:80b56d50 r4:9d51dc00 +[10055.208697] [<8014df2c>] (handle_irq_event) from [<80151f1c>] (handle_level_irq+0xbc/0x12c) +[10055.217037] r5:80b56d50 r4:9d51dc00 +[10055.220623] [<80151e60>] (handle_level_irq) from [<8014d4b8>] (generic_handle_irq+0x30/0x44) +[10055.229052] r5:80b56d50 r4:00000017 +[10055.232648] [<8014d488>] (generic_handle_irq) from [<8014d524>] (__handle_domain_irq+0x58/0xb4) +[10055.241356] [<8014d4cc>] (__handle_domain_irq) from [<801021e4>] (avic_handle_irq+0x68/0x70) +[10055.249797] r9:015b6e60 r8:00c5387d r7:00c5387d r6:ffffffff r5:9dd33fb0 r4:9d402380 +[10055.257539] [<8010217c>] (avic_handle_irq) from [<80101e34>] (__irq_usr+0x54/0x80) +[10055.265105] Exception stack(0x9dd33fb0 to 0x9dd33ff8) +[10055.270152] 3fa0: 015d0530 00000000 00000000 015d0538 +[10055.278328] 3fc0: 015d0530 015b6e60 00000000 00000000 0052c5d0 015b6e60 7eff7910 7eff7918 +[10055.286496] 3fe0: 76ce5614 7eff7908 0050e2f4 76a3a08c 20000010 ffffffff +[10055.293104] r5:20000010 r4:76a3a08c +[10055.296673] handlers: +[10055.298967] [<79f218a5>] irq_default_primary_handler threaded [<1de88514>] aspeed_video_irq +[10055.307344] Disabling IRQ #23 + +To fix this issue, this commit makes the interrupt handler clear +these garbage interrupts. This driver enables and uses only +COMP_COMPLETE interrupt. + +Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +--- + drivers/media/platform/aspeed-video.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c +index 455c6af81236..0473f3141329 100644 +--- a/drivers/media/platform/aspeed-video.c ++++ b/drivers/media/platform/aspeed-video.c +@@ -606,6 +606,16 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg) + aspeed_video_start_frame(video); + } + ++ /* ++ * CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even when these ++ * are disabled in the VE_INTERRUPT_CTRL register so clear them to ++ * prevent unnecessary interrupt calls. ++ */ ++ if (sts & VE_INTERRUPT_CAPTURE_COMPLETE) ++ sts &= ~VE_INTERRUPT_CAPTURE_COMPLETE; ++ if (sts & VE_INTERRUPT_FRAME_COMPLETE) ++ sts &= ~VE_INTERRUPT_FRAME_COMPLETE; ++ + return sts ? IRQ_NONE : IRQ_HANDLED; + } + +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg index 41530dd6e..2a4e87d80 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg @@ -1 +1,74 @@ CONFIG_BLK_DEV_RAM=y +CONFIG_HWMON=y +CONFIG_SENSORS_ASPEED=y +CONFIG_SPI=y +CONFIG_SPI_MASTER=y +CONFIG_IIO=y +CONFIG_SENSORS_IIO_HWMON=y +CONFIG_ASPEED_ADC=y +CONFIG_SGPIO_ASPEED=y +CONFIG_CRC8=y +CONFIG_PECI=y +CONFIG_PECI_CHARDEV=y +CONFIG_PECI_ASPEED=y +CONFIG_SENSORS_PECI_CPUTEMP=y +CONFIG_SENSORS_PECI_DIMMTEMP=y +CONFIG_CONFIGFS_FS=y +CONFIG_BLK_DEV_RAM_SIZE=49152 +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x01 +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_ASPEED_ESPI_SLAVE=y +CONFIG_ASPEED_KCS_IPMI_BMC=y +CONFIG_I2C_SLAVE=y +CONFIG_I2C_SLAVE_MQUEUE=y +CONFIG_I2C_SLAVE_MQUEUE_MESSAGE_SIZE=256 +CONFIG_I2C_SLAVE_MQUEUE_QUEUE_SIZE=32 +CONFIG_ASPEED_BT_IPMI_BMC=n +CONFIG_ASPEED_LPC_CTRL=n +CONFIG_ASPEED_LPC_MBOX=y +CONFIG_ASPEED_LPC_SIO=y +CONFIG_JTAG=y +CONFIG_JTAG_ASPEED=y +CONFIG_FRAME_VECTOR=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_VIDEO_DEV=y +CONFIG_VIDEO_V4L2=y +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_VIDEO_ASPEED=y +CONFIG_VIDEOBUF2_CORE=y +CONFIG_VIDEOBUF2_V4L2=y +CONFIG_VIDEOBUF2_MEMOPS=y +CONFIG_VIDEOBUF2_DMA_CONTIG=y +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 +CONFIG_USB_LIBCOMPOSITE=y +CONFIG_USB_F_HID=y +CONFIG_USB_GADGET=y +CONFIG_U_SERIAL_CONSOLE=y +CONFIG_USB_ASPEED_VHUB=y +CONFIG_USB_CONFIGFS=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_USB_CONFIGFS_F_HID=y +CONFIG_ASPEED_UART_ROUTING=y +CONFIG_ASPEED_VGA_SHAREDMEM=y +CONFIG_PWM=y +CONFIG_PWM_FTTMR010=y +CONFIG_INPUT_MISC=y +CONFIG_INPUT_PWM_BEEPER=y +CONFIG_VFAT_FS=y +CONFIG_NLS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_15=y +CONFIG_NLS_UTF8=y +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_CIFS=y +CONFIG_CIFS_XATTR=y +CONFIG_PSTORE=y +CONFIG_PSTORE_ZLIB_COMPRESS=y +CONFIG_PSTORE_RAM=y diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend index 8ff89685b..a901ce9db 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -7,11 +7,17 @@ do_compile_prepend(){ SRC_URI += " \ file://intel.cfg \ - file://0005-arm-dts-aspeed-g5-add-espi.patch \ - file://0007-New-flash-map-for-intel.patch \ - file://0008-Add-ASPEED-SGPIO-driver.patch \ - file://0009-SGPIO-DT-and-pinctrl-fixup.patch \ - file://0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch \ + file://0001-arm-dts-add-DTS-for-Intel-platforms.patch \ + file://0002-Enable-pass-through-on-GPIOE1-and-GPIOE3-free.patch \ + file://0003-Enable-GPIOE0-and-GPIOE2-pass-through-by-default.patch \ + file://0006-Allow-monitoring-of-power-control-input-GPIOs.patch \ + file://0007-aspeed-pwm-tacho-change-default-fan-speed.patch \ + file://0008-Report-link-statistics-for-the-NCSI-channel.patch \ + file://0014-arm-dts-aspeed-g5-add-espi.patch \ + file://0015-New-flash-map-for-intel.patch \ + file://0016-Add-ASPEED-SGPIO-driver.patch \ + file://0017-SGPIO-DT-and-pinctrl-fixup.patch \ + file://0018-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch \ file://0019-Add-I2C-IPMB-support.patch \ file://0020-misc-aspeed-add-lpc-mbox-driver.patch \ file://0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch \ @@ -38,14 +44,19 @@ SRC_URI += " \ file://0055-Documentation-jtag-Add-ABI-documentation.patch \ file://0056-Documentation-jtag-Add-JTAG-core-driver-ioctl-number.patch \ file://0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch \ - file://0058-i2c-aspeed-add-general-call-support.patch \ - file://0065-i2c-aspeed-fix-master-pending-state-handling.patch \ - file://0066-i2c-aspeed-add-buffer-mode-transfer-support.patch \ - file://0067-i2c-aspeed-add-DMA-mode-transfer-support.patch \ - file://0001-set-idle-disconnect-to-true-in-all-cases.patch \ + file://0060-i2c-aspeed-fix-master-pending-state-handling.patch \ + file://0061-i2c-aspeed-add-buffer-mode-transfer-support.patch \ + file://0062-i2c-aspeed-add-DMA-mode-transfer-support.patch \ + file://0063-i2c-aspeed-add-general-call-support.patch \ + file://0064-set-idle-disconnect-to-true-in-all-cases.patch \ file://0068-i2c-aspeed-add-H-W-timeout-support.patch \ file://0069-i2c-aspeed-add-SLAVE_ADDR_RECEIVED_PENDING-interrupt.patch \ file://0070-gpio-aspeed-temporary-fix-for-gpiochip-range-setting.patch \ - file://0071-peci-add-a-temporary-workaround.patch \ file://0072-pmbus-add-fault-and-beep-attributes.patch \ + file://0073-Add-IO-statistics-to-USB-Mass-storage-gadget.patch \ + file://0074-media-aspeed-refine-HSYNC-VSYNC-polarity-setting-log.patch \ + file://0075-Refine-initialization-flow-in-I2C-driver.patch \ + file://0076-media-aspeed-clear-garbage-interrupts.patch \ " + +SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://0005-128MB-flashmap-for-PFR.patch', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check index 67b8afd5e..639b6c5ee 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check @@ -70,6 +70,7 @@ mac_check() { fi } +mkdir -p ${SOFS_MNT}/factory-settings/network/mac while read IFACE UBDEV; do mac_check "$IFACE" "$UBDEV" done <<-END_CONF diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/beepcode-mgr.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/beepcode-mgr.bb index 347ba7cdd..1bf81d953 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/beepcode-mgr.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/beepcode-mgr/beepcode-mgr.bb @@ -9,7 +9,7 @@ SRC_URI = "\ PV = "0.1" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/LICENSE;md5=19407077e42b1ba3d653da313f1f5b4e" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" S = "${WORKDIR}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend index 080ae9f58..7819c90f6 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -1,6 +1,6 @@ # this is here just to bump faster than upstream SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "fff050a355041d2848b8a126a19a6cb81daebe6b" +SRCREV = "978fcadadc8320ff5356ed1a5dc25e3284e3745f" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0018-Define-post-code-interfaces-for-post-code-manager.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0018-Define-post-code-interfaces-for-post-code-manager.patch deleted file mode 100644 index ce23c222b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0018-Define-post-code-interfaces-for-post-code-manager.patch +++ /dev/null @@ -1,64 +0,0 @@ -From f88cac8364d5312e29208018909827d2da4a0f87 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang <kuiying.wang@intel.com> -Date: Tue, 19 Feb 2019 16:52:51 +0800 -Subject: [PATCH] Define post code interfaces for post code manager - -It includes one method and 2 properties. -properties: - - name: CurrentBootCycleIndex - description: > - It is used to indicate current boot cycle index. - - name: MaxBootCycleNum - description: > - The max cached boot cycles for post code. -methods: - - name: GetPostCodes - description: > - Method to get the cached post code for each boot cycle. -TestBy: bitbake build - -Signeoff-by: Kuiying Wang <kuiying.wang@intel.com> ---- - .../State/Boot/PostCode.interface.yaml | 30 ++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - create mode 100644 xyz/openbmc_project/State/Boot/PostCode.interface.yaml - -diff --git a/xyz/openbmc_project/State/Boot/PostCode.interface.yaml b/xyz/openbmc_project/State/Boot/PostCode.interface.yaml -new file mode 100644 -index 0000000..711749d ---- /dev/null -+++ b/xyz/openbmc_project/State/Boot/PostCode.interface.yaml -@@ -0,0 +1,30 @@ -+description: > -+ Monitor Post code coming and buffer all of them based on boot cycle -+ into file system. -+ -+properties: -+ - name: CurrentBootCycleIndex -+ type: uint16 -+ description: > -+ It is used to indicate current boot cycle index. -+ - name: MaxBootCycleNum -+ type: uint16 -+ description: > -+ The max cached boot cycles for post code. -+methods: -+ - name: GetPostCodes -+ description: > -+ Method to get the cached post code for each boot cycle. -+ parameters: -+ - name: Index -+ type: uint16 -+ description: > -+ Index indicates which boot cycle of post codes is requested. -+ returns: -+ - name: codes -+ type: array[uint64] -+ description: > -+ An array of post codes of one boot cycle. -+ errors: -+ - xyz.openbmc_project.Common.Error.InternalFailure -+ - xyz.openbmc_project.Common.Error.InvalidArgument --- -2.16.2 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0021-D-Bus-Intf-Security-modes-property-intf-update.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0021-D-Bus-Intf-Security-modes-property-intf-update.patch deleted file mode 100644 index 62d5376d6..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0021-D-Bus-Intf-Security-modes-property-intf-update.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 9b0630f40c7fb1143901f7d114c376426cc03501 Mon Sep 17 00:00:00 2001 -From: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> -Date: Sat, 15 Jun 2019 01:04:41 +0530 -Subject: [PATCH] [D-Bus Intf] Security modes property & intf update - -Defined new values for RestrictionMode property and defined -SpecialMode interfaces to handle special cases like manufacturing -and validation mode in OpenBMC. - -Note: Please refer Security mode design doc under review for more -details -https://gerrit.openbmc-project.xyz/#/c/openbmc/docs/+/21195/ - -Change-Id: I270e7d23ca2ed260f2d121e3844c2ca79150070e -Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> ---- - .../Security/RestrictionMode.interface.yaml | 16 +++++++++++++ - .../Control/Security/SpecialMode.interface.yaml | 26 ++++++++++++++++++++++ - 2 files changed, 42 insertions(+) - create mode 100644 xyz/openbmc_project/Control/Security/SpecialMode.interface.yaml - -diff --git a/xyz/openbmc_project/Control/Security/RestrictionMode.interface.yaml b/xyz/openbmc_project/Control/Security/RestrictionMode.interface.yaml -index 8e4fd8d..afd2279 100644 ---- a/xyz/openbmc_project/Control/Security/RestrictionMode.interface.yaml -+++ b/xyz/openbmc_project/Control/Security/RestrictionMode.interface.yaml -@@ -21,3 +21,19 @@ enumerations: - - name: Blacklist - description: > - Prevent, if in the blacklist. -+ - name: Provisioning -+ description: > -+ Indicate that system is in provisioning mode -+ and all commands are allowed in system inteface -+ in both pre and post BIOS boot. -+ - name: ProvisionedHostWhitelist -+ description: > -+ Commands in the whitelist will only be executed -+ through system interface after BIOS POST complete. -+ All KCS commands are supported before POST complete. -+ - name: ProvisionedHostDisabled -+ description: > -+ Commands through system interface are executed only -+ till BIOS POST complete notification, after -+ which no system interface commands will be executed(other -+ than BIOS SMI based ones). -diff --git a/xyz/openbmc_project/Control/Security/SpecialMode.interface.yaml b/xyz/openbmc_project/Control/Security/SpecialMode.interface.yaml -new file mode 100644 -index 0000000..6760076 ---- /dev/null -+++ b/xyz/openbmc_project/Control/Security/SpecialMode.interface.yaml -@@ -0,0 +1,26 @@ -+description: > -+ Implement to specify a special mode of operation -+ -+properties: -+ - name: SpecialMode -+ type: enum[self.Modes] -+ description: > -+ The special mode. -+ -+enumerations: -+ - name: Modes -+ description: > -+ Possible modes available. -+ values: -+ - name: None -+ description: > -+ BMC is under normal working condition. -+ - name: Manufacturing -+ description: > -+ Indicate that BMC is in manufacturing mode -+ and is allowed to perform any manufacturing related -+ activity -+ - name: ValidationUnsecure -+ description: > -+ Indicate that BMC is in validation mode, and can -+ execute any special validation related commands --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend index 79a67ee79..c306e5afc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend @@ -1,5 +1,6 @@ -SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git" -SRCREV = "ddc9e9f9d6ed0282ec6c1421a706b45f3c09ebcc" +# todo Johnathan, undo nobranch once phosphor-networking is working +SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git;nobranch=1" +SRCREV = "9cb4a711cff999b373cf98b44cc18b9001c1395a" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" @@ -9,8 +10,6 @@ SRC_URI += "file://0005-Add-DBUS-interface-of-CPU-and-Memory-s-properties.patch file://0012-Add-RestoreDelay-interface-for-power-restore-delay.patch \ file://0013-Add-ErrConfig.yaml-interface-for-processor-error-config.patch \ file://0016-Add-DBUS-interface-of-SMBIOS-MDR-V2.patch \ - file://0018-Define-post-code-interfaces-for-post-code-manager.patch \ - file://0021-D-Bus-Intf-Security-modes-property-intf-update.patch \ file://0022-Add-chassis-power-cycle-and-reset-to-Chassis-State.patch \ file://0024-Add-the-pre-timeout-interrupt-defined-in-IPMI-spec.patch \ file://0025-Add-PreInterruptFlag-properity-in-DBUS.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend index 30044eb6e..842d89f03 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend @@ -5,6 +5,6 @@ SYSTEMD_SERVICE_${PN} = "phosphor-pid-control.service" EXTRA_OECONF = "--enable-configure-dbus=yes" SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git" -SRCREV = "a7ec8350d17b70153cebe666d3fbe88bddd02a1a" +SRCREV = "6b9f59991b7f694866c98775b4179ae97c5e69a8" FILES_${PN} = "${bindir}/swampd ${bindir}/setsensor" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch new file mode 100644 index 000000000..34d5b6e67 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch @@ -0,0 +1,435 @@ +From 030f918b90ea45104bccf68082c2d634c6694238 Mon Sep 17 00:00:00 2001 +From: Vikram Bodireddy <vikram.bodireddy@intel.com> +Date: Tue, 13 Aug 2019 22:43:12 +0530 +Subject: [PATCH] PFR images support in phosphor-software-manager + +This commit adds support for handling the PFR images +upload and processing. + +Testing: +tested PFR image uploads and updates + +Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> +--- + Makefile.am | 18 +++- + activation.cpp | 2 +- + configure.ac | 7 ++ + item_updater.cpp | 6 +- + pfr_image_manager.cpp | 217 ++++++++++++++++++++++++++++++++++++++++++ + pfr_image_manager.hpp | 75 +++++++++++++++ + 6 files changed, 320 insertions(+), 5 deletions(-) + create mode 100644 pfr_image_manager.cpp + create mode 100644 pfr_image_manager.hpp + +diff --git a/Makefile.am b/Makefile.am +index 6c3ec16..59ebecc 100755 +--- a/Makefile.am ++++ b/Makefile.am +@@ -6,13 +6,20 @@ noinst_HEADERS = \ + watch.hpp \ + version.hpp \ + images.hpp \ +- image_manager.hpp \ + item_updater.hpp \ + activation.hpp \ + flash.hpp \ + item_updater_helper.hpp \ + utils.hpp + ++if PFR_UPDATE ++noinst_HEADERS += \ ++ pfr_image_manager.hpp ++else ++noinst_HEADERS += \ ++ image_manager.hpp ++endif ++ + bin_PROGRAMS = \ + phosphor-version-software-manager \ + phosphor-download-manager \ +@@ -24,8 +31,15 @@ dist_bin_SCRIPTS = \ + phosphor_version_software_manager_SOURCES = \ + image_manager_main.cpp \ + watch.cpp \ +- version.cpp \ ++ version.cpp ++ ++if PFR_UPDATE ++phosphor_version_software_manager_SOURCES += \ ++ pfr_image_manager.cpp ++else ++phosphor_version_software_manager_SOURCES += \ + image_manager.cpp ++endif + + BUILT_SOURCES = \ + xyz/openbmc_project/Software/Image/error.cpp \ +diff --git a/activation.cpp b/activation.cpp +index cea1e50..7ff4196 100644 +--- a/activation.cpp ++++ b/activation.cpp +@@ -197,7 +197,7 @@ auto Activation::activation(Activations value) -> Activations + } + else if (activationProgress->progress() == 100) + { +- log<level::ERR>("[Jennifer] progress == 100..."); ++ log<level::INFO>("progress == 100..."); + if (!redundancyPriority) + { + redundancyPriority = +diff --git a/configure.ac b/configure.ac +index 720e704..e527682 100755 +--- a/configure.ac ++++ b/configure.ac +@@ -191,6 +191,13 @@ AS_IF([test "x$enable_fwupd_script" == "xyes"], \ + [AC_DEFINE([FWUPD_SCRIPT],[],[Enable fwupd script support.])]) + AM_CONDITIONAL([FWUPD_SCRIPT], [test "x$enable_fwupd_script" == "xyes"]) + ++# setup pfr image update support ++AC_ARG_ENABLE([pfr_update], ++ AS_HELP_STRING([--enable-pfr_update], [Enable pfr image update support.])) ++AS_IF([test "x$enable_pfr_update" == "xyes"], \ ++ [AC_DEFINE([PFR_UPDATE],[],[Enable pfr image update support.])]) ++AM_CONDITIONAL([PFR_UPDATE], [test "x$enable_pfr_update" == "xyes"]) ++ + # Check for header files. + AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) + AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...openbmc/sdbusplus package required])]) +diff --git a/item_updater.cpp b/item_updater.cpp +index 21fb6e0..fd76a7f 100644 +--- a/item_updater.cpp ++++ b/item_updater.cpp +@@ -64,7 +64,8 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) + auto value = SVersion::convertVersionPurposeFromString( + variant_ns::get<std::string>(property.second)); + if (value == VersionPurpose::BMC || +- value == VersionPurpose::System) ++ value == VersionPurpose::Host || ++ value == VersionPurpose::Other) + { + purpose = value; + } +@@ -356,6 +357,7 @@ void ItemUpdater::deleteAll() + ItemUpdater::ActivationStatus + ItemUpdater::validateSquashFSImage(const std::string& filePath) + { ++#ifndef PFR_UPDATE + bool invalid = false; + + for (auto& bmcImage : bmcImages) +@@ -375,7 +377,7 @@ ItemUpdater::ActivationStatus + { + return ItemUpdater::ActivationStatus::invalid; + } +- ++#endif + return ItemUpdater::ActivationStatus::ready; + } + +diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp +new file mode 100644 +index 0000000..242a6ca +--- /dev/null ++++ b/pfr_image_manager.cpp +@@ -0,0 +1,217 @@ ++#include "config.h" ++ ++#include "pfr_image_manager.hpp" ++ ++#include "version.hpp" ++#include "watch.hpp" ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <sys/stat.h> ++#include <sys/wait.h> ++#include <time.h> ++#include <unistd.h> ++ ++#include <algorithm> ++#include <cstring> ++#include <elog-errors.hpp> ++#include <filesystem> ++#include <fstream> ++#include <iomanip> ++#include <sstream> ++#include <string> ++#include <xyz/openbmc_project/Software/Image/error.hpp> ++ ++namespace phosphor ++{ ++namespace software ++{ ++namespace manager ++{ ++ ++using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; ++namespace Software = phosphor::logging::xyz::openbmc_project::Software; ++ ++static constexpr const uint32_t pfmPos = 2054; ++ ++static int getPFRImgInfo(const std::filesystem::path imgPath, uint8_t& imgType, ++ std::string& version) ++{ ++ struct pfrImgBlock0 block0Data; ++ uint8_t verData[2]; ++ ++ if (std::filesystem::exists(imgPath)) ++ { ++ try ++ { ++ std::ifstream imgFile(imgPath, std::ios::binary | std::ios::in); ++ ++ if (!imgFile.good()) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Image file read failed"); ++ return -1; ++ } ++ ++ imgFile.read(reinterpret_cast<char*>(&block0Data), ++ sizeof(block0Data)); ++ imgType = block0Data.pcType[0]; ++ imgFile.seekg(pfmPos, ++ std::ios::beg); // Version is at 0x806 in the PFM ++ imgFile.read(reinterpret_cast<char*>(&verData), sizeof(verData)); ++ imgFile.close(); ++ version = ++ std::to_string(verData[0]) + "." + std::to_string(verData[1]); ++ phosphor::logging::log<phosphor::logging::level::INFO>( ++ "PFR image", ++ phosphor::logging::entry("PCType=%d", block0Data.pcType[0]), ++ phosphor::logging::entry("VERSION=%s", version.c_str())); ++ } ++ catch (std::exception& e) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); ++ return -1; ++ } ++ } ++ ++ return 0; ++} ++ ++int Manager::processImage(const std::string& imgFilePath) ++{ ++ std::filesystem::path imgPath(imgFilePath); ++ ++ if (!std::filesystem::exists(imgPath)) ++ return -1; ++ ++ uint8_t imgType; ++ int retry = 3; ++ std::string ver; ++ std::string purposeString; ++ ++ if (0 != getPFRImgInfo(imgFilePath, imgType, ver)) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Error reading uploaded image type and version"); ++ return -1; ++ } ++ ++ if (ver.empty()) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Empty version from image file"); ++ return -1; ++ } ++ ++ if (imgType == pfrBMCUpdateCap) ++ { ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"; ++ } ++ else if (imgType == pfrPCHUpdateCap) ++ { ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.Host"; ++ } ++ else if (imgType == pfrCPLDUpdateCap) ++ { ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.Other"; ++ } ++ else ++ { ++ purposeString = ++ "xyz.openbmc_project.Software.Version.VersionPurpose.Unknown"; ++ ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Unknown image type"); ++ return -1; ++ } ++ ++ sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose ++ purpose = Version::VersionPurpose::Unknown; ++ try ++ { ++ purpose = Version::convertVersionPurposeFromString(purposeString); ++ } ++ catch (const sdbusplus::exception::InvalidEnumString& e) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Error: Failed to convert purpose to enum." ++ " Setting to Unknown."); ++ } ++ ++ // Compute id ++ std::string id = Version::getId(ver); ++ ++ // Append a random number after the original version hash ++ // This will allow forcing image update onto the same version ++ // with 3 retries on random number generation. ++ do ++ { ++ srand(time(NULL)); ++ id = id + "_" + std::to_string(rand()); ++ } while ((versions.find(id) != versions.end()) && retry--); ++ ++ if (versions.find(id) != versions.end()) ++ { ++ phosphor::logging::log<phosphor::logging::level::INFO>( ++ "Software Object with the same version already exists, exiting " ++ "the update", ++ phosphor::logging::entry("VERSION_ID=%s", id.c_str())); ++ ++ return -1; ++ } ++ ++ std::filesystem::path imageDirPath(IMG_UPLOAD_DIR); ++ imageDirPath /= id; ++ ++ std::filesystem::create_directory(imageDirPath); ++ ++ std::filesystem::path newFileName = imageDirPath / "image-runtime"; ++ std::filesystem::rename(imgFilePath, newFileName); ++ ++ // Create Version object ++ std::string objPath = std::string{SOFTWARE_OBJPATH} + '/' + id; ++ ++ auto versionPtr = std::make_unique<Version>( ++ bus, objPath, ver, purpose, imageDirPath.string(), ++ std::bind(&Manager::erase, this, std::placeholders::_1)); ++ versionPtr->deleteObject = ++ std::make_unique<phosphor::software::manager::Delete>(bus, objPath, ++ *versionPtr); ++ versions.insert(std::make_pair(id, std::move(versionPtr))); ++ ++ return 0; ++} ++ ++void Manager::erase(std::string entryId) ++{ ++ auto it = versions.find(entryId); ++ if (it == versions.end()) ++ { ++ return; ++ } ++ ++ if (it->second->isFunctional()) ++ { ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ ("Error: Version " + entryId + ++ " is currently running on the BMC." ++ " Unable to remove.") ++ .c_str()); ++ return; ++ } ++ ++ // Delete image dir ++ std::filesystem::path imageDirPath = (*(it->second)).path(); ++ if (std::filesystem::exists(imageDirPath)) ++ { ++ std::filesystem::remove_all(imageDirPath); ++ } ++ this->versions.erase(entryId); ++} ++ ++} // namespace manager ++} // namespace software ++} // namespace phosphor +diff --git a/pfr_image_manager.hpp b/pfr_image_manager.hpp +new file mode 100644 +index 0000000..c6ee6a4 +--- /dev/null ++++ b/pfr_image_manager.hpp +@@ -0,0 +1,75 @@ ++#pragma once ++#include "version.hpp" ++ ++#include <sdbusplus/server.hpp> ++ ++namespace phosphor ++{ ++namespace software ++{ ++namespace manager ++{ ++ ++enum pfrImgPCType { ++ pfrCPLDUpdateCap = 0x00, ++ pfrPCHPFM = 0x01, ++ pfrPCHUpdateCap = 0x02, ++ pfrBMCPFM = 0x03, ++ pfrBMCUpdateCap = 0x04 ++}; ++ ++/* PFR image block 0 - As defined in HAS */ ++struct pfrImgBlock0 { ++ uint8_t tag[4]; ++ uint8_t pcLength[4]; ++ uint8_t pcType[4]; ++ uint8_t reserved1[4]; ++ uint8_t hash256[32]; ++ uint8_t hash384[48]; ++ uint8_t reserved2[32]; ++}__attribute__((packed)); ++ ++/** @class Manager ++ * @brief Contains a map of Version dbus objects. ++ * @details The software image manager class that contains the Version dbus ++ * objects and their version ids. ++ */ ++class Manager ++{ ++ public: ++ /** @brief Constructs Manager Class ++ * ++ * @param[in] bus - The Dbus bus object ++ */ ++ Manager(sdbusplus::bus::bus& bus) : bus(bus){}; ++ ++ /** ++ * @brief Verify the image and provide the image to updater. ++ * Create and populate the version and file path interfaces. ++ * ++ * @param[in] uploaded image. ++ * @param[out] result - 0 if successful. ++ */ ++ int processImage(const std::string& imageFilePath); ++ ++ /** ++ * @brief Erase specified entry d-bus object ++ * and deletes the image file. ++ * ++ * @param[in] entryId - unique identifier of the entry ++ */ ++ void erase(std::string entryId); ++ ++ private: ++ /** @brief Persistent map of Version dbus objects and their ++ * version id */ ++ std::map<std::string, std::unique_ptr<Version>> versions; ++ ++ /** @brief Persistent sdbusplus DBus bus connection. */ ++ sdbusplus::bus::bus& bus; ++ ++}; ++ ++} // namespace manager ++} // namespace software ++} // namespace phosphor +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend index 2efe911ae..90da32ac2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend @@ -3,9 +3,12 @@ EXTRA_OECONF += "--enable-fwupd_script" SYSTEMD_SERVICE_${PN}-updater += "fwupd@.service" +EXTRA_OECONF += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '--enable-pfr_update', '', d)}" SRC_URI += "file://0002-Redfish-firmware-activation.patch \ file://0004-Changed-the-condition-of-software-version-service-wa.patch \ file://0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch \ file://0006-Modify-the-ID-of-software-image-updater-object-on-DB.patch \ " + +SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://0007-PFR-images-support.patch', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru.bb new file mode 100644 index 000000000..53cec437d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru.bb @@ -0,0 +1,30 @@ +SUMMARY = "Default Fru" +DESCRIPTION = "Builds a default FRU file at runtime based on board ID" + +inherit systemd +inherit cmake + +SYSTEMD_SERVICE_${PN} = "SetBaseboardFru.service" + +S = "${WORKDIR}" +SRC_URI = "file://checkFru.sh \ + file://SetBaseboardFru.service \ + file://mkfru.cpp \ + file://CMakeLists.txt \ + " + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "\ + file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658 \ + file://mkfru.cpp;beginline=2;endline=14;md5=c451359f18a13ee69602afce1588c01a \ + " + +RDEPENDS_${PN} = "bash" + +do_install_append() { + install -d ${D}${bindir} + install -m 0755 ${S}/checkFru.sh ${D}/${bindir}/checkFru.sh + + install -d ${D}${base_libdir}/systemd/system + install -m 0644 ${S}/SetBaseboardFru.service ${D}${base_libdir}/systemd/system +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/CMakeLists.txt b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/CMakeLists.txt new file mode 100644 index 000000000..a8e633644 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) +project(mkfru CXX) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +add_executable(mkfru mkfru.cpp) +install(TARGETS mkfru DESTINATION bin) + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/SetBaseboardFru.service b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/SetBaseboardFru.service new file mode 100644 index 000000000..d8c2a75ac --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/SetBaseboardFru.service @@ -0,0 +1,9 @@ +[Unit] +Description=Check for FRU presence + +[Service] +ExecStart=/usr/bin/checkFru.sh +Type=oneshot + +[Install] +WantedBy=basic.target diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh new file mode 100755 index 000000000..908e4b51e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# this script checks the gpio id and loads the correct baseboard fru +FRUPATH="/etc/fru" +fruFile="$FRUPATH/baseboard.fru.bin" +if [ -f $fruFile ]; then + exit 0 +fi + +read_id() { + local idx=0 + local result=0 + local value=0 + for ((idx=0; idx<6; idx++)) + do + typeset -i value=$(gpioget $(gpiofind "FM_BMC_BOARD_SKU_ID${idx}_N")) + value=$((value << idx)) + result=$((result | value)) + done + echo $result +} + +BOARD_ID=$(read_id) +if grep -q 'CPU part\s*: 0xb76' /proc/cpuinfo; then + # AST2500 + case $BOARD_ID in + 12) NAME="D50TNP1SB";; + 40) NAME="CooperCity";; + 45) NAME="WilsonCity";; + 60) NAME="M50CYP2SB2U";; + 62) NAME="WilsonPoint";; + *) NAME="S2600WFT";; + esac +fi + +if [ -z "$NAME" ]; then + NAME="Unknown" +fi + +cd /tmp +mkdir -p $FRUPATH +mkfru $NAME +mv $NAME.fru.bin $fruFile + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/mkfru.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/mkfru.cpp new file mode 100644 index 000000000..afadbd324 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/mkfru.cpp @@ -0,0 +1,219 @@ +/* +// Copyright (c) 2019 Intel Corporation +// +// 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. +// +// Abstract: default FRU generation +// +*/ + +#include <fstream> +#include <iostream> +#include <iterator> +#include <numeric> +#include <string> +#include <vector> + +constexpr uint8_t fillChar = '.'; +constexpr uint8_t eof = 0xc1; +const std::string intel = "Intel Corporation"; + +// round up to nearest block size (power of 2) +constexpr size_t blockRound(size_t len, size_t blk) +{ + return ((len) + (((blk) - ((len) & ((blk)-1))) & ((blk)-1))); +} + +uint8_t mklen(uint8_t len) +{ + return static_cast<uint8_t>((0x3 << 6) | len); +} + +struct FruEntry +{ + static constexpr size_t fruBlockSize = 8; // type, length, checksum + static constexpr size_t fixedBytes = 3; // type, length, checksum + FruEntry() = delete; + FruEntry(const std::vector<uint8_t>& contents) + { + constexpr size_t verOffset = 0; + constexpr size_t lenOffset = 1; + value.resize(blockRound(fixedBytes + contents.size(), fruBlockSize)); + value[verOffset] = 1; + value[lenOffset] = blocks(); + std::copy(contents.begin(), contents.end(), value.begin() + 2); + addChecksum(); + } + + void addChecksum() + { + int sum = std::accumulate(value.begin(), value.end(), 0); + value.back() = static_cast<uint8_t>(256 - sum & 0xff); + } + + uint8_t blocks() const + { + return static_cast<uint8_t>(value.size() / 8); + } + + std::vector<uint8_t> value; +}; + +size_t fillDots(std::vector<uint8_t>::iterator start, size_t count) +{ + *start++ = mklen(count); // prefix with (0xc0 | count) + auto end = start + count++; + std::fill(start, end, '.'); + return count; +} + +size_t fillStr(std::vector<uint8_t>::iterator start, const std::string& str) +{ + size_t count = str.size(); + *start++ = mklen(count++); // prefix with (0xc0 | count) + std::copy(str.begin(), str.end(), start); + return count; +} + +std::vector<uint8_t> genChassisContents() +{ + constexpr size_t pnSize = 18; + constexpr size_t snSize = 18; + constexpr size_t amSize = 31; + constexpr size_t headerSize = 1; + constexpr size_t contentSize = headerSize + 1 + pnSize + 1 + snSize + 1 + + amSize + 1 + amSize + sizeof(eof); + std::vector<uint8_t> data(contentSize); + size_t offset = 0; + // chassis type (main server chassis) + data[offset++] = 0x17; + // chassis part number + offset += fillDots(data.begin() + offset, pnSize); + // chassis serial number + offset += fillDots(data.begin() + offset, snSize); + // info am1 + offset += fillDots(data.begin() + offset, amSize); + // info am2 + offset += fillDots(data.begin() + offset, amSize); + data[offset] = eof; + + return data; +} + +std::vector<uint8_t> genBoardContents(const std::string& name) +{ + constexpr size_t headerSize = 4; + constexpr size_t snSize = 12; + constexpr size_t pnSize = 10; + const std::string version = "FRU Ver 0.01"; + size_t contentSize = headerSize + 1 + name.size() + 1 + intel.size() + 1 + + snSize + 1 + pnSize + 1 + version.size() + sizeof(eof); + std::vector<uint8_t> data(contentSize); + size_t offset = 0; + // chassis type (main server chassis) + data[offset++] = 0; // language code + data[offset++] = 0; // mfg date/time + data[offset++] = 0; // mfg date/time + data[offset++] = 0; // mfg date/time + // manufacturer name + offset += fillStr(data.begin() + offset, intel); + // product name + offset += fillStr(data.begin() + offset, name); + // board sn + offset += fillDots(data.begin() + offset, snSize); + // board pn + offset += fillDots(data.begin() + offset, pnSize); + // fru version string + offset += fillStr(data.begin() + offset, version); + data[offset] = eof; + + return data; +} + +std::vector<uint8_t> genProductContents(const std::string& name) +{ + constexpr size_t headerSize = 1; + constexpr size_t pnSize = 10; + constexpr size_t pvSize = 20; + constexpr size_t snSize = 12; + constexpr size_t atSize = 20; + constexpr size_t idSize = 0; + const std::string version = "FRU Ver 0.01"; + size_t contentSize = headerSize + 1 + intel.size() + 1 + name.size() + 1 + + pnSize + 1 + pvSize + 1 + snSize + 1 + atSize + 1 + + idSize + sizeof(eof); + std::vector<uint8_t> data(contentSize); + size_t offset = 0; + // chassis type (main server chassis) + data[offset++] = 0; // language code + // manufacturer name + offset += fillStr(data.begin() + offset, intel); + // product name + offset += fillStr(data.begin() + offset, name); + // product part number + offset += fillDots(data.begin() + offset, pnSize); + // product version + offset += fillDots(data.begin() + offset, pvSize); + // product serial number + offset += fillDots(data.begin() + offset, snSize); + // product asset tag + offset += fillDots(data.begin() + offset, atSize); + // empty fru file id + offset += fillDots(data.begin() + offset, idSize); + data[offset] = eof; + + return data; +} + +int createFru(const std::string& name) +{ + std::vector<uint8_t> internal{1, 0, 0, 0, 0, 0, 0, 1}; // fixed data + FruEntry chassis(genChassisContents()); + FruEntry board(genBoardContents(name)); + FruEntry product(genProductContents(name)); + uint8_t offset = 1; // room for header's offset + FruEntry header({ + offset += 1, // internal size + offset += chassis.blocks(), + offset += board.blocks(), + }); + std::string filename = name + ".fru.bin"; + std::ofstream output(filename); + std::ostream_iterator<uint8_t> outputIter(output); + std::copy(header.value.begin(), header.value.end(), outputIter); + std::copy(internal.begin(), internal.end(), outputIter); + std::copy(chassis.value.begin(), chassis.value.end(), outputIter); + std::copy(board.value.begin(), board.value.end(), outputIter); + std::copy(product.value.begin(), product.value.end(), outputIter); + constexpr size_t minFruSize = 0x1ff; + size_t fruSize = header.value.size() + internal.size() + + chassis.value.size() + board.value.size() + + product.value.size(); + if (fruSize < minFruSize) + { + std::vector<uint8_t> padding(minFruSize - fruSize); + std::copy(padding.begin(), padding.end(), outputIter); + } + output.close(); + return 0; +} + +int main(int argc, const char* argv[]) +{ + if (argc != 2) + { + std::cerr << "Usage: " << argv[0] << " <'Product Name'>\n"; + return 1; + } + return createFru(argv[1]); +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend index 53cd944c6..5a2e55497 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "b76f9ca126d5c1abcd8b833a511d784531dbb3a1" +SRCREV = "c80fee55c3663e5ac620a4d11378799c91867b76" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" @@ -15,3 +15,6 @@ EXTRA_OECMAKE += "-DBMCWEB_ENABLE_REDFISH_RAW_PECI=ON" # Enable Redfish BMC Journal support EXTRA_OECMAKE += "-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL=ON" + +# Enable PFR support +EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DBMCWEB_ENABLE_REDFISH_PFR_FEATURE=ON', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json index 92731f439..dc9c2ce20 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json @@ -44,12 +44,12 @@ } }, "4" : { - "name" : "EMP", + "name" : "RESERVED", "is_valid" : true, "active_sessions" : 0, "channel_info" : { - "medium_type" : "ipmb", - "protocol_type" : "ipmb-1.0", + "medium_type" : "reserved", + "protocol_type" : "na", "session_supported" : "session-less", "is_ipmi" : true } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch index b54b22213..c862a306a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0009-IPv6-Network-changes.patch @@ -17,11 +17,11 @@ Change-Id: If5528d3b7294c5f8c17db5919439235d0fad0446 transporthandler.hpp | 50 +++ 4 files changed, 713 insertions(+), 1 deletion(-) -diff --git a/include/ipmid/types.hpp b/include/ipmid/types.hpp -index 57c5873..c06fd8c 100644 ---- a/include/ipmid/types.hpp -+++ b/include/ipmid/types.hpp -@@ -224,6 +224,7 @@ constexpr auto ADDR_TYPE_FORMAT = "%hhx"; +Index: phosphor-host-ipmid.clean/include/ipmid/types.hpp +=================================================================== +--- phosphor-host-ipmid.clean.orig/include/ipmid/types.hpp ++++ phosphor-host-ipmid.clean/include/ipmid/types.hpp +@@ -224,6 +224,7 @@ constexpr auto ADDR_TYPE_FORMAT = "%hhx" constexpr auto IPV4_ADDRESS_SIZE_BYTE = 4; constexpr auto IPV6_ADDRESS_SIZE_BYTE = 16; @@ -50,10 +50,10 @@ index 57c5873..c06fd8c 100644 + } // namespace network } // namespace ipmi -diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp -index 9ef1488..8b91b12 100644 ---- a/include/ipmid/utils.hpp -+++ b/include/ipmid/utils.hpp +Index: phosphor-host-ipmid.clean/include/ipmid/utils.hpp +=================================================================== +--- phosphor-host-ipmid.clean.orig/include/ipmid/utils.hpp ++++ phosphor-host-ipmid.clean/include/ipmid/utils.hpp @@ -256,6 +256,7 @@ namespace network constexpr auto ROOT = "/xyz/openbmc_project/network"; constexpr auto SERVICE = "xyz.openbmc_project.Network"; @@ -62,11 +62,11 @@ index 9ef1488..8b91b12 100644 constexpr auto IPV4_PREFIX = "169.254"; constexpr auto IPV6_PREFIX = "fe80"; constexpr auto IP_INTERFACE = "xyz.openbmc_project.Network.IP"; -diff --git a/transporthandler.cpp b/transporthandler.cpp -index 8172cc4..12d224a 100644 ---- a/transporthandler.cpp -+++ b/transporthandler.cpp -@@ -30,6 +30,12 @@ std::unique_ptr<phosphor::Timer> networkTimer = nullptr; +Index: phosphor-host-ipmid.clean/transporthandler.cpp +=================================================================== +--- phosphor-host-ipmid.clean.orig/transporthandler.cpp ++++ phosphor-host-ipmid.clean/transporthandler.cpp +@@ -29,6 +29,12 @@ std::unique_ptr<phosphor::Timer> network const int SIZE_MAC = 18; // xx:xx:xx:xx:xx:xx constexpr auto ipv4Protocol = "xyz.openbmc_project.Network.IP.Protocol.IPv4"; @@ -79,29 +79,23 @@ index 8172cc4..12d224a 100644 std::map<int, std::unique_ptr<struct ChannelConfig_t>> channelConfig; -@@ -389,7 +395,6 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - ipmi_context_t context) - { - ipmi_ret_t rc = IPMI_CC_OK; -- *data_len = 0; - - using namespace std::chrono_literals; - -@@ -403,6 +408,9 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - auto reqptr = reinterpret_cast<const set_lan_t*>(request); - sdbusplus::bus::bus bus(ipmid_get_sd_bus_connection()); - -+ size_t reqLen = *data_len; -+ *data_len = 0; +@@ -445,6 +451,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n + { + case LanParam::IP: + { ++ if (reqLen != lanParamIPSize) ++ { ++ return IPMI_CC_REQ_DATA_LEN_INVALID; ++ } + - // channel number is the lower nibble - int channel = reqptr->channel & CHANNEL_MASK; - auto ethdevice = ipmi::getChannelName(channel); -@@ -426,6 +434,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, + std::snprintf(ipaddr, INET_ADDRSTRLEN, + ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], + reqptr->data[1], reqptr->data[2], reqptr->data[3]); +@@ -455,6 +466,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::IPSRC: { -+ if (reqLen != LAN_PARAM_IPSRC_SIZE) ++ if (reqLen != lanParamIPSrcSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -109,11 +103,11 @@ index 8172cc4..12d224a 100644 uint8_t ipsrc{}; std::memcpy(&ipsrc, reqptr->data, ipmi::network::IPSRC_SIZE_BYTE); channelConf->ipsrc = static_cast<ipmi::network::IPOrigin>(ipsrc); -@@ -434,6 +447,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -463,6 +479,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::MAC: { -+ if (reqLen != LAN_PARAM_MAC_SIZE) ++ if (reqLen != lanParamMACSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -121,11 +115,11 @@ index 8172cc4..12d224a 100644 char mac[SIZE_MAC]; std::snprintf(mac, SIZE_MAC, ipmi::network::MAC_ADDRESS_FORMAT, -@@ -454,6 +472,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -483,6 +504,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::SUBNET: { -+ if (reqLen != LAN_PARAM_SUBNET_SIZE) ++ if (reqLen != lanParamSubnetSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -133,11 +127,11 @@ index 8172cc4..12d224a 100644 std::snprintf(netmask, INET_ADDRSTRLEN, ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]); -@@ -463,6 +486,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -492,6 +518,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::GATEWAY: { -+ if (reqLen != LAN_PARAM_GATEWAY_SIZE) ++ if (reqLen != lanParamGatewaySize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -145,23 +139,11 @@ index 8172cc4..12d224a 100644 std::snprintf(gateway, INET_ADDRSTRLEN, ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0], reqptr->data[1], reqptr->data[2], reqptr->data[3]); -@@ -472,6 +500,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - - case LanParam::VLAN: - { -+ if (reqLen != LAN_PARAM_VLAN_SIZE) -+ { -+ return IPMI_CC_REQ_DATA_LEN_INVALID; -+ } -+ - uint16_t vlan{}; - std::memcpy(&vlan, reqptr->data, ipmi::network::VLAN_SIZE_BYTE); - // We are not storing the enable bit -@@ -484,6 +517,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -522,6 +553,11 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n case LanParam::INPROGRESS: { -+ if (reqLen != LAN_PARAM_INPROGRESS_SIZE) ++ if (reqLen != lanParamInProgressSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -169,13 +151,13 @@ index 8172cc4..12d224a 100644 if (reqptr->data[0] == SET_COMPLETE) { channelConf->lan_set_in_progress = SET_COMPLETE; -@@ -512,6 +550,122 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -540,6 +576,122 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_n } break; + case LanParam::IPV6_AND_IPV4_ENABLES: + { -+ if (reqLen != LAN_PARAM_IPV6_AND_IPV4_ENABLES_SIZE) ++ if (reqLen != lanParamIPv6AndIPv4EnablesSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -186,7 +168,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ADDRESSES: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ADDRESSES_SIZE) ++ if (reqLen != lanParamIPv6StaticAddressesSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -202,7 +184,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_ROUTER_ADDRESS_CONF_CTRL: + { -+ if (reqLen != LAN_PARAM_IPV6_ROUTER_ADDRESS_CONF_CTRL_SIZE) ++ if (reqLen != lanParamIPv6RouterAddressConfCtrlSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -213,7 +195,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_1_IP_ADDR: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_1_IP_ADDR_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter1IPAddrSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -227,7 +209,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_1_PREFIX_LEN: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_1_PREFIX_LEN_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter1PrefixLenSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -238,7 +220,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_1_PREFIX_VAL: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_1_PREFIX_VAL_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter1PrefixValSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -252,7 +234,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_2_IP_ADDR: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_2_IP_ADDR_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter2IPAddrSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -266,7 +248,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_2_PREFIX_LEN: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_2_PREFIX_LEN_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter2PrefixLenSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -277,7 +259,7 @@ index 8172cc4..12d224a 100644 + + case LanParam::IPV6_STATIC_ROUTER_2_PREFIX_VAL: + { -+ if (reqLen != LAN_PARAM_IPV6_STATIC_ROUTER_2_PREFIX_VAL_SIZE) ++ if (reqLen != lanParamIPv6StaticRouter2PrefixValSize) + { + return IPMI_CC_REQ_DATA_LEN_INVALID; + } @@ -292,7 +274,7 @@ index 8172cc4..12d224a 100644 default: { rc = IPMI_CC_PARM_NOT_SUPPORTED; -@@ -538,6 +692,7 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -568,6 +720,7 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_n ipmi_ret_t rc = IPMI_CC_OK; *data_len = 0; const uint8_t current_revision = 0x11; // Current rev per IPMI Spec 2.0 @@ -300,7 +282,7 @@ index 8172cc4..12d224a 100644 get_lan_t* reqptr = (get_lan_t*)request; // channel number is the lower nibble -@@ -676,6 +831,476 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -713,6 +866,476 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_n static_cast<uint8_t>(cipherList.size()); break; } @@ -777,7 +759,7 @@ index 8172cc4..12d224a 100644 default: log<level::ERR>("Unsupported parameter", entry("PARAMETER=0x%x", reqptr->parameter)); -@@ -921,6 +1546,16 @@ void applyChanges(int channel) +@@ -957,6 +1580,16 @@ void applyChanges(int channel) ipaddress, prefix); } @@ -794,7 +776,7 @@ index 8172cc4..12d224a 100644 if (!gateway.empty()) { ipmi::setDbusProperty(bus, systemObject.second, -@@ -928,7 +1563,24 @@ void applyChanges(int channel) +@@ -964,7 +1597,24 @@ void applyChanges(int channel) ipmi::network::SYSTEMCONFIG_INTERFACE, "DefaultGateway", std::string(gateway)); } @@ -817,42 +799,41 @@ index 8172cc4..12d224a 100644 + ipmi::network::ETHERNET_INTERFACE, "IPv6AcceptRA", + (bool)channelConf->ipv6RouterAddressConfigControl); } - catch (InternalFailure& e) + catch (sdbusplus::exception::exception& e) { -diff --git a/transporthandler.hpp b/transporthandler.hpp -index 04d4673..bd23391 100644 ---- a/transporthandler.hpp -+++ b/transporthandler.hpp -@@ -79,6 +79,28 @@ enum class LanParam : uint8_t +Index: phosphor-host-ipmid.clean/transporthandler.hpp +=================================================================== +--- phosphor-host-ipmid.clean.orig/transporthandler.hpp ++++ phosphor-host-ipmid.clean/transporthandler.hpp +@@ -79,8 +79,27 @@ enum class LanParam : uint8_t IPV6_NEIGHBOR_TIMING_CONFIGURATION = 80, }; -+// Data length of parameters -+constexpr size_t LAN_PARAM_INPROGRESS_SIZE = 3; -+constexpr size_t LAN_PARAM_IP_SIZE = 6; -+constexpr size_t LAN_PARAM_IPSRC_SIZE = 3; -+constexpr size_t LAN_PARAM_MAC_SIZE = 8; -+constexpr size_t LAN_PARAM_SUBNET_SIZE = 6; -+constexpr size_t LAN_PARAM_GATEWAY_SIZE = 6; -+constexpr size_t LAN_PARAM_VLAN_SIZE = 4; -+constexpr size_t LAN_PARAM_IPV6_AND_IPV4_ENABLES_SIZE = 3; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ADDRESSES_SIZE = 23; -+constexpr size_t LAN_PARAM_IPV6_ROUTER_ADDRESS_CONF_CTRL_SIZE = 3; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_1_IP_ADDR_SIZE = 18; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_1_PREFIX_LEN_SIZE = 3; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_1_PREFIX_VAL_SIZE = 19; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_2_IP_ADDR_SIZE = 18; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_2_PREFIX_LEN_SIZE = 3; -+constexpr size_t LAN_PARAM_IPV6_STATIC_ROUTER_2_PREFIX_VAL_SIZE = 19; -+ +constexpr uint8_t DUID_LEN = 10; +constexpr uint8_t DUID_LL_TYPE = 3; +constexpr uint8_t DUIC_ETH_HW_TYPE = 1; + + // Data length of parameters + constexpr size_t lanParamVLANSize = 4; ++constexpr size_t lanParamInProgressSize = 3; ++constexpr size_t lanParamIPSize = 6; ++constexpr size_t lanParamIPSrcSize = 3; ++constexpr size_t lanParamMACSize = 8; ++constexpr size_t lanParamSubnetSize = 6; ++constexpr size_t lanParamGatewaySize = 6; ++constexpr size_t lanParamIPv6AndIPv4EnablesSize = 3; ++constexpr size_t lanParamIPv6StaticAddressesSize = 23; ++constexpr size_t lanParamIPv6RouterAddressConfCtrlSize = 3; ++constexpr size_t lanParamIPv6StaticRouter1IPAddrSize = 18; ++constexpr size_t lanParamIPv6StaticRouter1PrefixLenSize = 3; ++constexpr size_t lanParamIPv6StaticRouter1PrefixValSize = 19; ++constexpr size_t lanParamIPv6StaticRouter2IPAddrSize = 18; ++constexpr size_t lanParamIPv6StaticRouter2PrefixLenSize = 3; ++constexpr size_t lanParamIPv6StaticRouter2PrefixValSize = 19; constexpr uint8_t SET_COMPLETE = 0; constexpr uint8_t SET_IN_PROGRESS = 1; constexpr uint8_t SET_COMMIT_WRITE = 2; // Optional -@@ -101,6 +123,20 @@ struct ChannelConfig_t +@@ -103,6 +122,20 @@ struct ChannelConfig_t uint8_t lan_set_in_progress = SET_COMPLETE; bool flush = false; @@ -873,7 +854,7 @@ index 04d4673..bd23391 100644 void clear() { ipaddr.clear(); -@@ -111,6 +147,20 @@ struct ChannelConfig_t +@@ -113,6 +146,20 @@ struct ChannelConfig_t ipsrc = ipmi::network::IPOrigin::UNSPECIFIED; lan_set_in_progress = SET_COMPLETE; flush = false; @@ -894,6 +875,3 @@ index 04d4673..bd23391 100644 } }; --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0057-Add-timer-use-actions-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0057-Add-timer-use-actions-support.patch index a96707d44..f091b31fa 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0057-Add-timer-use-actions-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0057-Add-timer-use-actions-support.patch @@ -1,6 +1,6 @@ -From 6e37e02a4f200507627a82f6dba00a9c9d877cb2 Mon Sep 17 00:00:00 2001 +From 3c69c94eed1a0c6eecfd53e739fade6596c6f3e5 Mon Sep 17 00:00:00 2001 From: Yong Li <yong.b.li@linux.intel.com> -Date: Mon, 18 Mar 2019 23:05:16 +0800 +Date: Thu, 12 Sep 2019 17:37:05 +0800 Subject: [PATCH] Add timer use/actions support Based on IPMI spec, add timer use/actions support, @@ -8,188 +8,24 @@ and add input data checking Signed-off-by: Yong Li <yong.b.li@linux.intel.com> --- - app/watchdog.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++----- - app/watchdog_service.cpp | 8 +++++++ - app/watchdog_service.hpp | 8 +++++++ - 3 files changed, 72 insertions(+), 6 deletions(-) + app/watchdog.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/watchdog.cpp b/app/watchdog.cpp -index 1a5d19c..3b61055 100644 +index c4e594d..18e7e3a 100644 --- a/app/watchdog.cpp +++ b/app/watchdog.cpp -@@ -89,6 +89,13 @@ static constexpr uint8_t wd_dont_stop = 0x1 << 6; - static constexpr uint8_t wd_timeout_action_mask = 0x3; +@@ -251,8 +251,8 @@ ipmi::RspType<> ipmiSetWatchdogTimer( + return ipmi::responseInvalidFieldRequest(); + } - static constexpr uint8_t wdTimerUseMask = 0x7; -+static constexpr uint8_t wdTimerUseResTimer1 = 0x0; -+static constexpr uint8_t wdTimerUseResTimer2 = 0x6; -+static constexpr uint8_t wdTimerUseResTimer3 = 0x7; -+static constexpr uint8_t wdTimerUseRes = 0x38; -+ -+static constexpr uint8_t wdTimerActionMask = 0xcc; -+static constexpr uint8_t wdTimerUseExpMask = 0xc1; +- timerLogFlags = static_cast<uint8_t>(dontLog); +- timerActions &= static_cast<uint8_t>(timeoutAction) | ++ timerLogFlags = (static_cast<uint8_t>(dontLog)) << 7; ++ timerActions = static_cast<uint8_t>(timeoutAction) | + static_cast<uint8_t>(preTimeoutInterrupt) << 4; - enum class IpmiAction : uint8_t - { -@@ -186,6 +193,11 @@ static_assert(sizeof(wd_set_req) == 6, "wd_set_req has invalid size."); - static_assert(sizeof(wd_set_req) <= MAX_IPMI_BUFFER, - "wd_get_res can't fit in request buffer."); - -+static uint8_t timerLogFlags = 0; -+static uint8_t timerActions = 0; -+ -+static uint8_t timerUseExpirationFlags = 0; -+ - ipmi_ret_t ipmi_app_watchdog_set(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - ipmi_request_t request, - ipmi_response_t response, -@@ -203,6 +215,24 @@ ipmi_ret_t ipmi_app_watchdog_set(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - req.initial_countdown = le16toh(req.initial_countdown); - *data_len = 0; - -+ if (((req.timer_use & wdTimerUseMask) == wdTimerUseResTimer1) || -+ ((req.timer_use & wdTimerUseMask) == wdTimerUseResTimer2) || -+ ((req.timer_use & wdTimerUseMask) == wdTimerUseResTimer3) || -+ (req.timer_use & wdTimerUseRes) || -+ (req.timer_action & wdTimerActionMask) || -+ (req.expire_flags & wdTimerUseExpMask)) -+ { -+ return IPMI_CC_INVALID_FIELD_REQUEST; -+ } -+ -+ if (req.pretimeout > (req.initial_countdown / 10)) -+ { -+ return IPMI_CC_INVALID_FIELD_REQUEST; -+ } -+ -+ timerLogFlags = req.timer_use & 0x80; -+ timerActions = req.timer_action; -+ try - { - WatchdogService wd_service; -@@ -221,6 +251,10 @@ ipmi_ret_t ipmi_app_watchdog_set(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - static_cast<IpmiTimerUse>(req.timer_use & wdTimerUseMask); - wd_service.setTimerUse(ipmiTimerUseToWdTimerUse(ipmiTimerUse)); - -+ wd_service.setExpiredTimerUse(WatchdogService::TimerUse::Reserved); -+ -+ timerUseExpirationFlags &= ~req.expire_flags; -+ - // Set the new interval and the time remaining deci -> mill seconds - const uint64_t interval = req.initial_countdown * 100; - wd_service.setInterval(interval); -@@ -339,7 +373,6 @@ static_assert(sizeof(wd_get_res) == 8, "wd_get_res has invalid size."); - static_assert(sizeof(wd_get_res) <= MAX_IPMI_BUFFER, - "wd_get_res can't fit in response buffer."); - --static constexpr uint8_t wd_dont_log = 0x1 << 7; - static constexpr uint8_t wd_running = 0x1 << 6; - - ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd, -@@ -358,20 +391,37 @@ ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - - // Build and return the response - wd_get_res res; -- res.timer_use = wd_dont_log; -- res.timer_action = -- static_cast<uint8_t>(wdActionToIpmiAction(wd_prop.expireAction)); -+ res.timer_use |= timerLogFlags; -+ res.timer_action = timerActions; - - // Interval and timeRemaining need converted from milli -> deci seconds - res.initial_countdown = htole16(wd_prop.interval / 100); -+ -+ if (wd_prop.expiredTimerUse != WatchdogService::TimerUse::Reserved) -+ { -+ timerUseExpirationFlags |= -+ 1 << static_cast<uint8_t>( -+ wdTimerUseToIpmiTimerUse(wd_prop.expiredTimerUse)); -+ } -+ - if (wd_prop.enabled) - { - res.timer_use |= wd_running; - res.present_countdown = htole16(wd_prop.timeRemaining / 100); -+ res.expire_flags = 0; - } - else - { -- res.present_countdown = res.initial_countdown; -+ if (wd_prop.expiredTimerUse == WatchdogService::TimerUse::Reserved) -+ { -+ res.present_countdown = res.initial_countdown; -+ res.expire_flags = 0; -+ } -+ else -+ { -+ res.present_countdown = 0; -+ res.expire_flags = timerUseExpirationFlags; -+ } - } - - res.timer_use |= -@@ -379,7 +429,7 @@ ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - - // TODO: Do something about having pretimeout support - res.pretimeout = 0; -- res.expire_flags = 0; -+ - memcpy(response, &res, sizeof(res)); - *data_len = sizeof(res); - lastCallSuccessful = true; -diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp -index e65ea63..8b1aa47 100644 ---- a/app/watchdog_service.cpp -+++ b/app/watchdog_service.cpp -@@ -83,6 +83,9 @@ WatchdogService::Properties WatchdogService::getProperties() - wd_prop.timerUse = Watchdog::convertTimerUseFromString( - std::get<std::string>(properties.at("CurrentTimerUse"))); - -+ wd_prop.expiredTimerUse = Watchdog::convertTimerUseFromString( -+ std::get<std::string>(properties.at("ExpiredTimerUse"))); -+ - wd_prop.interval = std::get<uint64_t>(properties.at("Interval")); - wd_prop.timeRemaining = - std::get<uint64_t>(properties.at("TimeRemaining")); -@@ -187,6 +190,11 @@ void WatchdogService::setTimerUse(TimerUse timerUse) - setProperty("CurrentTimerUse", convertForMessage(timerUse)); - } - -+void WatchdogService::setExpiredTimerUse(TimerUse timerUse) -+{ -+ setProperty("ExpiredTimerUse", convertForMessage(timerUse)); -+} -+ - void WatchdogService::setInterval(uint64_t interval) - { - setProperty("Interval", interval); -diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp -index 75afc1e..d0cc1a8 100644 ---- a/app/watchdog_service.hpp -+++ b/app/watchdog_service.hpp -@@ -36,6 +36,7 @@ class WatchdogService - bool enabled; - Action expireAction; - TimerUse timerUse; -+ TimerUse expiredTimerUse; - uint64_t interval; - uint64_t timeRemaining; - }; -@@ -79,6 +80,13 @@ class WatchdogService - */ - void setTimerUse(TimerUse timerUse); - -+ /** @brief Sets the value of the ExpiredTimerUse property on the host -+ * watchdog -+ * -+ * @param[in] timerUse - The new timerUse value -+ */ -+ void setExpiredTimerUse(TimerUse timerUse); -+ - /** @brief Sets the value of the interval property on the host watchdog - * - * @param[in] interval - The new interval value -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch index 5623d246d..2dad2fc16 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch @@ -1,6 +1,6 @@ -From 55db62a92dff4bfc3d34c590b33d9da4e7706b9d Mon Sep 17 00:00:00 2001 +From 27b94aa1df83abad63cbba69525273194b14ab9c Mon Sep 17 00:00:00 2001 From: Cheng C Yang <cheng.c.yang@intel.com> -Date: Wed, 3 Jul 2019 06:12:55 +0800 +Date: Wed, 16 Oct 2019 14:24:20 +0800 Subject: [PATCH] Move Set SOL config parameter to host-ipmid Move Set SOL config parameter command from net-ipmid to host-ipmid, @@ -23,15 +23,14 @@ to 0 and other properties will not reset to default value. Signed-off-by: Cheng C Yang <cheng.c.yang@intel.com> --- host-ipmid-whitelist.conf | 1 + - transporthandler.cpp | 289 ++++++++++++++++++++++++++++++++++++++++++++++ - transporthandler.hpp | 33 ++++++ - 3 files changed, 323 insertions(+) + transporthandler.cpp | 322 ++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 323 insertions(+) diff --git a/host-ipmid-whitelist.conf b/host-ipmid-whitelist.conf -index 2b72d23..856588e 100644 +index e8df7c7..f030ef4 100644 --- a/host-ipmid-whitelist.conf +++ b/host-ipmid-whitelist.conf -@@ -42,6 +42,7 @@ +@@ -41,6 +41,7 @@ 0x0A:0x48 //<Storage>:<Get SEL Time> 0x0A:0x49 //<Storage>:<Set SEL Time> 0x0C:0x02 //<Transport>:<Get LAN Configuration Parameters> @@ -40,22 +39,17 @@ index 2b72d23..856588e 100644 0x2C:0x01 //<Group Extension>:<Get DCMI Capabilities> 0x2C:0x02 //<Group Extension>:<Get Power Reading> diff --git a/transporthandler.cpp b/transporthandler.cpp -index bb624c4..25062ae 100644 +index e88eb63..4a42e7b 100644 --- a/transporthandler.cpp +++ b/transporthandler.cpp -@@ -36,6 +36,9 @@ static const std::array<std::string, 3> ipAddressEnablesType = { - "xyz.openbmc_project.Network.EthernetInterface.IPAllowed.IPv6Only", - "xyz.openbmc_project.Network.EthernetInterface.IPAllowed.IPv4AndIPv6"}; +@@ -1168,8 +1168,323 @@ RspType<message::Payload> getLan(uint4_t channelBits, uint3_t, bool revOnly, + } // namespace transport + } // namespace ipmi +constexpr const char* solInterface = "xyz.openbmc_project.Ipmi.SOL"; +constexpr const char* solPath = "/xyz/openbmc_project/ipmi/sol/"; + - std::map<int, std::unique_ptr<struct ChannelConfig_t>> channelConfig; - - using namespace phosphor::logging; -@@ -1631,6 +1634,285 @@ void createNetworkTimer() - } - } + void register_netfn_transport_functions() __attribute__((constructor)); +static std::string + getSOLService(std::shared_ptr<sdbusplus::asio::connection> dbus, @@ -194,6 +188,37 @@ index bb624c4..25062ae 100644 + +} // namespace ipmi + ++namespace sol ++{ ++enum class Parameter ++{ ++ progress, //!< Set In Progress. ++ enable, //!< SOL Enable. ++ authentication, //!< SOL Authentication. ++ accumulate, //!< Character Accumulate Interval & Send Threshold. ++ retry, //!< SOL Retry. ++ nvbitrate, //!< SOL non-volatile bit rate. ++ vbitrate, //!< SOL volatile bit rate. ++ channel, //!< SOL payload channel. ++ port, //!< SOL payload port. ++}; ++ ++enum class Privilege : uint8_t ++{ ++ highestPriv, ++ callbackPriv, ++ userPriv, ++ operatorPriv, ++ adminPriv, ++ oemPriv, ++}; ++ ++} // namespace sol ++ ++constexpr uint8_t progressMask = 0x03; ++constexpr uint8_t enableMask = 0x01; ++constexpr uint8_t retryMask = 0x07; ++ +ipmi::RspType<> setSOLConfParams(ipmi::Context::ptr ctx, uint4_t chNum, + uint4_t reserved, uint8_t paramSelector, + uint8_t configParamData1, @@ -312,8 +337,10 @@ index bb624c4..25062ae 100644 + { + return ipmi::responseReqDataLenInvalid(); + } -+ if ((setSOLParameter("RetryCount", (configParamData1 & 0x7), -+ channelNum) < 0) || ++ if ((setSOLParameter( ++ "RetryCount", ++ static_cast<uint8_t>(configParamData1 & retryMask), ++ channelNum) < 0) || + (setSOLParameter("RetryIntervalMS", *configParamData2, + channelNum) < 0)) + { @@ -338,74 +365,19 @@ index bb624c4..25062ae 100644 + void register_netfn_transport_functions() { - // As this timer is only for transport handler -@@ -1648,5 +1930,12 @@ void register_netfn_transport_functions() - ipmi_register_callback(NETFUN_TRANSPORT, IPMI_CMD_GET_LAN, NULL, - ipmi_transport_get_lan, PRIVILEGE_OPERATOR); - + ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, +@@ -1178,4 +1493,11 @@ void register_netfn_transport_functions() + ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, + ipmi::transport::cmdGetLanConfigParameters, + ipmi::Privilege::Admin, ipmi::transport::getLan); ++ + ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, + ipmi::transport::cmdSetSolConfigParameters, + ipmi::Privilege::Admin, setSOLConfParams); + + // Initialize dbus property progress to 0 every time sol manager restart. + initializeSOLInProgress(); -+ - return; } -diff --git a/transporthandler.hpp b/transporthandler.hpp -index bd23391..1237658 100644 ---- a/transporthandler.hpp -+++ b/transporthandler.hpp -@@ -1,5 +1,6 @@ - #pragma once - -+#include <ipmid/api-types.hpp> - #include <ipmid/types.hpp> - #include <string> - // IPMI commands for Transport net functions. -@@ -8,6 +9,8 @@ enum ipmi_netfn_storage_cmds - // Get capability bits - IPMI_CMD_SET_LAN = 0x01, - IPMI_CMD_GET_LAN = 0x02, -+ IPMI_CMD_SET_SOL_CONF_PARAMS = 0x21, -+ IPMI_CMD_GET_SOL_CONF_PARAMS = 0x22, - }; - - // Command specific completion codes -@@ -186,3 +189,33 @@ void commitNetworkChanges(); - * @param[in] channel: channel number. - */ - void applyChanges(int channel); -+ -+namespace sol -+{ -+enum class Parameter -+{ -+ progress, //!< Set In Progress. -+ enable, //!< SOL Enable. -+ authentication, //!< SOL Authentication. -+ accumulate, //!< Character Accumulate Interval & Send Threshold. -+ retry, //!< SOL Retry. -+ nvbitrate, //!< SOL non-volatile bit rate. -+ vbitrate, //!< SOL volatile bit rate. -+ channel, //!< SOL payload channel. -+ port, //!< SOL payload port. -+}; -+ -+enum class Privilege : uint8_t -+{ -+ highestPriv, -+ callbackPriv, -+ userPriv, -+ operatorPriv, -+ adminPriv, -+ oemPriv, -+}; -+ -+} // namespace sol -+ -+constexpr uint8_t progressMask = 0x03; -+constexpr uint8_t enableMask = 0x01; -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch index 685e7c39d..aac0850ea 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch @@ -85,8 +85,8 @@ index 2ffaae3..e9b7a9c 100644 + // pretimeOutAction + const auto ipmiPreTimeoutInterrupt = -+ static_cast<IpmiPreTimeoutInterrupt>((req.timer_action >> 4) & -+ wdPreTimeoutInterruptMask); ++ static_cast<IpmiPreTimeoutInterrupt>(wdPreTimeoutInterruptMask & ++ (static_cast<uint8_t>(preTimeoutInterrupt))); + wd_service.setPreTimeoutInterrupt( + ipmiPreTimeoutInterruptToWdAction(ipmiPreTimeoutInterrupt)); + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch index 6a7b056ab..4ee28bb5c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch @@ -1,29 +1,66 @@ +From e7b86ade7db1e9ae86ea39a957bead9090f4ccbf Mon Sep 17 00:00:00 2001 +From: Yong Li <yong.b.li@linux.intel.com> +Date: Thu, 12 Sep 2019 13:18:42 +0800 +Subject: [PATCH] Enable watchdog to save useflag after host power off + +Get the right useflag after host power off. + +Tested: +Set a watchdog (Timer action is none and Time Use is BIOS FRB2) +ipmitool raw 0x06 0x24 0x01 0x00 0x00 0x00 0x40 0x00 +Get watchdog +ipmitool mc watchdog get +Start watchdog +ipmitool mc watchdog reset +Get watchdog +ipmitool mc watchdog get +After timer is stop, set a watchdog again +(Timer action is none and Time Use is BIOS/POST) +ipmitool raw 0x06 0x24 0x02 0x00 0x00 0x00 0x40 0x00 +Start watchdog and wait until timer is stop, +Get watchdog +ipmitool mc watchdog get +Timer Expiration Flags should be 0x06(BIOS FRB2, BIOS/POST) +Power down the Host +Ipmitool chassis power off +Check the Timer Expiration Flags(User Flags) +ipmitool mc watchdog get +Timer Expiration Flags should be 0x06(BIOS FRB2, BIOS/POST) + +Signed-off-by: Yong Li <yong.b.li@linux.intel.com> +--- + app/watchdog.cpp | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + diff --git a/app/watchdog.cpp b/app/watchdog.cpp -index 2938d23..bc5df29 100644 +index 4650d89..1562f5e 100644 --- a/app/watchdog.cpp +++ b/app/watchdog.cpp -@@ -445,23 +445,21 @@ ipmi_ret_t ipmi_app_watchdog_get(ipmi_netfn_t netfn, ipmi_cmd_t cmd, +@@ -435,23 +435,21 @@ ipmi::RspType<uint8_t, // timerUse wdTimerUseToIpmiTimerUse(wd_prop.expiredTimerUse)); } -+ res.expire_flags = timerUseExpirationFlags; ++ expireFlags = timerUseExpirationFlags; if (wd_prop.enabled) { - res.timer_use |= wd_running; - res.present_countdown = htole16(wd_prop.timeRemaining / 100); -- res.expire_flags = 0; + timerUse |= wd_running; + presentCountdown = htole16(wd_prop.timeRemaining / 100); +- expireFlags = 0; } else { if (wd_prop.expiredTimerUse == WatchdogService::TimerUse::Reserved) { - res.present_countdown = res.initial_countdown; -- res.expire_flags = 0; + presentCountdown = initialCountdown; +- expireFlags = 0; } else { - res.present_countdown = 0; -- res.expire_flags = timerUseExpirationFlags; + presentCountdown = 0; +- expireFlags = timerUseExpirationFlags; } } +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch deleted file mode 100644 index f8f71338a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 07caf4cc516601c93d12bbe89b4afb0284201dff Mon Sep 17 00:00:00 2001 -From: Suryakanth Sekar <suryakanth.sekar@linux.intel.com> -Date: Fri, 2 Aug 2019 14:18:31 +0530 -Subject: [PATCH] Valid VLANID should be 1-4095 as in 802.1VLAN spec - -Added the VLAN ID checking condition in Set LAN configuration - -Unit test: -Verified VLAN ID 1-4095 is allowed and CC returns for 0 & > 4095 - -Change-Id: I1737986ed7adb727758dedb84b851ba2c208cea3 -Signed-off-by: Suryakanth Sekar <suryakanth.sekar@linux.intel.com> ---- - transporthandler.cpp | 4 ++++ - transporthandler.hpp | 1 + - 2 files changed, 5 insertions(+) - -diff --git a/transporthandler.cpp b/transporthandler.cpp -index 44ddcef..ede6472 100644 ---- a/transporthandler.cpp -+++ b/transporthandler.cpp -@@ -536,6 +536,10 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd, - // We assume that ipmitool always send enable - // bit as 1. - vlan = le16toh(vlan); -+ if (vlan == 0 || vlan > maxValidVLANIDValue) -+ { -+ return IPMI_CC_INVALID_FIELD_REQUEST; -+ } - channelConf->vlanID = vlan; - } - break; -diff --git a/transporthandler.hpp b/transporthandler.hpp -index 1237658..d8805e1 100644 ---- a/transporthandler.hpp -+++ b/transporthandler.hpp -@@ -219,3 +219,4 @@ enum class Privilege : uint8_t - - constexpr uint8_t progressMask = 0x03; - constexpr uint8_t enableMask = 0x01; -+constexpr uint16_t maxValidVLANIDValue = 4095; --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf index deed53b0b..f3218d8d8 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/host-ipmid-whitelist.conf @@ -1,50 +1,196 @@ -#<NetFn>:<Command -0x00:0x00 //<Chassis>:<Chassis Capabiliti> +#<NetFn>:<Command> +#IPMI whitelist command list version 9b +0x00:0x00 //<Chassis>:<Get Chassis Capabiliti> 0x00:0x01 //<Chassis>:<Get Chassis Status> +0x00:0x04 //<Chassis>:<Chassis Identify> 0x00:0x07 //<Chassis>:<Get System Restart Cause> 0x00:0x09 //<Chassis>:<Get System Boot Options> -0x00:0x0F //<Chassis>:<Get POH Counter Command> -0x04:0x02 //<Sensor/Event>:<Platform event> -0x04:0x2D //<Sensor/Event>:<Get Sensor Reading> +0x00:0x0A //<Chassis>:<Set Front Panel Enables> +0x00:0x0F //<Chassis>:<Get POH Counter> +0x04:0x01 //<Sensor/Event>:<Get Event Receiver> +0x04:0x02 //<Sensor/Event>:<SEL Platform event> +0x04:0x10 //<Sensor/Event>:<PEF Get Capabilities> +0x04:0x13 //<Sensor/Event>:<PEF Get Configuration Parameters> +0x04:0x15 //<Sensor/Event>:<PEF Get Processed EventID> +0x04:0x20 //<Sensor/Event>:<Get Device SDR Info> +0x04:0x21 //<Sensor/Event>:<Get Device SDR> +0x04:0x23 //<Sensor/Event>:<Get Sensor Reading Factors> +0x04:0x25 //<Sensor/Event>:<Get Sensor Hysteresis> +0x04:0x27 //<Sensor/Event>:<Get Sensor Threshold> +0x04:0x29 //<Sensor/Event>:<Get SensorEvent Enable> +0x04:0x2B //<Sensor/Event>:<Get SensorEvent Status> +0x04:0x2D //<Sensor/Event>:<Get SensorReading> 0x04:0x2F //<Sensor/Event>:<Get Sensor Type> 0x06:0x01 //<App>:<Get Device ID> -0x06:0x04 //<App>:<Get Self Test Results> +0x06:0x04 //<App>:<Get Self Test> +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:0x2F //<App>:<Get BMC Global Enables> +0x06:0x30 //<App>:<Clear Message Flags> 0x06:0x31 //<App>:<Get Message Flags> +0x06:0x33 //<App>:<Get Message> 0x06:0x35 //<App>:<Read Event Message Buffer> -0x06:0x36 //<App>:<Get BT Interface Capabilities> 0x06:0x37 //<App>:<Get System GUID> -0x06:0x42 //<App>:<Get Channel Info Command> +0x06:0x38 //<App>:<Get Channel Authentication Capability> +0x06:0x39 //<App>:<Get Session Challenge> +0x06:0x3D //<App>:<Get Channel Session Info> +0x06:0x3F //<App>:<Get Authentication Code> +0x06:0x41 //<App>:<Get Channel Access> +0x06:0x42 //<App>:<Get Channel Info> +0x06:0x44 //<App>:<Get User Access> +0x06:0x46 //<App>:<Get User Name> +0x06:0x4A //<App>:<Get Payload Activation Status> +0x06:0x4B //<App>:<Get Payload Instance Info> +0x06:0x4D //<App>:<Get User Payload Access> 0x06:0x4E //<App>:<Get Channel Payload Support> +0x06:0x4F //<App>:<Get Channel Payload Version> +0x06:0x50 //<App>:<Get Channel OEM Payload Info> 0x06:0x54 //<App>:<Get Channel Cipher Suites> +0x06:0x57 //<App>:<Get System Interface Capabilities> +0x08:0x20 //<Firmware>:<Get Version Information> +0x08:0x21 //<Firmware>:<Security Version Information> +0x08:0x22 //<Firmware>:<Firmware Update Channel Information> +0x08:0x23 //<Firmware>:<BMC Execution Context> +0x08:0x24 //<Firmware>:<Get Boot Certificate Info> +0x08:0x25 //<Firmware>:<Get Boot Certificate Data> +0x08:0x26 //<Firmware>:<Firmware Random Number Update> +0x08:0x27 //<Firmware>:<Set Firmware Update Mode> +0x08:0x28 //<Firmware>:<Exit Firmware Update Mode> +0x08:0x29 //<Firmware>:<Firmware Update Control> +0x08:0x2A //<Firmware>:<Get Firmware Update Status> +0x08:0x2B //<Firmware>:<Set Firmware Update Options> +0x08:0x2C //<Firmware>:<Write Firmware Image> +0x08:0x2D //<Firmware>:<Get Firmware Update Status Code Message> +0x08:0xE0 //<Firmware>:<Get Firmware Update Error Code Message> 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:0x21 //<Storage>:<Get SDR Alloc Info> 0x0A:0x23 //<Storage>:<Get SDR> +0x0A:0x28 //<Storage>:<SEL Get Time> 0x0A:0x40 //<Storage>:<Get SEL Info> -0x0A:0x42 //<Storage>:<Reserve SEL> -0x0A:0x44 //<Storage>:<Add SEL Entry> +0x0A:0x41 //<Storage>:<Get SEL Alloc Info> +0x0A:0x43 //<Storage>:<Get SEL Entry> 0x0A:0x48 //<Storage>:<Get SEL Time> -0x0A:0x49 //<Storage>:<Set SEL Time> +0x0A:0x5A //<Storage>:<Get SEL Auxiliary Log Status> +0x0A:0x5C //<Storage>:<Get SEL Time UTC Offset> 0x0C:0x02 //<Transport>:<Get LAN Configuration Parameters> +0x0C:0x04 //<Transport>:<Get IPUDPRMCP Statistics> +0x0C:0x11 //<Transport>:<Get Serial Modem Configuration> 0x0C:0x22 //<Transport>:<Get SOL 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:0x10 //<Group Extension>:<Get Temperature Readings> -0x30:0x27 //<OEM>:<Get Device Info> -0x30:0x31 //<OEM>:<Get AIC card FRU> -0x30:0x55 //<OEM>:<Get Power Restore Delay> -0x30:0x9A //<OEM>:<Get Processor Error Config> -0x30:0xB0 //<OEM>:<Get LED Status> -0x30:0xE9 //<OEM>:<Get BIOS Post Codes> - +0x2C:0x1F //<Group Extension>:<Get CPU PECI Package Config Data> +0x2C:0x20 //<Group Extension>:<Get MDR Data Region Status> +0x2C:0x21 //<Group Extension>:<Get MDR Region Update Complete> +0x2C:0x22 //<Group Extension>:<Read MDR Region> +0x2C:0x23 //<Group Extension>:<Write MDR Region> +0x2C:0x24 //<Group Extension>:<Get MDR Region Lock> +0x2C:0x25 //<Group Extension>:<Get System Mode> +0x2C:0x29 //<Group Extension>:<Get TPM Configuration> +0x2C:0x37 //<Group Extension>:<Read PCIe Cable EEPROM Data> +0x30:0x04 //<Intel General Application>:<Get NW Switch MIB> +0x30:0x05 //<Intel General Application>:<Get PDB FW Version> +0x30:0x09 //<Intel General Application>:<Get BMC Config> +0x30:0x14 //<Intel General Application>:<Get SM Signal> +0x30:0x19 //<Intel General Application>:<Read LAN Channel Port Value> +0x30:0x1A //<Intel General Application>:<Get NIC Info> +0x30:0x1B //<Intel General Application>:<Get LAN Available> +0x30:0x1D //<Intel General Application>:<Get Master MAC> +0x30:0x1F //<Intel General Application>:<Get Secure Mode> +0x30:0x20 //<Intel General Application>:<OEM Get SEL info> +0x30:0x21 //<Intel General Application>:<OEM Get SEL Allocation Info> +0x30:0x22 //<Intel General Application>:<OEM Platform Event Message> +0x30:0x23 //<Intel General Application>:<OEM Get SEL Entry> +0x30:0x26 //<Intel General Application>:<Set BIOS ID> +0x30:0x27 //<Intel General Application>:<Get OEM Device Information> +0x30:0x2E //<Intel General Application>:<Get Cold Redundancy Configuration> +0x30:0x30 //<Intel General Application>:<Get Sensor Severity> +0x30:0x31 //<Intel General Application>:<Get AIC Slot FRU ID SLOT POS Records> +0x30:0x33 //<Intel General Application>:<Get Controller Status> +0x30:0x38 //<Intel General Application>:<Get Satellite Firmware update status> +0x30:0x39 //<Intel General Application>:<HSBP Get Owner> +0x30:0x3C //<Intel General Application>:<Get AIC MAC> +0x30:0x41 //<Intel General Application>:<Set System GUID> +0x30:0x43 //<Intel General Application>:<Get BMC Reset Disables> +0x30:0x44 //<Intel General Application>:<Send Embedded Firmware Update Status> +0x30:0x47 //<Intel General Application>:<HSBP Get Version> +0x30:0x55 //<Intel General Application>:<Get Power Restore Delay> +0x30:0x58 //<Intel General Application>:<Get DIMM Fault Status> +0x30:0x62 //<Intel General Application>:<Get Shutdown Policy> +0x30:0x63 //<Intel General Application>:<Get Node Slot Presence> +0x30:0x65 //<Intel General Application>:<Get HDD Drive Fault LED State> +0x30:0x66 //<Intel General Application>:<Get Buffer Size> +0x30:0x71 //<Intel General Application>:<Get Advanced Support> +0x30:0x73 //<Intel General Application>:<Get EFI Payload> +0x30:0x74 //<Intel General Application>:<Get RMM Status> +0x30:0x75 //<Intel General Application>:<Get Voltage Name> +0x30:0x80 //<Intel General Application>:<HSBP Get Register From Memory> +0x30:0x81 //<Intel General Application>:<Get Power State> +0x30:0x82 //<Intel General Application>:<Get ACPI Config> +0x30:0x85 //<Intel General Application>:<Get SF PWM> +0x30:0x8A //<Intel General Application>:<Get Fan Control Configuration> +0x30:0x8B //<Intel General Application>:<Auto Fan Detect> +0x30:0x8D //<Intel General Application>:<Get fan speed offset> +0x30:0x8F //<Intel General Application>:<Get DIMM offset> +0x30:0x91 //<Intel General Application>:<Get FSC Parameter> +0x30:0x92 //<Intel General Application>:<Get Chassis Identifier> +0x30:0x93 //<Intel General Application>:<Read Base Board Product ID> +0x30:0x94 //<Intel General Application>:<Get BMC Revision ID> +0x30:0x95 //<Intel General Application>:<Get Is AP CPU> +0x30:0x9A //<Intel General Application>:<Get Processor Error Configuration and Status> +0x30:0x9D //<Intel General Application>:<Get Fan PWM Limit> +0x30:0xB0 //<Intel General Application>:<Get LED Status> +0x30:0xB2 //<Intel General Application>:<Get BMC Service Status> +0x30:0xB3 //<Intel General Application>:<Get BMC Security Control Mode> +0x30:0xBB //<Intel General Application>:<Get CPLD Revision ID> +0x30:0xC2 //<Intel General Application>:<Get OEM Extended Sys Info> +0x30:0xC6 //<Intel General Application>:<Get Partition Config> +0x30:0xC7 //<Intel General Application>:<Get Zone Information> +0x30:0xC9 //<Intel General Application>:<Get Configuration Status> +0x30:0xCA //<Intel General Application>:<Get Fabric Information> +0x30:0xCB //<Intel General Application>:<Get EndPoints Information> +0x30:0xCC //<Intel General Application>:<Get Switches Information> +0x30:0xCD //<Intel General Application>:<Get Switch Collection Information> +0x30:0xD0 //<Intel General Application>:<Get NVMe Drive Data> +0x30:0xD1 //<Intel General Application>:<HSBP Statistics> +0x30:0xD4 //<Intel General Application>:<Get BIOS Capsule (OOB Update)> +0x30:0xE2 //<Intel General Application>:<OEM Get Reading> +0x30:0xE5 //<Intel General Application>:<Get NMI Source> +0x30:0xE8 //<Intel General Application>:<Get PCIe SMBus Slot Card Info> +0x30:0xE9 //<Intel General Application>:<Get BIOS POST CODE> +0x30:0xF9 //<Intel General Application>:<Get POST Progress Codes> +0x30:0xFD //<Intel General Application>:<Get Riser Presence> +0x32:0x60 //<Intel OEM Platform>:<Get PM Bus Information> +0x32:0x63 //<Intel OEM Platform>:<Get Tach Information> +0x32:0x8D //<Intel OEM Platform>:<Get SSD Power> +0x3E:0x02 //<Intel Managed Data Region>:<BMC Data Region Update Event Message> +0x3E:0x20 //<Intel Managed Data Region>:<BMC Region Status> +0x3E:0x21 //<Intel Managed Data Region>:<BMC Region Update Complete> +0x3E:0x22 //<Intel Managed Data Region>:<MDR Event> +0x3E:0x23 //<Intel Managed Data Region>:<BMC Region Read> +0x3E:0x24 //<Intel Managed Data Region>:<BMC Region Write> +0x3E:0x25 //<Intel Managed Data Region>:<BMC Region Lock> +0x3E:0x28 //<Intel Managed Data Region>:<Get DIMM information> +0x3E:0x30 //<Intel Managed Data Region>:<MDR2 Status> +0x3E:0x31 //<Intel Managed Data Region>:<MDR2 GET Direction> +0x3E:0x32 //<Intel Managed Data Region>:<MDR2 Get Data Set Info> +0x3E:0x33 //<Intel Managed Data Region>:<MDR2 Lock Data> +0x3E:0x34 //<Intel Managed Data Region>:<MDR2 Unlock Data> +0x3E:0x35 //<Intel Managed Data Region>:<MDR2 Dget Data Block> +0x3E:0x38 //<Intel Managed Data Region>:<MDR2 Send Direction> +0x3E:0x39 //<Intel Managed Data Region>:<MDR2 Data Info Offer> +0x3E:0x3A //<Intel Managed Data Region>:<MDR2 Data Info> +0x3E:0x3B //<Intel Managed Data Region>:<MDR2 Data Start> +0x3E:0x3C //<Intel Managed Data Region>:<MDR2 Data Done> +0x3E:0x3D //<Intel Managed Data Region>:<MDR2 Data Block> +0x3E:0x41 //<Intel Managed Data Region>:<Enter Platform Debug Log file transfer mode> +0x3E:0x42 //<Intel Managed Data Region>:<Read Platform Debug Log file> +0x3E:0x43 //<Intel Managed Data Region>:<Status of the Platform Debug Log file transfer mode> +0x3E:0x44 //<Intel Managed Data Region>:<Exit Platform Debug Log file transfer mode> +0x3E:0x50 //<Intel Managed Data Region>:<Node IPMB slave address> +0x3E:0x51 //<Intel Managed Data Region>:<Slot IPMB> +0x3E:0x52 //<Intel Managed Data Region>:<Slot I2C Master Write Read> +0x3E:0x75 //<Intel Managed Data Region>:<Get Remote Log IP> diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend index 16bd9f757..a50d5fd7f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -1,13 +1,11 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -# TODO: This should be removed, once up-stream bump up -# issue is resolved -#SRC_URI = "git://github.com/openbmc/phosphor-host-ipmid" -SRCREV = "9da3a75091e0bf0849e2555447e64a70f1dc3bfb" +#todo yong unpin this +SRC_URI = "git://github.com/openbmc/phosphor-host-ipmid;nobranch=1" +SRCREV = "c514d874e4ce3ed1f747cfcb4bab5990393c55e8" SRC_URI += "file://phosphor-ipmi-host.service \ file://host-ipmid-whitelist.conf \ - file://0009-IPv6-Network-changes.patch \ file://0010-fix-get-system-GUID-ipmi-command.patch \ file://0013-ipmi-add-set-bios-id-to-whitelist.patch \ file://0039-ipmi-add-oem-command-get-AIC-FRU-to-whitelist.patch \ @@ -21,9 +19,12 @@ SRC_URI += "file://phosphor-ipmi-host.service \ file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \ file://0064-Enable-watchdog-to-save-useflag-after-host-power-off.patch \ file://0064-Update-provisioning-mode-filter-logic.patch \ - file://0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch \ " +EXTRA_OECONF_append = " --disable-i2c-whitelist-check" + +RDEPENDS_${PN}_remove = "clear-once" + # remove the softpoweroff service since we do not need it SYSTEMD_SERVICE_${PN}_remove += " \ xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend index 24037a4cb..7f7d89105 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend @@ -3,7 +3,7 @@ inherit useradd # TODO: This should be removed, once up-stream bump up # issue is resolved SRC_URI += "git://github.com/openbmc/phosphor-net-ipmid" -SRCREV = "35ca150beb7d5faf2fe0ca44c87bc7b0ade0aee7" +SRCREV = "dafe36444fa438030fdf27089b0e94d8d88411dc" USERADD_PACKAGES = "${PN}" # add a group called ipmi diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb index b27961109..fd0a6562b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb @@ -3,7 +3,7 @@ DESCRIPTION = "The Node Manager Proxy provides a simple interface for communicat with Management Engine via IPMB" SRC_URI = "git://git@github.com/Intel-BMC/node-manager;protocol=ssh" -SRCREV = "06e8a1072b05d42e63cf70e2ceac7390578c051d" +SRCREV = "cceeff9cd35aa548cba039b8ad47c20c5870fa27" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb index d20da7b35..66530e01d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/phosphor-u-boot-mgr/phosphor-u-boot-mgr_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.U_Boot.Environment.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init index e97c40c1c..9de00fd2f 100755 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/preinit-mounts/preinit-mounts/init @@ -25,12 +25,18 @@ log() { # start with /proc and /tmp mounted [ -e /proc/mounts ] || mount -t proc proc /proc +# FIXME: add size limits to /tmp grep -q /tmp /proc/mounts || mount -t tmpfs -o rw,nosuid,nodev tmp /tmp grep -q /sys /proc/mounts || mount -t sysfs -o rw,nosuid,nodev,noexec sys /sys +# fix up /srv to be RW +mkdir -p /tmp/srv +mount --bind /tmp/srv /srv + if grep -q debug-init /proc/cmdline; then exec > /tmp/init.log 2>&1 set -x + env else # silent bob exec >/dev/null 2>&1 @@ -127,23 +133,29 @@ prepare_ubi_volume() { reformat_ubi_volume() { local nv_num="$1" local mnt="$2" + local mtd="/dev/mtd${nv_num}" local ubi="/dev/ubi${nv_num}" local vol="${ubi}_0" # unmount the volume to reformat it umount -f "$mnt" ubidetach -m $nv_num - ubiformat -y "$ubi" + ubiformat -y "$mtd" prepare_ubi_volume $nv_num # remount the UBIFS on the UBI volume - mount -t ubifs "$vol" "$mnt" + mount -t ubifs -o sync "$vol" "$mnt" if [ $? -ne 0 ]; then log "Failed to mount reformatted NV volume; system unstable" fi } +clear_ubenv() { + log "Clearing U-Boot environment" + flash_erase /dev/mtd/u-boot-env 0 0 +} + # mount a UBIFS on the UBI volume prepare_ubi_volume $NV_MTD_NUM -mount -t ubifs "/dev/ubi${NV_MTD_NUM}_0" "$RWFS_MNT" +mount -t ubifs -o sync "/dev/ubi${NV_MTD_NUM}_0" "$RWFS_MNT" if [ $? -ne 0 ]; then log "Failed to mount NV volume; attempting recovery" reformat_ubi_volume $NV_MTD_NUM $RWFS_MNT @@ -158,9 +170,11 @@ if [ $restore_op -eq 1 ]; then targeted_clean elif [ $restore_op -eq 2 ]; then full_clean + clear_ubenv elif [ $restore_op -eq 3 ]; then log "restore-defaults: reformat" reformat_ubi_volume $NV_MTD_NUM $RWFS_MNT + clear_ubenv fi rm -f $RESTORE_FLAG @@ -168,6 +182,17 @@ for FS in $NV_OVERLAYS; do nvrw "$FS" done +# at first boot, fix up /var/volatile/{log,tmp} to be RW (due to yocto nonsense) +if [ -L /var/log ]; then + # remove symlink /var/log -> volatile/log; make /var/log non-volatile + rm /var/log + mkdir -p /var/log + # remove symlink /var/tmp -> volatile/tmp; symlink to /tmp/var + rm /var/tmp + ln -s /tmp/var /var/tmp +fi +mkdir -p /tmp/var + # work around bug where /etc/machine-id will be mounted with a temporary file # if rootfs is read-only and the file is empty MACHINE_ID=/etc/machine-id @@ -205,7 +230,7 @@ if ! grep -q sofs /proc/mounts; then # mount a UBIFS on the UBI volume prepare_ubi_volume $SOFS_MTD_NUM - mount -t ubifs "/dev/ubi${SOFS_MTD_NUM}_0" "$SOFS_MNT" + mount -t ubifs -o sync "/dev/ubi${SOFS_MTD_NUM}_0" "$SOFS_MNT" if [ $? -ne 0 ]; then log "Failed to mount SOFS volume; attempting recovery" reformat_ubi_volume $SOFS_MTD_NUM $SOFS_MNT diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb index 53f42dbdf..7ceff1798 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.RestrictionMode.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend index fcdef4e02..ad14d1d65 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend @@ -1,6 +1,6 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/phosphor-sel-logger.git" -SRCREV = "3d300fca24b30864b3e9a4f5768cfe5e769458ae" +SRCREV = "6afe9560852c6431c43c8e79a28e2b7cb498e355" # Enable threshold monitoring EXTRA_OECMAKE += "-DSEL_LOGGER_MONITOR_THRESHOLD_EVENTS=ON" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-WA-enable-disable-control-code-into-cpusensor.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-WA-enable-disable-control-code-into-cpusensor.patch deleted file mode 100644 index 1e1fc9625..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-WA-enable-disable-control-code-into-cpusensor.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f9b4545af42fc673f81d043a8512db8ebfe58660 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> -Date: Fri, 2 Aug 2019 12:02:58 -0700 -Subject: [PATCH] Add WA enable/disable control code into cpusensor - -This commit adds a PECI WA enable/disable control code. If 'UseWA' -isn't in CPU configuration or the setting is 0, the WA will be -disabled by writing 'N' on the peci_core module parameter. - -This is a temporary WA. - -Change-Id: I73ae9ac49c9382f3ebdc800c360e078418b124e9 -Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> ---- - src/CPUSensorMain.cpp | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index 2a3ff16f8294..b4085fd1038d 100644 ---- a/src/CPUSensorMain.cpp -+++ b/src/CPUSensorMain.cpp -@@ -629,6 +629,25 @@ bool getCpuConfig( - std::cout << "type: " << type << "\n"; - } - -+ // Temporary WA -+ uint64_t useWA = 0; -+ auto findUseWA = config.second.find("UseWA"); -+ if (findUseWA != config.second.end()) -+ { -+ useWA = std::visit(VariantToUnsignedIntVisitor(), -+ findUseWA->second); -+ } -+ if (useWA == 0) -+ { -+ std::ofstream deviceFile( -+ "/sys/module/peci_core/parameters/use_wa"); -+ if (deviceFile.good()) -+ { -+ deviceFile << 'N'; -+ } -+ deviceFile.close(); -+ } -+ - cpuConfigs.emplace(bus, addr, name, State::OFF); - } - } --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend index 082c87055..ce487dd0d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -1,10 +1,7 @@ -SRCREV = "7fa475d3f27ec6c37503ff7ec0496acc2215da29" +SRCREV = "432d1edf7ac86f69558273307a59e4b1cf86b8a6" SRC_URI = "git://github.com/openbmc/dbus-sensors.git" DEPENDS_append = " libgpiod" FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" -SRC_URI += "file://0001-Add-WA-enable-disable-control-code-into-cpusensor.patch" -#todo(cheng) remove this when synced upstream -SYSTEMD_SERVICE_${PN} += " xyz.openbmc_project.mcutempsensor.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb index 1a34e2478..c23d86a38 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb @@ -1,7 +1,7 @@ SUMMARY = "Settings" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb index d6d9d2d20..eb8f6ac34 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "specialmodemgr.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb index 12fd75226..12619a88e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/srvcfg-manager/srvcfg-manager_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" inherit cmake systemd SYSTEMD_SERVICE_${PN} = "srvcfg-manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager/0001-Implement-post-code-manager.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager/0001-Implement-post-code-manager.patch index 8915484cd..56bb8d1c3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager/0001-Implement-post-code-manager.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/state/post-code-manager/0001-Implement-post-code-manager.patch @@ -311,7 +311,7 @@ index 0000000..67bc43f +BusName=xyz.openbmc_project.State.Boot.PostCode + +[Install] -+WantedBy=obmc-standby.target ++WantedBy=multi-user.target diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..4a74b29 @@ -426,21 +426,21 @@ index 0000000..983eeee + std::ofstream os(fullPath.c_str(), std::ios::binary); + cereal::JSONOutputArchive oarchive(os); + oarchive(index); -+ + std::ofstream osPostCodes((path + std::to_string(currentBootCycleIndex())).c_str(), std::ios::binary); + cereal::JSONOutputArchive oarchivePostCodes(osPostCodes); + oarchivePostCodes(postCodes); -+ -+ return path; + } + catch (cereal::Exception& e) + { + phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); ++ return ""; + } + catch (const fs::filesystem_error& e) + { + phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); ++ return ""; + } ++ return path; +} + +bool PostCode::deserialize(const fs::path& path, uint16_t& index) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb index 921352a5b..7e69f41c5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb @@ -7,7 +7,7 @@ inherit cmake systemd DEPENDS = "boost sdbusplus" PV = "0.1+git${SRCPV}" -SRCREV = "226ca2842e0a14ad56b4ebeedfd82ac2ea7e145e" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" S = "${WORKDIR}/git/callback-manager" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb index f50ec86d1..9f7be9434 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb @@ -1,8 +1,8 @@ SUMMARY = "Virtual Media Service" DESCRIPTION = "Virtual Media Service" -SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh;nobranch=1" -SRCREV = "0de77d616866a6251ce7e36db3285fda76b13873" +SRC_URI = "git://git@github.com/Intel-BMC/provingground.git;protocol=ssh" +SRCREV = "30110fe5b18999bddc5721dc5611f542f6feeabd" S = "${WORKDIR}/git/virtual-media/" PV = "1.0+git${SRCPV}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb index 950f4932d..ebd795e83 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb @@ -10,7 +10,7 @@ SRC_URI = "\ PV = "0.1" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/LICENSE;md5=19407077e42b1ba3d653da313f1f5b4e" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" S = "${WORKDIR}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch new file mode 100644 index 000000000..736431e9e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch @@ -0,0 +1,316 @@ +From a65701eabcf205203d6363d54730a6a497c0e6fc 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 9090760..68b4246 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) + { +@@ -102,13 +164,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()) +@@ -128,10 +279,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); + } +@@ -142,6 +294,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(); + +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch deleted file mode 100644 index 627dacef1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch +++ /dev/null @@ -1,198 +0,0 @@ -From d15cf914ad51207021451b12863d4b7585f4666c 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] Move Phosphor-Watchdog to Not Use Service Files - -Our power control does not use service files, update it -so that it calls properties directly. - -According to EPS, change the messageArgs in redfish about watchdog -action and pre-interrupt action. - -Tested: used ipmi to create watchdog event and system -was restarted. - -Set a watchdog (Timer action and pre-interrupt action both are none). - ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0x30 0x00 -Get the watchdog. - ipmitool mc watchdog get -Start the watchdog. - ipmitool mc watchdog reset -When timer expired, check messageArgs in Redfish with below url: -https://IP/redfish/v1/Systems/system/LogServices/EventLog/Entries. - -Signed-off-by: James Feist <james.feist@linux.intel.com> -Signed-off-by: Ren Yu <yux.ren@intel.com> ---- - watchdog.cpp | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 108 insertions(+), 8 deletions(-) - -diff --git a/watchdog.cpp b/watchdog.cpp -index 9090760..4c8e480 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,44 @@ 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* powerActionHardReset = -+ "xyz.openbmc_project.State.Watchdog.Action.HardReset"; -+const static constexpr char* powerActionOff = -+ "xyz.openbmc_project.State.Watchdog.Action.PowerOff"; -+const static constexpr char* powerActionPowerCycle = -+ "xyz.openbmc_project.State.Watchdog.Action.PowerCycle"; -+const static constexpr char* powerActionNone = -+ "xyz.openbmc_project.State.Watchdog.Action.None"; -+const static constexpr char* preInterruptNoAction = -+ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; -+ -+const static constexpr char* hardResteDescription = -+ "Hard Reset - System reset due to Watchdog timeout"; -+const static constexpr char* powerOffDescription = -+ "Power Down - System power down due to Watchdog timeout"; -+const static constexpr char* powerCycleDescription = -+ "Power Cycle - System power cycle due to Watchdog timeout"; -+const static constexpr char* timerExpiredDescription = "Timer expired"; -+const static constexpr char* preInterruptDescription = "Timer interrupt"; -+ -+namespace restart -+{ -+static constexpr const char* busName = "xyz.openbmc_project.Settings"; -+static constexpr const char* path = -+ "/xyz/openbmc_project/control/host0/restart_cause"; -+static constexpr const char* interface = -+ "xyz.openbmc_project.Common.RestartCause"; -+static constexpr const char* property = "RestartCause"; -+} // 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::resetTimeRemaining(bool enableWatchdog) - { -@@ -102,12 +139,51 @@ uint64_t Watchdog::interval(uint64_t value) - // Optional callback function on timer expiration - void Watchdog::timeOutHandler() - { -+ PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt(); - Action action = expireAction(); -+ std::string actionMessageArgs{}; -+ - if (!this->enabled()) - { - action = fallback->action; - } - -+ if (convertForMessage(action) == powerActionHardReset) -+ { -+ actionMessageArgs = hardResteDescription; -+ } -+ else if (convertForMessage(action) == powerActionOff) -+ { -+ actionMessageArgs = powerOffDescription; -+ } -+ else if (convertForMessage(action) == powerActionPowerCycle) -+ { -+ actionMessageArgs = powerCycleDescription; -+ } -+ else if (convertForMessage(action) == powerActionNone) -+ { -+ actionMessageArgs = timerExpiredDescription; -+ } -+ else -+ { -+ actionMessageArgs = "Reserved"; -+ } -+ -+ // 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", actionMessageArgs.c_str(), NULL); -+ -+ if (preInterruptNoAction != convertForMessage(preTimeoutInterruptAction)) -+ { -+ 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=%s", -+ preInterruptDescription, NULL); -+ } -+ - expiredTimerUse(currentTimerUse()); - - auto target = actionTargetMap.find(action); -@@ -128,10 +204,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); - } -@@ -142,6 +219,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(); --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch deleted file mode 100644 index 016cf063a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch +++ /dev/null @@ -1,118 +0,0 @@ -From b05da90d7023199e23daf8fbb49455138332f241 Mon Sep 17 00:00:00 2001 -From: Ren Yu <yux.ren@intel.com> -Date: Wed, 24 Jul 2019 16:21:13 +0800 -Subject: [PATCH] Stop the watchdog when the host is going to off - -After the host is off, check the WDT status, if it is running, -needs to stop it - -Tested: -Set a watchdog with a long time expiration(Timer action is none, -Timer Use is OEM and Initial Countdown is 435.1 second). - ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0xff 0x10 -Get the watchdog. - ipmitool mc watchdog get -Start the watchdog. - ipmitool mc watchdog reset -Host off. - ipmitool chassis power off -Get the watchdog. - ipmitool mc watchdog get -Check the watchdog status, expect watchdog is stoped. - -Signed-off-by: Ren Yu <yux.ren@intel.com> ---- - watchdog.cpp | 21 +++++++++++++++++++++ - watchdog.hpp | 23 ++++++++++++++++++++++- - 2 files changed, 43 insertions(+), 1 deletion(-) - -diff --git a/watchdog.cpp b/watchdog.cpp -index 4c8e480..fa58ef4 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -21,6 +21,10 @@ using namespace phosphor::logging; - using sdbusplus::exception::SdBusError; - using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; - -+const static constexpr char* currentPowerState = "CurrentPowerState"; -+const static constexpr char* powerStatusOff = -+ "xyz.openbmc_project.State.Chassis.PowerState.Off"; -+ - const static constexpr char* powerActionHardReset = - "xyz.openbmc_project.State.Watchdog.Action.HardReset"; - const static constexpr char* powerActionOff = -@@ -60,6 +64,23 @@ 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(currentPowerState); -+ if (iter != props.end()) -+ { -+ const std::string* powerState = std::get_if<std::string>(&iter->second); -+ if (powerState && (*powerState == powerStatusOff)) -+ { -+ if (timerEnabled()) -+ { -+ enabled(false); -+ } -+ } -+ } -+} -+ - void Watchdog::resetTimeRemaining(bool enableWatchdog) - { - timeRemaining(interval()); -diff --git a/watchdog.hpp b/watchdog.hpp -index 7de9bb3..dcbecd1 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/chassis0", -+ "xyz.openbmc_project.State.Chassis"), -+ [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(); - --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch deleted file mode 100644 index 60b605418..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 41f71ecfa2b8339281a33c260d78102453d4ac97 Mon Sep 17 00:00:00 2001 -From: Ren Yu <yux.ren@intel.com> -Date: Tue, 30 Jul 2019 15:31:09 +0800 -Subject: [PATCH] Set PreTimeoutInterruptOccurFlag in DBUS - -Set preTimeoutInterruptOccurFlag in DBUS as 'true' when -watchdog pre-timeout interrupt occurred. -This property is use for recording PreTimeoutInterruptOccurFlag. -In command get message flag, need verify whether pre-timeout -interrupt occurred by it. - -Tested: -Set watchdog timer -(Pre-timeout interrupt is Messaging, Initial Countdown is 2 second). -ipmitool raw 0x06 0x24 0x5 0x30 0x1 0x3e 0x14 0x00 -Start watchdog timer. -ipmitool mc watchdog reset -Wait watchdog timer expired, log into below: -http://BMC-IP:3000/ -xyz.openbmc_project.Watchdog -/xyz/openbmc_project/watchdog/host0 -xyz.openbmc_project.State.Watchdog -check whether the value of PreTimeoutInterruptOccurFlag is true. - -Signed-off-by: Ren Yu <yux.ren@intel.com> ---- - watchdog.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/watchdog.cpp b/watchdog.cpp -index fa58ef4..bdf65da 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -198,6 +198,8 @@ void Watchdog::timeOutHandler() - - if (preInterruptNoAction != 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", --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch deleted file mode 100644 index 578fa1257..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch +++ /dev/null @@ -1,211 +0,0 @@ -From 3bead6316f653f14773e65b2f6b8facb08f200e7 Mon Sep 17 00:00:00 2001 -From: Ren Yu <yux.ren@intel.com> -Date: Fri, 9 Aug 2019 14:54:13 +0800 -Subject: [PATCH] Standardize watchdog redfish format according to EPS - -According to EPS and test requirement, change the messageArgs -in redfish about watchdog action and pre-interrupt action and -add timer user display. - -Tested: -Set a watchdog (Timer action and pre-interrupt action both are none). - ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0x30 0x00 -Get the watchdog. - ipmitool mc watchdog get -Start the watchdog. - ipmitool mc watchdog reset -When timer expired, check messageArgs in Redfish with below url: -https://IP/redfish/v1/Systems/system/LogServices/EventLog/Entries. - - "Message": "Host Watchdog Event: Power Cycle - System power cycle due to Watchdog timeout. timer use: SMS/OS", - "MessageArgs": [ - "Power Cycle - System power cycle due to Watchdog timeout. timer use: SMS/OS" - ], - - "Message": "Host Watchdog Event: Timer interrupt - Messaging Interrupt due to Watchdog timeout. timer use: OEM", - "MessageArgs": [ - "Timer interrupt - Messaging Interrupt due to Watchdog timeout. timer use: OEM" - ], - -Signed-off-by: Ren Yu <yux.ren@intel.com> ---- - watchdog.cpp | 127 +++++++++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 89 insertions(+), 38 deletions(-) - -diff --git a/watchdog.cpp b/watchdog.cpp -index bdf65da..7cfcc75 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp -@@ -25,25 +25,28 @@ const static constexpr char* currentPowerState = "CurrentPowerState"; - const static constexpr char* powerStatusOff = - "xyz.openbmc_project.State.Chassis.PowerState.Off"; - --const static constexpr char* powerActionHardReset = -- "xyz.openbmc_project.State.Watchdog.Action.HardReset"; --const static constexpr char* powerActionOff = -- "xyz.openbmc_project.State.Watchdog.Action.PowerOff"; --const static constexpr char* powerActionPowerCycle = -- "xyz.openbmc_project.State.Watchdog.Action.PowerCycle"; --const static constexpr char* powerActionNone = -- "xyz.openbmc_project.State.Watchdog.Action.None"; --const static constexpr char* preInterruptNoAction = -- "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; -- --const static constexpr char* hardResteDescription = -- "Hard Reset - System reset due to Watchdog timeout"; -+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 due to Watchdog timeout"; -+ "Power Down - System power down"; - const static constexpr char* powerCycleDescription = -- "Power Cycle - System power cycle due to Watchdog timeout"; -+ "Power Cycle - System power cycle"; - const static constexpr char* timerExpiredDescription = "Timer expired"; --const static constexpr char* preInterruptDescription = "Timer interrupt"; -+ -+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 - { -@@ -161,54 +164,102 @@ uint64_t Watchdog::interval(uint64_t value) - 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; - } - -- if (convertForMessage(action) == powerActionHardReset) -- { -- actionMessageArgs = hardResteDescription; -- } -- else if (convertForMessage(action) == powerActionOff) -- { -- actionMessageArgs = powerOffDescription; -- } -- else if (convertForMessage(action) == powerActionPowerCycle) -+ switch (timeUser) - { -- actionMessageArgs = powerCycleDescription; -+ 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; - } -- else if (convertForMessage(action) == powerActionNone) -- { -- actionMessageArgs = timerExpiredDescription; -- } -- else -+ -+ switch (action) - { -- actionMessageArgs = "Reserved"; -+ 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", actionMessageArgs.c_str(), NULL); -+ "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 (preInterruptNoAction != convertForMessage(preTimeoutInterruptAction)) -+ 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=%s", -- preInterruptDescription, NULL); -+ "OpenBMC.0.1.IPMIWatchdog", -+ "REDFISH_MESSAGE_ARGS=Timer interrupt - %s due to " -+ "Watchdog timeout. timer use: %s", -+ preInterruptActionMessageArgs.c_str(), -+ timeUserMessage.c_str(), NULL); - } - -- expiredTimerUse(currentTimerUse()); -- - auto target = actionTargetMap.find(action); - if (target == actionTargetMap.end()) - { --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend index 0e221a6b5..f0b8e8f23 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog_%.bbappend @@ -1,10 +1,7 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" SRCREV = "c35135d32f9cb84b62de7b72eee3a2e87b4b3d4d" -SRC_URI += "file://0001-Move-Phosphor-Watchdog-to-Not-Use-Service-Files.patch \ - file://0002-Stop-the-watchdog-when-the-host-is-going-to-off.patch \ - file://0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch \ - file://0004-Standardize-watchdog-redfish-format-according-to-EPS.patch \ +SRC_URI += "file://0001-Customize-phosphor-watchdog-for-Intel-platforms.patch \ " # Remove the override to keep service running after DC cycle diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb index 2ed120659..45c2c5364 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb @@ -5,6 +5,8 @@ DESCRIPTION = "BMC hardware watchdog service that is used to reset BMC \ inherit allarch inherit obmc-phosphor-systemd +RDEPENDS_${PN} = "bash" + LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" @@ -14,3 +16,9 @@ SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/system-watchdog/system-watchdog.conf" SYSTEMD_SERVICE_${PN} += "watchdog-reset.service" SYSTEMD_SERVICE_${PN} += "watchdog-clear-failures.service" SYSTEMD_SERVICE_${PN} += "watchdog-clear-failures.timer" +SRC_URI += "file://watchdog-reset.sh" + +do_install_append(){ + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/watchdog-reset.sh ${D}${bindir} +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.service index 6f33b36d7..6a5ffb4ba 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.service +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.service @@ -1,8 +1,7 @@ [Unit] Description=Reset BMC Using Hardware Watchdog -Conflicts=system-watchdog.service [Service] -ExecStart=/sbin/watchdog -T 0 -F /dev/watchdog1 +ExecStart=/usr/bin/watchdog-reset.sh Type=oneshot diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh new file mode 100644 index 000000000..b3afd73d3 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if /sbin/fw_printenv bootfailures -n | grep -q 3; then + exit 0 # passed boot limit, user started again on purpose +fi + +echo "Watchdog Failure Limit Reached, Failed Processes:" > /dev/kmsg +systemctl --failed --no-pager | grep failed > /dev/kmsg +echo "Log as follows:" > /dev/kmsg +journalctl -r -n 100 | while read line; do echo $line > /dev/kmsg; done + +systemctl stop system-watchdog.service +/sbin/watchdog -T 0 -F /dev/watchdog1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch deleted file mode 100644 index 3885318de..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 5a6e97bdca6db517eabb94a926623e2f662b1315 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang <kuiying.wang@intel.com> -Date: Thu, 1 Aug 2019 17:37:17 +0800 -Subject: [PATCH] force to bios fix bump fail - -Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> ---- - app/common/services/api-utils.js | 30 ++++++++++++++++++ - app/common/services/constants.js | 4 +++ - app/common/services/dataService.js | 1 + - .../controllers/power-operations-controller.html | 11 +++++++ - .../controllers/power-operations-controller.js | 36 ++++++++++++++++++++-- - 5 files changed, 80 insertions(+), 2 deletions(-) - -diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js -index d485016..3d64406 100644 ---- a/app/common/services/api-utils.js -+++ b/app/common/services/api-utils.js -@@ -29,12 +29,42 @@ window.angular && (function(angular) { - HOST_STATE_TEXT: Constants.HOST_STATE, - LED_STATE: Constants.LED_STATE, - LED_STATE_TEXT: Constants.LED_STATE_TEXT, -+ FORCE_TO_BIOS_STATE_TEXT: Constants.FORCE_TO_BIOS_STATE_TEXT, - HOST_SESSION_STORAGE_KEY: Constants.API_CREDENTIALS.host_storage_key, - validIPV4IP: function(ip) { - // Checks for [0-255].[0-255].[0-255].[0-255] - return ip.match( - /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/); - }, -+ setForceToBIOSState: function(state) { -+ console.log(state); -+ var data = JSON.stringify({'Boot': -+ { -+ 'BootSourceOverrideTarget': state -+ } -+ }); -+ return $http({ -+ method: 'PATCH', -+ url: DataService.getHost() + '/redfish/v1/Systems/system', -+ withCredentials: true, -+ data: data -+ }); -+ }, -+ getForceToBIOSState: function() { -+ -+ return $http({ -+ method: 'GET', -+ url: DataService.getHost() + '/redfish/v1/Systems/system', -+ withCredentials: true -+ }).then( -+ function(response) { -+ console.log(JSON.stringify(response.data.Boot.BootSourceOverrideTarget)); -+ return response.data.Boot.BootSourceOverrideTarget; -+ }, -+ function(error) { -+ console.log(error); -+ }); -+ }, - getRedfishSysName: function() { - return $http({ - method: 'GET', -diff --git a/app/common/services/constants.js b/app/common/services/constants.js -index ae82e76..e594570 100644 ---- a/app/common/services/constants.js -+++ b/app/common/services/constants.js -@@ -42,6 +42,10 @@ window.angular && (function(angular) { - }, - LED_STATE: {on: true, off: false}, - LED_STATE_TEXT: {on: 'on', off: 'off'}, -+ FORCE_TO_BIOS_STATE_TEXT: { -+ on: 'BiosSetup', -+ off: 'None' -+ }, - SEVERITY_TO_PRIORITY_MAP: { - Emergency: 'High', - Alert: 'High', -diff --git a/app/common/services/dataService.js b/app/common/services/dataService.js -index 87fddba..cc9c0b3 100644 ---- a/app/common/services/dataService.js -+++ b/app/common/services/dataService.js -@@ -16,6 +16,7 @@ window.angular && (function(angular) { - this.server_health = Constants.SERVER_HEALTH.unknown; - this.server_state = 'Unreachable'; - this.LED_state = Constants.LED_STATE_TEXT.off; -+ this.ForceToBIOS_state = Constants.FORCE_TO_BIOS_STATE_TEXT.off; - this.last_updated = new Date(); - - this.loading = false; -diff --git a/app/server-control/controllers/power-operations-controller.html b/app/server-control/controllers/power-operations-controller.html -index ddf8bda..ea46e00 100644 ---- a/app/server-control/controllers/power-operations-controller.html -+++ b/app/server-control/controllers/power-operations-controller.html -@@ -10,6 +10,17 @@ - <div class="row column"> - <div id="power-indicator-bar" class="power__indicator-bar" ng-class="{'power__state-on': dataService.server_state == 'Running', 'power__state-off': dataService.server_state == 'Off', 'power__state-indet': dataService.server_state == 'Standby', 'power__state-error': dataService.server_state == 'Quiesced'}"> - <p class="inline">{{dataService.hostname}} - {{dataService.server_id}}</p> -+ <div class="toggle float-right"> -+ <input id="toggle__switch-round" -+ class="toggle-switch toggle-switch__round-flat" -+ type="checkbox" -+ tabindex="0" -+ ng-click="toggleForceToBIOS()" -+ ng-checked="dataService.ForceToBIOS_state == 'BiosSetup'" -+ ng-disabled="dataService.server_unreachable"> -+ <label for="toggle__switch-round" tabindex="0"> </label> -+ <h3 class="inline">Boot to BIOS</h3> -+ </div> - <h3 class="power__state inline no-margin h3"><span>{{dataService.server_state | quiescedToError}}</span></h3> - </div> - </div> -diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js -index 986ac3b..2c29093 100644 ---- a/app/server-control/controllers/power-operations-controller.js -+++ b/app/server-control/controllers/power-operations-controller.js -@@ -10,10 +10,10 @@ window.angular && (function(angular) { - 'use strict'; - - angular.module('app.serverControl').controller('powerOperationsController', [ -- '$scope', 'APIUtils', 'dataService', 'Constants', '$interval', '$q', -+ '$route', '$scope', 'APIUtils', 'dataService', 'Constants', '$interval', '$q', - 'toastService', - function( -- $scope, APIUtils, dataService, Constants, $interval, $q, toastService) { -+ $route, $scope, APIUtils, dataService, Constants, $interval, $q, toastService) { - $scope.dataService = dataService; - // Is a || of the other 4 "confirm" variables to ensure only - // one confirm is shown at a time. -@@ -57,6 +57,17 @@ window.angular && (function(angular) { - }, Constants.POLL_INTERVALS.POWER_OP); - return deferred.promise; - }; -+ APIUtils.getForceToBIOSState().then( -+ function(data) { -+ if (data == APIUtils.FORCE_TO_BIOS_STATE_TEXT.on) { -+ dataService.ForceToBIOS_state = APIUtils.FORCE_TO_BIOS_STATE_TEXT.on; -+ } else { -+ dataService.ForceToBIOS_state = APIUtils.FORCE_TO_BIOS_STATE_TEXT.off; -+ } -+ }, -+ function(error) { -+ console.log(JSON.stringify(error)); -+ }); - - APIUtils.getLastPowerTime() - .then( -@@ -74,6 +85,27 @@ window.angular && (function(angular) { - $scope.loading = false; - }); - -+ $scope.toggleForceToBIOS = function() { -+ var toggleState = -+ (dataService.ForceToBIOS_state == APIUtils.FORCE_TO_BIOS_STATE_TEXT.on) ? -+ APIUtils.FORCE_TO_BIOS_STATE_TEXT.off : -+ APIUtils.FORCE_TO_BIOS_STATE_TEXT.on; -+ dataService.ForceToBIOS_state = -+ (dataService.ForceToBIOS_state == APIUtils.FORCE_TO_BIOS_STATE_TEXT.on) ? -+ APIUtils.FORCE_TO_BIOS_STATE_TEXT.off : -+ APIUtils.FORCE_TO_BIOS_STATE_TEXT.on; -+ APIUtils.setForceToBIOSState(toggleState) -+ .then( -+ function(response) {}, -+ function(errors) { -+ toastService.error( -+ 'Failed to set Boot to BIOS '); -+ console.log(JSON.stringify(errors)); -+ // Reload to get correct current state -+ $route.reload(); -+ }) -+ }; -+ - $scope.toggleState = function() { - dataService.server_state = - (dataService.server_state == 'Running') ? 'Off' : 'Running'; --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend index 5f18206c8..7133892e9 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend @@ -1,6 +1,2 @@ -FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" - -#SRC_URI = "git://github.com/openbmc/phosphor-webui.git" -SRCREV = "30d7c6377f70382088436c7a4830663eb522d588" - -SRC_URI += "file://0004-Implement-force-boot-to-bios-in-server-power-control.patch" +SRC_URI = "git://git@github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel" +SRCREV = "2e0bc44e0c5552395f10e95f66a0874f14403ceb" diff --git a/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/default b/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/default new file mode 100644 index 000000000..b9f8e0363 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/default @@ -0,0 +1 @@ +EXTRA_ARGS="-r /dev/hwrng" diff --git a/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/init b/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/init new file mode 100644 index 000000000..13f0ecd37 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/init @@ -0,0 +1,42 @@ +#!/bin/sh +# +# This is an init script for openembedded +# Copy it to @SYSCONFDIR@/init.d/rng-tools and type +# > update-rc.d rng-tools defaults 60 +# + +rngd=@SBINDIR@/rngd +test -x "$rngd" || exit 1 + +[ -r @SYSCONFDIR@/default/rng-tools ] && . "@SYSCONFDIR@/default/rng-tools" + +case "$1" in + start) + echo -n "Starting random number generator daemon" + start-stop-daemon -S -q -x $rngd -- $EXTRA_ARGS + echo "." + ;; + stop) + echo -n "Stopping random number generator daemon" + start-stop-daemon -K -q -n rngd + echo "." + ;; + reload|force-reload) + echo -n "Signalling rng daemon restart" + start-stop-daemon -K -q -s 1 -x $rngd + start-stop-daemon -K -q -s 1 -x $rngd + ;; + restart) + echo -n "Stopping random number generator daemon" + start-stop-daemon -K -q -n rngd + echo "." + echo -n "Starting random number generator daemon" + start-stop-daemon -S -q -x $rngd -- $EXTRA_ARGS + echo "." + ;; + *) + echo "Usage: @SYSCONFDIR@/init.d/rng-tools {start|stop|reload|restart|force-reload}" + exit 1 +esac + +exit 0 diff --git a/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/rngd.service b/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/rngd.service new file mode 100644 index 000000000..d76e9a0c4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools/rngd.service @@ -0,0 +1,10 @@ +[Unit] +Description=Hardware RNG Entropy Gatherer Daemon + +[Service] +EnvironmentFile=-@SYSCONFDIR@/default/rng-tools +ExecStart=@SBINDIR@/rngd -f $EXTRA_ARGS +Nice=15 + +[Install] +WantedBy=multi-user.target diff --git a/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools_6.7.bb b/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools_6.7.bb new file mode 100644 index 000000000..b4e453f67 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-support/rng-tools/rng-tools_6.7.bb @@ -0,0 +1,52 @@ +SUMMARY = "Random number generator daemon" +DESCRIPTION = "Check and feed random data from hardware device to kernel" +AUTHOR = "Philipp Rumpf, Jeff Garzik <jgarzik@pobox.com>, \ + Henrique de Moraes Holschuh <hmh@debian.org>" +HOMEPAGE = "https://github.com/nhorman/rng-tools" +BUGTRACKER = "https://github.com/nhorman/rng-tools/issues" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" +DEPENDS = "sysfsutils" + +SRC_URI = "\ + git://github.com/nhorman/rng-tools.git \ + file://init \ + file://default \ + file://rngd.service \ +" +SRCREV = "9fc873c5af0e392632e6b736938b811f7ca97251" + +S = "${WORKDIR}/git" + +inherit autotools update-rc.d systemd pkgconfig + +PACKAGECONFIG ??= "libgcrypt libjitterentropy" +PACKAGECONFIG_libc-musl = "libargp libjitterentropy" + +PACKAGECONFIG[libargp] = "--with-libargp,--without-libargp,argp-standalone," +PACKAGECONFIG[libgcrypt] = "--with-libgcrypt,--without-libgcrypt,libgcrypt," +PACKAGECONFIG[libjitterentropy] = "--enable-jitterentropy,--disable-jitterentropy,libjitterentropy" +PACKAGECONFIG[libp11] = "--with-pkcs11,--without-pkcs11,libp11 openssl" +PACKAGECONFIG[nistbeacon] = "--with-nistbeacon,--without-nistbeacon,curl libxml2 openssl" + +INITSCRIPT_NAME = "rng-tools" +INITSCRIPT_PARAMS = "start 03 2 3 4 5 . stop 30 0 6 1 ." + +SYSTEMD_SERVICE_${PN} = "rngd.service" + +# Refer autogen.sh in rng-tools +do_configure_prepend() { + cp ${S}/README.md ${S}/README +} + +do_install_append() { + install -Dm 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools + install -Dm 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools + install -Dm 0644 ${WORKDIR}/rngd.service \ + ${D}${systemd_system_unitdir}/rngd.service + sed -i \ + -e 's,@SYSCONFDIR@,${sysconfdir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + ${D}${sysconfdir}/init.d/rng-tools \ + ${D}${systemd_system_unitdir}/rngd.service +} diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/io-app/files/io-app.c b/meta-openbmc-mods/meta-common/recipes-utilities/io-app/files/io-app.c index a5ffabd88..955674fa6 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/io-app/files/io-app.c +++ b/meta-openbmc-mods/meta-common/recipes-utilities/io-app/files/io-app.c @@ -450,6 +450,7 @@ typedef enum CPU_PILOT3, CPU_PILOT4, CPU_AST2500, + CPU_AST2600, CPU_MAX, } CPU_TYPE; @@ -499,21 +500,49 @@ static CPU_TYPE probe_cpu(void) if (!quiet) fprintf(stderr, "AST2500\n"); this_cpu = CPU_AST2500; + break; } else if (strncmp("ASpeed SoC", v, 11) == 0) { if (!quiet) fprintf(stderr, "Found ASpeed SoC\n"); this_cpu = CPU_AST2500; + break; } else if (strncmp("ServerEngines PILOT3", v, 21) == 0) { if (!quiet) fprintf(stderr, "Found PILOT3\n"); this_cpu = CPU_PILOT3; + break; + } + } + } + else if (strncmp("CPU", cpuinfo, 4) == 0) + { + char *v = strtok_r(NULL, delim, &tmp_s); + if (!v || strncmp("part", v, 5) != 0) + { + continue; + } + v = strtok_r(NULL, delim, &tmp_s); + if (v) + { + if (strncmp("0xb76", v, 6) == 0) + { + if (!quiet) + fprintf(stderr, "AST2500\n"); + this_cpu = CPU_AST2500; + break; + } + else if (strncmp("0xc07", v, 6) == 0) + { + if (!quiet) + fprintf(stderr, "AST2600\n"); + this_cpu = CPU_AST2600; + break; } } - break; } } fclose(f); @@ -530,6 +559,8 @@ static const char *probe_cpu_for_map(void) return "0:2000000,10000000:8000,40000000:43b000"; case CPU_AST2500: return "0:4000000,1e600000:1a0000,20000000:4000000"; + case CPU_AST2600: + return "0:20000000,38000000:8000000,60000000:20000000"; default: return ""; } diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/lpc-cmds.bb b/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/lpc-cmds.bb index 2fbb1eb2f..38489263b 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/lpc-cmds.bb +++ b/meta-openbmc-mods/meta-common/recipes-utilities/lpc-cmds/lpc-cmds.bb @@ -4,7 +4,7 @@ DESCRIPTION = "command tool for LPC interface test on the BMC" inherit cmake LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/LICENSE;md5=19407077e42b1ba3d653da313f1f5b4e" +LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" SRC_URI = "\ file://CMakeLists.txt \ |