initial support for yosemite v4
Subsystems (2)
v2 cover initial support for yosemite v4
Add initial and incomplete support for yosemite v4 BMC-side emulation.
As part of this effort 3 new sensor ICs are added.
Alexander Hansen (4):
hw/sensor: MAX31790 support
hw/sensor: support MAX11615
hw/sensor: support Texas Instruments ADC128D818
ast2600: yosemite4 initial support
hw/arm/Kconfig | 3 + hw/arm/aspeed_ast2600_fby4.c | 289 +++++++++++++ hw/arm/meson.build | 1 + hw/sensor/Kconfig | 12 + hw/sensor/adc128d818.c | 414 +++++++++++++++++++ hw/sensor/max11615.c | 202 +++++++++ hw/sensor/max31790.c | 499 +++++++++++++++++++++++ hw/sensor/meson.build | 3 + hw/sensor/trace-events | 24 ++ include/hw/sensor/adc128d818.h | 20 + include/hw/sensor/max11615.h | 20 + include/hw/sensor/max31790.h | 7 + tests/functional/arm/meson.build | 2 + tests/functional/arm/test_aspeed_fby4.py | 44 ++ 14 files changed, 1540 insertions(+) create mode 100644 hw/arm/aspeed_ast2600_fby4.c create mode 100644 hw/sensor/adc128d818.c create mode 100644 hw/sensor/max11615.c create mode 100644 hw/sensor/max31790.c create mode 100644 include/hw/sensor/adc128d818.h create mode 100644 include/hw/sensor/max11615.h create mode 100644 include/hw/sensor/max31790.h create mode 100755 tests/functional/arm/test_aspeed_fby4.py
Signature · 1 line
2.54.0
PATCH v2 1/4 hw/sensor: MAX31790 support
Product: [1]
Datasheet: [2]
MAX31790 Support:
- fan inputs are reading
- tach reading propertional to pwm setting from linux driver
- fans do not show any fault
- 6 PWM registers influence 6 TACH registers
There is intentional stub behavior in some places and various functions of the device are currently unsupported.
MAX31790 currently unsupported:
- slave address restriction
- fan dynamics
- spin-up configuration
- fault state / failure possibility
- rate-of-change control
- tach mode
- mixed layouts where number of fans != number of tachs
- see Figure 5.9 in [2] for example of mixed layout
Anyone could expand it in the future for more accurate emulation.
The reason for adding this device is to support Yosemite V4 emulation.
Tested: on yosemite 4 qemu
``` root@yosemite4:~# ls /sys/class/hwmon/hwmon2/ device fan2_fault fan3_target fan5_fault fan6_target pwm2 pwm5 fan1_enable fan2_input fan4_enable fan5_input name pwm2_enable pwm5_enable fan1_fault fan2_target fan4_fault fan5_target of_node pwm3 pwm6 fan1_input fan3_enable fan4_input fan6_enable power pwm3_enable pwm6_enable fan1_target fan3_fault fan4_target fan6_fault pwm1 pwm4 subsystem fan2_enable fan3_input fan5_enable fan6_input pwm1_enable pwm4_enable uevent root@yosemite4:~# cat /sys/class/hwmon/hwmon2/fan1_input 4551 root@yosemite4:~# cat /sys/class/hwmon/hwmon2/fan1_enable 1 root@yosemite4:~# cat /sys/class/hwmon/hwmon2/fan1_fault 0 root@yosemite4:~# cat /sys/class/hwmon/hwmon2/fan1_target 2048 root@yosemite4:~# cat /sys/class/hwmon/hwmon2/pwm1 178 root@yosemite4:~# cat /sys/class/hwmon/hwmon2/name max31790 ```
Trace output:
``` max31790_realize i2c_addr: 0x20 max31790_realize i2c_addr: 0x2f max31790_realize i2c_addr: 0x20 max31790_realize i2c_addr: 0x2f max31790_event i2c_addr: 0x20, event: 0x01 max31790_send i2c_addr: 0x20, data: 0x02 max31790_event i2c_addr: 0x20, event: 0x00 max31790_recv i2c_addr: 0x20, reg_addr: 0x02 max31790_recv_return i2c_addr: 0x20, returns: 0x08 ... ```
References:
[1] https://www.analog.com/en/products/MAX31790.html
[2] https://www.analog.com/media/en/technical-documentation/data-sheets/MAX31790.pdf
--- hw/arm/Kconfig | 1 + hw/sensor/Kconfig | 4 + hw/sensor/max31790.c | 499 +++++++++++++++++++++++++++++++++++ hw/sensor/meson.build | 1 + hw/sensor/trace-events | 8 + include/hw/sensor/max31790.h | 7 + 6 files changed, 520 insertions(+) create mode 100644 hw/sensor/max31790.c create mode 100644 include/hw/sensor/max31790.h
hw/arm/Kconfig +1 -0
@@ -551,6 +551,7 @@ config ASPEED_SOC select LED select PMBUS select MAX31785 + select MAX31790 select FSI_APB2OPB_ASPEED select AT24C select PCI_EXPRESS
hw/sensor/Kconfig +4 -0
@@ -43,3 +43,7 @@ config ISL_PMBUS_VR config MAX31785 bool depends on PMBUS + +config MAX31790 + bool + depends on PMBUS
hw/sensor/max31790.c new file +499 -0
499 lines not on this page · raw message
hw/sensor/meson.build +1 -0
@@ -8,3 +8,4 @@ system_ss.add(when: 'CONFIG_MAX34451', if_true: files('max34451.c')) system_ss.add(when: 'CONFIG_LSM303DLHC_MAG', if_true: files('lsm303dlhc_mag.c')) system_ss.add(when: 'CONFIG_ISL_PMBUS_VR', if_true: files('isl_pmbus_vr.c')) system_ss.add(when: 'CONFIG_MAX31785', if_true: files('max31785.c')) +system_ss.add(when: 'CONFIG_MAX31790', if_true: files('max31790.c'))
hw/sensor/trace-events +8 -0
@@ -4,3 +4,11 @@ tmp105_read(uint8_t dev, uint8_t addr) "device: 0x%02x, addr: 0x%02x" tmp105_write(uint8_t dev, uint8_t addr) "device: 0x%02x, addr 0x%02x" tmp105_write_shutdown(uint8_t dev) "device: 0x%02x" + +# max31790.c +max31790_send(uint8_t i2c_addr, uint8_t send) "i2c_addr: 0x%02x, data: 0x%02x" +max31790_recv(uint8_t i2c_addr, uint8_t reg_addr) "i2c_addr: 0x%02x, reg_addr: 0x%02x" +max31790_recv_return(uint8_t i2c_addr, uint8_t data) "i2c_addr: 0x%02x, returns: 0x%02x" +max31790_event(uint8_t i2c_addr, uint8_t event) "i2c_addr: 0x%02x, event: 0x%02x" +max31790_realize(uint8_t i2c_addr) "i2c_addr: 0x%02x" +max31790_pwm_write(uint8_t i2c_addr, size_t index, uint16_t value) "i2c_addr: 0x%02x, index: %zu, value: 0x%04x"
include/hw/sensor/max31790.h new file +7 -0
@@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#ifndef QEMU_MAX31790_H +#define QEMU_MAX31790_H + +#define TYPE_MAX31790 "max31790" + +#endif
Signature · 1 line
2.54.0
PATCH v2 2/4 hw/sensor: support MAX11615
In reply to Alexander HansenProduct: [1]
Datasheet: [2]
Sensor readings can be provided upon creation of the device. In case no readings are provided the ADC reads a pre-deviced arbitrary value.
``` root@yosemite4:~# cat /sys/bus/iio/devices/iio:device2/in_voltage0_raw 2770 ```
trace:
``` less /tmp/qemu-trace.log | grep -i max116 max11615_realize i2c_addr: 0x33 max11615_realize i2c_addr: 0x33 max11615_event i2c_addr: 0x33, event: 0x01 max11615_write_setup i2c_addr: 0x33, data: 0xd2 max11615_write_config i2c_addr: 0x33, data: 0x0f max11615_event i2c_addr: 0x33, event: 0x03 max11615_event i2c_addr: 0x33, event: 0x01 max11615_write_setup i2c_addr: 0x33, data: 0xd2 max11615_write_config i2c_addr: 0x33, data: 0x0f max11615_event i2c_addr: 0x33, event: 0x03 max11615_event i2c_addr: 0x33, event: 0x01 max11615_write_setup i2c_addr: 0x33, data: 0xd2 max11615_write_config i2c_addr: 0x33, data: 0x61 max11615_event i2c_addr: 0x33, event: 0x03 max11615_event i2c_addr: 0x33, event: 0x00 max11615_recv i2c_addr: 0x33, reg_addr: 0x00 max11615_recv_return i2c_addr: 0x33, returns: 0xfa max11615_recv i2c_addr: 0x33, reg_addr: 0x00 max11615_recv_return i2c_addr: 0x33, returns: 0xd2 max11615_event i2c_addr: 0x33, event: 0x04 max11615_event i2c_addr: 0x33, event: 0x03 ```
References:
[1] https://www.analog.com/en/products/MAX11615.html
[2] https://www.analog.com/media/en/technical-documentation/data-sheets/MAX11612-MAX11617.pdf
--- hw/arm/Kconfig | 1 + hw/sensor/Kconfig | 4 + hw/sensor/max11615.c | 202 +++++++++++++++++++++++++++++++++++ hw/sensor/meson.build | 1 + hw/sensor/trace-events | 8 ++ include/hw/sensor/max11615.h | 20 ++++ 6 files changed, 236 insertions(+) create mode 100644 hw/sensor/max11615.c create mode 100644 include/hw/sensor/max11615.h
hw/arm/Kconfig +1 -0
@@ -552,6 +552,7 @@ config ASPEED_SOC select PMBUS select MAX31785 select MAX31790 + select MAX11615 select FSI_APB2OPB_ASPEED select AT24C select PCI_EXPRESS
hw/sensor/Kconfig +4 -0
@@ -47,3 +47,7 @@ config MAX31785 config MAX31790 bool depends on PMBUS + +config MAX11615 + bool + depends on I2C
hw/sensor/max11615.c new file +202 -0
202 lines not on this page · raw message
hw/sensor/meson.build +1 -0
@@ -9,3 +9,4 @@ system_ss.add(when: 'CONFIG_LSM303DLHC_MAG', if_true: files('lsm303dlhc_mag.c')) system_ss.add(when: 'CONFIG_ISL_PMBUS_VR', if_true: files('isl_pmbus_vr.c')) system_ss.add(when: 'CONFIG_MAX31785', if_true: files('max31785.c')) system_ss.add(when: 'CONFIG_MAX31790', if_true: files('max31790.c')) +system_ss.add(when: 'CONFIG_MAX11615', if_true: files('max11615.c'))
hw/sensor/trace-events +8 -0
@@ -12,3 +12,11 @@ max31790_recv_return(uint8_t i2c_addr, uint8_t data) "i2c_addr: 0x%02x, returns: max31790_event(uint8_t i2c_addr, uint8_t event) "i2c_addr: 0x%02x, event: 0x%02x" max31790_realize(uint8_t i2c_addr) "i2c_addr: 0x%02x" max31790_pwm_write(uint8_t i2c_addr, size_t index, uint16_t value) "i2c_addr: 0x%02x, index: %zu, value: 0x%04x" + +# max11615.c +max11615_write_setup(uint8_t i2c_addr, uint8_t send) "i2c_addr: 0x%02x, data: 0x%02x" +max11615_write_config(uint8_t i2c_addr, uint8_t send) "i2c_addr: 0x%02x, data: 0x%02x" +max11615_recv(uint8_t i2c_addr, uint8_t reg_addr) "i2c_addr: 0x%02x, reg_addr: 0x%02x" +max11615_recv_return(uint8_t i2c_addr, uint8_t data) "i2c_addr: 0x%02x, returns: 0x%02x" +max11615_event(uint8_t i2c_addr, uint8_t event) "i2c_addr: 0x%02x, event: 0x%02x" +max11615_realize(uint8_t i2c_addr) "i2c_addr: 0x%02x"
include/hw/sensor/max11615.h new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#ifndef QEMU_MAX11615_H +#define QEMU_MAX11615_H + +#include <stdint.h> +#include "hw/i2c/i2c.h" + +#define TYPE_MAX11615 "max11615" + +/* +* Create and realize a MAX11615 ADC with constant caller-supplied readings +* @bus: I2C bus to put it on +* @address: I2C address +* @init_values: array of readings for each ADC channel +* @init_values_size: Size of @init_values, can be less than the number of channels +*/ +I2CSlave *max11615_init_with_values (I2CBus *bus,uint8_t address, +const uint16_t *init_values,uint32_t init_values_size); + +#endif
Signature · 1 line
2.54.0
PATCH v2 3/4 hw/sensor: support Texas Instruments ADC128D818
In reply to Alexander HansenProduct: [1]
Datasheet: [2]
ADC128D818 Support:
- channel readings from pre-set values
- driver can read and write most configuration registers
ADC128D818 currently unsupported:
- slave address restriction
- startup sequence and realistic busy register emulation
- external VREF
- conversion rate
- interrupts
- deep shutdown mode
- individual channel shutdown
- selection between Mode 0,1,2,3
- pseudo-differential input
Anyone could expand it in the future for more accurate emulation.
The reason for adding this device is to support Yosemite V4 emulation.
Tested: on yosemite v4 qemu
initialize the device:
```
// ti,adc128d818 @ 0x1f (adc)
// the driver will throw away the last 4 bits, set them 0
uint16_t adc_values1[8] = {
0b011110000000, 0b010100010000,
0b001000110000, 0b100000100000,
0b011110000000, 0b010100010000,
0b001000110000, 0b100000100000};
adc128d818_init_with_values(bus, 0x1f, adc_values1, 8);
```Trace outputs directly after initialization:
``` adc128d818_realize i2c_addr: 0x1f adc128d818_realize i2c_addr: 0x1f adc128d818_event i2c_addr: 0x1f, event: 0x01 adc128d818_send i2c_addr: 0x1f, data: 0x00 adc128d818_send i2c_addr: 0x1f, data: 0x80 adc128d818_write i2c_addr: 0x1f, reg: 0x00 data: 0x80 adc128d818_event i2c_addr: 0x1f, event: 0x03 adc128d818_event i2c_addr: 0x1f, event: 0x01 ... ```
read the values
``` root@yosemite4:/sys/bus/i2c/devices/30-001f# cat hwmon/hwmon0/in0_min 0 root@yosemite4:/sys/bus/i2c/devices/30-001f# cat hwmon/hwmon0/in0_max 0 root@yosemite4:/sys/bus/i2c/devices/30-001f# cat hwmon/hwmon0/in0_input 75 root@yosemite4:/sys/bus/i2c/devices/30-001f# cat hwmon/hwmon0/name adc128d818 ```
We initially configured 0b011110000000 for the first channel. The driver throws away the last 4 bits and does calculation similar to below:
``` val = DIV_ROUND_CLOSEST(data->in[index][nr] * data->vref, 4095); ``` We can check that the calculation is as expected given our configured value. ``` ((0b011110000000 >> 4) * 2560) / 4095 75.01831501831502 ```
References:
[1] https://www.ti.com/product/ADC128D818
[2] https://www.ti.com/lit/gpn/adc128d818
--- hw/arm/Kconfig | 1 + hw/sensor/Kconfig | 4 + hw/sensor/adc128d818.c | 414 +++++++++++++++++++++++++++++++++ hw/sensor/meson.build | 1 + hw/sensor/trace-events | 8 + include/hw/sensor/adc128d818.h | 20 ++ 6 files changed, 448 insertions(+) create mode 100644 hw/sensor/adc128d818.c create mode 100644 include/hw/sensor/adc128d818.h
hw/arm/Kconfig +1 -0
@@ -553,6 +553,7 @@ config ASPEED_SOC select MAX31785 select MAX31790 select MAX11615 + select ADC128D818 select FSI_APB2OPB_ASPEED select AT24C select PCI_EXPRESS
hw/sensor/Kconfig +4 -0
@@ -51,3 +51,7 @@ config MAX31790 config MAX11615 bool depends on I2C + +config ADC128D818 + bool + depends on I2C
hw/sensor/adc128d818.c new file +414 -0
414 lines not on this page · raw message
hw/sensor/meson.build +1 -0
@@ -10,3 +10,4 @@ system_ss.add(when: 'CONFIG_ISL_PMBUS_VR', if_true: files('isl_pmbus_vr.c')) system_ss.add(when: 'CONFIG_MAX31785', if_true: files('max31785.c')) system_ss.add(when: 'CONFIG_MAX31790', if_true: files('max31790.c')) system_ss.add(when: 'CONFIG_MAX11615', if_true: files('max11615.c')) +system_ss.add(when: 'CONFIG_ADC128D818', if_true: files('adc128d818.c'))
hw/sensor/trace-events +8 -0
@@ -20,3 +20,11 @@ max11615_recv(uint8_t i2c_addr, uint8_t reg_addr) "i2c_addr: 0x%02x, reg_addr: 0 max11615_recv_return(uint8_t i2c_addr, uint8_t data) "i2c_addr: 0x%02x, returns: 0x%02x" max11615_event(uint8_t i2c_addr, uint8_t event) "i2c_addr: 0x%02x, event: 0x%02x" max11615_realize(uint8_t i2c_addr) "i2c_addr: 0x%02x" + +# adc128d818.c +adc128d818_send(uint8_t i2c_addr, uint8_t data) "i2c_addr: 0x%02x, data: 0x%02x" +adc128d818_write(uint8_t i2c_addr, uint8_t reg, uint8_t data) "i2c_addr: 0x%02x, reg: 0x%02x data: 0x%02x" +adc128d818_recv(uint8_t i2c_addr, uint8_t reg) "i2c_addr: 0x%02x, reg: 0x%02x" +adc128d818_recv_return(uint8_t i2c_addr, uint8_t data) "i2c_addr: 0x%02x, returns: 0x%02x" +adc128d818_event(uint8_t i2c_addr, uint8_t event) "i2c_addr: 0x%02x, event: 0x%02x" +adc128d818_realize(uint8_t i2c_addr) "i2c_addr: 0x%02x"
include/hw/sensor/adc128d818.h new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#ifndef QEMU_ADC128D818_H +#define QEMU_ADC128D818_H + +#include <stdint.h> +#include "hw/i2c/i2c.h" + +#define TYPE_ADC128D818 "adc128d818" + +/* +* Create and realize a adc128d818 ADC with constant caller-supplied readings +* @bus: I2C bus to put it on +* @address: I2C address +* @init_values: array of readings for each ADC channel +* @init_values_size: Size of @init_values, can be less than the number of channels +*/ +I2CSlave *adc128d818_init_with_values (I2CBus *bus,uint8_t address, +const uint16_t *init_values,uint32_t init_values_size); + +#endif
Signature · 1 line
2.54.0
PATCH v2 4/4 ast2600: yosemite4 initial support
In reply to Alexander HansenInitial patch based on [1] to support yosemite v4 bmc emulation.
The goal of this machine support is to support OpenBMC development.
Reference linux devicetree from openbmc linux is [2].
Status:
- Enclosure FRU: showing up - Management Board FRU: showing up - Blade Board FRU: showing up - Blade Board sensors: not implemented - Blade Chassis FRU: showing up - Fan Board FRU: both showing up - Fan Board sensors: supported
Overall the emulation is incomplete but already helpful in development and testing.
The focus of this initial support is on the FRU eeproms and fanboard sensors.
Tested: booted an OpenBMC image for yosemite4 target.
Tested: functional test (see [5] for the image) passed.
``` export QEMU_TEST_QEMU_BINARY=qemu-system-arm ./build/run tests/functional/arm/test_aspeed_fby4.py TAP version 13 ok 1 test_aspeed_fby4.YosemiteV4Machine.test_arm_ast2600_yosemitev4_openbmc 1..1 ```
References:
[1] https://github.com/9elements/qemu/commit/32139f913c2bd0ebe4bd26c46765861f6f9f2d49
[2] arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts
[3] https://github.com/legoater/qemu-aspeed-boot/pull/5
--- hw/arm/aspeed_ast2600_fby4.c | 289 +++++++++++++++++++++++ hw/arm/meson.build | 1 + tests/functional/arm/meson.build | 2 + tests/functional/arm/test_aspeed_fby4.py | 44 ++++ 4 files changed, 336 insertions(+) create mode 100644 hw/arm/aspeed_ast2600_fby4.c create mode 100755 tests/functional/arm/test_aspeed_fby4.py
hw/arm/aspeed_ast2600_fby4.c new file +289 -0
@@ -0,0 +1,289 @@ +/* +* Yosemite V4 +* +* Copyright 2026 9elements. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/arm/machines-qom.h" +#include "hw/arm/aspeed.h" +#include "hw/arm/aspeed_soc.h" +#include "hw/nvram/eeprom_at24c.h" +#include "hw/sensor/tmp105.h" +#include "hw/sensor/max31790.h" +#include "hw/sensor/max11615.h" +#include "hw/sensor/adc128d818.h" +#include "hw/i2c/i2c_mux_pca954x.h" +#include "hw/gpio/pca9552.h" +#include "system/reset.h" + +#define FBY4_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) + +/* START OF EEPROM CONTENTS */ + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Fan Board FSC-MAX ADC-TI LED-NXP EFUSE-MAX" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set product.custom="Fanboard Custom1" \ +* --set product.custom.1="Fanboard Custom2" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-fanboard.bin +*/ +/* EM Config: yosemite4_fanboard_fsc_max_adc_ti_led_nxp_ons_efuse_max.json */ +/* Yosemite4 fan board */ +static const uint8_t fru_yv4_fanboard_bin[] = { +0x01 ,0x00 ,0x00 ,0x01 ,0x0b ,0x00 ,0x00 ,0xf3 ,0x01 ,0x0a ,0x19 ,0xce , +0xc2 ,0xa8 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xea ,0x46 ,0x61 , +0x6e ,0x20 ,0x42 ,0x6f ,0x61 ,0x72 ,0x64 ,0x20 ,0x46 ,0x53 ,0x43 ,0x2d , +0x4d ,0x41 ,0x58 ,0x20 ,0x41 ,0x44 ,0x43 ,0x2d ,0x54 ,0x49 ,0x20 ,0x4c , +0x45 ,0x44 ,0x2d ,0x4e ,0x58 ,0x50 ,0x20 ,0x45 ,0x46 ,0x55 ,0x53 ,0x45 , +0x2d ,0x4d ,0x41 ,0x58 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0xca ,0x42 , +0x52 ,0x44 ,0x2d ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc0 ,0xc1 ,0x00 , +0x00 ,0x00 ,0x00 ,0xdb ,0x01 ,0x09 ,0x19 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 , +0x6e ,0x6e ,0xcb ,0x59 ,0x6f ,0x73 ,0x65 ,0x6d ,0x69 ,0x74 ,0x65 ,0x20 , +0x56 ,0x34 ,0xc6 ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc4 ,0x76 ,0x31 , +0x2e ,0x31 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0x89 ,0x30 ,0x1b ,0x8e , +0x25 ,0xfa ,0xb2 ,0x64 ,0x29 ,0x03 ,0xc0 ,0xd0 ,0x46 ,0x61 ,0x6e ,0x62 , +0x6f ,0x61 ,0x72 ,0x64 ,0x20 ,0x43 ,0x75 ,0x73 ,0x74 ,0x6f ,0x6d ,0x32 , +0xc1 ,0x00 ,0x00 ,0x9d +}; +static const size_t fru_yv4_fanboard_bin_len =sizeof (fru_yv4_fanboard_bin); + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Sentinel Dome without Retimer" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set product.custom="Yosemite V4 T1" \ +* --set product.custom.1="Yosemite V4 T1" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-sentineldome-board.bin +*/ +/* product.cust maps to PRODUCT_INFO_AM2 */ +/* EM Config: yosemite4_sentineldome_t1.json */ +/* Yosemite4 Sentinel Dome without Retimer Boards */ +static const uint8_t fru_yv4_sentineldome_board_bin[] = { +0x01 ,0x00 ,0x00 ,0x01 ,0x09 ,0x00 ,0x00 ,0xf5 ,0x01 ,0x08 ,0x19 ,0xce , +0xc2 ,0xa8 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xdd ,0x53 ,0x65 , +0x6e ,0x74 ,0x69 ,0x6e ,0x65 ,0x6c ,0x20 ,0x44 ,0x6f ,0x6d ,0x65 ,0x20 , +0x77 ,0x69 ,0x74 ,0x68 ,0x6f ,0x75 ,0x74 ,0x20 ,0x52 ,0x65 ,0x74 ,0x69 , +0x6d ,0x65 ,0x72 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0xca ,0x42 ,0x52 , +0x44 ,0x2d ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc0 ,0xc1 ,0x00 ,0x78 , +0x01 ,0x09 ,0x19 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xcb ,0x59 , +0x6f ,0x73 ,0x65 ,0x6d ,0x69 ,0x74 ,0x65 ,0x20 ,0x56 ,0x34 ,0xc6 ,0x50 , +0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc4 ,0x76 ,0x31 ,0x2e ,0x31 ,0x85 ,0x91 , +0x34 ,0x51 ,0x95 ,0x05 ,0x89 ,0x30 ,0x1b ,0x8e ,0x25 ,0xfa ,0xb2 ,0x64 , +0x29 ,0x03 ,0xc0 ,0xce ,0x59 ,0x6f ,0x73 ,0x65 ,0x6d ,0x69 ,0x74 ,0x65 , +0x20 ,0x56 ,0x34 ,0x20 ,0x54 ,0x31 ,0xc1 ,0x00 ,0x00 ,0x00 ,0x00 ,0xeb +}; +static const size_t fru_yv4_sentineldome_board_bin_len = +sizeof (fru_yv4_sentineldome_board_bin); + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Sentinel Dome" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-sentineldome-chassis.bin +*/ +/* EM Config: yosemite4_sentineldome_chassis.json */ +/* Yosemite 4 Sentinel Dome Chassis FRU */ +static const uint8_t fru_yv4_sentineldome_chassis_bin[] = { +0x01 ,0x00 ,0x00 ,0x01 ,0x07 ,0x00 ,0x00 ,0xf7 ,0x01 ,0x06 ,0x19 ,0xce , +0xc2 ,0xa8 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xcd ,0x53 ,0x65 , +0x6e ,0x74 ,0x69 ,0x6e ,0x65 ,0x6c ,0x20 ,0x44 ,0x6f ,0x6d ,0x65 ,0x85 , +0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0xca ,0x42 ,0x52 ,0x44 ,0x2d ,0x50 ,0x4e , +0x2d ,0x33 ,0x34 ,0x35 ,0xc0 ,0xc1 ,0x00 ,0xb6 ,0x01 ,0x07 ,0x19 ,0xc6 , +0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xcb ,0x59 ,0x6f ,0x73 ,0x65 ,0x6d , +0x69 ,0x74 ,0x65 ,0x20 ,0x56 ,0x34 ,0xc6 ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 , +0x35 ,0xc4 ,0x76 ,0x31 ,0x2e ,0x31 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 , +0x89 ,0x30 ,0x1b ,0x8e ,0x25 ,0xfa ,0xb2 ,0x64 ,0x29 ,0x03 ,0xc0 ,0xc1 , +0x00 ,0x00 ,0x00 ,0x59 +}; +static const size_t fru_yv4_sentineldome_chassis_bin_len = +sizeof (fru_yv4_sentineldome_chassis_bin); + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Management Board wBMC" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-eclosure.bin +*/ +/* EM Config: yosemite4_chassis.json, yosemite4.json */ +/* Yosemite 4 Sentinel Dome Enclosure FRU */ +static const uint8_t fru_yv4_eclosure_bin[] = { +0x01 ,0x00 ,0x00 ,0x01 ,0x08 ,0x00 ,0x00 ,0xf6 ,0x01 ,0x07 ,0x19 ,0xce , +0xc2 ,0xa8 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xd5 ,0x4d ,0x61 , +0x6e ,0x61 ,0x67 ,0x65 ,0x6d ,0x65 ,0x6e ,0x74 ,0x20 ,0x42 ,0x6f ,0x61 , +0x72 ,0x64 ,0x20 ,0x77 ,0x42 ,0x4d ,0x43 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 , +0x05 ,0xca ,0x42 ,0x52 ,0x44 ,0x2d ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 , +0xc0 ,0xc1 ,0x00 ,0x26 ,0x01 ,0x07 ,0x19 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 , +0x6e ,0x6e ,0xcb ,0x59 ,0x6f ,0x73 ,0x65 ,0x6d ,0x69 ,0x74 ,0x65 ,0x20 , +0x56 ,0x34 ,0xc6 ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc4 ,0x76 ,0x31 , +0x2e ,0x31 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0x89 ,0x30 ,0x1b ,0x8e , +0x25 ,0xfa ,0xb2 ,0x64 ,0x29 ,0x03 ,0xc0 ,0xc1 ,0x00 ,0x00 ,0x00 ,0x59 +}; +static const size_t fru_yv4_eclosure_bin_len =sizeof (fru_yv4_eclosure_bin); + +/* END OF EEPROM CONTENTS */ + +static void fby4_i2c_init_fanboard (I2CSlave *fan_mux,size_t eepromSize) +{ +/* 2 fan boards */ +for (int i =0 ; i <=1 ; i++) { +/* downstream bus */ +I2CBus *bus =pca954x_i2c_get_bus (fan_mux, i); + +/* ti,adc128d818 @ 0x1f (adc) */ +/* the driver will throw away the last 4 bits, set them 0 */ +static const uint16_t adc_values1[8 ] = { +0b011110000000 ,0b010100010000 , +0b001000110000 ,0b100000100000 , +0b011110000000 ,0b010100010000 , +0b001000110000 ,0b100000100000 }; +adc128d818_init_with_values (bus,0x1f , adc_values1,8 ); + +/* maxim,max31790 @ 0x20 (pwm) */ +i2c_slave_create_simple (bus,TYPE_MAX31790 ,0x20 ); + +/* +* ti,tca6424 @ 0x22 (gpio) +* linux handles tca6424 with PCA953X_TYPE, same as pca9535 +* { "pca9535", 16 | PCA953X_TYPE | PCA_INT, }, +* { "tca6424", 24 | PCA953X_TYPE | PCA_INT, }, +* so we _could_ be fine here unless more than 16 gpios are used +*/ +i2c_slave_create_simple (bus,TYPE_PCA9535 ,0x22 ); + +/* +* NOTE: above works and could use for gpio presence: +* $ gpioget gpiochip2 2 +* 1 +*/ + +/* maxim,max31790 @ 0x2f (pwm) */ +i2c_slave_create_simple (bus,TYPE_MAX31790 ,0x2f ); + +/* maxim,max11615 @ 0x33 (adc) */ +static const uint16_t adc_values[8 ] = { +0b011110000010 ,0b010100011000 , +0b001000110100 ,0b100000101001 , +0b011110000010 ,0b010100011000 , +0b001000110100 ,0b100000101001 }; +max11615_init_with_values (bus,0x33 , adc_values,8 ); + +at24c_eeprom_init_rom ( + bus,0x52 , eepromSize, + fru_yv4_fanboard_bin, + fru_yv4_fanboard_bin_len); + +/* LED blink driver / gpio expander */ +/* nxp,pca9552 @ 0x61 (gpio) */ +i2c_slave_create_simple (bus,TYPE_PCA9552 ,0x61 ); + } +} + +static void fby4_i2c_init_blade_chassis (I2CBus *bus,size_t eepromSize) +{ +/* Sentinel Dome Blade EEPROMS */ + +/* Board */ +at24c_eeprom_init_rom (bus,0x54 , eepromSize, + fru_yv4_sentineldome_board_bin, fru_yv4_sentineldome_board_bin_len); + +/* Chassis */ +at24c_eeprom_init_rom (bus,0x55 , eepromSize, + fru_yv4_sentineldome_chassis_bin, fru_yv4_sentineldome_chassis_bin_len); +} + +static void fby4_i2c_init_multiple_blade_chassis (I2CBus **i2c, +size_t eepromSize) +{ +/* there is 8 blade chassis, but we only emulate 2 for performance reason */ +for (int bus =1 ; bus <= (8 /4 ); bus++) { + +fby4_i2c_init_blade_chassis (i2c[bus], eepromSize); + } +} + +static void fby4_i2c_init (AspeedMachineState *bmc) +{ +AspeedSoCState *soc = bmc->soc; +I2CBus *i2c[16 ]; + +for (int i =0 ; i <16 ; i++) { + i2c[i] =aspeed_i2c_get_bus (&soc->i2c, i); + } + +const size_t eepromSize =128 * KiB; + +const uint8_t enclosure_addr =0x51 ; + +/* Enclosure (EM Config: yosemite4_chassis.json, yosemite4.json) */ +at24c_eeprom_init_rom (i2c[1 ], enclosure_addr, eepromSize, + fru_yv4_eclosure_bin, fru_yv4_eclosure_bin_len); + +fby4_i2c_init_multiple_blade_chassis (i2c, eepromSize); + +/* Yv4 fanboard connection */ +I2CSlave *fan_mux =i2c_slave_create_simple (i2c[14 ],TYPE_PCA9546 ,0x74 ); + +fby4_i2c_init_fanboard (fan_mux, eepromSize); +} + +static void aspeed_machine_fby4_class_init (ObjectClass *oc,const void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="Facebook fby4 BMC (Cortex-A7)" ; + amc->fmc_model ="mx66l1g45g" ; + amc->num_cs =2 ; + amc->macs_mask =ASPEED_MAC3_ON ; + amc->i2c_init = fby4_i2c_init; + mc->default_ram_size =FBY4_BMC_RAM_SIZE ; +aspeed_machine_class_init_cpus_defaults (mc); +} + +static const TypeInfo aspeed_ast2600_fby4_types[] = { + { + .name =MACHINE_TYPE_NAME ("fby4-bmc" ), + .parent =MACHINE_TYPE_NAME ("ast2600-evb" ), + .class_init = aspeed_machine_fby4_class_init, + .interfaces = arm_machine_interfaces, + } +}; + +DEFINE_TYPES (aspeed_ast2600_fby4_types)
hw/arm/meson.build +1 -0
@@ -60,6 +60,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_ast2600_catalina.c', 'aspeed_ast2600_evb.c', 'aspeed_ast2600_fby35.c', + 'aspeed_ast2600_fby4.c', 'aspeed_ast2600_fuji.c', 'aspeed_ast2600_gb200nvl.c', 'aspeed_ast2600_qcom-dc-scm-v1.c',
tests/functional/arm/meson.build +2 -0
@@ -14,6 +14,7 @@ test_arm_timeouts = { 'aspeed_ast2600_sdk_otp' : 720, 'aspeed_bletchley' : 480, 'aspeed_catalina' : 480, + 'aspeed_fby4': 480, 'aspeed_gb200nvl_bmc' : 480, 'aspeed_rainier' : 480, 'bpim2u' : 500,
@@ -47,6 +48,7 @@ tests_arm_system_thorough = [ 'aspeed_ast2600_sdk_otp', 'aspeed_bletchley', 'aspeed_catalina', + 'aspeed_fby4', 'aspeed_gb200nvl_bmc', 'aspeed_rainier', 'bpim2u',
tests/functional/arm/test_aspeed_fby4.py new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.54.0
Re: [PATCH v2 4/4] ast2600: yosemite4 initial support
Hello Alexander,
Could you please cc: me on the whole series ? I'd like to see what the rest is about. However, I am not the sensor maintainer, Titus is.
Quoted 18 lines · Alexander Hansen
Initial patch based on [1] to support yosemite v4 bmc emulation.
The goal of this machine support is to support OpenBMC development.
Reference linux devicetree from openbmc linux is [2].
Status:
- Enclosure FRU: showing up - Management Board FRU: showing up - Blade Board FRU: showing up - Blade Board sensors: not implemented - Blade Chassis FRU: showing up - Fan Board FRU: both showing up - Fan Board sensors: supportedOverall the emulation is incomplete but already helpful in development and testing.
Quoted 8 lines
The focus of this initial support is on the FRU eeproms and fanboard sensors.
Tested: booted an OpenBMC image for yosemite4 target.
Tested: functional test (see [5] for the image) passed.
```
Please remove the markdown annotations. This is a git commit log.
Quoted 23 lines
export QEMU_TEST_QEMU_BINARY=qemu-system-arm
./build/runtests/functional/arm/test_aspeed_fby4.py
TAP version 13
ok 1 test_aspeed_fby4.YosemiteV4Machine.test_arm_ast2600_yosemitev4_openbmc 1..1
```References:
[1] https://github.com/9elements/qemu/commit/32139f913c2bd0ebe4bd26c46765861f6f9f2d49
[2]arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts
[3] https://github.com/legoater/qemu-aspeed-boot/pull/5Cc "Cédric Le Goater" <[email protected]> (maintainer:ASPEED BMCs)Cc Peter Maydell <[email protected]> (maintainer:ASPEED BMCs)Cc Steven Lee <[email protected]> (reviewer:ASPEED BMCs)Cc Troy Lee <[email protected]> (reviewer:ASPEED BMCs)Cc Jamin Lin <[email protected]> (reviewer:ASPEED BMCs)Cc Kane Chen <[email protected]> (reviewer:ASPEED BMCs)Cc Andrew Jeffery <[email protected]> (reviewer:ASPEED BMCs)Cc Joel Stanley <[email protected]> (reviewer:ASPEED BMCs)Cc [email protected] (open list:ASPEED BMCs)Cc [email protected] (open list:All patches CC here)Signed-off-by Alexander Hansen <[email protected]>
Quoted 5 lines
--- hw/arm/aspeed_ast2600_fby4.c | 289 +++++++++++++++++++++++ hw/arm/meson.build | 1 + tests/functional/arm/meson.build | 2 + tests/functional/arm/test_aspeed_fby4.py | 44 ++++
I would prefer the functional test to be proposed in its own patch.
The machine looks good. Just a few minor comments.
Quoted 21 lines
4 files changed, 336 insertions(+)create mode 100644
hw/arm/aspeed_ast2600_fby4.ccreate mode 100755tests/functional/arm/test_aspeed_fby4.pyhw/arm/aspeed_ast2600_fby4.c new file +11
-0@@ -0,0 +1,289 @@ +/* +* Yosemite V4 +* +* Copyright 2026 9elements. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/arm/machines-qom.h"
hw/arm/aspeed_ast2600_fby4.c line 21
Quoted 10 lines
hw/arm/aspeed_ast2600_fby4.c new file +10
-0+#include "hw/arm/aspeed.h" +#include "hw/arm/aspeed_soc.h" +#include "hw/nvram/eeprom_at24c.h" +#include "hw/sensor/tmp105.h" +#include "hw/sensor/max31790.h" +#include "hw/sensor/max11615.h" +#include "hw/sensor/adc128d818.h" +#include "hw/i2c/i2c_mux_pca954x.h" +#include "hw/gpio/pca9552.h" +#include "system/reset.h"
I don't think this include is needed.
Quoted 205 lines
hw/arm/aspeed_ast2600_fby4.c new file +205
-0+ +#define FBY4_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) + +/* START OF EEPROM CONTENTS */ + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Fan Board FSC-MAX ADC-TI LED-NXP EFUSE-MAX" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set product.custom="Fanboard Custom1" \ +* --set product.custom.1="Fanboard Custom2" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-fanboard.bin +*/ +/* EM Config: yosemite4_fanboard_fsc_max_adc_ti_led_nxp_ons_efuse_max.json */ +/* Yosemite4 fan board */ +static const uint8_t fru_yv4_fanboard_bin[] = { +0x01 ,0x00 ,0x00 ,0x01 ,0x0b ,0x00 ,0x00 ,0xf3 ,0x01 ,0x0a ,0x19 ,0xce , +0xc2 ,0xa8 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xea ,0x46 ,0x61 , +0x6e ,0x20 ,0x42 ,0x6f ,0x61 ,0x72 ,0x64 ,0x20 ,0x46 ,0x53 ,0x43 ,0x2d , +0x4d ,0x41 ,0x58 ,0x20 ,0x41 ,0x44 ,0x43 ,0x2d ,0x54 ,0x49 ,0x20 ,0x4c , +0x45 ,0x44 ,0x2d ,0x4e ,0x58 ,0x50 ,0x20 ,0x45 ,0x46 ,0x55 ,0x53 ,0x45 , +0x2d ,0x4d ,0x41 ,0x58 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0xca ,0x42 , +0x52 ,0x44 ,0x2d ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc0 ,0xc1 ,0x00 , +0x00 ,0x00 ,0x00 ,0xdb ,0x01 ,0x09 ,0x19 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 , +0x6e ,0x6e ,0xcb ,0x59 ,0x6f ,0x73 ,0x65 ,0x6d ,0x69 ,0x74 ,0x65 ,0x20 , +0x56 ,0x34 ,0xc6 ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc4 ,0x76 ,0x31 , +0x2e ,0x31 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0x89 ,0x30 ,0x1b ,0x8e , +0x25 ,0xfa ,0xb2 ,0x64 ,0x29 ,0x03 ,0xc0 ,0xd0 ,0x46 ,0x61 ,0x6e ,0x62 , +0x6f ,0x61 ,0x72 ,0x64 ,0x20 ,0x43 ,0x75 ,0x73 ,0x74 ,0x6f ,0x6d ,0x32 , +0xc1 ,0x00 ,0x00 ,0x9d +}; +static const size_t fru_yv4_fanboard_bin_len =sizeof (fru_yv4_fanboard_bin); + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Sentinel Dome without Retimer" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set product.custom="Yosemite V4 T1" \ +* --set product.custom.1="Yosemite V4 T1" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-sentineldome-board.bin +*/ +/* product.cust maps to PRODUCT_INFO_AM2 */ +/* EM Config: yosemite4_sentineldome_t1.json */ +/* Yosemite4 Sentinel Dome without Retimer Boards */ +static const uint8_t fru_yv4_sentineldome_board_bin[] = { +0x01 ,0x00 ,0x00 ,0x01 ,0x09 ,0x00 ,0x00 ,0xf5 ,0x01 ,0x08 ,0x19 ,0xce , +0xc2 ,0xa8 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xdd ,0x53 ,0x65 , +0x6e ,0x74 ,0x69 ,0x6e ,0x65 ,0x6c ,0x20 ,0x44 ,0x6f ,0x6d ,0x65 ,0x20 , +0x77 ,0x69 ,0x74 ,0x68 ,0x6f ,0x75 ,0x74 ,0x20 ,0x52 ,0x65 ,0x74 ,0x69 , +0x6d ,0x65 ,0x72 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0xca ,0x42 ,0x52 , +0x44 ,0x2d ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc0 ,0xc1 ,0x00 ,0x78 , +0x01 ,0x09 ,0x19 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xcb ,0x59 , +0x6f ,0x73 ,0x65 ,0x6d ,0x69 ,0x74 ,0x65 ,0x20 ,0x56 ,0x34 ,0xc6 ,0x50 , +0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc4 ,0x76 ,0x31 ,0x2e ,0x31 ,0x85 ,0x91 , +0x34 ,0x51 ,0x95 ,0x05 ,0x89 ,0x30 ,0x1b ,0x8e ,0x25 ,0xfa ,0xb2 ,0x64 , +0x29 ,0x03 ,0xc0 ,0xce ,0x59 ,0x6f ,0x73 ,0x65 ,0x6d ,0x69 ,0x74 ,0x65 , +0x20 ,0x56 ,0x34 ,0x20 ,0x54 ,0x31 ,0xc1 ,0x00 ,0x00 ,0x00 ,0x00 ,0xeb +}; +static const size_t fru_yv4_sentineldome_board_bin_len = +sizeof (fru_yv4_sentineldome_board_bin); + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Sentinel Dome" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-sentineldome-chassis.bin +*/ +/* EM Config: yosemite4_sentineldome_chassis.json */ +/* Yosemite 4 Sentinel Dome Chassis FRU */ +static const uint8_t fru_yv4_sentineldome_chassis_bin[] = { +0x01 ,0x00 ,0x00 ,0x01 ,0x07 ,0x00 ,0x00 ,0xf7 ,0x01 ,0x06 ,0x19 ,0xce , +0xc2 ,0xa8 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xcd ,0x53 ,0x65 , +0x6e ,0x74 ,0x69 ,0x6e ,0x65 ,0x6c ,0x20 ,0x44 ,0x6f ,0x6d ,0x65 ,0x85 , +0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0xca ,0x42 ,0x52 ,0x44 ,0x2d ,0x50 ,0x4e , +0x2d ,0x33 ,0x34 ,0x35 ,0xc0 ,0xc1 ,0x00 ,0xb6 ,0x01 ,0x07 ,0x19 ,0xc6 , +0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xcb ,0x59 ,0x6f ,0x73 ,0x65 ,0x6d , +0x69 ,0x74 ,0x65 ,0x20 ,0x56 ,0x34 ,0xc6 ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 , +0x35 ,0xc4 ,0x76 ,0x31 ,0x2e ,0x31 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 , +0x89 ,0x30 ,0x1b ,0x8e ,0x25 ,0xfa ,0xb2 ,0x64 ,0x29 ,0x03 ,0xc0 ,0xc1 , +0x00 ,0x00 ,0x00 ,0x59 +}; +static const size_t fru_yv4_sentineldome_chassis_bin_len = +sizeof (fru_yv4_sentineldome_chassis_bin); + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Management Board wBMC" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-eclosure.bin +*/ +/* EM Config: yosemite4_chassis.json, yosemite4.json */ +/* Yosemite 4 Sentinel Dome Enclosure FRU */ +static const uint8_t fru_yv4_eclosure_bin[] = { +0x01 ,0x00 ,0x00 ,0x01 ,0x08 ,0x00 ,0x00 ,0xf6 ,0x01 ,0x07 ,0x19 ,0xce , +0xc2 ,0xa8 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 ,0x6e ,0x6e ,0xd5 ,0x4d ,0x61 , +0x6e ,0x61 ,0x67 ,0x65 ,0x6d ,0x65 ,0x6e ,0x74 ,0x20 ,0x42 ,0x6f ,0x61 , +0x72 ,0x64 ,0x20 ,0x77 ,0x42 ,0x4d ,0x43 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 , +0x05 ,0xca ,0x42 ,0x52 ,0x44 ,0x2d ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 , +0xc0 ,0xc1 ,0x00 ,0x26 ,0x01 ,0x07 ,0x19 ,0xc6 ,0x57 ,0x69 ,0x77 ,0x79 , +0x6e ,0x6e ,0xcb ,0x59 ,0x6f ,0x73 ,0x65 ,0x6d ,0x69 ,0x74 ,0x65 ,0x20 , +0x56 ,0x34 ,0xc6 ,0x50 ,0x4e ,0x2d ,0x33 ,0x34 ,0x35 ,0xc4 ,0x76 ,0x31 , +0x2e ,0x31 ,0x85 ,0x91 ,0x34 ,0x51 ,0x95 ,0x05 ,0x89 ,0x30 ,0x1b ,0x8e , +0x25 ,0xfa ,0xb2 ,0x64 ,0x29 ,0x03 ,0xc0 ,0xc1 ,0x00 ,0x00 ,0x00 ,0x59 +}; +static const size_t fru_yv4_eclosure_bin_len =sizeof (fru_yv4_eclosure_bin); + +/* END OF EEPROM CONTENTS */ + +static void fby4_i2c_init_fanboard (I2CSlave *fan_mux,size_t eepromSize) +{ +/* 2 fan boards */ +for (int i =0 ; i <=1 ; i++) { +/* downstream bus */ +I2CBus *bus =pca954x_i2c_get_bus (fan_mux, i); + +/* ti,adc128d818 @ 0x1f (adc) */ +/* the driver will throw away the last 4 bits, set them 0 */ +static const uint16_t adc_values1[8 ] = { +0b011110000000 ,0b010100010000 , +0b001000110000 ,0b100000100000 , +0b011110000000 ,0b010100010000 , +0b001000110000 ,0b100000100000 }; +adc128d818_init_with_values (bus,0x1f , adc_values1,8 ); + +/* maxim,max31790 @ 0x20 (pwm) */ +i2c_slave_create_simple (bus,TYPE_MAX31790 ,0x20 ); + +/* +* ti,tca6424 @ 0x22 (gpio) +* linux handles tca6424 with PCA953X_TYPE, same as pca9535 +* { "pca9535", 16 | PCA953X_TYPE | PCA_INT, }, +* { "tca6424", 24 | PCA953X_TYPE | PCA_INT, }, +* so we _could_ be fine here unless more than 16 gpios are used +*/ +i2c_slave_create_simple (bus,TYPE_PCA9535 ,0x22 ); + +/* +* NOTE: above works and could use for gpio presence: +* $ gpioget gpiochip2 2 +* 1 +*/ + +/* maxim,max31790 @ 0x2f (pwm) */ +i2c_slave_create_simple (bus,TYPE_MAX31790 ,0x2f ); + +/* maxim,max11615 @ 0x33 (adc) */ +static const uint16_t adc_values[8 ] = { +0b011110000010 ,0b010100011000 , +0b001000110100 ,0b100000101001 , +0b011110000010 ,0b010100011000 , +0b001000110100 ,0b100000101001 }; +max11615_init_with_values (bus,0x33 , adc_values,8 ); + +at24c_eeprom_init_rom ( + bus,0x52 , eepromSize, + fru_yv4_fanboard_bin, + fru_yv4_fanboard_bin_len); + +/* LED blink driver / gpio expander */ +/* nxp,pca9552 @ 0x61 (gpio) */ +i2c_slave_create_simple (bus,TYPE_PCA9552 ,0x61 ); + } +} + +static void fby4_i2c_init_blade_chassis (I2CBus *bus,size_t eepromSize) +{ +/* Sentinel Dome Blade EEPROMS */ + +/* Board */ +at24c_eeprom_init_rom (bus,0x54 , eepromSize, + fru_yv4_sentineldome_board_bin, fru_yv4_sentineldome_board_bin_len); + +/* Chassis */
hw/arm/aspeed_ast2600_fby4.c line 236
Quoted 10 lines
hw/arm/aspeed_ast2600_fby4.c new file +10
-0+at24c_eeprom_init_rom (bus,0x55 , eepromSize, + fru_yv4_sentineldome_chassis_bin, fru_yv4_sentineldome_chassis_bin_len); +} + +static void fby4_i2c_init_multiple_blade_chassis (I2CBus **i2c, +size_t eepromSize) +{ +/* there is 8 blade chassis, but we only emulate 2 for performance reason */ +for (int bus =1 ; bus <= (8 /4 ); bus++) { +
Extra line.
Quoted 6 lines
hw/arm/aspeed_ast2600_fby4.c new file +6
-0+fby4_i2c_init_blade_chassis (i2c[bus], eepromSize); + } +} + +static void fby4_i2c_init (AspeedMachineState *bmc) +{
hw/arm/aspeed_ast2600_fby4.c line 252
Quoted 10 lines
hw/arm/aspeed_ast2600_fby4.c new file +10
-0+AspeedSoCState *soc = bmc->soc; +I2CBus *i2c[16 ]; + +for (int i =0 ; i <16 ; i++) { + i2c[i] =aspeed_i2c_get_bus (&soc->i2c, i); + } + +const size_t eepromSize =128 * KiB; + +const uint8_t enclosure_addr =0x51 ;
These variables seem superflous.
Quoted 80 lines
hw/arm/aspeed_ast2600_fby4.c new file +37
-0+ +/* Enclosure (EM Config: yosemite4_chassis.json, yosemite4.json) */ +at24c_eeprom_init_rom (i2c[1 ], enclosure_addr, eepromSize, + fru_yv4_eclosure_bin, fru_yv4_eclosure_bin_len); + +fby4_i2c_init_multiple_blade_chassis (i2c, eepromSize); + +/* Yv4 fanboard connection */ +I2CSlave *fan_mux =i2c_slave_create_simple (i2c[14 ],TYPE_PCA9546 ,0x74 ); + +fby4_i2c_init_fanboard (fan_mux, eepromSize); +} + +static void aspeed_machine_fby4_class_init (ObjectClass *oc,const void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="Facebook fby4 BMC (Cortex-A7)" ; + amc->fmc_model ="mx66l1g45g" ; + amc->num_cs =2 ; + amc->macs_mask =ASPEED_MAC3_ON ; + amc->i2c_init = fby4_i2c_init; + mc->default_ram_size =FBY4_BMC_RAM_SIZE ; +aspeed_machine_class_init_cpus_defaults (mc); +} + +static const TypeInfo aspeed_ast2600_fby4_types[] = { + { + .name =MACHINE_TYPE_NAME ("fby4-bmc" ), + .parent =MACHINE_TYPE_NAME ("ast2600-evb" ), + .class_init = aspeed_machine_fby4_class_init, + .interfaces = arm_machine_interfaces, + } +}; + +DEFINE_TYPES (aspeed_ast2600_fby4_types)hw/arm/meson.build +1
-0@@ -60,6 +60,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_ast2600_catalina.c', 'aspeed_ast2600_evb.c', 'aspeed_ast2600_fby35.c', + 'aspeed_ast2600_fby4.c', 'aspeed_ast2600_fuji.c', 'aspeed_ast2600_gb200nvl.c', 'aspeed_ast2600_qcom-dc-scm-v1.c',tests/functional/arm/meson.build +2
-0@@ -14,6 +14,7 @@ test_arm_timeouts = { 'aspeed_ast2600_sdk_otp' : 720, 'aspeed_bletchley' : 480, 'aspeed_catalina' : 480, + 'aspeed_fby4': 480, 'aspeed_gb200nvl_bmc' : 480, 'aspeed_rainier' : 480, 'bpim2u' : 500,@@ -47,6 +48,7 @@ tests_arm_system_thorough = [ 'aspeed_ast2600_sdk_otp', 'aspeed_bletchley', 'aspeed_catalina', + 'aspeed_fby4', 'aspeed_gb200nvl_bmc', 'aspeed_rainier', 'bpim2u',tests/functional/arm/test_aspeed_fby4.py new file +5
-0@@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# +# Functional test that boots the ASPEED machines +# +# SPDX-License-Identifier: GPL-2.0-or-later
tests/functional/arm/test_aspeed_fby4.py line 15
Quoted 10 lines
tests/functional/arm/test_aspeed_fby4.py new file +10
-0+ +from qemu_test import Asset +from aspeed import AspeedTest + + +class YosemiteV4Machine(AspeedTest): + + ASSET_YOSEMITE_V4_FLASH = Asset( + 'https://github.com/pointbazaar/qemu-aspeed-boot/raw/3ef9a0d8cd2902c2039924ad1f16c8f2345486f3/images/yosemite4-bmc/openbmc-20260505132843/obmc-phosphor-image-yosemite4-20260505132843.static.mtd.xz', + 'dff6946363b41f952b15cfc3156482b89fcfc1b0ecfc3ec8b3ed496a5f001ef9')
Now that the yosemite4 image is merged in my image test tree, may be it is best to update the asset ? As you wish. Works like that too.
Quoted 16 lines
tests/functional/arm/test_aspeed_fby4.py new file +16
-0+ + def do_test_arm_aspeed_openbmc_no_network(self, machine, image, uboot, + cpu_id, soc): + + self.set_machine(machine) + self.vm.set_console() + self.vm.add_args('-drive', f'file={image},if=mtd,format=raw', + '-snapshot') + self.vm.launch() + + self.wait_for_console_pattern(f'U-Boot {uboot}') + self.wait_for_console_pattern('## Loading kernel from FIT Image') + self.wait_for_console_pattern('Starting kernel ...') + self.wait_for_console_pattern(f'Booting Linux on physical CPU {cpu_id}') + self.wait_for_console_pattern(f'ASPEED {soc}') + self.wait_for_console_pattern('/init as init process')
tests/functional/arm/test_aspeed_fby4.py line 41
Quoted 10 lines
tests/functional/arm/test_aspeed_fby4.py new file +10
-0+ # yosemite v4 does not emit the hostname log which is + # different from the other machines. + self.wait_for_console_pattern('yosemite4 login:') + + def test_arm_ast2600_yosemitev4_openbmc(self): + image_path = self.uncompress(self.ASSET_YOSEMITE_V4_FLASH) + + self.do_test_arm_aspeed_openbmc_no_network('fby4-bmc', image=image_path, + uboot='2019.04', cpu_id='0xf00', + soc='AST2600 rev A3')
I don't see any tests regarding the new sensor models.
The commit logs of patch 1-3 :
hw/sensor: MAX31790 support
hw/sensor: support MAX11615
hw/sensor: support Texas Instruments ADC128D818
contain Linux command sequences that could be included in this test case. Could you do that please ?
Also, for sensors, please cc:
Titus Rwantare <[email protected]>
and we will need new entries under MAINTAINERS.
Thanks,
C.
Re: [PATCH v2 4/4] ast2600: yosemite4 initial support
Hi Cedric,
thanks for your ongoing review :)
I sent v5, summary of changes:
- I CCd you and Titus on all the patches now.
- removed the backticks (markdown syntax) from my patches. I was used to this workflow since some other projects use commit linters which get tripped up by log outputs.
- restructured the series as you suggested (board, then functional test, then sensors)
- removed some unused includes on the machine file
- removed some unnecessary variables from the machine file
- linked to your github tree for the fw image for the functional test, since the image is now available there
- added new section for each sensor to the functional test with some command sequences and expected outputs
- added new entries in MAINTAINERS file for Titus for the individual sensors. Your maintenance of the fby4 seems to already be covered by existing regex.
Let me know in case there is extra tests i should write for the sensors other than the functional test.
I saw the tests/qtest/tmp105-test.c , would that be helpful for the new sensors as well to write a test like that?
Thanks,
Alexander
Quoted 544 lines · Cédric Le Goater
Hello Alexander,
Could you please cc: me on the whole series ? I'd like to see what the rest is about. However, I am not the sensor maintainer, Titus is.
Quoted 18 lines · Alexander Hansen
Initial patch based on [1] to support yosemite v4 bmc emulation.
The goal of this machine support is to support OpenBMC development.
Reference linux devicetree from openbmc linux is [2].
Status:
- Enclosure FRU: showing up
- Management Board FRU: showing up
- Blade Board FRU: showing up
- Blade Board sensors: not implemented
- Blade Chassis FRU: showing up
- Fan Board FRU: both showing up
- Fan Board sensors: supportedOverall the emulation is incomplete but already helpful in development and testing.
Quoted 8 lines
The focus of this initial support is on the FRU eeproms and fanboard sensors.
Tested: booted an OpenBMC image for yosemite4 target.
Tested: functional test (see [5] for the image) passed.
```
Please remove the markdown annotations. This is a git commit log.
Quoted 23 lines
export QEMU_TEST_QEMU_BINARY=qemu-system-arm
./build/runtests/functional/arm/test_aspeed_fby4.py
TAP version 13
ok 1 test_aspeed_fby4.YosemiteV4Machine.test_arm_ast2600_yosemitev4_openbmc 1..1
```References:
[1] https://github.com/9elements/qemu/commit/32139f913c2bd0ebe4bd26c46765861f6f9f2d49
[2]arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts
[3] https://github.com/legoater/qemu-aspeed-boot/pull/5Cc "Cédric Le Goater" <[email protected]> (maintainer:ASPEED BMCs)Cc Peter Maydell <[email protected]> (maintainer:ASPEED BMCs)Cc Steven Lee <[email protected]> (reviewer:ASPEED BMCs)Cc Troy Lee <[email protected]> (reviewer:ASPEED BMCs)Cc Jamin Lin <[email protected]> (reviewer:ASPEED BMCs)Cc Kane Chen <[email protected]> (reviewer:ASPEED BMCs)Cc Andrew Jeffery <[email protected]> (reviewer:ASPEED BMCs)Cc Joel Stanley <[email protected]> (reviewer:ASPEED BMCs)Cc [email protected] (open list:ASPEED BMCs)Cc [email protected] (open list:All patches CC here)Signed-off-by Alexander Hansen <[email protected]>Quoted 5 lines
---
hw/arm/aspeed_ast2600_fby4.c | 289 +++++++++++++++++++++++ hw/arm/meson.build | 1 + tests/functional/arm/meson.build | 2 +tests/functional/arm/test_aspeed_fby4.py| 44 ++++I would prefer the functional test to be proposed in its own patch.
The machine looks good. Just a few minor comments.
Quoted 21 lines
4 files changed, 336 insertions(+)create mode 100644
hw/arm/aspeed_ast2600_fby4.ccreate mode 100755tests/functional/arm/test_aspeed_fby4.pyhw/arm/aspeed_ast2600_fby4.c new file +11
-0@@ -0,0 +1,289 @@ +/* +* Yosemite V4 +* +* Copyright 2026 9elements. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/arm/machines-qom.h" hw/arm/aspeed_ast2600_fby4.c line 21
Quoted 10 lines
hw/arm/aspeed_ast2600_fby4.c new file +10
-0+#include "hw/arm/aspeed.h" +#include "hw/arm/aspeed_soc.h" +#include "hw/nvram/eeprom_at24c.h" +#include "hw/sensor/tmp105.h" +#include "hw/sensor/max31790.h" +#include "hw/sensor/max11615.h" +#include "hw/sensor/adc128d818.h" +#include "hw/i2c/i2c_mux_pca954x.h" +#include "hw/gpio/pca9552.h" +#include "system/reset.h" I don't think this include is needed.
Quoted 264 lines
hw/arm/aspeed_ast2600_fby4.c new file +22
-0+ +#define FBY4_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) + +/* START OF EEPROM CONTENTS */ + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Fan Board FSC-MAX ADC-TI LED-NXP EFUSE-MAX" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set product.custom="Fanboard Custom1" \ +* --set product.custom.1="Fanboard Custom2" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-fanboard.bin +*/ +/* EM Config: yosemite4_fanboard_fsc_max_adc_ti_led_nxp_ons_efuse_max.json */
hw/arm/aspeed_ast2600_fby4.c new file +3
-0+/* Yosemite4 fan board */ +static const uint8_t fru_yv4_fanboard_bin[] = { + 0x01, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0xf3, 0x01, 0x0a, 0x19,
0xce,
+0xc2,0xa8,0xc6,0x57,0x69,0x77,0x79,0x6e,0x6e,0xea,0x46,0x61,
+0x6e,0x20,0x42,0x6f,0x61,0x72,0x64,0x20,0x46,0x53,0x43,0x2d,
+0x4d,0x41,0x58,0x20,0x41,0x44,0x43,0x2d,0x54,0x49,0x20,0x4c,
+0x45,0x44,0x2d,0x4e,0x58,0x50,0x20,0x45,0x46,0x55,0x53,0x45,
+0x2d,0x4d,0x41,0x58,0x85,0x91,0x34,0x51,0x95,0x05,0xca,0x42,
+0x52,0x44,0x2d,0x50,0x4e,0x2d,0x33,0x34,0x35,0xc0,0xc1,0x00,
+0x00,0x00,0x00,0xdb,0x01,0x09,0x19,0xc6,0x57,0x69,0x77,0x79,
+0x6e,0x6e,0xcb,0x59,0x6f,0x73,0x65,0x6d,0x69,0x74,0x65,0x20,
+0x56,0x34,0xc6,0x50,0x4e,0x2d,0x33,0x34,0x35,0xc4,0x76,0x31,
+0x2e,0x31,0x85,0x91,0x34,0x51,0x95,0x05,0x89,0x30,0x1b,0x8e,
+0x25,0xfa,0xb2,0x64,0x29,0x03,0xc0,0xd0,0x46,0x61,0x6e,0x62,
+0x6f,0x61,0x72,0x64,0x20,0x43,0x75,0x73,0x74,0x6f,0x6d,0x32,
+0xc1,0x00,0x00,0x9dhw/arm/aspeed_ast2600_fby4.c new file +2
-0+}; +static const size_t fru_yv4_fanboard_bin_len =
sizeof(fru_yv4_fanboard_bin);hw/arm/aspeed_ast2600_fby4.c new file +22
-0+ +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Sentinel Dome without Retimer" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set product.custom="Yosemite V4 T1" \ +* --set product.custom.1="Yosemite V4 T1" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-sentineldome-board.bin +*/ +/* product.cust maps to PRODUCT_INFO_AM2 */ +/* EM Config: yosemite4_sentineldome_t1.json */ +/* Yosemite4 Sentinel Dome without Retimer Boards */ +static const uint8_t fru_yv4_sentineldome_board_bin[] = { + 0x01, 0x00, 0x00, 0x01, 0x09, 0x00, 0x00, 0xf5, 0x01, 0x08, 0x19,
0xce,
+0xc2,0xa8,0xc6,0x57,0x69,0x77,0x79,0x6e,0x6e,0xdd,0x53,0x65,
+0x6e,0x74,0x69,0x6e,0x65,0x6c,0x20,0x44,0x6f,0x6d,0x65,0x20,
+0x77,0x69,0x74,0x68,0x6f,0x75,0x74,0x20,0x52,0x65,0x74,0x69,
+0x6d,0x65,0x72,0x85,0x91,0x34,0x51,0x95,0x05,0xca,0x42,0x52,
+0x44,0x2d,0x50,0x4e,0x2d,0x33,0x34,0x35,0xc0,0xc1,0x00,0x78,
+0x01,0x09,0x19,0xc6,0x57,0x69,0x77,0x79,0x6e,0x6e,0xcb,0x59,
+0x6f,0x73,0x65,0x6d,0x69,0x74,0x65,0x20,0x56,0x34,0xc6,0x50,
+0x4e,0x2d,0x33,0x34,0x35,0xc4,0x76,0x31,0x2e,0x31,0x85,0x91,
+0x34,0x51,0x95,0x05,0x89,0x30,0x1b,0x8e,0x25,0xfa,0xb2,0x64,
+0x29,0x03,0xc0,0xce,0x59,0x6f,0x73,0x65,0x6d,0x69,0x74,0x65,
+0x20,0x56,0x34,0x20,0x54,0x31,0xc1,0x00,0x00,0x00,0x00,0xebhw/arm/aspeed_ast2600_fby4.c new file +22
-0+}; +static const size_t fru_yv4_sentineldome_board_bin_len = + sizeof(fru_yv4_sentineldome_board_bin); + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Sentinel Dome" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-sentineldome-chassis.bin +*/ +/* EM Config: yosemite4_sentineldome_chassis.json */ +/* Yosemite 4 Sentinel Dome Chassis FRU */ +static const uint8_t fru_yv4_sentineldome_chassis_bin[] = { + 0x01, 0x00, 0x00, 0x01, 0x07, 0x00, 0x00, 0xf7, 0x01, 0x06, 0x19,
0xce,
+0xc2,0xa8,0xc6,0x57,0x69,0x77,0x79,0x6e,0x6e,0xcd,0x53,0x65,
+0x6e,0x74,0x69,0x6e,0x65,0x6c,0x20,0x44,0x6f,0x6d,0x65,0x85,
+0x91,0x34,0x51,0x95,0x05,0xca,0x42,0x52,0x44,0x2d,0x50,0x4e,
+0x2d,0x33,0x34,0x35,0xc0,0xc1,0x00,0xb6,0x01,0x07,0x19,0xc6,
+0x57,0x69,0x77,0x79,0x6e,0x6e,0xcb,0x59,0x6f,0x73,0x65,0x6d,
+0x69,0x74,0x65,0x20,0x56,0x34,0xc6,0x50,0x4e,0x2d,0x33,0x34,
+0x35,0xc4,0x76,0x31,0x2e,0x31,0x85,0x91,0x34,0x51,0x95,0x05,
+0x89,0x30,0x1b,0x8e,0x25,0xfa,0xb2,0x64,0x29,0x03,0xc0,0xc1,
+0x00,0x00,0x00,0x59hw/arm/aspeed_ast2600_fby4.c new file +22
-0+}; +static const size_t fru_yv4_sentineldome_chassis_bin_len = + sizeof(fru_yv4_sentineldome_chassis_bin); + +/* +*./frugen -s board.mfg="Wiwynn" \ +* --set board.pname="Management Board wBMC" \ +* --set text:board.pn="BRD-PN-345" \ +* --board-date "10/1/2017 12:58:00" \ +* --set board.serial="123456" \ +* --set product.pname="Yosemite V4" \ +* --set product.mfg="Wiwynn" \ +* --set product.ver="v1.1" \ +* --set product.serial="123456" \ +* --set product.atag="PLACEHOLDER" \ +* --set text:product.pn="PN-345" \ +* fru-yv4-eclosure.bin +*/ +/* EM Config: yosemite4_chassis.json, yosemite4.json */ +/* Yosemite 4 Sentinel Dome Enclosure FRU */ +static const uint8_t fru_yv4_eclosure_bin[] = { + 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19,
0xce,
+0xc2,0xa8,0xc6,0x57,0x69,0x77,0x79,0x6e,0x6e,0xd5,0x4d,0x61,
+0x6e,0x61,0x67,0x65,0x6d,0x65,0x6e,0x74,0x20,0x42,0x6f,0x61,
+0x72,0x64,0x20,0x77,0x42,0x4d,0x43,0x85,0x91,0x34,0x51,0x95,
+0x05,0xca,0x42,0x52,0x44,0x2d,0x50,0x4e,0x2d,0x33,0x34,0x35,
+0xc0,0xc1,0x00,0x26,0x01,0x07,0x19,0xc6,0x57,0x69,0x77,0x79,
+0x6e,0x6e,0xcb,0x59,0x6f,0x73,0x65,0x6d,0x69,0x74,0x65,0x20,
+0x56,0x34,0xc6,0x50,0x4e,0x2d,0x33,0x34,0x35,0xc4,0x76,0x31,
+0x2e,0x31,0x85,0x91,0x34,0x51,0x95,0x05,0x89,0x30,0x1b,0x8e,
+0x25,0xfa,0xb2,0x64,0x29,0x03,0xc0,0xc1,0x00,0x00,0x00,0x59hw/arm/aspeed_ast2600_fby4.c new file +2
-0+}; +static const size_t fru_yv4_eclosure_bin_len =
sizeof(fru_yv4_eclosure_bin);hw/arm/aspeed_ast2600_fby4.c new file +4
-0+ +/* END OF EEPROM CONTENTS */ + +static void fby4_i2c_init_fanboard(I2CSlave *fan_mux, size_teepromSize)
hw/arm/aspeed_ast2600_fby4.c new file +24
-0+{ + /* 2 fan boards */ + for (int i = 0; i <= 1; i++) { + /* downstream bus */ + I2CBus *bus = pca954x_i2c_get_bus(fan_mux, i); + + /* ti,adc128d818 @ 0x1f (adc) */ + /* the driver will throw away the last 4 bits, set them 0 */ + static const uint16_t adc_values1[8] = { + 0b011110000000, 0b010100010000, + 0b001000110000, 0b100000100000, + 0b011110000000, 0b010100010000, + 0b001000110000, 0b100000100000}; + adc128d818_init_with_values(bus, 0x1f, adc_values1, 8); + + /* maxim,max31790 @ 0x20 (pwm) */ + i2c_slave_create_simple(bus, TYPE_MAX31790, 0x20); + + /* +* ti,tca6424 @ 0x22 (gpio) +* linux handles tca6424 with PCA953X_TYPE, same as pca9535 +* { "pca9535", 16 | PCA953X_TYPE | PCA_INT, }, +* { "tca6424", 24 | PCA953X_TYPE | PCA_INT, }, +* so we _could_ be fine here unless more than 16 gpios are used
+ */
+i2c_slave_create_simple(bus, TYPE_PCA9535, 0x22);hw/arm/aspeed_ast2600_fby4.c new file +36
-0+ + /* + * NOTE: above works and could use for gpio presence: + * $ gpioget gpiochip2 2 + * 1 + */ + + /* maxim,max31790 @ 0x2f (pwm) */ + i2c_slave_create_simple(bus, TYPE_MAX31790, 0x2f); + + /* maxim,max11615 @ 0x33 (adc) */ + static const uint16_t adc_values[8] = { + 0b011110000010, 0b010100011000, + 0b001000110100, 0b100000101001, + 0b011110000010, 0b010100011000, + 0b001000110100, 0b100000101001}; + max11615_init_with_values(bus, 0x33, adc_values, 8); + + at24c_eeprom_init_rom( + bus, 0x52, eepromSize, + fru_yv4_fanboard_bin, + fru_yv4_fanboard_bin_len); + + /* LED blink driver / gpio expander */ + /* nxp,pca9552 @ 0x61 (gpio) */ + i2c_slave_create_simple(bus, TYPE_PCA9552, 0x61); + } +} + +static void fby4_i2c_init_blade_chassis (I2CBus *bus,size_t eepromSize) +{ + /* Sentinel Dome Blade EEPROMS */ + + /* Board */ + at24c_eeprom_init_rom(bus, 0x54, eepromSize, + fru_yv4_sentineldome_board_bin,
fru_yv4_sentineldome_board_bin_len);
+
+ /* Chassis */
+ at24c_eeprom_init_rom(bus,0x55, eepromSize,
+fru_yv4_sentineldome_chassis_bin,fru_yv4_sentineldome_chassis_bin_len);hw/arm/aspeed_ast2600_fby4.c new file +6
-0+} + +static void fby4_i2c_init_multiple_blade_chassis (I2CBus **i2c, + size_t eepromSize) +{ + /* there is 8 blade chassis, but we only emulate 2 forQuoted 3 lines
performance reason */
+ for (int bus = 1; bus <= (8 / 4); bus++) {
+Extra line.
Quoted 6 lines
+
fby4_i2c_init_blade_chassis(i2c[bus], eepromSize); + }hw/arm/aspeed_ast2600_fby4.c new file +4
-0+} + +static void fby4_i2c_init (AspeedMachineState *bmc) +{hw/arm/aspeed_ast2600_fby4.c line 252
Quoted 10 lines
hw/arm/aspeed_ast2600_fby4.c new file +10
-0+ AspeedSoCState *soc = bmc->soc; + I2CBus *i2c[16]; + + for (int i = 0; i < 16; i++) { + i2c[i] = aspeed_i2c_get_bus(&soc->i2c, i); + } + + const size_t eepromSize = 128 * KiB; + + const uint8_t enclosure_addr = 0x51;These variables seem superflous.
Quoted 91 lines
hw/arm/aspeed_ast2600_fby4.c new file +9
-0+ + /* Enclosure (EM Config: yosemite4_chassis.json, yosemite4.json) */ + at24c_eeprom_init_rom(i2c[1], enclosure_addr, eepromSize, + fru_yv4_eclosure_bin, fru_yv4_eclosure_bin_len); + + fby4_i2c_init_multiple_blade_chassis(i2c, eepromSize); + + /* Yv4 fanboard connection */ + I2CSlave *fan_mux = i2c_slave_create_simple(i2c[14],
TYPE_PCA9546,0x74);hw/arm/aspeed_ast2600_fby4.c new file +5
-0+ + fby4_i2c_init_fanboard(fan_mux, eepromSize); +} + +static void aspeed_machine_fby4_class_init(ObjectClass *oc, constvoid *data)
hw/arm/aspeed_ast2600_fby4.c new file +23
-0+{ + MachineClass *mc = MACHINE_CLASS(oc); + AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc); + + mc->desc = "Facebook fby4 BMC (Cortex-A7)"; + amc->fmc_model = "mx66l1g45g"; + amc->num_cs = 2; + amc->macs_mask = ASPEED_MAC3_ON; + amc->i2c_init = fby4_i2c_init; + mc->default_ram_size = FBY4_BMC_RAM_SIZE; + aspeed_machine_class_init_cpus_defaults(mc); +} + +static const TypeInfo aspeed_ast2600_fby4_types[] = { + { + .name = MACHINE_TYPE_NAME("fby4-bmc"), + .parent = MACHINE_TYPE_NAME("ast2600-evb"), + .class_init = aspeed_machine_fby4_class_init, + .interfaces = arm_machine_interfaces, + } +}; + +DEFINE_TYPES (aspeed_ast2600_fby4_types)hw/arm/meson.build +1
-0@@ -60,6 +60,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_ast2600_catalina.c', 'aspeed_ast2600_evb.c', 'aspeed_ast2600_fby35.c', + 'aspeed_ast2600_fby4.c', 'aspeed_ast2600_fuji.c', 'aspeed_ast2600_gb200nvl.c', 'aspeed_ast2600_qcom-dc-scm-v1.c',tests/functional/arm/meson.build +2
-0@@ -14,6 +14,7 @@ test_arm_timeouts = { 'aspeed_ast2600_sdk_otp' : 720, 'aspeed_bletchley' : 480, 'aspeed_catalina' : 480, + 'aspeed_fby4': 480, 'aspeed_gb200nvl_bmc' : 480, 'aspeed_rainier' : 480, 'bpim2u' : 500,@@ -47,6 +48,7 @@ tests_arm_system_thorough = [ 'aspeed_ast2600_sdk_otp', 'aspeed_bletchley', 'aspeed_catalina', + 'aspeed_fby4', 'aspeed_gb200nvl_bmc', 'aspeed_rainier', 'bpim2u',tests/functional/arm/test_aspeed_fby4.py new file +14
-0@@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# +# Functional test that boots the ASPEED machines +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import Asset +from aspeed import AspeedTest + + +class YosemiteV4Machine(AspeedTest): + + ASSET_YOSEMITE_V4_FLASH = Asset( +Quoted 2 lines
'https://github.com/pointbazaar/qemu-aspeed-boot/raw/3ef9a0d8cd2902c2039924ad1f16c8f2345486f3/images/yosemite4-bmc/openbmc-20260505132843/obmc-phosphor-image-yosemite4-20260505132843.static.mtd.xz',
+ 'dff6946363b41f952b15cfc3156482b89fcfc1b0ecfc3ec8b3ed496a5f001ef9')Now that the yosemite4 image is merged in my image test tree, may be it is best to update the asset ? As you wish. Works like that too.
Quoted 27 lines
+
+ def do_test_arm_aspeed_openbmc_no_network(self, machine, image, uboot,
+cpu_id, soc):tests/functional/arm/test_aspeed_fby4.py new file +9
-0+ + self.set_machine(machine) + self.vm.set_console() + self.vm.add_args('-drive', f'file={image},if=mtd,format=raw', + '-snapshot') + self.vm.launch() + + self.wait_for_console_pattern(f'U-Boot {uboot}') + self.wait_for_console_pattern('## Loading kernel from FITImage')
+self.wait_for_console_pattern('Starting kernel ...')+self.wait_for_console_pattern(f'Booting Linux on physical CPU {cpu_id}')
+self.wait_for_console_pattern(f'ASPEED {soc}')+self.wait_for_console_pattern('/init as init process')+ # yosemite v4 does not emit the hostname log which is + # different from the other machines.
+self.wait_for_console_pattern('yosemite4 login:')tests/functional/arm/test_aspeed_fby4.py new file +5
-0+ + def test_arm_ast2600_yosemitev4_openbmc(self): + image_path = self.uncompress(self.ASSET_YOSEMITE_V4_FLASH) + + self.do_test_arm_aspeed_openbmc_no_network('fby4-bmc',Quoted 4 lines
image=image_path,
+ uboot='2019.04', cpu_id='0xf00',
+ soc='AST2600 rev A3')I don't see any tests regarding the new sensor models.
The commit logs of patch 1-3 :
hw/sensor: MAX31790 support
hw/sensor: support MAX11615
hw/sensor: support Texas Instruments ADC128D818contain Linux command sequences that could be included in this test case. Could you do that please ?
Also, for sensors, please cc:
Titus Rwantare <[email protected]>
and we will need new entries under
MAINTAINERS.Thanks,
C.
Re: [PATCH v2 4/4] ast2600: yosemite4 initial support
Hello,
Quoted 3 lines · Alexander Hansen
Hi Cedric,
thanks for your ongoing review :)
yeah. It takes a few respins.
Quoted 1 line
I sent v5, summary of changes:
I see a v3.
What's below would have been great in a cover letter ;)
Quoted 9 lines
- I CCd you and Titus on all the patches now.
- removed the backticks (markdown syntax) from my patches. I was used to this workflow since some other projects use commit linters which get tripped up by log outputs.
- restructured the series as you suggested (board, then functional test, then sensors)
- removed some unused includes on the machine file
- removed some unnecessary variables from the machine file
- linked to your github tree for the fw image for the functional test, since the image is now available there
- added new section for each sensor to the functional test with some command sequences and expected outputs
- added new entries inMAINTAINERSfile for Titus for the individual sensors. Your maintenance of the fby4 seems to already be covered by existing regex.
Quoted 3 lines
Let me know in case there is extra tests i should write for the sensors other than the functional test.
I saw the
tests/qtest/tmp105-test.c, would that be helpful for the new sensors as well to write a test like that?
It is always useful to have, especially for covering corner cases in the model that are harder to exercise when running a full OS image. Some MMIO sequences are much easier to test in qtest than by building custom firmware for them. It really depends on the complexity and criticality of the model.
Thanks,
C.
Hi,
Quoted 25 lines · Alexander Hansen
Add initial and incomplete support for yosemite v4 BMC-side emulation.
As part of this effort 3 new sensor ICs are added.
Alexander Hansen (4):
hw/sensor: MAX31790 support
hw/sensor: support MAX11615
hw/sensor: support Texas Instruments ADC128D818
ast2600: yosemite4 initial supporthw/arm/Kconfig | 3 + hw/arm/aspeed_ast2600_fby4.c | 289 +++++++++++++ hw/arm/meson.build | 1 + hw/sensor/Kconfig | 12 + hw/sensor/adc128d818.c | 414 +++++++++++++++++++ hw/sensor/max11615.c | 202 +++++++++ hw/sensor/max31790.c | 499 +++++++++++++++++++++++ hw/sensor/meson.build | 3 + hw/sensor/trace-events | 24 ++ include/hw/sensor/adc128d818.h | 20 + include/hw/sensor/max11615.h | 20 + include/hw/sensor/max31790.h | 7 + tests/functional/arm/meson.build | 2 + tests/functional/arm/test_aspeed_fby4.py | 44 ++ 14 files changed, 1540 insertions(+)
Quoted 9 lines
create mode 100644
hw/arm/aspeed_ast2600_fby4.ccreate mode 100644hw/sensor/adc128d818.c
create mode 100644hw/sensor/max11615.c
create mode 100644hw/sensor/max31790.c
create mode 100644include/hw/sensor/adc128d818.hcreate mode 100644include/hw/sensor/max11615.hcreate mode 100644include/hw/sensor/max31790.hcreate mode 100755tests/functional/arm/test_aspeed_fby4.py
I would organized the series as :
1: Introduce new machine xyz
2: Add functional test for machine xyz
3: Introduce new sensor1 model (and possibly unit test) 4: Integrate sensor1 sensors in machine xyz, extend machine test. 5: Repeat 3-4 for each new sensor model
Thanks,
C.