hw/intc/arm_gicv3_its: Remove redundant ITS_CTLR_ENABLED define

We currently define a bitmask for the GITS_CTLR ENABLED bit in
two ways: as ITS_CTLR_ENABLED, and via the FIELD() macro as
R_GITS_CTLR_ENABLED_MASK. Consistently use the FIELD macro version
everywhere and remove the redundant ITS_CTLR_ENABLED define.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
Peter Maydell 2022-01-07 17:07:58 +00:00
parent a120157b24
commit 8d2d6dd9bb
2 changed files with 10 additions and 12 deletions

View File

@ -651,7 +651,7 @@ static void process_cmdq(GICv3ITSState *s)
uint8_t cmd; uint8_t cmd;
int i; int i;
if (!(s->ctlr & ITS_CTLR_ENABLED)) { if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) {
return; return;
} }
@ -887,7 +887,7 @@ static MemTxResult gicv3_its_translation_write(void *opaque, hwaddr offset,
switch (offset) { switch (offset) {
case GITS_TRANSLATER: case GITS_TRANSLATER:
if (s->ctlr & ITS_CTLR_ENABLED) { if (s->ctlr & R_GITS_CTLR_ENABLED_MASK) {
devid = attrs.requester_id; devid = attrs.requester_id;
result = process_its_cmd(s, data, devid, NONE); result = process_its_cmd(s, data, devid, NONE);
} }
@ -912,13 +912,13 @@ static bool its_writel(GICv3ITSState *s, hwaddr offset,
switch (offset) { switch (offset) {
case GITS_CTLR: case GITS_CTLR:
if (value & R_GITS_CTLR_ENABLED_MASK) { if (value & R_GITS_CTLR_ENABLED_MASK) {
s->ctlr |= ITS_CTLR_ENABLED; s->ctlr |= R_GITS_CTLR_ENABLED_MASK;
extract_table_params(s); extract_table_params(s);
extract_cmdq_params(s); extract_cmdq_params(s);
s->creadr = 0; s->creadr = 0;
process_cmdq(s); process_cmdq(s);
} else { } else {
s->ctlr &= ~ITS_CTLR_ENABLED; s->ctlr &= ~R_GITS_CTLR_ENABLED_MASK;
} }
break; break;
case GITS_CBASER: case GITS_CBASER:
@ -926,7 +926,7 @@ static bool its_writel(GICv3ITSState *s, hwaddr offset,
* IMPDEF choice:- GITS_CBASER register becomes RO if ITS is * IMPDEF choice:- GITS_CBASER register becomes RO if ITS is
* already enabled * already enabled
*/ */
if (!(s->ctlr & ITS_CTLR_ENABLED)) { if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) {
s->cbaser = deposit64(s->cbaser, 0, 32, value); s->cbaser = deposit64(s->cbaser, 0, 32, value);
s->creadr = 0; s->creadr = 0;
s->cwriter = s->creadr; s->cwriter = s->creadr;
@ -937,7 +937,7 @@ static bool its_writel(GICv3ITSState *s, hwaddr offset,
* IMPDEF choice:- GITS_CBASER register becomes RO if ITS is * IMPDEF choice:- GITS_CBASER register becomes RO if ITS is
* already enabled * already enabled
*/ */
if (!(s->ctlr & ITS_CTLR_ENABLED)) { if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) {
s->cbaser = deposit64(s->cbaser, 32, 32, value); s->cbaser = deposit64(s->cbaser, 32, 32, value);
s->creadr = 0; s->creadr = 0;
s->cwriter = s->creadr; s->cwriter = s->creadr;
@ -979,7 +979,7 @@ static bool its_writel(GICv3ITSState *s, hwaddr offset,
* IMPDEF choice:- GITS_BASERn register becomes RO if ITS is * IMPDEF choice:- GITS_BASERn register becomes RO if ITS is
* already enabled * already enabled
*/ */
if (!(s->ctlr & ITS_CTLR_ENABLED)) { if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) {
index = (offset - GITS_BASER) / 8; index = (offset - GITS_BASER) / 8;
if (offset & 7) { if (offset & 7) {
@ -1076,7 +1076,7 @@ static bool its_writell(GICv3ITSState *s, hwaddr offset,
* IMPDEF choice:- GITS_BASERn register becomes RO if ITS is * IMPDEF choice:- GITS_BASERn register becomes RO if ITS is
* already enabled * already enabled
*/ */
if (!(s->ctlr & ITS_CTLR_ENABLED)) { if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) {
index = (offset - GITS_BASER) / 8; index = (offset - GITS_BASER) / 8;
s->baser[index] &= GITS_BASER_RO_MASK; s->baser[index] &= GITS_BASER_RO_MASK;
s->baser[index] |= (value & ~GITS_BASER_RO_MASK); s->baser[index] |= (value & ~GITS_BASER_RO_MASK);
@ -1087,7 +1087,7 @@ static bool its_writell(GICv3ITSState *s, hwaddr offset,
* IMPDEF choice:- GITS_CBASER register becomes RO if ITS is * IMPDEF choice:- GITS_CBASER register becomes RO if ITS is
* already enabled * already enabled
*/ */
if (!(s->ctlr & ITS_CTLR_ENABLED)) { if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) {
s->cbaser = value; s->cbaser = value;
s->creadr = 0; s->creadr = 0;
s->cwriter = s->creadr; s->cwriter = s->creadr;
@ -1298,7 +1298,7 @@ static void gicv3_its_reset(DeviceState *dev)
static void gicv3_its_post_load(GICv3ITSState *s) static void gicv3_its_post_load(GICv3ITSState *s)
{ {
if (s->ctlr & ITS_CTLR_ENABLED) { if (s->ctlr & R_GITS_CTLR_ENABLED_MASK) {
extract_table_params(s); extract_table_params(s);
extract_cmdq_params(s); extract_cmdq_params(s);
} }

View File

@ -289,8 +289,6 @@ FIELD(GITS_TYPER, CIL, 36, 1)
#define GITS_IDREGS 0xFFD0 #define GITS_IDREGS 0xFFD0
#define ITS_CTLR_ENABLED (1U) /* ITS Enabled */
#define GITS_BASER_RO_MASK (R_GITS_BASER_ENTRYSIZE_MASK | \ #define GITS_BASER_RO_MASK (R_GITS_BASER_ENTRYSIZE_MASK | \
R_GITS_BASER_TYPE_MASK) R_GITS_BASER_TYPE_MASK)