Skip to content

Commit

Permalink
firmware/coreboot: Subtree merge libgfxinit
Browse files Browse the repository at this point in the history
Signed-off-by: David Hendricks <dhendricks@fb.com>
  • Loading branch information
dhendrix committed Jun 14, 2018
2 parents 6f4bd2f + 865f1fa commit 6a28b88
Show file tree
Hide file tree
Showing 149 changed files with 20,302 additions and 1 deletion.
1 change: 0 additions & 1 deletion firmware/coreboot/3rdparty/libgfxinit
Submodule libgfxinit deleted from 718c79
5 changes: 5 additions & 0 deletions firmware/coreboot/3rdparty/libgfxinit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/proof-allconfigs/
/build/
/dest/
/*.gpr
/.config
339 changes: 339 additions & 0 deletions firmware/coreboot/3rdparty/libgfxinit/COPYING

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions firmware/coreboot/3rdparty/libgfxinit/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name := gfxinit

ifeq ($(MAKECMDGOALS),gfx_test)
prefixed-name := gfx_test
link-type := program
GFXINIT_TEST := y
endif

gfxinit-deplibs := libhw

libhw-dir ?= ../libhwbase/dest
include $(libhw-dir)/Makefile

gfx_test: $(binary)

.PHONY: gfx_test
3 changes: 3 additions & 0 deletions firmware/coreboot/3rdparty/libgfxinit/Makefile.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
subdirs-y += common

subdirs-$(GFXINIT_TEST) += gfxtest
95 changes: 95 additions & 0 deletions firmware/coreboot/3rdparty/libgfxinit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
libgfxinit
==========

*libgfxinit* is a graphics initialization (aka modesetting) library
for embedded environments. It currently supports only Intel hardware,
more specifically the Intel Core processor line.

It can query and set up most kinds of displays based on their EDID
information. You can, however, also specify particular mode lines.

*libgfxinit* is written in SPARK, an Ada subset with formal verifica-
tion aspects. Absence of runtime errors can be proved automatically
with SPARK GPL 2016.


Building on Linux
=================

Prerequisites
-------------

For compilation, the GNAT Ada compiler is required. Usual package
names in Linux distributions are `gcc-ada` and `gnat`.

Grab the Sources
----------------

You'll need *libhwbase* and *libgfxinit*. Best is to clone the reposi-
tories into a common parent directory (this way *libgfxinit* will know
where to find *libhwbase*).

$ mkdir gfxfun && cd gfxfun
$ git clone https://review.coreboot.org/p/libhwbase.git
$ git clone https://review.coreboot.org/p/libgfxinit.git

Configure and Install libhwbase
-------------------------------

Both libraries are currently configured by hand-written config files.
You can either write your own `.config`, link one of the shipped files
in `configs/`, e.g.:

$ ln -s configs/linux libhwbase/.config

or overwrite the config filename by specifying `cnf=<configfile>` on
the make command line.

By default most debug messages won't be compiled into the binary. To
include them into the build, set `DEBUG=1` on the command line or in
your `.config`.

Let's install *libhwbase*. We'll need `configs/linux` to build regular
Linux executables:

$ cd libhwbase
$ make DEBUG=1 cnf=configs/linux install

By default this installs into a new subdirectory `dest`. You can however
overwrite this decision by specifying `DESTDIR=`.

Build libgfxinit/`gfx_test`
---------------------------

*libgfxinit* is configured and installed in the same manner as de-
scribed above. You will have to select a configuration matching your
hardware.

The makefile knows an additional target `gfx_test` to build a small
Linux test application:

$ cd ../libgfxinit
$ make DEBUG=1 cnf=configs/sandybridge gfx_test

The resulting binary is `build/gfx_test`.


Testing libgfxinit on Linux
===========================

`gfx_test` sets up its own framebuffer in the *stolen memory*. It
backs any current framebuffer mapping and contents up first and re-
stores it before exiting. This works somehow even while the *i915*
driver is running. A wrapper script `gfxtest/gfx_test.sh` is pro-
vided to help with the setup. It switches to a text console first
and tries to unload the *i915* driver. But ignores failures to do
so (it won't work if you still have any application running that
uses the gfx driver, e.g. an X server).

# gfxtest/gfx_test.sh

If you chose the right config above, you should be presented with a
nice test image. But please be prepared that your console might be
stuck in that state afterwards. You can try to run it with *i915*
deactivated then (e.g. when booting with `nomodeset` in the kernel
command line or with *i915* blacklisted) and loading it afterwards.
7 changes: 7 additions & 0 deletions firmware/coreboot/3rdparty/libgfxinit/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
medium DP re-read status if updated bit isn't set
medium DP honor adjust requests also if training succeeded?
unknown DP honor SINK_STATUS after training

low LVDS 8bit colors, data format???

medium gfxtest take care of our own framebuffer mapping
75 changes: 75 additions & 0 deletions firmware/coreboot/3rdparty/libgfxinit/common/Makefile.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
gfxinit-y += hw-gfx-dp_aux_ch.adb
gfxinit-y += hw-gfx-dp_aux_ch.ads
gfxinit-y += hw-gfx-dp_defs.ads
gfxinit-y += hw-gfx-dp_info.adb
gfxinit-y += hw-gfx-dp_info.ads
gfxinit-y += hw-gfx-dp_training.adb
gfxinit-y += hw-gfx-dp_training.ads
gfxinit-y += hw-gfx-edid.adb
gfxinit-y += hw-gfx-edid.ads
gfxinit-y += hw-gfx-gma-config_helpers.adb
gfxinit-y += hw-gfx-gma-config_helpers.ads
gfxinit-y += hw-gfx-gma-connector_info.adb
gfxinit-y += hw-gfx-gma-connector_info.ads
gfxinit-y += hw-gfx-gma-connectors.ads
gfxinit-y += hw-gfx-gma-display_probing.adb
gfxinit-y += hw-gfx-gma-display_probing.ads
gfxinit-y += hw-gfx-gma-dp_aux_ch.ads
gfxinit-y += hw-gfx-gma-dp_aux_request.adb
gfxinit-y += hw-gfx-gma-dp_aux_request.ads
gfxinit-y += hw-gfx-gma-dp_info.ads
gfxinit-y += hw-gfx-gma-i2c.adb
gfxinit-y += hw-gfx-gma-i2c.ads
gfxinit-y += hw-gfx-gma-panel.adb
gfxinit-y += hw-gfx-gma-panel.ads
gfxinit-y += hw-gfx-gma-pch-fdi.adb
gfxinit-y += hw-gfx-gma-pch-fdi.ads
gfxinit-y += hw-gfx-gma-pch-sideband.adb
gfxinit-y += hw-gfx-gma-pch-sideband.ads
gfxinit-y += hw-gfx-gma-pch-transcoder.adb
gfxinit-y += hw-gfx-gma-pch-transcoder.ads
gfxinit-y += hw-gfx-gma-pch-vga.adb
gfxinit-y += hw-gfx-gma-pch-vga.ads
gfxinit-y += hw-gfx-gma-pch.ads
gfxinit-y += hw-gfx-gma-pipe_setup.adb
gfxinit-y += hw-gfx-gma-pipe_setup.ads
gfxinit-y += hw-gfx-gma-port_detect.ads
gfxinit-y += hw-gfx-gma-registers.adb
gfxinit-y += hw-gfx-gma-registers.ads
gfxinit-y += hw-gfx-gma-transcoder.adb
gfxinit-y += hw-gfx-gma-transcoder.ads
gfxinit-y += hw-gfx-gma.adb
gfxinit-y += hw-gfx-gma.ads
gfxinit-y += hw-gfx-i2c.ads
gfxinit-y += hw-gfx.ads
gfxinit-y += hw-gfx-framebuffer_filler.adb
gfxinit-y += hw-gfx-framebuffer_filler.ads

CONFIG_GFX_GMA_CPU := $(call strip_quotes,$(CONFIG_GFX_GMA_CPU))
CONFIG_GFX_GMA_CPU_VARIANT := $(call strip_quotes,$(CONFIG_GFX_GMA_CPU_VARIANT))
CONFIG_GFX_GMA_INTERNAL_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_INTERNAL_PORT))
CONFIG_GFX_GMA_ANALOG_I2C_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_ANALOG_I2C_PORT))

hw-gfx-gma-config-ads := $(subst //,/,$(call src-to-obj,,$(dir)/hw-gfx-gma-config).ads)

$(hw-gfx-gma-config-ads): $(dir)/hw-gfx-gma-config.ads.template $(cnf)
printf " GENERATE $(patsubst /%,%,$(subst $(obj)/,,$@))\n"
sed -e's/<<CPU>>/$(CONFIG_GFX_GMA_CPU)/' \
-e's/<<CPU_VARIANT>>/$(CONFIG_GFX_GMA_CPU_VARIANT)/' \
-e's/<<INTERNAL_PORT>>/$(CONFIG_GFX_GMA_INTERNAL_PORT)/' \
-e's/<<ANALOG_I2C_PORT>>/$(CONFIG_GFX_GMA_ANALOG_I2C_PORT)/' \
-e's/<<DEFAULT_MMIO_BASE>>/$(CONFIG_GFX_GMA_DEFAULT_MMIO)/' \
$< >$@
gfxinit-gen-y += $(hw-gfx-gma-config-ads)

ifneq ($(filter G45,$(CONFIG_GFX_GMA_CPU)),)
subdirs-y += g45
else ifneq ($(filter Ironlake Sandybridge Ivybridge,$(CONFIG_GFX_GMA_CPU)),)
subdirs-y += ironlake
else ifneq ($(filter Haswell Broadwell,$(CONFIG_GFX_GMA_CPU)),)
subdirs-y += haswell_shared haswell
else ifneq ($(filter Broxton,$(CONFIG_GFX_GMA_CPU)),)
subdirs-y += haswell_shared broxton
else ifneq ($(filter Skylake,$(CONFIG_GFX_GMA_CPU)),)
subdirs-y += haswell_shared skylake
endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
gfxinit-y += hw-gfx-gma-connectors-ddi-buffers.ads
gfxinit-y += hw-gfx-gma-ddi_phy.adb
gfxinit-y += hw-gfx-gma-ddi_phy.ads
gfxinit-y += hw-gfx-gma-plls.adb
gfxinit-y += hw-gfx-gma-plls.ads
gfxinit-y += hw-gfx-gma-power_and_clocks.adb
gfxinit-y += hw-gfx-gma-power_and_clocks.ads
gfxinit-y += hw-gfx-gma-spll.ads
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--
-- Copyright (C) 2017 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--

private package HW.GFX.GMA.Connectors.DDI.Buffers
is

procedure Translations (Trans : out Buf_Trans_Array; Port : Digital_Port)
is null;

end HW.GFX.GMA.Connectors.DDI.Buffers;
Loading

0 comments on commit 6a28b88

Please sign in to comment.