aspeed/scu: Add AST2700 support
Subsystems (2)
PATCH 5/8 aspeed/scu: Add AST2700 support
In reply to a message not in the archiveAST2700 have two SCU controllers which are SCU and SCUIO.
Both SCU and SCUIO registers are not compatible previous SOCs , introduces new registers and adds ast2700 scu, sucio class init handler.
The pclk divider selection of SCUIO is defined in SCUIO280[20:18] and the pclk divider selection of SCU is defined in SCU280[25:23]. Both of them are not compatible AST2600 SOCs, adds a get_apb_freq function and trace-event for AST2700 SCU and SCUIO.
--- hw/misc/aspeed_scu.c | 306 ++++++++++++++++++++++++++++++++++- hw/misc/trace-events | 4 + include/hw/misc/aspeed_scu.h | 47 +++++- 3 files changed, 351 insertions(+), 6 deletions(-)
hw/misc/aspeed_scu.c +305 -1
@@ -134,6 +134,48 @@#define AST2600_CLK TO_REG(0x40) +#define AST2700_SILICON_REV TO_REG(0x00) +#define AST2700_HW_STRAP1 TO_REG(0x10) +#define AST2700_HW_STRAP1_CLR TO_REG(0x14) +#define AST2700_HW_STRAP1_LOCK TO_REG(0x20) +#define AST2700_HW_STRAP1_SEC1 TO_REG(0x24) +#define AST2700_HW_STRAP1_SEC2 TO_REG(0x28) +#define AST2700_HW_STRAP1_SEC3 TO_REG(0x2C) + +#define AST2700_SCU_CLK_SEL_1 TO_REG(0x280) +#define AST2700_SCU_HPLL_PARAM TO_REG(0x300) +#define AST2700_SCU_HPLL_EXT_PARAM TO_REG(0x304) +#define AST2700_SCU_DPLL_PARAM TO_REG(0x308) +#define AST2700_SCU_DPLL_EXT_PARAM TO_REG(0x30c) +#define AST2700_SCU_MPLL_PARAM TO_REG(0x310) +#define AST2700_SCU_MPLL_EXT_PARAM TO_REG(0x314) +#define AST2700_SCU_D1CLK_PARAM TO_REG(0x320) +#define AST2700_SCU_D2CLK_PARAM TO_REG(0x330) +#define AST2700_SCU_CRT1CLK_PARAM TO_REG(0x340) +#define AST2700_SCU_CRT2CLK_PARAM TO_REG(0x350) +#define AST2700_SCU_MPHYCLK_PARAM TO_REG(0x360) +#define AST2700_SCU_FREQ_CNTR TO_REG(0x3b0) +#define AST2700_SCU_CPU_SCRATCH_0 TO_REG(0x780) +#define AST2700_SCU_CPU_SCRATCH_1 TO_REG(0x784) + +#define AST2700_SCUIO_CLK_STOP_CTL_1 TO_REG(0x240) +#define AST2700_SCUIO_CLK_STOP_CLR_1 TO_REG(0x244) +#define AST2700_SCUIO_CLK_STOP_CTL_2 TO_REG(0x260) +#define AST2700_SCUIO_CLK_STOP_CLR_2 TO_REG(0x264) +#define AST2700_SCUIO_CLK_SEL_1 TO_REG(0x280) +#define AST2700_SCUIO_CLK_SEL_2 TO_REG(0x284) +#define AST2700_SCUIO_HPLL_PARAM TO_REG(0x300) +#define AST2700_SCUIO_HPLL_EXT_PARAM TO_REG(0x304) +#define AST2700_SCUIO_APLL_PARAM TO_REG(0x310) +#define AST2700_SCUIO_APLL_EXT_PARAM TO_REG(0x314) +#define AST2700_SCUIO_DPLL_PARAM TO_REG(0x320) +#define AST2700_SCUIO_DPLL_EXT_PARAM TO_REG(0x324) +#define AST2700_SCUIO_DPLL_PARAM_READ TO_REG(0x328) +#define AST2700_SCUIO_DPLL_EXT_PARAM_READ TO_REG(0x32c) +#define AST2700_SCUIO_UARTCLK_GEN TO_REG(0x330) +#define AST2700_SCUIO_HUARTCLK_GEN TO_REG(0x334) +#define AST2700_SCUIO_CLK_DUTY_MEAS_RST TO_REG(0x388) +#define SCU_IO_REGION_SIZE 0x1000static const uint32_t ast2400_a0_resets[ASPEED_SCU_NR_REGS ] = {
@@ -244,6 +286,25 @@ static uint32_t aspeed_1030_scu_get_apb_freq(AspeedSCUState *s) / asc->apb_divider; } +static uint32_t aspeed_2700_scu_get_apb_freq (AspeedSCUState *s) +{ +AspeedSCUClass *asc =ASPEED_SCU_GET_CLASS (s); +uint32_t hpll = asc->calc_hpll (s, s->regs[AST2700_SCU_HPLL_PARAM ]); + +return hpll / (SCU_CLK_GET_PCLK_DIV (s->regs[AST2700_SCU_CLK_SEL_1 ]) +1 ) + / asc->apb_divider; +} + +static uint32_t aspeed_2700_scuio_get_apb_freq (AspeedSCUState *s) +{ +AspeedSCUClass *asc =ASPEED_SCU_GET_CLASS (s); +uint32_t hpll = asc->calc_hpll (s, s->regs[AST2700_SCUIO_HPLL_PARAM ]); + +return hpll / + (SCUIO_AST2700_CLK_GET_PCLK_DIV (s->regs[AST2700_SCUIO_CLK_SEL_1 ]) +1 ) + / asc->apb_divider; +} +static uint64_t aspeed_scu_read (void *opaque,hwaddr offset,unsigned size) {AspeedSCUState *s =ASPEED_SCU (opaque);
@@ -258,7 +319,8 @@ static uint64_t aspeed_scu_read(void *opaque, hwaddr offset, unsigned size)switch (reg) {case RNG_DATA : -/* On hardware, RNG_DATA works regardless of +/* +* On hardware, RNG_DATA works regardless of * the state of the enable bit in RNG_CTRL */ s->regs[RNG_DATA ] =aspeed_scu_get_random ();
@@ -494,6 +556,9 @@ static uint32_t aspeed_silicon_revs[] = {AST2600_A3_SILICON_REV ,AST1030_A0_SILICON_REV ,AST1030_A1_SILICON_REV , +AST2700_A0_SILICON_REV , +AST2720_A0_SILICON_REV , + AST2750_A0_SILICON_REV, };bool is_supported_silicon_rev (uint32_t silicon_rev)
@@ -783,6 +848,243 @@ static const TypeInfo aspeed_2600_scu_info = { .class_init = aspeed_2600_scu_class_init, }; +static uint64_t aspeed_ast2700_scu_read (void *opaque,hwaddr offset, +unsigned size) +{ +AspeedSCUState *s =ASPEED_SCU (opaque); +int reg =TO_REG (offset); + +if (reg >=ASPEED_AST2700_SCU_NR_REGS ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return 0 ; + } + +switch (reg) { +default : +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Unhandled read at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); + } + +trace_aspeed_ast2700_scu_read (offset, size, s->regs[reg]); +return s->regs[reg]; +} + +static void aspeed_ast2700_scu_write (void *opaque,hwaddr offset, +uint64_t data64,unsigned size) +{ +AspeedSCUState *s =ASPEED_SCU (opaque); +int reg =TO_REG (offset); +/* Truncate here so bitwise operations below behave as expected */ +uint32_t data = data64; + +if (reg >=ASPEED_AST2700_SCU_NR_REGS ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return ; + } + +trace_aspeed_ast2700_scu_write (offset, size, data); + +switch (reg) { +default : +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Unhandeled write at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +break ; + } + + s->regs[reg] = data; +} + +static const MemoryRegionOps aspeed_ast2700_scu_ops = { + .read = aspeed_ast2700_scu_read, + .write = aspeed_ast2700_scu_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid.min_access_size =1 , + .valid.max_access_size =8 , + .valid.unaligned = false, +}; + +static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS ] = { + [AST2700_SILICON_REV ] =AST2700_A0_SILICON_REV , + [AST2700_HW_STRAP1 ] =0x00000800 , + [AST2700_HW_STRAP1_CLR ] =0xFFF0FFF0 , + [AST2700_HW_STRAP1_LOCK ] =0x00000FFF , + [AST2700_HW_STRAP1_SEC1 ] =0x000000FF , + [AST2700_HW_STRAP1_SEC2 ] =0x00000000 , + [AST2700_HW_STRAP1_SEC3 ] =0x1000408F , + [AST2700_SCU_HPLL_PARAM ] =0x0000009f , + [AST2700_SCU_HPLL_EXT_PARAM ] =0x8000004f , + [AST2700_SCU_DPLL_PARAM ] =0x0080009f , + [AST2700_SCU_DPLL_EXT_PARAM ] =0x8000004f , + [AST2700_SCU_MPLL_PARAM ] =0x00000040 , + [AST2700_SCU_MPLL_EXT_PARAM ] =0x80000000 , + [AST2700_SCU_D1CLK_PARAM ] =0x00050002 , + [AST2700_SCU_D2CLK_PARAM ] =0x00050002 , + [AST2700_SCU_CRT1CLK_PARAM ] =0x00050002 , + [AST2700_SCU_CRT2CLK_PARAM ] =0x00050002 , + [AST2700_SCU_MPHYCLK_PARAM ] =0x0000004c , + [AST2700_SCU_FREQ_CNTR ] =0x000375eb , + [AST2700_SCU_CPU_SCRATCH_0 ] =0x00000000 , + [AST2700_SCU_CPU_SCRATCH_1 ] =0x00000004 , +}; + +static void aspeed_ast2700_scu_reset (DeviceState *dev) +{ +AspeedSCUState *s =ASPEED_SCU (dev); +AspeedSCUClass *asc =ASPEED_SCU_GET_CLASS (dev); + +memcpy (s->regs, asc->resets, asc->nr_regs *4 ); +} + +static void aspeed_2700_scu_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedSCUClass *asc =ASPEED_SCU_CLASS (klass); + + dc->desc ="ASPEED 2700 System Control Unit" ; + dc->reset = aspeed_ast2700_scu_reset; + asc->resets = ast2700_a0_resets; + asc->calc_hpll = aspeed_2600_scu_calc_hpll; + asc->get_apb = aspeed_2700_scu_get_apb_freq; + asc->apb_divider =4 ; + asc->nr_regs =ASPEED_AST2700_SCU_NR_REGS ; + asc->clkin_25Mhz = true; + asc->ops = &aspeed_ast2700_scu_ops; +} + +static uint64_t aspeed_ast2700_scuio_read (void *opaque,hwaddr offset, +unsigned size) +{ +AspeedSCUState *s =ASPEED_SCU (opaque); +int reg =TO_REG (offset); +if (reg >=ASPEED_AST2700_SCU_NR_REGS ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return 0 ; + } + +switch (reg) { +default : +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Unhandled read at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); + } + +trace_aspeed_ast2700_scuio_read (offset, size, s->regs[reg]); +return s->regs[reg]; +} + +static void aspeed_ast2700_scuio_write (void *opaque,hwaddr offset, +uint64_t data64,unsigned size) +{ +AspeedSCUState *s =ASPEED_SCU (opaque); +int reg =TO_REG (offset); +/* Truncate here so bitwise operations below behave as expected */ +uint32_t data = data64; +bool updated = false; + +if (reg >=ASPEED_AST2700_SCU_NR_REGS ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return ; + } + +trace_aspeed_ast2700_scuio_write (offset, size, data); + +switch (reg) { +case AST2700_SCUIO_CLK_STOP_CTL_1 : +case AST2700_SCUIO_CLK_STOP_CTL_2 : + s->regs[reg] |= data; + updated = true; +break ; +case AST2700_SCUIO_CLK_STOP_CLR_1 : +case AST2700_SCUIO_CLK_STOP_CLR_2 : + s->regs[reg -1 ] ^= data; + updated = true; +break ; +default : +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Unhandeled write at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +break ; + } + +if (!updated) { + s->regs[reg] = data; + } +} + +static const MemoryRegionOps aspeed_ast2700_scuio_ops = { + .read = aspeed_ast2700_scuio_read, + .write = aspeed_ast2700_scuio_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid.min_access_size =1 , + .valid.max_access_size =8 , + .valid.unaligned = false, +}; + +static const uint32_t ast2700_a0_resets_io[ASPEED_AST2700_SCU_NR_REGS ] = { + [AST2700_SILICON_REV ] =0x06000003 , + [AST2700_HW_STRAP1 ] =0x00000504 , + [AST2700_HW_STRAP1_CLR ] =0xFFF0FFF0 , + [AST2700_HW_STRAP1_LOCK ] =0x00000FFF , + [AST2700_HW_STRAP1_SEC1 ] =0x000000FF , + [AST2700_HW_STRAP1_SEC2 ] =0x00000000 , + [AST2700_HW_STRAP1_SEC3 ] =0x1000408F , + [AST2700_SCUIO_CLK_STOP_CTL_1 ] =0xffff8400 , + [AST2700_SCUIO_CLK_STOP_CTL_2 ] =0x00005f30 , + [AST2700_SCUIO_CLK_SEL_1 ] =0x86900000 , + [AST2700_SCUIO_CLK_SEL_2 ] =0x00400000 , + [AST2700_SCUIO_HPLL_PARAM ] =0x10000027 , + [AST2700_SCUIO_HPLL_EXT_PARAM ] =0x80000014 , + [AST2700_SCUIO_APLL_PARAM ] =0x1000001f , + [AST2700_SCUIO_APLL_EXT_PARAM ] =0x8000000f , + [AST2700_SCUIO_DPLL_PARAM ] =0x106e42ce , + [AST2700_SCUIO_DPLL_EXT_PARAM ] =0x80000167 , + [AST2700_SCUIO_DPLL_PARAM_READ ] =0x106e42ce , + [AST2700_SCUIO_DPLL_EXT_PARAM_READ ] =0x80000167 , + [AST2700_SCUIO_UARTCLK_GEN ] =0x00014506 , + [AST2700_SCUIO_HUARTCLK_GEN ] =0x000145c0 , + [AST2700_SCUIO_CLK_DUTY_MEAS_RST ] =0x0c9100d2 , +}; + +static void aspeed_2700_scuio_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedSCUClass *asc =ASPEED_SCU_CLASS (klass); + + dc->desc ="ASPEED 2700 System Control Unit I/O" ; + dc->reset = aspeed_ast2700_scu_reset; + asc->resets = ast2700_a0_resets_io; + asc->calc_hpll = aspeed_2600_scu_calc_hpll; + asc->get_apb = aspeed_2700_scuio_get_apb_freq; + asc->apb_divider =2 ; + asc->nr_regs =ASPEED_AST2700_SCU_NR_REGS ; + asc->clkin_25Mhz = true; + asc->ops = &aspeed_ast2700_scuio_ops; +} + +static const TypeInfo aspeed_2700_scu_info = { + .name =TYPE_ASPEED_2700_SCU , + .parent =TYPE_ASPEED_SCU , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_2700_scu_class_init, +}; + +static const TypeInfo aspeed_2700_scuio_info = { + .name =TYPE_ASPEED_2700_SCUIO , + .parent =TYPE_ASPEED_SCU , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_2700_scuio_class_init, +}; +static const uint32_t ast1030_a1_resets[ASPEED_AST2600_SCU_NR_REGS ] = { [AST2600_SYS_RST_CTRL ] =0xFFC3FED8 , [AST2600_SYS_RST_CTRL2 ] =0x09FFFFFC ,
@@ -841,6 +1143,8 @@ static void aspeed_scu_register_types(void)type_register_static (&aspeed_2500_scu_info);type_register_static (&aspeed_2600_scu_info);type_register_static (&aspeed_1030_scu_info); +type_register_static (&aspeed_2700_scu_info); +type_register_static (&aspeed_2700_scuio_info); }type_init (aspeed_scu_register_types);
hw/misc/trace-events +4 -0
@@ -93,6 +93,10 @@ slavio_led_mem_readw(uint32_t ret) "Read diagnostic LED 0x%04x" # aspeed_scu.c aspeed_scu_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 aspeed_scu_read(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_ast2700_scu_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_ast2700_scu_read(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_ast2700_scuio_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_ast2700_scuio_read(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 # mps2-scc.c mps2_scc_read(uint64_t offset, uint64_t data, unsigned size) "MPS2 SCC read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
include/hw/misc/aspeed_scu.h +42 -5
97 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 1/8 aspeed/wdt: Add AST2700 support
In reply to a message not in the archiveAST2700 wdt controller is similiar to AST2600's wdt, but
the AST2700 has 8 watchdogs, and they each have a 0x80 of registers. Introduce ast2700 object class and increse the number of regs(offset) of ast2700 model.
--- hw/watchdog/wdt_aspeed.c | 24 ++++++++++++++++++++++++ include/hw/watchdog/wdt_aspeed.h | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-)
hw/watchdog/wdt_aspeed.c +24 -0
@@ -422,12 +422,36 @@ static const TypeInfo aspeed_1030_wdt_info = { .class_init = aspeed_1030_wdt_class_init, }; +static void aspeed_2700_wdt_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +AspeedWDTClass *awc =ASPEED_WDT_CLASS (klass); + + dc->desc ="ASPEED 2700 Watchdog Controller" ; + 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; + awc->wdt_reload = aspeed_wdt_reload_1mhz; + awc->sanitize_ctrl = aspeed_2600_sanitize_ctrl; + awc->default_status =0x014FB180 ; + awc->default_reload_value =0x014FB180 ; +} + +static const TypeInfo aspeed_2700_wdt_info = { + .name =TYPE_ASPEED_2700_WDT , + .parent =TYPE_ASPEED_WDT , + .instance_size =sizeof (AspeedWDTState), + .class_init = aspeed_2700_wdt_class_init, +}; +static void wdt_aspeed_register_types (void ) {type_register_static (&aspeed_wdt_info);type_register_static (&aspeed_2400_wdt_info);type_register_static (&aspeed_2500_wdt_info);type_register_static (&aspeed_2600_wdt_info); +type_register_static (&aspeed_2700_wdt_info);type_register_static (&aspeed_1030_wdt_info); }
include/hw/watchdog/wdt_aspeed.h +2 -1
@@ -19,9 +19,10 @@ OBJECT_DECLARE_TYPE(AspeedWDTState, AspeedWDTClass, ASPEED_WDT)#define TYPE_ASPEED_2400_WDT TYPE_ASPEED_WDT "-ast2400"#define TYPE_ASPEED_2500_WDT TYPE_ASPEED_WDT "-ast2500"#define TYPE_ASPEED_2600_WDT TYPE_ASPEED_WDT "-ast2600" +#define TYPE_ASPEED_2700_WDT TYPE_ASPEED_WDT "-ast2700"#define TYPE_ASPEED_1030_WDT TYPE_ASPEED_WDT "-ast1030" -#define ASPEED_WDT_REGS_MAX (0x30 / 4) +#define ASPEED_WDT_REGS_MAX (0x80 / 4)struct AspeedWDTState {/*< private >*/
Signature · 1 line
2.25.1
PATCH 2/8 aspeed/sli: Add AST2700 support
In reply to a message not in the archiveAST2700 SLI engine is designed to accelerate the
throughput between cross-die connections.
It have CPU_SLI at CPU die and IO_SLI at IO die.
Introduce new ast2700_sli and ast2700_sliio class
with instance_init and realize handlers.
--- hw/misc/aspeed_sli.c | 179 +++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 3 +- hw/misc/trace-events | 7 ++ include/hw/misc/aspeed_sli.h | 32 +++++++ 4 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 hw/misc/aspeed_sli.c create mode 100644 include/hw/misc/aspeed_sli.h
hw/misc/aspeed_sli.c new file +179 -0
@@ -0,0 +1,179 @@ +/* +* ASPEED SLI Controller +* +* Copyright (C) 2024 ASPEED Technology Inc. +* +* This code is licensed under the GPL version 2 or later. See +* the COPYING file in the top-level directory. +*/ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/error-report.h" +#include "hw/qdev-properties.h" +#include "hw/misc/aspeed_sli.h" +#include "qapi/error.h" +#include "migration/vmstate.h" +#include "trace.h" + +#define SLI_REGION_SIZE 0x500 +#define TO_REG (addr) ((addr) >> 2) + +static uint64_t aspeed_sli_read (void *opaque,hwaddr addr,unsigned int size) +{ +AspeedSLIState *s =ASPEED_SLI (opaque); +int reg =TO_REG (addr); + +if (reg >=ARRAY_SIZE (s->regs)) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx"\n" , + __func__, addr); +return 0 ; + } + +trace_aspeed_sli_read (addr, size, s->regs[reg]); +return s->regs[reg]; +} + +static void aspeed_sli_write (void *opaque,hwaddr addr,uint64_t data, +unsigned int size) +{ +AspeedSLIState *s =ASPEED_SLI (opaque); +int reg =TO_REG (addr); + +if (reg >=ARRAY_SIZE (s->regs)) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , + __func__, addr); +return ; + } + +trace_aspeed_sli_write (addr, size, data); + s->regs[reg] = data; +} + +static uint64_t aspeed_sliio_read (void *opaque,hwaddr addr,unsigned int size) +{ +AspeedSLIState *s =ASPEED_SLI (opaque); +int reg =TO_REG (addr); + +if (reg >=ARRAY_SIZE (s->regs)) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx"\n" , + __func__, addr); +return 0 ; + } + +trace_aspeed_sliio_read (addr, size, s->regs[reg]); +return s->regs[reg]; +} + +static void aspeed_sliio_write (void *opaque,hwaddr addr,uint64_t data, +unsigned int size) +{ +AspeedSLIState *s =ASPEED_SLI (opaque); +int reg =TO_REG (addr); + +if (reg >=ARRAY_SIZE (s->regs)) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , + __func__, addr); +return ; + } + +trace_aspeed_sliio_write (addr, size, data); + s->regs[reg] = data; +} + +static const MemoryRegionOps aspeed_sli_ops = { + .read = aspeed_sli_read, + .write = aspeed_sli_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid = { + .min_access_size =1 , + .max_access_size =4 , + }, +}; + +static const MemoryRegionOps aspeed_sliio_ops = { + .read = aspeed_sliio_read, + .write = aspeed_sliio_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid = { + .min_access_size =1 , + .max_access_size =4 , + }, +}; + +static void aspeed_sli_realize (DeviceState *dev,Error **errp) +{ +AspeedSLIState *s =ASPEED_SLI (dev); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev); + +memory_region_init_io (&s->iomem,OBJECT (s), &aspeed_sli_ops, s, +TYPE_ASPEED_SLI ,SLI_REGION_SIZE ); +sysbus_init_mmio (sbd, &s->iomem); +} + +static void aspeed_sliio_realize (DeviceState *dev,Error **errp) +{ +AspeedSLIState *s =ASPEED_SLI (dev); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev); + +memory_region_init_io (&s->iomem,OBJECT (s), &aspeed_sliio_ops, s, +TYPE_ASPEED_SLI ,SLI_REGION_SIZE ); +sysbus_init_mmio (sbd, &s->iomem); +} + +static void aspeed_sli_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="Aspeed SLI Controller" ; + dc->realize = aspeed_sli_realize; +} + +static const TypeInfo aspeed_sli_info = { + .name =TYPE_ASPEED_SLI , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedSLIState), + .class_init = aspeed_sli_class_init, + .class_size =sizeof (AspeedSLIClass), + .abstract = true, +}; + +static void aspeed_2700_sli_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="AST2700 SLI Controller" ; +} + +static void aspeed_2700_sliio_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="AST2700 I/O SLI Controller" ; + dc->realize = aspeed_sliio_realize; +} + +static const TypeInfo aspeed_2700_sli_info = { + .name =TYPE_ASPEED_2700_SLI , + .parent =TYPE_ASPEED_SLI , + .class_init = aspeed_2700_sli_class_init, +}; + +static const TypeInfo aspeed_2700_sliio_info = { + .name =TYPE_ASPEED_2700_SLIIO , + .parent =TYPE_ASPEED_SLI , + .class_init = aspeed_2700_sliio_class_init, +}; + +static void aspeed_sli_register_types (void ) +{ +type_register_static (&aspeed_sli_info); +type_register_static (&aspeed_2700_sli_info); +type_register_static (&aspeed_2700_sliio_info); +} + +type_init (aspeed_sli_register_types);
hw/misc/meson.build +2 -1
@@ -137,7 +137,8 @@ system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_sbc.c', 'aspeed_sdmc.c', 'aspeed_xdma.c', - 'aspeed_peci.c')) + 'aspeed_peci.c', + 'aspeed_sli.c')) system_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) system_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_rng.c'))
hw/misc/trace-events +7 -0
@@ -341,3 +341,10 @@ djmemc_write(int reg, uint64_t value, unsigned int size) "reg=0x%x value=0x%"PRI # iosb.c iosb_read(int reg, uint64_t value, unsigned int size) "reg=0x%x value=0x%"PRIx64" size=%u" iosb_write(int reg, uint64_t value, unsigned int size) "reg=0x%x value=0x%"PRIx64" size=%u" + +# aspeed_sli.c +aspeed_sli_write(uint64_t offset, unsigned int size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_sli_read(uint64_t offset, unsigned int size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_sliio_write(uint64_t offset, unsigned int size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_sliio_read(uint64_t offset, unsigned int size, uint32_t data) "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +
include/hw/misc/aspeed_sli.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* ASPEED SLI Controller +* +* Copyright (C) 2024 ASPEED Technology Inc. +* +* This code is licensed under the GPL version 2 or later. See +* the COPYING file in the top-level directory. +*/ +#ifndef ASPEED_SLI_H +#define ASPEED_SLI_H + +#include "hw/sysbus.h" + +#define TYPE_ASPEED_SLI "aspeed.sli" +#define TYPE_ASPEED_2700_SLI TYPE_ASPEED_SLI "-ast2700" +#define TYPE_ASPEED_2700_SLIIO TYPE_ASPEED_SLI "io" "-ast2700" +OBJECT_DECLARE_TYPE(AspeedSLIState, AspeedSLIClass, ASPEED_SLI) + +#define ASPEED_SLI_NR_REGS (0x500 >> 2) + +struct AspeedSLIState { +SysBusDevice parent; +MemoryRegion iomem; + +uint32_t regs[ASPEED_SLI_NR_REGS ]; +}; + +struct AspeedSLIClass { +SysBusDeviceClass parent_class; +}; + +#endif /* ASPEED_SLI_H */
Signature · 1 line
2.25.1
RE: [PATCH v1 8/8] aspeed: Add an AST2700 eval board
In reply to a message not in the archiveQuoted 9 lines
-----Original Message-----
From: Jamin Lin <[email protected]>
Sent: Thursday, February 29, 2024 3:43 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Yunlin Tang <[email protected]>
Subject: [PATCH v1 8/8] aspeed: Add an AST2700 eval board
Hi all,
I tried to send the patch series to support AST2700 but I encountered some patches were rejected by server IP 211.20.114.70.
Error Log:
[email protected]
eggs.gnu.org
Remote Server returned '550-[SPF] 211.20.114.70 is not allowed to send mail from aspeedtech.com. 550 Please see http://www.openspf.org/Why?scope=mfrom;[email protected];ip=211.20.114.70'
[email protected]
eggs.gnu.org
Remote Server returned '550-[SPF] 211.20.114.70 is not allowed to send mail from aspeedtech.com. 550 Please see http://www.openspf.org/Why?scope=mfrom;[email protected];ip=211.20.114.70
Did you encounter the same errors before?
My send email command as following.
git send-email
--cc [email protected]
--cc [email protected]
--cc [email protected]
--to-cmd "./scripts/get_maintainer.pl ../v1-patch/*.patch" ../v1-patch/*.patch
Thanks-Jamin
Quoted 77 lines
AST2700 CPU is ARM Cortex-A35 which is 64 bits.
AddTARGET_AARCH64to build this machine.According to the design of ast2700, it has a bootmcu(riscv-32) which is used for executing SPL.
Then, CPUs(cortex-a35) execute u-boot, kernel and rofs.Currently, qemu not support emulate two CPU architectures at the same machine. Therefore, qemu will only support to emulate CPU(cortex-a35) side for ast2700
Signed-off-by Troy Lee <[email protected]>Signed-off-by Jamin Lin <[email protected]>--- hw/arm/aspeed.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0
-0
8854581ca8..4544026d14100644hw/arm/aspeed.c +0
-0@@ -178,6 +178,12 @@ struct AspeedMachineState { #define
AST2600_EVB_HW_STRAP10x000000C0#defineAST2600_EVB_HW_STRAP20x00000003hw/arm/aspeed.c +3
-0+#ifdef TARGET_AARCH64 +/* AST2700 evb hardware value */ +#define AST2700_EVB_HW_STRAP1 0x000000C0 #define
AST2700_EVB_HW_STRAP2
+0x00000003 #endif
+
/* Tacoma hardware value */
#defineTACOMA_BMC_HW_STRAP10x00000000#defineTACOMA_BMC_HW_STRAP20x00000040@@ -1588,6 +1594,26 @@ static void aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc,aspeed_machine_class_init_cpus_defaults(mc);}
hw/arm/aspeed.c +14
-0+#ifdef TARGET_AARCH64 +static void aspeed_machine_ast2700_evb_class_init (ObjectClass *oc,void +*data) { +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="Aspeed AST2700 EVB (Cortex-A35)" ; + amc->soc_name ="ast2700-a0" ; + amc->hw_strap1 =AST2700_EVB_HW_STRAP1 ; + amc->hw_strap2 =AST2700_EVB_HW_STRAP2 ; + amc->fmc_model ="w25q01jvq" ; + amc->spi_model ="w25q512jv" ; + amc->num_cs =2 ; + amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON |
ASPEED_MAC2_ON;hw/arm/aspeed.c +6
-0+ amc->uart_default =ASPEED_DEV_UART12 ; + mc->default_ram_size =1 * GiB; + aspeed_machine_class_init_cpus_defaults(mc); +} +#endif +static void aspeed_machine_qcom_dc_scm_v1_class_init (ObjectClass *oc,void *data){ @@ -1711,6 +1737,12 @@ static const TypeInfo aspeed_machine_types[] = {
.name = MACHINE_TYPE_NAME("ast1030-evb"), .parent = TYPE_ASPEED_MACHINE, .class_init =
aspeed_minibmc_machine_ast1030_evb_class_init,hw/arm/aspeed.c +6
-1+#ifdef TARGET_AARCH64 + }, { + .name = MACHINE_TYPE_NAME("ast2700-evb"), + .parent = TYPE_ASPEED_MACHINE, + .class_init = aspeed_machine_ast2700_evb_class_init, +#endif }, { .name = TYPE_ASPEED_MACHINE, .parent = TYPE_MACHINE, --2.25.1
RE: [PATCH v1 8/8] aspeed: Add an AST2700 eval board
Quoted 47 lines
-----Original Message-----
From: Jamin Lin <[email protected]>
Sent: Thursday, February 29, 2024 3:53 PM
To: Jamin Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: RE: [PATCH v1 8/8] aspeed: Add an AST2700 eval boardQuoted 10 lines
-----Original Message-----
From: Jamin Lin <[email protected]>
Sent: Thursday, February 29, 2024 3:43 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Yunlin Tang <[email protected]>
Subject: [PATCH v1 8/8] aspeed: Add an AST2700 eval boardHi all,
I tried to send the patch series to support AST2700 but I encountered some patches were rejected by server IP 211.20.114.70.
Error Log:
[email protected]
eggs.gnu.org
Remote Server returned '550-[SPF] 211.20.114.70 is not allowed to send mail from aspeedtech.com. 550 Please see
http://www.openspf.org/Why?scope=mfrom;[email protected]
om;ip=211.20.114.70'
[email protected]
eggs.gnu.org
Remote Server returned '550-[SPF] 211.20.114.70 is not allowed to send mail from aspeedtech.com. 550 Please see
http://www.openspf.org/Why?scope=mfrom;[email protected]
om;ip=211.20.114.70Did you encounter the same errors before?
My send email command as following.
git send-email
--cc [email protected]
--cc [email protected]
--cc [email protected]
--to-cmd "./scripts/get_maintainer.pl../v1-patch/*.patch" ../v1-patch/*.patch
Quoted 2 lines
Thanks-Jamin
It seems our mail server issue. We are checking this issue. Thanks
Quoted 81 lines
Quoted 22 lines
AST2700 CPU is ARM Cortex-A35 which is 64 bits.
AddTARGET_AARCH64to build this machine.According to the design of ast2700, it has a bootmcu(riscv-32) which is used for executing SPL.
Then, CPUs(cortex-a35) execute u-boot, kernel and rofs.Currently, qemu not support emulate two CPU architectures at the same machine. Therefore, qemu will only support to emulate CPU(cortex-a35) side for ast2700
Signed-off-by Troy Lee <[email protected]>Signed-off-by Jamin Lin <[email protected]>--- hw/arm/aspeed.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0
-0
8854581ca8..4544026d14100644hw/arm/aspeed.c +0
-0@@ -178,6 +178,12 @@ struct AspeedMachineState { #defineQuoted 1 line
AST2600_EVB_HW_STRAP10x000000C0#define
AST2600_EVB_HW_STRAP2Quoted 11 lines
0x00000003hw/arm/aspeed.c +3
-0+#ifdef TARGET_AARCH64 +/* AST2700 evb hardware value */ +#define AST2700_EVB_HW_STRAP1 0x000000C0 #define
AST2700_EVB_HW_STRAP2
+0x00000003 #endif
+
/* Tacoma hardware value */
#defineTACOMA_BMC_HW_STRAP10x00000000#defineTACOMA_BMC_HW_STRAP20x00000040@@ -1588,6 +1594,26 @@static void
Quoted 20 lines
aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc,
aspeed_machine_class_init_cpus_defaults(mc);}
hw/arm/aspeed.c +15
-0+#ifdef TARGET_AARCH64 +static void aspeed_machine_ast2700_evb_class_init (ObjectClass *oc, +void +*data) { +MachineClass *mc =MACHINE_CLASS (oc); +AspeedMachineClass *amc =ASPEED_MACHINE_CLASS (oc); + + mc->desc ="Aspeed AST2700 EVB (Cortex-A35)" ; + amc->soc_name ="ast2700-a0" ; + amc->hw_strap1 =AST2700_EVB_HW_STRAP1 ; + amc->hw_strap2 =AST2700_EVB_HW_STRAP2 ; + amc->fmc_model ="w25q01jvq" ; + amc->spi_model ="w25q512jv" ; + amc->num_cs =2 ; + amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON |
ASPEED_MAC2_ON;hw/arm/aspeed.c
Quoted 8 lines
hw/arm/aspeed.c +6
-0+ amc->uart_default =ASPEED_DEV_UART12 ; + mc->default_ram_size =1 * GiB; +aspeed_machine_class_init_cpus_defaults (mc); +} +#endif +static void aspeed_machine_qcom_dc_scm_v1_class_init (ObjectClass *oc, void*data) { @@
Quoted 16 lines
-1711,6 +1737,12 @@ static const TypeInfo aspeed_machine_types[] = {
.name = MACHINE_TYPE_NAME("ast1030-evb"), .parent = TYPE_ASPEED_MACHINE, .class_init =
aspeed_minibmc_machine_ast1030_evb_class_init,hw/arm/aspeed.c +6
-1+#ifdef TARGET_AARCH64 + }, { + .name = MACHINE_TYPE_NAME("ast2700-evb"), + .parent = TYPE_ASPEED_MACHINE, + .class_init = aspeed_machine_ast2700_evb_class_init, +#endif }, { .name = TYPE_ASPEED_MACHINE, .parent = TYPE_MACHINE, --2.25.1
Re: [PATCH v1 8/8] aspeed: Add an AST2700 eval board
In reply to Jamin LinHello Jamin,
Quoted 10 lines
I tried to send the patch series to support AST2700 but I encountered some patches were rejected by server IP 211.20.114.70.
Error Log:
[email protected]
eggs.gnu.org
Remote Server returned '550-[SPF] 211.20.114.70 is not allowed to send mail from aspeedtech.com. 550 Please see http://www.openspf.org/Why?scope=mfrom;[email protected];ip=211.20.114.70'
[email protected]
eggs.gnu.org
Remote Server returned '550-[SPF] 211.20.114.70 is not allowed to send mail from aspeedtech.com. 550 Please see http://www.openspf.org/Why?scope=mfrom;[email protected];ip=211.20.114.70
$ host -t txt aspeedtech.com aspeedtech.com descriptive text "google-site-verification=77FsedIzGqFvs3bFfy5L2lT_AGEWVecyoJwZN7KDVnM" aspeedtech.com descriptive text "v=spf1 ip4:211.20.114.72 include:spf.protection.outlook.com -all" aspeedtech.com descriptive text "google-site-verification=sBPPFeYyix6oWeC3GRJ64zQNFLJpN6SFBMT8RX8ZuME"
May be try using 211.20.114.72 (mail.aspeedtech.com) as an SMTP server ?
Quoted 1 line
Did you encounter the same errors before?
I received the full series 4 times.
But the mailing lists only have 4 :
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
or
https://patchew.org/QEMU/[email protected]/
https://patchew.org/QEMU/[email protected]/
Quoted 6 lines
My send email command as following.
git send-email
--cc [email protected]
--cc [email protected]
--cc [email protected]
--to-cmd "./scripts/get_maintainer.pl../v1-patch/*.patch" ../v1-patch/*.patch
The command line above is sending twice the same series, you should remove one of the "../v1-patch/*.patch" command arguments. the rest looks correct.
Thanks,
C.
RE: [PATCH v1 8/8] aspeed: Add an AST2700 eval board
Quoted 39 lines
-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Thursday, February 29, 2024 4:32 PM
To: Jamin Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Troy Lee <[email protected]>; Yunlin Tang <[email protected]>
Subject: Re: [PATCH v1 8/8] aspeed: Add an AST2700 eval boardHello Jamin,
Quoted 7 lines
I tried to send the patch series to support AST2700 but I encountered some patches were rejected by server IP 211.20.114.70.
Error Log:
[email protected]
eggs.gnu.org
Remote Server returned '550-[SPF] 211.20.114.70 is not allowed to send mailfrom aspeedtech.com. 550 Please see
http://www.openspf.org/Why?scope=mfrom;[email protected]
om;ip=211.20.114.70'Quoted 5 lines
[email protected]
eggs.gnu.org
Remote Server returned '550-[SPF] 211.20.114.70 is not allowed to send mail from aspeedtech.com. 550 Please seehttp://www.openspf.org/Why?scope=mfrom;[email protected]
Quoted 1 line
om;ip=211.20.114.70
$ host -t txt aspeedtech.com aspeedtech.com descriptive text "google-site-verification=77FsedIzGqFvs3bFfy5L2lT_AGEWVecyoJwZN7KDVnM" aspeedtech.com descriptive text "v=spf1 ip4:211.20.114.72 include:spf.protection.outlook.com -all" aspeedtech.com descriptive text "google-site-verification=sBPPFeYyix6oWeC3GRJ64zQNFLJpN6SFBMT8RX8ZuM E"
Quoted 2 lines
May be try using 211.20.114.72 (mail.aspeedtech.com) as an SMTP server ?
Thanks for your help. We are checking our smtp server now and sorry for your inconvenient. Jamin
Quoted 38 lines
Quoted 1 line
Did you encounter the same errors before?
I received the full series 4 times.
But the mailing lists only have 4 :
https://lore.kernel.org/qemu-devel/20240229080014.1235018-1-jamin_lin@as
peedtech.com/https://lore.kernel.org/qemu-devel/20240229072315.743963-1-jamin_lin@asp
eedtech.com/or
https://patchew.org/QEMU/20240229080014.1235018-1-jamin._5Flin@aspeed
tech.com/https://patchew.org/QEMU/20240229072315.743963-1-jamin._5Flin@aspeedt
ech.com/Quoted 7 lines
My send email command as following.
git send-email
--cc [email protected]
--cc [email protected]
--cc [email protected]
--to-cmd "./scripts/get_maintainer.pl../v1-patch/*.patch" ../v1-patch/*.patchThe command line above is sending twice the same series, you should remove one of the "../v1-patch/*.patch" command arguments. the rest looks correct.
Thanks,
C.