summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/intel/gma/Kconfig5
-rw-r--r--src/drivers/intel/gma/Makefile.inc2
-rw-r--r--src/drivers/intel/gma/gma.adb37
-rw-r--r--src/drivers/intel/gma/gma.ads12
-rw-r--r--src/drivers/intel/gma/libgfxinit.h13
5 files changed, 67 insertions, 2 deletions
diff --git a/src/drivers/intel/gma/Kconfig b/src/drivers/intel/gma/Kconfig
index 56c5d43c75..75d268723b 100644
--- a/src/drivers/intel/gma/Kconfig
+++ b/src/drivers/intel/gma/Kconfig
@@ -54,6 +54,9 @@ config INTEL_GMA_SWSMISCI
Select this option for Atom-based platforms which use the SWSMISCI
register (0xe0) rather than the SWSCI register (0xe8).
+config INTEL_GMA_LIBGFXINIT_EDID
+ bool
+
config GFX_GMA_ANALOG_I2C_HDMI_B
bool
@@ -71,7 +74,7 @@ config GFX_GMA
|| SOC_INTEL_BROADWELL || SOC_INTEL_SKYLAKE || SOC_INTEL_APOLLOLAKE \
|| SOC_INTEL_KABYLAKE || SOC_INTEL_COFFEELAKE \
|| SOC_INTEL_WHISKEYLAKE
- depends on MAINBOARD_USE_LIBGFXINIT
+ depends on MAINBOARD_USE_LIBGFXINIT || INTEL_GMA_LIBGFXINIT_EDID
select RAMSTAGE_LIBHWBASE
config GFX_GMA_INTERNAL_IS_EDP
diff --git a/src/drivers/intel/gma/Makefile.inc b/src/drivers/intel/gma/Makefile.inc
index e128ad6474..cea319e976 100644
--- a/src/drivers/intel/gma/Makefile.inc
+++ b/src/drivers/intel/gma/Makefile.inc
@@ -50,7 +50,7 @@ CONFIG_GFX_GMA_DEFAULT_MMIO := 0 # dummy, will be overwritten at runtime
subdirs-y += ../../../../3rdparty/libgfxinit
-ramstage-y += gma.ads
+ramstage-y += gma.ads gma.adb
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-gfx_init.ads
ifeq ($(CONFIG_LINEAR_FRAMEBUFFER),y)
diff --git a/src/drivers/intel/gma/gma.adb b/src/drivers/intel/gma/gma.adb
new file mode 100644
index 0000000000..10885e6e09
--- /dev/null
+++ b/src/drivers/intel/gma/gma.adb
@@ -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;
diff --git a/src/drivers/intel/gma/gma.ads b/src/drivers/intel/gma/gma.ads
index a6ce3a4f77..0b4b66bde7 100644
--- a/src/drivers/intel/gma/gma.ads
+++ b/src/drivers/intel/gma/gma.ads
@@ -1,2 +1,14 @@
+with Interfaces.C;
+
+with HW.GFX.EDID;
+
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;
diff --git a/src/drivers/intel/gma/libgfxinit.h b/src/drivers/intel/gma/libgfxinit.h
index c67870e4e0..c4a8a5b4d2 100644
--- a/src/drivers/intel/gma/libgfxinit.h
+++ b/src/drivers/intel/gma/libgfxinit.h
@@ -14,6 +14,19 @@
#ifndef 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);
+int gma_read_edid(unsigned char edid[], int port);
#endif