diff options
author | Peter Delevoryas | 2022-05-02 17:03:04 +0200 |
---|---|---|
committer | Cédric Le Goater | 2022-05-02 17:03:04 +0200 |
commit | 2ec063788efd3a545c5aa2999159c9303bb476f3 (patch) | |
tree | ede0086014e910c122b8d76f209eef8786008ecb /hw/gpio | |
parent | tests/qtest: Add test for Aspeed HACE accumulative mode (diff) | |
download | qemu-2ec063788efd3a545c5aa2999159c9303bb476f3.tar.gz qemu-2ec063788efd3a545c5aa2999159c9303bb476f3.tar.xz qemu-2ec063788efd3a545c5aa2999159c9303bb476f3.zip |
hw/gpio/aspeed_gpio: Fix QOM pin property
I was setting gpioV4-7 to "1110" using the QOM pin property handler and
noticed that lowering gpioV7 was inadvertently lowering gpioV4-6 too.
(qemu) qom-set /machine/soc/gpio gpioV4 true
(qemu) qom-set /machine/soc/gpio gpioV5 true
(qemu) qom-set /machine/soc/gpio gpioV6 true
(qemu) qom-get /machine/soc/gpio gpioV4
true
(qemu) qom-set /machine/soc/gpio gpioV7 false
(qemu) qom-get /machine/soc/gpio gpioV4
false
An expression in aspeed_gpio_set_pin_level was using a logical NOT
operator instead of a bitwise NOT operator:
value &= !pin_mask;
The original author probably intended to make a bitwise NOT expression
"~", but mistakenly used a logical NOT operator "!" instead. Some
programming languages like Rust use "!" for both purposes.
Fixes: 4b7f956862dc ("hw/gpio: Add basic Aspeed GPIO model for AST2400 and
AST2500")
Signed-off-by: Peter Delevoryas <pdel@fb.com>
Message-Id: <20220502080827.244815-1-pdel@fb.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'hw/gpio')
-rw-r--r-- | hw/gpio/aspeed_gpio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c index c63634d3d3..9b736e7a9f 100644 --- a/hw/gpio/aspeed_gpio.c +++ b/hw/gpio/aspeed_gpio.c @@ -312,7 +312,7 @@ static void aspeed_gpio_set_pin_level(AspeedGPIOState *s, uint32_t set_idx, if (level) { value |= pin_mask; } else { - value &= !pin_mask; + value &= ~pin_mask; } aspeed_gpio_update(s, &s->sets[set_idx], value); |