diff mbox

[2/3] arm_gic: GICD_ICFGR: Write model only for pre v1 GICs

Message ID 1408218501-22326-3-git-send-email-adam@os.inf.tu-dresden.de
State New
Headers show

Commit Message

Adam Lackorzynski Aug. 16, 2014, 7:48 p.m. UTC
Setting the model is only available in pre-v1 GIC models.
---
 hw/intc/arm_gic.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Christoffer Dall Aug. 18, 2014, 12:46 p.m. UTC | #1
On Sat, Aug 16, 2014 at 09:48:20PM +0200, Adam Lackorzynski wrote:
> Setting the model is only available in pre-v1 GIC models.
> ---
>  hw/intc/arm_gic.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
> index d2b1aaf..e546647 100644
> --- a/hw/intc/arm_gic.c
> +++ b/hw/intc/arm_gic.c
> @@ -561,10 +561,12 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,
>          if (irq < GIC_INTERNAL)
>              value |= 0xaa;
>          for (i = 0; i < 4; i++) {
> -            if (value & (1 << (i * 2))) {
> -                GIC_SET_MODEL(irq + i);
> -            } else {
> -                GIC_CLEAR_MODEL(irq + i);
> +            if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
> +                if (value & (1 << (i * 2))) {
> +                    GIC_SET_MODEL(irq + i);
> +                } else {
> +                    GIC_CLEAR_MODEL(irq + i);
> +                }
>              }
>              if (value & (2 << (i * 2))) {
>                  GIC_SET_EDGE_TRIGGER(irq + i);
> -- 
> 2.1.0.rc1
> 
looks good,

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
diff mbox

Patch

diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index d2b1aaf..e546647 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -561,10 +561,12 @@  static void gic_dist_writeb(void *opaque, hwaddr offset,
         if (irq < GIC_INTERNAL)
             value |= 0xaa;
         for (i = 0; i < 4; i++) {
-            if (value & (1 << (i * 2))) {
-                GIC_SET_MODEL(irq + i);
-            } else {
-                GIC_CLEAR_MODEL(irq + i);
+            if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
+                if (value & (1 << (i * 2))) {
+                    GIC_SET_MODEL(irq + i);
+                } else {
+                    GIC_CLEAR_MODEL(irq + i);
+                }
             }
             if (value & (2 << (i * 2))) {
                 GIC_SET_EDGE_TRIGGER(irq + i);