From: Simon Xu <simonxhy0404@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Owen Giles <owen.giles@hpe.com>,
Peter Maydell <peter.maydell@linaro.org>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,
Robert Elliott <elliott@hpe.com>,
Simon Xu <simonxhy0404@gmail.com>
Subject: [PATCH v2 6/9] hw/misc/iotkit-secctl.c: use GNU C case ranges
Date: Wed, 5 Aug 2026 10:30:02 -0500 [thread overview]
Message-ID: <20260805153005.9989-7-simonxhy0404@gmail.com> (raw)
In-Reply-To: <20260805153005.9989-1-simonxhy0404@gmail.com>
Replace case fall throughs with case ranges when register addresses
are continous.
Reviewed-by: Owen Giles <owen.giles@hpe.com>
Reviewed-by: Robert Elliott <elliott@hpe.com>
Signed-off-by: Simon Xu <simonxhy0404@gmail.com>
---
v1 -> v2
Make long case statemens consistent with other iotkit files
---
hw/misc/iotkit-secctl.c | 112 ++++++----------------------------------
1 file changed, 16 insertions(+), 96 deletions(-)
diff --git a/hw/misc/iotkit-secctl.c b/hw/misc/iotkit-secctl.c
index 9f6fb81088..2d06d6f80f 100644
--- a/hw/misc/iotkit-secctl.c
+++ b/hw/misc/iotkit-secctl.c
@@ -187,36 +187,24 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, hwaddr addr,
case A_BRGINTEN:
r = s->brginten;
break;
- case A_AHBNSPPCEXP0:
- case A_AHBNSPPCEXP1:
- case A_AHBNSPPCEXP2:
- case A_AHBNSPPCEXP3:
+ case A_AHBNSPPCEXP0 ... A_AHBNSPPCEXP3:
r = s->ahbexp[offset_to_ppc_idx(offset)].ns;
break;
case A_APBNSPPC0:
case A_APBNSPPC1:
r = s->apb[offset_to_ppc_idx(offset)].ns;
break;
- case A_APBNSPPCEXP0:
- case A_APBNSPPCEXP1:
- case A_APBNSPPCEXP2:
- case A_APBNSPPCEXP3:
+ case A_APBNSPPCEXP0 ... A_APBNSPPCEXP3:
r = s->apbexp[offset_to_ppc_idx(offset)].ns;
break;
- case A_AHBSPPPCEXP0:
- case A_AHBSPPPCEXP1:
- case A_AHBSPPPCEXP2:
- case A_AHBSPPPCEXP3:
+ case A_AHBSPPPCEXP0 ... A_AHBSPPPCEXP3:
r = s->ahbexp[offset_to_ppc_idx(offset)].sp;
break;
case A_APBSPPPC0:
case A_APBSPPPC1:
r = s->apb[offset_to_ppc_idx(offset)].sp;
break;
- case A_APBSPPPCEXP0:
- case A_APBSPPPCEXP1:
- case A_APBSPPPCEXP2:
- case A_APBSPPPCEXP3:
+ case A_APBSPPPCEXP0 ... A_APBSPPPCEXP3:
r = s->apbexp[offset_to_ppc_idx(offset)].sp;
break;
case A_SECMSCINTSTAT:
@@ -228,18 +216,7 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, hwaddr addr,
case A_NSMSCEXP:
r = s->nsmscexp;
break;
- case A_PID4:
- case A_PID5:
- case A_PID6:
- case A_PID7:
- case A_PID0:
- case A_PID1:
- case A_PID2:
- case A_PID3:
- case A_CID0:
- case A_CID1:
- case A_CID2:
- case A_CID3:
+ case A_PID4 ... A_CID3:
switch (s->sse_version) {
case ARMSSE_SSE300:
r = iotkit_secctl_s_sse300_idregs[(offset - A_PID4) / 4];
@@ -389,10 +366,7 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,
case A_BRGINTEN:
s->brginten = value & 0xffff0000;
break;
- case A_AHBNSPPCEXP0:
- case A_AHBNSPPCEXP1:
- case A_AHBNSPPCEXP2:
- case A_AHBNSPPCEXP3:
+ case A_AHBNSPPCEXP0 ... A_AHBNSPPCEXP3:
ppc = &s->ahbexp[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_ns_write(ppc, value);
break;
@@ -401,17 +375,11 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,
ppc = &s->apb[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_ns_write(ppc, value);
break;
- case A_APBNSPPCEXP0:
- case A_APBNSPPCEXP1:
- case A_APBNSPPCEXP2:
- case A_APBNSPPCEXP3:
+ case A_APBNSPPCEXP0 ... A_APBNSPPCEXP3:
ppc = &s->apbexp[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_ns_write(ppc, value);
break;
- case A_AHBSPPPCEXP0:
- case A_AHBSPPPCEXP1:
- case A_AHBSPPPCEXP2:
- case A_AHBSPPPCEXP3:
+ case A_AHBSPPPCEXP0 ... A_AHBSPPPCEXP3:
ppc = &s->ahbexp[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_sp_write(ppc, value);
break;
@@ -420,10 +388,7 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,
ppc = &s->apb[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_sp_write(ppc, value);
break;
- case A_APBSPPPCEXP0:
- case A_APBSPPPCEXP1:
- case A_APBSPPPCEXP2:
- case A_APBSPPPCEXP3:
+ case A_APBSPPPCEXP0 ... A_APBSPPPCEXP3:
ppc = &s->apbexp[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_sp_write(ppc, value);
break;
@@ -444,18 +409,7 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,
case A_BRGINTSTAT:
case A_AHBNSPPC0:
case A_AHBSPPPC0:
- case A_PID4:
- case A_PID5:
- case A_PID6:
- case A_PID7:
- case A_PID0:
- case A_PID1:
- case A_PID2:
- case A_PID3:
- case A_CID0:
- case A_CID1:
- case A_CID2:
- case A_CID3:
+ case A_PID4 ... A_CID3:
qemu_log_mask(LOG_GUEST_ERROR,
"IoTKit SecCtl S block write: "
"read-only offset 0x%x\n", offset);
@@ -482,34 +436,17 @@ static MemTxResult iotkit_secctl_ns_read(void *opaque, hwaddr addr,
case A_AHBNSPPPC0:
r = 0;
break;
- case A_AHBNSPPPCEXP0:
- case A_AHBNSPPPCEXP1:
- case A_AHBNSPPPCEXP2:
- case A_AHBNSPPPCEXP3:
+ case A_AHBNSPPPCEXP0 ... A_AHBNSPPPCEXP3:
r = s->ahbexp[offset_to_ppc_idx(offset)].nsp;
break;
case A_APBNSPPPC0:
case A_APBNSPPPC1:
r = s->apb[offset_to_ppc_idx(offset)].nsp;
break;
- case A_APBNSPPPCEXP0:
- case A_APBNSPPPCEXP1:
- case A_APBNSPPPCEXP2:
- case A_APBNSPPPCEXP3:
+ case A_APBNSPPPCEXP0 ... A_APBNSPPPCEXP3:
r = s->apbexp[offset_to_ppc_idx(offset)].nsp;
break;
- case A_PID4:
- case A_PID5:
- case A_PID6:
- case A_PID7:
- case A_PID0:
- case A_PID1:
- case A_PID2:
- case A_PID3:
- case A_CID0:
- case A_CID1:
- case A_CID2:
- case A_CID3:
+ case A_PID4 ... A_CID3:
switch (s->sse_version) {
case ARMSSE_SSE300:
r = iotkit_secctl_ns_sse300_idregs[(offset - A_PID4) / 4];
@@ -560,10 +497,7 @@ static MemTxResult iotkit_secctl_ns_write(void *opaque, hwaddr addr,
}
switch (offset) {
- case A_AHBNSPPPCEXP0:
- case A_AHBNSPPPCEXP1:
- case A_AHBNSPPPCEXP2:
- case A_AHBNSPPPCEXP3:
+ case A_AHBNSPPPCEXP0 ... A_AHBNSPPPCEXP3:
ppc = &s->ahbexp[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_nsp_write(ppc, value);
break;
@@ -572,26 +506,12 @@ static MemTxResult iotkit_secctl_ns_write(void *opaque, hwaddr addr,
ppc = &s->apb[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_nsp_write(ppc, value);
break;
- case A_APBNSPPPCEXP0:
- case A_APBNSPPPCEXP1:
- case A_APBNSPPPCEXP2:
- case A_APBNSPPPCEXP3:
+ case A_APBNSPPPCEXP0 ... A_APBNSPPPCEXP3:
ppc = &s->apbexp[offset_to_ppc_idx(offset)];
iotkit_secctl_ppc_nsp_write(ppc, value);
break;
case A_AHBNSPPPC0:
- case A_PID4:
- case A_PID5:
- case A_PID6:
- case A_PID7:
- case A_PID0:
- case A_PID1:
- case A_PID2:
- case A_PID3:
- case A_CID0:
- case A_CID1:
- case A_CID2:
- case A_CID3:
+ case A_PID4 ... A_CID3:
qemu_log_mask(LOG_GUEST_ERROR,
"IoTKit SecCtl NS block write: "
"read-only offset 0x%x\n", offset);
--
2.53.0
next prev parent reply other threads:[~2026-08-05 15:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 15:29 [PATCH v2 0/9] arm: add Cortex-M85, SSE-310, and mps3-an555 Simon Xu
2026-08-05 15:29 ` [PATCH v2 1/9] target/arm/tcg/cpu-v7m.c: add cortex-m85 model Simon Xu
2026-08-05 15:29 ` [PATCH v2 2/9] hw/arm/armsse: add Arm Corstone SSE-310 Simon Xu
2026-08-17 15:23 ` Peter Maydell
2026-08-05 15:29 ` [PATCH v2 3/9] hw/misc/iotkit-sysctl.c: add SSE-310 support Simon Xu
2026-08-17 15:30 ` Peter Maydell
2026-08-05 15:30 ` [PATCH v2 4/9] hw/misc/iotkit-secctl.c: fix AHB secure read Simon Xu
2026-08-17 15:33 ` Peter Maydell
2026-08-05 15:30 ` [PATCH v2 5/9] hw/misc/iotkit-secctl.c: add SSE-310 support Simon Xu
2026-08-17 15:34 ` Peter Maydell
2026-08-05 15:30 ` Simon Xu [this message]
2026-08-17 15:38 ` [PATCH v2 6/9] hw/misc/iotkit-secctl.c: use GNU C case ranges Peter Maydell
2026-08-05 15:30 ` [PATCH v2 7/9] hw/misc/iotkit-sysinfo.c: add SSE-310 support Simon Xu
2026-08-17 15:38 ` Peter Maydell
2026-08-05 15:30 ` [PATCH v2 8/9] hw/arm/mps2-tz.c add Arm mps3-an555 board Simon Xu
2026-08-17 15:50 ` Peter Maydell
2026-08-05 15:30 ` [PATCH v2 9/9] hw/misc/mps2-fpgaio.c: add GPIOALT2 register Simon Xu
2026-08-17 15:49 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260805153005.9989-7-simonxhy0404@gmail.com \
--to=simonxhy0404@gmail.com \
--cc=elliott@hpe.com \
--cc=owen.giles@hpe.com \
--cc=peter.maydell@linaro.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox