OSDN Git Service

hw/intc/arm_gicv3_its: Reduce code duplication in extract_table_params()
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 7 Jan 2022 17:07:58 +0000 (17:07 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 7 Jan 2022 17:07:58 +0000 (17:07 +0000)
commite5487a413904973ca77999c904be8949da2e8f31
treece9e41c829840d3cfb5ebb647bc81ae957b492ce
parent62df780e3d4e918d984797f2d75b0cced157b757
hw/intc/arm_gicv3_its: Reduce code duplication in extract_table_params()

The extract_table_params() decodes the fields in the GITS_BASER<n>
registers into TableDesc structs.  Since the fields are the same for
all the GITS_BASER<n> registers, there is currently a lot of code
duplication within the switch (type) statement.  Refactor so that the
cases include only what is genuinely different for each type:
the calculation of the number of bits in the ID value that indexes
into the table.

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>
hw/intc/arm_gicv3_its.c