aspeed queue
Subsystems (2)
[PULL 01/25] tests/avocado: Introduce file_truncate()
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
--- tests/avocado/boot_linux_console.py | 5 +++++ 1 file changed, 5 insertions(+)
tests/avocado/boot_linux_console.py +5 -0
@@ -30,6 +30,11 @@ def pow2ceil(x): return 1 if x == 0 else 2**(x - 1).bit_length() +def file_truncate(path, size): + if size != os.path.getsize(path): + with open(path, 'ab+') as fd: + fd.truncate(size) + """ Expand file size to next power of 2 """
Signature · 1 line
2.39.1
[PULL 09/25] hw/core/loader: Remove declarations of option_rom_has_mr/rom_file_has_mr
In reply to Cédric Le GoaterThese globals were moved to MachineClass by commit 71ae9e94d9 ("pc: Move option_rom_has_mr/rom_file_has_mr globals to MachineClass"). Finish cleanup.
--- include/hw/loader.h | 3 --- 1 file changed, 3 deletions(-)
include/hw/loader.h +0 -3
@@ -251,9 +251,6 @@ void pstrcpy_targphys(const char *name, hwaddr dest, int buf_size, const char *source); -extern bool option_rom_has_mr; -extern bool rom_file_has_mr; -ssize_t rom_add_file (const char *file,const char *fw_dir,hwaddr addr,int32_t bootindex,bool option_rom,MemoryRegion *mr,AddressSpace *as);
Signature · 1 line
2.39.1
[PULL 03/25] aspeed: Add Supermicro X11 SPI machine type
In reply to Cédric Le GoaterFrom: Guenter Roeck <[email protected]>
supermicrox11-bmc is configured with ast2400-a1 SoC. This does not match the Supermicro documentation for X11 BMCs, and it does not match the devicetree file in the Linux kernel.
As it turns out, some Supermicro X11 motherboards use AST2400 SoCs, while others use AST2500.
Introduce new machine type supermicrox11-spi-bmc with AST2500 SoC to match the devicetree description in the Linux kernel. Hardware configuration details for this machine type are guesswork and taken from defaults as well as from the Linux kernel devicetree file.
The new machine type was tested with aspeed-bmc-supermicro-x11spi.dts from the Linux kernel and with Linux versions 6.0.3 and 6.1-rc2. Linux booted successfully from initrd and from both SPI interfaces. Ethernet interfaces were confirmed to be operational.
Message-Id: <[email protected]>
--- hw/arm/aspeed.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
hw/arm/aspeed.c +33 -0
@@ -71,6 +71,16 @@ struct AspeedMachineState { SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) | \ SCU_AST2400_HW_STRAP_BOOT_MODE(AST2400_SPI_BOOT)) +/* TODO: Find the actual hardware value */ +#define SUPERMICRO_X11SPI_BMC_HW_STRAP1 ( \ + AST2500_HW_STRAP1_DEFAULTS | \ + SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \ + SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \ + SCU_AST2500_HW_STRAP_UART_DEBUG | \ + SCU_AST2500_HW_STRAP_DDR4_ENABLE | \ + SCU_HW_STRAP_SPI_WIDTH | \ + SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_M_S_EN)) +/* AST2500 evb hardware value: 0xF100C2E6 */ #define AST2500_EVB_HW_STRAP1 (( \ AST2500_HW_STRAP1_DEFAULTS | \
@@ -1141,6 +1151,25 @@ static void aspeed_machine_supermicrox11_bmc_class_init(ObjectClass *oc, mc->default_ram_size =256 * MiB; } +static void aspeed_machine_supermicro_x11spi_bmc_class_init (ObjectClass *oc, +void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="Supermicro X11 SPI BMC (ARM1176)" ; + amc->soc_name ="ast2500-a1" ; + amc->hw_strap1 =SUPERMICRO_X11SPI_BMC_HW_STRAP1 ; + amc->fmc_model ="mx25l25635e" ; + amc->spi_model ="mx25l25635e" ; + amc->num_cs =1 ; + amc->macs_mask =ASPEED_MAC0_ON |ASPEED_MAC1_ON ; + amc->i2c_init = palmetto_bmc_i2c_init; + mc->default_ram_size =512 * MiB; + mc->default_cpus = mc->min_cpus = mc->max_cpus = +aspeed_soc_num_cpus (amc->soc_name); +} +static void aspeed_machine_ast2500_evb_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);
@@ -1522,6 +1551,10 @@ static const TypeInfo aspeed_machine_types[] = { .name = MACHINE_TYPE_NAME("supermicrox11-bmc"), .parent = TYPE_ASPEED_MACHINE, .class_init = aspeed_machine_supermicrox11_bmc_class_init, + }, { + .name = MACHINE_TYPE_NAME("supermicro-x11spi-bmc"), + .parent = TYPE_ASPEED_MACHINE, + .class_init = aspeed_machine_supermicro_x11spi_bmc_class_init, }, { .name = MACHINE_TYPE_NAME("ast2500-evb"), .parent = TYPE_ASPEED_MACHINE,
Signature · 1 line
2.39.1
[PULL 02/25] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
The M2S-FG484 SOM uses a 16 MiB SPI flash (Spansion S25FL128SDPBHICO). Since the test asset is bigger, truncate it to the correct size to avoid when running the test_arm_emcraft_sf2 test:
qemu-system-arm: device requires 16777216 bytes, block backend provides 67108864 bytes
Add comment regarding the M2S-FG484 SOM hardware in hw/arm/msf2-som.c.
--- hw/arm/msf2-som.c | 5 ++++- tests/avocado/boot_linux_console.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)
hw/arm/msf2-som.c +4 -1
@@ -1,6 +1,9 @@/* * SmartFusion2 SOM starter kit(from Emcraft) emulation. * +* M2S-FG484 SOM hardware architecture specification: +* https://www.emcraft.com/jdownloads/som/m2s/m2s-som-ha.pdf +* * Copyright (c) 2017 Subbaraya Sundeep <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -87,7 +90,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)/* Attach SPI flash to SPI0 controller */ spi_bus =qdev_get_child_bus (dev,"spi0" ); - spi_flash =qdev_new ("s25sl12801" ); + spi_flash =qdev_new ("s25sl12801" );/* Spansion S25FL128SDPBHICO */ qdev_prop_set_uint8 (spi_flash,"spansion-cr2nv" ,1 );if (dinfo) { qdev_prop_set_drive_err(spi_flash, "drive",
tests/avocado/boot_linux_console.py +2 -0
@@ -400,6 +400,8 @@ def test_arm_emcraft_sf2(self): spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501' spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash) + file_truncate(spi_path, 16 << 20) # Spansion S25FL128SDPBHICO is 16 MiB + self.vm.set_console() kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE self.vm.add_args('-kernel', uboot_path,
Signature · 1 line
2.39.1
[PULL 04/25] hw/net: Fix read of uninitialized memory in ftgmac100
In reply to Cédric Le GoaterFrom: Stephen Longfield <[email protected]>
With the size += 4 before the call to crc32, the CRC calculation would overrun the buffer. Size is used in the while loop starting on line 1009 to determine how much data to write back, with the last four bytes coming from crc_ptr, so do need to increase it, but should do this after the computation.
I'm unsure why this use of uninitialized memory in the CRC doesn't result in CRC errors, but it seems clear to me that it should not be included in the calculation.
Message-Id: <[email protected]>
--- hw/net/ftgmac100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/ftgmac100.c +2 -2
@@ -980,9 +980,9 @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf,return size; } -/* 4 bytes for the CRC. */ - size +=4 ; crc =cpu_to_be32 (crc32 (~0 , buf, size)); +/* Increase size by 4, loop below reads the last 4 bytes from crc_ptr. */ + size +=4 ; crc_ptr = (uint8_t *) &crc;/* Huge frames are truncated. */
Signature · 1 line
2.39.1
[PULL 08/25] tests/avocado/machine_aspeed.py: Mask systemd services to speed up SDK boot
In reply to Cédric Le GoaterMessage-Id: <[email protected]>
--- tests/avocado/machine_aspeed.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
tests/avocado/machine_aspeed.py +9 -2
@@ -183,7 +183,14 @@ def test_arm_ast2600_evb_buildroot(self): class AST2x00MachineSDK(QemuSystemTest): - EXTRA_BOOTARGS = ' quiet' + EXTRA_BOOTARGS = ( + 'quiet ' + 'systemd.mask=org.openbmc.HostIpmi.service ' + '[email protected] ' + '[email protected] ' + 'systemd.mask=rngd.service ' + '[email protected] ' + ) # FIXME: Although these tests boot a whole distro they are still # slower than comparable machine models. There may be some
@@ -208,7 +215,7 @@ def do_test_arm_aspeed_sdk_start(self, image): interrupt_interactive_console_until_pattern( self, 'Hit any key to stop autoboot:', 'ast#') exec_command_and_wait_for_pattern( - self, 'setenv bootargs ${bootargs}' + self.EXTRA_BOOTARGS, 'ast#') + self, 'setenv bootargs ${bootargs} ' + self.EXTRA_BOOTARGS, 'ast#') exec_command_and_wait_for_pattern( self, 'boot', '## Loading kernel from FIT Image') self.wait_for_console_pattern('Starting kernel ...')
Signature · 1 line
2.39.1
[PULL 10/25] hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards
In reply to Cédric Le GoaterFrom: Peter Delevoryas <[email protected]>
This helper is useful in board initialization because lets users initialize and realize an EEPROM on an I2C bus with a single function call.
--- include/hw/nvram/eeprom_at24c.h | 23 +++++++++++++++++++++++ hw/arm/aspeed.c | 10 +--------- hw/arm/npcm7xx_boards.c | 20 +++++--------------- hw/nvram/eeprom_at24c.c | 12 ++++++++++++ 4 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 include/hw/nvram/eeprom_at24c.h
include/hw/nvram/eeprom_at24c.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright (c) Meta Platforms, Inc. and affiliates. +* +* SPDX-License-Identifier: GPL-2.0-only +*/ + +#ifndef EEPROM_AT24C_H +#define EEPROM_AT24C_H + +#include "hw/i2c/i2c.h" + +/* +* Create and realize an AT24C EEPROM device on the heap. +* @bus: I2C bus to put it on +* @address: I2C address of the EEPROM slave when put on a bus +* @rom_size: size of the EEPROM +* +* Create the device state structure, initialize it, put it on the specified +* @bus, and drop the reference to it (the device is realized). +*/ +I2CSlave *at24c_eeprom_init (I2CBus *bus,uint8_t address,uint32_t rom_size); + +#endif
hw/arm/aspeed.c +1 -9
@@ -17,6 +17,7 @@#include "hw/i2c/i2c_mux_pca954x.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/misc/pca9552.h" +#include "hw/nvram/eeprom_at24c.h" #include "hw/sensor/tmp105.h" #include "hw/misc/led.h" #include "hw/qdev-properties.h"
@@ -439,15 +440,6 @@ static void aspeed_machine_init(MachineState *machine)arm_load_kernel (ARM_CPU (first_cpu), machine, &aspeed_board_binfo); } -static void at24c_eeprom_init (I2CBus *bus,uint8_t addr,uint32_t rsize) -{ -I2CSlave *i2c_dev =i2c_slave_new ("at24c-eeprom" , addr); -DeviceState *dev =DEVICE (i2c_dev); - -qdev_prop_set_uint32 (dev,"rom-size" , rsize); -i2c_slave_realize_and_unref (i2c_dev, bus, &error_abort); -} -static void palmetto_bmc_i2c_init (AspeedMachineState *bmc) {AspeedSoCState *soc = &bmc->soc;
hw/arm/npcm7xx_boards.c +5 -15
@@ -21,6 +21,7 @@#include "hw/i2c/i2c_mux_pca954x.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/loader.h" +#include "hw/nvram/eeprom_at24c.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" #include "qapi/error.h"
@@ -140,17 +141,6 @@ static I2CBus *npcm7xx_i2c_get_bus(NPCM7xxState *soc, uint32_t num)return I2C_BUS (qdev_get_child_bus (DEVICE (&soc->smbus[num]),"i2c-bus" )); } -static void at24c_eeprom_init (NPCM7xxState *soc,int bus,uint8_t addr, -uint32_t rsize) -{ -I2CBus *i2c_bus =npcm7xx_i2c_get_bus (soc, bus); -I2CSlave *i2c_dev =i2c_slave_new ("at24c-eeprom" , addr); -DeviceState *dev =DEVICE (i2c_dev); - -qdev_prop_set_uint32 (dev,"rom-size" , rsize); -i2c_slave_realize_and_unref (i2c_dev, i2c_bus, &error_abort); -} -static void npcm7xx_init_pwm_splitter (NPCM7xxMachine *machine,NPCM7xxState *soc,const int *fan_counts) {
@@ -253,8 +243,8 @@ static void quanta_gsj_i2c_init(NPCM7xxState *soc)i2c_slave_create_simple (npcm7xx_i2c_get_bus (soc,3 ),"tmp105" ,0x5c );i2c_slave_create_simple (npcm7xx_i2c_get_bus (soc,4 ),"tmp105" ,0x5c ); -at24c_eeprom_init (soc,9 ,0x55 ,8192 ); -at24c_eeprom_init (soc,10 ,0x55 ,8192 ); +at24c_eeprom_init (npcm7xx_i2c_get_bus (soc,9 ),0x55 ,8192 ); +at24c_eeprom_init (npcm7xx_i2c_get_bus (soc,10 ),0x55 ,8192 );/* * i2c-11:
@@ -360,7 +350,7 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc)i2c_slave_create_simple (npcm7xx_i2c_get_bus (soc,4 ),TYPE_PCA9548 ,0x77 ); -at24c_eeprom_init (soc,4 ,0x50 ,8192 );/* mbfru */ +at24c_eeprom_init (npcm7xx_i2c_get_bus (soc,4 ),0x50 ,8192 );/* mbfru */ i2c_mux =i2c_slave_create_simple (npcm7xx_i2c_get_bus (soc,13 ),TYPE_PCA9548 ,0x77 );
@@ -371,7 +361,7 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc)i2c_slave_create_simple (pca954x_i2c_get_bus (i2c_mux,4 ),"tmp105" ,0x48 );i2c_slave_create_simple (pca954x_i2c_get_bus (i2c_mux,5 ),"tmp105" ,0x49 ); -at24c_eeprom_init (soc,14 ,0x55 ,8192 );/* bmcfru */ +at24c_eeprom_init (npcm7xx_i2c_get_bus (soc,14 ),0x55 ,8192 );/* bmcfru */ /* TODO: Add remaining i2c devices. */ }
hw/nvram/eeprom_at24c.c +12 -0
@@ -12,6 +12,7 @@#include "qapi/error.h" #include "qemu/module.h" #include "hw/i2c/i2c.h" +#include "hw/nvram/eeprom_at24c.h" #include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h"
@@ -128,6 +129,17 @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data)return 0 ; } +I2CSlave *at24c_eeprom_init (I2CBus *bus,uint8_t address,uint32_t rom_size) +{ +I2CSlave *i2c_dev =i2c_slave_new (TYPE_AT24C_EE , address); +DeviceState *dev =DEVICE (i2c_dev); + +qdev_prop_set_uint32 (dev,"rom-size" , rom_size); +i2c_slave_realize_and_unref (i2c_dev, bus, &error_abort); + +return i2c_dev; +} +static void at24c_eeprom_realize (DeviceState *dev,Error **errp) {EEPROMState *ee =AT24C_EE (dev);
Signature · 1 line
2.39.1
[PULL 16/25] hw/watchdog/wdt_aspeed: Extend MMIO range to cover more registers
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
When booting the Zephyr demo in [1] we get:
aspeed.io: unimplemented device write (size 4, offset 0x185128, value 0x030f1ff1) <-- aspeed.io: unimplemented device write (size 4, offset 0x18512c, value 0x03fffff1)
This corresponds to this Zephyr code [2]:
static int aspeed_wdt_init(const struct device *dev)
{
const struct aspeed_wdt_config *config = dev->config;
struct aspeed_wdt_data *const data = dev->data;
uint32_t reg_val; /* disable WDT by default */
reg_val = sys_read32(config->ctrl_base + WDT_CTRL_REG);
reg_val &= ~WDT_CTRL_ENABLE;
sys_write32(reg_val, config->ctrl_base + WDT_CTRL_REG);
sys_write32(data->rst_mask1,
config->ctrl_base + WDT_SW_RESET_MASK1_REG); <------
sys_write32(data->rst_mask2,
config->ctrl_base + WDT_SW_RESET_MASK2_REG);
return 0;}
The register definitions are [3]:
#define WDT_RELOAD_VAL_REG 0x0004 #define WDT_RESTART_REG 0x0008 #define WDT_CTRL_REG 0x000C #define WDT_TIMEOUT_STATUS_REG 0x0010 #define WDT_TIMEOUT_STATUS_CLR_REG 0x0014 #define WDT_RESET_MASK1_REG 0x001C #define WDT_RESET_MASK2_REG 0x0020 #define WDT_SW_RESET_MASK1_REG 0x0028 <------ #define WDT_SW_RESET_MASK2_REG 0x002C #define WDT_SW_RESET_CTRL_REG 0x0024
Currently QEMU only cover a MMIO region of size 0x20:
#define ASPEED_WDT_REGS_MAX (0x20 / 4)
Change to map the whole 'iosize' which might be bigger, covering the other registers. The MemoryRegionOps read/write handlers will report the accesses as out-of-bounds guest-errors, but the next commit will report them as unimplemented.
[1] https://github.com/AspeedTech-BMC/zephyr/releases/tag/v00.01.07
[2] https://github.com/AspeedTech-BMC/zephyr/commit/2e99f10ac27b
[3] https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/drivers/watchdog/wdt_aspeed.c#L31
--- hw/watchdog/wdt_aspeed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/watchdog/wdt_aspeed.c +2 -1
@@ -260,6 +260,7 @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp) {SysBusDevice *sbd =SYS_BUS_DEVICE (dev);AspeedWDTState *s =ASPEED_WDT (dev); +AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (dev);assert (s->scu);
@@ -271,7 +272,7 @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp) s->pclk_freq =PCLK_HZ ;memory_region_init_io (&s->iomem,OBJECT (s), &aspeed_wdt_ops, s, -TYPE_ASPEED_WDT ,ASPEED_WDT_REGS_MAX *4 ); +TYPE_ASPEED_WDT , awc->iosize);sysbus_init_mmio (sbd, &s->iomem); }
Signature · 1 line
2.39.1
[PULL 17/25] hw/watchdog/wdt_aspeed: Log unimplemented registers as UNIMP level
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Add more Aspeed watchdog registers from [*].
Since guests can righteously access them, log the access at 'unimplemented' level instead of 'guest-errors'.
[*] https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/drivers/watchdog/wdt_aspeed.c#L31
--- include/hw/watchdog/wdt_aspeed.h | 2 +- hw/watchdog/wdt_aspeed.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
include/hw/watchdog/wdt_aspeed.h +1 -1
@@ -21,7 +21,7 @@ OBJECT_DECLARE_TYPE(AspeedWDTState, AspeedWDTClass, ASPEED_WDT)#define TYPE_ASPEED_2600_WDT TYPE_ASPEED_WDT "-ast2600"#define TYPE_ASPEED_1030_WDT TYPE_ASPEED_WDT "-ast1030" -#define ASPEED_WDT_REGS_MAX (0x20 / 4) +#define ASPEED_WDT_REGS_MAX (0x30 / 4)struct AspeedWDTState {/*< private >*/
hw/watchdog/wdt_aspeed.c +13 -0
@@ -42,6 +42,11 @@#define WDT_PUSH_PULL_MAGIC (0xA8 << 24)#define WDT_OPEN_DRAIN_MAGIC (0x8A << 24)#define WDT_RESET_MASK1 (0x1c / 4) +#define WDT_RESET_MASK2 (0x20 / 4) + +#define WDT_SW_RESET_CTRL (0x24 / 4) +#define WDT_SW_RESET_MASK1 (0x28 / 4) +#define WDT_SW_RESET_MASK2 (0x2c / 4)#define WDT_TIMEOUT_STATUS (0x10 / 4)#define WDT_TIMEOUT_CLEAR (0x14 / 4)
@@ -83,6 +88,10 @@ static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size)return s->regs[WDT_RESET_MASK1 ];case WDT_TIMEOUT_STATUS :case WDT_TIMEOUT_CLEAR : +case WDT_RESET_MASK2 : +case WDT_SW_RESET_CTRL : +case WDT_SW_RESET_MASK1 : +case WDT_SW_RESET_MASK2 :qemu_log_mask (LOG_UNIMP ,"%s: uninmplemented read at offset 0x%" HWADDR_PRIx"\n" , __func__, offset);
@@ -190,6 +199,10 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,case WDT_TIMEOUT_STATUS :case WDT_TIMEOUT_CLEAR : +case WDT_RESET_MASK2 : +case WDT_SW_RESET_CTRL : +case WDT_SW_RESET_MASK1 : +case WDT_SW_RESET_MASK2 :qemu_log_mask (LOG_UNIMP ,"%s: uninmplemented write at offset 0x%" HWADDR_PRIx"\n" , __func__, offset);
Signature · 1 line
2.39.1
[PULL 22/25] hw/arm/aspeed_ast10x0: Map HACE peripheral
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Since I don't have access to the datasheet, the relevant values were found in:
https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi
Before on Zephyr:
uart:~$ hash test sha256_test tv[0]:hash_final error sha384_test tv[0]:hash_final error sha512_test tv[0]:hash_final error [00:00:06.278,000] <err> hace_global: HACE poll timeout [00:00:09.324,000] <err> hace_global: HACE poll timeout [00:00:12.261,000] <err> hace_global: HACE poll timeout
uart:~$ crypto aes256_cbc_vault aes256_cbc vault key 1 [00:00:06.699,000] <inf> hace_global: aspeed_crypto_session_setup [00:00:06.699,000] <inf> hace_global: data->cmd: 1c2098 [00:00:06.699,000] <inf> hace_global: crypto_data_src: 93340 [00:00:06.699,000] <inf> hace_global: crypto_data_dst: 93348 [00:00:06.699,000] <inf> hace_global: crypto_ctx_base: 93300 [00:00:06.699,000] <inf> hace_global: crypto_data_len: 80000040 [00:00:06.699,000] <inf> hace_global: crypto_cmd_reg: 11c2098 [00:00:09.743,000] <inf> hace_global: HACE_STS: 0 [00:00:09.743,000] <err> hace_global: HACE poll timeout [00:00:09.743,000] <err> crypto: CBC mode ENCRYPT - Failed [00:00:09.743,000] <inf> hace_global: aspeed_crypto_session_free uart:~$
After:
uart:~$ hash test sha256_test tv[0]:PASS tv[1]:PASS tv[2]:PASS tv[3]:PASS tv[4]:PASS sha384_test tv[0]:PASS tv[1]:PASS tv[2]:PASS tv[3]:PASS tv[4]:PASS tv[5]:PASS sha512_test tv[0]:PASS tv[1]:PASS tv[2]:PASS tv[3]:PASS tv[4]:PASS tv[5]:PASS
uart:~$ crypto aes256_cbc_vault aes256_cbc vault key 1 Was waiting for: 6b c1 be e2 2e 40 9f 96 e9 3d 7e 11 73 93 17 2a ae 2d 8a 57 1e 03 ac 9c 9e b7 6f ac 45 af 8e 51 30 c8 1c 46 a3 5c e4 11 e5 fb c1 19 1a 0a 52 ef f6 9f 24 45 df 4f 9b 17 ad 2b 41 7b e6 6c 37 10
But got:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[00:00:05.771,000] <inf> hace_global: aspeed_crypto_session_setup
[00:00:05.772,000] <inf> hace_global: data->cmd: 1c2098
[00:00:05.772,000] <inf> hace_global: crypto_data_src: 93340
[00:00:05.772,000] <inf> hace_global: crypto_data_dst: 93348
[00:00:05.772,000] <inf> hace_global: crypto_ctx_base: 93300
[00:00:05.772,000] <inf> hace_global: crypto_data_len: 80000040
[00:00:05.772,000] <inf> hace_global: crypto_cmd_reg: 11c2098
[00:00:05.772,000] <inf> hace_global: HACE_STS: 1000
[00:00:05.772,000] <inf> crypto: Output length (encryption): 80
[00:00:05.772,000] <inf> hace_global: aspeed_crypto_session_free
[00:00:05.772,000] <inf> hace_global: aspeed_crypto_session_setup
[00:00:05.772,000] <inf> hace_global: data->cmd: 1c2018
[00:00:05.772,000] <inf> hace_global: crypto_data_src: 93340
[00:00:05.772,000] <inf> hace_global: crypto_data_dst: 93348
[00:00:05.772,000] <inf> hace_global: crypto_ctx_base: 93300
[00:00:05.772,000] <inf> hace_global: crypto_data_len: 80000040
[00:00:05.772,000] <inf> hace_global: crypto_cmd_reg: 11c2018
[00:00:05.772,000] <inf> hace_global: HACE_STS: 1000
[00:00:05.772,000] <inf> crypto: Output length (decryption): 64
[00:00:05.772,000] <err> crypto: CBC mode DECRYPT - Mismatch between plaintext and decrypted cipher text [00:00:05.774,000] <inf> hace_global: aspeed_crypto_session_free
uart:~$
--- hw/arm/aspeed_ast10x0.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
hw/arm/aspeed_ast10x0.c +15 -0
@@ -28,6 +28,7 @@ static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_SPI1] = 0x7E630000, [ASPEED_DEV_SPI2] = 0x7E640000, [ASPEED_DEV_UDC] = 0x7E6A2000, + [ASPEED_DEV_HACE] = 0x7E6D0000, [ASPEED_DEV_SCU] = 0x7E6E2000, [ASPEED_DEV_JTAG0] = 0x7E6E4000, [ASPEED_DEV_JTAG1] = 0x7E6E4100,
@@ -165,6 +166,9 @@ static void aspeed_soc_ast1030_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.gpio-%s" , socname);object_initialize_child (obj,"gpio" , &s->gpio, typename); +snprintf (typename,sizeof (typename),"aspeed.hace-%s" , socname); +object_initialize_child (obj,"hace" , &s->hace, typename); +object_initialize_child (obj,"iomem" , &s->iomem,TYPE_UNIMPLEMENTED_DEVICE );object_initialize_child (obj,"sbc-unimplemented" , &s->sbc_unimplemented,TYPE_UNIMPLEMENTED_DEVICE );
@@ -358,6 +362,17 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) }aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->sbc),0 , sc->memmap[ASPEED_DEV_SBC ]); +/* HACE */ +object_property_set_link (OBJECT (&s->hace),"dram" ,OBJECT (&s->sram), + &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&s->hace), errp)) { +return ; + } +aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->hace),0 , + sc->memmap[ASPEED_DEV_HACE ]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->hace),0 , +aspeed_soc_get_irq (s,ASPEED_DEV_HACE )); +/* Watch dog */ for (i =0 ; i < sc->wdts_num; i++) {AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);
Signature · 1 line
2.39.1
[PULL 06/25] m25p80: Add the is25wp256 SFPD table
In reply to Cédric Le GoaterFrom: Guenter Roeck <[email protected]>
Generated from hardware using the following command and then padding with 0xff to fill out a power-of-2:
xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
Message-Id: <[email protected]>
--- hw/block/m25p80_sfdp.h | 2 ++ hw/block/m25p80.c | 3 ++- hw/block/m25p80_sfdp.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-)
hw/block/m25p80_sfdp.h +2 -0
@@ -26,4 +26,6 @@ uint8_t m25p80_sfdp_w25q512jv(uint32_t addr);uint8_t m25p80_sfdp_w25q01jvq (uint32_t addr); +uint8_t m25p80_sfdp_is25wp256 (uint32_t addr); +#endif
hw/block/m25p80.c +2 -1
@@ -221,7 +221,8 @@ static const FlashPartInfo known_devices[] = { { INFO("is25wp032", 0x9d7016, 0, 64 << 10, 64, ER_4K) }, { INFO("is25wp064", 0x9d7017, 0, 64 << 10, 128, ER_4K) }, { INFO("is25wp128", 0x9d7018, 0, 64 << 10, 256, ER_4K) }, - { INFO("is25wp256", 0x9d7019, 0, 64 << 10, 512, ER_4K) }, + { INFO("is25wp256", 0x9d7019, 0, 64 << 10, 512, ER_4K), + .sfdp_read = m25p80_sfdp_is25wp256 },/* Macronix */ { INFO("mx25l2005a", 0xc22012, 0, 64 << 10, 4, ER_4K) },
hw/block/m25p80_sfdp.c +40 -0
@@ -330,3 +330,43 @@ static const uint8_t sfdp_w25q01jvq[] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , };define_sfdp_read (w25q01jvq); + +/* +* Integrated Silicon Solution (ISSI) +*/ + +static const uint8_t sfdp_is25wp256[] = { +0x53 ,0x46 ,0x44 ,0x50 ,0x06 ,0x01 ,0x01 ,0xff , +0x00 ,0x06 ,0x01 ,0x10 ,0x30 ,0x00 ,0x00 ,0xff , +0x9d ,0x05 ,0x01 ,0x03 ,0x80 ,0x00 ,0x00 ,0x02 , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xe5 ,0x20 ,0xf9 ,0xff ,0xff ,0xff ,0xff ,0x0f , +0x44 ,0xeb ,0x08 ,0x6b ,0x08 ,0x3b ,0x80 ,0xbb , +0xfe ,0xff ,0xff ,0xff ,0xff ,0xff ,0x00 ,0xff , +0xff ,0xff ,0x44 ,0xeb ,0x0c ,0x20 ,0x0f ,0x52 , +0x10 ,0xd8 ,0x00 ,0xff ,0x23 ,0x4a ,0xc9 ,0x00 , +0x82 ,0xd8 ,0x11 ,0xce ,0xcc ,0xcd ,0x68 ,0x46 , +0x7a ,0x75 ,0x7a ,0x75 ,0xf7 ,0xae ,0xd5 ,0x5c , +0x4a ,0x42 ,0x2c ,0xff ,0xf0 ,0x30 ,0xfa ,0xa9 , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0x50 ,0x19 ,0x50 ,0x16 ,0x9f ,0xf9 ,0xc0 ,0x64 , +0x8f ,0xef ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff ,0xff , +}; +define_sfdp_read (is25wp256);
Signature · 1 line
2.39.1
[PULL 18/25] hw/misc/aspeed_hace: Do not crash if address_space_map() failed
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
address_space_map() can fail:
uart:~$ hash test
sha256_test
tv[0]:
Segmentation fault: 11
Thread 3 "qemu-system-arm" received signal SIGSEGV, Segmentation fault.
gen_acc_mode_iov (req_len=0x7ffff18b7778, id=<optimized out>, iov=0x7ffff18b7780, s=0x555556ce0bd0)
at ../hw/misc/aspeed_hace.c:171
171 if (has_padding(s, &iov[id], *req_len, &total_msg_len, &pad_offset)) {
(gdb) bt
#0 gen_acc_mode_iov (req_len=0x7ffff18b7778, id=<optimized out>, iov=0x7ffff18b7780, s=0x555556ce0bd0)
at ../hw/misc/aspeed_hace.c:171
#1 do_hash_operation (s=s@entry=0x555556ce0bd0, algo=3, sg_mode=sg_mode@entry=true, acc_mode=acc_mode@entry=true)
at ../hw/misc/aspeed_hace.c:224
#2 0x00005555559bdbb8 in aspeed_hace_write (opaque=<optimized out>, addr=12, data=262488, size=<optimized out>)
at ../hw/misc/aspeed_hace.c:358This change doesn't fix much, but at least the guest can't crash QEMU anymore. Instead it is still usable:
uart:~$ hash test sha256_test tv[0]:hash_final error sha384_test tv[0]:hash_final error sha512_test tv[0]:hash_final error [00:00:06.278,000] <err> hace_global: HACE poll timeout [00:00:09.324,000] <err> hace_global: HACE poll timeout [00:00:12.261,000] <err> hace_global: HACE poll timeout uart:~$
--- hw/misc/aspeed_hace.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
hw/misc/aspeed_hace.c +15 -6
@@ -193,6 +193,7 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,size_t digest_len =0 ;int niov =0 ;int i; +void *haddr;if (sg_mode) {uint32_t len =0 ;
@@ -217,9 +218,13 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode, addr &=SG_LIST_ADDR_MASK ; plen = len &SG_LIST_LEN_MASK ; - iov[i].iov_base =address_space_map (&s->dram_as, addr, &plen, false, -MEMTXATTRS_UNSPECIFIED ); - + haddr =address_space_map (&s->dram_as, addr, &plen, false, +MEMTXATTRS_UNSPECIFIED ); +if (haddr ==NULL ) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: qcrypto failed\n" , __func__); +return ; + } + iov[i].iov_base = haddr;if (acc_mode) { niov =gen_acc_mode_iov (s, iov, i, &plen);
@@ -230,10 +235,14 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode, }else {hwaddr len = s->regs[R_HASH_SRC_LEN ]; + haddr =address_space_map (&s->dram_as, s->regs[R_HASH_SRC ], + &len, false,MEMTXATTRS_UNSPECIFIED ); +if (haddr ==NULL ) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: qcrypto failed\n" , __func__); +return ; + } + iov[0 ].iov_base = haddr; iov[0 ].iov_len = len; - iov[0 ].iov_base =address_space_map (&s->dram_as, s->regs[R_HASH_SRC ], - &len, false, -MEMTXATTRS_UNSPECIFIED ); i =1 ;if (s->iov_count) {
Signature · 1 line
2.39.1
[PULL 05/25] avocado/boot_linux_console.py: Update ast2600 test
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
Update the test_arm_ast2600_debian test to
- the latest Debian kernel
- use the Rainier machine instead of Tacoma
Both of which contains support for more hardware and thus exercises more of the hardware Qemu models.
Message-Id: <[email protected]>
--- tests/avocado/boot_linux_console.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/avocado/boot_linux_console.py +6 -6
@@ -1105,18 +1105,18 @@ def test_arm_vexpressa9(self): def test_arm_ast2600_debian(self): """ :avocado: tags=arch:arm - :avocado: tags=machine:tacoma-bmc + :avocado: tags=machine:rainier-bmc """ deb_url = ('http://snapshot.debian.org/archive/debian/' - '20210302T203551Z/' + '20220606T211338Z/' 'pool/main/l/linux/' - 'linux-image-5.10.0-3-armmp_5.10.13-1_armhf.deb') - deb_hash = 'db40d32fe39255d05482bea48d72467b67d6225bb2a2a4d6f618cb8976f1e09e' + 'linux-image-5.17.0-2-armmp_5.17.6-1%2Bb1_armhf.deb') + deb_hash = '8acb2b4439faedc2f3ed4bdb2847ad4f6e0491f73debaeb7f660c8abe4dcdc0e' deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash, algorithm='sha256') - kernel_path = self.extract_from_deb(deb_path, '/boot/vmlinuz-5.10.0-3-armmp') + kernel_path = self.extract_from_deb(deb_path, '/boot/vmlinuz-5.17.0-2-armmp') dtb_path = self.extract_from_deb(deb_path, - '/usr/lib/linux-image-5.10.0-3-armmp/aspeed-bmc-opp-tacoma.dtb') + '/usr/lib/linux-image-5.17.0-2-armmp/aspeed-bmc-ibm-rainier.dtb') self.vm.set_console() self.vm.add_args('-kernel', kernel_path,
Signature · 1 line
2.39.1
[PULL 20/25] hw/arm/aspeed_ast10x0: Map I3C peripheral
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Since I don't have access to the datasheet, the relevant values were found in:
https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi
--- hw/arm/aspeed_ast10x0.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
hw/arm/aspeed_ast10x0.c +16 -0
@@ -53,6 +53,7 @@ static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_WDT] = 0x7E785000, [ASPEED_DEV_LPC] = 0x7E789000, [ASPEED_DEV_PECI] = 0x7E78B000, + [ASPEED_DEV_I3C] = 0x7E7A0000, [ASPEED_DEV_I2C] = 0x7E7B0000, };
@@ -88,6 +89,7 @@ static const int aspeed_soc_ast1030_irqmap[] = { [ASPEED_DEV_ADC] = 46, [ASPEED_DEV_SPI1] = 65, [ASPEED_DEV_SPI2] = 66, + [ASPEED_DEV_I3C] = 102, /* 102 -> 105 */ [ASPEED_DEV_I2C] = 110, /* 110 ~ 123 */ [ASPEED_DEV_KCS] = 138, /* 138 -> 142 */ [ASPEED_DEV_UDC] = 9,
@@ -129,6 +131,8 @@ static void aspeed_soc_ast1030_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.i2c-%s" , socname);object_initialize_child (obj,"i2c" , &s->i2c, typename); +object_initialize_child (obj,"i3c" , &s->i3c,TYPE_ASPEED_I3C ); +snprintf (typename,sizeof (typename),"aspeed.timer-%s" , socname);object_initialize_child (obj,"timerctrl" , &s->timerctrl, typename);
@@ -239,6 +243,18 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->i2c.busses[i]),0 , irq); } +/* I3C */ +if (!sysbus_realize (SYS_BUS_DEVICE (&s->i3c), errp)) { +return ; + } +aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->i3c),0 , sc->memmap[ASPEED_DEV_I3C ]); +for (i =0 ; i <ASPEED_I3C_NR_DEVICES ; i++) { +qemu_irq irq =qdev_get_gpio_in (DEVICE (&s->armv7m), + sc->irqmap[ASPEED_DEV_I3C ] + i); +/* The AST1030 I3C controller has one IRQ per bus. */ +sysbus_connect_irq (SYS_BUS_DEVICE (&s->i3c.devices[i]),0 , irq); + } +/* PECI */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->peci), errp)) {return ;
Signature · 1 line
2.39.1
[PULL 25/25] aspeed/sdmc: Drop unnecessary scu include
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
The model includes aspeed_scu.h but doesn't appear to require it.
Message-Id: <[email protected]>
--- hw/misc/aspeed_sdmc.c | 1 - 1 file changed, 1 deletion(-)
hw/misc/aspeed_sdmc.c +0 -1
@@ -12,7 +12,6 @@#include "qemu/module.h" #include "qemu/error-report.h" #include "hw/misc/aspeed_sdmc.h" -#include "hw/misc/aspeed_scu.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qapi/error.h"
Signature · 1 line
2.39.1
[PULL 21/25] hw/arm/aspeed_ast10x0: Map the secure SRAM
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Some SRAM appears to be used by the Secure Boot unit and crypto accelerators. Name it 'secure sram'.
Note, the SRAM base address was already present but unused (the 'SBC' index is used for the MMIO peripheral).
Interestingly using CFLAGS=-Winitializer-overrides reports:
../hw/arm/aspeed_ast10x0.c:32:30: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
[ASPEED_DEV_SBC] = 0x7E6F2000,
^~~~~~~~~~
../hw/arm/aspeed_ast10x0.c:24:30: note: previous initialization is here
[ASPEED_DEV_SBC] = 0x79000000,
^~~~~~~~~~This fixes with Zephyr:
uart:~$ rsa test rsa test vector[0]: [00:00:26.156,000] <err> os: ***** BUS FAULT ***** [00:00:26.157,000] <err> os: Precise data bus error [00:00:26.157,000] <err> os: BFAR Address: 0x79000000 [00:00:26.158,000] <err> os: r0/a1: 0x79000000 r1/a2: 0x00000000 r2/a3: 0x00001800 [00:00:26.158,000] <err> os: r3/a4: 0x79001800 r12/ip: 0x00000800 r14/lr: 0x0001098d [00:00:26.158,000] <err> os: xpsr: 0x81000000 [00:00:26.158,000] <err> os: Faulting instruction address (r15/pc): 0x0001e1bc [00:00:26.158,000] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0 [00:00:26.158,000] <err> os: Current thread: 0x38248 (shell_uart) [00:00:26.165,000] <err> os: Halting system
--- include/hw/arm/aspeed_soc.h | 3 +++ hw/arm/aspeed_ast10x0.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
include/hw/arm/aspeed_soc.h +3 -0
@@ -71,6 +71,7 @@ struct AspeedSoCState {AspeedSMCState spi[ASPEED_SPIS_NUM ];EHCISysBusState ehci[ASPEED_EHCIS_NUM ];AspeedSBCState sbc; +MemoryRegion secsram;UnimplementedDeviceState sbc_unimplemented;AspeedSDMCState sdmc;AspeedWDTState wdt[ASPEED_WDTS_NUM ];
@@ -105,6 +106,7 @@ struct AspeedSoCClass {const char *cpu_type;uint32_t silicon_rev;uint64_t sram_size; +uint64_t secsram_size;int spis_num;int ehcis_num;int wdts_num;
@@ -143,6 +145,7 @@ enum {ASPEED_DEV_SCU ,ASPEED_DEV_ADC ,ASPEED_DEV_SBC , +ASPEED_DEV_SECSRAM ,ASPEED_DEV_EMMC_BC ,ASPEED_DEV_VIDEO , ASPEED_DEV_SRAM,
hw/arm/aspeed_ast10x0.c +10 -1
@@ -21,7 +21,7 @@static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_SRAM ] =0x00000000 , - [ASPEED_DEV_SBC ] =0x79000000 , + [ASPEED_DEV_SECSRAM ] =0x79000000 , [ASPEED_DEV_IOMEM ] =0x7E600000 , [ASPEED_DEV_PWM ] =0x7E610000 , [ASPEED_DEV_FMC ] =0x7E620000 ,
@@ -221,6 +221,14 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SRAM ], &s->sram); +memory_region_init_ram (&s->secsram,OBJECT (s),"sec.sram" , + sc->secsram_size, &err); +if (err !=NULL ) { +error_propagate (errp, err); +return ; + } +memory_region_add_subregion (s->memory, sc->memmap[ASPEED_DEV_SECSRAM ], + &s->secsram);/* SCU */ if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {
@@ -400,6 +408,7 @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) sc->cpu_type =ARM_CPU_TYPE_NAME ("cortex-m4" ); sc->silicon_rev =AST1030_A1_SILICON_REV ; sc->sram_size =0xc0000 ; + sc->secsram_size =0x40000 ;/* 256 * KiB */ sc->spis_num =2 ; sc->ehcis_num =0 ; sc->wdts_num =4 ;
Signature · 1 line
2.39.1
[PULL 13/25] hw/arm/aspeed: Add aspeed_eeprom.c
In reply to Cédric Le GoaterFrom: Peter Delevoryas <[email protected]>
- Create aspeed_eeprom.c and aspeed_eeprom.h
- Include aspeed_eeprom.c in CONFIG_ASPEED meson source files
- Include aspeed_eeprom.h in aspeed.c
- Add fby35_bmc_fruid data
- Use new at24c_eeprom_init_rom helper to initialize BMC FRUID EEPROM with data from aspeed_eeprom.c
wget https://github.com/facebook/openbmc/releases/download/openbmc-e2294ff5d31d/fby35.mtd
qemu-system-aarch64 -machine fby35-bmc -nographic -mtdblock fby35.mtd
...
user: root
pass: 0penBmc
...
root@bmc-oob:~# fruid-util bb
FRU Information : Baseboard --------------- : ------------------ Chassis Type : Rack Mount Chassis Chassis Part Number : N/A Chassis Serial Number : N/A Board Mfg Date : Fri Jan 7 10:30:00 2022 Board Mfg : XXXXXX Board Product : Management Board wBMC Board Serial : XXXXXXXXXXXXX Board Part Number : XXXXXXXXXXXXXX Board FRU ID : 1.0 Board Custom Data 1 : XXXXXXXXX Board Custom Data 2 : XXXXXXXXXXXXXXXXXX Product Manufacturer : XXXXXX Product Name : Yosemite V3.5 EVT2 Product Part Number : XXXXXXXXXXXXXX Product Version : EVT2 Product Serial : XXXXXXXXXXXXX Product Asset Tag : XXXXXXX Product FRU ID : 1.0 Product Custom Data 1 : XXXXXXXXX Product Custom Data 2 : N/A root@bmc-oob:~# fruid-util bmc
FRU Information : BMC --------------- : ------------------ Board Mfg Date : Mon Jan 10 21:42:00 2022 Board Mfg : XXXXXX Board Product : BMC Storage Module Board Serial : XXXXXXXXXXXXX Board Part Number : XXXXXXXXXXXXXX Board FRU ID : 1.0 Board Custom Data 1 : XXXXXXXXX Board Custom Data 2 : XXXXXXXXXXXXXXXXXX Product Manufacturer : XXXXXX Product Name : Yosemite V3.5 EVT2 Product Part Number : XXXXXXXXXXXXXX Product Version : EVT2 Product Serial : XXXXXXXXXXXXX Product Asset Tag : XXXXXXX Product FRU ID : 1.0 Product Custom Data 1 : XXXXXXXXX Product Custom Data 2 : Config A root@bmc-oob:~# fruid-util nic
FRU Information : NIC --------------- : ------------------ Board Mfg Date : Tue Nov 2 08:51:00 2021 Board Mfg : XXXXXXXX Board Product : Mellanox ConnectX-6 DX OCP3.0 Board Serial : XXXXXXXXXXXXXXXXXXXXXXXX Board Part Number : XXXXXXXXXXXXXXXXXXXXX Board FRU ID : FRU Ver 0.02 Product Manufacturer : XXXXXXXX Product Name : Mellanox ConnectX-6 DX OCP3.0 Product Part Number : XXXXXXXXXXXXXXXXXXXXX Product Version : A9 Product Serial : XXXXXXXXXXXXXXXXXXXXXXXX Product Custom Data 3 : ConnectX-6 DX
--- hw/arm/aspeed_eeprom.h | 19 ++++++++++ hw/arm/aspeed.c | 10 ++++-- hw/arm/aspeed_eeprom.c | 82 ++++++++++++++++++++++++++++++++++++++++++ hw/arm/meson.build | 1 + 4 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 hw/arm/aspeed_eeprom.h create mode 100644 hw/arm/aspeed_eeprom.c
hw/arm/aspeed_eeprom.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (c) Meta Platforms, Inc. and affiliates. +* +* SPDX-License-Identifier: GPL-2.0-only +*/ + +#ifndef ASPEED_EEPROM_H +#define ASPEED_EEPROM_H + +#include "qemu/osdep.h" + +extern const uint8_t fby35_nic_fruid[]; +extern const uint8_t fby35_bb_fruid[]; +extern const uint8_t fby35_bmc_fruid[]; +extern const size_t fby35_nic_fruid_len; +extern const size_t fby35_bb_fruid_len; +extern const size_t fby35_bmc_fruid_len; + +#endif
hw/arm/aspeed.c +7 -3
@@ -14,6 +14,7 @@#include "hw/arm/boot.h" #include "hw/arm/aspeed.h" #include "hw/arm/aspeed_soc.h" +#include "hw/arm/aspeed_eeprom.h" #include "hw/i2c/i2c_mux_pca954x.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/misc/pca9552.h"
@@ -950,9 +951,12 @@ static void fby35_i2c_init(AspeedMachineState *bmc)at24c_eeprom_init (i2c[4 ],0x51 ,128 * KiB);at24c_eeprom_init (i2c[6 ],0x51 ,128 * KiB); -at24c_eeprom_init (i2c[8 ],0x50 ,32 * KiB); -at24c_eeprom_init (i2c[11 ],0x51 ,128 * KiB); -at24c_eeprom_init (i2c[11 ],0x54 ,128 * KiB); +at24c_eeprom_init_rom (i2c[8 ],0x50 ,32 * KiB, fby35_nic_fruid, + fby35_nic_fruid_len); +at24c_eeprom_init_rom (i2c[11 ],0x51 ,128 * KiB, fby35_bb_fruid, + fby35_bb_fruid_len); +at24c_eeprom_init_rom (i2c[11 ],0x54 ,128 * KiB, fby35_bmc_fruid, + fby35_bmc_fruid_len);/* * TODO: There is a multi-master i2c connection to an AST1030 MiniBMC on
hw/arm/aspeed_eeprom.c new file +82 -0
82 lines not on this page · raw message
hw/arm/meson.build +1 -0
@@ -51,6 +51,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed.c', 'aspeed_ast2600.c', 'aspeed_ast10x0.c', + 'aspeed_eeprom.c', 'fby35.c')) arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2.c')) arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2-tz.c'))
Signature · 1 line
2.39.1
[PULL 24/25] tests/avocado: Test Aspeed Zephyr SDK v00.01.08 on AST1030 board
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Add a very quick test that runs some commands in a Zephyr shell:
$ tests/venv/bin/avocado --show=app,console run -t os:zephyr tests/avocado (2/2) tests/avocado/machine_aspeed.py:AST1030Machine.test_ast1030_zephyros_1_07: console: *** Booting Zephyr OS build v00.01.07 *** console: ast1030_evb demo console: SOC: AST1030-A1 console: uart:~$ kernel stacks console: 0x36910 wdt_background (real size 1024): unused 988 usage 36 / 1024 (3 %) console: 0x36ad8 shell_uart (real size 4096): unused 3084 usage 1012 / 4096 (24 %) console: 0x2edb8 ADC0 (real size 400): unused 260 usage 140 / 400 (35 %) console: 0x2f0f0 ADC1 (real size 400): unused 260 usage 140 / 400 (35 %) console: 0x3b098 sysworkq (real size 1024): unused 860 usage 164 / 1024 (16 %) console: 0x36cc0 usbdworkq (real size 1024): unused 860 usage 164 / 1024 (16 %) console: 0x36bd8 usbworkq (real size 1024): unused 860 usage 164 / 1024 (16 %) console: 0x36a10 logging (real size 768): unused 548 usage 220 / 768 (28 %) console: 0x36ef8 idle 00 (real size 320): unused 268 usage 52 / 320 (16 %) console: 0x47800 IRQ 00 (real size 2048): unused 1504 usage 544 / 2048 (26 %) console: uart:~$ otp info scu console: SCU BIT reg_protect Description console: ____________________________________________________________________ console: 0x500 0x0 0x0 Disable ARM CM4 CPU boot (TXD5) console: 0x500 0x1 0x0 /Reserved console: 0x500 0x2 0x0 \ " console: 0x500 0x3 0x0 Address offset of single chip ABR mode console: 0x500 0x4 0x0 /Reserved console: 0x500 0x5 0x0 | " console: 0x500 0x6 0x0 | " console: 0x500 0x7 0x0 | " console: 0x500 0x8 0x0 | " console: 0x500 0x9 0x0 | " console: 0x500 0xA 0x0 | " console: 0x500 0xB 0x0 | " console: 0x500 0xC 0x0 | " console: 0x500 0xD 0x0 | " console: 0x500 0xE 0x0 | " console: 0x500 0xF 0x0 | " console: 0x500 0x10 0x0 \ " console: 0x500 0x11 0x0 Disabl3 ARM JTAG debug console: 0x500 0x12 0x0 /Reserved console: 0x500 0x13 0x0 | " console: 0x500 0x14 0x0 | " console: 0x500 0x15 0x0 | " console: 0x500 0x16 0x0 | " console: 0x500 0x17 0x0 | " console: 0x500 0x18 0x0 | " console: 0x500 0x19 0x0 | " console: 0x500 0x1A 0x0 | " console: 0x500 0x1B 0x0 | " console: 0x500 0x1C 0x0 | " console: 0x500 0x1D 0x0 | " console: 0x500 0x1E 0x0 | " console: 0x500 0x1F 0x0 \ " console: 0x510 0x0 0x0 /Reserved console: 0x510 0x1 0x0 | " console: 0x510 0x2 0x0 | " console: 0x510 0x3 0x0 \ " console: 0x510 0x4 0x0 Disable debug interfaces console: 0x510 0x5 0x0 /Reserved console: 0x510 0x6 0x0 | " console: 0x510 0x7 0x0 \ " console: 0x510 0x8 0x0 Enable boot from Uart5 by Pin Strap console: 0x510 0x9 0x0 /Reserved console: 0x510 0xA 0x0 \ " console: 0x510 0xB 0x0 Enable boot SPI ABR console: 0x510 0xC 0x0 Boot SPI ABR Mode console: 0x510 0xD 0x0 /Boot SPI flash size console: 0x510 0xE 0x0 | " console: 0x510 0xF 0x0 \ " console: 0x510 0x10 0x0 /Reserved console: 0x510 0x11 0x0 | " console: 0x510 0x12 0x0 | " console: 0x510 0x13 0x0 | " console: 0x510 0x14 0x0 | " console: 0x510 0x15 0x0 \ " console: 0x510 0x16 0x0 Enable boot SPI auxiliary control pins console: 0x510 0x19 0x0 /Reserved console: 0x510 0x1A 0x0 | " console: 0x510 0x1B 0x0 | " console: 0x510 0x1C 0x0 | " console: 0x510 0x1D 0x0 | " console: 0x510 0x1E 0x0 | " console: 0x510 0x1F 0x0 \ " console: 0x510 0x1E 0x0 Enable dedicate GPIO strap pins console: 0x510 0x1F 0x0 Enable Secure Boot by Pin Strap console: uart:~$ hwinfo devid console: Length: 8 console: ID: 0x0000018000000180 console: uart:~$ crypto aes256_cbc_vault console: aes256_cbc vault key 1 console: Was waiting for: console: 6b c1 be e2 2e 40 9f 96 e9 3d 7e 11 73 93 17 2a console: ae 2d 8a 57 1e 03 ac 9c 9e b7 6f ac 45 af 8e 51 console: 30 c8 1c 46 a3 5c e4 11 e5 fb c1 19 1a 0a 52 ef console: f6 9f 24 45 df 4f 9b 17 ad 2b 41 7b e6 6c 37 10 console: But got: console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 console: uart:~$ random get console: 0x862460d console: uart:~$ i2c scan I2C_0 console: 0 1 2 3 4 5 6 7 8 9 a b c d e f console: 00: -- -- -- -- -- -- -- -- -- -- -- -- console: 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 70: -- -- -- -- -- -- -- -- console: 1 devices found on I2C_0 console: uart:~$ kernel uptime console: Uptime: 9897 ms console: uart:~$ kernel reboot warm console: *** Booting Zephyr OS build v00.01.07 *** PASS (1.08 s)
--- tests/avocado/machine_aspeed.py | 41 ++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-)
tests/avocado/machine_aspeed.py +40 -1
@@ -22,10 +22,11 @@ class AST1030Machine(QemuSystemTest): timeout = 10 - def test_ast1030_zephyros(self): + def test_ast1030_zephyros_1_04(self): """ :avocado: tags=arch:arm :avocado: tags=machine:ast1030-evb + :avocado: tags=os:zephyr """ tar_url = ('https://github.com/AspeedTech-BMC' '/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip')
@@ -41,6 +42,44 @@ def test_ast1030_zephyros(self): exec_command_and_wait_for_pattern(self, "help", "Available commands") + def test_ast1030_zephyros_1_07(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:ast1030-evb + :avocado: tags=os:zephyr + """ + tar_url = ('https://github.com/AspeedTech-BMC' + '/zephyr/releases/download/v00.01.07/ast1030-evb-demo.zip') + tar_hash = '40ac87eabdcd3b3454ce5aad11fedc72a33ecda2' + tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash) + archive.extract(tar_path, self.workdir) + kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.bin" + self.vm.set_console() + self.vm.add_args('-kernel', kernel_file, + '-nographic') + self.vm.launch() + wait_for_console_pattern(self, "Booting Zephyr OS") + for shell_cmd in [ + 'kernel stacks', + 'otp info conf', + 'otp info scu', + 'hwinfo devid', + 'crypto aes256_cbc_vault', + 'random get', + 'jtag JTAG1 sw_xfer high TMS', + 'adc ADC0 resolution 12', + 'adc ADC0 read 42', + 'adc ADC1 read 69', + 'i2c scan I2C_0', + 'i3c attach I3C_0', + 'hash test', + 'kernel uptime', + 'kernel reboot warm', + 'kernel uptime', + 'kernel reboot cold', + 'kernel uptime', + ]: exec_command_and_wait_for_pattern(self, shell_cmd, "uart:~$") + class AST2x00Machine(QemuSystemTest): timeout = 90
Signature · 1 line
2.39.1
[PULL 12/25] hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper
In reply to Cédric Le GoaterFrom: Peter Delevoryas <[email protected]>
Allows users to specify binary data to initialize an EEPROM, allowing users to emulate data programmed at manufacturing time.
- Added init_rom and init_rom_size attributes to TYPE_AT24C_EE
- Added at24c_eeprom_init_rom helper function to initialize attributes
- If -drive property is provided, it overrides init_rom data
--- include/hw/nvram/eeprom_at24c.h | 16 +++++++++++++++ hw/nvram/eeprom_at24c.c | 36 ++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 5 deletions(-)
include/hw/nvram/eeprom_at24c.h +16 -0
@@ -20,4 +20,20 @@*/ I2CSlave *at24c_eeprom_init (I2CBus *bus,uint8_t address,uint32_t rom_size); + +/* +* Create and realize an AT24C EEPROM device on the heap with initial data. +* @bus: I2C bus to put it on +* @address: I2C address of the EEPROM slave when put on a bus +* @rom_size: size of the EEPROM +* @init_rom: Array of bytes to initialize EEPROM memory with +* @init_rom_size: Size of @init_rom, must be less than or equal to @rom_size +* +* Create the device state structure, initialize it, put it on the specified +* @bus, and drop the reference to it (the device is realized). Copies the data +* from @init_rom to the beginning of the EEPROM memory buffer. +*/ +I2CSlave *at24c_eeprom_init_rom (I2CBus *bus,uint8_t address,uint32_t rom_size, +const uint8_t *init_rom,uint32_t init_rom_size); +#endif
hw/nvram/eeprom_at24c.c +31 -5
@@ -50,6 +50,9 @@ struct EEPROMState {uint8_t *mem;BlockBackend *blk; + +const uint8_t *init_rom; +uint32_t init_rom_size; }; static
@@ -131,19 +134,37 @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data)I2CSlave *at24c_eeprom_init (I2CBus *bus,uint8_t address,uint32_t rom_size) { -I2CSlave *i2c_dev =i2c_slave_new (TYPE_AT24C_EE , address); -DeviceState *dev =DEVICE (i2c_dev); +return at24c_eeprom_init_rom (bus, address, rom_size,NULL ,0 ); +} + +I2CSlave *at24c_eeprom_init_rom (I2CBus *bus,uint8_t address,uint32_t rom_size, +const uint8_t *init_rom,uint32_t init_rom_size) +{ +EEPROMState *s; + + s =AT24C_EE (i2c_slave_new (TYPE_AT24C_EE , address)); + +qdev_prop_set_uint32 (DEVICE (s),"rom-size" , rom_size); -qdev_prop_set_uint32 (dev,"rom-size" , rom_size); -i2c_slave_realize_and_unref (i2c_dev, bus, &error_abort); +/* TODO: Model init_rom with QOM properties. */ + s->init_rom = init_rom; + s->init_rom_size = init_rom_size; -return i2c_dev; +i2c_slave_realize_and_unref (I2C_SLAVE (s), bus, &error_abort); + +return I2C_SLAVE (s); }static void at24c_eeprom_realize (DeviceState *dev,Error **errp) {EEPROMState *ee =AT24C_EE (dev); +if (ee->init_rom_size > ee->rsize) { +error_setg (errp,"%s: init rom is larger than rom: %u > %u" , +TYPE_AT24C_EE , ee->init_rom_size, ee->rsize); +return ; + } +if (ee->blk) {int64_t len =blk_getlength (ee->blk);
@@ -163,6 +184,7 @@ static void at24c_eeprom_realize(DeviceState *dev, Error **errp) } ee->mem =g_malloc0 (ee->rsize); + } static
@@ -176,6 +198,10 @@ void at24c_eeprom_reset(DeviceState *state)memset (ee->mem,0 , ee->rsize); +if (ee->init_rom) { +memcpy (ee->mem, ee->init_rom,MIN (ee->init_rom_size, ee->rsize)); + } +if (ee->blk) {int ret =blk_pread (ee->blk,0 , ee->rsize, ee->mem,0 );
Signature · 1 line
2.39.1
[PULL 23/25] hw/arm/aspeed_ast10x0: Add TODO comment to use Cortex-M4F
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
This SoC uses a Cortex-M4F. QEMU only implements a M4, which is good enough. Add a TODO note in case the M4F is added.
--- hw/arm/aspeed_ast10x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/aspeed_ast10x0.c +1 -1
@@ -420,7 +420,7 @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) dc->realize = aspeed_soc_ast1030_realize; sc->name ="ast1030-a1" ; - sc->cpu_type =ARM_CPU_TYPE_NAME ("cortex-m4" ); + sc->cpu_type =ARM_CPU_TYPE_NAME ("cortex-m4" );/* TODO cortex-m4f */ sc->silicon_rev =AST1030_A1_SILICON_REV ; sc->sram_size =0xc0000 ; sc->secsram_size =0x40000 ;/* 256 * KiB */
Signature · 1 line
2.39.1
[PULL 07/25] tests/avocado/machine_aspeed.py: update buildroot tests
In reply to Cédric Le GoaterUse buildroot 2022.11 based images plus some customization :
- Linux version is bumped to 6.0.9 and kernel is built with a custom config similar to what OpenBMC provides.
- U-Boot is switched to the one provided by OpenBMC for better support.
- defconfigs includes more target tools for dev.
Message-Id: <[email protected]>
--- tests/avocado/machine_aspeed.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/avocado/machine_aspeed.py +4 -4
@@ -123,8 +123,8 @@ def test_arm_ast2500_evb_buildroot(self): """ image_url = ('https://github.com/legoater/qemu-aspeed-boot/raw/master/' - 'images/ast2500-evb/buildroot-2022.05/flash.img') - image_hash = ('549db6e9d8cdaf4367af21c36385a68bb465779c18b5e37094fc7343decccd3f') + 'images/ast2500-evb/buildroot-2022.11-2-g15d3648df9/flash.img') + image_hash = ('f96d11db521fe7a2787745e9e391225deeeec3318ee0fc07c8b799b8833dd474') image_path = self.fetch_asset(image_url, asset_hash=image_hash, algorithm='sha256')
@@ -151,8 +151,8 @@ def test_arm_ast2600_evb_buildroot(self): """ image_url = ('https://github.com/legoater/qemu-aspeed-boot/raw/master/' - 'images/ast2600-evb/buildroot-2022.05/flash.img') - image_hash = ('6cc9e7d128fd4fa1fd01c883af67593cae8072c3239a0b8b6ace857f3538a92d') + 'images/ast2600-evb/buildroot-2022.11-2-g15d3648df9/flash.img') + image_hash = ('e598d86e5ea79671ca8b59212a326c911bc8bea728dec1a1f5390d717a28bb8b') image_path = self.fetch_asset(image_url, asset_hash=image_hash, algorithm='sha256')
Signature · 1 line
2.39.1
[PULL 11/25] hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init
In reply to Cédric Le GoaterFrom: Peter Delevoryas <[email protected]>
aspeed_eeprom_init is an exact copy of at24c_eeprom_init, not needed.
--- hw/arm/aspeed.c | 95 ++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 52 deletions(-)
hw/arm/aspeed.c +43 -52
@@ -670,15 +670,6 @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc) eeprom_buf); } -static void aspeed_eeprom_init (I2CBus *bus,uint8_t addr,uint32_t rsize) -{ -I2CSlave *i2c_dev =i2c_slave_new ("at24c-eeprom" , addr); -DeviceState *dev =DEVICE (i2c_dev); - -qdev_prop_set_uint32 (dev,"rom-size" , rsize); -i2c_slave_realize_and_unref (i2c_dev, bus, &error_abort); -} -static void fp5280g2_bmc_i2c_init (AspeedMachineState *bmc) {AspeedSoCState *soc = &bmc->soc;
@@ -711,7 +702,7 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)AspeedSoCState *soc = &bmc->soc;I2CSlave *i2c_mux; -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,0 ),0x51 ,32 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,0 ),0x51 ,32 * KiB);create_pca9552 (soc,3 ,0x61 );
@@ -724,9 +715,9 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc) 0x4a); i2c_mux =i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,4 ),"pca9546" ,0x70 ); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,0 ),0x50 ,64 * KiB); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,1 ),0x51 ,64 * KiB); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,2 ),0x52 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,0 ),0x50 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,1 ),0x51 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,2 ),0x52 ,64 * KiB);create_pca9552 (soc,4 ,0x60 ); i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), TYPE_TMP105,
@@ -737,8 +728,8 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)create_pca9552 (soc,5 ,0x61 ); i2c_mux =i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,5 ),"pca9546" ,0x70 ); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,0 ),0x50 ,64 * KiB); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,1 ),0x51 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,0 ),0x50 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,1 ),0x51 ,64 * KiB);i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,6 ),TYPE_TMP105 ,0x48 );
@@ -748,10 +739,10 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc) 0x4b); i2c_mux =i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,6 ),"pca9546" ,0x70 ); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,0 ),0x50 ,64 * KiB); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,1 ),0x51 ,64 * KiB); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,2 ),0x50 ,64 * KiB); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,3 ),0x51 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,0 ),0x50 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,1 ),0x51 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,2 ),0x50 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,3 ),0x51 ,64 * KiB);create_pca9552 (soc,7 ,0x30 );create_pca9552 (soc,7 ,0x31 );
@@ -764,15 +755,15 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,7 ),TYPE_TMP105 ,0x48 );i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,7 ),"max31785" ,0x52 ); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,7 ),0x50 ,64 * KiB); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,7 ),0x51 ,64 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,7 ),0x50 ,64 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,7 ),0x51 ,64 * KiB);i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,8 ),TYPE_TMP105 ,0x48 );i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,8 ),TYPE_TMP105 ,0x4a ); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,8 ),0x50 ,64 * KiB); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,8 ),0x51 ,64 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,8 ),0x50 ,64 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,8 ),0x51 ,64 * KiB);create_pca9552 (soc,8 ,0x60 );create_pca9552 (soc,8 ,0x61 );/* Bus 8: ucd90320@11 */
@@ -781,11 +772,11 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,9 ),"tmp423" ,0x4c );i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,9 ),"tmp423" ,0x4d ); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,9 ),0x50 ,128 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,9 ),0x50 ,128 * KiB);i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,10 ),"tmp423" ,0x4c );i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,10 ),"tmp423" ,0x4d ); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,10 ),0x50 ,128 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,10 ),0x50 ,128 * KiB);i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,11 ),TYPE_TMP105 ,0x48 );
@@ -793,18 +784,18 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc) 0x49); i2c_mux =i2c_slave_create_simple (aspeed_i2c_get_bus (&soc->i2c,11 ),"pca9546" ,0x70 ); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,0 ),0x50 ,64 * KiB); -aspeed_eeprom_init (pca954x_i2c_get_bus (i2c_mux,1 ),0x51 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,0 ),0x50 ,64 * KiB); +at24c_eeprom_init (pca954x_i2c_get_bus (i2c_mux,1 ),0x51 ,64 * KiB);create_pca9552 (soc,11 ,0x60 ); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,13 ),0x50 ,64 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,13 ),0x50 ,64 * KiB);create_pca9552 (soc,13 ,0x60 ); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,14 ),0x50 ,64 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,14 ),0x50 ,64 * KiB);create_pca9552 (soc,14 ,0x60 ); -aspeed_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,15 ),0x50 ,64 * KiB); +at24c_eeprom_init (aspeed_i2c_get_bus (&soc->i2c,15 ),0x50 ,64 * KiB);create_pca9552 (soc,15 ,0x60 ); }
@@ -848,45 +839,45 @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc)i2c_slave_create_simple (i2c[17 ],TYPE_LM75 ,0x4c );i2c_slave_create_simple (i2c[17 ],TYPE_LM75 ,0x4d ); -aspeed_eeprom_init (i2c[19 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[20 ],0x50 ,2 * KiB); -aspeed_eeprom_init (i2c[22 ],0x52 ,2 * KiB); +at24c_eeprom_init (i2c[19 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[20 ],0x50 ,2 * KiB); +at24c_eeprom_init (i2c[22 ],0x52 ,2 * KiB);i2c_slave_create_simple (i2c[3 ],TYPE_LM75 ,0x48 );i2c_slave_create_simple (i2c[3 ],TYPE_LM75 ,0x49 );i2c_slave_create_simple (i2c[3 ],TYPE_LM75 ,0x4a );i2c_slave_create_simple (i2c[3 ],TYPE_TMP422 ,0x4c ); -aspeed_eeprom_init (i2c[8 ],0x51 ,64 * KiB); +at24c_eeprom_init (i2c[8 ],0x51 ,64 * KiB);i2c_slave_create_simple (i2c[8 ],TYPE_LM75 ,0x4a );i2c_slave_create_simple (i2c[50 ],TYPE_LM75 ,0x4c ); -aspeed_eeprom_init (i2c[50 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[50 ],0x52 ,64 * KiB);i2c_slave_create_simple (i2c[51 ],TYPE_TMP75 ,0x48 );i2c_slave_create_simple (i2c[52 ],TYPE_TMP75 ,0x49 );i2c_slave_create_simple (i2c[59 ],TYPE_TMP75 ,0x48 );i2c_slave_create_simple (i2c[60 ],TYPE_TMP75 ,0x49 ); -aspeed_eeprom_init (i2c[65 ],0x53 ,64 * KiB); +at24c_eeprom_init (i2c[65 ],0x53 ,64 * KiB);i2c_slave_create_simple (i2c[66 ],TYPE_TMP75 ,0x49 );i2c_slave_create_simple (i2c[66 ],TYPE_TMP75 ,0x48 ); -aspeed_eeprom_init (i2c[68 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[69 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[70 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[71 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[68 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[69 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[70 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[71 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[73 ],0x53 ,64 * KiB); +at24c_eeprom_init (i2c[73 ],0x53 ,64 * KiB);i2c_slave_create_simple (i2c[74 ],TYPE_TMP75 ,0x49 );i2c_slave_create_simple (i2c[74 ],TYPE_TMP75 ,0x48 ); -aspeed_eeprom_init (i2c[76 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[77 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[78 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[79 ],0x52 ,64 * KiB); -aspeed_eeprom_init (i2c[28 ],0x50 ,2 * KiB); +at24c_eeprom_init (i2c[76 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[77 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[78 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[79 ],0x52 ,64 * KiB); +at24c_eeprom_init (i2c[28 ],0x50 ,2 * KiB);for (int i =0 ; i <8 ; i++) { -aspeed_eeprom_init (i2c[81 + i *8 ],0x56 ,64 * KiB); +at24c_eeprom_init (i2c[81 + i *8 ],0x56 ,64 * KiB);i2c_slave_create_simple (i2c[82 + i *8 ],TYPE_TMP75 ,0x48 );i2c_slave_create_simple (i2c[83 + i *8 ],TYPE_TMP75 ,0x4b );i2c_slave_create_simple (i2c[84 + i *8 ],TYPE_TMP75 ,0x4a );
@@ -957,11 +948,11 @@ static void fby35_i2c_init(AspeedMachineState *bmc)i2c_slave_create_simple (i2c[12 ],TYPE_LM75 ,0x4e );i2c_slave_create_simple (i2c[12 ],TYPE_LM75 ,0x4f ); -aspeed_eeprom_init (i2c[4 ],0x51 ,128 * KiB); -aspeed_eeprom_init (i2c[6 ],0x51 ,128 * KiB); -aspeed_eeprom_init (i2c[8 ],0x50 ,32 * KiB); -aspeed_eeprom_init (i2c[11 ],0x51 ,128 * KiB); -aspeed_eeprom_init (i2c[11 ],0x54 ,128 * KiB); +at24c_eeprom_init (i2c[4 ],0x51 ,128 * KiB); +at24c_eeprom_init (i2c[6 ],0x51 ,128 * KiB); +at24c_eeprom_init (i2c[8 ],0x50 ,32 * KiB); +at24c_eeprom_init (i2c[11 ],0x51 ,128 * KiB); +at24c_eeprom_init (i2c[11 ],0x54 ,128 * KiB);/* * TODO: There is a multi-master i2c connection to an AST1030 MiniBMC on
Signature · 1 line
2.39.1
[PULL 15/25] hw/watchdog/wdt_aspeed: Rename MMIO region size as 'iosize'
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Avoid confusing two different things:
- the WDT I/O region size ('iosize')
- at which offset the SoC map the WDT ('offset') While it is often the same, we can map smaller region sizes at larger offsets.
Here we are interested in the I/O region size, so rename as 'iosize'.
--- include/hw/watchdog/wdt_aspeed.h | 2 +- hw/arm/aspeed_ast10x0.c | 4 ++-- hw/arm/aspeed_ast2600.c | 4 ++-- hw/arm/aspeed_soc.c | 4 ++-- hw/watchdog/wdt_aspeed.c | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-)
include/hw/watchdog/wdt_aspeed.h +1 -1
@@ -40,7 +40,7 @@ struct AspeedWDTState {struct AspeedWDTClass {SysBusDeviceClass parent_class; -uint32_t offset; +uint32_t iosize;uint32_t ext_pulse_width_mask;uint32_t reset_ctrl_reg;void (*reset_pulse)(AspeedWDTState *s,uint32_t property);
hw/arm/aspeed_ast10x0.c +2 -2
@@ -318,14 +318,14 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)/* Watch dog */ for (i =0 ; i < sc->wdts_num; i++) {AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]); +hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT ] + i * awc->iosize;object_property_set_link (OBJECT (&s->wdt[i]),"scu" ,OBJECT (&s->scu), &error_abort);if (!sysbus_realize (SYS_BUS_DEVICE (&s->wdt[i]), errp)) {return ; } -aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->wdt[i]),0 , - sc->memmap[ASPEED_DEV_WDT ] + i * awc->offset); +aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->wdt[i]),0 , wdt_offset); }/* GPIO */
hw/arm/aspeed_ast2600.c +2 -2
@@ -465,14 +465,14 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* Watch dog */ for (i =0 ; i < sc->wdts_num; i++) {AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]); +hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT ] + i * awc->iosize;object_property_set_link (OBJECT (&s->wdt[i]),"scu" ,OBJECT (&s->scu), &error_abort);if (!sysbus_realize (SYS_BUS_DEVICE (&s->wdt[i]), errp)) {return ; } -aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->wdt[i]),0 , - sc->memmap[ASPEED_DEV_WDT ] + i * awc->offset); +aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->wdt[i]),0 , wdt_offset); }/* RAM */
hw/arm/aspeed_soc.c +2 -2
@@ -386,14 +386,14 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)/* Watch dog */ for (i =0 ; i < sc->wdts_num; i++) {AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]); +hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT ] + i * awc->iosize;object_property_set_link (OBJECT (&s->wdt[i]),"scu" ,OBJECT (&s->scu), &error_abort);if (!sysbus_realize (SYS_BUS_DEVICE (&s->wdt[i]), errp)) {return ; } -aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->wdt[i]),0 , - sc->memmap[ASPEED_DEV_WDT ] + i * awc->offset); +aspeed_mmio_map (s,SYS_BUS_DEVICE (&s->wdt[i]),0 , wdt_offset); }/* RAM */
hw/watchdog/wdt_aspeed.c +4 -4
@@ -309,7 +309,7 @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data)AspeedWDTClass *awc =ASPEED_WDT_CLASS (klass); dc->desc ="ASPEED 2400 Watchdog Controller" ; - awc->offset =0x20 ; + awc->iosize =0x20 ; awc->ext_pulse_width_mask =0xff ; awc->reset_ctrl_reg =SCU_RESET_CONTROL1 ; awc->wdt_reload = aspeed_wdt_reload;
@@ -346,7 +346,7 @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, void *data)AspeedWDTClass *awc =ASPEED_WDT_CLASS (klass); dc->desc ="ASPEED 2500 Watchdog Controller" ; - awc->offset =0x20 ; + awc->iosize =0x20 ; awc->ext_pulse_width_mask =0xfffff ; awc->reset_ctrl_reg =SCU_RESET_CONTROL1 ; awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
@@ -369,7 +369,7 @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data)AspeedWDTClass *awc =ASPEED_WDT_CLASS (klass); dc->desc ="ASPEED 2600 Watchdog Controller" ; - awc->offset =0x40 ; + awc->iosize =0x40 ; awc->ext_pulse_width_mask =0xfffff ;/* TODO */ awc->reset_ctrl_reg =AST2600_SCU_RESET_CONTROL1 ; awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
@@ -392,7 +392,7 @@ static void aspeed_1030_wdt_class_init(ObjectClass *klass, void *data)AspeedWDTClass *awc =ASPEED_WDT_CLASS (klass); dc->desc ="ASPEED 1030 Watchdog Controller" ; - awc->offset =0x80 ; + awc->iosize =0x80 ; awc->ext_pulse_width_mask =0xfffff ;/* TODO */ awc->reset_ctrl_reg =AST2600_SCU_RESET_CONTROL1 ; awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
Signature · 1 line
2.39.1
The following changes since commit 6661b8c7fe3f8b5687d2d90f7b4f3f23d70e3e8b:
Merge tag 'pull-ppc-20230205' of https://gitlab.com/danielhb/qemu into staging (2023-02-05 16:49:09 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20230207
for you to fetch changes up to bf81b8f8acda4f1f774adc5f8e76225d472c6ae5:
aspeed/sdmc: Drop unnecessary scu include (2023-02-07 09:02:05 +0100)
----------------------------------------------------------------
aspeed queue:
* various small cleanups and fixes
* new variant of the supermicrox11-bmc machine using an ast2500-a1 SoC
* at24c_eeprom extension to define eeprom contents with static arrays
* ast10x0 model and test improvements
* avocado update of images to use the latest
----------------------------------------------------------------
Cédric Le Goater (3):
tests/avocado/machine_aspeed.py: update buildroot tests tests/avocado/machine_aspeed.py: Mask systemd services to speed up SDK boot hw/core/loader: Remove declarations of option_rom_has_mr/rom_file_has_mr
Guenter Roeck (2):
aspeed: Add Supermicro X11 SPI machine type
m25p80: Add the is25wp256 SFPD table
Joel Stanley (2):
avocado/boot_linux_console.py: Update ast2600 test aspeed/sdmc: Drop unnecessary scu include
Peter Delevoryas (5):
hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper hw/arm/aspeed: Add aspeed_eeprom.c
hw/nvram/eeprom_at24c: Make reset behavior more like hardware
Philippe Mathieu-Daudé (12):
tests/avocado: Introduce file_truncate() tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB hw/watchdog/wdt_aspeed: Rename MMIO region size as 'iosize' hw/watchdog/wdt_aspeed: Extend MMIO range to cover more registers hw/watchdog/wdt_aspeed: Log unimplemented registers as UNIMP level hw/misc/aspeed_hace: Do not crash if address_space_map() failed hw/arm/aspeed_ast10x0: Add various unimplemented peripherals hw/arm/aspeed_ast10x0: Map I3C peripheral hw/arm/aspeed_ast10x0: Map the secure SRAM hw/arm/aspeed_ast10x0: Map HACE peripheral hw/arm/aspeed_ast10x0: Add TODO comment to use Cortex-M4F tests/avocado: Test Aspeed Zephyr SDK v00.01.08 on AST1030 board
Stephen Longfield (1):
hw/net: Fix read of uninitialized memory in ftgmac100
hw/arm/aspeed_eeprom.h | 19 +++++ hw/block/m25p80_sfdp.h | 2 + include/hw/arm/aspeed_soc.h | 14 ++++ include/hw/loader.h | 3 - include/hw/nvram/eeprom_at24c.h | 39 ++++++++++ include/hw/watchdog/wdt_aspeed.h | 4 +- hw/arm/aspeed.c | 142 ++++++++++++++++++++---------------- hw/arm/aspeed_ast10x0.c | 83 ++++++++++++++++++++- hw/arm/aspeed_ast2600.c | 4 +- hw/arm/aspeed_eeprom.c | 82 +++++++++++++++++++++ hw/arm/aspeed_soc.c | 4 +- hw/arm/msf2-som.c | 5 +- hw/arm/npcm7xx_boards.c | 20 ++--- hw/block/m25p80.c | 3 +- hw/block/m25p80_sfdp.c | 40 ++++++++++ hw/misc/aspeed_hace.c | 21 ++++-- hw/misc/aspeed_sdmc.c | 1 - hw/net/ftgmac100.c | 4 +- hw/nvram/eeprom_at24c.c | 58 ++++++++++++--- hw/watchdog/wdt_aspeed.c | 24 ++++-- hw/arm/meson.build | 1 + tests/avocado/boot_linux_console.py | 19 +++-- tests/avocado/machine_aspeed.py | 60 +++++++++++++-- 23 files changed, 523 insertions(+), 129 deletions(-) create mode 100644 hw/arm/aspeed_eeprom.h create mode 100644 include/hw/nvram/eeprom_at24c.h create mode 100644 hw/arm/aspeed_eeprom.c
[PULL 19/25] hw/arm/aspeed_ast10x0: Add various unimplemented peripherals
From: Philippe Mathieu-Daudé <[email protected]>
Based on booting Zephyr demo from [1] running QEMU with '-d unimp' and checking missing devices in [2].
[1] https://github.com/AspeedTech-BMC/zephyr/releases/tag/v00.01.07
[2] https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi
--- include/hw/arm/aspeed_soc.h | 11 +++++++++++ hw/arm/aspeed_ast10x0.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+)
include/hw/arm/aspeed_soc.h +11 -0
@@ -44,6 +44,7 @@#define ASPEED_CPUS_NUM 2#define ASPEED_MACS_NUM 4#define ASPEED_UARTS_NUM 13 +#define ASPEED_JTAG_NUM 2struct AspeedSoCState {/*< private >*/
@@ -87,6 +88,11 @@ struct AspeedSoCState {UnimplementedDeviceState video;UnimplementedDeviceState emmc_boot_controller;UnimplementedDeviceState dpmcu; +UnimplementedDeviceState pwm; +UnimplementedDeviceState espi; +UnimplementedDeviceState udc; +UnimplementedDeviceState sgpiom; +UnimplementedDeviceState jtag[ASPEED_JTAG_NUM ]; };#define TYPE_ASPEED_SOC "aspeed-soc"
@@ -174,6 +180,11 @@ enum {ASPEED_DEV_DPMCU ,ASPEED_DEV_DP ,ASPEED_DEV_I3C , +ASPEED_DEV_ESPI , +ASPEED_DEV_UDC , +ASPEED_DEV_SGPIOM , +ASPEED_DEV_JTAG0 , + ASPEED_DEV_JTAG1, };qemu_irq aspeed_soc_get_irq (AspeedSoCState *s,int dev);
hw/arm/aspeed_ast10x0.c +35 -0
@@ -27,10 +27,15 @@ static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_FMC] = 0x7E620000, [ASPEED_DEV_SPI1] = 0x7E630000, [ASPEED_DEV_SPI2] = 0x7E640000, + [ASPEED_DEV_UDC] = 0x7E6A2000, [ASPEED_DEV_SCU] = 0x7E6E2000, + [ASPEED_DEV_JTAG0] = 0x7E6E4000, + [ASPEED_DEV_JTAG1] = 0x7E6E4100, [ASPEED_DEV_ADC] = 0x7E6E9000, + [ASPEED_DEV_ESPI] = 0x7E6EE000, [ASPEED_DEV_SBC] = 0x7E6F2000, [ASPEED_DEV_GPIO] = 0x7E780000, + [ASPEED_DEV_SGPIOM] = 0x7E780500, [ASPEED_DEV_TIMER1] = 0x7E782000, [ASPEED_DEV_UART1] = 0x7E783000, [ASPEED_DEV_UART2] = 0x7E78D000,
@@ -78,12 +83,17 @@ static const int aspeed_soc_ast1030_irqmap[] = { [ASPEED_DEV_LPC] = 35, [ASPEED_DEV_PECI] = 38, [ASPEED_DEV_FMC] = 39, + [ASPEED_DEV_ESPI] = 42, [ASPEED_DEV_PWM] = 44, [ASPEED_DEV_ADC] = 46, [ASPEED_DEV_SPI1] = 65, [ASPEED_DEV_SPI2] = 66, [ASPEED_DEV_I2C] = 110, /* 110 ~ 123 */ [ASPEED_DEV_KCS] = 138, /* 138 -> 142 */ + [ASPEED_DEV_UDC] = 9, + [ASPEED_DEV_SGPIOM] = 51, + [ASPEED_DEV_JTAG0] = 27, + [ASPEED_DEV_JTAG1] = 53, };static qemu_irq aspeed_soc_ast1030_get_irq (AspeedSoCState *s,int dev)
@@ -154,6 +164,15 @@ static void aspeed_soc_ast1030_init(Object *obj)object_initialize_child (obj,"iomem" , &s->iomem,TYPE_UNIMPLEMENTED_DEVICE );object_initialize_child (obj,"sbc-unimplemented" , &s->sbc_unimplemented,TYPE_UNIMPLEMENTED_DEVICE ); +object_initialize_child (obj,"pwm" , &s->pwm,TYPE_UNIMPLEMENTED_DEVICE ); +object_initialize_child (obj,"espi" , &s->espi,TYPE_UNIMPLEMENTED_DEVICE ); +object_initialize_child (obj,"udc" , &s->udc,TYPE_UNIMPLEMENTED_DEVICE ); +object_initialize_child (obj,"sgpiom" , &s->sgpiom, +TYPE_UNIMPLEMENTED_DEVICE ); +object_initialize_child (obj,"jtag[0]" , &s->jtag[0 ], +TYPE_UNIMPLEMENTED_DEVICE ); +object_initialize_child (obj,"jtag[1]" , &s->jtag[1 ], +TYPE_UNIMPLEMENTED_DEVICE ); }static void aspeed_soc_ast1030_realize (DeviceState *dev_soc,Error **errp)
@@ -336,6 +355,22 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) sc->memmap[ASPEED_DEV_GPIO]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio),0 ,aspeed_soc_get_irq (s,ASPEED_DEV_GPIO )); + +aspeed_mmio_map_unimplemented (s,SYS_BUS_DEVICE (&s->pwm),"aspeed.pwm" , + sc->memmap[ASPEED_DEV_PWM ],0x100 ); + +aspeed_mmio_map_unimplemented (s,SYS_BUS_DEVICE (&s->espi),"aspeed.espi" , + sc->memmap[ASPEED_DEV_ESPI ],0x800 ); + +aspeed_mmio_map_unimplemented (s,SYS_BUS_DEVICE (&s->udc),"aspeed.udc" , + sc->memmap[ASPEED_DEV_UDC ],0x1000 ); +aspeed_mmio_map_unimplemented (s,SYS_BUS_DEVICE (&s->sgpiom),"aspeed.sgpiom" , + sc->memmap[ASPEED_DEV_SGPIOM ],0x100 ); + +aspeed_mmio_map_unimplemented (s,SYS_BUS_DEVICE (&s->jtag[0 ]),"aspeed.jtag" , + sc->memmap[ASPEED_DEV_JTAG0 ],0x20 ); +aspeed_mmio_map_unimplemented (s,SYS_BUS_DEVICE (&s->jtag[1 ]),"aspeed.jtag" , + sc->memmap[ASPEED_DEV_JTAG1 ],0x20 ); }static void aspeed_soc_ast1030_class_init (ObjectClass *klass,void *data)
Signature · 1 line
2.39.1
[PULL 14/25] hw/nvram/eeprom_at24c: Make reset behavior more like hardware
In reply to Cédric Le GoaterFrom: Peter Delevoryas <[email protected]>
EEPROM's are a form of non-volatile memory. After power-cycling an EEPROM, I would expect the I2C state machine to be reset to default values, but I wouldn't really expect the memory to change at all.
The current implementation of the at24c EEPROM resets its internal memory on reset. This matches the specification in docs/devel/reset.rst:
Cold reset is supported by every resettable object. In QEMU, it means we reset to the initial state corresponding to the start of QEMU; this might differ from what is a real hardware cold reset. It differs from other resets (like warm or bus resets) which may keep certain parts untouched.
But differs from my intuition. For example, if someone writes some information to an EEPROM, then AC power cycles their board, they would expect the EEPROM to retain that information. It's very useful to be able to test things like this in QEMU as well, to verify software instrumentation like determining the cause of a reboot.
--- hw/nvram/eeprom_at24c.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
hw/nvram/eeprom_at24c.c +10 -12
@@ -184,18 +184,6 @@ static void at24c_eeprom_realize(DeviceState *dev, Error **errp) } ee->mem =g_malloc0 (ee->rsize); - -} - -static -void at24c_eeprom_reset (DeviceState *state) -{ -EEPROMState *ee =AT24C_EE (state); - - ee->changed = false; - ee->cur =0 ; - ee->haveaddr =0 ; -memset (ee->mem,0 , ee->rsize);if (ee->init_rom) {
@@ -213,6 +201,16 @@ void at24c_eeprom_reset(DeviceState *state) } } +static +void at24c_eeprom_reset (DeviceState *state) +{ +EEPROMState *ee =AT24C_EE (state); + + ee->changed = false; + ee->cur =0 ; + ee->haveaddr =0 ; +} +static Property at24c_eeprom_props[] = {DEFINE_PROP_UINT32 ("rom-size" , EEPROMState, rsize,0 ),DEFINE_PROP_BOOL ("writable" , EEPROMState, writable, true),
Signature · 1 line
2.39.1
Peter Maydell
AppliedQuoted 13 lines · Cédric Le Goater
The following changes since commit
6661b8c7fe3f8b5687d2d90f7b4f3f23d70e3e8b:Merge tag 'pull-ppc-20230205' of https://gitlab.com/danielhb/qemu into staging (2023-02-05 16:49:09 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20230207
for you to fetch changes up to
bf81b8f8acda4f1f774adc5f8e76225d472c6ae5:aspeed/sdmc: Drop unnecessary scu include (2023-02-07 09:02:05 +0100)
Quoted 8 lines
----------------------------------------------------------------
aspeed queue:* various small cleanups and fixes
* new variant of the supermicrox11-bmc machine using an ast2500-a1 SoC
*at24c_eepromextension to define eeprom contents with static arrays
* ast10x0 model and test improvements
* avocado update of images to use the latest
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.0
for any user-visible changes.
-- PMM