Compare commits

...

70 Commits

Author SHA1 Message Date
Tim Crawford
f615ba1c4e
[WIP] ec/system76/ec: Implement USB-C DP HPD
Change-Id: I0487b761a5a83b0a1897c92416d0d81219303341
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-06-13 11:21:27 -06:00
Tim Crawford
3a205fc0bf
mb/system76/adl,rpl: Enable TCSS USB/Display detection
Change-Id: I9d06c1e4e84655cb78175a7b011bbca2e01403a9
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-06-13 11:21:27 -06:00
Tim Crawford
1e9f75af51
[WIP] ec/system76/ec: Implement usbc_get_ops
Change-Id: Icee0661ec0d0c949b73503e639dd8a461c05235a
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-06-13 11:21:27 -06:00
Tim Crawford
d267490a6f
include/device: Add missing headers to usbc_mux.h
Add the headers for using bool and uint8_t.

Change-Id: Ie1a2a482145a7ca02fb306e385538894807a6ad6
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-06-13 11:21:26 -06:00
Sean Rhodes
019baecda0 soc/intel/alderlake: Set UsbTcPortEn based on tcss_port[x]
UsbTcPortEn is configured based on pointers to tcss_usb3_port1,
which is part of the ACPI driver.

This is illogical, as the port might need to be enabled, and
the ACPI not needed or included. Change this so it's configured
based on the tcss_port[x] in devicetree.

Tested by connecting a USB 3.0 hub, and checking that Linux
correctly identifies a new USB 3.0 device.

Change-Id: I07ef0759057f7f40210766a73643c9ccf1dc986d
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2024-06-12 17:22:01 -06:00
Tim Crawford
792996fc8c mb/system76/tgl: Update VBT to version 250
Commit 4c7e97b26a34 ("Update fsp submodule to upstream master branch")
included an update to the VBT from 240 to 250, breaking parsing of
existing VBTs.

Generate blobs for the new version using Intel Display Configuration
Tool (DisCon) v3.3.

Change-Id: I918356d9f660b985ee4408ef77544fbd071ab35f
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-21 14:30:46 -06:00
Jeremy Soller
f65d2abb06 Add lemp13-b
Change-Id: Icc82c47f5e9e6885e9d31878c26d471d06e11c34
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-05-17 08:35:04 -06:00
Jeremy Soller
552e524c1b Add darp10-b 2024-05-07 13:46:26 -06:00
Tim Crawford
49122b0ec5 mb/system76/mtl: Add Darter Pro 10 as a variant
Change-Id: I2325e7ab8efc8e39f679edea0f27ef35ee80bebd
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-07 13:46:26 -06:00
Tim Crawford
8cd1045572 mb/system76/mtl: Fix crashlog
Enable device required for crashlog at it is force enabled in SoC.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-07 13:46:26 -06:00
Tim Crawford
7dbc4052ed soc/intel/mtl: Set HDA subsystem ID during FSP-M
Intel introduced a new UPD for setting the HDA subsystem ID in FSP-M.
Using SiSsidTablePtr in FSP-S no longer works as it will be locked with
a default value of 0 by that point.

Change-Id: I174f9a5faf7e8dbbb370d7a4c3d6e9107fb59123
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-05-07 13:46:26 -06:00
Michał Kopeć
2ff8127cdf include/device/pci_ids.h, soc/intel/mtl: add new MTL-P iGPU DID
Found in a Clevo V560TU with Intel Core Ultra 155H

Change-Id: I0f10808fd0e2d9c122743615fbce656c6d2447cc
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82071
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-05-07 13:46:26 -06:00
Subrata Banik
3a66a8eed9 cpu/intel/microcode: Defer microcode patching until after DRAM init
Follows Intel SoC recommendation to avoid potential cache contention
issues during early (pre-DRAM) microcode loading.

Source: MTL_ARL_Processor_Family_BiosSpec_Rev1p0
Document Number: 729384

BUG=b:330536271
TEST=Able to boot to ChromeOS.

w/o this patch:

[DEBUG]  microcode: sig=0xa06a4 pf=0x80 revision=0x19
[INFO ]  CBFS: Found 'cpu_microcode_a06a4.bin' @0x1d9c0 size 0x21400
    in mcache @0xfef89680
[INFO ]  VB2:vb2_digest_init() 136192 bytes, hash algo 2, HW
    acceleration enabled
[INFO ]  microcode: load microcode patch
[ERROR]  microcode: Update failed

w/ this patch:

[ERROR]  Microcode Error: Early microcode patching is not supported due
    to NEM limitation

Change-Id: I1e433f5bede036800b27900b4b13a399b4f45d6f
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81954
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Eric Lai <ericllai@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-05-07 13:46:26 -06:00
Subrata Banik
d462108ba8 cpu/x86/mtrr: Error out caching limitation during NEM
Improves user experience by highlighting a possibility of runtime
hangs caused by unsupported WB caching during NEM.

Recently we have encountered an issue on Intel platform and came to
know about the NEM logical limitation where due to cache sets are not
in power_on_two running into a runtime hang upon enabling WB caching.

BUG=b:306677879
BRANCH=firmware-rex-15709.B
TEST=Verified boot on google/ovis and google/rex (including Ovis with
non-power-of-two cache configuration).

Change-Id: Ic4fbef1fcc018856420428139683897634c9f85d
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81336
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
2024-05-07 13:46:26 -06:00
Subrata Banik
9dad323baf soc/intel/mtl: Enable RAMTOP caching at SoC level for MTL devices
This patch enables the `SOC_INTEL_COMMON_BASECODE_RAMTOP` configuration
at the SoC level for all MTL devices. This change streamlines the
configuration process, avoiding redundant selections on individual
mainboards.

BUG=b:306677879
BRANCH=firmware-rex-15709.B
TEST=Verified boot functionality on google/ovis and google/rex.

Change-Id: I3aa3a83c190d0a0e93c267222a9dca0ac7651f9c
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81271
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2024-05-07 13:46:26 -06:00
Subrata Banik
4a0c8c4289 soc/intel/cmn/ramtop: Refactor MTRR handling for RAMTOP range
This patch refactors RAMTOP MTRR type selection to address a critical
NEM logic bug on SoCs with non-power-of-two cache sets. This bug can
cause runtime hangs when Write Back (WB) caching is enabled.

Workaround: Force MTRR type to WC (Write Combining) on affected SoCs
when the cache set count is not a power of two.

BUG=b:306677879
BRANCH=firmware-rex-15709.B
TEST=Verified boot on google/ovis and google/rex (including Ovis with
non-power-of-two cache configuration).

Change-Id: Ia9a8f0d37d581b05c19ea7f9b1a07933caa956d4
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81269
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-05-07 13:46:26 -06:00
Subrata Banik
fc17805ba7 arch/x86: Add API to check if cache sets are power-of-two
Introduce a function to determine whether the number of cache sets is
a power of two. This aligns with common cache design practices that
favor power-of-two counts for efficient indexing and addressing.

BUG=b:306677879
BRANCH=firmware-rex-15709.B
TEST=Verified functionality on google/ovis and google/rex (including
a non-power-of-two Ovis configuration).

Change-Id: I819e0d1aeb4c1dbe1cdf3115b2e172588a6e8da5
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81268
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-05-07 13:46:26 -06:00
Jincheng Li
568ef48bda drivers/mrc_cache: Deselect MRC_CACHE_USING_MRC_VERSION by default
EDK2 version binding is irrelevant for MRC_CACHE_USING_MRC_VERSION
as this is SoC FSP choice to enable/disable this feature. So deselect
the option and leave it to SoC codes to enable it depending on needs.

Change-Id: I84fdcfbf3c833a7ccb259a1a1d4be0bcfe291dc3
Signed-off-by: Jincheng Li <jincheng.li@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80693
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-05-07 13:46:26 -06:00
Jincheng Li
65b8b55f44 soc/intel/meteorlake: Select MRC_CACHE_USING_MRC_VERSION
MRC_CACHE_USING_MRC_VERSION is irrelevant to the EDK2 binding version
and should not be enabled under specific version conditions, so select
this at SoC level.

Change-Id: I10594df7c8fdc5cfe9b68975e01ae65859735544
Signed-off-by: Jincheng Li <jincheng.li@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80728
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Ronak Kanabar <ronak.kanabar@intel.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2024-05-07 13:46:26 -06:00
Tim Crawford
6a6f7f8db0 mb/system76: Update CMOS layouts
Use the default position for ramtop and exclude it from the checksum.
Fixes invalid checksum after caching ramtop causing things like
disabling CSME to not work.

Change-Id: Ic7e0cac479e88b0c2645511e5ba4fd9622573a17
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-04-05 13:43:38 -06:00
Jeremy Soller
7114256ba7 lemp13: disable CPU C10 reporting
Change-Id: I6592f6ebdd949783321a3846bb4c44a693916326
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-25 14:30:24 -06:00
Jeremy Soller
30ee8e1e97 lemp13: use SPD size of 1024 bytes
Change-Id: Idd9349188b5d74fe0d389582d56d2ac46d6bd3d0
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-22 10:32:11 -06:00
Jeremy Soller
160f0f97a2 Ensure that full DDR5 SPD is read
Change-Id: I8be865e7a3702245f50fd62479dcc52e67933145
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-22 10:32:11 -06:00
Jeremy Soller
9c1710a9a7 Revert "soc/intel/meteorlake: Disable MRC fast boot"
This reverts commit 22a3cb788d63196302dedf9e271ca5a386835e31.
2024-03-22 10:32:11 -06:00
Jeremy Soller
37241d7fa8 soc/intel/common/block/cse: prevent HECI commands when flash descriptor override is set
Sending the disable and EOP commands will not work if flash descriptor
override is set on meteorlake.

Change-Id: I3b5a56229434c9cc326141d48359faa7759541ee
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-22 10:32:11 -06:00
Jeremy Soller
7beec0babd
soc/intel/meteorlake: increase cbfs and preram cbmem console sizes
These values were taken from alderlake.

Change-Id: Ib790c7d52748156b25bad423ed082c1b51a33550
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-21 11:47:21 -06:00
Jeremy Soller
22a3cb788d
soc/intel/meteorlake: Disable MRC fast boot
MRC fast boot causes issues with memory init reusing invalid values
when DIMMs are switched.

Change-Id: Ia053982f747b2e794b974b84d57a9ead61ddd2ea
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-21 11:47:20 -06:00
Sean Rhodes
b1996b212b
soc/intel/meteorlake: Correctly set Usb4CmMode
The ACPI is adjusted based on SOFTWARE_CONNECTION_MANAGER, so set
the UPD to match this to avoid the connection type being
mismatched.

If it's mismatched, the TBT port will timeout.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: I3ab68c01f682723dab39870f0676e59ae3d89add
2024-03-21 11:47:19 -06:00
Tim Crawford
a176798a16 mb/system76/rpl: oryp12: Disable AER on TBT port
Change-Id: I93f0d7c912684331c9d5fe79a539488e979d5547
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-21 11:11:44 -06:00
Tim Crawford
9bd47b4bed mb/system76/rpl: Add Oryx Pro 12 as a variant
Change-Id: I7c5bee7e188a1fd73ab1d546e941929471227554
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-19 13:38:59 -06:00
Jeremy Soller
bcd34461da Add System76 Lemur Pro (lemp13)
Change-Id: I805cf4929bc69d50237603d40bab6adb6fbdc862
Signed-off-by: Jeremy Soller <jeremy@system76.com>
2024-03-19 13:19:47 -06:00
Jeremy Soller
d876776a6b soc/intel/adl,mtl: Use channel 0 only for memory down in mixed topo
Change-Id: Ic30bec272e82535f6f606033c3ba512662cb2c8b
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-19 13:19:47 -06:00
Jeremy Soller
960bfe9d53 soc/intel/meteorlake: set PortResetMessageEnable appropriately
Change-Id: I61f93f70b882b98e079edf24b1b98cd3b7a7d5ee
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-19 13:19:47 -06:00
Jeremy Soller
d14c9c670d soc/intel/meteorlake: Hook up GMA ACPI brightness controls
Change-Id: I436feba1166c0dedb7b0e89458347e6ca2826ae7
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-19 13:19:47 -06:00
Jeremy Soller
b8bf900ce6 soc/intel/meteorlake: set PchHdaAudioLinkHdaEnable
Change-Id: I6f35339d91ce0897e6ba4ff3c922ad5c94036321
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-19 13:19:47 -06:00
Jeremy Soller
7480a5a34e soc/intel/meteorlake: Expand DDR5 channels like soc/intel/alderlake
Change-Id: Id73ed4603e4c6316c099de1e8dbf8eba0a4e1e1f
Signed-off-by: Jeremy Soller <jackpot51@gmail.com>
2024-03-19 13:19:47 -06:00
Tim Crawford
b37a24f403 drivers/i2c/tas5825m: Use I2C instead of SMBus
The latest Clevo boards connect the TAS5825M to one of the I2C
connections instead of the SMBus connection. The I2C ops are compatible
with SMBus, so always use them.

Change-Id: I5152db647094acf473cc798970dd9d97543df4d7
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-03-07 16:50:31 -07:00
Michał Żygowski
f3ecbaeb3b lib/rtc: Fix off-by-one error in February day count in leap year
The month argument passed to rtc_month_days is 0-based, not 1-based.
This results in the RTC being reverted to the build date constantly
on 29th February 2024.

Change-Id: If451e3e3471fef0d429e255cf297050a525ca1a2
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80790
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Michał Kopeć <michal.kopec@3mdeb.com>
2024-02-29 11:29:10 -07:00
CoolStar
e8df441ef2 soc/intel/tigerlake: Remove IOM Mctp command from TCSS ASL
Port fix from Alder Lake to not set/reset IOM MCTP during
D3 cold entry or exit.

