From 1e2abe05a89cb8ff073837f733185fba2f112610 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Mon, 13 Apr 2015 19:57:54 -0700 Subject: armv8/secmon: Disable and Enable GIC in PSCI path Disable and enable GIC before switching off a CPU and after bringing it up back respectively. BUG=None BRANCH=None TEST=Compiles successfully and psci commands work for ryu. Change-Id: Ib43af60e994e3d072e897a59595775d0b2dcef83 Signed-off-by: Patrick Georgi Original-Commit-Id: d5271d731f0a569583c2b32ef6726dadbfa846d3 Original-Change-Id: I672945fcb0ff416008a1aad5ed625cfa91bb9cbd Original-Signed-off-by: Furquan Shaikh Original-Reviewed-on: https://chromium-review.googlesource.com/265623 Original-Trybot-Ready: Furquan Shaikh Original-Tested-by: Furquan Shaikh Original-Reviewed-by: Aaron Durbin Original-Commit-Queue: Furquan Shaikh Reviewed-on: http://review.coreboot.org/9926 Reviewed-by: Stefan Reinauer Tested-by: build bot (Jenkins) --- src/drivers/gic/gic.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/gic/gic.c b/src/drivers/gic/gic.c index 8972d04617..71073a580a 100644 --- a/src/drivers/gic/gic.c +++ b/src/drivers/gic/gic.c @@ -59,6 +59,11 @@ static struct gic *gic_get(void) return &gic; } +static inline uint32_t gic_read(uint32_t *base) +{ + return read32(base); +} + static inline void gic_write(uint32_t *base, uint32_t val) { write32(base, val); @@ -118,3 +123,31 @@ void gic_init(void) /* Allow Non-secure access to everything. */ gic_write_regs(&gicd->nsacr[0], gic->num_interrupts / 16, ~0x0); } + +void gic_disable(void) +{ + struct gic *gic; + struct gicc_mmio *gicc; + + gic = gic_get(); + gicc = gic->gicc; + + /* Disable secure, non-secure interrupts. */ + uint32_t val = gic_read(&gicc->ctlr); + val &= ~(ENABLE_GRP0 | ENABLE_GRP1); + gic_write(&gicc->ctlr, val); +} + +void gic_enable(void) +{ + struct gic *gic; + struct gicc_mmio *gicc; + + gic = gic_get(); + gicc = gic->gicc; + + /* Enable secure, non-secure interrupts. */ + uint32_t val = gic_read(&gicc->ctlr); + val |= (ENABLE_GRP0 | ENABLE_GRP1); + gic_write(&gicc->ctlr, val); +} -- cgit v1.2.3