aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2016-07-14 16:51:38 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-07-14 16:51:38 +0100
commit97c2ed5dbdda978e29618f356f11caa99a7df601 (patch)
treeea62588d7188031c0346e66087f980dda1ef71f3 /hw
parent2ddfa2817b7f2be4f7ef0fd4806e06aaced9e6ac (diff)
ast2400: replace aspeed_smc_is_implemented()
aspeed_smc_is_implemented() filters invalid registers in a peculiar way. Let's remove it and open code the if conditions. It serves the same purpose, the aesthetic is better, and new registers can easily be added. Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-id: 1467994016-11678-3-git-send-email-clg@kaod.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/ssi/aspeed_smc.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index a371e302d4..854474b642 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -281,12 +281,6 @@ static void aspeed_smc_reset(DeviceState *d)
aspeed_smc_update_cs(s);
}
-static bool aspeed_smc_is_implemented(AspeedSMCState *s, hwaddr addr)
-{
- return (addr == s->r_conf || addr == s->r_timings || addr == s->r_ce_ctrl ||
- (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->num_cs));
-}
-
static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size)
{
AspeedSMCState *s = ASPEED_SMC(opaque);
@@ -300,13 +294,16 @@ static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size)
return 0;
}
- if (!aspeed_smc_is_implemented(s, addr)) {
+ if (addr == s->r_conf ||
+ addr == s->r_timings ||
+ addr == s->r_ce_ctrl ||
+ (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->num_cs)) {
+ return s->regs[addr];
+ } else {
qemu_log_mask(LOG_UNIMP, "%s: not implemented: 0x%" HWADDR_PRIx "\n",
- __func__, addr);
+ __func__, addr);
return 0;
}
-
- return s->regs[addr];
}
static void aspeed_smc_write(void *opaque, hwaddr addr, uint64_t data,
@@ -324,20 +321,18 @@ static void aspeed_smc_write(void *opaque, hwaddr addr, uint64_t data,
return;
}
- if (!aspeed_smc_is_implemented(s, addr)) {
+ if (addr == s->r_conf ||
+ addr == s->r_timings ||
+ addr == s->r_ce_ctrl) {
+ s->regs[addr] = value;
+ } else if (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->num_cs) {
+ s->regs[addr] = value;
+ aspeed_smc_update_cs(s);
+ } else {
qemu_log_mask(LOG_UNIMP, "%s: not implemented: 0x%" HWADDR_PRIx "\n",
__func__, addr);
return;
}
-
- /*
- * Not much to do apart from storing the value and set the cs
- * lines if the register is a controlling one.
- */
- s->regs[addr] = value;
- if (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->num_cs) {
- aspeed_smc_update_cs(s);
- }
}
static const MemoryRegionOps aspeed_smc_ops = {