Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
7eea1352
Commit
7eea1352
authored
Jun 24, 2014
by
danh-arm
Browse files
Merge pull request #147 from athoelke/at/remove-bakery-mpidr
Remove calling CPU mpidr from bakery lock API
parents
41cf7bdf
634ec6c2
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/lib/bakery_lock.h
View file @
7eea1352
...
@@ -44,8 +44,8 @@ typedef struct bakery_lock {
...
@@ -44,8 +44,8 @@ typedef struct bakery_lock {
#define NO_OWNER (-1)
#define NO_OWNER (-1)
void
bakery_lock_init
(
bakery_lock_t
*
bakery
);
void
bakery_lock_init
(
bakery_lock_t
*
bakery
);
void
bakery_lock_get
(
unsigned
long
mpidr
,
bakery_lock_t
*
bakery
);
void
bakery_lock_get
(
bakery_lock_t
*
bakery
);
void
bakery_lock_release
(
unsigned
long
mpidr
,
bakery_lock_t
*
bakery
);
void
bakery_lock_release
(
bakery_lock_t
*
bakery
);
int
bakery_lock_try
(
unsigned
long
mpidr
,
bakery_lock_t
*
bakery
);
int
bakery_lock_try
(
bakery_lock_t
*
bakery
);
#endif
/* __BAKERY_LOCK_H__ */
#endif
/* __BAKERY_LOCK_H__ */
lib/locks/bakery/bakery_lock.c
View file @
7eea1352
...
@@ -124,12 +124,12 @@ static unsigned int bakery_get_ticket(bakery_lock_t *bakery, unsigned int me)
...
@@ -124,12 +124,12 @@ static unsigned int bakery_get_ticket(bakery_lock_t *bakery, unsigned int me)
* of others'. The CPU with the highest priority (lowest numerical value)
* of others'. The CPU with the highest priority (lowest numerical value)
* acquires the lock
* acquires the lock
*/
*/
void
bakery_lock_get
(
unsigned
long
mpidr
,
bakery_lock_t
*
bakery
)
void
bakery_lock_get
(
bakery_lock_t
*
bakery
)
{
{
unsigned
int
they
,
me
;
unsigned
int
they
,
me
;
unsigned
int
my_ticket
,
my_prio
,
their_ticket
;
unsigned
int
my_ticket
,
my_prio
,
their_ticket
;
me
=
platform_get_core_pos
(
mpidr
);
me
=
platform_get_core_pos
(
read_mpidr_el1
()
);
assert_bakery_entry_valid
(
me
,
bakery
);
assert_bakery_entry_valid
(
me
,
bakery
);
...
@@ -176,9 +176,9 @@ void bakery_lock_get(unsigned long mpidr, bakery_lock_t *bakery)
...
@@ -176,9 +176,9 @@ void bakery_lock_get(unsigned long mpidr, bakery_lock_t *bakery)
/* Release the lock and signal contenders */
/* Release the lock and signal contenders */
void
bakery_lock_release
(
unsigned
long
mpidr
,
bakery_lock_t
*
bakery
)
void
bakery_lock_release
(
bakery_lock_t
*
bakery
)
{
{
unsigned
int
me
=
platform_get_core_pos
(
mpidr
);
unsigned
int
me
=
platform_get_core_pos
(
read_mpidr_el1
()
);
assert_bakery_entry_valid
(
me
,
bakery
);
assert_bakery_entry_valid
(
me
,
bakery
);
assert
(
bakery
->
owner
==
me
);
assert
(
bakery
->
owner
==
me
);
...
...
plat/fvp/drivers/pwrc/fvp_pwrc.c
View file @
7eea1352
...
@@ -41,59 +41,54 @@ static bakery_lock_t pwrc_lock __attribute__ ((section("tzfw_coherent_mem")));
...
@@ -41,59 +41,54 @@ static bakery_lock_t pwrc_lock __attribute__ ((section("tzfw_coherent_mem")));
unsigned
int
fvp_pwrc_get_cpu_wkr
(
unsigned
long
mpidr
)
unsigned
int
fvp_pwrc_get_cpu_wkr
(
unsigned
long
mpidr
)
{
{
unsigned
int
rc
=
0
;
return
PSYSR_WK
(
fvp_pwrc_read_psysr
(
mpidr
));
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
;
}
}
unsigned
int
fvp_pwrc_read_psysr
(
unsigned
long
mpidr
)
unsigned
int
fvp_pwrc_read_psysr
(
unsigned
long
mpidr
)
{
{
unsigned
int
rc
=
0
;
unsigned
int
rc
;
bakery_lock_get
(
mpidr
,
&
pwrc_lock
);
bakery_lock_get
(
&
pwrc_lock
);
mmio_write_32
(
PWRC_BASE
+
PSYSR_OFF
,
(
unsigned
int
)
mpidr
);
mmio_write_32
(
PWRC_BASE
+
PSYSR_OFF
,
(
unsigned
int
)
mpidr
);
rc
=
mmio_read_32
(
PWRC_BASE
+
PSYSR_OFF
);
rc
=
mmio_read_32
(
PWRC_BASE
+
PSYSR_OFF
);
bakery_lock_release
(
mpidr
,
&
pwrc_lock
);
bakery_lock_release
(
&
pwrc_lock
);
return
rc
;
return
rc
;
}
}
void
fvp_pwrc_write_pponr
(
unsigned
long
mpidr
)
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
);
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
)
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
);
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
)
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
,
mmio_write_32
(
PWRC_BASE
+
PWKUPR_OFF
,
(
unsigned
int
)
(
PWKUPR_WEN
|
mpidr
));
(
unsigned
int
)
(
PWKUPR_WEN
|
mpidr
));
bakery_lock_release
(
mpidr
,
&
pwrc_lock
);
bakery_lock_release
(
&
pwrc_lock
);
}
}
void
fvp_pwrc_clr_wen
(
unsigned
long
mpidr
)
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
,
mmio_write_32
(
PWRC_BASE
+
PWKUPR_OFF
,
(
unsigned
int
)
mpidr
);
(
unsigned
int
)
mpidr
);
bakery_lock_release
(
mpidr
,
&
pwrc_lock
);
bakery_lock_release
(
&
pwrc_lock
);
}
}
void
fvp_pwrc_write_pcoffr
(
unsigned
long
mpidr
)
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
);
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 */
/* Nothing else to do here apart from initializing the lock */
...
...
services/std_svc/psci/psci_common.c
View file @
7eea1352
...
@@ -166,7 +166,7 @@ void psci_acquire_afflvl_locks(unsigned long mpidr,
...
@@ -166,7 +166,7 @@ void psci_acquire_afflvl_locks(unsigned long mpidr,
for
(
level
=
start_afflvl
;
level
<=
end_afflvl
;
level
++
)
{
for
(
level
=
start_afflvl
;
level
<=
end_afflvl
;
level
++
)
{
if
(
mpidr_nodes
[
level
]
==
NULL
)
if
(
mpidr_nodes
[
level
]
==
NULL
)
continue
;
continue
;
bakery_lock_get
(
mpidr
,
&
mpidr_nodes
[
level
]
->
lock
);
bakery_lock_get
(
&
mpidr_nodes
[
level
]
->
lock
);
}
}
}
}
...
@@ -185,7 +185,7 @@ void psci_release_afflvl_locks(unsigned long mpidr,
...
@@ -185,7 +185,7 @@ void psci_release_afflvl_locks(unsigned long mpidr,
for
(
level
=
end_afflvl
;
level
>=
start_afflvl
;
level
--
)
{
for
(
level
=
end_afflvl
;
level
>=
start_afflvl
;
level
--
)
{
if
(
mpidr_nodes
[
level
]
==
NULL
)
if
(
mpidr_nodes
[
level
]
==
NULL
)
continue
;
continue
;
bakery_lock_release
(
mpidr
,
&
mpidr_nodes
[
level
]
->
lock
);
bakery_lock_release
(
&
mpidr_nodes
[
level
]
->
lock
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment