drivers/intel/gma: Export Read_EDID() to C

Change-Id: Icf802904c569e621ca3b3105b6107936776c5cee
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31458
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2019-02-18 01:25:58 +01:00
parent 3071c8114a
commit b92c4e3683
5 changed files with 67 additions and 2 deletions

View File

@ -54,6 +54,9 @@ config INTEL_GMA_SWSMISCI
Select this option for Atom-based platforms which use the SWSMISCI Select this option for Atom-based platforms which use the SWSMISCI
register (0xe0) rather than the SWSCI register (0xe8). register (0xe0) rather than the SWSCI register (0xe8).
config INTEL_GMA_LIBGFXINIT_EDID
bool
config GFX_GMA_ANALOG_I2C_HDMI_B config GFX_GMA_ANALOG_I2C_HDMI_B
bool bool
@ -71,7 +74,7 @@ config GFX_GMA
|| SOC_INTEL_BROADWELL || SOC_INTEL_SKYLAKE || SOC_INTEL_APOLLOLAKE \ || SOC_INTEL_BROADWELL || SOC_INTEL_SKYLAKE || SOC_INTEL_APOLLOLAKE \
|| SOC_INTEL_KABYLAKE || SOC_INTEL_COFFEELAKE \ || SOC_INTEL_KABYLAKE || SOC_INTEL_COFFEELAKE \
|| SOC_INTEL_WHISKEYLAKE || SOC_INTEL_WHISKEYLAKE
depends on MAINBOARD_USE_LIBGFXINIT depends on MAINBOARD_USE_LIBGFXINIT || INTEL_GMA_LIBGFXINIT_EDID
select RAMSTAGE_LIBHWBASE select RAMSTAGE_LIBHWBASE
config GFX_GMA_INTERNAL_IS_EDP config GFX_GMA_INTERNAL_IS_EDP

View File

@ -50,7 +50,7 @@ CONFIG_GFX_GMA_DEFAULT_MMIO := 0 # dummy, will be overwritten at runtime
subdirs-y += ../../../../3rdparty/libgfxinit subdirs-y += ../../../../3rdparty/libgfxinit
ramstage-y += gma.ads ramstage-y += gma.ads gma.adb
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-gfx_init.ads ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-gfx_init.ads
ifeq ($(CONFIG_LINEAR_FRAMEBUFFER),y) ifeq ($(CONFIG_LINEAR_FRAMEBUFFER),y)

View File

@ -0,0 +1,37 @@
with HW.GFX.GMA;
with HW.GFX.GMA.Display_Probing;
use HW.GFX.GMA;
package body GMA is
function read_edid
(raw_edid : out HW.GFX.EDID.Raw_EDID_Data;
port : in Interfaces.C.int)
return Interfaces.C.int
is
use type Interfaces.C.int;
success : Boolean := true;
begin
if port not in Active_Port_Type'Pos (Active_Port_Type'First)
.. Active_Port_Type'Pos (Active_Port_Type'Last)
then
raw_edid := (others => 0);
return -2;
else
if not HW.GFX.GMA.Is_Initialized then
HW.GFX.GMA.Initialize (Success => success);
end if;
if success then
HW.GFX.GMA.Display_Probing.Read_EDID
(raw_edid, Active_Port_Type'Val (port), success);
end if;
if success then
return 0;
else
return -1;
end if;
end if;
end read_edid;
end GMA;

View File

@ -1,2 +1,14 @@
with Interfaces.C;
with HW.GFX.EDID;
package GMA is package GMA is
function read_edid
(raw_edid : out HW.GFX.EDID.Raw_EDID_Data;
Port : in Interfaces.C.int)
return Interfaces.C.int
with
Export, Convention => C, External_Name => "gma_read_edid";
end GMA; end GMA;

View File

@ -14,6 +14,19 @@
#ifndef DRIVERS_INTEL_GMA_LIBGFXINIT_H #ifndef DRIVERS_INTEL_GMA_LIBGFXINIT_H
#define DRIVERS_INTEL_GMA_LIBGFXINIT_H #define DRIVERS_INTEL_GMA_LIBGFXINIT_H
enum {
GMA_PORT_DISABLED,
GMA_PORT_INTERNAL,
GMA_PORT_DP1,
GMA_PORT_DP2,
GMA_PORT_DP3,
GMA_PORT_HDMI1, /* or DVI */
GMA_PORT_HDMI2, /* or DVI */
GMA_PORT_HDMI3, /* or DVI */
GMA_PORT_ANALOG,
};
void gma_gfxinit(int *lightup_ok); void gma_gfxinit(int *lightup_ok);
int gma_read_edid(unsigned char edid[], int port);
#endif #endif