Ports 5008d340033d ("soc/intel/adl: Remove IOM Mctp command from TCSS
ASL"):

> Recently as part of s0ix hang issue, it was found that sending IOM
> MCTP command as part of TCSS D3 Cold enter-exit sequence created an
> issue.

> We discovered that due to change in hardware sequence, ADL should not
> set/reset IOM MCTP during D3 cold entry or exit. This patch removes
> the bit setting from ASL file to prevent hang in the system.

> This patch also removes obsolete Pcode mailbox communication which
> is no longer required for ADL.

> BUG=b:220796339
> BRANCH=firmware-brya-14505.B
> TEST=Check if hang issue is resolved with the CL and no other
> regression
> observed

> https://review.coreboot.org/c/coreboot/+/62861

Test: build/boot drobit to Win11. Verify TCSS XHCI power management
working and USB Root Hub doesn't Code 43 in device manager

Change-Id: I40a537fd2b0c821caf282f52aaff1874f54325f1
Signed-off-by: CoolStar <coolstarorganization@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80719
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-02-29 11:29:10 -07:00
CoolStar
e824c88b95 soc/intel/tigerlake: Fix processor hang while plug unplug of TBT device
Port 9c348a7b7ea3 ("soc/intel/alderlake: Fix processor hang while plug
unplug of TBT device") from Alder Lake to fix a similar issue present
on Tiger Lake:

> Processor hang is observed while hot plug unplug of TBT device. BIOS
> should execute TBT PCIe RP RTD3 flow based on the value of
> TBT_DMA_CFG_VS_CAP_9[30]. It should skip TBT PCIe RP RTD3 flow, if
> BIT30 in TBT FW version is not set.

> BUG=b:194880254

> https://review.coreboot.org/c/coreboot/+/56503

Change-Id: Ie5409111d4239be86c0b153f01b4fe5fc6af352c
Signed-off-by: CoolStar <coolstarorganization@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80718
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-02-29 11:29:10 -07:00
Marx Wang
f7cea308fc soc/intel/adl: Set slp-s0 counter frequency
System sleep time (SLP_S0 signal asserted) is measured in ticks, for
Alder Lake soc in 122us (i.e. ~8197Hz) granularity/ticks.

BUG=b:301854636
TEST=/sys/devices/system/cpu/cpuidle/
low_power_idle_system_residency_us" will show system idle residency time

Change-Id: I449f7ed0d9ef891ae5266e8fd784a063a75e38eb
Signed-off-by: Marx Wang <marx.wang@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80665
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sukumar Ghorai <sukumar.ghorai@intel.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2024-02-29 11:29:10 -07:00
Sean Rhodes
566623f0fc soc/intel/alderlake: Sync UPD Usb4CmMode with Kconfig
The ACPI is adjusted based on SOFTWARE_CONNECTION_MANAGER, so set
the UPD to match this to avoid the connection type being mismatched.

If it's mismatched, the TBT port will time out.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: I8a99db165301ce08caf55aac0e33ca1994559d62
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80486
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2024-02-29 11:29:10 -07:00
Tim Crawford
2c8c5cf25b
mb/system76/rpl: Fix typo
Change-Id: I9e421023dbd8b30af9c968ca5b78d6e7f803f297
Fixes: c70505ff8d97 ("mb/system76/rpl: addw4: Set dynamic boost values")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-28 14:24:15 -07:00
Tim Crawford
c70505ff8d mb/system76/rpl: addw4: Set dynamic boost values
Fixes: 7df47320ec55 ("mb/system76/rpl: Add Adder WS 4 as a variant")
Change-Id: I34f637e5cc0d06908d4fdd317705a4270e69d039
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-28 14:20:59 -07:00
Tim Crawford
7df47320ec mb/system76/rpl: Add Adder WS 4 as a variant
Change-Id: Ic9a886445d6280514d62d953765105087a6e60fb
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-28 11:41:55 -07:00
Tim Crawford
6ab4a7243c
mb/system76/adl,rpl: Fix HDA codec init
Commit 2d482386182e ("soc/intel/alderlake: Set PchHdaSdiEnable for Alder
Lake") hooked up a new UPD, overriding the FSP default and causing HDA
init to break. Hook up the new UPD in the devicetree to restore HDA
functionality.

Also remove PchHdaAudioLinkHdaEnable per board romstage, as it set in
the devicetree.

Change-Id: I2533fa829fac4913308379788911339effa36d9f
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-27 09:23:59 -07:00
Tim Crawford
38c3eda699
drivers/intel/dtbt: Fix build after rebase
Change-Id: I1357f3216dd6a14c3909241ae5bd2b39f271672e
Ref: bfb11bec3b3f ("include/device/device.h: Remove CHIP_NAME() macro")
Ref: 7fcd4d58ec7e ("device/device.h: Rename busses for clarity")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-21 09:54:50 -07:00
Tim Crawford
4a2741633b
drivers/gfx/nvidia: Fix build after rebase
Change-Id: Ie092df13cb50f4f1cfab6157d3e5b4876bd63146
Ref: bfb11bec3b3f ("include/device/device.h: Remove CHIP_NAME() macro")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-21 09:24:22 -07:00
Dan Campbell
60f3d71981 Resolve ACPI BIOS Errors for RPL systems
On Raptor Lake based systems with TCSS, Linux will report ACPI
errors for \_SB.PCI0.TDM0 and \_SB.PCI0.TRP0. This is due to the
tcss.asl file only being included for one specific mainboard. This
change includes tcss.asl for all Raptor Lake models.

Change-Id: I2d8de7a77cfa91cd8bdbb9c3048e21d0a677d2fa
Signed-off-by: Dan Campbell <dan@compiledworks.com>
2024-02-21 08:18:22 -07:00
Tim Crawford
d6d4c5e355 mb/system76/adl,rpl: Add timeouts for PCIe 3.0 RPs
The FSP may fail to detect PCIe 4.0 devices in PCIe 3.0 slots on S3
resume. This issue has only been experienced on lemp12, and only with
Samsung drives, but implies it could happen on other systems or with
other drives as well.

Tested on lemp12 with Samsung 980 PRO and 990 PRO drives.

Change-Id: Ieacab03f6cb0943ed2a589e9bb7669d3d8fd45ae
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 12:41:06 -07:00
Michał Kopeć
5b13dc0f5e
drivers/smmstore/ramstage.c: retry smmstore init up 5 times
Retry calling the SMI 5 times in case the initial write to APM did not
cause SMM entry immediately.

Fixes occasional SMMSTORE initialization failure on Clevo NV4xPZ with
Intel i5-1240P processor. The issue was especially evident when all
logging in coreboot was disabled.

Based on SMMSTORE implementation in MrChromebox's fork of EDK2:
27854bc8c5

Change-Id: I8929af25c4f69873bbdd835fde5cb60fc324b6ab
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
f941def9dd
mb/system76/rpl: darp9: Add SSD RTD3 configs
Some drives block the CPU from reaching C10 on suspend without the RTD3
config.

Fixes suspend with the following drives:

- Kingston KC3000 (SKC3000D/4096G)
- Kingston HyperX (SHPM2280P2H/240G)
- Solidigm P44 Pro (SSDPFKKW010X7)

The following drives continue to work:

- Samsung 970 Evo (MZVLB250HAHQ)
- WD Black SN770 (WDS250G3X0E)
- WD Green SN350 (WDS240G2G0C-00AJM0)
- WD Blue SN570 (WDS100T3B0C)

Change-Id: I205d78377fa2b0db8d37542cdb94ba86ded1d66e
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Tested-by: Levi Portenier <levi@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
b41369176f
mb/system76: Add custom CMOS default for darp8,darp9
Since these boards will use S0ix they need to leave CSME enabled for the
CPU to reach C10.

Change-Id: I70c908402c9964508bb9c439d48d24773f5a35ab
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
e96476dd65
mb/system76: Enable S0ix for darp8/darp9
The newer batch of these boards do not de-assert VW PLTRST# on S3
resume, causes the units to not power on in the EC code. Switch them to
S0ix by default, but leave S3 available.

Change-Id: I95337c1391102db9e020e82bdd938659c1a4f905
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
9113e145db
mb/system76: Enable EC lockdown on TGL+
Change-Id: I4b07846c404eb93ab4baf0a78a4bbffcc5d8afca
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
bb54e49a54
ec/system76: Support lockdown based on EC security state
Change-Id: I202c0607c2cdac1df59f42fb41735704dd5bd95c
Signed-off-by: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
be0dfcd68a
mb/system76: Enable dGPUs
Change-Id: I28fe45afaccd60621f2f2456af14306e18df2657
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Jeremy Soller
ed92a6d587
drivers/gfx/nvidia: Add driver for NVIDIA GPU
Add a driver for laptops with NVIDIA Optimus (hybrid) graphics. The
driver provides ACPI support for dynamically powering on and off the
GPU, NVIDIA Dynamic Boost support, and a function for enabling the GPU
power in romstage.

References:
- DG-09845-001: NVIDIA GN20/QN20 Hardware Design Guide
- DG-09954-001: NVIDIA GN20/QN20 Software Design Guide

Change-Id: I2dec7aa2c8db7994f78a7cc1220502676e248465
Signed-off-by: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
b21bd87af0
soc/intel/alderlake: Add IRQ for non-existent CPU PCIe device
Device 0:01.1 does not exist on ADL-P. I assume this works because the
bridged device has function 1.

Fixes the following error in Linux:

    pcieport 0000:00:01.0: can't derive routing for PCI INT B
    snd_hda_intel 0000:01:00.1: PCI INT B: no GSI - using ISA IRQ 10

Which in turn resolves the conflict with the PCH HDA device...again:

    irq 10: nobody cared (try booting with the "irqpoll" option)
    <snip>
    [<00000000bf549647>] azx_interrupt [snd_hda_codec]
    Disabling IRQ #10

Change-Id: I9d9a0003764a1e031be578c1f406b2a5d7512de7
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
f224ddbc78
mb/system76/bonw14: Enable TAS5825M smart amp
The Bonobo has 2 AMPs: one for the speakers and one for the subwoofer.

Smart AMP data was collected using a logic analyzer connected to the IC
during system start on proprietary firmware. This data is then used to
generate a C file [1].

[1]: https://github.com/system76/smart-amp

Change-Id: I5389a9890563ebd3adb20096b6225f474bc006f9
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
e3033b56fe
mb/system76/rpl: Enable discrete TBT device
The HX board, using PCH-S, use a discrete Thunderbolt device (Intel
Maple Ridge), as opposed to a built-in one like the boards using PCH-P.

Fixes Thunderbolt on RPL-HX boards using the Maple Ridge controller.

Change-Id: I53d18f3ec5a084431e1113782c791bcb42728350
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Jeremy Soller
cfa8635d03
drivers/intel/dtbt: Add discrete Thunderbolt driver
Add a new driver for discrete Thunderbolt controllers. This allows using
Maple Ridge devices on Raptor Point PCH.

Change-Id: Ib78ce43740956fa2c93b9ebddb0eeb319dcc0364
Signed-off-by: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Jeremy Soller
868c102d2f
lib,soc/intel/common/block/smbus: Use a SPD length of 512 bytes for DDR5
Change-Id: I8bdc4c676a0f571fd8f34e078f6a1c73a2e90a87
Signed-off-by: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Jeremy Soller
f6ed8684a5
soc/intel/adl: Fill in SPD data on both channels of DDR5 memory
CB:52731 introduced support for reading SPD from the EEPROM via SMBus.
Replace the now unneeded workaround for DDR5 with filling in the correct
channels for DDR5.

Change-Id: I5a92199a7cd2718e9396f0dac8257df40e4f834c
Signed-off-by: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Meera Ravindranath
920d350c9f
soc/common/smbus: Add support for reading spd data via smbus for DDR5
DDR5 uses a Serial Presence Detect EEPROM with hub function
(SPD5 hub device) to store the spd data.
This CL adds support to read the spd5 hub device via smbus.

BUG=b:180458099
TEST=Boot adlrvp DDR5 board to kernel

Signed-off-by: Meera Ravindranath <meera.ravindranath@intel.com>
Change-Id: Ic5e6c58f255bef86b68ce90a4f853bf4e7c7ccfe
2024-02-20 08:25:25 -07:00
Jeremy Soller
d241bc97c9
soc/intel/alderlake: Hack to preserve SBREG
Change-Id: Ie70905d34a4050aeff4b5cda116eb700f19a18ea
2024-02-20 08:25:25 -07:00
Tim Crawford
70657e373f
security/tpm/tspi: Do TPM Restart if TPM Resume fails
The Infineon SLB 9672 on newer Clevo machines regularly fails TPM Resume
on S3 with the error `TPM_RC_VALUE`.

Per TPM2 spec, handle the failure by performing a TPM Restart.

> The startup behavior defined by this specification is different than
> TPM 1.2 with respect to Startup(STATE). A TPM 1.2 device will enter
> Failure Mode if no state is available when the TPM receives
> Startup(STATE). This is not the case in this specification. It is up
> to the CRTM to take corrective action if it the TPM returns
> TPM_RC_VALUE in response to Startup(STATE).

Fixes the following error from being repeatedly logged in Linux:

> kernel: tpm tpm0: A TPM error (256) occurred attempting get random

Ref: Trusted Platform Module Library, Part 1: Architecture, rev 1.59
Change-Id: I3388007d4448c93bd0dda591c8ca7d1a8dc5306b
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-02-20 08:25:25 -07:00
Jeremy Soller
8d5df37c79
intel/block/pcie/rtd3: Also implement _PR3
Change-Id: Id7f4373989dffe8c3bc68a034f59a94d2160dd15
Signed-off-by: Jeremy Soller <jeremy@system76.com>
2024-02-20 08:25:25 -07:00
Jeremy Soller
ed35db9071
intel/block/pcie/rtd3: ACPI debug messages
Change-Id: Icc4a882ff73f62a134b92f1afb0dc298ea809189
Signed-off-by: Jeremy Soller <jeremy@system76.com>
2024-02-20 08:25:25 -07:00
Tim Crawford
f2182a3f95
submodules: Use absolute paths
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Change-Id: If03415f80a6028e263e76a9e3cc10df0cde5cc3c
2024-02-20 08:25:25 -07:00
224 changed files with 9578 additions and 358 deletions

36
.gitmodules vendored
View File

@ -1,70 +1,70 @@
[submodule "3rdparty/blobs"]
path = 3rdparty/blobs
url = ../blobs.git
url = https://review.coreboot.org/blobs.git
update = none
ignore = dirty
[submodule "util/nvidia-cbootimage"]
path = util/nvidia/cbootimage
url = ../nvidia-cbootimage.git
url = https://review.coreboot.org/nvidia-cbootimage.git
[submodule "vboot"]
path = 3rdparty/vboot
url = ../vboot.git
url = https://review.coreboot.org/vboot.git
branch = main
[submodule "arm-trusted-firmware"]
path = 3rdparty/arm-trusted-firmware
url = ../arm-trusted-firmware.git
url = https://review.coreboot.org/arm-trusted-firmware.git
[submodule "3rdparty/chromeec"]
path = 3rdparty/chromeec
url = ../chrome-ec.git
url = https://review.coreboot.org/chrome-ec.git
[submodule "libhwbase"]
path = 3rdparty/libhwbase
url = ../libhwbase.git
url = https://review.coreboot.org/libhwbase.git
[submodule "libgfxinit"]
path = 3rdparty/libgfxinit
url = ../libgfxinit.git
url = https://review.coreboot.org/libgfxinit.git
[submodule "3rdparty/fsp"]
path = 3rdparty/fsp
url = ../fsp.git
url = https://review.coreboot.org/fsp.git
update = none
ignore = dirty
[submodule "opensbi"]
path = 3rdparty/opensbi
url = ../opensbi.git
url = https://review.coreboot.org/opensbi.git
[submodule "intel-microcode"]
path = 3rdparty/intel-microcode
url = ../intel-microcode.git
url = https://review.coreboot.org/intel-microcode.git
update = none
ignore = dirty
branch = main
[submodule "3rdparty/ffs"]
path = 3rdparty/ffs
url = ../ffs.git
url = https://review.coreboot.org/ffs.git
[submodule "3rdparty/amd_blobs"]
path = 3rdparty/amd_blobs
url = ../amd_blobs
url = https://review.coreboot.org/amd_blobs
update = none
ignore = dirty
[submodule "3rdparty/cmocka"]
path = 3rdparty/cmocka
url = ../cmocka.git
url = https://review.coreboot.org/cmocka.git
update = none
branch = stable-1.1
[submodule "3rdparty/qc_blobs"]
path = 3rdparty/qc_blobs
url = ../qc_blobs.git
url = https://review.coreboot.org/qc_blobs.git
update = none
ignore = dirty
[submodule "3rdparty/intel-sec-tools"]
path = 3rdparty/intel-sec-tools
url = ../9esec-security-tooling.git
url = https://review.coreboot.org/9esec-security-tooling.git
[submodule "3rdparty/stm"]
path = 3rdparty/stm
url = ../STM
url = https://review.coreboot.org/STM
branch = stmpe
[submodule "util/goswid"]
path = util/goswid
url = ../goswid
url = https://review.coreboot.org/goswid.git
branch = trunk
[submodule "src/vendorcode/amd/opensil/genoa_poc/opensil"]
path = src/vendorcode/amd/opensil/genoa_poc/opensil
url = ../opensil_genoa_poc.git
url = https://review.coreboot.org/opensil_genoa_poc.git

View File

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <commonlib/helpers.h>
#include <cpu/cpu.h>
#include <types.h>
@ -234,3 +235,18 @@ bool fill_cpu_cache_info(uint8_t level, struct cpu_cache_info *info)
return true;
}
bool is_cache_sets_power_of_two(void)
{
struct cpu_cache_info info;
if (!fill_cpu_cache_info(CACHE_L3, &info))
return false;
size_t cache_sets = cpu_get_cache_sets(&info);
if (IS_POWER_OF_2(cache_sets))
return true;
return false;
}

View File

@ -329,6 +329,15 @@ uint8_t cpu_get_c_substate_support(const int state);
*/
bool fill_cpu_cache_info(uint8_t level, struct cpu_cache_info *info);
/*
* Determines whether the number of cache sets is a power of two.
*
* Cache designs often favor power-of-two set counts for efficient indexing
* and addressing. This function checks if the provided cache configuration
* adheres to this practice.
*/
bool is_cache_sets_power_of_two(void);
#if CONFIG(RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT)
unsigned int get_reserved_phys_addr_bits(void);
#else

View File

@ -241,6 +241,12 @@ const void *intel_microcode_find(void)
static bool microcode_checked;
static const void *ucode_update;
if (ENV_CACHE_AS_RAM) {
printk(BIOS_ERR, "Microcode Error: Early microcode patching is not supported due"
"to NEM limitation\n");
return NULL;
}
if (microcode_checked)
return ucode_update;

View File

@ -37,6 +37,9 @@ void set_var_mtrr(
/* FIXME: It only support 4G less range */
msr_t basem, maskm;
if (type == MTRR_TYPE_WRBACK && !is_cache_sets_power_of_two() && ENV_CACHE_AS_RAM)
printk(BIOS_ERR, "MTRR Error: Type %x may not be supported due to NEM limitation\n",
type);
if (!IS_POWER_OF_2(size))
printk(BIOS_ERR, "MTRR Error: size %#x is not a power of two\n", size);
if (size < 4 * KiB)

View File

@ -0,0 +1,38 @@
config DRIVERS_GFX_NVIDIA
bool
default n
help
Support for NVIDIA Optimus graphics
config DRIVERS_GFX_NVIDIA_BRIDGE
hex "PCI bridge for the GPU device"
default 0x01
depends on DRIVERS_GFX_NVIDIA
config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST
depends on DRIVERS_GFX_NVIDIA
bool
default n
help
Support for NVIDIA Dynamic Boost
config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_TPP
int "Total processor power offset from default TGP in watts"
default 45
depends on DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST
help
This identifies the available power for the CPU or GPU boost
config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_MIN
int "Minimum TGP offset from default TGP in watts"
default 0
depends on DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST
help
This is used to transfer power from the GPU to the CPU
config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_MAX
int "Maximum TGP offset from default TGP in watts"
default 0
depends on DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST
help
This is used to transfer power from the CPU to the GPU

View File

@ -0,0 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
romstage-$(CONFIG_DRIVERS_GFX_NVIDIA) += romstage.c
ramstage-$(CONFIG_DRIVERS_GFX_NVIDIA) += nvidia.c

View File

@ -0,0 +1,96 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* NVIDIA GC6 on CFL and CML CPU PCIe ports */
// Memory mapped PCI express config space
OperationRegion (PCIC, SystemMemory, CONFIG_ECAM_MMCONF_BASE_ADDRESS + (CONFIG_DRIVERS_GFX_NVIDIA_BRIDGE << 15), 0x1000)
Field (PCIC, ByteAcc, NoLock, Preserve) {
PVID, 16,
PDID, 16,
Offset (0x248),
, 7,
L23E, 1, /* L23_Rdy Entry Request */
L23R, 1, /* L23_Rdy to Detect Transition */
Offset (0xC20),
, 4,
P0AP, 2, /* Additional power savings */
Offset (0xC38),
, 3,
P0RM, 1, /* Robust squelch mechanism */
}
// Enter L23
Method (DL23, 0, Serialized) {
Printf(" GPU PORT DL23 START")
L23E = 1
Sleep (16)
Local0 = 0
While (L23E) {
If ((Local0 > 4)) {
Break
}
Sleep (16)
Local0++
}
P0RM = 1
P0AP = 3
Printf(" GPU PORT DL23 FINISH")
}
// Exit L23
Method (L23D, 0, Serialized) {
Printf(" GPU PORT L23D START")
L23R = 1
Sleep (16)
Local0 = 0
While (L23R) {
If ((Local0 > 4)) {
Break
}
Sleep (16)
Local0++
}
P0RM = 0
P0AP = 0
Printf(" GPU PORT L23D FINISH")
}
// Main power resource
PowerResource (PWRR, 0, 0) {
Name (_STA, 1)
Method (_ON, 0, Serialized) {
Printf("GPU PORT PWRR._ON")
^^DEV0._ON()
_STA = 1
}
Method (_OFF, 0, Serialized) {
Printf("GPU PORT PWRR._OFF")
^^DEV0._OFF()
_STA = 0
}
}
// Power resources for entering D0
Name (_PR0, Package () { PWRR })
// Power resources for entering D3
Name (_PR3, Package () { PWRR })
#include "common/gpu.asl"

View File

@ -0,0 +1,30 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#define NV_ERROR_SUCCESS 0x0
#define NV_ERROR_UNSPECIFIED 0x80000001
#define NV_ERROR_UNSUPPORTED 0x80000002
#include "gps.asl"
#include "nvjt.asl"
Method (_DSM, 4, Serialized) {
Printf("GPU _DSM")
If (Arg0 == ToUUID (JT_DSM_GUID)) {
If (ToInteger(Arg1) >= JT_REVISION_ID_MIN) {
Return (NVJT(Arg2, Arg3))
} Else {
Printf(" Unsupported JT revision: %o", SFST(Arg1))
Return (NV_ERROR_UNSUPPORTED)
}
} ElseIf (Arg0 == ToUUID (GPS_DSM_GUID)) {
If (ToInteger(Arg1) == GPS_REVISION_ID) {
Return (GPS(Arg2, Arg3))
} Else {
Printf(" Unsupported GPS revision: %o", SFST(Arg1))
Return (NV_ERROR_UNSUPPORTED)
}
} Else {
Printf(" Unsupported GUID: %o", IDST(Arg0))
Return (NV_ERROR_UNSPECIFIED)
}
}

View File

@ -0,0 +1,66 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#define GPS_DSM_GUID "A3132D01-8CDA-49BA-A52E-BC9D46DF6B81"
#define GPS_REVISION_ID 0x00000200
#define GPS_FUNC_SUPPORT 0x00000000
#define GPS_FUNC_PSHARESTATUS 0x00000020
#define GPS_FUNC_PSHAREPARAMS 0x0000002A
Method(GPS, 2, Serialized) {
Printf(" GPU GPS")
Switch(ToInteger(Arg0)) {
Case(GPS_FUNC_SUPPORT) {
Printf(" Supported Functions")
Return(ITOB(
(1 << GPS_FUNC_SUPPORT) |
(1 << GPS_FUNC_PSHARESTATUS) |
(1 << GPS_FUNC_PSHAREPARAMS)
))
}
Case(GPS_FUNC_PSHARESTATUS) {
Printf(" Power Share Status")
Return(ITOB(0))
}
Case(GPS_FUNC_PSHAREPARAMS) {
Printf(" Power Share Parameters")
CreateField(Arg1, 0, 4, QTYP) // Query type
Name(GPSP, Buffer(36) { 0x00 })
CreateDWordField(GPSP, 0, RSTS) // Response status
CreateDWordField(GPSP, 4, VERS) // Version
// Set query type of response
RSTS = QTYP
// Set version of response
VERS = 0x00010000
Switch(ToInteger(QTYP)) {
Case(0) {
Printf(" Request Current Information")
// No required information
Return(GPSP)
}
Case(1) {
Printf(" Request Supported Fields")
// Support GPU temperature field
RSTS |= (1 << 8)
Return(GPSP)
}
Case(2) {
Printf(" Request Current Limits")
// No required limits
Return(GPSP)
}
Default {
Printf(" Unknown Query: %o", SFST(QTYP))
Return(NV_ERROR_UNSUPPORTED)
}
}
}
Default {
Printf(" Unsupported function: %o", SFST(Arg0))
Return(NV_ERROR_UNSUPPORTED)
}
}
}

View File

@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0-only */
Device (DEV0) {
Name(_ADR, 0x00000000)
#include "utility.asl"
#include "dsm.asl"
#include "power.asl"
}
#if CONFIG(DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST)
Scope (\_SB) {
Device(NPCF) {
#include "utility.asl"
#include "nvpcf.asl"
}
}
#endif

View File

@ -0,0 +1,152 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#define JT_DSM_GUID "CBECA351-067B-4924-9CBD-B46B00B86F34"
#define JT_REVISION_ID_MIN 0x00000100
#define JT_REVISION_ID_MAX 0x00000200
#define JT_FUNC_SUPPORT 0x00000000
#define JT_FUNC_CAPS 0x00000001
#define JT_FUNC_POWERCONTROL 0x00000003
//TODO: SMI traps and EGIN/XCLM
#define JT_GPC_GSS 0 // Get current GPU GCx sleep status
#define JT_GPC_EGNS 1 // Enter GC6 without self-refresh
#define JT_GPC_EGIS 2 // Enter GC6 with self-refresh
#define JT_GPC_XGXS 3 // Exit GC6 and stop self-refresh
#define JT_GPC_XGIS 4 // Exit GC6 for self-refresh update
#define JT_DFGC_NONE 0 // Handle request immediately
#define JT_DFGC_DEFER 1 // Defer GPC and GPCX
//TODO #define JT_DFGC_CLEAR 2 // Clear pending requests
// Deferred GC6 enter/exit until D3-cold (saved DFGC)
Name(DFEN, 0)
// Deferred GC6 enter control (saved GPC)
Name(DFCI, 0)
// Deferred GC6 exit control (saved GPCX)
Name(DFCO, 0)
Method (NVJT, 2, Serialized) {
Printf(" GPU NVJT")
Switch (ToInteger(Arg0)) {
Case (JT_FUNC_SUPPORT) {
Printf(" Supported Functions")
Return(ITOB(
(1 << JT_FUNC_SUPPORT) |
(1 << JT_FUNC_CAPS) |
(1 << JT_FUNC_POWERCONTROL)
))
}
Case (JT_FUNC_CAPS) {
Printf(" Capabilities")
Return(ITOB(
(1 << 0) | // G-SYNC NSVR power-saving features are enabled
(1 << 1) | // NVSR disabled
(2 << 3) | // Panel power and backlight are on the suspend rail
(0 << 5) | // self-refresh controller remains powered while panel is powered
(0 << 6) | // FB is not on the suspend rail but is powered on in GC6
(0 << 8) | // Combined power rail for all GPUs
(0 << 10) | // External SPI ROM
(1 << 11) | // No SMI handler for kernel panic exit while in GC6
(0 << 12) | // Supports notify on GC6 state done
(1 << 13) | // Support deferred GC6
(1 << 14) | // Support fine-grained root port control
(2 << 15) | // GC6 version is GC6-R
(0 << 17) | // GC6 exit ISR is not supported
(0 << 18) | // GC6 self wakeup not supported
(JT_REVISION_ID_MAX << 20) // Highest revision supported
))
}
Case (JT_FUNC_POWERCONTROL) {
Printf(" Power Control: %o", SFST(Arg1))
CreateField (Arg1, 0, 3, GPC) // GPU power control
CreateField (Arg1, 4, 1, PPC) // Panel power control
CreateField (Arg1, 14, 2, DFGC) // Defer GC6 enter/exit until D3 cold
CreateField (Arg1, 16, 3, GPCX) // Deferred GC6 exit control
// Save deferred GC6 request
If ((ToInteger(GPC) != 0) || (ToInteger(DFGC) != 0)) {
DFEN = DFGC
DFCI = GPC
DFCO = GPCX
}
// Buffer to cache current state
Name (JTBF, Buffer (4) { 0, 0, 0, 0 })
CreateField (JTBF, 0, 3, CGCS) // Current GC state
CreateField (JTBF, 3, 1, CGPS) // Current GPU power status
CreateField (JTBF, 7, 1, CPSS) // Current panel and SRC state (0 when on)
// If doing deferred GC6 request, return now
If (ToInteger(DFGC) != 0) {
CGCS = 1
CGPS = 1
Return (JTBF)
}
// Apply requested state
Switch (ToInteger(GPC)) {
Case (JT_GPC_GSS) {
Printf(" Get current GPU GCx sleep status")
//TODO: include transitions!
If (GTXS(DGPU_RST_N)) {
// GPU powered on
CGCS = 1
CGPS = 1
} ElseIf (GTXS(DGPU_PWR_EN)) {
// GPU powered off, GC6
CGCS = 3
CGPS = 0
} Else {
// GPU powered off, D3 cold
CGCS = 2
CGPS = 0
}
}
Case (JT_GPC_EGNS) {
Printf(" Enter GC6 without self-refresh")
GC6I()
CPSS = 1
}
Case (JT_GPC_EGIS) {
Printf(" Enter GC6 with self-refresh")
GC6I()
If (ToInteger(PPC) == 0) {
CPSS = 0
}
}
Case (JT_GPC_XGXS) {
Printf(" Exit GC6 and stop self-refresh")
GC6O()
CGCS = 1
CGPS = 1
If (ToInteger(PPC) != 0) {
CPSS = 0
}
}
Case (JT_GPC_XGIS) {
Printf(" Exit GC6 for self-refresh update")
GC6O()
CGCS = 1
CGPS = 1
If (ToInteger(PPC) != 0) {
CPSS = 0
}
}
Default {
Printf(" Unsupported GPU power control: %o", SFST(GPC))
}
}
Return (JTBF)
}
Default {
Printf(" Unsupported function: %o", SFST(Arg0))
Return (NV_ERROR_UNSUPPORTED)
}
}
}

View File

@ -0,0 +1,113 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#define NVPCF_DSM_GUID "36b49710-2483-11e7-9598-0800200c9a66"
#define NVPCF_REVISION_ID 0x00000200
#define NVPCF_ERROR_SUCCESS 0x0
#define NVPCF_ERROR_GENERIC 0x80000001
#define NVPCF_ERROR_UNSUPPORTED 0x80000002
#define NVPCF_FUNC_GET_SUPPORTED 0x00000000
#define NVPCF_FUNC_GET_STATIC_CONFIG_TABLES 0x00000001
#define NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS 0x00000002
Name(_HID, "NVDA0820")
Name(_UID, "NPCF")
Method(_DSM, 4, Serialized) {
Printf("NVPCF _DSM")
If (Arg0 == ToUUID(NVPCF_DSM_GUID)) {
If (ToInteger(Arg1) == NVPCF_REVISION_ID) {
Return(NPCF(Arg2, Arg3))
} Else {
Printf(" Unsupported NVPCF revision: %o", SFST(Arg1))
Return(NVPCF_ERROR_GENERIC)
}
} Else {
Printf(" Unsupported GUID: %o", IDST(Arg0))
Return(NVPCF_ERROR_GENERIC)
}
}
Method(NPCF, 2, Serialized) {
Printf(" NVPCF NPCF")
Switch(ToInteger(Arg0)) {
Case(NVPCF_FUNC_GET_SUPPORTED) {
Printf(" Supported Functions")
Return(ITOB(
(1 << NVPCF_FUNC_GET_SUPPORTED) |
(1 << NVPCF_FUNC_GET_STATIC_CONFIG_TABLES) |
(1 << NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS)
))
}
Case(NVPCF_FUNC_GET_STATIC_CONFIG_TABLES) {
Printf(" Get Static Config")
Return(Buffer(14) {
// Device table header
0x20, 0x03, 0x01,
// Intel + NVIDIA
0x00,
// Controller table header
0x23, 0x04, 0x05, 0x01,
// Dynamic boost controller
0x01,
// Supports DC
0x01,
// Reserved
0x00, 0x00, 0x00,
// Checksum
0xAD
})
}
Case(NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS) {
Printf(" Update Dynamic Boost")
CreateField(Arg1, 0x28, 2, ICMD) // Input command
Name(PCFP, Buffer(49) {
// Table version
0x23,
// Table header size
0x05,
// Size of common status in bytes
0x10,
// Size of controller entry in bytes
0x1C,
// Other fields filled in later
})
CreateByteField(PCFP, 0x04, CCNT) // Controller count
CreateWordField(PCFP, 0x19, ATPP) // AC TPP offset
CreateWordField(PCFP, 0x1D, AMXP) // AC maximum TGP offset
CreateWordField(PCFP, 0x21, AMNP) // AC minimum TGP offset
Switch(ToInteger(ICMD)) {
Case(0) {
Printf(" Get Controller Params")
// Number of controllers
CCNT = 1
// AC total processor power offset from default TGP in 1/8 watt units
ATPP = (CONFIG_DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_TPP << 3)
// AC maximum TGP offset from default TGP in 1/8 watt units
AMXP = (CONFIG_DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_MAX << 3)
// AC minimum TGP offset from default TGP in 1/8 watt units
AMNP = (CONFIG_DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_MIN << 3)
Printf("PCFP: %o", SFST(PCFP))
Return(PCFP)
}
Case(1) {
Printf(" Set Controller Status")
//TODO
Printf("PCFP: %o", SFST(PCFP))
Return(PCFP)
}
Default {
Printf(" Unknown Input Command: %o", SFST(ICMD))
Return(NV_ERROR_UNSUPPORTED)
}
}
}
Default {
Printf(" Unsupported function: %o", SFST(Arg0))
Return(NVPCF_ERROR_UNSUPPORTED)
}
}
}

View File

@ -0,0 +1,120 @@
/* SPDX-License-Identifier: GPL-2.0-only */
//TODO: evaluate sleeps
OperationRegion (PCIC, PCI_Config, 0x00, 0xFF)
Field (PCIC, DwordAcc, NoLock, Preserve) {
Offset (0x40),
SSID, 32, // Subsystem vendor and product ID
}
// Enter GC6
Method(GC6I, 0, Serialized) {
Printf(" GPU GC6I START")
// Enter L23
^^DL23()
Sleep(5)
// Put GPU into reset
Printf(" Put GPU into reset")
CTXS(DGPU_RST_N)
Sleep(5)
Printf(" GPU GC6I FINISH")
}
// Exit GC6
Method(GC6O, 0, Serialized) {
Printf(" GPU GC6O START")
// Bring GPU out of reset
Printf(" Bring GPU out of reset")
STXS(DGPU_RST_N)
Sleep(5)
// Exit L23
^^L23D()
Sleep(5)
Printf(" GPU GC6O FINISH")
}
Method (_ON, 0, Serialized) {
Printf(" GPU _ON START")
If (DFEN == JT_DFGC_DEFER) {
Switch (ToInteger(DFCO)) {
Case (JT_GPC_XGXS) {
Printf(" Exit GC6 and stop self-refresh")
GC6O()
}
Default {
Printf(" Unsupported DFCO: %o", SFST(DFCO))
}
}
DFEN = JT_DFGC_NONE
} Else {
Printf(" Standard RTD3 power on")
STXS(DGPU_PWR_EN)
Sleep(5)
GC6O()
}
Printf(" GPU _ON FINISH")
}
Method (_OFF, 0, Serialized) {
Printf(" GPU _OFF START")
If (DFEN == JT_DFGC_DEFER) {
Switch (ToInteger(DFCI)) {
Case (JT_GPC_EGNS) {
Printf(" Enter GC6 without self-refresh")
GC6I()
}
Case (JT_GPC_EGIS) {
Printf(" Enter GC6 with self-refresh")
GC6I()
}
Default {
Printf(" Unsupported DFCI: %o", SFST(DFCI))
}
}
DFEN = JT_DFGC_NONE
} Else {
Printf(" Standard RTD3 power off")
GC6I()
CTXS(DGPU_PWR_EN)
Sleep(5)
}
Printf(" GPU _OFF FINISH")
}
// Main power resource
PowerResource (PWRR, 0, 0) {
Name (_STA, 1)
Method (_ON, 0, Serialized) {
Printf("GPU PWRR._ON")
// Restore SSID
^^SSID = DGPU_SSID
Printf(" Restore SSID: %o", SFST(^^SSID))
_STA = 1
}
Method (_OFF, 0, Serialized) {
Printf("GPU PWRR._OFF")
_STA = 0
}
}
// Power resources for entering D0
Name (_PR0, Package () { PWRR })
// Power resources for entering D3
Name (_PR3, Package () { PWRR })

View File

@ -0,0 +1,63 @@
/* SPDX-License-Identifier: GPL-2.0-only */
// Convert a byte to a hex string, trimming extra parts
Method (BHEX, 1) {
Local0 = ToHexString(Arg0)
Return (Mid(Local0, SizeOf(Local0) - 2, 2))
}
// UUID to string
Method (IDST, 1) {
Local0 = ""
Fprintf(
Local0,
"%o%o%o%o-%o%o-%o%o-%o%o-%o%o%o%o%o%o",
BHEX(DerefOf(Arg0[3])),
BHEX(DerefOf(Arg0[2])),
BHEX(DerefOf(Arg0[1])),
BHEX(DerefOf(Arg0[0])),
BHEX(DerefOf(Arg0[5])),
BHEX(DerefOf(Arg0[4])),
BHEX(DerefOf(Arg0[7])),
BHEX(DerefOf(Arg0[6])),
BHEX(DerefOf(Arg0[8])),
BHEX(DerefOf(Arg0[9])),
BHEX(DerefOf(Arg0[10])),
BHEX(DerefOf(Arg0[11])),
BHEX(DerefOf(Arg0[12])),
BHEX(DerefOf(Arg0[13])),
BHEX(DerefOf(Arg0[14])),
BHEX(DerefOf(Arg0[15]))
)
Return (Local0)
}
// Safe hex conversion, checks type first
Method (SFST, 1) {
Local0 = ObjectType(Arg0)
If (Local0 == 1 || Local0 == 2 || Local0 == 3) {
Return (ToHexString(Arg0))
} Else {
Return (Concatenate("Type: ", Arg0))
}
}
// Convert from 4-byte buffer to 32-bit integer
Method (BTOI, 1) {
Return(
DerefOf(Arg0[0]) |
(DerefOf(Arg0[1]) << 8) |
(DerefOf(Arg0[2]) << 16) |
(DerefOf(Arg0[3]) << 24)
)
}
// Convert from 32-bit integer to 4-byte buffer
Method (ITOB, 1) {
Local0 = Buffer(4) { 0, 0, 0, 0 }
Local0[0] = Arg0 & 0xFF
Local0[1] = (Arg0 >> 8) & 0xFF
Local0[2] = (Arg0 >> 16) & 0xFF
Local0[3] = (Arg0 >> 24) & 0xFF
Return (Local0)
}

View File

@ -0,0 +1,140 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* NVIDIA GC6 on (TGL and ADL) (CPU and PCH) PCIe ports */
// Port mapped PCI express config space
OperationRegion (PCIC, PCI_Config, 0x00, 0xFF)
Field (PCIC, AnyAcc, NoLock, Preserve) {
Offset(0x52), /* LSTS - Link Status Register */
, 13,
LASX, 1, /* 0, Link Active Status */
Offset(0x60), /* RSTS - Root Status Register */
, 16,
PSPX, 1, /* 16, PME Status */
Offset(0xD8), /* 0xD8, MPC - Miscellaneous Port Configuration Register */
, 30,
HPEX, 1, /* 30, Hot Plug SCI Enable */
PMEX, 1, /* 31, Power Management SCI Enable */
Offset (0xE0), /* 0xE0, SPR - Scratch Pad Register */
SCB0, 1, /* Scratch bit 0 */
Offset(0xE2), /* 0xE2, RPPGEN - Root Port Power Gating Enable */
, 2,
L23E, 1, /* 2, L23_Rdy Entry Request (L23ER) */
L23R, 1, /* 3, L23_Rdy to Detect Transition (L23R2DT) */
}
Field (PCIC, AnyAcc, NoLock, WriteAsZeros) {
Offset(0xDC), /* 0xDC, SMSCS - SMI/SCI Status Register */
, 30,
HPSX, 1, /* 30, Hot Plug SCI Status */
PMSX, 1 /* 31, Power Management SCI Status */
}
// Enter L23
Method (DL23, 0, Serialized) {
Printf(" GPU PORT DL23 START")
L23E = 1
Sleep (16)
Local0 = 0
While (L23E) {
If ((Local0 > 4)) {
Break
}
Sleep (16)
Local0++
}
SCB0 = 1
Printf(" GPU PORT DL23 FINISH")
}
// Exit L23
Method (L23D, 0, Serialized) {
Printf(" GPU PORT L23D START")
If ((SCB0 == 1)) {
L23R = 1
Local0 = 0
While (L23R) {
If ((Local0 > 4)) {
Break
}
Sleep (16)
Local0++
}
SCB0 = 0
Local0 = 0
While ((LASX == 0)) {
If ((Local0 > 8)) {
Break
}
Sleep (16)
Local0++
}
}
Printf(" GPU PORT L23D FINISH")
}
Method (HPME, 0, Serialized) {
Printf(" GPU PORT HPME START")
If (PMSX == 1) {
Printf(" Notify GPU driver of PME SCI")
Notify(DEV0, 0x2)
Printf(" Clear PME SCI")
PMSX = 1
Printf(" Consume PME notification")
PSPX = 1
}
Printf(" GPU PORT HPME FINISH")
}
// Main power resource
PowerResource (PWRR, 0, 0) {
Name (_STA, 1)
Method (_ON, 0, Serialized) {
Printf("GPU PORT PWRR._ON")
HPME();
If (PMEX == 1) {
Printf(" Disable power management SCI")
PMEX = 0
}
^^DEV0._ON()
_STA = 1
}
Method (_OFF, 0, Serialized) {
Printf("GPU PORT PWRR._OFF")
^^DEV0._OFF()
If (PMEX == 0) {
Printf(" Enable power management SCI")
PMEX = 1
HPME()
}
_STA = 0
}
}
// Power resources for entering D0
Name (_PR0, Package () { PWRR })
// Power resources for entering D3
Name (_PR3, Package () { PWRR })
#include "common/gpu.asl"

View File

@ -0,0 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _DRIVERS_GFX_NVIDIA_CHIP_H_
#define _DRIVERS_GFX_NVIDIA_CHIP_H_
struct drivers_gfx_nvidia_config {
/* TODO: Set GPIOs in devicetree? */
};
#endif /* _DRIVERS_GFX_NVIDIA_CHIP_H_ */

View File

@ -0,0 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _DRIVERS_GFX_NVIDIA_GPU_H_
#define _DRIVERS_GFX_NVIDIA_GPU_H_
#include <stdbool.h>
struct nvidia_gpu_config {
/* GPIO for GPU_PWR_EN */
unsigned int power_gpio;
/* GPIO for GPU_RST# */
unsigned int reset_gpio;
/* Enable or disable GPU power */
bool enable;
};
void nvidia_set_power(const struct nvidia_gpu_config *config);
#endif /* _DRIVERS_NVIDIA_GPU_H_ */

View File

@ -0,0 +1,71 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include "chip.h"
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#define NVIDIA_SUBSYSTEM_ID_OFFSET 0x40
static void nvidia_read_resources(struct device *dev)
{
printk(BIOS_DEBUG, "%s: %s\n", __func__, dev_path(dev));
pci_dev_read_resources(dev);
// Find all BARs on GPU, mark them above 4g if prefetchable
for (int bar = PCI_BASE_ADDRESS_0; bar <= PCI_BASE_ADDRESS_5; bar += 4) {
struct resource *res = probe_resource(dev, bar);
if (res) {
if (res->flags & IORESOURCE_PREFETCH) {
printk(BIOS_INFO, " BAR at 0x%02x marked above 4g\n", bar);
res->flags |= IORESOURCE_ABOVE_4G;
} else {
printk(BIOS_DEBUG, " BAR at 0x%02x not prefetch\n", bar);
}
} else {
printk(BIOS_DEBUG, " BAR at 0x%02x not found\n", bar);
}
}
}
static void nvidia_set_subsystem(struct device *dev, unsigned int vendor, unsigned int device)
{
pci_write_config32(dev, NVIDIA_SUBSYSTEM_ID_OFFSET,
((device & 0xffff) << 16) | (vendor & 0xffff));
}
static struct pci_operations nvidia_device_ops_pci = {
.set_subsystem = nvidia_set_subsystem,
};
static struct device_operations nvidia_device_ops = {
.read_resources = nvidia_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
#if CONFIG(HAVE_ACPI_TABLES)
.write_acpi_tables = pci_rom_write_acpi_tables,
.acpi_fill_ssdt = pci_rom_ssdt,
#endif
.init = pci_dev_init,
.ops_pci = &nvidia_device_ops_pci,
};
static void nvidia_enable(struct device *dev)
{
if (!is_dev_enabled(dev) || dev->path.type != DEVICE_PATH_PCI)
return;
if (pci_read_config16(dev, PCI_VENDOR_ID) != PCI_VID_NVIDIA)
return;
dev->ops = &nvidia_device_ops;
}
struct chip_operations drivers_gfx_nvidia_ops = {
.name = "NVIDIA Optimus Graphics Device",
.enable_dev = nvidia_enable
};

View File

@ -0,0 +1,33 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
#include <device/pci.h>
#include <gpio.h>
#include "chip.h"
#include "gpu.h"
void nvidia_set_power(const struct nvidia_gpu_config *config)
{
if (!config->power_gpio || !config->reset_gpio) {
printk(BIOS_ERR, "%s: GPU_PWR_EN and GPU_RST# must be set\n", __func__);
return;
}
printk(BIOS_DEBUG, "%s: GPU_PWR_EN = %d\n", __func__, config->power_gpio);
printk(BIOS_DEBUG, "%s: GPU_RST# = %d\n", __func__, config->reset_gpio);
gpio_set(config->reset_gpio, 0);
mdelay(10);
if (config->enable) {
gpio_set(config->power_gpio, 1);
mdelay(25);
gpio_set(config->reset_gpio, 1);
} else {
gpio_set(config->power_gpio, 0);
}
mdelay(10);
}

View File

@ -1,23 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
#include <device/smbus.h>
#include <device/pci.h>
#include <device/i2c_bus.h>
#include "chip.h"
#include "tas5825m.h"
int tas5825m_write_at(struct device *dev, uint8_t addr, uint8_t value)
{
return smbus_write_byte(dev, addr, value);
return i2c_dev_writeb_at(dev, addr, value);
}
//TODO: use I2C block write for better performance
int tas5825m_write_block_at(struct device *dev, uint8_t addr,
const uint8_t *values, uint8_t length)
{
// TODO: use I2C block write for better performance; SMBus does not
// have `transfer` op for it.
int res = 0;
for (uint8_t i = 0; i < length; i++) {
res = smbus_write_byte(dev, addr + i, values[i]);
res = i2c_dev_writeb_at(dev, addr + i, values[i]);
if (res < 0)
return res;
}
@ -45,8 +46,7 @@ __weak int tas5825m_setup(struct device *dev, int id)
static void tas5825m_init(struct device *dev)
{
if (dev->enabled && dev->path.type == DEVICE_PATH_I2C &&
ops_smbus_bus(get_pbus_smbus(dev))) {
if (dev->enabled && dev->path.type == DEVICE_PATH_I2C && i2c_link(dev)) {
printk(BIOS_DEBUG, "tas5825m at %s\n", dev_path(dev));
struct drivers_i2c_tas5825m_config *config = dev->chip_info;

View File

@ -0,0 +1,5 @@
config DRIVERS_INTEL_DTBT
bool
default n
help
Support for discrete Thunderbolt controllers

View File

@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
ramstage-$(CONFIG_DRIVERS_INTEL_DTBT) += dtbt.c

View File

@ -0,0 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _DRIVERS_INTEL_DTBT_CHIP_H_
#define _DRIVERS_INTEL_DTBT_CHIP_H_
struct drivers_intel_dtbt_config {};
#endif /* _DRIVERS_INTEL_DTBT_CHIP_H_ */

View File

@ -0,0 +1,214 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include "chip.h"
#include <acpi/acpigen.h>
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pciexp.h>
#include <device/pci_ids.h>
#define PCIE2TBT 0x54C
#define PCIE2TBT_GO2SX ((0x02 << 1) | 1)
#define PCIE2TBT_GO2SX_NO_WAKE ((0x03 << 1) | 1)
#define PCIE2TBT_SX_EXIT_TBT_CONNECTED ((0x04 << 1) | 1)
#define PCIE2TBT_SX_EXIT_NO_TBT_CONNECTED ((0x05 << 1) | 1)
#define PCIE2TBT_SET_SECURITY_LEVEL ((0x08 << 1) | 1)
#define PCIE2TBT_GET_SECURITY_LEVEL ((0x09 << 1) | 1)
#define PCIE2TBT_BOOT_ON ((0x18 << 1) | 1)
#define TBT2PCIE 0x548
static void dtbt_cmd(struct device *dev, u32 command)
{
printk(BIOS_DEBUG, "DTBT send command %08x\n", command);
pci_write_config32(dev, PCIE2TBT, command);
u32 timeout;
u32 status;
for (timeout = 1000000; timeout > 0; timeout--) {
status = pci_read_config32(dev, TBT2PCIE);
if (status & 1) {
break;
}
udelay(1);
}
if (timeout == 0) {
printk(BIOS_ERR, "DTBT command %08x timeout on status %08x\n", command, status);
}
printk(BIOS_DEBUG, "DTBT command %08x status %08x\n", command, status);
pci_write_config32(dev, PCIE2TBT, 0);
u32 status_clear;
for (timeout = 1000000; timeout > 0; timeout--) {
status_clear = pci_read_config32(dev, TBT2PCIE);
if (!(status_clear & 1)) {
break;
}
udelay(1);
}
if (timeout == 0) {
printk(BIOS_ERR, "DTBT command %08x timeout on status clear %08x\n", command, status_clear);
}
}
static void dtbt_fill_ssdt(const struct device *dev)
{
printk(BIOS_DEBUG, "DTBT fill SSDT\n");
if (!dev) {
printk(BIOS_ERR, "DTBT device invalid\n");
}
printk(BIOS_DEBUG, " Dev %s\n", dev_path(dev));
struct bus *bus = dev->upstream;
if (!bus) {
printk(BIOS_ERR, "DTBT bus invalid\n");
}
struct device *parent = bus->dev;
if (!parent || parent->path.type != DEVICE_PATH_PCI) {
printk(BIOS_ERR, "DTBT parent invalid\n");
return;
}
printk(BIOS_DEBUG, " Parent %s\n", dev_path(parent));
const char *parent_scope = acpi_device_path(parent);
if (!parent_scope) {
printk(BIOS_ERR, "DTBT parent scope not valid\n");
return;
}
{ /* Scope */
printk(BIOS_DEBUG, " Scope %s\n", parent_scope);
acpigen_write_scope(parent_scope);
struct acpi_dp *dsd = acpi_dp_new_table("_DSD");
/* Indicate that device supports hotplug in D3. */
acpi_device_add_hotplug_support_in_d3(dsd);
/* Indicate that port is external. */
acpi_device_add_external_facing_port(dsd);
acpi_dp_write(dsd);
{ /* Device */
const char *dev_name = acpi_device_name(dev);
printk(BIOS_DEBUG, " Device %s\n", dev_name);
acpigen_write_device(dev_name);
acpigen_write_name_integer("_ADR", 0);
uintptr_t mmconf_base = (uintptr_t)CONFIG_ECAM_MMCONF_BASE_ADDRESS
+ (((uintptr_t)(bus->secondary)) << 20);
printk(BIOS_DEBUG, " MMCONF base %08lx\n", mmconf_base);
const struct opregion opregion = OPREGION("PXCS", SYSTEMMEMORY, mmconf_base, 0x1000);
const struct fieldlist fieldlist[] = {
FIELDLIST_OFFSET(TBT2PCIE),
FIELDLIST_NAMESTR("TB2P", 32),
FIELDLIST_OFFSET(PCIE2TBT),
FIELDLIST_NAMESTR("P2TB", 32),
};
acpigen_write_opregion(&opregion);
acpigen_write_field("PXCS", fieldlist, ARRAY_SIZE(fieldlist),
FIELD_DWORDACC | FIELD_NOLOCK | FIELD_PRESERVE);
{ /* Method */
acpigen_write_method_serialized("PTS", 0);
acpigen_write_debug_string("DTBT prepare to sleep");
acpigen_write_store_int_to_namestr(PCIE2TBT_GO2SX_NO_WAKE, "P2TB");
acpigen_write_delay_until_namestr_int(600, "TB2P", PCIE2TBT_GO2SX_NO_WAKE);
acpigen_write_debug_namestr("TB2P");
acpigen_write_store_int_to_namestr(0, "P2TB");
acpigen_write_delay_until_namestr_int(600, "TB2P", 0);
acpigen_write_debug_namestr("TB2P");
acpigen_write_method_end();
}
acpigen_write_device_end();
}
acpigen_write_scope_end();
}
{ /* Scope */
acpigen_write_scope("\\");
{ /* Method */
acpigen_write_method("TBTS", 0);
acpigen_emit_namestring(acpi_device_path_join(dev, "PTS"));
acpigen_write_method_end();
}
acpigen_write_scope_end();
}
}
static const char *dtbt_acpi_name(const struct device *dev)
{
return "DTBT";
}
static struct pci_operations dtbt_device_ops_pci = {
.set_subsystem = 0,
};
static struct device_operations dtbt_device_ops = {
.read_resources = pci_bus_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_bus_enable_resources,
.acpi_fill_ssdt = dtbt_fill_ssdt,
.acpi_name = dtbt_acpi_name,
.scan_bus = pciexp_scan_bridge,
.reset_bus = pci_bus_reset,
.ops_pci = &dtbt_device_ops_pci,
};
static void dtbt_enable(struct device *dev)
{
if (!is_dev_enabled(dev) || dev->path.type != DEVICE_PATH_PCI)
return;
if (pci_read_config16(dev, PCI_VENDOR_ID) != PCI_VID_INTEL)
return;
// TODO: check device ID
dev->ops = &dtbt_device_ops;
printk(BIOS_INFO, "DTBT controller found at %s\n", dev_path(dev));
printk(BIOS_DEBUG, "DTBT get security level\n");
dtbt_cmd(dev, PCIE2TBT_GET_SECURITY_LEVEL);
printk(BIOS_DEBUG, "DTBT set security level SL0\n");
dtbt_cmd(dev, PCIE2TBT_SET_SECURITY_LEVEL);
printk(BIOS_DEBUG, "DTBT get security level\n");
dtbt_cmd(dev, PCIE2TBT_GET_SECURITY_LEVEL);
if (acpi_is_wakeup_s3()) {
printk(BIOS_INFO, "DTBT SX exit\n");
dtbt_cmd(dev, PCIE2TBT_SX_EXIT_TBT_CONNECTED);
} else {
printk(BIOS_INFO, "DTBT boot on\n");
dtbt_cmd(dev, PCIE2TBT_BOOT_ON);
}
}
struct chip_operations drivers_intel_dtbt_ops = {
.name = "Intel Discrete Thunderbolt Device",
.enable_dev = dtbt_enable
};

View File

@ -56,14 +56,12 @@ config MRC_SAVE_HASH_IN_TPM
config MRC_CACHE_USING_MRC_VERSION
bool
default y if UDK_VERSION >= 202302
default n
help
Use the MRC version info from FSP extended header to store the MRC cache data.
This method relies on the FSP_PRODUCER_DATA_TABLES belongs to the
`FspProducerDataHeader.h`file to get the MRC version.
Intel FSP built with EDK2 version 202302 onwards has support to retrieve the
MRC version by directly parsing the binary.
Supported platform can retrieve the MRC version by directly parsing the binary.
endif # CACHE_MRC_SETTINGS

View File

@ -9,6 +9,7 @@
#include <smmstore.h>
#include <types.h>
#include <cbmem.h>
#include <delay.h>
static struct smmstore_params_info info;
@ -39,6 +40,7 @@ static void init_store(void *unused)
{
struct smmstore_params_init args;
uint32_t ret = ~0;
uint8_t retry = 5;
if (smmstore_get_info(&info) < 0) {
printk(BIOS_INFO, "SMMSTORE: Failed to get meta data\n");
@ -56,8 +58,17 @@ static void init_store(void *unused)
printk(BIOS_INFO, "SMMSTORE: Setting up SMI handler\n");
/* Issue SMI using APM to update the com buffer and to lock the SMMSTORE */
ret = call_smm(APM_CNT_SMMSTORE, SMMSTORE_CMD_INIT, &args);
/*
* Issue SMI using APM to update the com buffer and to lock the SMMSTORE.
* Retry 5 times in case the SMI isn't triggered immediately.
*/
do {
ret = call_smm(APM_CNT_SMMSTORE, SMMSTORE_CMD_INIT, &args);
if (ret == SMMSTORE_RET_SUCCESS)
break;
mdelay(1);
} while (retry--);
if (ret != SMMSTORE_RET_SUCCESS) {
printk(BIOS_ERR, "SMMSTORE: Failed to install com buffer\n");

View File

@ -15,6 +15,11 @@ config EC_SYSTEM76_EC_DGPU
bool
default n
config EC_SYSTEM76_EC_LOCKDOWN
depends on EC_SYSTEM76_EC
bool
default n
config EC_SYSTEM76_EC_OLED
depends on EC_SYSTEM76_EC
bool

View File

@ -4,6 +4,8 @@ ifeq ($(CONFIG_EC_SYSTEM76_EC),y)
all-y += system76_ec.c
ramstage-y += smbios.c
ramstage-$(CONFIG_EC_SYSTEM76_EC_LOCKDOWN) += lockdown.c
ramstage-y += usbc_mux.c
smm-$(CONFIG_DEBUG_SMI) += system76_ec.c

View File

@ -0,0 +1,59 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include "system76_ec.h"
#include <bootstate.h>
#include <commonlib/region.h>
#include <fmap.h>
#include <spi_flash.h>
static int protect_region_by_name(const char *name)
{
int res;
struct region region;
res = fmap_locate_area(name, &region);
if (res < 0) {
printk(BIOS_ERR, "fmap_locate_area '%s' failed: %d\n", name, res);
return res;
}
res = spi_flash_ctrlr_protect_region(
boot_device_spi_flash(),
&region,
WRITE_PROTECT
);
if (res < 0) {
printk(BIOS_ERR, "spi_flash_ctrlr_protect_region '%s' failed: %d\n", name, res);
return res;
}
printk(BIOS_INFO, "protected '%s'\n", name);
return 0;
}
static void lock(void *unused)
{
uint8_t state = SYSTEM76_EC_SECURITY_STATE_UNLOCK;
if (!system76_ec_security_get(&state)) {
printk(BIOS_INFO, "failed to get security state, assuming unlocked\n");
state = SYSTEM76_EC_SECURITY_STATE_UNLOCK;
}
printk(BIOS_INFO, "security state: %d\n", state);
if (state != SYSTEM76_EC_SECURITY_STATE_UNLOCK) {
// Protect WP_RO region, which should contain FMAP and COREBOOT
protect_region_by_name("WP_RO");
// Protect RW_MRC_CACHE region, this must be done after it is written
protect_region_by_name("RW_MRC_CACHE");
//TODO: protect entire flash except when in SMM?
}
}
/*
* Keep in sync with mrc_cache.c
*/
#if CONFIG(MRC_WRITE_NV_LATE)
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME_CHECK, BS_ON_EXIT, lock, NULL);
#else
BOOT_STATE_INIT_ENTRY(BS_DEV_RESOURCES, BS_ON_ENTRY, lock, NULL);
#endif

View File

@ -26,6 +26,9 @@
#define CMD_PRINT_REG_LEN 3
#define CMD_PRINT_REG_DATA 4
// Get security state command
#define CMD_SECURITY_GET 20
static inline uint8_t system76_ec_read(uint8_t addr)
{
return inb(SYSTEM76_EC_BASE + (uint16_t)addr);
@ -110,3 +113,9 @@ bool system76_ec_cmd(uint8_t cmd, const uint8_t *request_data,
return ret;
}
bool system76_ec_security_get(uint8_t *state)
{
*state = SYSTEM76_EC_SECURITY_STATE_LOCK;
return system76_ec_cmd(CMD_SECURITY_GET, NULL, 0, state, sizeof(*state));
}

View File

@ -6,6 +6,15 @@
#include <stdbool.h>
#include <stdint.h>
// Default value, flashing is prevented, cannot be set with CMD_SECURITY_SET
#define SYSTEM76_EC_SECURITY_STATE_LOCK 0
// Flashing is allowed, cannot be set with CMD_SECURITY_SET
#define SYSTEM76_EC_SECURITY_STATE_UNLOCK 1
// Flashing will be prevented on the next reboot
#define SYSTEM76_EC_SECURITY_STATE_PREPARE_LOCK 2
// Flashing will be allowed on the next reboot
#define SYSTEM76_EC_SECURITY_STATE_PREPARE_UNLOCK 3
/*
* Send a command to the EC. request_data/request_size are the request payload,
* request_data can be NULL if request_size is 0. reply_data/reply_size are
@ -14,4 +23,6 @@
bool system76_ec_cmd(uint8_t cmd, const uint8_t *request_data,
uint8_t request_size, uint8_t *reply_data, uint8_t reply_size);
bool system76_ec_security_get(uint8_t *state);
#endif

View File

@ -0,0 +1,132 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include "system76_ec.h"
#include <console/console.h>
#include <delay.h>
#include <device/usbc_mux.h>
#include <timer.h>
#include <types.h>
#define CMD_USBC_MUX_INFO 23
enum usbc_mux_flags {
USBC_MUX_DP = BIT(0),
USBC_MUX_USB = BIT(1),
USBC_MUX_CABLE = BIT(2),
USBC_MUX_POLARITY = BIT(3),
USBC_MUX_HPD_LVL = BIT(4),
USBC_MUX_HPD_IRQ = BIT(5),
USBC_MUX_UFP = BIT(6),
USBC_MUX_DBG_ACC = BIT(7),
};
static int system76_ec_get_mux_info(int port, struct usbc_mux_info *info)
{
uint8_t request[1] = { port };
uint8_t reply[3] = { 0 };
uint8_t flags;
uint8_t pin_mode;
bool res;
if (!info)
return -1;
res = system76_ec_cmd(CMD_USBC_MUX_INFO, request, ARRAY_SIZE(request),
reply, ARRAY_SIZE(reply));
if (!res)
return -1;
flags = reply[1];
pin_mode = reply[2];
info->dp = !!(flags & USBC_MUX_DP);
info->usb = !!(flags & USBC_MUX_USB);
info->cable = !!(flags & USBC_MUX_CABLE);
info->polarity = !!(flags & USBC_MUX_POLARITY);
info->hpd_lvl = !!(flags & USBC_MUX_HPD_LVL);
info->hpd_irq = !!(flags & USBC_MUX_HPD_IRQ);
info->ufp = !!(flags & USBC_MUX_UFP);
info->dbg_acc = !!(flags & USBC_MUX_DBG_ACC);
info->dp_pin_mode = pin_mode;
printk(BIOS_SPEW, "%s: dp=%u, usb=%u\n", __func__, info->dp, info->usb);
printk(BIOS_SPEW, "%s: cable=%u, polarity=%u\n", __func__, info->cable, info->polarity);
printk(BIOS_SPEW, "%s: hpd_lvl=%u, hpd_irq=%u\n", __func__, info->hpd_lvl, info->hpd_irq);
printk(BIOS_SPEW, "%s: ufp=%u, dbg_acc=%u\n", __func__, info->ufp, info->dbg_acc);
printk(BIOS_SPEW, "%s: pin_mode=0x%x\n", __func__, info->dp_pin_mode);
return 0;
}
static int system76_ec_wait_for_connection(long timeout_ms)
{
// TODO
return 1;
}
static int system76_ec_enter_dp_mode(int port)
{
// TODO
return 0;
}
static int system76_ec_wait_for_dp_mode_entry(int port, long timeout_ms)
{
struct usbc_mux_info info;
if (system76_ec_get_mux_info(port, &info) < 0) {
printk(BIOS_WARNING, "%s: could not get usbc mux info\n", __func__);
return -1;
}
if (!info.dp) {
printk(BIOS_WARNING, "DP mode not ready\n");
return -1;
}
return 0;
}
static int system76_ec_wait_for_hpd(int port, long timeout_ms)
{
struct usbc_mux_info info;
struct stopwatch sw;
stopwatch_init_msecs_expire(&sw, timeout_ms);
while (1) {
if (system76_ec_get_mux_info(port, &info) < 0) {
printk(BIOS_WARNING, "%s: could not get usbc mux info\n", __func__);
return -1;
}
if (info.hpd_lvl)
break;
if (stopwatch_expired(&sw)) {
printk(BIOS_WARNING, "HPD not ready after %ldms\n", timeout_ms);
return -1;
}
mdelay(100);
}
printk(BIOS_INFO, "HPD ready after %lldms\n", stopwatch_duration_msecs(&sw));
return 0;
}
static const struct usbc_ops system76_ec_usbc_ops = {
.mux_ops = {
.get_mux_info = system76_ec_get_mux_info,
},
.dp_ops = {
.wait_for_connection = system76_ec_wait_for_connection,
.enter_dp_mode = system76_ec_enter_dp_mode,
.wait_for_dp_mode_entry = system76_ec_wait_for_dp_mode_entry,
.wait_for_hpd = system76_ec_wait_for_hpd,
},
};
const struct usbc_ops *usbc_get_ops(void)
{
return &system76_ec_usbc_ops;
}

View File

@ -4128,6 +4128,7 @@
#define PCI_DID_INTEL_MTL_P_GT2_2 0x7d50
#define PCI_DID_INTEL_MTL_P_GT2_3 0x7d55
#define PCI_DID_INTEL_MTL_P_GT2_4 0x7d60
#define PCI_DID_INTEL_MTL_P_GT2_5 0x7dd5
#define PCI_DID_INTEL_RPL_HX_GT1 0xa788
#define PCI_DID_INTEL_RPL_HX_GT2 0xa78b
#define PCI_DID_INTEL_RPL_HX_GT3 0x4688

View File

@ -3,6 +3,9 @@
#ifndef __USBC_MUX_H__
#define __USBC_MUX_H__
#include <stdbool.h>
#include <stdint.h>
/* struct to hold all USB-C mux related variables */
struct usbc_mux_info {
bool dp; /* DP connected */

View File

@ -35,6 +35,18 @@
#define DDR4_SPD_PART_OFF 329
#define DDR4_SPD_PART_LEN 20
#define DDR4_SPD_SN_OFF 325
#define MAX_SPD_PAGE_SIZE_SPD5 128
#define MAX_SPD_SIZE (SPD_PAGE_LEN * 4)
#define SPD_HUB_MEMREG(addr) ((u8)(0x80 | (addr)))
#define SPD5_MR11 0x0B
#define SPD5_MR0 0x00
#define SPD5_MEMREG_REG(addr) ((u8)((~0x80) & (addr)))
#define SPD5_MR0_SPD5_HUB_DEV 0x51
struct spd_offset_table {
u16 start; /* Offset 0 */
u16 end; /* Offset 2 */
};
struct spd_block {
u8 addr_map[CONFIG_DIMM_MAX]; /* 7 bit I2C addresses */

View File

@ -126,7 +126,7 @@ static int rtc_month_days(unsigned int month, unsigned int year)
{
int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
return month_days[month] + (LEAP_YEAR(year) && month == 2);
return month_days[month] + (LEAP_YEAR(year) && month == 1);
}
int rtc_invalid(const struct rtc_time *tm)

View File

@ -209,7 +209,9 @@ enum cb_err spd_fill_from_cache(uint8_t *spd_cache, struct spd_block *blk)
dram_type = *(spd_cache + SC_SPD_OFFSET(i) + SPD_DRAM_TYPE);
if (dram_type == SPD_DRAM_DDR4)
if (dram_type == SPD_DRAM_DDR5)
blk->len = CONFIG_DIMM_SPD_SIZE;
else if (dram_type == SPD_DRAM_DDR4)
blk->len = SPD_PAGE_LEN_DDR4;
else
blk->len = SPD_PAGE_LEN;

View File

@ -58,7 +58,6 @@ config BOARD_GOOGLE_BASEBOARD_REX
select HAVE_SLP_S0_GATE
select MAINBOARD_HAS_CHROMEOS
select MEMORY_SOLDERDOWN
select SOC_INTEL_COMMON_BASECODE_RAMTOP
select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES
select SOC_INTEL_IOE_DIE_SUPPORT
select SOC_INTEL_METEORLAKE_U_H

View File

@ -19,7 +19,6 @@ config BOARD_INTEL_MTLRVP_COMMON
select HAVE_ACPI_TABLES
select HAVE_SPD_IN_CBFS
select MAINBOARD_HAS_CHROMEOS
select SOC_INTEL_COMMON_BASECODE_RAMTOP
select SOC_INTEL_COMMON_BLOCK_VARIANT_POWER_LIMIT
select SOC_INTEL_CSE_LITE_SKU
select SOC_INTEL_METEORLAKE_U_H

View File

@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_16384
select DRIVERS_GENERIC_CBFS_SERIAL
select DRIVERS_GENERIC_CBFS_UUID
select DRIVERS_GFX_NVIDIA
select DRIVERS_I2C_HID
select DRIVERS_I2C_TAS5825M
select EC_SYSTEM76_EC

View File

@ -1,6 +1,6 @@
## SPDX-License-Identifier: GPL-2.0-only
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include
bootblock-y += bootblock.c
bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c

View File

@ -1,11 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <variant/gpio.h>
#define EC_GPE_SCI 0x03 /* GPP_K3 */
#define EC_GPE_SWI 0x06 /* GPP_K6 */
#include <ec/system76/ec/acpi/ec.asl>
Scope (\_SB) {
#include "sleep.asl"
Scope (PCI0) {
Device (PEGP) {
Name (_ADR, CONFIG_DRIVERS_GFX_NVIDIA_BRIDGE << 16)
#include <drivers/gfx/nvidia/acpi/coffeelake.asl>
}
}
}
Scope (\_GPE) {

View File

@ -14,7 +14,10 @@ entries
412 4 e 6 debug_level
416 1 e 2 me_state
417 3 h 0 me_state_counter
904 80 h 0 ramtop
# CMOS_VSTART_ramtop
800 80 r 0 ramtop
984 16 h 0 check_sum
enumerations
@ -37,4 +40,4 @@ enumerations
checksums
checksum 408 983 984
checksum 408 799 984

View File

@ -56,6 +56,12 @@ chip soc/intel/cannonlake
# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU)
register "PcieClkSrcUsage[8]" = "0x40"
register "PcieClkSrcClkReq[8]" = "8"
chip drivers/gfx/nvidia
device pci 00.0 on end # VGA controller
device pci 00.1 on end # Audio device
device pci 00.2 on end # USB xHCI Host controller
device pci 00.3 on end # USB Type-C UCSI controller
end
end
device pci 02.0 on end # Integrated Graphics Device
device pci 04.0 on # SA Thermal device

View File

@ -1,7 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/gfx/nvidia/gpu.h>
#include <soc/cnl_memcfg_init.h>
#include <soc/romstage.h>
#include <variant/gpio.h>
static const struct cnl_mb_cfg memcfg = {
.spd[0] = {
@ -20,5 +22,17 @@ static const struct cnl_mb_cfg memcfg = {
void mainboard_memory_init_params(FSPM_UPD *memupd)
{
const struct nvidia_gpu_config config = {
.power_gpio = DGPU_PWR_EN,
.reset_gpio = DGPU_RST_N,
.enable = true,
};
// Enable dGPU power
nvidia_set_power(&config);
// Set primary display to internal graphics
memupd->FspmConfig.PrimaryDisplay = 0;
cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg);
}

View File

@ -3,7 +3,16 @@
#ifndef VARIANT_GPIO_H
#define VARIANT_GPIO_H
#include <soc/gpio.h>
#define DGPU_RST_N GPP_F22
#define DGPU_PWR_EN GPP_F23
#define DGPU_GC6 GPP_C12
#define DGPU_SSID 0x65d11558
#ifndef __ACPI__
void variant_configure_early_gpios(void);
void variant_configure_gpios(void);
#endif
#endif

View File

@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef VARIANT_GPIO_H
#define VARIANT_GPIO_H
#include <soc/gpio.h>
#define DGPU_RST_N GPP_F22
#define DGPU_PWR_EN GPP_F23
#define DGPU_GC6 GPP_C12
#define DGPU_SSID 0x65e11558
#ifndef __ACPI__
void variant_configure_early_gpios(void);
void variant_configure_gpios(void);
#endif
#endif

View File

@ -10,6 +10,9 @@ config BOARD_SYSTEM76_ADL_COMMON
select DRIVERS_INTEL_PMC
select DRIVERS_INTEL_USB4_RETIMER
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_LOCKDOWN
select ENABLE_TCSS_DISPLAY_DETECTION
select ENABLE_TCSS_USB_DETECTION
select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES
select HAVE_CMOS_DEFAULT
@ -35,10 +38,12 @@ config BOARD_SYSTEM76_GALP6
config BOARD_SYSTEM76_GAZE17_3050
select BOARD_SYSTEM76_ADL_COMMON
select DRIVERS_GFX_NVIDIA
select EC_SYSTEM76_EC_DGPU
config BOARD_SYSTEM76_GAZE17_3060_B
select BOARD_SYSTEM76_ADL_COMMON
select DRIVERS_GFX_NVIDIA
select EC_SYSTEM76_EC_DGPU
select MAINBOARD_USES_IFD_GBE_REGION
@ -48,11 +53,15 @@ config BOARD_SYSTEM76_LEMP11
config BOARD_SYSTEM76_ORYP9
select BOARD_SYSTEM76_ADL_COMMON
select DRIVERS_GFX_NVIDIA
select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST
select DRIVERS_I2C_TAS5825M
select EC_SYSTEM76_EC_DGPU
config BOARD_SYSTEM76_ORYP10
select BOARD_SYSTEM76_ADL_COMMON
select DRIVERS_GFX_NVIDIA
select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST
select EC_SYSTEM76_EC_DGPU
if BOARD_SYSTEM76_ADL_COMMON
@ -97,6 +106,10 @@ config MAINBOARD_VERSION
default "oryp9" if BOARD_SYSTEM76_ORYP9
default "oryp10" if BOARD_SYSTEM76_ORYP10
config CMOS_DEFAULT_FILE
default "src/mainboard/\$(MAINBOARDDIR)/cmos-csme.default" if BOARD_SYSTEM76_DARP8
default "src/mainboard/\$(MAINBOARDDIR)/cmos.default"
config CONSOLE_POST
default y
@ -106,6 +119,12 @@ config D3COLD_SUPPORT
config DIMM_SPD_SIZE
default 512
config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_TPP
default 45 if BOARD_SYSTEM76_ORYP9 || BOARD_SYSTEM76_ORYP10
config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_MAX
default 25 if BOARD_SYSTEM76_ORYP9 || BOARD_SYSTEM76_ORYP10
config FMDFILE
default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/board.fmd"

View File

@ -2,6 +2,10 @@
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include
ifeq ($(CONFIG_DRIVERS_GFX_NVIDIA),y)
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include
endif
bootblock-y += bootblock.c
bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c

View File

@ -1,5 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#if CONFIG(DRIVERS_GFX_NVIDIA)
#include <variant/gpio.h>
#endif
#define EC_GPE_SCI 0x6E
#define EC_GPE_SWI 0x6B
#include <ec/system76/ec/acpi/ec.asl>
@ -8,5 +12,11 @@ Scope (\_SB) {
#include "sleep.asl"
Scope (PCI0) {
#include "backlight.asl"
#if CONFIG(DRIVERS_GFX_NVIDIA)
Scope (PEG2) {
#include <drivers/gfx/nvidia/acpi/tigerlake.asl>
}
#endif
}
}

View File

@ -0,0 +1,3 @@
boot_option=Fallback
debug_level=Debug
me_state=Enable

View File

@ -14,7 +14,10 @@ entries
412 4 e 6 debug_level
416 1 e 2 me_state
417 3 h 0 me_state_counter
904 80 h 0 ramtop
# CMOS_VSTART_ramtop
800 80 r 0 ramtop
984 16 h 0 check_sum
enumerations
@ -37,4 +40,4 @@ enumerations
checksums
checksum 408 983 984
checksum 408 799 984

View File

@ -81,6 +81,7 @@ chip soc/intel/alderlake
end
device ref p2sb on end
device ref hda on
register "pch_hda_sdi_enable[0]" = "1"
register "pch_hda_audio_link_hda_enable" = "1"
register "pch_hda_idisp_codec_enable" = "1"
register "pch_hda_idisp_link_frequency" = "HDA_LINKFREQ_96MHZ"

View File

@ -1,4 +1,6 @@
chip soc/intel/alderlake
register "s0ix_enable" = "1"
register "power_limits_config[ADL_P_282_442_482_28W_CORE]" = "{
.tdp_pl1_override = 20,
.tdp_pl2_override = 56,
@ -152,6 +154,7 @@ chip soc/intel/alderlake
.clk_src = 4,
.clk_req = 4,
.flags = PCIE_RP_LTR,
.pcie_rp_detect_timeout_ms = 50,
}"
# FIXME: Drives do not exit D3cold on S3 exit
#chip soc/intel/common/block/pcie/rtd3

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef VARIANT_GPIO_H
#define VARIANT_GPIO_H
#include <soc/gpio.h>
#define DGPU_RST_N GPP_B2
#define DGPU_PWR_EN GPP_A14
#define DGPU_GC6 GPP_F13
#define DGPU_SSID 0x866d1558
#endif

View File

@ -38,6 +38,10 @@ chip soc/intel/alderlake
.clk_req = 3,
.flags = PCIE_RP_LTR,
}"
chip drivers/gfx/nvidia
device pci 00.0 on end # VGA controller
device pci 00.1 on end # Audio device
end
end
device ref pcie4_0 on
# PCIe PEG0 x4, Clock 0 (SSD2)
@ -98,6 +102,7 @@ chip soc/intel/alderlake
.clk_src = 1,
.clk_req = 1,
.flags = PCIE_RP_LTR,
.pcie_rp_detect_timeout_ms = 50,
}"
end
device ref pcie_rp9 on

View File

@ -1,7 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/gfx/nvidia/gpu.h>
#include <soc/meminit.h>
#include <soc/romstage.h>
#include <variant/gpio.h>
void mainboard_memory_init_params(FSPM_UPD *mupd)
{
@ -17,6 +19,14 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
};
const bool half_populated = false;
const struct nvidia_gpu_config config = {
.power_gpio = DGPU_PWR_EN,
.reset_gpio = DGPU_RST_N,
.enable = true,
};
// Enable dGPU power
nvidia_set_power(&config);
// Set primary display to internal graphics
mupd->FspmConfig.PrimaryDisplay = 0;

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef VARIANT_GPIO_H
#define VARIANT_GPIO_H
#include <soc/gpio.h>
#define DGPU_RST_N GPP_B2
#define DGPU_PWR_EN GPP_A14
#define DGPU_GC6 GPP_F13
#define DGPU_SSID 0x867c1558
#endif

View File

@ -38,6 +38,10 @@ chip soc/intel/alderlake
.clk_req = 3,
.flags = PCIE_RP_LTR,
}"
chip drivers/gfx/nvidia
device pci 00.0 on end # VGA controller
device pci 00.1 on end # Audio device
end
end
device ref igpu on
# DDIA is eDP
@ -130,6 +134,7 @@ chip soc/intel/alderlake
.clk_src = 1,
.clk_req = 1,
.flags = PCIE_RP_LTR,
.pcie_rp_detect_timeout_ms = 50,
}"
end
device ref gbe on end

View File

@ -1,7 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/gfx/nvidia/gpu.h>
#include <soc/meminit.h>
#include <soc/romstage.h>
#include <variant/gpio.h>
void mainboard_memory_init_params(FSPM_UPD *mupd)
{
@ -17,6 +19,14 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
};
const bool half_populated = false;
const struct nvidia_gpu_config config = {
.power_gpio = DGPU_PWR_EN,
.reset_gpio = DGPU_RST_N,
.enable = true,
};
// Enable dGPU power
nvidia_set_power(&config);
// Set primary display to internal graphics
mupd->FspmConfig.PrimaryDisplay = 0;

View File

@ -138,6 +138,7 @@ chip soc/intel/alderlake
.clk_src = 1,
.clk_req = 1,
.flags = PCIE_RP_LTR,
.pcie_rp_detect_timeout_ms = 50,
}"
# FIXME: Drives do not exit D3cold on S3 exit
#chip soc/intel/common/block/pcie/rtd3

View File

@ -15,7 +15,6 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
};
const bool half_populated = false;
mupd->FspmConfig.PchHdaAudioLinkHdaEnable = 1;
mupd->FspmConfig.DmiMaxLinkSpeed = 4;
mupd->FspmConfig.GpioOverride = 0;

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef VARIANT_GPIO_H
#define VARIANT_GPIO_H
#include <soc/gpio.h>
#define DGPU_RST_N GPP_B2
#define DGPU_PWR_EN GPP_A14
#define DGPU_GC6 GPP_A7
#define DGPU_SSID 0x65f51558
#endif

View File

@ -23,6 +23,10 @@ chip soc/intel/alderlake
.clk_req = 3,
.flags = PCIE_RP_LTR,
}"
chip drivers/gfx/nvidia
device pci 00.0 on end # VGA controller
device pci 00.1 on end # Audio device
end
end
device ref igpu on
register "ddi_portA_config" = "1"

View File

@ -1,7 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/gfx/nvidia/gpu.h>
#include <soc/meminit.h>
#include <soc/romstage.h>
#include <variant/gpio.h>
void mainboard_memory_init_params(FSPM_UPD *mupd)
{
@ -20,10 +22,17 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
};
const bool half_populated = false;
const struct nvidia_gpu_config config = {
.power_gpio = DGPU_PWR_EN,
.reset_gpio = DGPU_RST_N,
.enable = true,
};
// Enable dGPU power
nvidia_set_power(&config);
// Set primary display to internal graphics
mupd->FspmConfig.PrimaryDisplay = 0;
mupd->FspmConfig.PchHdaAudioLinkHdaEnable = 1;
mupd->FspmConfig.DmiMaxLinkSpeed = 4;
mupd->FspmConfig.GpioOverride = 0;

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef VARIANT_GPIO_H
#define VARIANT_GPIO_H
#include <soc/gpio.h>
#define DGPU_RST_N GPP_B2
#define DGPU_PWR_EN GPP_A14
#define DGPU_GC6 GPP_A7
#define DGPU_SSID 0x65f51558
#endif

View File

@ -23,6 +23,10 @@ chip soc/intel/alderlake
.clk_req = 3,
.flags = PCIE_RP_LTR,
}"
chip drivers/gfx/nvidia
device pci 00.0 on end # VGA controller
device pci 00.1 on end # Audio device
end
end
device ref igpu on
register "ddi_portA_config" = "1"

View File

@ -1,7 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/gfx/nvidia/gpu.h>
#include <soc/meminit.h>
#include <soc/romstage.h>
#include <variant/gpio.h>
void mainboard_memory_init_params(FSPM_UPD *mupd)
{
@ -17,10 +19,17 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
};
const bool half_populated = false;
const struct nvidia_gpu_config config = {
.power_gpio = DGPU_PWR_EN,
.reset_gpio = DGPU_RST_N,
.enable = true,
};
// Enable dGPU power
nvidia_set_power(&config);
// Set primary display to internal graphics
mupd->FspmConfig.PrimaryDisplay = 0;
mupd->FspmConfig.PchHdaAudioLinkHdaEnable = 1;
mupd->FspmConfig.DmiMaxLinkSpeed = 4;
mupd->FspmConfig.GpioOverride = 0;

View File

@ -7,7 +7,9 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_16384
select DRIVERS_GENERIC_CBFS_SERIAL
select DRIVERS_GENERIC_CBFS_UUID
select DRIVERS_GFX_NVIDIA
select DRIVERS_I2C_HID
select DRIVERS_I2C_TAS5825M
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_DGPU
select HAVE_ACPI_RESUME

View File

@ -10,3 +10,4 @@ romstage-y += romstage.c
ramstage-y += ramstage.c
ramstage-y += gpio.c
ramstage-y += hda_verb.c
ramstage-y += tas5825m.c

View File

@ -14,7 +14,10 @@ entries
412 4 e 6 debug_level
416 1 e 2 me_state
417 3 h 0 me_state_counter
904 80 h 0 ramtop
# CMOS_VSTART_ramtop
800 80 r 0 ramtop
984 16 h 0 check_sum
enumerations
@ -37,4 +40,4 @@ enumerations
checksums
checksum 408 983 984
checksum 408 799 984

View File

@ -59,11 +59,12 @@ chip soc/intel/cannonlake
# PCI Express Graphics #0 x16, Clock 7 (NVIDIA GPU)
register "PcieClkSrcUsage[7]" = "0x40"
register "PcieClkSrcClkReq[7]" = "7"
device pci 00.0 on end # VGA controller
device pci 00.1 on end # Audio device
device pci 00.2 on end # USB xHCI Host controller
device pci 00.3 on end # USB Type-C UCSI controller
chip drivers/gfx/nvidia
device pci 00.0 on end # VGA controller
device pci 00.1 on end # Audio device
device pci 00.2 on end # USB xHCI Host controller
device pci 00.3 on end # USB Type-C UCSI controller
end
end
# TODO: is this enough to disable iGPU?
device pci 02.0 off end # Integrated Graphics Device
@ -219,7 +220,16 @@ chip soc/intel/cannonlake
device pci 1f.3 on # Intel HDA
register "PchHdaAudioLinkHda" = "1"
end
device pci 1f.4 on end # SMBus
device pci 1f.4 on # SMBus
chip drivers/i2c/tas5825m
register "id" = "0"
device i2c 4e on end # (8bit address: 0x9c)
end
chip drivers/i2c/tas5825m
register "id" = "1"
device i2c 4f on end # (8bit address: 0x9e)
end
end
device pci 1f.5 on end # PCH SPI
device pci 1f.6 off end # GbE
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/i2c/tas5825m/tas5825m.h>
#include "tas5825m-normal.c"
#include "tas5825m-sub.c"
int tas5825m_setup(struct device *dev, int id)
{
if (id == 0)
return tas5825m_setup_normal(dev);
if (id == 1)
return tas5825m_setup_sub(dev);
return -1;
}

View File

@ -14,7 +14,10 @@ entries
412 4 e 6 debug_level
416 1 e 2 me_state
417 3 h 0 me_state_counter
904 80 h 0 ramtop
# CMOS_VSTART_ramtop
800 80 r 0 ramtop
984 16 h 0 check_sum
enumerations
@ -37,4 +40,4 @@ enumerations
checksums
checksum 408 983 984
checksum 408 799 984

View File

@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_16384
select DRIVERS_GENERIC_CBFS_SERIAL
select DRIVERS_GENERIC_CBFS_UUID
select DRIVERS_GFX_NVIDIA
select DRIVERS_I2C_HID
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_DGPU

View File

@ -1,6 +1,6 @@
## SPDX-License-Identifier: GPL-2.0-only
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include
bootblock-y += bootblock.c
bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c

View File

@ -1,5 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <variant/gpio.h>
#define EC_GPE_SCI 0x03 /* GPP_K3 */
#define EC_GPE_SWI 0x06 /* GPP_K6 */
#include <ec/system76/ec/acpi/ec.asl>
@ -8,6 +10,10 @@ Scope (\_SB) {
#include "sleep.asl"
Scope (PCI0) {
#include "backlight.asl"
Device (PEGP) {
Name (_ADR, CONFIG_DRIVERS_GFX_NVIDIA_BRIDGE << 16)
#include <drivers/gfx/nvidia/acpi/coffeelake.asl>
}
}
}

View File

@ -14,7 +14,10 @@ entries
412 4 e 6 debug_level
416 1 e 2 me_state
417 3 h 0 me_state_counter
904 80 h 0 ramtop
# CMOS_VSTART_ramtop
800 80 r 0 ramtop
984 16 h 0 check_sum
enumerations
@ -37,4 +40,4 @@ enumerations
checksums
checksum 408 983 984
checksum 408 799 984

View File

@ -55,6 +55,12 @@ chip soc/intel/cannonlake
# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU)
register "PcieClkSrcUsage[8]" = "0x40"
register "PcieClkSrcClkReq[8]" = "8"
chip drivers/gfx/nvidia
device pci 00.0 on end # VGA controller
device pci 00.1 on end # Audio device
device pci 00.2 on end # USB xHCI Host controller
device pci 00.3 on end # USB Type-C UCSI controller
end
end
device pci 02.0 on # Integrated Graphics Device
register "gfx" = "GMA_DEFAULT_PANEL(0)"

View File

@ -1,7 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/gfx/nvidia/gpu.h>
#include <soc/cnl_memcfg_init.h>
#include <soc/romstage.h>
#include <variant/gpio.h>
static const struct cnl_mb_cfg memcfg = {
.spd[0] = {
@ -20,5 +22,17 @@ static const struct cnl_mb_cfg memcfg = {
void mainboard_memory_init_params(FSPM_UPD *memupd)
{
const struct nvidia_gpu_config config = {
.power_gpio = DGPU_PWR_EN,
.reset_gpio = DGPU_RST_N,
.enable = true,
};
// Enable dGPU power
nvidia_set_power(&config);
// Set primary display to internal graphics
memupd->FspmConfig.PrimaryDisplay = 0;
cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg);
}

View File

@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef VARIANT_GPIO_H
#define VARIANT_GPIO_H
#include <soc/gpio.h>
#define DGPU_RST_N GPP_F22
#define DGPU_PWR_EN GPP_F23
#define DGPU_GC6 GPP_K21
#define DGPU_SSID 0x85501558
#ifndef __ACPI__
void variant_configure_early_gpios(void);
void variant_configure_gpios(void);
#endif
#endif

View File

@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef VARIANT_GPIO_H
#define VARIANT_GPIO_H
#include <soc/gpio.h>
#define DGPU_RST_N GPP_F22
#define DGPU_PWR_EN GPP_F23
#define DGPU_GC6 GPP_K21
#define DGPU_SSID 0x85201558
#ifndef __ACPI__
void variant_configure_early_gpios(void);
void variant_configure_gpios(void);
#endif
#endif

View File

@ -12,7 +12,10 @@ entries
400 8 r 0 century
412 4 e 6 debug_level
904 80 h 0 ramtop
# CMOS_VSTART_ramtop
800 80 r 0 ramtop
984 16 h 0 check_sum
enumerations
@ -32,4 +35,4 @@ enumerations
checksums
checksum 408 983 984
checksum 408 799 984

View File

@ -0,0 +1,117 @@
## SPDX-License-Identifier: GPL-2.0-only
config BOARD_SYSTEM76_MTL_COMMON
def_bool n
select BOARD_ROMSIZE_KB_32768
select DRIVERS_GENERIC_BAYHUB_LV2
select DRIVERS_GENERIC_CBFS_SERIAL
select DRIVERS_GENERIC_CBFS_UUID
select DRIVERS_I2C_HID
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_LOCKDOWN
select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES
select HAVE_CMOS_DEFAULT
select HAVE_OPTION_TABLE
select INTEL_GMA_HAVE_VBT
select INTEL_LPSS_UART_FOR_CONSOLE
select MAINBOARD_HAS_TPM2
select MEMORY_MAPPED_TPM
select NO_UART_ON_SUPERIO
select PCIEXP_SUPPORT_RESIZABLE_BARS
select SOC_INTEL_COMMON_BLOCK_HDA_VERB
select SOC_INTEL_CRASHLOG
select SOC_INTEL_METEORLAKE
select SPD_READ_BY_WORD
select SYSTEM_TYPE_LAPTOP
select TPM_RDRESP_NEED_DELAY
config BOARD_SYSTEM76_DARP10
select BOARD_SYSTEM76_MTL_COMMON
select MAINBOARD_USES_IFD_GBE_REGION
select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES
select SOC_INTEL_METEORLAKE_U_H
config BOARD_SYSTEM76_DARP10_B
select BOARD_SYSTEM76_MTL_COMMON
select MAINBOARD_USES_IFD_GBE_REGION
select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES
select SOC_INTEL_METEORLAKE_U_H
config BOARD_SYSTEM76_LEMP13
select BOARD_SYSTEM76_MTL_COMMON
select DRIVERS_I2C_TAS5825M
select HAVE_SPD_IN_CBFS
select SOC_INTEL_METEORLAKE_U_H
select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES
config BOARD_SYSTEM76_LEMP13_B
select BOARD_SYSTEM76_MTL_COMMON
select DRIVERS_I2C_TAS5825M
select HAVE_SPD_IN_CBFS
select SOC_INTEL_METEORLAKE_U_H
select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES
if BOARD_SYSTEM76_MTL_COMMON
config MAINBOARD_DIR
default "system76/mtl"
config VARIANT_DIR
default "darp10" if BOARD_SYSTEM76_DARP10 || BOARD_SYSTEM76_DARP10_B
default "lemp13" if BOARD_SYSTEM76_LEMP13 || BOARD_SYSTEM76_LEMP13_B
config OVERRIDE_DEVICETREE
default "variants/\$(CONFIG_VARIANT_DIR)/overridetree.cb"
config MAINBOARD_PART_NUMBER
default "darp10" if BOARD_SYSTEM76_DARP10
default "darp10-b" if BOARD_SYSTEM76_DARP10_B
default "lemp13" if BOARD_SYSTEM76_LEMP13
default "lemp13-b" if BOARD_SYSTEM76_LEMP13_B
config MAINBOARD_SMBIOS_PRODUCT_NAME
default "Darter Pro" if BOARD_SYSTEM76_DARP10 || BOARD_SYSTEM76_DARP10_B
default "Lemur Pro" if BOARD_SYSTEM76_LEMP13 || BOARD_SYSTEM76_LEMP13_B
config MAINBOARD_VERSION
default "darp10" if BOARD_SYSTEM76_DARP10
default "darp10-b" if BOARD_SYSTEM76_DARP10_B
default "lemp13" if BOARD_SYSTEM76_LEMP13
default "lemp13-b" if BOARD_SYSTEM76_LEMP13_B
config CMOS_DEFAULT_FILE
default "src/mainboard/\$(MAINBOARDDIR)/cmos.default"
config CONSOLE_POST
default y
config D3COLD_SUPPORT
default n
config DIMM_SPD_SIZE
default 1024
config FMDFILE
default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/variants/\$(CONFIG_VARIANT_DIR)/board.fmd"
config ONBOARD_VGA_IS_PRIMARY
default y
config PCIEXP_DEFAULT_MAX_RESIZABLE_BAR_BITS
default 36
config POST_DEVICE
default n
config TPM_MEASURED_BOOT
default y
config UART_FOR_CONSOLE
default 0
# PM Timer Disabled, saves power
config USE_PM_ACPI_TIMER
default n
endif

View File

@ -0,0 +1,13 @@
## SPDX-License-Identifier: GPL-2.0-only
config BOARD_SYSTEM76_DARP10
bool "darp10"
config BOARD_SYSTEM76_DARP10_B
bool "darp10-b"
config BOARD_SYSTEM76_LEMP13
bool "lemp13"
config BOARD_SYSTEM76_LEMP13_B
bool "lemp13-b"

View File

@ -0,0 +1,20 @@
## SPDX-License-Identifier: GPL-2.0-only
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include
ifeq ($(CONFIG_DRIVERS_GFX_NVIDIA),y)
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include
endif
bootblock-y += bootblock.c
bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c
romstage-y += variants/$(VARIANT_DIR)/romstage.c
ramstage-y += ramstage.c
ramstage-y += variants/$(VARIANT_DIR)/hda_verb.c
ramstage-y += variants/$(VARIANT_DIR)/gpio.c
ramstage-y += variants/$(VARIANT_DIR)/ramstage.c
ramstage-$(CONFIG_DRIVERS_I2C_TAS5825M) += variants/$(VARIANT_DIR)/tas5825m.c
SPD_SOURCES = samsung-M425R1GB4BB0-CQKOD

View File

@ -0,0 +1,31 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/intel/gma/acpi/gma.asl>
Scope (GFX0)
{
Name (BRIG, Package (22) {
100, /* default AC */
100, /* default Battery */
5,
10,
15,
20,
25,
30,
35,
40,
45,
50,
55,
60,
65,
70,
75,
80,
85,
90,
95,
100
})
}

View File

@ -0,0 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#define EC_GPE_SCI 0x6E
#define EC_GPE_SWI 0x6B
#include <ec/system76/ec/acpi/ec.asl>
Scope (\_SB) {
#include "sleep.asl"
Scope (PCI0) {
#include "backlight.asl"
}
}

View File

@ -0,0 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
External(\TBTS, MethodObj)
Method(MPTS, 1, Serialized) {
If (CondRefOf(\TBTS)) {
\TBTS()
}
}

View File

@ -0,0 +1,6 @@
Vendor name: System76
Category: laptop
ROM package: WSON-8
ROM protocol: SPI
ROM socketed: n
Flashrom support: y

View File

@ -0,0 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <bootblock_common.h>
#include <mainboard/gpio.h>
void bootblock_mainboard_early_init(void)
{
mainboard_configure_early_gpios();
}

View File

@ -0,0 +1,5 @@
## SPDX-License-Identifier: GPL-2.0-only
boot_option=Fallback
debug_level=Debug
me_state=Disable

View File

@ -0,0 +1,43 @@
# SPDX-License-Identifier: GPL-2.0-only
entries
0 384 r 0 reserved_memory
# RTC_BOOT_BYTE (coreboot hardcoded)
384 1 e 4 boot_option
388 4 h 0 reboot_counter
# RTC_CLK_ALTCENTURY
400 8 r 0 century
412 4 e 6 debug_level
416 1 e 2 me_state
417 3 h 0 me_state_counter
# CMOS_VSTART_ramtop
800 80 r 0 ramtop
984 16 h 0 check_sum
enumerations
2 0 Enable
2 1 Disable
4 0 Fallback
4 1 Normal
6 0 Emergency
6 1 Alert
6 2 Critical
6 3 Error
6 4 Warning
6 5 Notice
6 6 Info
6 7 Debug
6 8 Spew
checksums
checksum 408 799 984

View File

@ -0,0 +1,65 @@
chip soc/intel/meteorlake
register "common_soc_config" = "{
// Touchpad I2C bus
.i2c[0] = {
.speed = I2C_SPEED_FAST,
.rise_time_ns = 80,
.fall_time_ns = 110,
},
}"
# Enable Enhanced Intel SpeedStep
register "eist_enable" = "1"
# Thermal
register "tcc_offset" = "8"
device cpu_cluster 0 on end
device domain 0 on
device ref system_agent on end
device ref igpu on
# DDIA is eDP, TCP2 is HDMI
register "ddi_port_A_config" = "1"
register "ddi_ports_config" = "{
[DDI_PORT_A] = DDI_ENABLE_HPD,
[DDI_PORT_2] = DDI_ENABLE_HPD | DDI_ENABLE_DDC,
}"
register "gfx" = "GMA_DEFAULT_PANEL(0)"
end
device ref ioe_shared_sram on end
device ref pmc_shared_sram on end
device ref cnvi_wifi on
register "cnvi_bt_core" = "true"
register "cnvi_bt_audio_offload" = "true"
chip drivers/wifi/generic
register "wake" = "GPE0_PME_B0"
device generic 0 on end
end
end
device ref i2c1 on
register "serial_io_i2c_mode[PchSerialIoIndexI2C1]" = "PchSerialIoPci"
end
device ref heci1 on end
device ref soc_espi on
register "gen1_dec" = "0x00040069" # EC PM channel
register "gen2_dec" = "0x00fc0e01" # AP/EC command
register "gen3_dec" = "0x00fc0f01" # AP/EC debug
chip drivers/pc80/tpm
device pnp 0c31.0 on end
end
end
device ref p2sb on end
device ref hda on
register "pch_hda_sdi_enable[0]" = "1"
register "pch_hda_audio_link_hda_enable" = "1"
register "pch_hda_idisp_codec_enable" = "1"
register "pch_hda_idisp_link_frequency" = "HDA_LINKFREQ_96MHZ"
register "pch_hda_idisp_link_tmode" = "HDA_TMODE_8T"
end
device ref smbus on end
device ref fast_spi on end
end
end

View File

@ -0,0 +1,36 @@
/* SPDX-License-Identifier: GPL-2.0-only */
//TODO: HACK FOR MISSING MISCCFG_GPIO_PM_CONFIG_BITS
#include <soc/gpio.h>
#include <acpi/acpi.h>
DefinitionBlock(
"dsdt.aml",
"DSDT",
ACPI_DSDT_REV_2,
OEM_ID,
ACPI_TABLE_CREATOR,
0x20110725
)
{
#include <acpi/dsdt_top.asl>
#include <soc/intel/common/block/acpi/acpi/platform.asl>
#include <soc/intel/common/block/acpi/acpi/globalnvs.asl>
#include <cpu/intel/common/acpi/cpu.asl>
Device (\_SB.PCI0)
{
#include <soc/intel/common/block/acpi/acpi/northbridge.asl>
#include <soc/intel/meteorlake/acpi/southbridge.asl>
#include <soc/intel/meteorlake/acpi/tcss.asl>
}
#include <southbridge/intel/common/acpi/sleepstates.asl>
Scope (\_SB.PCI0.LPCB)
{
#include <drivers/pc80/pc/ps2_controller.asl>
}
#include "acpi/mainboard.asl"
}

View File

@ -0,0 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef MAINBOARD_GPIO_H
#define MAINBOARD_GPIO_H
void mainboard_configure_early_gpios(void);
void mainboard_configure_gpios(void);
#endif

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <mainboard/gpio.h>
#include <soc/ramstage.h>
static void mainboard_init(void *chip_info)
{
mainboard_configure_gpios();
}
struct chip_operations mainboard_ops = {
.init = mainboard_init,
};

Some files were not shown because too many files have changed in this diff Show More