Change in libgfxinit[master]: gma: Use a full `case` statement in Decode_Stolen

Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/libgfxinit/+/44934 ) Change subject: gma: Use a full `case` statement in Decode_Stolen ...................................................................... gma: Use a full `case` statement in Decode_Stolen Hopefully, this will cause a `missing case` warning when adding support for a new platform, instead of silently using the wrong functions. Change-Id: I39f37e931977f4f437b619188436c37752f6b915 Signed-off-by: Angel Pons <th3fanbus@gmail.com> --- M common/hw-gfx-gma.adb 1 file changed, 13 insertions(+), 14 deletions(-) git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/34/44934/1 diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb index 9157bbe..f36470e 100644 --- a/common/hw-gfx-gma.adb +++ b/common/hw-gfx-gma.adb @@ -739,20 +739,19 @@ GGC : Word16; begin Dev.Read16 (GGC, GGC_Reg); - if Config.Gen_G45 or Config.CPU_Ironlake then - GTT_Size := GTT_Size_Gen4 (GGC); - Stolen_Size := Stolen_Size_Gen4 (GGC); - elsif Config.CPU_Sandybridge or Config.CPU_Ivybridge or Config.CPU_Haswell - then - GTT_Size := GTT_Size_Gen6 (GGC); - Stolen_Size := Stolen_Size_Gen6 (GGC); - elsif Config.CPU_Broadwell then - GTT_Size := GTT_Size_Gen8 (GGC); - Stolen_Size := Stolen_Size_Gen8 (GGC); - else - GTT_Size := GTT_Size_Gen8 (GGC); - Stolen_Size := Stolen_Size_Gen9 (GGC); - end if; + + -- Upcasting is necessary to cover all cases + GTT_Size := + (case CPU_Type (Config.CPU) is + when G45 .. Ironlake => GTT_Size_Gen4 (GGC), + when Sandybridge .. Haswell => GTT_Size_Gen6 (GGC), + when Broadwell .. Kabylake => GTT_Size_Gen8 (GGC)); + Stolen_Size := + (case CPU_Type (Config.CPU) is + when G45 .. Ironlake => Stolen_Size_Gen4 (GGC), + when Sandybridge .. Haswell => Stolen_Size_Gen6 (GGC), + when Broadwell => Stolen_Size_Gen8 (GGC), + when Broxton .. Kabylake => Stolen_Size_Gen9 (GGC)); end Decode_Stolen; -- Additional runtime validation that FB fits stolen memory and aperture. -- To view, visit https://review.coreboot.org/c/libgfxinit/+/44934 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: libgfxinit Gerrit-Branch: master Gerrit-Change-Id: I39f37e931977f4f437b619188436c37752f6b915 Gerrit-Change-Number: 44934 Gerrit-PatchSet: 1 Gerrit-Owner: Angel Pons <th3fanbus@gmail.com> Gerrit-MessageType: newchange

Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/libgfxinit/+/44934 ) Change subject: gma: Use a full `case` statement in Decode_Stolen ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://review.coreboot.org/c/libgfxinit/+/44934 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: libgfxinit Gerrit-Branch: master Gerrit-Change-Id: I39f37e931977f4f437b619188436c37752f6b915 Gerrit-Change-Number: 44934 Gerrit-PatchSet: 1 Gerrit-Owner: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Comment-Date: Sun, 06 Sep 2020 10:53:26 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment

Attention is currently required from: Angel Pons. Hello Nico Huber, I'd like you to reexamine a change. Please visit https://review.coreboot.org/c/libgfxinit/+/44934?usp=email to look at the new patch set (#2). Change subject: gma: Use `case` statements in Decode_Stolen ...................................................................... gma: Use `case` statements in Decode_Stolen For the sake of brevity and clarity, handle per-platform differences using `case` statements. Given that the format of the `GGC` register seems to have stabilized, use `others` to handle newer platforms, as the `else` was doing already. Change-Id: I39f37e931977f4f437b619188436c37752f6b915 Signed-off-by: Angel Pons <th3fanbus@gmail.com> --- M common/hw-gfx-gma.adb 1 file changed, 13 insertions(+), 14 deletions(-) git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/34/44934/2 -- To view, visit https://review.coreboot.org/c/libgfxinit/+/44934?usp=email To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: libgfxinit Gerrit-Branch: main Gerrit-Change-Id: I39f37e931977f4f437b619188436c37752f6b915 Gerrit-Change-Number: 44934 Gerrit-PatchSet: 2 Gerrit-Owner: Angel Pons <th3fanbus@gmail.com> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-CC: Paul Menzel <paulepanter@mailbox.org> Gerrit-CC: Stefan Reinauer <stefan.reinauer@coreboot.org> Gerrit-Attention: Angel Pons <th3fanbus@gmail.com> Gerrit-MessageType: newpatchset
participants (2)
-
Angel Pons (Code Review)
-
Nico Huber (Code Review)