gma ddi: Move conditionally used Program_Buffer_Translations()
When compiled for Broxton, Buffers.Translations() is a stub and GCC 8
correctly identifies the use of unitialized fields. However, it can't
see that it's never called in that case. Draw the definition of
Program_Buffer_Translations() inside the respective `if` to make that
clear.
Change-Id: I8edbb8ac9249d76465d1cd07526fb6eeef0618e1
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/26305
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Adrian-Ken Rueegsegger <ken@codelabs.ch>
diff --git a/common/haswell_shared/hw-gfx-gma-connectors-ddi.adb b/common/haswell_shared/hw-gfx-gma-connectors-ddi.adb
index b6d7284..88f2b22 100644
--- a/common/haswell_shared/hw-gfx-gma-connectors-ddi.adb
+++ b/common/haswell_shared/hw-gfx-gma-connectors-ddi.adb
@@ -296,29 +296,32 @@
----------------------------------------------------------------------------
- procedure Program_Buffer_Translations (Port : Digital_Port)
- is
- Buffer_Translations : Buf_Trans_Array;
- begin
- Buffers.Translations (Buffer_Translations, Port);
- for I in Buf_Trans_Range loop
- Registers.Write
- (Register => DDI_Regs (Port).BUF_TRANS (I),
- Value => Buffer_Translations (I));
- end loop;
- end Program_Buffer_Translations;
-
procedure Initialize
is
Iboost_Value : constant Word32 := 1;
begin
if Config.Has_DDI_Buffer_Trans then
- for Port in Digital_Port range DIGI_A .. Config.Last_Digital_Port loop
- Program_Buffer_Translations (Port);
- end loop;
- if Config.Is_FDI_Port (Analog) then
- Program_Buffer_Translations (DIGI_E);
- end if;
+ declare
+ procedure Program_Buffer_Translations (Port : Digital_Port)
+ is
+ Buffer_Translations : Buf_Trans_Array;
+ begin
+ Buffers.Translations (Buffer_Translations, Port);
+ for I in Buf_Trans_Range loop
+ Registers.Write
+ (Register => DDI_Regs (Port).BUF_TRANS (I),
+ Value => Buffer_Translations (I));
+ end loop;
+ end Program_Buffer_Translations;
+ begin
+ for Port in Digital_Port range DIGI_A .. Config.Last_Digital_Port
+ loop
+ Program_Buffer_Translations (Port);
+ end loop;
+ if Config.Is_FDI_Port (Analog) then
+ Program_Buffer_Translations (DIGI_E);
+ end if;
+ end;
end if;
if Config.Has_Iboost_Config then