Commit Graph

271 Commits

Author SHA1 Message Date
Angel Pons 17cfc92f40 tgl plls: Disable warnings about unused variable
Looks like this is yet-to-be-implemented code. To be able to build-test
other changes, turn off some warnings about the `PLLs` variable.

TEST=Run this and make sure all builds pass:

 for f in configs/*
 do
     make distclean
     make DEBUG=1 cnf=$f -j$(nproc)
 done

Change-Id: I51a14f7a9d6d6d930b9239ed5d0f61c45f2f123b
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/81852
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: Nico Huber <nico.h@gmx.de>
2024-04-23 19:37:56 +00:00
Nico Huber 4b991bf8ae gfxtest: Drop unnecessary with of ancestor
Change-Id: Ibc1a6710a5cd12be9190860635e7b951d4fe4775
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/81521
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2024-04-11 13:18:04 +00:00
Tim Wawrzynczak 4be2e75658 gma: Update transcoder setup for TGL
Tiger Lake requires configuration (but not enablement) of the
transcoder during the modeset sequence itself, so this patch adds a
new Config option to accommodate that and refactors the transcoder
setup into two new procedures.  There should be no functional
differences for other generations.

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Change-Id: I4d7e2a24c54fcd9994f44bb0b10924dce48068e5
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/67493
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2024-02-29 15:11:40 +00:00
Anil Kumar 87469f2ec0 gma config: Add new device IDs for Raptor Lake
References:
RaptorLake External Design Specification Volume 1 (640555)

Change-Id: Icfba8143b306faa85bd4585b11633c8bd01f6f48
Signed-off-by: Anil Kumar <anil.kumar.k@intel.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/77983
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: Nico Huber <nico.h@gmx.de>
2023-09-21 09:21:18 +00:00
Jeremy Compostella e096913f65 connector_info: Fix HDMI/DVI default bytes per color setting
According to the Programming Reference Manual and more specificaly
`TRANS_DDI_FUNC_CTL' register description, a bytes per colors value of
6 (or 10) is not supported by HDMI.

We indeed noticed that if we use a HDMI monitor on the first HDMI port
of a board without eDP, the monitor does not accept the configuration.

This patch ensures that we do not use a default BPC of 6 if the port
is HDMI.

Change-Id: I55e9e63a4da6c6764bae0f1b19132f14fd865cea
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/77227
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2023-08-23 10:47:49 +00:00
Nico Huber a4be8a21b0 Avoid warning '"Pos32" is already use-visible'
Ensures compatibility with GCC 13.

Change-Id: Ic41a20167b88b5952642cc59e80315c5d2fd98b0
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/76491
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2023-08-01 10:03:33 +00:00
Tim Wawrzynczak 732feb414d gma i2c: Update for Tiger Lake
Tiger Lake GMBUS is different only in the pin pairs because it has a
different set of ports.

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: I46248b9c55948aa9bc4c047624c7dc3f62dba766
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/67492
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2023-06-04 12:14:31 +00:00
Tim Wawrzynczak fc49b60f23 gma: Update PCH Rawclk programming for TGL
Tigerlake onwards needs the Rawclk numerator programmed into the
RAWCLK register in addition the fields from to prior generations.

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: Iad36221a44db4128332392bd6610132ea08c0e35
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/67491
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: Nico Huber <nico.h@gmx.de>
2023-06-04 12:12:26 +00:00
Tim Wawrzynczak 1b65b84bc2 gma: Update BDSM register offset for TGL onwards
BDSM moved and is also 64 bits on TGL. If the register indicates that
BSDM is 64-bits, then right now libgfxinit will error out.

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: I0a3e7a92dcb08ea33e08c9f2c5135d4269c9e0b9
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/65178
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2023-05-29 19:23:08 +00:00
Tim Wawrzynczak 79a53797f7 gma pcode: Add Mailbox_Read procedure
Some chipsets may have data that they need to read from the PCode,
with no data in particular necessary, therefore add a `Mailbox_Read`
procedure to do this.

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: Ic8505ef46661c291e6f0787279b32430669f7d14
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/65140
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2023-05-29 19:23:08 +00:00
Tim Wawrzynczak b6df683917 gma registers: Update for Tiger Lake and Alder Lake
Add all of the necessary registers at once, so they do not distract
from the rest of the patches.

Change-Id: I32102b58018b62874d708b31621c3ca8f676ca02
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/70890
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2023-05-29 19:23:08 +00:00
Tim Wawrzynczak 24748f320c dp aux: Add support for TGL
Just new registers for new ports.

Change-Id: I32ea8d31d70574dbe6bb835eb755087a2cae0b1b
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/70891
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Tested-by: Nico Huber <nico.h@gmx.de>
2023-05-29 19:23:08 +00:00
Tim Wawrzynczak e9631d8360 gma: Begin Alder Lake (ADL) integration
Alder Lake uses the same generation of igfx engine as Tiger Lake,
therefore the changes required to support ADL-P are minor. This patch
starts with PCI device detection.

Change-Id: Ia9ab283b388735c4dd01c710251057c12b90b18e
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/70888
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2023-05-29 19:22:30 +00:00
Tim Wawrzynczak 605660bb21 gma: Begin Tiger Lake (TGL) integration
Tiger Lake's integrated graphics engine is built off an entirely new
igfx architecture named "Iris Xe". This patch adds just enough support
to compile for Tiger Lake. Fortunately, the backlight programming
hasn't changed since SKL, so with a little bit of hacking, one can
also have libgfxinit turn on the backlight to verify something is
working and running.

The first pass through the support will focus mostly on the eDP panel,
then Type-C ports (both in fixed/native mode [DP/HDMI] and in Type-C
DP Alt Mode). TBT will not be mostly ignored in this first pass, as
it is not as widely used (yet?) as the other protocols.

This patch includes changes to fix ironlake gnatprove errors caused by
the new PCH_HDMI_A port definition.

Tested on google/voxel, with DEBUG_ADA_CODE enabled.
Tested on google/skolas, with DEBUG_ADA_CODE enabled.

This patch leaves the following unresolved gnatprove errors:
- hw-gfx-gma-port_detect.ads:17:14:
     warning: subprogram "Initialize" has no effect
- hw-gfx-gma-port_detect.ads:20:07:
     warning: unused variable "Port"
- hw-gfx-gma-port_detect.ads:23:14:
     warning: subprogram "Clear_Hotplug_Detect" has no effect
- hw-gfx-gma-connectors.ads:39:14:
     warning: subprogram "Post_Off" has no effect
- hw-gfx-gma-connectors.ads:42:14:
     warning: subprogram "Post_All_Off" has no effect

These errors will by addressed by the proper implementation of these
procedures.

Change-Id: I84f15837856ecc5ec8df18b39d3989885cd550d4
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/70887
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2023-05-29 19:22:30 +00:00
Nico Huber 0dadb674cc gma pch-transcoder: Work around GNAT issue
The combination of the Shift_Left intrinsic and the case expression
somehow makes GNAT crash.

Change-Id: Ibdb3ce4c1699d547999efd89ee6f4ae0f570703c
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/73163
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Tested-by: Nico Huber <nico.h@gmx.de>
2023-02-26 01:33:03 +00:00
Jeremy Compostella fe80fbb74d common: Turn off VGA when not in use anymore
When VGA mode is up on Alder Lake or Raptor Lake devices,
`Update_Outputs' does successfully turn off graphics but it also
leaves some undesirable configuration which can confuse following
graphics drivers such as the PEIM graphics driver.

Experimentally, we have identified that `libgfxinit' should turn off
VGA when it disables the ouput which was using this mode.

BUG=b:264526798
BRANCH=firmware-brya-14505.B
TEST=Developer screen shows up on the recovery flow on skolas

Change-Id: Id39c308a4d0408b996834439186645b33e692d02
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/72123
Reviewed-by: Tarun Tuli <taruntuli@google.com>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Tested-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2023-02-04 23:39:06 +00:00
Nico Huber 793f4f83f1 gma: Correct Global annotation for Initialize()
On G45, we use the private PCI device `Dev` during
Power_And_Clocks.Initialize(). As its `Dev.PCI_State`
is not directly visible in the sub-package, it is
assumed that the whole, abstract `Device_State` can
be altered. This includes `Registers.GTT_State`.

Correcting the `Globals` aspect for G45 makes it
excessive for other platforms, hence we need the
same forest of additional justifications and anno-
tations as we have for Power_Up_VGA().

Change-Id: I7086b024d96f0a17f19f46f60ceac6757eb91867
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/68111
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-12-06 11:53:14 +00:00
Nico Huber 1dff38cd6a gma: Make HW.GFX.GMA.SPLL package private
If it's not private, newer GNATprove versions assume the less
specific `GMA.Device_State` would be used as global input/output.

Change-Id: I8a8258fecc5433510555f9a1165356a769c02be7
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/68110
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-11-28 17:03:45 +00:00
Nico Huber c68cafa3d9 gma skylake: Avoid aliasing of Config.State
SPARK rules forbid us to pass `Config.Raw_Clock` (which is a part
of `Config.State`) as an output to Get_Raw_Clock() as the latter
also depends on `Config.State`. Introduce an intermediate variable
to avoid this.

Change-Id: I721dea522afba9342d92f44aa0fd7708cc079436
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/68109
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-11-28 17:03:36 +00:00
Nico Huber 17b513ed2d gma: Shuffle warning justifications to support old and new tooling
We annotate a check message because the actual behaviour of Power_Up_VGA
depends on the platform we compile for. For the same reason we have to
justify a warning that the annotation may be spurious. SPARK rules state
that the annotation has to directly follow the subprogram's body. Appa-
rently that also accounts for the warning justification, so move it
above the subprogram body.

Change-Id: I8f879e73b3ea43de7e10532fba6a9b2bb9eecfcf
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/68108
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-11-28 17:03:22 +00:00
Nico Huber 3c1ac1884c display probing: Update warning justification
The wording for the unused-assignment warning changed. To support
both older and newer version of GNATprove, add another justification
to the existing one.

Change-Id: I832d40a8e515eff63be2b196b18ca7b6f0114914
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/68107
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-11-28 17:00:24 +00:00
Nico Huber b636d81a98 framebuffer filler: Extend loop invariant to assist prover
Automatically proving that `Linux_Start + Col` is still within
`Width * Height` only worked sporadically. So we let GNATprove
show an intermediate step first to assist it.

Change-Id: I34d5b4d5840fd2b45c4bf3d72abba88487dda2dd
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/68106
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-11-28 17:00:15 +00:00
Nico Huber 420e863442 dp info: Provide Link_Status'Object_Size and padding
We convert a plane byte buffer to a `Link_Status` object via an
`Unchecked_Conversion`. While the situation is actually clear
to the compiler because of the record representation clause for
`Link_Status`, SPARK rules demand an explicit `'Object_Size`.

The `'Object_Size` attribute specifies the exact size the
compiler should allocate for objects of the given type. The
`Padding` field is added to fill the gap left by reserved
bits.

Change-Id: Id7f6b9f50105d9357adcb60fd551b719d9eccd30
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/68105
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-11-28 17:00:03 +00:00
Elyes Haouas 066e52eeaa Fix "unnecessary with of ancestor [-gnatwr]"
These warnings are a bit overeager as some of them only apply once
unnecessary `use type ...` clauses are adapted. So we do both in
one patch. This partially fixes building with GCC 12.

Change-Id: Id7e88fe9a3ef7cb10cbc427a052e21f12578a3fd
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/67833
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-10-04 14:04:23 +00:00
Angel Pons b789e86d64 dp training: Fix `EQ_Delay` function
The DisplayPort v2.0 specification does not mention anything about the
delay being dependent on the link bandwidth.

Change-Id: I18d118ff1bf013175290a1c9fba4d449c7b00cb4
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/67447
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2022-10-04 11:02:33 +00:00
Angel Pons 7769b52d61 hw-gfx-dp_info.adb: Fix reading `Aux_RD_Interval`
Starting with DP v1.4, the definition of DPCD address 0xe was updated
to include a new field. Bit 7 now indicates whether a DP receiver has
an Extended Receiver Capability field, so `Aux_RD_Interval` is now in
bits 6:0. This change is backwards compatible with older hardware, as
the defined values for `Aux_RD_Interval` range from 0 to 4, and bit 7
is always zero.

However, libgfxinit does not make sure the value is valid before using
it in calculations, so the `EQ_Delay` function may return an extremely
large value if bit 7 is set. To avoid this, add some masks to properly
obtain the value for `Aux_RD_Interval`.

Change-Id: If22d8dbc0517daeaa043ede30bf69e7a65ab154b
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/67445
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com>
Tested-by: Nico Huber <nico.h@gmx.de>
2022-10-01 13:53:04 +00:00
Jack Rosenthal f47ec05acb README: Fix hyphenations in markdown
These hyphenations do not show properly once the Markdown is rendered
in (for example) Gitiles.

Change-Id: Ie44b3d4c14215be6cc50692f0063139066751cbf
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/63588
Tested-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2022-05-02 20:18:06 +00:00
Nico Huber 1b04c517b3 sed: Get rid of \+
This also turned out not to be part of POSIX Basic Regular Expressions.

Change-Id: I8d567a53046cd4a557c87b383c5884ebb8e9e774
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/55468
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2021-06-15 09:18:01 +00:00
Nico Huber c47872c656 sed: Get rid of \|
It turned out that \| is not part of POSIX Basic Regular Expressions.
We'll have to explicitly specify individual sed scripts per case, at
least `make` assists us with some repetition.

Change-Id: Ifb24d0d5aa0e2a0a231ce0fc7c5dddc3e28088a5
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/55467
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2021-06-15 09:17:34 +00:00
Nico Huber f20f5fc66e sed: Replace \(...\)\? with \(...\)*
It turned out that \? is not part of POSIX Basic Regular Expressions.
With *, we might match too much, but for the current cases we are good.

Change-Id: Ia99d34c262418949f73340b58af1cf8d5c74f031
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/55466
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2021-06-15 09:16:18 +00:00
Nico Huber ce63df3044 sed: Drop unnecessary, optional match
The line matches no matter if there is a `_Var` suffix or not.

Change-Id: I06e7e1769888b82f2bfbb6897d189b497d833d70
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/55465
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2021-06-15 09:16:10 +00:00
Nico Huber 04f919c030 sed: Replace hack'ish command line with script file
Add `common/delete_dyncpu.sed` that replaces the ugly attempt to
do it inline.

Change-Id: Ief65038ae5e798d18403565d8a7ede3ecb918bb6
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/55464
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2021-06-15 09:16:05 +00:00
Nico Huber 5c1e43a65b dp aux: Handle partially acked multi-byte I2C writes
There is another case when we have to keep querying the I2C status
after starting a write transaction: When some bytes were already acked,
we receive an I2C-ACK for them and the number of bytes ack'ed. So
re-write the loop such that it always continues until one of these
conditions occur:

* We receive an I2C-ACK without additional data: This means
  all remaining bytes have been ack'ed.

* The summed up number of transferred bytes reaches the
  number of written bytes.

* We get an I2C-Defer but have re-tried too often without
  getting additional ACKs.

* We get an I2C-NAK.

Change-Id: I794dc1587f56b81539d1d4796f754644172f89b7
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/52826
Tested-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-06-15 09:05:53 +00:00
Nico Huber 30d897167d gfxtest: Re-arrange debug output to avoid dynamic allocation
Newer compilers seem to allocate space for the concatenated string,
however libhwbase' strict profile doesn't allow it.

Change-Id: Id852f8e72846a0f55518bb1fdf5ea43192f9db9b
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/55426
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-06-13 20:11:44 +00:00
Nico Huber 283e2a3ad2 gma broxton: Move `null` implementation of procedure
Newer compilers say the `Global` annotation of the null procedure is
illegal. However, we need that annotation to have a stable interface
for multiple platforms.

Move the "implementation" into the body file, so we are not bothered
by the compiler a little longer.

Change-Id: I4b6f8a5af64097b394fabe4d9e1a735650615fa8
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/55424
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-06-13 20:11:21 +00:00
Nico Huber 87bd381fdc Revert "gma config: Enable Restrictions (No_Elaboration_Code)"
This reverts commit 8a9062a084.

It was assumed that pragma No_Elaboration_Code would force the compiler
to avoid elaboration code. However, it turns out that it merely checks
what the compiler did.

Newer compiler versions sometimes choose to add elaboration code where
others didn't. So we have to disable the pragma until we find a way to
force compile-time elaboration.

Change-Id: I1b0328c53add53ea713d1ceec3f24b7751363483
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/55423
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-06-13 20:11:11 +00:00
Angel Pons 8d5c24dddd Add support to switch LSPCON modes
LSPCON is a level shifter and protocol converter chip. It is principally
used to convert DisplayPort into HDMI 2.0, since some Intel iGPUs do not
have native HDMI 2.0 support. The chip defaults to LS mode, in which the
display engine has to generate an HDMI-protocol signal, which the LSPCON
converts from DisplayPort signal levels to HDMI signal levels.

Add code to detect LSPCON chips and put them in protocol-converter mode.
This way, the LSPCON behaves like a regular DisplayPort sink. This needs
to be done before any DPCD accesses, because the LSPCON does not respond
to DPCD accesses in level-shifter mode.

Tested on Purism Librem Mini v1 (WHL-U), HDMI port can now light up.

Change-Id: Idfa9bdff47a6591000cd5092d64a4cd4f8dbdc8d
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/51133
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-05-11 12:12:18 +00:00
Angel Pons 0a8174bdf2 gfx dp_aux: Add I2C_{Read,Write}_Byte procedures
These will be used to switch LSPCON modes in subsequent commits.

Change-Id: Ib66b073691282d0c89710b0591484d4123e039b7
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/51122
Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-05-06 19:27:28 +00:00
Angel Pons ae186bdb6a gfx gma skylake: Implement some workarounds
Without these workarounds, gfx_test will leave a WHL-U Librem Mini v1 in
a state where entering low-power states results in a hang. With these
workarounds, the system no longer locks up after running gfx_test. Looks
like the hang does not happen when coreboot runs libgfxinit.

Steps to reproduce the hang:
- Boot Linux without loading i915.
- Run gfx_test without the workarounds.
- After gfx_test exits and the machine enters a low-power state,
  it will lock up.

If something keeps the CPU from getting into low-power states (e.g.
`cat /dev/zero > /dev/null`), the machine will not lock up. However,
stopping the load task after gfx_test has run will result in a lock-up.

Change-Id: I4cd64cf4c1e702dc05709adc345a976a4e3c1ded
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/46635
Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-05-06 19:26:38 +00:00
Nico Huber bc0588e482 gma: Export backlight control interface
Change-Id: I5a157d7849124fd3b4cca8f9de1d605092fd3c5e
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/43668
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-12-21 17:53:57 +00:00
Michael Niewöhner 994971af45 gma: actually enable/disable backlight with new backlight control
In order to enable or disable the backlight on platforms with the new
backlight control, both enable bits in the PWM register and the
PP_CONTROL register need to bet set. Currently, the code only sets one
or the other.

Also, reverse the order in the disable case so that PWM gets disabled
after the backlight enable bit in PP_CONTROL.

Tested successfully on Clevo L141CU (CML).

Change-Id: Ib3827e744e86a9d29e09da3c5fd44d226f0b41b5
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/48770
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-12-21 17:40:35 +00:00
Nico Huber dde0630af4 gma: Add `Cannon_Point` PCH
It almost behaves the same as its predecessors Union and Sunrise
Point. GMBUS pins and panel and backlight controls are updated to
those of Broxton. It also allows an alternative `Raw Clock` of
19.2MHz.

Change-Id: I86fe26a351d2c3c736b6acc85f718fd103d276bb
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/48763
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-12-21 17:40:13 +00:00
Nico Huber e79babd08d gma: Introduce `PCH_Type`
We got this far without it but now there is a PCH (Cannon Point)
that is not fully compatible to its predecessors but works with
the same CPUs. First, introduce the type and make use of it in a
few cases. In a follow-up, we'll add the new PCH.

Change-Id: I9d4965f110da3613749023143cf75123e63ae76e
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/48762
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-12-21 17:39:56 +00:00
Nico Huber c9ad9de6ce gma: Fix setting of `Raw Clock` scratchpad
On some platforms, we determine the `Raw Clock` frequency at runtime.
Make sure that we write the up-to-date value in PCH_RAWCLK_FREQ.

Change-Id: I50c299f6861ef313f2f11d146c4efa7204d53296
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/48761
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
2020-12-21 17:39:47 +00:00
Angel Pons 3318bf2680 Drop generation suffix from `Power_And_Clocks`
There's no need to differentiate between `Power_And_Clocks` packages for
different generations anymore.

Change-Id: Ide297d52959285e93185c84690a343a2679282db
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/43597
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2020-07-19 18:15:36 +00:00
Angel Pons 450c24cbf6 haswell: Make VGA on FDI work
Attempting to light up a 1920x1080 monitor through VGA with libgfxinit
on Haswell would either hang the system or show garbage on the monitor.
This was due to two different problems around FDI initialization code.

The system would only hang if libgfxinit was the first program to light
up a monitor on VGA. This is because no one had performed the required
FDI mPHY initialization that is described on the Haswell graphics PRMs.
Add it to libgfxinit alongside some code to disable bending CLKOUT_DP.

Even with the FDI mPHY initialization in place, the garbage would still
be present on the VGA monitor. Digital interfaces were not affected.
By carefully dumping and comparing the display registers of a good and
a bad case, it was determinted that the fault was due to a mismatched
link width for FDI. The FDI link between the iGPU and the Lynxpoint PCH
can operate in either x1 or x2 width, depending on the bandwidth needs
of the monitor on the PCH's VGA port. To drive a 1920x1080 VGA monitor,
it is necessary to use both FDI lanes. Moreover, both ends of the link
need to be configured to use the same link width. However, the wrong
link width was assumed when configuring the display pipe, because
`DP.Lane_Count` was used unconditionally instead of `FDI.Lane_Count`.

After fixing both issues, gfx_test is able to light up a 1920x1080 VGA
monitor on the Asrock B85M Pro4 successfully, even after a S3 resume.

Change-Id: Ieabe3b7f947be2ef488ddb57bfeae85fa055d360
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/41343
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2020-07-19 18:04:00 +00:00
Angel Pons 3f86b0b121 Move `PSR_Off` out of `Power_And_Clocks_Haswell`
Allowing other platforms to use the Haswell-specific power and clocks
package precludes with'ing other Haswell-specific units unless they are
placed under `haswell_shared` as well. This unnecessarily forces several
implementation-specific details to be public, breaking encapsulation.

The only benefit is that the `PSR_Off` procedure gets to be shared.
However, we can allow reusing said procedure without having to destroy
encapsulation, by moving it elsewhere. As the SRD/PSR registers are tied
to transcoders, place `PSR_Off` and the corresponding definitions to the
common `Transcoder` package. Also update the callers of this procedure
to refer to the `Transcoder` package, and then drop the visibility of
the power and clocks package for Haswell.

Change-Id: I7483409b8b7db58874cbba3c0a7edb1968bba456
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/43563
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2020-07-19 17:38:39 +00:00
Angel Pons c0db994900 common/Makefile.inc: Factor out generation TLAs
The Three Letter Acronyms that correspond to generation names appear
four times inside complex sed-fu. As they are the same, factor them out.

Sanity-checked by building gfxtest for Haswell, whose executable remains
identical regardless of whether this commit is applied or not.

Change-Id: I63cb24d7334359d39aca4682632c3b9b6b698d43
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/42365
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: Nico Huber <nico.h@gmx.de>
2020-07-19 17:38:06 +00:00
Matt DeVillier 8fc8e49a93 common/Makefile.inc: eliminate duplicate substitutions
Several config substitutions are duplicated, move them to a variable and
reference that instead.

Change-Id: Id5d3f33ba87039eb233e5013cc688b76f7e2691b
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/41434
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2020-05-18 16:27:30 +00:00
Matt DeVillier 2a3dbba703 gma config: allow override of presence straps
A handful of boards do not properly implement the presence straps,
leading libgfxinit to fail to detect an attached internal display.
Add an override which can be set by coreboot for affected boards.

Change-Id: Iabf0fac3a8431ffceb81cd583bb05f9c28e8ad64
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/41415
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2020-05-18 16:27:24 +00:00