Remove calling CPU mpidr from bakery lock API
The bakery lock code currently expects the calling code to pass
the MPIDR_EL1 of the current CPU.
This is not always done correctly. Also the change to provide
inline access to system registers makes it more efficient for the
bakery lock code to obtain the MPIDR_EL1 directly.
This change removes the mpidr parameter from the bakery lock
interface, and results in a code reduction of 160 bytes for the
ARM FVP port.
Fixes ARM-software/tf-issues#213
Change-Id: I7ec7bd117bcc9794a0d948990fcf3336a367d543
diff --git a/plat/fvp/drivers/pwrc/fvp_pwrc.c b/plat/fvp/drivers/pwrc/fvp_pwrc.c
index d1feece..c32c322 100644
--- a/plat/fvp/drivers/pwrc/fvp_pwrc.c
+++ b/plat/fvp/drivers/pwrc/fvp_pwrc.c
@@ -41,59 +41,54 @@
unsigned int fvp_pwrc_get_cpu_wkr(unsigned long mpidr)
{
- unsigned int rc = 0;
- bakery_lock_get(mpidr, &pwrc_lock);
- mmio_write_32(PWRC_BASE + PSYSR_OFF, (unsigned int) mpidr);
- rc = PSYSR_WK(mmio_read_32(PWRC_BASE + PSYSR_OFF));
- bakery_lock_release(mpidr, &pwrc_lock);
- return rc;
+ return PSYSR_WK(fvp_pwrc_read_psysr(mpidr));
}
unsigned int fvp_pwrc_read_psysr(unsigned long mpidr)
{
- unsigned int rc = 0;
- bakery_lock_get(mpidr, &pwrc_lock);
+ unsigned int rc;
+ bakery_lock_get(&pwrc_lock);
mmio_write_32(PWRC_BASE + PSYSR_OFF, (unsigned int) mpidr);
rc = mmio_read_32(PWRC_BASE + PSYSR_OFF);
- bakery_lock_release(mpidr, &pwrc_lock);
+ bakery_lock_release(&pwrc_lock);
return rc;
}
void fvp_pwrc_write_pponr(unsigned long mpidr)
{
- bakery_lock_get(mpidr, &pwrc_lock);
+ bakery_lock_get(&pwrc_lock);
mmio_write_32(PWRC_BASE + PPONR_OFF, (unsigned int) mpidr);
- bakery_lock_release(mpidr, &pwrc_lock);
+ bakery_lock_release(&pwrc_lock);
}
void fvp_pwrc_write_ppoffr(unsigned long mpidr)
{
- bakery_lock_get(mpidr, &pwrc_lock);
+ bakery_lock_get(&pwrc_lock);
mmio_write_32(PWRC_BASE + PPOFFR_OFF, (unsigned int) mpidr);
- bakery_lock_release(mpidr, &pwrc_lock);
+ bakery_lock_release(&pwrc_lock);
}
void fvp_pwrc_set_wen(unsigned long mpidr)
{
- bakery_lock_get(mpidr, &pwrc_lock);
+ bakery_lock_get(&pwrc_lock);
mmio_write_32(PWRC_BASE + PWKUPR_OFF,
(unsigned int) (PWKUPR_WEN | mpidr));
- bakery_lock_release(mpidr, &pwrc_lock);
+ bakery_lock_release(&pwrc_lock);
}
void fvp_pwrc_clr_wen(unsigned long mpidr)
{
- bakery_lock_get(mpidr, &pwrc_lock);
+ bakery_lock_get(&pwrc_lock);
mmio_write_32(PWRC_BASE + PWKUPR_OFF,
(unsigned int) mpidr);
- bakery_lock_release(mpidr, &pwrc_lock);
+ bakery_lock_release(&pwrc_lock);
}
void fvp_pwrc_write_pcoffr(unsigned long mpidr)
{
- bakery_lock_get(mpidr, &pwrc_lock);
+ bakery_lock_get(&pwrc_lock);
mmio_write_32(PWRC_BASE + PCOFFR_OFF, (unsigned int) mpidr);
- bakery_lock_release(mpidr, &pwrc_lock);
+ bakery_lock_release(&pwrc_lock);
}
/* Nothing else to do here apart from initializing the lock */