aspeed/scu: Implement chip id register
Joel Stanley
maintainercover aspeed/scu: Implement chip id register
This implements the chip id register in the SCU for the ast2500 and ast2600. The first patch is a cleanup to separate out ast2400 and ast2500 functionality.
Joel Stanley (2):
aspeed/scu: Create separate write callbacks
aspeed/scu: Implement chip ID register
hw/misc/aspeed_scu.c | 93 +++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 23 deletions(-)
Signature · 1 line
2.24.1
Joel Stanley
maintainerPATCH 1/2 aspeed/scu: Create separate write callbacks
This splits the common write callback into separate ast2400 and ast2500 implementations. This makes it clearer when implementing differing behaviour.
--- hw/misc/aspeed_scu.c | 80 +++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 23 deletions(-)
hw/misc/aspeed_scu.c +57 -23
@@ -232,8 +232,47 @@ static uint64_t aspeed_scu_read(void *opaque, hwaddr offset, unsigned size)return s->regs[reg]; } -static void aspeed_scu_write (void *opaque,hwaddr offset,uint64_t data, -unsigned size) +static void aspeed_ast2400_scu_write (void *opaque,hwaddr offset, +uint64_t data,unsigned size) +{ +AspeedSCUState *s =ASPEED_SCU (opaque); +int reg =TO_REG (offset); + +if (reg >=ASPEED_SCU_NR_REGS ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return ; + } + +if (reg >PROT_KEY && reg <CPU2_BASE_SEG1 && + !s->regs[PROT_KEY ]) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: SCU is locked!\n" , __func__); + } + +trace_aspeed_scu_write (offset, size, data); + +switch (reg) { +case PROT_KEY : + s->regs[reg] = (data ==ASPEED_SCU_PROT_KEY ) ?1 :0 ; +return ; +case SILICON_REV : +case FREQ_CNTR_EVAL : + case VGA_SCRATCH1 ... VGA_SCRATCH8: +case RNG_DATA : +case FREE_CNTR4 : +case FREE_CNTR4_EXT : +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return ; + } + + s->regs[reg] = data; +} + +static void aspeed_ast2500_scu_write (void *opaque,hwaddr offset, +uint64_t data,unsigned size) {AspeedSCUState *s =ASPEED_SCU (opaque);int reg =TO_REG (offset);
@@ -257,25 +296,11 @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data,case PROT_KEY : s->regs[reg] = (data ==ASPEED_SCU_PROT_KEY ) ?1 :0 ;return ; -case CLK_SEL : - s->regs[reg] = data; -break ;case HW_STRAP1 : -if (ASPEED_IS_AST2500 (s->regs[SILICON_REV ])) { - s->regs[HW_STRAP1 ] |= data; -return ; - } -/* Jump to assignment below */ -break ; + s->regs[HW_STRAP1 ] |= data; +return ;case SILICON_REV : -if (ASPEED_IS_AST2500 (s->regs[SILICON_REV ])) { - s->regs[HW_STRAP1 ] &= ~data; - }else { -qemu_log_mask (LOG_GUEST_ERROR , -"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , - __func__, offset); - } -/* Avoid assignment below, we've handled everything */ + s->regs[HW_STRAP1 ] &= ~data;return ;case FREQ_CNTR_EVAL : case VGA_SCRATCH1 ... VGA_SCRATCH8:
@@ -291,9 +316,18 @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data, s->regs[reg] = data; } -static const MemoryRegionOps aspeed_scu_ops = { +static const MemoryRegionOps aspeed_ast2400_scu_ops = { + .read = aspeed_scu_read, + .write = aspeed_ast2400_scu_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid.min_access_size =4 , + .valid.max_access_size =4 , + .valid.unaligned = false, +}; + +static const MemoryRegionOps aspeed_ast2500_scu_ops = { .read = aspeed_scu_read, - .write = aspeed_scu_write, + .write = aspeed_ast2500_scu_write, .endianness =DEVICE_LITTLE_ENDIAN , .valid.min_access_size =4 , .valid.max_access_size =4 ,
@@ -469,7 +503,7 @@ static void aspeed_2400_scu_class_init(ObjectClass *klass, void *data) asc->calc_hpll = aspeed_2400_scu_calc_hpll; asc->apb_divider =2 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; - asc->ops = &aspeed_scu_ops; + asc->ops = &aspeed_ast2400_scu_ops; }static const TypeInfo aspeed_2400_scu_info = {
@@ -489,7 +523,7 @@ static void aspeed_2500_scu_class_init(ObjectClass *klass, void *data) asc->calc_hpll = aspeed_2500_scu_calc_hpll; asc->apb_divider =4 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; - asc->ops = &aspeed_scu_ops; + asc->ops = &aspeed_ast2500_scu_ops; }static const TypeInfo aspeed_2500_scu_info = {
Signature · 1 line
2.24.1
Re: [PATCH 1/2] aspeed/scu: Create separate write callbacks
Quoted 5 lines · Joel Stanley
This splits the common write callback into separate ast2400 and ast2500 implementations. This makes it clearer when implementing differing behaviour.
Signed-off-by Joel Stanley <[email protected]>
Re: [PATCH 1/2] aspeed/scu: Create separate write callbacks
In reply to Joel StanleyQuoted 5 lines · Joel Stanley
This splits the common write callback into separate ast2400 and ast2500 implementations. This makes it clearer when implementing differing behaviour.
Signed-off-by Joel Stanley <[email protected]>
Quoted 127 lines
--- hw/misc/aspeed_scu.c | 80 +++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 23 deletions(-)hw/misc/aspeed_scu.c +57
-23@@ -232,8 +232,47 @@ static uint64_t aspeed_scu_read(void *opaque, hwaddr offset, unsigned size)return s->regs[reg]; } -static void aspeed_scu_write (void *opaque,hwaddr offset,uint64_t data, -unsigned size) +static void aspeed_ast2400_scu_write (void *opaque,hwaddr offset, +uint64_t data,unsigned size) +{ +AspeedSCUState *s =ASPEED_SCU (opaque); +int reg =TO_REG (offset); + +if (reg >=ASPEED_SCU_NR_REGS ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return ; + } + +if (reg >PROT_KEY && reg <CPU2_BASE_SEG1 && + !s->regs[PROT_KEY ]) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: SCU is locked!\n" , __func__); + } + +trace_aspeed_scu_write (offset, size, data); + +switch (reg) { +case PROT_KEY : + s->regs[reg] = (data ==ASPEED_SCU_PROT_KEY ) ?1 :0 ; +return ; +case SILICON_REV : +case FREQ_CNTR_EVAL : + case VGA_SCRATCH1 ... VGA_SCRATCH8: +case RNG_DATA : +case FREE_CNTR4 : +case FREE_CNTR4_EXT : +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return ; + } + + s->regs[reg] = data; +} + +static void aspeed_ast2500_scu_write (void *opaque,hwaddr offset, +uint64_t data,unsigned size) {AspeedSCUState *s =ASPEED_SCU (opaque);int reg =TO_REG (offset);@@ -257,25 +296,11 @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data,case PROT_KEY : s->regs[reg] = (data ==ASPEED_SCU_PROT_KEY ) ?1 :0 ;return ; -case CLK_SEL : - s->regs[reg] = data; -break ;case HW_STRAP1 : -if (ASPEED_IS_AST2500 (s->regs[SILICON_REV ])) { - s->regs[HW_STRAP1 ] |= data; -return ; - } -/* Jump to assignment below */ -break ; + s->regs[HW_STRAP1 ] |= data; +return ;case SILICON_REV : -if (ASPEED_IS_AST2500 (s->regs[SILICON_REV ])) { - s->regs[HW_STRAP1 ] &= ~data; - }else { -qemu_log_mask (LOG_GUEST_ERROR , -"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , - __func__, offset); - } -/* Avoid assignment below, we've handled everything */ + s->regs[HW_STRAP1 ] &= ~data;return ;case FREQ_CNTR_EVAL : case VGA_SCRATCH1 ... VGA_SCRATCH8:@@ -291,9 +316,18 @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data, s->regs[reg] = data; } -static const MemoryRegionOps aspeed_scu_ops = { +static const MemoryRegionOps aspeed_ast2400_scu_ops = { + .read = aspeed_scu_read, + .write = aspeed_ast2400_scu_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid.min_access_size =4 , + .valid.max_access_size =4 , + .valid.unaligned = false, +}; + +static const MemoryRegionOps aspeed_ast2500_scu_ops = { .read = aspeed_scu_read, - .write = aspeed_scu_write, + .write = aspeed_ast2500_scu_write, .endianness =DEVICE_LITTLE_ENDIAN , .valid.min_access_size =4 , .valid.max_access_size =4 ,@@ -469,7 +503,7 @@ static void aspeed_2400_scu_class_init(ObjectClass *klass, void *data) asc->calc_hpll = aspeed_2400_scu_calc_hpll; asc->apb_divider =2 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; - asc->ops = &aspeed_scu_ops; + asc->ops = &aspeed_ast2400_scu_ops; }static const TypeInfo aspeed_2400_scu_info = {@@ -489,7 +523,7 @@ static void aspeed_2500_scu_class_init(ObjectClass *klass, void *data) asc->calc_hpll = aspeed_2500_scu_calc_hpll; asc->apb_divider =4 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; - asc->ops = &aspeed_scu_ops; + asc->ops = &aspeed_ast2500_scu_ops; }static const TypeInfo aspeed_2500_scu_info = {
Re: [PATCH 1/2] aspeed/scu: Create separate write callbacks
In reply to Joel StanleyQuoted 15 lines · Joel Stanley
This splits the common write callback into separate ast2400 and ast2500 implementations. This makes it clearer when implementing differing behaviour.
Signed-off-by Joel Stanley <[email protected]>--- hw/misc/aspeed_scu.c | 80 +++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 23 deletions(-)hw/misc/aspeed_scu.c +0
-0@@ -232,8 +232,47 @@ static uint64_t aspeed_scu_read(void *opaque, hwaddr offset, unsigned size)return s->regs[reg];
hw/misc/aspeed_scu.c static uint64_t aspeed_scu_read(void *opaque, hwaddr offset, unsigned size) · line 240
Quoted 10 lines
hw/misc/aspeed_scu.c +6
-2} -static void aspeed_scu_write (void *opaque,hwaddr offset,uint64_t data, -unsigned size) +static void aspeed_ast2400_scu_write (void *opaque,hwaddr offset, +uint64_t data,unsigned size) +{ +AspeedSCUState *s =ASPEED_SCU (opaque); +int reg =TO_REG (offset); +
I'd move the trace call here:
trace_aspeed_scu_write(offset, size, data);
(we might be running with tracing enabled but not guest_errors).
Regardless:
Quoted 107 lines
hw/misc/aspeed_scu.c +51
-21+if (reg >=ASPEED_SCU_NR_REGS ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return ; + } + +if (reg >PROT_KEY && reg <CPU2_BASE_SEG1 && + !s->regs[PROT_KEY ]) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: SCU is locked!\n" , __func__); + } + +trace_aspeed_scu_write (offset, size, data); + +switch (reg) { +case PROT_KEY : + s->regs[reg] = (data ==ASPEED_SCU_PROT_KEY ) ?1 :0 ; +return ; +case SILICON_REV : +case FREQ_CNTR_EVAL : + case VGA_SCRATCH1 ... VGA_SCRATCH8: +case RNG_DATA : +case FREE_CNTR4 : +case FREE_CNTR4_EXT : +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , + __func__, offset); +return ; + } + + s->regs[reg] = data; +} + +static void aspeed_ast2500_scu_write (void *opaque,hwaddr offset, +uint64_t data,unsigned size) {AspeedSCUState *s =ASPEED_SCU (opaque);int reg =TO_REG (offset);@@ -257,25 +296,11 @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data,case PROT_KEY : s->regs[reg] = (data ==ASPEED_SCU_PROT_KEY ) ?1 :0 ;return ; -case CLK_SEL : - s->regs[reg] = data; -break ;case HW_STRAP1 : -if (ASPEED_IS_AST2500 (s->regs[SILICON_REV ])) { - s->regs[HW_STRAP1 ] |= data; -return ; - } -/* Jump to assignment below */ -break ; + s->regs[HW_STRAP1 ] |= data; +return ;case SILICON_REV : -if (ASPEED_IS_AST2500 (s->regs[SILICON_REV ])) { - s->regs[HW_STRAP1 ] &= ~data; - }else { -qemu_log_mask (LOG_GUEST_ERROR , -"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , - __func__, offset); - } -/* Avoid assignment below, we've handled everything */ + s->regs[HW_STRAP1 ] &= ~data;return ;case FREQ_CNTR_EVAL : case VGA_SCRATCH1 ... VGA_SCRATCH8:@@ -291,9 +316,18 @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data, s->regs[reg] = data; } -static const MemoryRegionOps aspeed_scu_ops = { +static const MemoryRegionOps aspeed_ast2400_scu_ops = { + .read = aspeed_scu_read, + .write = aspeed_ast2400_scu_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid.min_access_size =4 , + .valid.max_access_size =4 , + .valid.unaligned = false, +}; + +static const MemoryRegionOps aspeed_ast2500_scu_ops = { .read = aspeed_scu_read, - .write = aspeed_scu_write, + .write = aspeed_ast2500_scu_write, .endianness =DEVICE_LITTLE_ENDIAN , .valid.min_access_size =4 , .valid.max_access_size =4 ,@@ -469,7 +503,7 @@ static void aspeed_2400_scu_class_init(ObjectClass *klass, void *data) asc->calc_hpll = aspeed_2400_scu_calc_hpll; asc->apb_divider =2 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; - asc->ops = &aspeed_scu_ops; + asc->ops = &aspeed_ast2400_scu_ops; }static const TypeInfo aspeed_2400_scu_info = {@@ -489,7 +523,7 @@ static void aspeed_2500_scu_class_init(ObjectClass *klass, void *data) asc->calc_hpll = aspeed_2500_scu_calc_hpll; asc->apb_divider =4 ; asc->nr_regs =ASPEED_SCU_NR_REGS ; - asc->ops = &aspeed_scu_ops; + asc->ops = &aspeed_ast2500_scu_ops; }static const TypeInfo aspeed_2500_scu_info = {
Joel Stanley
maintainerPATCH 2/2 aspeed/scu: Implement chip ID register
In reply to Joel StanleyThis returns a fixed but non-zero value for the chip id.
--- hw/misc/aspeed_scu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
hw/misc/aspeed_scu.c +13 -0
@@ -77,6 +77,8 @@#define CPU2_BASE_SEG4 TO_REG(0x110)#define CPU2_BASE_SEG5 TO_REG(0x114)#define CPU2_CACHE_CTRL TO_REG(0x118) +#define CHIP_ID0 TO_REG(0x150) +#define CHIP_ID1 TO_REG(0x154)#define UART_HPLL_CLK TO_REG(0x160)#define PCIE_CTRL TO_REG(0x180)#define BMC_MMIO_CTRL TO_REG(0x184)
@@ -115,6 +117,8 @@#define AST2600_HW_STRAP2_PROT TO_REG(0x518)#define AST2600_RNG_CTRL TO_REG(0x524)#define AST2600_RNG_DATA TO_REG(0x540) +#define AST2600_CHIP_ID0 TO_REG(0x5B0) +#define AST2600_CHIP_ID1 TO_REG(0x5B4)#define AST2600_CLK TO_REG(0x40)
@@ -182,6 +186,8 @@ static const uint32_t ast2500_a1_resets[ASPEED_SCU_NR_REGS] = { [CPU2_BASE_SEG1] = 0x80000000U, [CPU2_BASE_SEG4] = 0x1E600000U, [CPU2_BASE_SEG5] = 0xC0000000U, + [CHIP_ID0] = 0x1234ABCDU, + [CHIP_ID1] = 0x88884444U, [UART_HPLL_CLK] = 0x00001903U, [PCIE_CTRL] = 0x0000007BU, [BMC_DEV_ID ] =0x00002402U
@@ -307,6 +313,8 @@ static void aspeed_ast2500_scu_write(void *opaque, hwaddr offset,case RNG_DATA :case FREE_CNTR4 :case FREE_CNTR4_EXT : +case CHIP_ID0 : +case CHIP_ID1 :qemu_log_mask (LOG_GUEST_ERROR ,"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , __func__, offset);
@@ -620,6 +628,8 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset,case AST2600_RNG_DATA :case AST2600_SILICON_REV :case AST2600_SILICON_REV2 : +case AST2600_CHIP_ID0 : +case AST2600_CHIP_ID1 :/* Add read only registers here */ qemu_log_mask(LOG_GUEST_ERROR, "%s: Write to read-only offset 0x%" HWADDR_PRIx "\n",
@@ -648,6 +658,9 @@ static const uint32_t ast2600_a0_resets[ASPEED_AST2600_SCU_NR_REGS] = { [AST2600_CLK_STOP_CTRL2] = 0xFFF0FFF0, [AST2600_SDRAM_HANDSHAKE] = 0x00000040, /* SoC completed DRAM init */ [AST2600_HPLL_PARAM] = 0x1000405F, + [AST2600_CHIP_ID0] = 0x1234ABCD, + [AST2600_CHIP_ID1] = 0x88884444, + };static void aspeed_ast2600_scu_reset (DeviceState *dev)
Signature · 1 line
2.24.1
Re: [PATCH 2/2] aspeed/scu: Implement chip ID register
Quoted 3 lines · Joel Stanley
This returns a fixed but non-zero value for the chip id.
Signed-off-by Joel Stanley <[email protected]>
Quoted 64 lines
--- hw/misc/aspeed_scu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)hw/misc/aspeed_scu.c +6
-0@@ -77,6 +77,8 @@#define CPU2_BASE_SEG4 TO_REG(0x110)#define CPU2_BASE_SEG5 TO_REG(0x114)#define CPU2_CACHE_CTRL TO_REG(0x118) +#define CHIP_ID0 TO_REG(0x150) +#define CHIP_ID1 TO_REG(0x154)#define UART_HPLL_CLK TO_REG(0x160)#define PCIE_CTRL TO_REG(0x180)#define BMC_MMIO_CTRL TO_REG(0x184)@@ -115,6 +117,8 @@#define AST2600_HW_STRAP2_PROT TO_REG(0x518)#define AST2600_RNG_CTRL TO_REG(0x524)#define AST2600_RNG_DATA TO_REG(0x540) +#define AST2600_CHIP_ID0 TO_REG(0x5B0) +#define AST2600_CHIP_ID1 TO_REG(0x5B4)#define AST2600_CLK TO_REG(0x40)@@ -182,6 +186,8 @@ static const uint32_t ast2500_a1_resets[ASPEED_SCU_NR_REGS] = { [CPU2_BASE_SEG1] = 0x80000000U, [CPU2_BASE_SEG4] = 0x1E600000U, [CPU2_BASE_SEG5] = 0xC0000000U, + [CHIP_ID0] = 0x1234ABCDU, + [CHIP_ID1] = 0x88884444U, [UART_HPLL_CLK] = 0x00001903U, [PCIE_CTRL] = 0x0000007BU,[BMC_DEV_ID] = 0x00002402Uhw/misc/aspeed_scu.c +2
-0@@ -307,6 +313,8 @@ static void aspeed_ast2500_scu_write(void *opaque, hwaddr offset, case RNG_DATA:case FREE_CNTR4 :case FREE_CNTR4_EXT : +case CHIP_ID0 : +case CHIP_ID1 :qemu_log_mask (LOG_GUEST_ERROR , "%s: Write to read-only offset 0x%" HWADDR_PRIx"\n",
__func__, offset);hw/misc/aspeed_scu.c +2
-0@@ -620,6 +628,8 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, case AST2600_RNG_DATA:case AST2600_SILICON_REV :case AST2600_SILICON_REV2 : +case AST2600_CHIP_ID0 : +case AST2600_CHIP_ID1 :/* Add read only registers here */ qemu_log_mask(LOG_GUEST_ERROR,"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n",
hw/misc/aspeed_scu.c +0
-0@@ -648,6 +658,9 @@ static const uint32_t ast2600_a0_resets[ASPEED_AST2600_SCU_NR_REGS] = { [AST2600_CLK_STOP_CTRL2] = 0xFFF0FFF0, [AST2600_SDRAM_HANDSHAKE] = 0x00000040, /* SoC completed DRAMinit */
[AST2600_HPLL_PARAM] = 0x1000405F,
hw/misc/aspeed_scu.c static const uint32_t ast2600_a0_resets[ASPEED_AST2600_SCU_NR_REGS] = { · line 662
Quoted 2 lines
hw/misc/aspeed_scu.c +2
-0+ [AST2600_CHIP_ID0] = 0x1234ABCD, + [AST2600_CHIP_ID1] = 0x88884444,
Probably should add the explicit trailing 'U' to the constants at some point.
Re: [PATCH 2/2] aspeed/scu: Implement chip ID register
In reply to Joel StanleyQuoted 3 lines · Joel Stanley
This returns a fixed but non-zero value for the chip id.
Signed-off-by Joel Stanley <[email protected]>
Quoted 64 lines
--- hw/misc/aspeed_scu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)hw/misc/aspeed_scu.c +13
-0@@ -77,6 +77,8 @@#define CPU2_BASE_SEG4 TO_REG(0x110)#define CPU2_BASE_SEG5 TO_REG(0x114)#define CPU2_CACHE_CTRL TO_REG(0x118) +#define CHIP_ID0 TO_REG(0x150) +#define CHIP_ID1 TO_REG(0x154)#define UART_HPLL_CLK TO_REG(0x160)#define PCIE_CTRL TO_REG(0x180)#define BMC_MMIO_CTRL TO_REG(0x184)@@ -115,6 +117,8 @@#define AST2600_HW_STRAP2_PROT TO_REG(0x518)#define AST2600_RNG_CTRL TO_REG(0x524)#define AST2600_RNG_DATA TO_REG(0x540) +#define AST2600_CHIP_ID0 TO_REG(0x5B0) +#define AST2600_CHIP_ID1 TO_REG(0x5B4)#define AST2600_CLK TO_REG(0x40)@@ -182,6 +186,8 @@ static const uint32_t ast2500_a1_resets[ASPEED_SCU_NR_REGS] = { [CPU2_BASE_SEG1] = 0x80000000U, [CPU2_BASE_SEG4] = 0x1E600000U, [CPU2_BASE_SEG5] = 0xC0000000U, + [CHIP_ID0] = 0x1234ABCDU, + [CHIP_ID1] = 0x88884444U, [UART_HPLL_CLK] = 0x00001903U, [PCIE_CTRL] = 0x0000007BU, [BMC_DEV_ID ] =0x00002402U @@ -307,6 +313,8 @@ static void aspeed_ast2500_scu_write(void *opaque, hwaddr offset,case RNG_DATA :case FREE_CNTR4 :case FREE_CNTR4_EXT : +case CHIP_ID0 : +case CHIP_ID1 :qemu_log_mask (LOG_GUEST_ERROR ,"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , __func__, offset);@@ -620,6 +628,8 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset,case AST2600_RNG_DATA :case AST2600_SILICON_REV :case AST2600_SILICON_REV2 : +case AST2600_CHIP_ID0 : +case AST2600_CHIP_ID1 :/* Add read only registers here */ qemu_log_mask(LOG_GUEST_ERROR, "%s: Write to read-only offset 0x%" HWADDR_PRIx "\n",@@ -648,6 +658,9 @@ static const uint32_t ast2600_a0_resets[ASPEED_AST2600_SCU_NR_REGS] = { [AST2600_CLK_STOP_CTRL2] = 0xFFF0FFF0, [AST2600_SDRAM_HANDSHAKE] = 0x00000040, /* SoC completed DRAM init */ [AST2600_HPLL_PARAM] = 0x1000405F, + [AST2600_CHIP_ID0] = 0x1234ABCD, + [AST2600_CHIP_ID1] = 0x88884444, + };static void aspeed_ast2600_scu_reset (DeviceState *dev)
Re: [PATCH 2/2] aspeed/scu: Implement chip ID register
In reply to Joel StanleyQuoted 57 lines · Joel Stanley
This returns a fixed but non-zero value for the chip id.
Signed-off-by Joel Stanley <[email protected]>--- hw/misc/aspeed_scu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)hw/misc/aspeed_scu.c +10
-0@@ -77,6 +77,8 @@#define CPU2_BASE_SEG4 TO_REG(0x110)#define CPU2_BASE_SEG5 TO_REG(0x114)#define CPU2_CACHE_CTRL TO_REG(0x118) +#define CHIP_ID0 TO_REG(0x150) +#define CHIP_ID1 TO_REG(0x154)#define UART_HPLL_CLK TO_REG(0x160)#define PCIE_CTRL TO_REG(0x180)#define BMC_MMIO_CTRL TO_REG(0x184)@@ -115,6 +117,8 @@#define AST2600_HW_STRAP2_PROT TO_REG(0x518)#define AST2600_RNG_CTRL TO_REG(0x524)#define AST2600_RNG_DATA TO_REG(0x540) +#define AST2600_CHIP_ID0 TO_REG(0x5B0) +#define AST2600_CHIP_ID1 TO_REG(0x5B4)#define AST2600_CLK TO_REG(0x40)@@ -182,6 +186,8 @@ static const uint32_t ast2500_a1_resets[ASPEED_SCU_NR_REGS] = { [CPU2_BASE_SEG1] = 0x80000000U, [CPU2_BASE_SEG4] = 0x1E600000U, [CPU2_BASE_SEG5] = 0xC0000000U, + [CHIP_ID0] = 0x1234ABCDU, + [CHIP_ID1] = 0x88884444U, [UART_HPLL_CLK] = 0x00001903U, [PCIE_CTRL] = 0x0000007BU, [BMC_DEV_ID ] =0x00002402U @@ -307,6 +313,8 @@ static void aspeed_ast2500_scu_write(void *opaque, hwaddr offset,case RNG_DATA :case FREE_CNTR4 :case FREE_CNTR4_EXT : +case CHIP_ID0 : +case CHIP_ID1 :qemu_log_mask (LOG_GUEST_ERROR ,"%s: Write to read-only offset 0x%" HWADDR_PRIx"\n" , __func__, offset);@@ -620,6 +628,8 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset,case AST2600_RNG_DATA :case AST2600_SILICON_REV :case AST2600_SILICON_REV2 : +case AST2600_CHIP_ID0 : +case AST2600_CHIP_ID1 :/* Add read only registers here */ qemu_log_mask(LOG_GUEST_ERROR, "%s: Write to read-only offset 0x%" HWADDR_PRIx "\n",
hw/misc/aspeed_scu.c static const uint32_t ast2600_a0_resets[ASPEED_AST2600_SCU_NR_REGS] = { · line 662
Quoted 5 lines
hw/misc/aspeed_scu.c +2
-0@@ -648,6 +658,9 @@ static const uint32_t ast2600_a0_resets[ASPEED_AST2600_SCU_NR_REGS] = { [AST2600_CLK_STOP_CTRL2] = 0xFFF0FFF0, [AST2600_SDRAM_HANDSHAKE] = 0x00000040, /* SoC completed DRAM init */ [AST2600_HPLL_PARAM] = 0x1000405F, + [AST2600_CHIP_ID0] = 0x1234ABCD, + [AST2600_CHIP_ID1] = 0x88884444,
Since this doesn't match the datasheet, can you add a comment /* Arbitrary non-zero value */?
With it:
Quoted 5 lines
hw/misc/aspeed_scu.c +1
-0+ };static void aspeed_ast2600_scu_reset (DeviceState *dev)
Quoted 3 lines · Joel Stanley
This implements the chip id register in the SCU for the ast2500 and ast2600. The first patch is a cleanup to separate out ast2400 and ast2500 functionality.
These patches apply cleanly on top of :
[v3,0/5] aspeed: extensions and fixes http://patchwork.ozlabs.org/cover/1222667/
Thanks,
C.
Quoted 8 lines
Joel Stanley (2):
aspeed/scu: Create separate write callbacks
aspeed/scu: Implement chip ID registerhw/misc/aspeed_scu.c | 93 +++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 23 deletions(-)
Quoted 11 lines · Joel Stanley
This implements the chip id register in the SCU for the ast2500 and ast2600. The first patch is a cleanup to separate out ast2400 and ast2500 functionality.
Joel Stanley (2):
aspeed/scu: Create separate write callbacks
aspeed/scu: Implement chip ID registerhw/misc/aspeed_scu.c | 93 +++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 23 deletions(-)
Hello Peter,
I see you have merged patches more recent than this series. Do you plan to take them later on ? They apply correctly on mainline.
Thanks,
C.
Quoted 10 lines · Cédric Le Goater
Quoted 8 lines · Joel Stanley
This implements the chip id register in the SCU for the ast2500 and ast2600. The first patch is a cleanup to separate out ast2400 and ast2500 functionality.
Joel Stanley (2):
aspeed/scu: Create separate write callbacks
aspeed/scu: Implement chip ID register
Quoted 8 lines
Quoted 3 lines
hw/misc/aspeed_scu.c | 93 +++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 23 deletions(-)Hello Peter,
I see you have merged patches more recent than this series. Do you plan to take them later on ? They apply correctly on mainline.
Sorry, these didn't get onto my to-review queue for some reason; I've just put them into target-arm.next.
thanks
-- PMM