Refactor fvp gic code to be a generic driver
Refactor the FVP gic code in plat/fvp/fvp_gic.c to be a generic ARM
GIC driver in drivers/arm/gic/arm_gic.c. Provide the platform
specific inputs in the arm_gic_setup() function so that the driver
has no explicit dependency on platform code.
Provide weak implementations of the platform interrupt controller
API in a new file, plat/common/plat_gic.c. These simply call through
to the ARM GIC driver.
Move the only remaining FVP GIC function, fvp_gic_init() to
plat/fvp/aarch64/fvp_common.c and remove plat/fvp/fvp_gic.c
Fixes ARM-software/tf-issues#182
Change-Id: Iea82fe095fad62dd33ba9efbddd48c57717edd21
diff --git a/plat/fvp/fvp_pm.c b/plat/fvp/fvp_pm.c
index f796718..55f465b 100644
--- a/plat/fvp/fvp_pm.c
+++ b/plat/fvp/fvp_pm.c
@@ -29,6 +29,7 @@
*/
#include <arch_helpers.h>
+#include <arm_gic.h>
#include <assert.h>
#include <bakery_lock.h>
#include <cci400.h>
@@ -130,7 +131,7 @@
unsigned int state)
{
int rc = PSCI_E_SUCCESS;
- unsigned int gicc_base, ectlr;
+ unsigned int ectlr;
switch (afflvl) {
case MPIDR_AFFLVL1:
@@ -168,8 +169,7 @@
* Prevent interrupts from spuriously waking up
* this cpu
*/
- gicc_base = get_plat_config()->gicc_base;
- gic_cpuif_deactivate(gicc_base);
+ arm_gic_cpuif_deactivate();
/*
* Program the power controller to power this
@@ -205,7 +205,7 @@
unsigned int state)
{
int rc = PSCI_E_SUCCESS;
- unsigned int gicc_base, ectlr;
+ unsigned int ectlr;
unsigned long linear_id;
mailbox_t *fvp_mboxes;
@@ -251,8 +251,7 @@
* Prevent interrupts from spuriously waking up
* this cpu
*/
- gicc_base = get_plat_config()->gicc_base;
- gic_cpuif_deactivate(gicc_base);
+ arm_gic_cpuif_deactivate();
/*
* Program the power controller to power this
@@ -284,7 +283,7 @@
int rc = PSCI_E_SUCCESS;
unsigned long linear_id;
mailbox_t *fvp_mboxes;
- unsigned int gicd_base, gicc_base, ectlr;
+ unsigned int ectlr;
switch (afflvl) {
@@ -339,12 +338,10 @@
sizeof(unsigned long));
/* Enable the gic cpu interface */
- gicc_base = get_plat_config()->gicc_base;
- gic_cpuif_setup(gicc_base);
+ arm_gic_cpuif_setup();
/* TODO: This setup is needed only after a cold boot */
- gicd_base = get_plat_config()->gicd_base;
- gic_pcpu_distif_setup(gicd_base);
+ arm_gic_pcpu_distif_setup();
break;