qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model
@ 2019-10-23 13:04 Cédric Le Goater
  2019-10-23 13:04 ` [PATCH 1/2] " Cédric Le Goater
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Cédric Le Goater @ 2019-10-23 13:04 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Andrew Jeffery, qemu-devel, qemu-arm, Joel Stanley, rashmica.g,
	Cédric Le Goater

Hello,

The property names of AST2600 GPIO 1.8V model are one character bigger
than the names of the other ASPEED GPIO model. This change increases
the string buffer size by one and parses the property name with a
better pattern.

This fixes the QOM test of the ast2600-evb machine under :

  Apple LLVM version 10.0.0 (clang-1000.10.44.4)
  Target: x86_64-apple-darwin17.7.0
  Thread model: posix
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin

And all tests for the AST2600 EVB machine should now pass !

Thanks,

C.

Cédric Le Goater (2):
  hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model
  aspeed: Add an AST2600 eval board

 include/hw/arm/aspeed.h |  1 +
 hw/arm/aspeed.c         | 23 +++++++++++++++++++++++
 hw/gpio/aspeed_gpio.c   |  8 ++++----
 3 files changed, 28 insertions(+), 4 deletions(-)

-- 
2.21.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model
  2019-10-23 13:04 [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model Cédric Le Goater
@ 2019-10-23 13:04 ` Cédric Le Goater
  2019-10-23 13:04 ` [PATCH 2/2] aspeed: Add an AST2600 eval board Cédric Le Goater
  2019-10-24 10:59 ` [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2019-10-23 13:04 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Andrew Jeffery, qemu-devel, qemu-arm, Joel Stanley, rashmica.g,
	Cédric Le Goater

The property names of AST2600 GPIO 1.8V model are one character bigger
than the names of the other ASPEED GPIO model. Increase the string
buffer size by one and be more strict on the expected pattern of the
property name.

This fixes the QOM test of the ast2600-evb machine under :

  Apple LLVM version 10.0.0 (clang-1000.10.44.4)
  Target: x86_64-apple-darwin17.7.0
  Thread model: posix
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Cc: Rashmica Gupta <rashmica.g@gmail.com>
Fixes: 36d737ee82b2 ("hw/gpio: Add in AST2600 specific implementation")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/gpio/aspeed_gpio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
index 196e47c26284..7acc5fa8e29a 100644
--- a/hw/gpio/aspeed_gpio.c
+++ b/hw/gpio/aspeed_gpio.c
@@ -733,13 +733,13 @@ static void aspeed_gpio_get_pin(Object *obj, Visitor *v, const char *name,
 {
     int pin = 0xfff;
     bool level = true;
-    char group[3];
+    char group[4];
     AspeedGPIOState *s = ASPEED_GPIO(obj);
     int set_idx, group_idx = 0;
 
     if (sscanf(name, "gpio%2[A-Z]%1d", group, &pin) != 2) {
         /* 1.8V gpio */
-        if (sscanf(name, "gpio%3s%1d", group, &pin) != 2) {
+        if (sscanf(name, "gpio%3[18A-E]%1d", group, &pin) != 2) {
             error_setg(errp, "%s: error reading %s", __func__, name);
             return;
         }
@@ -760,7 +760,7 @@ static void aspeed_gpio_set_pin(Object *obj, Visitor *v, const char *name,
     Error *local_err = NULL;
     bool level;
     int pin = 0xfff;
-    char group[3];
+    char group[4];
     AspeedGPIOState *s = ASPEED_GPIO(obj);
     int set_idx, group_idx = 0;
 
@@ -771,7 +771,7 @@ static void aspeed_gpio_set_pin(Object *obj, Visitor *v, const char *name,
     }
     if (sscanf(name, "gpio%2[A-Z]%1d", group, &pin) != 2) {
         /* 1.8V gpio */
-        if (sscanf(name, "gpio%3s%1d", group, &pin) != 2) {
+        if (sscanf(name, "gpio%3[18A-E]%1d", group, &pin) != 2) {
             error_setg(errp, "%s: error reading %s", __func__, name);
             return;
         }
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] aspeed: Add an AST2600 eval board
  2019-10-23 13:04 [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model Cédric Le Goater
  2019-10-23 13:04 ` [PATCH 1/2] " Cédric Le Goater
@ 2019-10-23 13:04 ` Cédric Le Goater
  2019-10-24 10:59 ` [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2019-10-23 13:04 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Andrew Jeffery, qemu-devel, qemu-arm, Joel Stanley, rashmica.g,
	Cédric Le Goater

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
---
 include/hw/arm/aspeed.h |  1 +
 hw/arm/aspeed.c         | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 02073a6b4d61..f49bc7081e4d 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -18,6 +18,7 @@ typedef struct AspeedBoardConfig {
     const char *desc;
     const char *soc_name;
     uint32_t hw_strap1;
+    uint32_t hw_strap2;
     const char *fmc_model;
     const char *spi_model;
     uint32_t num_cs;
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 52993f84b461..028191ff36fc 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -88,6 +88,10 @@ struct AspeedBoardState {
 /* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */
 #define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1
 
+/* AST2600 evb hardware value */
+#define AST2600_EVB_HW_STRAP1 0x000000C0
+#define AST2600_EVB_HW_STRAP2 0x00000003
+
 /*
  * The max ram region is for firmwares that scan the address space
  * with load/store to guess how much RAM the SoC has.
@@ -187,6 +191,8 @@ static void aspeed_board_init(MachineState *machine,
                              &error_abort);
     object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap1, "hw-strap1",
                             &error_abort);
+    object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap2, "hw-strap2",
+                            &error_abort);
     object_property_set_int(OBJECT(&bmc->soc), cfg->num_cs, "num-cs",
                             &error_abort);
     object_property_set_int(OBJECT(&bmc->soc), machine->smp.cpus, "num-cpus",
@@ -308,6 +314,12 @@ static void ast2500_evb_i2c_init(AspeedBoardState *bmc)
     i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32);
 }
 
+static void ast2600_evb_i2c_init(AspeedBoardState *bmc)
+{
+    /* Start with some devices on our I2C busses */
+    ast2500_evb_i2c_init(bmc);
+}
+
 static void romulus_bmc_i2c_init(AspeedBoardState *bmc)
 {
     AspeedSoCState *soc = &bmc->soc;
@@ -455,6 +467,17 @@ static const AspeedBoardConfig aspeed_boards[] = {
         .num_cs    = 2,
         .i2c_init  = witherspoon_bmc_i2c_init,
         .ram       = 512 * MiB,
+    }, {
+        .name      = MACHINE_TYPE_NAME("ast2600-evb"),
+        .desc      = "Aspeed AST2600 EVB (Cortex A7)",
+        .soc_name  = "ast2600-a0",
+        .hw_strap1 = AST2600_EVB_HW_STRAP1,
+        .hw_strap2 = AST2600_EVB_HW_STRAP2,
+        .fmc_model = "w25q512jv",
+        .spi_model = "mx66u51235f",
+        .num_cs    = 1,
+        .i2c_init  = ast2600_evb_i2c_init,
+        .ram       = 1 * GiB,
     },
 };
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model
  2019-10-23 13:04 [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model Cédric Le Goater
  2019-10-23 13:04 ` [PATCH 1/2] " Cédric Le Goater
  2019-10-23 13:04 ` [PATCH 2/2] aspeed: Add an AST2600 eval board Cédric Le Goater
@ 2019-10-24 10:59 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2019-10-24 10:59 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Andrew Jeffery, Rashmica Gupta, qemu-arm, Joel Stanley,
	QEMU Developers

On Wed, 23 Oct 2019 at 14:05, Cédric Le Goater <clg@kaod.org> wrote:
>
> Hello,
>
> The property names of AST2600 GPIO 1.8V model are one character bigger
> than the names of the other ASPEED GPIO model. This change increases
> the string buffer size by one and parses the property name with a
> better pattern.
>
> This fixes the QOM test of the ast2600-evb machine under :
>
>   Apple LLVM version 10.0.0 (clang-1000.10.44.4)
>   Target: x86_64-apple-darwin17.7.0
>   Thread model: posix
>   InstalledDir: /Library/Developer/CommandLineTools/usr/bin
>
> And all tests for the AST2600 EVB machine should now pass !

Aha, thanks for finding this bug. In theory the compiler
could have caught it, but it looks like this isn't one of
the things -Wformat/-Wformat-security check for.

Applied to target-arm.next.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-24 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-23 13:04 [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model Cédric Le Goater
2019-10-23 13:04 ` [PATCH 1/2] " Cédric Le Goater
2019-10-23 13:04 ` [PATCH 2/2] aspeed: Add an AST2600 eval board Cédric Le Goater
2019-10-24 10:59 ` [PATCH 0/2] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).