gma skl: Prevent race by late timeout check
We initialize the timeout variable before the first event on the other side (i.e. us sending a request to PCODE). With very slow debug output sending the request itself might take longer than the timeout period. Reorder the code to check the timeout condition only after the first try and thereby make sure that we always try at least twice. Also issue a debug message in case we timed out. Change-Id: I8cdeb3e36d7eafbef8a1a8e13670f3f9838a2f38 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/20647 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
parent
234e772f42
commit
8540805c29
|
@ -283,20 +283,23 @@ package body HW.GFX.GMA.Power_And_Clocks_Skylake is
|
|||
Mask => LCPLL1_CTL_PLL_LOCK);
|
||||
|
||||
CDClk_Change_Timeout := Time.MS_From_Now (3);
|
||||
Timed_Out := False;
|
||||
loop
|
||||
GT_Mailbox_Write
|
||||
(MBox => SKL_PCODE_CDCLK_CONTROL,
|
||||
Value => SKL_CDCLK_PREPARE_FOR_CHANGE);
|
||||
Timed_Out := Time.Timed_Out (CDClk_Change_Timeout);
|
||||
Registers.Read (Registers.GT_MAILBOX_DATA, MBox_Data0);
|
||||
if (MBox_Data0 and SKL_CDCLK_READY_FOR_CHANGE) =
|
||||
SKL_CDCLK_READY_FOR_CHANGE
|
||||
then
|
||||
if (MBox_Data0 and SKL_CDCLK_READY_FOR_CHANGE) /= 0 then
|
||||
-- Ignore timeout if we succeeded anyway.
|
||||
Timed_Out := False;
|
||||
exit;
|
||||
end if;
|
||||
exit when Timed_Out;
|
||||
|
||||
Timed_Out := Time.Timed_Out (CDClk_Change_Timeout);
|
||||
end loop;
|
||||
pragma Debug (Timed_Out, Debug.Put_Line
|
||||
("ERROR: PCODE not ready for frequency change after 3ms."));
|
||||
|
||||
if not Timed_Out then
|
||||
GT_Mailbox_Write
|
||||
|
|
Loading…
Reference in New Issue