summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS90
-rw-r--r--Documentation/drivers/smmstorev2.md25
-rw-r--r--Documentation/internals/chip_operations.md537
-rw-r--r--Documentation/internals/device_operations.md696
-rw-r--r--Documentation/internals/index.md3
-rw-r--r--src/arch/x86/c_start.S71
-rw-r--r--src/arch/x86/exception.c2
-rw-r--r--src/arch/x86/include/arch/ram_segs.h14
-rw-r--r--src/arch/x86/include/arch/rom_segs.h17
-rw-r--r--src/arch/x86/wakeup.S8
-rw-r--r--src/commonlib/include/commonlib/coreboot_tables.h8
-rw-r--r--src/cpu/x86/64bit/entry64.inc12
-rw-r--r--src/cpu/x86/64bit/exit32.inc14
-rw-r--r--src/cpu/x86/entry16.S4
-rw-r--r--src/cpu/x86/entry32.S4
-rw-r--r--src/cpu/x86/mtrr/Makefile.mk6
-rw-r--r--src/cpu/x86/mtrr/earlymtrr.c57
-rw-r--r--src/cpu/x86/mtrr/mtrr.c8
-rw-r--r--src/cpu/x86/mtrr/mtrrlib.c85
-rw-r--r--src/cpu/x86/sipi_vector.S6
-rw-r--r--src/cpu/x86/smm/smm_module_handler.c4
-rw-r--r--src/cpu/x86/smm/smm_stub.S7
-rw-r--r--src/device/oprom/realmode/x86_asm.S30
-rw-r--r--src/drivers/intel/fsp2_0/Kconfig18
-rw-r--r--src/drivers/intel/fsp2_0/Makefile.mk1
-rw-r--r--src/drivers/intel/fsp2_0/cb_logo.c175
-rw-r--r--src/drivers/intel/fsp2_0/fsp_gop_blt.c15
-rw-r--r--src/drivers/intel/fsp2_0/graphics.c19
-rw-r--r--src/drivers/intel/fsp2_0/include/fsp/api.h29
-rw-r--r--src/drivers/intel/fsp2_0/include/fsp/fsp_gop_blt.h1
-rw-r--r--src/drivers/intel/fsp2_0/include/fsp/graphics.h19
-rw-r--r--src/drivers/intel/fsp2_0/silicon_init.c31
-rw-r--r--src/drivers/smmstore/ramstage.c4
-rw-r--r--src/include/cpu/x86/gdt.h20
-rw-r--r--src/include/cpu/x86/mtrr.h4
-rw-r--r--src/include/smmstore.h2
-rw-r--r--src/mainboard/amd/birman/devicetree_phoenix_opensil.cb2
-rw-r--r--src/mainboard/asus/h61-series/Kconfig21
-rw-r--r--src/mainboard/asus/h61-series/Kconfig.name3
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/board_info.txt6
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/cmos.default7
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/cmos.layout65
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/data.vbtbin0 -> 7168 bytes
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/early_init.c29
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/gma-mainboard.ads21
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/gpio.c211
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/hda_verb.c51
-rw-r--r--src/mainboard/asus/h61-series/variants/h61m-a_usb3/overridetree.cb82
-rw-r--r--src/mainboard/google/brya/variants/uldrenite/gpio.c16
-rw-r--r--src/mainboard/google/brya/variants/uldrenite/variant.c73
-rw-r--r--src/mainboard/google/drallion/Kconfig1
-rw-r--r--src/mainboard/google/fatcat/variants/fatcat/overridetree.cb1
-rw-r--r--src/mainboard/google/fatcat/variants/francka/overridetree.cb2
-rw-r--r--src/mainboard/google/hatch/Kconfig1
-rw-r--r--src/mainboard/google/ocelot/variants/ocelot/overridetree.cb43
-rw-r--r--src/mainboard/google/sarien/Kconfig1
-rw-r--r--src/mainboard/google/volteer/variants/elemi/ramstage.c34
-rw-r--r--src/mainboard/intel/coffeelake_rvp/variants/baseboard/devicetree.cb35
-rw-r--r--src/mainboard/intel/coffeelake_rvp/variants/cfl_h/overridetree.cb19
-rw-r--r--src/mainboard/intel/coffeelake_rvp/variants/cfl_s/overridetree.cb23
-rw-r--r--src/mainboard/intel/coffeelake_rvp/variants/cfl_u/overridetree.cb25
-rw-r--r--src/mainboard/intel/coffeelake_rvp/variants/cml_u/overridetree.cb24
-rw-r--r--src/mainboard/intel/coffeelake_rvp/variants/whl_u/overridetree.cb22
-rw-r--r--src/mainboard/intel/ptlrvp/mainboard.c7
-rw-r--r--src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h1
-rw-r--r--src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk1
-rw-r--r--src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c63
-rw-r--r--src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c65
-rw-r--r--src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk1
-rw-r--r--src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt1
-rw-r--r--src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt1
-rw-r--r--src/mainboard/lenovo/m900_tiny/data.vbtbin4608 -> 8192 bytes
-rw-r--r--src/mainboard/starlabs/starbook/variants/tgl/gpio.c12
-rw-r--r--src/security/intel/stm/StmPlatformSmm.c12
-rw-r--r--src/security/intel/txt/getsec_enteraccs.S6
-rw-r--r--src/soc/amd/mendocino/fsp_s_params.c2
-rw-r--r--src/soc/amd/phoenix/Kconfig1
-rw-r--r--src/soc/amd/phoenix/Makefile.mk1
-rw-r--r--src/soc/amd/phoenix/acpi.c1
-rw-r--r--src/soc/amd/phoenix/chip.h2
-rw-r--r--src/soc/intel/alderlake/Makefile.mk5
-rw-r--r--src/soc/intel/alderlake/fsp_params.c5
-rw-r--r--src/soc/intel/apollolake/chip.c2
-rw-r--r--src/soc/intel/cannonlake/fsp_params.c2
-rw-r--r--src/soc/intel/common/block/include/intelblocks/cfg.h71
-rw-r--r--src/soc/intel/elkhartlake/fsp_params.c3
-rw-r--r--src/soc/intel/jasperlake/fsp_params.c3
-rw-r--r--src/soc/intel/meteorlake/fsp_params.c5
-rw-r--r--src/soc/intel/pantherlake/Kconfig9
-rw-r--r--src/soc/intel/pantherlake/acpi.c2
-rw-r--r--src/soc/intel/pantherlake/bootblock/report_platform.c36
-rw-r--r--src/soc/intel/pantherlake/chip.c2
-rw-r--r--src/soc/intel/pantherlake/chipset_ptl.cb (renamed from src/soc/intel/pantherlake/chipset.cb)0
-rw-r--r--src/soc/intel/pantherlake/chipset_wcl.cb132
-rw-r--r--src/soc/intel/pantherlake/elog.c4
-rw-r--r--src/soc/intel/pantherlake/fsp_params.c15
-rw-r--r--src/soc/intel/pantherlake/include/soc/iomap.h4
-rw-r--r--src/soc/intel/pantherlake/include/soc/pci_devs.h17
-rw-r--r--src/soc/intel/pantherlake/pcie_rp.c4
-rw-r--r--src/soc/intel/skylake/chip.c2
-rw-r--r--src/soc/intel/tigerlake/fsp_params.c3
-rw-r--r--src/vendorcode/intel/fsp/fsp2_0/iot/raptorlake_s/MemInfoHob.h315
-rw-r--r--util/autoport/ec_none.go7
-rw-r--r--util/autoport/main.go12
104 files changed, 2933 insertions, 768 deletions
diff --git a/AUTHORS b/AUTHORS
index 435a938df5bf..21e1cd567f37 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -15,12 +15,14 @@ Aaron Durbin
Abe Levkoy
Abel Briggs
Abhinav Hardikar
+Abhishek Pandit-Subedi
AdaCore
Adam Liu
Adam Mills
Advanced Computing Lab, LANL
Advanced Micro Devices, Inc.
AG Electronics Ltd.
+Agogo
Ahamed Husni
Akshu Agrawal
Al Hirani
@@ -41,24 +43,30 @@ Alexey Vazhnov
Alice Sell
Alicja Michalska
Allen-KH Cheng
+Alok Agarwal
Alper Nebi Yasak
Amanda Hwang
American Megatrends International, LLC
Amersel
Amit Caleechurn
+Ana Carolina Cabral
Analog Devices Inc.
Analogix Semiconductor
Anand Mistry
Anand Vaikar
+Anastasios Koutian
+Andre
Andre Heider
Andrew McRae
Andrew SH Cheng
Andrey Pronin
Andriy Gapon
+Andy
Andy Fleming
Andy Pont
Andy-ld Lu
Angel Pons
+Angela Czubak
Anil Kumar K
Anna Karaś
Annie Chen
@@ -68,6 +76,7 @@ Appukuttan V K
Arashk Mahshidfar
Arec Kao
Ariel Fang
+Ariel Otilibili
ARM Limited and Contributors
Arthur Heymans
Asami Doi
@@ -77,9 +86,12 @@ Ashqti
ASPEED Technology Inc.
Atheros Corporation
Atmel Corporation
+Avi Uday
+Avinash Munduru
Balaji Manigandan
Balázs Vinarz
BAP - Bruhnspace Advanced Projects
+Bartłomiej Grzesik
Baruch Siach
Ben Chuang
Ben Kao
@@ -90,6 +102,7 @@ Bernardo Perez Priego
Bhanu Prakash Maiya
Bill Xie
Bin Meng
+Bincai Liu
Bitland Tech Inc.
Bob Moragues
Bora Guvendik
@@ -97,10 +110,13 @@ Boris Barbulovski
Boris Mittelberg
Brandon Breitenstein
Brandon Weeks
+Brian Hsu
Brian Norris
Bryant Ou
Carl-Daniel Hailfinger
+Carlos López
Casper Chang
+Cathy Xu
Caveh Jalali
Cavium Inc.
Chao Gui
@@ -125,6 +141,7 @@ Cong Yang
CoolStar
coresystems GmbH
Corey Osgood
+Crystal Guo
Curt Brune
Curtis Chen
Custom Ideas
@@ -144,6 +161,7 @@ Dave Airlie
David Brownell
David Greenman
David Hendricks
+David Li
David Lin
David Milosevic
David Mosberger-Tang
@@ -153,6 +171,7 @@ David Wu
Dawei Chien
Deepika Punyamurtula
Deepti Deshatty
+Dehui Sun
Denis 'GNUtoo' Carikli
Denis Dowling
DENX Software Engineering
@@ -166,6 +185,7 @@ Divya S Sasidharan
Dmitry Ponamorev
Dmitry Torokhov
DMP Electronics Inc.
+Dolan Liu
Dominik Behr
Donghwa Lee
Drew Eckhardt
@@ -186,6 +206,7 @@ ELSOFT AG
Eltan B.V
Eltan B.V.
Elyes Haouas
+Emilie Roberts
Eran Mitrani
Eren Peng
Eric Biederman
@@ -205,11 +226,13 @@ Fabian Meyer
Fabio Aiuto
Fabrice Bellard
Facebook, Inc.
+Federico Amedeo Izzo
Fei Yan
Felix Friedlander
Felix Held
Felix Singer
Fengquan Chen
+Filip Brozovic
Filip Lewiński
Flora Fu
Florian Laufenböck
@@ -225,8 +248,12 @@ Freescale Semiconductor, Inc.
Furquan Shaikh
Gaggery Tsai
Gang C Chen
+Garen Wu
+Gareth Yu
Garmin Chang
Gary Jennejohn
+Gavin Liu
+George Burgess
George Trudeau
Gerald Van Baren
Gerd Hoffmann
@@ -234,6 +261,7 @@ Gergely Kiss
Google LLC
Greg Watson
Grzegorz Bernacki
+Guangjie Song
Guennadi Liakhovetski
Guodong Liu
Gwendal Grignou
@@ -241,6 +269,7 @@ Hal Martin
Hao Chou
Hao Wang
HardenedLinux
+Harrie Paijmans
Harsha B R
Harshit Sharma
Henry C Chen
@@ -248,11 +277,13 @@ Herbert Wu
Hewlett Packard Enterprise Development LP
Hewlett-Packard Development Company, L.P.
Himanshu Sahdev
+Hope Wang
Housong Zhang
Hsiao Chien Sung
Hsin-hsiung wang
Hsin-Te Yuan
Hsuan Ting Chen
+Hualin Wei
Huaqin Technology Co., Ltd
Huaqin Telecom Inc.
Hui Liu
@@ -267,6 +298,7 @@ Igor Pavlov
Ikjoon Jang
Imagination Technologies
Infineon Technologies
+Ingo Reitz
InKi Dae
INSPUR Co., Ltd
Intel Corporation
@@ -284,11 +316,14 @@ Jakub Czapiga
James Chao
James Lo
James Ye
+Jameson Thies
Jamie Chen
Jamie Ryu
Jan Dabros
+Jan Philipp Groß
Jan Samek
Jan Tatje
+Jarried Lin
Jason Glenesk
Jason Nein
Jason V Le
@@ -297,7 +332,9 @@ Jason Zhao
jason-ch chen
Jason-jh Lin
Jay Patel
+Jayvik Desai
Jean Lucas
+Jędrzej Ciupis
Jeff Chase
Jeff Daly
Jeff Li
@@ -318,10 +355,12 @@ Jingle Hsu
Jitao Shi
Joe Pillow
Joe Tessler
+Joel Bueno
Joel Kitching
Joel Linn
Joey Peng
Johanna Schander
+Johannes Hahn
John Su
John Zhao
Johnny Li
@@ -339,7 +378,9 @@ Jörg Mische
Joseph Smith
Josie Nordrum
Juan José García-Castro Crespo
+Julia Kittlinger
Julia Tsai
+Julian Intronati
Julian Schroeder
Julian Stecklina
Julien Viard de Galbert
@@ -351,6 +392,7 @@ Kangheui Won
Kapil Porwal
Karol Zmyslowski
Karthik Ramasubramanian
+Ke Zheng
Kei Hiroyoshi
Keith Hui
Keith Packard
@@ -362,10 +404,12 @@ Kevin Chowski
Kevin Cody-Little
Kevin Keijzer
Kevin O'Connor
+Kevin Yang
Kevin3 Yang
kewei xu
Kilari Raasi
Kirk Wang
+Kiwi Liu
Konrad Adamczyk
Kontron Europe GmbH
Kornel Dulęba
@@ -375,6 +419,7 @@ Kshitij
Kshitiz Godara
Kulkarni. Srinivas
Kun Liu
+KunYi Chen
Kyle Lin
Kyösti Mälkki
Lance Zhao
@@ -397,9 +442,13 @@ linear
Linus Torvalds
Linux Networx, Inc.
LiPPERT ADLINK Technology GmbH
+Liu Liu
Liya Li
+Lu Tang
+Lu. Pen-ChunX
Lubomir Rintel
Luc Verhaegen
+Luca Lai
Lucas Chen
Mac Chiang
Maciej Matuszczyk
@@ -420,6 +469,7 @@ Mario Scheithauer
Marius Gröger
Mariusz Szafranski
Mariusz Szafrański
+Mark Chang
Mark Hasemeyer
Mark Hsieh
Mars Chen
@@ -430,6 +480,7 @@ Martin Roth
Marvell International Ltd.
Marvell Semiconductor Inc.
Marx Wang
+Masa Nakura
Masanori Ogino
Máté Kukri
Matei Dibu
@@ -438,6 +489,7 @@ Matt Chen
Matt Delco
Matt DeVillier
Matt Papageorge
+Matt Turner
Matthew Blecker
Matthew Ziegelbaum
Mattias Nissler
@@ -450,6 +502,7 @@ Maximilian Brune
Mediatek Inc.
MediaTek Inc.
Meera Ravindranath
+Melongmelong
Meng-Huan Yu
Meta Platforms, Inc
mgabryelski1
@@ -462,15 +515,20 @@ Michael Strosche
Michael Walle
Michał Kopeć
Michal Suchanek
+Michał Zieliński
Michał Żygowski
Micro-Star INT'L CO., LTD.
Mika Westerberg
Mike Banon
+Mike Lin
Mike Shih
+Mingjin Ge
Miriam Polzer
mkurumel
Moises Garcia
+Momoko Hattori
Mondrian Nuessle
+Monika A
Monikaanan
MontaVista Software, Inc.
Morgan Jang
@@ -480,7 +538,7 @@ mtk15698
mturney mturney
Musse Abdullahi
Myles Watson
-Nancy.Lin
+Nancy Lin
Naresh Solanki
Nathan Lu
Naveen R. Iyer
@@ -491,12 +549,14 @@ Nicholas Sielicki
Nicholas Sudsgaard
Nick Barker
Nick Chen
+Nick Kochlowski
Nick Vaccaro
Nico Huber
Nico Rikken
Nicola Corna
Nicolas Boichat
Nicole Faerber
+Nigel Tao
Nikolai Vyssotski
Nils Jacobs
Nina Wu
@@ -510,6 +570,10 @@ Omar Pakker
Online SAS
Opal Voravootivat
Orion Technologies, LLC
+Ot_chhao.chang
+Ot_hao.han
+Ot_song Fan
+Pablo
Pablo Ceballos
Pablo Stebler
Pan Gao
@@ -542,13 +606,14 @@ Philipp Hug
Piotr Kleinschmidt
Po Xu
Poornima Tom
+Pranava Y N
Prasad Malisetty
Prashant Malani
Pratik Vishwakarma
Pratikkumar Prajapati
Pratikkumar V Prajapati
Protectli
-Purism SPC
+PugzAreCute
Purism, SPC
Qii Wang
Qinghong Zeng
@@ -566,6 +631,7 @@ Ravindra
Ravishankar Sarawadi
Ray Han Lim Ng
Raymond Chung
+Reagan
Red Hat, Inc
ReddestDream
Rehan Ghori
@@ -583,6 +649,7 @@ Richard Woodruff
Rick Lee
Ricky Chang
Riku Viitanen
+Rishika Raj
Ritul Guru
Rizwan Qureshi
Rnhmjoj
@@ -602,6 +669,7 @@ Roman Zippel
Ron Lee
Ron Minnich
Ronak Kanabar
+Ronald Claveau
Ronald G. Minnich
Rory Liu
Rudolf Marek
@@ -623,6 +691,7 @@ Samuel Holland
Sandeep Maheswaram
Sathya Prakash M R
Satya Priya Kakitapalli
+Satya SreenivasL
Saurabh Mishra
SciTech Software, Inc.
Scott Chao
@@ -650,6 +719,7 @@ Shiyu Sun
Shon Wang
Shou-Chieh Hsu
Shreesh Chhabbi
+Shunxi Zhang
Shuo Liu
Siemens AG
SiFive, Inc
@@ -662,10 +732,12 @@ Simon Zhou
Sindhoor Tilak
Solomon Alan-Dei
Song Fan
+Sowmya Aralguppe
Sridhar Siricilla
Srinidhi N Kaushik
Srinivasa Rao Mandadapu
ST Microelectronics
+Stanisław Kardach
Stanley Wu
Star Labs Online Ltd
Stefan Binding
@@ -693,6 +765,7 @@ Tao Xia
Tarun Tuli
Teddy Shih
Terry Chen
+Terry Cheong
Texas Instruments
The Android Open Source Project
The ChromiumOS Authors
@@ -712,6 +785,7 @@ tinghan shen
Tobias Diedrich
Tom Hiller
Tommie Lin
+Tongtong Pan
Tony Huang
Tracy Wu
Trevor Wu
@@ -730,8 +804,10 @@ Uwe Poeche
V Sowmya
Václav Straka
Vadim Bendebury
+Valentyn Sudomyr
Van Chen
Varshit B Pandya
+Varun Upadhyay
Veerabhadrarao Badiganti
Venkat Thogaru
Venkata Krishna Nimmagadda
@@ -740,6 +816,7 @@ Victor Ding
Vidya Gopalakrishnan
Vikram Narayanan
Vikrant L Jadeja
+Vince Liu
Vinod Polimera
Vipin Kumar
Vitaly Rodionov
@@ -752,8 +829,10 @@ Ward Vandewege
Wayne Wang
Weimin Wu
Weiyi Lu
+Wen Zhang
Wenbin Mei
Wentao Qin
+Wenzhen Yu
Werner Zeh
Wilbert Duijvenvoorde
William Wei
@@ -772,7 +851,10 @@ Wonkyu Kim
Wuxy
Xiang W
Xin Ji
+Xiwen Shao
Xixi Chen
+Xue Yao
+Xueqi Zhang
Xuxin Xiong
YADRO
Yan Liu
@@ -792,14 +874,18 @@ Yu-Ping Wu
Yuanliding
Yuchen He
Yuchen Huang
+Yuchiche
Yunlong Jia
Yuval Peress
Zachary Yedidia
Zanxi Chen
+Zebreus
Zhanyong Wang
+Zhaoqing Jiu
Zheng Bao
Zhenguo Li
Zhi7 Li
+Zhigang Qin
Zhiqiang Ma
Zhixing Ma
Zhiyong Tao
diff --git a/Documentation/drivers/smmstorev2.md b/Documentation/drivers/smmstorev2.md
index cf714835a51f..b29ffa886f07 100644
--- a/Documentation/drivers/smmstorev2.md
+++ b/Documentation/drivers/smmstorev2.md
@@ -74,19 +74,30 @@ has to read the coreboot table with tag `0x0039`, containing:
struct lb_smmstorev2 {
uint32_t tag;
uint32_t size;
- uint32_t num_blocks; /* Number of writeable blocks in SMM */
- uint32_t block_size; /* Size of a block in byte. Default: 64 KiB */
- uint32_t mmap_addr; /* MMIO address of the store for read only access */
- uint32_t com_buffer; /* Physical address of the communication buffer */
- uint32_t com_buffer_size; /* Size of the communication buffer in byte */
- uint8_t apm_cmd; /* The command byte to write to the APM I/O port */
- uint8_t unused[3]; /* Set to zero */
+ uint32_t num_blocks; /* Number of writable blocks in SMM */
+ uint32_t block_size; /* Size of a block in byte. Default: 64 KiB */
+ uint32_t mmap_addr_deprecated; /* 32-bit MMIO address of the store for read only access.
+ Prefer 'mmap_addr' for new software.
+ Zero when the address won't fit into 32-bits. */
+ uint32_t com_buffer; /* Physical address of the communication buffer */
+ uint32_t com_buffer_size; /* Size of the communication buffer in bytes */
+ uint8_t apm_cmd; /* The command byte to write to the APM I/O port */
+ uint8_t unused[3]; /* Set to zero */
+ uint64_t mmap_addr; /* 64-bit MMIO address of the store for read only access.
+ Introduced after the initial implementation. Users of
+ this table must check the 'size' field to detect if its
+ written out by coreboot. */
};
```
The absence of this coreboot table entry indicates that there's no
SMMSTOREv2 support.
+`mmap_addr` is an optional field added after the initial implementation.
+Users of this table must check the size field to know if it's written by coreboot.
+In case it's not present 'mmap_addr_deprecated' is to be used as the SPI ROM MMIO
+address and it must be below 4 GiB.
+
### Blocks
The SMMSTOREv2 splits the SMMSTORE FMAP partition into smaller chunks
diff --git a/Documentation/internals/chip_operations.md b/Documentation/internals/chip_operations.md
new file mode 100644
index 000000000000..636b51372b5b
--- /dev/null
+++ b/Documentation/internals/chip_operations.md
@@ -0,0 +1,537 @@
+# The `chip_operations` Structure in coreboot
+
+## Introduction
+
+The `chip_operations` structure is a fundamental component of coreboot's
+chipset abstraction layer. It provides a standardized interface for chipset-
+specific code to interact with coreboot's device initialization framework.
+This structure enables coreboot to support a wide variety of chipsets
+while maintaining a consistent initialization flow across different hardware
+platforms.
+
+In coreboot's architecture, a "chip" refers to a collection of hardware
+components that form a logical unit, such as a System-on-Chip (SoC),
+a CPU, or a distinct southbridge/northbridge. The `chip_operations`
+structure provides the hooks necessary for coreboot to discover, configure,
+and initialize these components during the boot process.
+
+The `chip_operations` structure is particularly crucial for the ramstage
+portion of coreboot, where it connects the static device tree definitions
+with the actual hardware initialization code. It serves as the bridge
+between the declarative device descriptions and the imperative code that
+brings those devices to life.
+
+
+## Structure Definition
+
+The `chip_operations` structure is defined in `src/include/device/device.h`
+as follows:
+
+```c
+struct chip_operations {
+ void (*enable_dev)(struct device *dev);
+ void (*init)(void *chip_info);
+ void (*final)(void *chip_info);
+ unsigned int initialized : 1;
+ unsigned int finalized : 1;
+ const char *name;
+};
+```
+
+
+### Field Descriptions
+
+- **enable_dev**: A function pointer that takes a `struct device*`
+parameter. This function is called for each device associated with the
+chip during the device enumeration phase (specifically, within the
+`scan_bus` operations triggered by `dev_enumerate`). Its primary
+purpose is to set up device operations (`dev->ops`) based on the
+device's role in the system.
+
+- **init**: A function pointer that takes a `void*` parameter pointing to
+the chip's configuration data (typically cast to a chip-specific struct).
+This function is called during the chip initialization phase
+(`BS_DEV_INIT_CHIPS`), before device enumeration. It usually performs
+early hardware setup needed before individual devices can be configured.
+
+- **final**: A function pointer that takes a `void*` parameter pointing to
+the chip's configuration data (typically cast to a chip-specific struct).
+This function is called during the final table writing phase of coreboot
+initialization (`BS_WRITE_TABLES`), after all devices have been
+initialized. It performs any necessary cleanup or late initialization
+operations.
+
+- **initialized**: A bit flag indicating whether the chip's init function
+has been called.
+
+- **finalized**: A bit flag indicating whether the chip's final function
+has been called.
+
+- **name**: A string containing the human-readable name of the chip, used
+for debugging and logging purposes.
+
+
+## Initialization Sequence and `chip_operations`
+
+The `chip_operations` structure integrates with coreboot's boot state
+machine, which is defined in `src/lib/hardwaremain.c`. The functions in
+this structure are called at specific points during the boot process:
+
+1. **BS_DEV_INIT_CHIPS** state: The `init` function is called for each
+chip in the device tree. This is handled by `dev_initialize_chips()`
+which iterates through all devices, identifies unique chip instances,
+and invokes their `init` functions.
+
+2. **BS_DEV_ENUMERATE** state: During the execution of this state,
+`dev_enumerate()` is called, which triggers bus scanning
+(e.g., `pci_scan_bus`). Within these scan routines, the `enable_dev`
+function is called for devices associated with a chip. This commonly
+assigns the appropriate `device_operations` structure to each device
+based on its type and purpose.
+
+3. **BS_WRITE_TABLES** state: The `final` function is called for each
+chip by `dev_finalize_chips()` after all devices have been initialized
+and just before payloads are loaded.
+
+This sequence ensures that chips can perform necessary setup before their
+individual devices are configured, and also perform cleanup or finalization
+after all devices have been initialized but before the final tables are
+written and the payload is executed.
+
+
+## Relationship Between `chip_operations` and `device_operations`
+
+It's important to understand the distinction and relationship between
+`chip_operations` and `device_operations`:
+
+- **chip_operations**: Operates at the chipset or SoC level, providing
+hooks for chip-wide initialization. It's responsible for the overall
+setup of a collection of devices that belong to the same logical chip.
+
+- **device_operations**: Operates at the individual device level,
+providing functions to manage specific devices within a chip. These
+operations include resource allocation, device initialization, and device-
+specific functionality.
+
+The key relationship is that `chip_operations.enable_dev` is typically
+responsible for assigning the appropriate `device_operations` structure
+to each device based on its type and function. This is where the bridge
+between the chip-level and device-level abstractions occurs.
+
+For example, a typical implementation of the `enable_dev` function might
+look like this:
+
+```c
+static void soc_enable(struct device *dev)
+{
+ if (dev->path.type == DEVICE_PATH_DOMAIN)
+ dev->ops = &pci_domain_ops;
+ else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
+ dev->ops = &cpu_bus_ops;
+ else if (dev->path.type == DEVICE_PATH_GPIO)
+ block_gpio_enable(dev);
+ else if (dev->path.type == DEVICE_PATH_PCI &&
+ dev->path.pci.devfn == PCH_DEVFN_PMC)
+ dev->ops = &pmc_ops;
+}
+```
+
+This function examines each device's path type and assigns the appropriate
+operations based on the device's role in the system.
+
+
+## Integration with the Devicetree
+
+The `chip_operations` structure is tightly integrated with coreboot's
+devicetree mechanism. The devicetree is a hierarchical description of the
+hardware platform, defined in `.cb` files (typically `chipset.cb`,
+`devicetree.cb`, and optionally `overridetree.cb`).
+
+In the devicetree, a `chip` directive starts a collection of devices
+associated with a particular chip driver. The path specified with the
+`chip` directive corresponds to a directory in the coreboot source tree
+that contains the chip driver code, including a `chip.c` file that defines
+the `chip_operations` structure for that chip.
+
+For example, a devicetree might contain:
+
+```
+chip soc/intel/cannonlake
+ device domain 0 on
+ device pci 00.0 on end # Host Bridge
+ device pci 12.0 on end # Thermal Subsystem
+ # ... more devices ...
+ end
+end
+```
+
+This connects the devices under this chip directive with the
+`chip_operations` structure defined in
+`src/soc/intel/cannonlake/chip.c`:
+
+```c
+struct chip_operations soc_intel_cannonlake_ops = {
+ .name = "Intel Cannonlake",
+ .enable_dev = &soc_enable,
+ .init = &soc_init_pre_device,
+};
+```
+
+During coreboot's build process, the `sconfig` utility processes the
+devicetree files and generates code that links the devices defined in the
+devicetree with their corresponding `chip_operations` structures.
+
+
+## Chip Configuration Data
+
+Each chip typically defines a configuration structure in a `chip.h` file
+within its source directory. This structure contains configuration settings
+that can be specified in the devicetree using `register` directives.
+
+For example, a chip might define a configuration structure like:
+
+```c
+/* In src/soc/intel/cannonlake/chip.h */
+struct soc_intel_cannonlake_config {
+ uint8_t pcie_rp_aspm[CONFIG_MAX_ROOT_PORTS];
+ uint8_t usb2_ports[16];
+ uint8_t usb3_ports[10];
+ /* ... more configuration options ... */
+};
+```
+
+In the devicetree, you would configure these options using register
+directives:
+
+```
+chip soc/intel/cannonlake
+ register "pcie_rp_aspm[0]" = "ASPM_AUTO"
+ register "usb2_ports[5]" = "USB2_PORT_MID(OC_SKIP)"
+ # ... more register settings ...
+
+ device domain 0 on
+ # ... devices ...
+ end
+end
+```
+
+These configuration values are made available to the chip's `init` and
+`final` functions through the `chip_info` parameter, which points to
+an instance of the chip's configuration structure (after appropriate
+casting from `void *`).
+
+
+## Implementation Examples
+
+### Minimal Implementation
+
+Some chips may not need extensive initialization and can provide a
+minimal implementation of the `chip_operations` structure:
+
+```c
+struct chip_operations soc_ucb_riscv_ops = {
+ .name = "UCB RISC-V",
+};
+```
+
+This implementation only provides a name for debugging purposes but
+doesn't define any initialization functions.
+
+
+### Basic Implementation with Initialization
+
+A more typical implementation includes at least initialization hooks:
+
+```c
+struct chip_operations soc_amd_genoa_poc_ops = {
+ .name = "AMD Genoa SoC Proof of Concept",
+ .init = soc_init,
+ .final = soc_final,
+};
+```
+
+The `init` function might perform chip-wide initialization:
+
+```c
+static void soc_init(void *chip_info)
+{
+ default_dev_ops_root.write_acpi_tables = soc_acpi_write_tables;
+ amd_opensil_silicon_init();
+ data_fabric_print_mmio_conf();
+ fch_init(chip_info);
+}
+```
+
+
+### Complete Implementation
+
+A complete implementation includes all three function pointers:
+
+```c
+struct chip_operations soc_intel_xeon_sp_cpx_ops = {
+ .name = "Intel Cooper Lake-SP",
+ .enable_dev = chip_enable_dev,
+ .init = chip_init,
+ .final = chip_final,
+};
+```
+
+The `enable_dev` function would typically assign device operations
+based on device types:
+
+```c
+static void chip_enable_dev(struct device *dev)
+{
+ /* PCI root complex */
+ if (dev->path.type == DEVICE_PATH_DOMAIN)
+ dev->ops = &pci_domain_ops;
+ /* CPU cluster */
+ else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
+ dev->ops = &cpu_cluster_ops;
+ /* PCIe root ports */
+ else if (dev->path.type == DEVICE_PATH_PCI &&
+ PCI_SLOT(dev->path.pci.devfn) == PCIE_PORT1_SLOT)
+ dev->ops = &pcie_rp_ops;
+ /* ... other device types ... */
+}
+```
+
+
+### Mainboard Implementation
+
+It's also common for the mainboard-specific code (e.g.,
+`src/mainboard/vendor/board/mainboard.c`) to define its own
+`chip_operations`, often named `mainboard_ops`. The `mainboard_ops.init`
+can perform early board-level setup, and `mainboard_ops.enable_dev` can
+assign operations for devices specific to the mainboard or set default
+operations.
+
+```c
+/* Example from src/mainboard/google/zork/mainboard.c */
+struct chip_operations mainboard_ops = {
+ .enable_dev = mainboard_enable,
+ .init = mainboard_init,
+ .final = mainboard_final,
+};
+```
+
+
+## Device Registration and Discovery
+
+The `chip_operations` structure plays a key role in device registration
+and discovery within coreboot. Here's how it fits into this process:
+
+1. **Static Device Definition**: Devices are statically defined in the
+devicetree files (`chipset.cb`, `devicetree.cb`, `overridetree.cb`).
+
+2. **Code Generation**: The `sconfig` utility processes these files and
+generates code in `build/static.c` that creates the device structures
+and links them to their corresponding chip configuration data.
+
+3. **Chip Initialization**: During the `BS_DEV_INIT_CHIPS` boot state,
+`dev_initialize_chips()` calls each chip's `init` function to perform
+chip-wide setup.
+
+4. **Device Enumeration and Enabling**: During the `BS_DEV_ENUMERATE`
+ boot state, `dev_enumerate()` initiates bus scanning. The scan
+ functions call the associated chip's `enable_dev` function for each
+ device, which assigns the appropriate device operations (`dev->ops`).
+
+5. **Device Configuration and Initialization**: Subsequent boot states
+ (`BS_DEV_RESOURCES`, `BS_DEV_ENABLE`, `BS_DEV_INIT`) configure and
+ initialize the devices according to their assigned device operations.
+
+6. **Chip Finalization**: After all devices have been initialized,
+ `dev_finalize_chips()` calls each chip's `final` function during the
+ `BS_WRITE_TABLES` boot state.
+
+
+## Build Process Integration
+
+The `chip_operations` structures are integrated into the coreboot build
+process through several mechanisms:
+
+1. **Devicetree Processing**: The `sconfig` utility processes the
+devicetree files and generates code that creates and links the device
+structures.
+
+2. **Static Structure Declaration**: Each chip (and often the mainboard)
+ defines its `chip_operations` structure in its respective `.c` file.
+ These structures are collected during the build process.
+
+3. **External References**: The generated code in `build/static.c`
+includes external references to these `chip_operations` structures.
+
+4. **Linking**: The linker collects all the `chip_operations` structures
+and includes them in the final firmware image.
+
+This process ensures that the appropriate chip operations are available
+during the boot process for each chip included in the devicetree.
+
+
+## Best Practices for Implementing `chip_operations`
+
+When implementing the `chip_operations` structure for a new chip,
+follow these best practices:
+
+1. **Provide a Meaningful Name**: The `name` field should be descriptive
+and identify the chip clearly for debugging purposes.
+
+2. **Implement `enable_dev` Correctly**: The `enable_dev` function should
+assign the appropriate device operations based on device types and
+functions. It should handle all device types that might be part of the chip.
+Consider interactions with the mainboard `enable_dev`.
+
+3. **Use Configuration Data**: The `init` and `final` functions should
+make use of the chip configuration data passed via the `chip_info`
+parameter (casting it to the correct type) to configure the chip
+according to the settings specified in the devicetree.
+
+4. **Minimize Dependencies**: The `init` function should minimize
+dependencies on other chips being initialized, as the order of chip
+initialization is not guaranteed.
+
+5. **Handle Resources Properly**: If the chip manages resources (memory
+regions, I/O ports, etc.), ensure that these are properly allocated and
+assigned to devices, usually within the associated `device_operations`.
+
+6. **Implement Error Handling**: Include appropriate error handling in
+the initialization functions to handle hardware initialization failures
+gracefully.
+
+7. **Document Special Requirements**: If the chip has special
+requirements or dependencies, document these clearly in comments or
+accompanying documentation.
+
+
+## Troubleshooting `chip_operations` Issues
+
+When implementing or debugging `chip_operations`, you might encounter
+certain issues:
+
+1. **Missing Device Operations**: If devices are not being initialized
+properly, check that the `enable_dev` function is correctly
+assigning device operations based on device types. Ensure it's being
+called during bus scanning.
+
+2. **Initialization Order Problems**: If a chip's initialization depends
+on another chip being initialized first, you might need to adjust the
+initialization sequence or add explicit dependencies, possibly using
+boot state callbacks if necessary.
+
+3. **Configuration Data Issues**: If chip configuration settings are not
+being applied correctly, check that the configuration structure is
+correctly defined in `chip.h`, that the register values in the
+devicetree match the expected format, and that the `chip_info` pointer
+is cast correctly in the `init`/`final` functions.
+
+4. **Build Errors**: If you encounter build errors related to
+`chip_operations`, check that the structure is correctly defined and
+that all required symbols are properly exported and linked. Check for
+conflicts if multiple files define the same symbol.
+
+5. **Runtime Failures**: If the chip initialization fails at runtime,
+add debug logging (using `printk`) to the `init`, `enable_dev`, and
+`final` functions to identify the specific point of failure.
+
+
+## Advanced `chip_operations` Patterns
+
+### Hierarchical Chip Initialization
+
+For complex chips with multiple components, you can implement a
+hierarchical initialization pattern within the `init` function:
+
+```c
+static void soc_init(void *chip_info)
+{
+ /* Initialize common components first */
+ common_init(chip_info);
+
+ /* Initialize specific blocks */
+ pcie_init(chip_info);
+ usb_init(chip_info);
+ sata_init(chip_info);
+
+ /* Final SoC-wide configuration */
+ power_management_init(chip_info);
+}
+```
+
+
+### Variant Support
+
+For chips with multiple variants, you can implement variant detection
+and specific initialization within the `init` function:
+
+```c
+static void soc_init(void *chip_info)
+{
+ uint32_t variant = read_chip_variant();
+
+ /* Common initialization */
+ common_init(chip_info);
+
+ /* Variant-specific initialization */
+ switch (variant) {
+ case VARIANT_A:
+ variant_a_init(chip_info);
+ break;
+ case VARIANT_B:
+ variant_b_init(chip_info);
+ break;
+ default:
+ printk(BIOS_WARNING, "Unknown variant %u\\n", variant);
+ break;
+ }
+}
+```
+
+
+### Conditional Feature Initialization
+
+You can conditionally initialize features based on configuration settings
+passed via `chip_info`:
+
+```c
+static void soc_init(void *chip_info)
+{
+ struct soc_config *config = chip_info;
+
+ /* Always initialize core components */
+ core_init();
+
+ /* Conditionally initialize optional features */
+ if (config->enable_xhci)
+ xhci_init(config);
+
+ if (config->enable_sata)
+ sata_init(config);
+
+ if (config->enable_pcie)
+ pcie_init(config);
+}
+```
+
+
+## Conclusion
+
+The `chip_operations` structure is a fundamental component of coreboot's
+chipset abstraction layer. It provides a standardized interface for chipset-
+specific code to interact with coreboot's device initialization framework,
+enabling support for a wide variety of chipsets while maintaining a
+consistent initialization flow.
+
+By implementing the `chip_operations` structure for a specific chipset
+(and often for the mainboard), developers can integrate their
+hardware-specific code with coreboot's device enumeration, configuration,
+and initialization process. This structure serves as the bridge between
+the declarative device descriptions in the devicetree and the imperative
+code that initializes the hardware.
+
+Understanding the `chip_operations` structure and its role in the
+coreboot boot process is essential for anyone working on chipset or
+mainboard support in coreboot. By following the best practices and
+patterns outlined in this document, developers can create robust and
+maintainable hardware support code that integrates seamlessly with the
+coreboot firmware ecosystem.
diff --git a/Documentation/internals/device_operations.md b/Documentation/internals/device_operations.md
new file mode 100644
index 000000000000..c0c98d0ebf68
--- /dev/null
+++ b/Documentation/internals/device_operations.md
@@ -0,0 +1,696 @@
+# Device Operations in coreboot Firmware
+
+## Introduction
+
+The `device_operations` structure is a cornerstone of coreboot's
+hardware abstraction layer. It represents a set of function pointers
+defining how the firmware interacts with a specific hardware device
+during various boot stages. This structure lets the coreboot
+architecture establish a consistent interface for device initialization,
+configuration, resource allocation, and ACPI table generation, while
+allowing device-specific implementations behind this common interface.
+
+At its core, `device_operations` applies the strategy pattern in
+systems programming. It decouples algorithms (device operations) from
+the core boot sequence, allowing devices to define their own behavior
+while the boot process follows a predictable flow. This pattern enables
+coreboot to support a wide range of hardware platforms with minimal
+changes to the core boot sequence code.
+
+
+## Structure Definition
+
+The `device_operations` structure, defined in
+`src/include/device/device.h`, consists of several function pointers,
+each representing a specific operation performed on a device during
+boot:
+
+```c
+struct device_operations {
+ void (*read_resources)(struct device *dev);
+ void (*set_resources)(struct device *dev);
+ void (*enable_resources)(struct device *dev);
+ void (*init)(struct device *dev);
+ void (*final)(struct device *dev);
+ void (*scan_bus)(struct device *bus);
+ void (*enable)(struct device *dev);
+ void (*vga_disable)(struct device *dev);
+ void (*reset_bus)(struct bus *bus);
+
+ int (*get_smbios_data)(struct device *dev, int *handle,
+ unsigned long *current);
+ void (*get_smbios_strings)(struct device *dev, struct smbios_type11 *t);
+
+ unsigned long (*write_acpi_tables)(const struct device *dev,
+ unsigned long start, struct acpi_rsdp *rsdp);
+ void (*acpi_fill_ssdt)(const struct device *dev);
+ const char *(*acpi_name)(const struct device *dev);
+ const char *(*acpi_hid)(const struct device *dev);
+
+ const struct pci_operations *ops_pci;
+ const struct i2c_bus_operations *ops_i2c_bus;
+ const struct spi_bus_operations *ops_spi_bus;
+ const struct smbus_bus_operations *ops_smbus_bus;
+ const struct pnp_mode_ops *ops_pnp_mode;
+ const struct gpio_operations *ops_gpio;
+ const struct mdio_bus_operations *ops_mdio;
+};
+```
+
+
+### Core Resource Management Functions
+
+* `read_resources`: Discovers and collects resources required by the
+ device (I/O ports, memory regions, IRQs, etc.). This typically
+ involves reading configuration registers or static device tree
+ information.
+* `set_resources`: Assigns finalized resources to the device after the
+ resource allocation phase. This writes the assigned base addresses,
+ lengths, and other parameters back to the device structure, but not
+ necessarily to hardware registers yet.
+* `enable_resources`: Activates the assigned resources in the device's
+ hardware registers (e.g., writing to PCI BARs, enabling memory
+ decoding).
+
+
+### Device Lifecycle Functions
+
+* `init`: Performs device-specific initialization, often requiring
+ access to the device's assigned resources. This is called after
+ resources have been enabled.
+* `final`: Executes final setup or cleanup operations before the
+ payload is loaded. This is useful for tasks that depend on other
+ devices being initialized.
+* `enable`: Enables the device in the hardware, often setting bits in
+ configuration registers to make the device active. Called after
+ `enable_resources`.
+
+
+### Bus Management Functions
+
+* `scan_bus`: Enumerates child devices on a bus device (e.g., scanning
+ a PCI bus for devices, probing I2C devices). Only applicable to
+ devices that act as buses.
+* `reset_bus`: Resets all devices on a specific bus.
+* `vga_disable`: Disables VGA decoding on a PCI device when another VGA
+ device is active. Used to manage legacy VGA resources.
+
+
+### System Table Generation Functions
+
+* `get_smbios_data`: Provides SMBIOS data specific to the device for
+ Type 9 (System Slots) or Type 41 (Onboard Devices Extended
+ Information).
+* `get_smbios_strings`: Supplies string information for SMBIOS tables,
+ often related to the data provided by `get_smbios_data`.
+* `write_acpi_tables`: Generates device-specific ACPI tables (like SSDTs)
+ or contributes data to system-wide tables.
+* `acpi_fill_ssdt`: Adds device-specific objects (scopes, methods, data)
+ to the Secondary System Description Table (SSDT).
+* `acpi_name`: Returns the ACPI name for the device (e.g.,
+ `\_SB.PCI0.GFX0`). This defines the device's path in the ACPI
+ namespace.
+* `acpi_hid`: Returns the ACPI Hardware ID (HID) for the device (e.g.,
+ `PNP0A08`). Used by the OS to match drivers.
+
+
+### Bus-Specific Operation Pointers
+
+These fields point to bus-specific operation structures when a device
+functions as a bus controller (or exposes bus-like functionality). See
+the "Bus-Specific Operations" section for details.
+
+* `ops_pci`: Operations for PCI configuration space access.
+* `ops_i2c_bus`: Operations for I2C bus transactions (read, write,
+ transfer).
+* `ops_spi_bus`: Operations for SPI bus transactions.
+* `ops_smbus_bus`: Operations for SMBus transactions.
+* `ops_pnp_mode`: Operations for Plug-and-Play device configuration.
+* `ops_gpio`: Operations for GPIO control (get, set, configure
+ direction/pulls).
+* `ops_mdio`: Operations for MDIO (Management Data Input/Output) bus
+ access, used for Ethernet PHYs.
+
+
+## Device Lifecycle in coreboot
+
+The function pointers in `device_operations` are called at specific
+stages during the boot process, following a sequence defined in
+coreboot's boot state machine (`src/lib/hardwaremain.c`). Understanding
+this lifecycle helps developers implement appropriate behavior for each
+function pointer.
+
+
+### Boot Sequence and Device Operations
+
+coreboot's main device initialization sequence involves these boot
+states:
+
+1. **BS_DEV_INIT_CHIPS** (`dev_initialize_chips()`): Initializes chip
+ drivers (`chip_operations`).
+2. **BS_DEV_ENUMERATE** (`dev_enumerate()`): Discovers and enumerates
+ devices.
+ * Calls `scan_bus()` for each bus to detect child devices.
+3. **BS_DEV_RESOURCES** (`dev_configure()`): Allocates resources across
+ all enumerated devices.
+ * Calls `read_resources()` for each device to discover required
+ resources.
+ * Calls `set_resources()` for each device to assign allocated
+ resources back to the `struct device`.
+4. **BS_DEV_ENABLE** (`dev_enable()`): Enables devices and their
+ resources.
+ * Calls `enable_resources()` for each device to activate assigned
+ resources in hardware.
+ * Calls `enable()` for each device to perform general hardware
+ enablement.
+5. **BS_DEV_INIT** (`dev_initialize()`): Initializes devices.
+ * Calls `init()` for each device to perform device-specific setup.
+6. **BS_POST_DEVICE** (`dev_finalize()`): Finalizes devices before
+ payload loading.
+ * Calls `final()` for each device for any final cleanup or setup.
+
+The sequence is primarily driven by the `boot_states` array in
+`src/lib/hardwaremain.c`:
+
+```c
+static struct boot_state boot_states[] = {
+ /* ... other states ... */
+ BS_INIT_ENTRY(BS_PRE_DEVICE, bs_pre_device),
+ BS_INIT_ENTRY(BS_DEV_INIT_CHIPS, bs_dev_init_chips),
+ BS_INIT_ENTRY(BS_DEV_ENUMERATE, bs_dev_enumerate),
+ BS_INIT_ENTRY(BS_DEV_RESOURCES, bs_dev_resources),
+ BS_INIT_ENTRY(BS_DEV_ENABLE, bs_dev_enable),
+ BS_INIT_ENTRY(BS_DEV_INIT, bs_dev_init),
+ BS_INIT_ENTRY(BS_POST_DEVICE, bs_post_device),
+ /* ... other states ... */
+};
+```
+
+Later stages include ACPI and SMBIOS table generation, where functions
+like `write_acpi_tables()`, `acpi_fill_ssdt()`, `get_smbios_data()`, and
+`get_smbios_strings()` are invoked as part of the table construction
+process.
+
+
+## Inheritance and Code Reuse Patterns
+
+The `device_operations` structure enables several patterns for code
+reuse:
+
+
+### 1. Default Implementations
+
+coreboot provides default implementations for common device types (like
+root devices, PCI devices, PCI bridges), which can be used directly or
+extended. Chip or mainboard code often assigns these defaults if no
+specific driver is found.
+
+```c
+/* From src/device/root_device.c */
+struct device_operations default_dev_ops_root = {
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
+ .scan_bus = scan_static_bus,
+ .reset_bus = root_dev_reset,
+#if CONFIG(HAVE_ACPI_TABLES)
+ .acpi_name = root_dev_acpi_name,
+#endif
+};
+```
+
+
+### 2. No-op Functions
+
+Simple shim functions (often static inline) are provided for cases where
+a device doesn't need to implement specific operations. Using these avoids
+leaving function pointers NULL.
+
+```c
+/* From src/include/device/device.h */
+static inline void noop_read_resources(struct device *dev) {}
+static inline void noop_set_resources(struct device *dev) {}
+```
+
+
+### 3. Chain of Responsibility / Delegation
+
+Some implementations delegate to parent devices or use helper functions
+when they can't handle an operation themselves or when common logic can
+be shared. For example, ACPI name generation often traverses up the
+device tree.
+
+```c
+/* Simplified example logic */
+const char *acpi_device_name(const struct device *dev)
+{
+ const char *name = NULL;
+ const struct device *pdev = dev;
+
+ /* Check for device specific handler */
+ if (dev->ops && dev->ops->acpi_name) {
+ name = dev->ops->acpi_name(dev);
+ if (name)
+ return name; /* Device handled it */
+ }
+
+ /* Walk up the tree to find if any parent can provide a name */
+ while (pdev->upstream && pdev->upstream->dev) {
+ pdev = pdev->upstream->dev;
+ if (pdev->ops && pdev->ops->acpi_name) {
+ /* Note: Parent's acpi_name might handle the original child 'dev' */
+ name = pdev->ops->acpi_name(dev);
+ if (name)
+ return name; /* Parent handled it */
+ }
+ }
+
+ /* Fallback or default logic if needed */
+ return NULL;
+}
+```
+This pattern allows parent devices (like buses) to provide default
+behavior or naming schemes if a child device doesn't specify its own.
+
+
+## Implementation Examples
+
+These examples show typical `device_operations` assignments. Actual
+implementations might involve more conditional compilation based on
+Kconfig options.
+
+
+### PCI Device Operations (Default)
+
+```c
+/* From src/device/pci_device.c */
+struct device_operations default_pci_ops_dev = {
+ .read_resources = pci_dev_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,
+ /* Assigns PCI-specific operations */
+ .ops_pci = &pci_dev_ops_pci,
+};
+```
+
+
+### CPU Cluster Operations
+
+```c
+/* From src/soc/intel/alderlake/chip.c (representative example) */
+static struct device_operations cpu_bus_ops = {
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
+ .enable_resources = cpu_set_north_irqs,
+#if CONFIG(HAVE_ACPI_TABLES)
+ .acpi_fill_ssdt = cpu_fill_ssdt,
+#endif
+ /* CPU clusters often don't need scan_bus, init, etc. */
+};
+```
+
+
+### GPIO Controller Operations
+
+```c
+/* From src/soc/intel/common/block/gpio/gpio_dev.c */
+static struct gpio_operations gpio_ops = {
+ .get = gpio_get,
+ .set = gpio_set,
+ /* ... other GPIO functions ... */
+};
+
+struct device_operations block_gpio_ops = {
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
+ /* Assigns GPIO-specific operations */
+ .ops_gpio = &gpio_ops,
+};
+```
+
+
+## Registration and Discovery
+
+How are `device_operations` structures associated with `struct device`
+instances?
+
+
+### 1. Static Assignment (via `chip_operations`)
+
+For devices known at build time (defined in devicetree.cb), the
+`device_operations` structure is often assigned in the SOC's or
+mainboard's `chip_operations->enable_dev()` function based on the
+device path type or other properties.
+
+```c
+/* Example from src/soc/intel/alderlake/chip.c */
+static void soc_enable(struct device *dev)
+{
+ /* Assign ops based on the device's role in the tree */
+ if (dev->path.type == DEVICE_PATH_DOMAIN)
+ dev->ops = &pci_domain_ops; /* Handles PCI domain resources */
+ else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
+ dev->ops = &cpu_bus_ops; /* Handles CPU cluster setup */
+ else if (dev->path.type == DEVICE_PATH_GPIO)
+ block_gpio_enable(dev); /* Assigns block_gpio_ops */
+ /* ... other assignments for specific PCI devices, etc. ... */
+}
+```
+The `enable_dev` function is part of `struct chip_operations`, which
+handles broader chip-level initialization (see "Relationship with
+`chip_operations`" section).
+
+
+### 2. Dynamic Detection (PCI Drivers)
+
+For PCI devices discovered during bus scanning (`scan_bus`), coreboot
+looks through a list of registered PCI drivers (`_pci_drivers` array)
+to find one matching the device's vendor and device IDs.
+
+```c
+/* Logic from src/device/pci_device.c::set_pci_ops() */
+static void set_pci_ops(struct device *dev)
+{
+ struct pci_driver *driver;
+
+ /* Check if ops already assigned (e.g., by chip_ops->enable_dev) */
+ if (dev->ops)
+ return;
+
+ /* Look through registered PCI drivers */
+ for (driver = &_pci_drivers[0]; driver != &_epci_drivers[0]; driver++) {
+ if ((driver->vendor == dev->vendor) &&
+ device_id_match(driver, dev->device)) {
+ /* Found a matching driver, assign its ops */
+ dev->ops = (struct device_operations *)driver->ops;
+ printk(BIOS_SPEW, "%s: Assigned ops from driver for %04x:%04x\n",
+ dev_path(dev), driver->vendor, driver->device);
+ return; /* Stop searching */
+ }
+ }
+
+ /* Fall back to default operations if no specific driver found */
+ if (!dev->ops) {
+ if ((dev->hdr_type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) {
+ dev->ops = get_pci_bridge_ops(dev); /* Special ops for bridges */
+ } else {
+ dev->ops = &default_pci_ops_dev; /* Default for normal devices */
+ }
+ printk(BIOS_SPEW, "%s: Assigned default PCI ops\n", dev_path(dev));
+ }
+}
+```
+
+
+## Build Process Integration
+
+The `device_operations` structures are integrated into the coreboot
+build process:
+
+1. **Static Device Tree**: The mainboard's `devicetree.cb` defines the
+ initial device hierarchy. The build process converts this into C
+ code (`static.c`) containing `struct device` instances.
+2. **PCI Driver Registration**: PCI drivers (containing their own
+ `device_operations`) register themselves using the `__pci_driver`
+ linker set macro.
+
+ ```c
+ /* Example pattern */
+ struct pci_driver example_pci_driver __pci_driver = {
+ .ops = &example_device_ops, /* Pointer to device_operations */
+ .vendor = VENDOR_ID,
+ .device = DEVICE_ID, /* Or .devices for a list */
+ };
+ ```
+3. **Linking**: The build system collects all structures placed in the
+ `__pci_driver` section and creates the `_pci_drivers` array used by
+ `set_pci_ops()`. It ensures all necessary code (default ops, driver
+ ops, core device functions) is linked into the final firmware image.
+
+
+## Relationship with `chip_operations`
+
+It's important to distinguish `device_operations` from
+`chip_operations` (defined in `src/include/chip.h`).
+
+* `chip_operations`: Defines operations related to the overall chipset
+ or mainboard logic. It includes functions called earlier in the boot
+ process, like `enable_dev`, `init`, and `final`.
+ * `chip_operations->enable_dev()` is crucial as it often performs
+ initial setup for static devices and is the primary place where
+ `device_operations` pointers are *assigned* for non-PCI devices
+ based on their path or type.
+ * `chip_operations->init()` runs during `BS_DEV_INIT_CHIPS`, before
+ most `device_operations` functions.
+* `device_operations`: Defines operations for *individual* devices
+ within the device tree. These are called *after* the corresponding
+ `chip_operations` stage and operate on a specific `struct device`.
+
+Essentially, `chip_operations` sets the stage at the SoC/mainboard level,
+including assigning the correct `device_operations` to static devices,
+while `device_operations` handles the specific actions for each device
+later in the boot process.
+
+
+## Bus-Specific Operations
+
+The `ops_*` pointers within `struct device_operations` (e.g., `ops_pci`,
+`ops_i2c_bus`, `ops_spi_bus`, `ops_gpio`) provide a way for devices that
+act as bus controllers or expose bus-like interfaces to offer
+standardized access methods.
+
+* **Purpose:** They abstract the low-level details of interacting with
+ that specific bus type. For example, a PCI host bridge device will
+ implement `struct pci_operations` via its `ops_pci` pointer,
+ allowing other code to perform PCI config reads/writes through it
+ without knowing the exact hardware mechanism. Similarly, an I2C
+ controller device implements `struct i2c_bus_operations` via
+ `ops_i2c_bus` to provide standard `read`, `write`, and `transfer`
+ functions for that bus segment.
+* **Usage:** Code needing to interact with a bus first finds the
+ controller `struct device` in the tree, then accesses the relevant
+ bus operations through the appropriate `ops_*` pointer, passing the
+ target address or parameters. For instance, to talk to an I2C device
+ at address `0x50` on the bus controlled by `i2c_controller_dev`, one
+ might call:
+ `i2c_controller_dev->ops->ops_i2c_bus->transfer(...)`. Helper
+ functions often wrap this access pattern.
+* **Implementation:** The structures like `struct pci_operations`,
+ `struct i2c_bus_operations`, etc., are defined in corresponding
+ header files (e.g., `src/include/device/pci_ops.h`,
+ `src/include/drivers/i2c/i2c_bus.h`). Devices acting as controllers
+ provide concrete implementations of these functions, tailored to their
+ hardware.
+
+This mechanism allows coreboot to manage diverse bus types using a
+consistent device model, where the controller device itself exposes the
+necessary functions for interacting with devices on its bus.
+
+
+## Best Practices
+
+When implementing `device_operations`:
+
+1. **Leverage Defaults/No-ops**: Use default or no-op implementations
+ whenever possible. Only override functions that require custom
+ behavior for your specific device.
+2. **Error Handling**: Check return values from functions called within
+ your ops implementations and handle errors gracefully (e.g., log an
+ error, return an error code if applicable).
+3. **Resource Management**: In `read_resources`, accurately declare all
+ resources (MMIO, I/O ports, IRQs) your device needs, specifying
+ flags like fixed vs. alignment, or bridge vs. standard device.
+ Incorrect resource declaration is a common source of issues.
+4. **Initialization Order**: Be mindful of dependencies in `init`. If
+ your device relies on another device being fully initialized, consider
+ deferring that part of the initialization to the `final` callback,
+ which runs later.
+5. **Minimal Implementation**: Only implement the functions relevant to
+ your device type. A simple MMIO device might only need
+ `read_resources`, `set_resources`, `enable_resources`, and perhaps
+ ACPI functions. A bus device additionally needs `scan_bus`.
+6. **Bus Operations**: If implementing a bus controller, correctly
+ implement the corresponding bus operations structure (e.g.,
+ `struct pci_operations`, `struct i2c_bus_operations`) and assign it
+ to the appropriate `ops_*` field.
+7. **ACPI/SMBIOS**: If the device needs OS visibility via ACPI or
+ SMBIOS, implement the relevant functions (`acpi_name`, `acpi_hid`,
+ `acpi_fill_ssdt`, `get_smbios_data`, etc.). Ensure ACPI names and
+ HIDs are correct according to specifications and platform needs.
+
+
+## Logging and Debugging
+
+Use coreboot's logging facilities (`printk`) within your `device_operations`
+functions to provide visibility during development and debugging. Use
+appropriate log levels (e.g., `BIOS_DEBUG`, `BIOS_INFO`, `BIOS_ERR`).
+
+```c
+static void example_device_init(struct device *dev)
+{
+ printk(BIOS_DEBUG, "%s: Initializing device at %s\n", __func__,
+ dev_path(dev));
+
+ /* ... Device initialization code ... */
+ if (/* some condition */) {
+ printk(BIOS_SPEW, "%s: Condition met, applying setting X\n",
+ dev_path(dev));
+ /* ... */
+ }
+
+ if (/* error condition */) {
+ printk(BIOS_ERR, "%s: Failed to initialize feature Y!\n",
+ dev_path(dev));
+ /* Handle error */
+ }
+
+ printk(BIOS_DEBUG, "%s: Initialization complete for %s\n", __func__,
+ dev_path(dev));
+}
+```
+Consistent logging helps trace the boot process and pinpoint where issues
+occur.
+
+
+## Common Troubleshooting
+
+* **Missing Resource Declarations**:
+ * *Problem*: Device fails to function, or conflicts arise because a
+ required resource (MMIO range, I/O port, IRQ) was not declared
+ in `read_resources`. The resource allocator is unaware of the
+ need.
+ * *Solution*: Verify that `read_resources` correctly calls functions
+ like `pci_dev_read_resources` or manually adds all necessary
+ resources using functions like `mmio_resource()`,
+ `io_resource()`, etc. Check PCI BARs or device datasheets.
+* **Initialization Order Issues**:
+ * *Problem*: `init()` fails because it depends on another device
+ that hasn't been fully initialized yet (e.g., accessing a shared
+ resource like SMBus before the SMBus controller is ready).
+ * *Solution*: Move the dependent initialization code to the `final`
+ callback if possible. Alternatively, ensure the dependency is met
+ by careful ordering in the device tree or using boot state
+ callbacks if necessary for complex scenarios.
+* **Resource Conflicts**:
+ * *Problem*: Boot fails during resource allocation, or devices
+ misbehave because multiple devices requested the same
+ non-sharable resource (e.g., conflicting fixed MMIO regions).
+ * *Solution*: Review resource declarations in `read_resources` across
+ all relevant devices. Ensure fixed resources don't overlap. Check
+ if bridge windows are correctly defined and large enough. Use
+ coreboot's resource reporting logs to identify overlaps.
+* **ACPI Table Generation Errors**:
+ * *Problem*: The operating system fails to recognize the device,
+ assigns the wrong driver, or the device doesn't function correctly
+ (e.g., power management issues).
+ * *Solution*: Double-check the `acpi_name`, `acpi_hid`, `_CRS`
+ (generated from assigned resources), and `acpi_fill_ssdt`
+ implementations. Verify names match the ACPI hierarchy and HIDs
+ match expected driver bindings. Ensure SSDT methods correctly
+ access hardware. Use OS debugging tools (e.g., `acpidump`, Device
+ Manager errors) to diagnose.
+* **Incorrect `ops` Pointer Assigned**:
+ * *Problem*: Device behaves incorrectly because the wrong
+ `device_operations` structure was assigned (e.g., default PCI ops
+ assigned to a device needing a specific driver's ops).
+ * *Solution*: Check the logic in `chip_operations->enable_dev` (for
+ static devices) or the PCI driver registration (`__pci_driver`
+ macro and `set_pci_ops` fallback logic) to ensure the correct
+ `ops` structure is being selected and assigned based on device
+ type, path, or PCI ID. Add debug prints to verify which `ops`
+ structure is assigned.
+
+
+## Advanced Usage
+
+### Complex Device Hierarchies
+
+For devices with non-standard interactions or complex initialization,
+custom `device_operations` can be created, often inheriting from defaults
+but overriding specific functions.
+
+```c
+static void advanced_device_init(struct device *dev)
+{
+ /* First, perform standard PCI init */
+ pci_dev_init(dev);
+
+ /* Then, add custom initialization steps */
+ printk(BIOS_DEBUG, "%s: Performing advanced init\n", dev_path(dev));
+ /* ... custom register writes, configuration ... */
+}
+
+static const char *advanced_device_acpi_name(const struct device *dev)
+{
+ /* Provide a custom ACPI name based on some property */
+ if (/* condition */)
+ return "ADV0001";
+ else
+ return "ADV0002";
+}
+
+/* Combine default and custom operations */
+static struct device_operations advanced_device_ops = {
+ /* Inherit resource handling from default PCI ops */
+ .read_resources = pci_dev_read_resources,
+ .set_resources = pci_dev_set_resources,
+ .enable_resources = pci_dev_enable_resources,
+
+ /* Override init */
+ .init = advanced_device_init,
+
+ /* Override ACPI naming */
+ .acpi_name = advanced_device_acpi_name,
+ /* Other functions might use defaults or no-ops */
+};
+```
+
+### Dynamic Configuration based on Probing
+
+Some `init` or other op implementations might probe the device's
+capabilities or read configuration data (e.g., from SPD, VPD, or straps)
+and alter their behavior accordingly.
+
+```c
+static void conditional_device_init(struct device *dev)
+{
+ uint8_t feature_flags;
+
+ /* Read capability register from the device */
+ feature_flags = pci_read_config8(dev, EXAMPLE_CAP_REG);
+
+ printk(BIOS_DEBUG, "%s: Feature flags: 0x%02x\n", dev_path(dev),
+ feature_flags);
+
+ /* Conditional initialization based on detected features */
+ if (feature_flags & FEATURE_X_ENABLED) {
+ printk(BIOS_INFO, "%s: Initializing Feature X\n", dev_path(dev));
+ init_feature_x(dev);
+ }
+ if (feature_flags & FEATURE_Y_ENABLED) {
+ printk(BIOS_INFO, "%s: Initializing Feature Y\n", dev_path(dev));
+ init_feature_y(dev);
+ }
+}
+```
+
+
+## Conclusion
+
+The `device_operations` structure is a powerful abstraction mechanism in
+coreboot. It enables consistent handling of diverse hardware while
+allowing for device-specific behavior. By providing a standard interface
+for device operations throughout the boot process, it simplifies the
+codebase, enhances maintainability, and provides the extensibility needed
+to support new hardware platforms.
+
+Understanding this structure, its relationship with `chip_operations`,
+and its role in the boot process is essential for coreboot developers,
+particularly when adding support for new devices or debugging hardware
+initialization issues. By following the patterns and best practices
+outlined here, developers can create robust and reusable device driver
+implementations that integrate smoothly into the coreboot architecture.
diff --git a/Documentation/internals/index.md b/Documentation/internals/index.md
index 17dee55ada3b..56c822179376 100644
--- a/Documentation/internals/index.md
+++ b/Documentation/internals/index.md
@@ -10,5 +10,6 @@ programming APIs internal to coreboot
coreboot devicetree <devicetree.md>
coreboot devicetree language <devicetree_language.md>
-
+Chip Operations <chip_operations.md>
+Device Operations <device_operations>
```
diff --git a/src/arch/x86/c_start.S b/src/arch/x86/c_start.S
index fd61cab44d8e..acd26a41be95 100644
--- a/src/arch/x86/c_start.S
+++ b/src/arch/x86/c_start.S
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <cpu/x86/gdt.h>
#include <cpu/x86/post_code.h>
-#include <arch/ram_segs.h>
/* Place the stack in the bss section. It's not necessary to define it in
* the linker script. */
@@ -30,9 +30,9 @@ _start:
lgdt (%rax)
#else
lgdt %cs:gdtaddr
- ljmp $RAM_CODE_SEG, $1f
+ ljmp $GDT_CODE_SEG, $1f
#endif
-1: movl $RAM_DATA_SEG, %eax
+1: movl $GDT_DATA_SEG, %eax
movl %eax, %ds
movl %eax, %es
movl %eax, %ss
@@ -40,7 +40,7 @@ _start:
movl %eax, %fs
movl %eax, %gs /* Will be used for cpu_info */
#if ENV_X86_64
- mov $RAM_CODE_SEG64, %ecx
+ mov $GDT_CODE_SEG64, %ecx
call SetCodeSelector
#endif
@@ -152,46 +152,44 @@ gdtaddr:
.data
- /* This is the gdt for GCC part of coreboot.
+ /*
+ * This is the gdt for coreboot's ramstage.
* It is different from the gdt in ASM part of coreboot
* which is defined in gdt_init.S
*
* When the machine is initially started, we use a very simple
* gdt from ROM (that in gdt_init.S) which only contains those
- * entries we need for protected mode.
+ * entries we need for protected mode and long mode.
*
* When we're executing code from RAM, we want to do more complex
* stuff, like initializing PCI option ROMs in real mode, or doing
- * a resume from a suspend to RAM.
+ * a resume from a suspend to RAM, which happens in real mode.
+ *
+ * Keep in sync with 'cpu/x86/gdt.h'.
*/
gdt:
/* selgdt 0, unused */
.word 0x0000, 0x0000 /* dummy */
.byte 0x00, 0x00, 0x00, 0x00
- /* selgdt 8, unused */
- .word 0x0000, 0x0000 /* dummy */
- .byte 0x00, 0x00, 0x00, 0x00
-
- /* selgdt 0x10, flat code segment */
+ /* selgdt 0x08, flat code segment */
.word 0xffff, 0x0000
- .byte 0x00, 0x9b, 0xcf, 0x00 /* G=1 and 0x0f, So we get 4Gbytes for
- * limit
- */
+ .byte 0x00, 0x9b, 0xcf, 0x00 /* G=1 and 0x0f, So we get 4Gbytes
+ for limit */
- /* selgdt 0x18, flat data segment */
+ /* selgdt 0x10, flat data segment */
.word 0xffff, 0x0000
-#if ENV_X86_64
- .byte 0x00, 0x92, 0xcf, 0x00
-#else
.byte 0x00, 0x93, 0xcf, 0x00
-#endif
- /* selgdt 0x20, unused */
- .word 0x0000, 0x0000 /* dummy */
- .byte 0x00, 0x00, 0x00, 0x00
+ /* selgdt 0x18, flat code segment (64-bit) */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x9b, 0xaf, 0x00
+
+ /* gdt selector 0x20 tss segment, used by STM */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x8b, 0x80, 0x00
- /* The next two entries are used for executing VGA option ROMs */
+ /* The next two entries are used for executing ACPI S3 RESUME and VGA option ROMs */
/* selgdt 0x28 16 bit 64k code at 0x00000000 */
.word 0xffff, 0x0000
@@ -201,34 +199,25 @@ gdt:
.word 0xffff, 0x0000
.byte 0, 0x92, 0, 0
- /* The next two entries are used for ACPI S3 RESUME */
+ /* The next entry is used for VGA option ROMs. See x86_asm.S */
- /* selgdt 0x38, flat data segment 16 bit */
- .word 0x0000, 0x0000 /* dummy */
- .byte 0x00, 0x93, 0x8f, 0x00 /* G=1 and 0x0f, So we get 4Gbytes for
- * limit
- */
-
- /* selgdt 0x40, flat code segment 16 bit */
+ /*
+ * selgdt 0x38, flat code segment 16 bits
+ *
+ * FIXME: It's only used in %ds (therefore used like a data segment).
+ * The PCI Specification doesn't enforce this.
+ * Is this a workaround for broken Option ROMs?
+ */
.word 0xffff, 0x0000
.byte 0x00, 0x9b, 0x8f, 0x00 /* G=1 and 0x0f, So we get 4Gbytes for
* limit
*/
-#if ENV_X86_64
- /* selgdt 0x48, flat x64 code segment */
- .word 0xffff, 0x0000
- .byte 0x00, 0x9b, 0xaf, 0x00
-#endif
per_cpu_segment_descriptors:
.rept CONFIG_MAX_CPUS
/* flat data segment */
.word 0xffff, 0x0000
-#if ENV_X86_64
- .byte 0x00, 0x92, 0xcf, 0x00
-#else
.byte 0x00, 0x93, 0xcf, 0x00
-#endif
.endr
gdt_end:
diff --git a/src/arch/x86/exception.c b/src/arch/x86/exception.c
index 224f0e1d4164..e21cfa6de583 100644
--- a/src/arch/x86/exception.c
+++ b/src/arch/x86/exception.c
@@ -665,6 +665,8 @@ asmlinkage void exception_init(void)
load_idt(idt, sizeof(idt));
+#if !ENV_SMM
null_breakpoint_init();
stack_canary_breakpoint_init();
+#endif
}
diff --git a/src/arch/x86/include/arch/ram_segs.h b/src/arch/x86/include/arch/ram_segs.h
deleted file mode 100644
index 3f92a1f6803a..000000000000
--- a/src/arch/x86/include/arch/ram_segs.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef RAM_SEGS_H
-#define RAM_SEGS_H
-
-#define RAM_CODE_SEG 0x10
-#define RAM_DATA_SEG 0x18
-#define RAM_CODE16_SEG 0x28
-#define RAM_DATA16_SEG 0x30
-#define RAM_CODE_ACPI_SEG 0x38
-#define RAM_DATA_ACPI_SEG 0x40
-#define RAM_CODE_SEG64 0x48
-
-#endif /* RAM_SEGS_H */
diff --git a/src/arch/x86/include/arch/rom_segs.h b/src/arch/x86/include/arch/rom_segs.h
deleted file mode 100644
index a7e31d29511d..000000000000
--- a/src/arch/x86/include/arch/rom_segs.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef ROM_SEGS_H
-#define ROM_SEGS_H
-
-#define ROM_CODE_SEG 0x08
-#define ROM_DATA_SEG 0x10
-#define ROM_CODE_SEG64 0x18
-
-/*
- * This define is placed here to make sure future romstage programmers
- * know about it.
- * It is used for STM setup code.
- */
-#define SMM_TASK_STATE_SEG 0x20
-
-#endif /* ROM_SEGS_H */
diff --git a/src/arch/x86/wakeup.S b/src/arch/x86/wakeup.S
index 7bff006d14bc..1afc31173553 100644
--- a/src/arch/x86/wakeup.S
+++ b/src/arch/x86/wakeup.S
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#include <arch/ram_segs.h>
+#include <cpu/x86/gdt.h>
#define WAKEUP_BASE 0x600
#define RELOCATED(x) (x - __wakeup + WAKEUP_BASE)
@@ -31,7 +31,7 @@ __wakeup:
add $8, %rax
push %rax
pushfq
- push $RAM_CODE_SEG
+ push $GDT_CODE_SEG
lea 3(%rip), %rax
push %rax
iretq
@@ -60,7 +60,7 @@ __wakeup:
movw %ax, (__wakeup_segment)
/* Activate the right segment descriptor real mode. */
- ljmp $RAM_CODE16_SEG, $RELOCATED(1f)
+ ljmp $GDT_CODE16_SEG, $RELOCATED(1f)
1:
.code16
/* 16 bit code from here on... */
@@ -70,7 +70,7 @@ __wakeup:
* configurations (limits, writability, etc.) once
* protected mode is turned off.
*/
- mov $RAM_DATA16_SEG, %ax
+ mov $GDT_DATA16_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h
index 78dbe8ef4c51..7860a413ce07 100644
--- a/src/commonlib/include/commonlib/coreboot_tables.h
+++ b/src/commonlib/include/commonlib/coreboot_tables.h
@@ -539,11 +539,17 @@ struct lb_smmstorev2 {
uint32_t size;
uint32_t num_blocks; /* Number of writable blocks in SMM */
uint32_t block_size; /* Size of a block in byte. Default: 64 KiB */
- uint32_t mmap_addr; /* MMIO address of the store for read only access */
+ uint32_t mmap_addr_deprecated; /* 32-bit MMIO address of the store for read only access.
+ Prefer 'mmap_addr' for new software.
+ Zero when the address won't fit into 32-bits. */
uint32_t com_buffer; /* Physical address of the communication buffer */
uint32_t com_buffer_size; /* Size of the communication buffer in bytes */
uint8_t apm_cmd; /* The command byte to write to the APM I/O port */
uint8_t unused[3]; /* Set to zero */
+ uint64_t mmap_addr; /* 64-bit MMIO address of the store for read only access.
+ Introduced after the initial implementation. Users of
+ this table must check the 'size' field to detect if its
+ written out by coreboot. */
};
enum lb_tpm_ppi_tpm_version {
diff --git a/src/cpu/x86/64bit/entry64.inc b/src/cpu/x86/64bit/entry64.inc
index 52da6037d554..a9f7ba49a8e2 100644
--- a/src/cpu/x86/64bit/entry64.inc
+++ b/src/cpu/x86/64bit/entry64.inc
@@ -17,12 +17,8 @@
#endif
#endif
+#include <cpu/x86/gdt.h>
#include <cpu/x86/msr.h>
-#if defined(__RAMSTAGE__)
-#include <arch/ram_segs.h>
-#else
-#include <arch/rom_segs.h>
-#endif
.macro setup_longmode page_table
/* Get page table address */
@@ -48,12 +44,8 @@
movl %eax, %cr0
/* use long jump to switch to 64-bit code segment */
-#if defined(__RAMSTAGE__)
- ljmp $RAM_CODE_SEG64, $jmp_addr\@
-#else
- ljmp $ROM_CODE_SEG64, $jmp_addr\@
+ ljmp $GDT_CODE_SEG64, $jmp_addr\@
-#endif
.code64
jmp_addr\@:
.endm
diff --git a/src/cpu/x86/64bit/exit32.inc b/src/cpu/x86/64bit/exit32.inc
index 3ac86a9df101..a3d215e785b6 100644
--- a/src/cpu/x86/64bit/exit32.inc
+++ b/src/cpu/x86/64bit/exit32.inc
@@ -10,17 +10,9 @@
*/
.code64
+#include <cpu/x86/gdt.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/cr.h>
-#if defined(__RAMSTAGE__)
-#include <arch/ram_segs.h>
-#define CODE_SEG RAM_CODE_SEG
-#define DATA_SEG RAM_DATA_SEG
-#else
-#include <arch/rom_segs.h>
-#define CODE_SEG ROM_CODE_SEG
-#define DATA_SEG ROM_DATA_SEG
-#endif
drop_longmode:
#if !ENV_CACHE_AS_RAM
@@ -28,7 +20,7 @@ drop_longmode:
wbinvd
#endif
/* Set 32-bit code segment and ss */
- mov $CODE_SEG, %rcx
+ mov $GDT_CODE_SEG, %rcx
/* SetCodeSelector32 will drop us to protected mode on return */
call SetCodeSelector32
@@ -63,7 +55,7 @@ __longmode_compatibility:
/* Running in 32-bit compatibility mode */
/* Use flat data segment */
- movl $DATA_SEG, %eax
+ movl $GDT_DATA_SEG, %eax
movl %eax, %ds
movl %eax, %es
movl %eax, %ss
diff --git a/src/cpu/x86/entry16.S b/src/cpu/x86/entry16.S
index ff4f1a26d04f..b19ffa5d6aff 100644
--- a/src/cpu/x86/entry16.S
+++ b/src/cpu/x86/entry16.S
@@ -27,7 +27,7 @@
/* Start code to put an i386 or later processor into 32-bit protected mode.
*/
-#include <arch/rom_segs.h>
+#include <cpu/x86/gdt.h>
#include <cpu/x86/post_code.h>
.section .init._start, "ax", @progbits
@@ -136,7 +136,7 @@ _start16bit:
movl %ebp, %eax
/* Now that we are in protected mode jump to a 32 bit code segment. */
- ljmpl $ROM_CODE_SEG, $bootblock_protected_mode_entry
+ ljmpl $GDT_CODE_SEG, $bootblock_protected_mode_entry
/**
* The gdt is defined in gdt_init.S, it has a 4 Gb code segment
diff --git a/src/cpu/x86/entry32.S b/src/cpu/x86/entry32.S
index 5c29581090a8..d013cbaf602a 100644
--- a/src/cpu/x86/entry32.S
+++ b/src/cpu/x86/entry32.S
@@ -11,7 +11,7 @@
*
*/
-#include <arch/rom_segs.h>
+#include <cpu/x86/gdt.h>
#include <cpu/x86/cr.h>
#include <cpu/x86/post_code.h>
@@ -33,7 +33,7 @@ bootblock_protected_mode_entry:
post_code(POSTCODE_ENTER_PROTECTED_MODE)
- movw $ROM_DATA_SEG, %ax
+ movw $GDT_DATA_SEG, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
diff --git a/src/cpu/x86/mtrr/Makefile.mk b/src/cpu/x86/mtrr/Makefile.mk
index c74f014531d5..2846280d258f 100644
--- a/src/cpu/x86/mtrr/Makefile.mk
+++ b/src/cpu/x86/mtrr/Makefile.mk
@@ -1,5 +1,11 @@
## SPDX-License-Identifier: GPL-2.0-only
+bootblock-y += mtrrlib.c
+verstage_x86-y += mtrrlib.c
+romstage-y += mtrrlib.c
+postcar-y += mtrrlib.c
+ramstage-y += mtrrlib.c
+
ramstage-y += mtrr.c
romstage-y += earlymtrr.c
diff --git a/src/cpu/x86/mtrr/earlymtrr.c b/src/cpu/x86/mtrr/earlymtrr.c
index 6c819a8c46f3..4ca7a0a5a4dc 100644
--- a/src/cpu/x86/mtrr/earlymtrr.c
+++ b/src/cpu/x86/mtrr/earlymtrr.c
@@ -7,67 +7,14 @@
#include <commonlib/bsd/helpers.h>
#include <types.h>
-/* Get first available variable MTRR.
- * Returns var# if available, else returns -1.
- */
-int get_free_var_mtrr(void)
-{
- msr_t maskm;
- int vcnt;
- int i;
-
- vcnt = get_var_mtrr_count();
-
- /* Identify the first var mtrr which is not valid. */
- for (i = 0; i < vcnt; i++) {
- maskm = rdmsr(MTRR_PHYS_MASK(i));
- if ((maskm.lo & MTRR_PHYS_MASK_VALID) == 0)
- return i;
- }
-
- /* No free var mtrr. */
- return -1;
-}
-
-void set_var_mtrr(
- unsigned int reg, unsigned int base, unsigned int size,
- unsigned int type)
-{
- /* Bit 32-35 of MTRRphysMask should be set to 1 */
- /* 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)
- printk(BIOS_ERR, "MTRR Error: size %#x smaller than 4KiB\n", size);
- if (base % size != 0)
- printk(BIOS_ERR, "MTRR Error: base %#x must be aligned to size %#x\n", base,
- size);
-
- basem.lo = base | type;
- basem.hi = 0;
- wrmsr(MTRR_PHYS_BASE(reg), basem);
- maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID;
- maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1;
- wrmsr(MTRR_PHYS_MASK(reg), maskm);
-}
-
void clear_all_var_mtrr(void)
{
- msr_t mtrr = { .raw = 0 };
int vcnt;
- int i;
vcnt = get_var_mtrr_count();
- for (i = 0; i < vcnt; i++) {
- wrmsr(MTRR_PHYS_MASK(i), mtrr);
- wrmsr(MTRR_PHYS_BASE(i), mtrr);
- }
+ for (int i = 0; i < vcnt; i++)
+ clear_var_mtrr(i);
}
void var_mtrr_context_init(struct var_mtrr_context *ctx)
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index 0d31cab769e6..33fc46e362de 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -369,14 +369,6 @@ struct var_mtrr_state {
struct var_mtrr_regs *regs;
};
-static void clear_var_mtrr(int index)
-{
- msr_t msr = { .lo = 0, .hi = 0 };
-
- wrmsr(MTRR_PHYS_BASE(index), msr);
- wrmsr(MTRR_PHYS_MASK(index), msr);
-}
-
static int get_os_reserved_mtrrs(void)
{
return CONFIG(RESERVE_MTRRS_FOR_OS) ? 2 : 0;
diff --git a/src/cpu/x86/mtrr/mtrrlib.c b/src/cpu/x86/mtrr/mtrrlib.c
new file mode 100644
index 000000000000..fe6bd6aef51e
--- /dev/null
+++ b/src/cpu/x86/mtrr/mtrrlib.c
@@ -0,0 +1,85 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <cpu/cpu.h>
+#include <cpu/x86/mtrr.h>
+#include <cpu/x86/msr.h>
+#include <console/console.h>
+#include <commonlib/bsd/helpers.h>
+#include <types.h>
+
+/*
+ * Get first available variable MTRR.
+ * Returns var# if available, else returns -1.
+ */
+int get_free_var_mtrr(void)
+{
+ msr_t maskm;
+ int vcnt;
+ int i;
+
+ vcnt = get_var_mtrr_count();
+
+ /* Identify the first var mtrr which is not valid. */
+ for (i = 0; i < vcnt; i++) {
+ maskm = rdmsr(MTRR_PHYS_MASK(i));
+ if ((maskm.lo & MTRR_PHYS_MASK_VALID) == 0)
+ return i;
+ }
+
+ /* No free var mtrr. */
+ return -1;
+}
+
+/*
+ * Sets the specified variable MTRR (as per index) with the
+ * given base, size, and memory type.
+ */
+void set_var_mtrr(
+ unsigned int index, unsigned int base, unsigned int size,
+ unsigned int type)
+{
+ /* Bit 32-35 of MTRRphysMask should be set to 1 */
+ /* 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)
+ printk(BIOS_ERR, "MTRR Error: size %#x smaller than 4KiB\n", size);
+ if (base % size != 0)
+ printk(BIOS_ERR, "MTRR Error: base %#x must be aligned to size %#x\n", base,
+ size);
+
+ basem.lo = base | type;
+ basem.hi = 0;
+ wrmsr(MTRR_PHYS_BASE(index), basem);
+ maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID;
+ maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1;
+ wrmsr(MTRR_PHYS_MASK(index), maskm);
+}
+
+/* Disables the variable MTRR at the given index by clearing its base and mask MSRs. */
+void clear_var_mtrr(int index)
+{
+ msr_t msr = { .lo = 0, .hi = 0 };
+
+ wrmsr(MTRR_PHYS_BASE(index), msr);
+ wrmsr(MTRR_PHYS_MASK(index), msr);
+}
+
+/*
+ * Acquires a free variable MTRR, configures it with the given base, size, and type.
+ * Returns the MTRR index if successful (>=0), or an error code (<0) if acquisition failed.
+ */
+int acquire_and_configure_mtrr(unsigned int base, unsigned int size, unsigned int type)
+{
+ int index = get_free_var_mtrr();
+
+ if (index >= 0)
+ set_var_mtrr(index, base, size, type);
+
+ return index;
+}
diff --git a/src/cpu/x86/sipi_vector.S b/src/cpu/x86/sipi_vector.S
index b7d700fb3946..6057282d765d 100644
--- a/src/cpu/x86/sipi_vector.S
+++ b/src/cpu/x86/sipi_vector.S
@@ -1,9 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <cpu/x86/cr.h>
+#include <cpu/x86/gdt.h>
#include <cpu/amd/mtrr.h>
#include <cpu/x86/msr.h>
-#include <arch/ram_segs.h>
#define __RAMSTAGE__
#include <cpu/x86/64bit/entry64.inc>
@@ -77,10 +77,10 @@ _start:
orl $CR0_SET_FLAGS, %eax
movl %eax, %cr0
- ljmpl $RAM_CODE_SEG, $1f
+ ljmpl $GDT_CODE_SEG, $1f
1:
.code32
- movw $RAM_DATA_SEG, %ax
+ movw $GDT_DATA_SEG, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c
index d25b5f47cf4f..d9f64204d6da 100644
--- a/src/cpu/x86/smm/smm_module_handler.c
+++ b/src/cpu/x86/smm/smm_module_handler.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/io.h>
+#include <arch/exception.h>
#include <commonlib/region.h>
#include <console/cbmem_console.h>
#include <console/console.h>
@@ -169,6 +170,9 @@ asmlinkage void smm_handler_start(void *arg)
printk(BIOS_SPEW, "\nSMI# #%d\n", cpu);
+ if (CONFIG(DEBUG_SMI) && CONFIG(CONSOLE_SERIAL))
+ exception_init();
+
/* Allow drivers to initialize variables in SMM context. */
if (do_driver_init) {
#if CONFIG(SPI_FLASH_SMM)
diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S
index ae8e047f4efe..dcfbcba5909c 100644
--- a/src/cpu/x86/smm/smm_stub.S
+++ b/src/cpu/x86/smm/smm_stub.S
@@ -9,8 +9,8 @@
* found in smm.h.
*/
-#include <arch/rom_segs.h>
#include <cpu/x86/cr.h>
+#include <cpu/x86/gdt.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/lapic_def.h>
#include <cpu/x86/64bit/entry64.inc>
@@ -48,7 +48,6 @@ fallback_stack_top:
.code16
.global _start
_start:
-smm_handler_start:
#if CONFIG(SMM_LAPIC_REMAP_MITIGATION)
/* Check if the LAPIC register block overlaps with the stub.
* This block needs to work without data accesses because they
@@ -94,7 +93,7 @@ untampered_lapic:
movl %eax, %cr0
/* Enable protected mode */
- ljmpl $ROM_CODE_SEG, $smm_trampoline32
+ ljmpl $GDT_CODE_SEG, $smm_trampoline32
.align 4
smm_relocate_gdt:
@@ -125,7 +124,7 @@ smm_relocate_gdt_end:
.global smm_trampoline32
smm_trampoline32:
/* Use flat data segment */
- movw $ROM_DATA_SEG, %ax
+ movw $GDT_DATA_SEG, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
diff --git a/src/device/oprom/realmode/x86_asm.S b/src/device/oprom/realmode/x86_asm.S
index ff33c0f4ba9d..39c504bad7d9 100644
--- a/src/device/oprom/realmode/x86_asm.S
+++ b/src/device/oprom/realmode/x86_asm.S
@@ -3,7 +3,7 @@
#define REALMODE_BASE 0x600
#define RELOCATED(x) (x - __realmode_code + REALMODE_BASE)
-#include <arch/ram_segs.h>
+#include <cpu/x86/gdt.h>
/* CR0 bits */
#define PE (1 << 0)
@@ -97,7 +97,7 @@ __realmode_call:
movl %eax, __registers + 20 /* edi */
/* Activate the right segment descriptor real mode. */
- ljmp $RAM_CODE16_SEG, $RELOCATED(1f)
+ ljmp $GDT_CODE16_SEG, $RELOCATED(1f)
1:
.code16
/* 16 bit code from here on... */
@@ -107,7 +107,7 @@ __realmode_call:
* configurations (limits, writability, etc.) once
* protected mode is turned off.
*/
- mov $RAM_DATA16_SEG, %ax
+ mov $GDT_DATA16_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -144,13 +144,13 @@ __realmode_call:
movl __registers + 16, %esi
movl __registers + 20, %edi
- /* Set all segments to 0x0000, ds to 0x0040 */
+ /* Set all segments to 0x0000, ds to 0x0038 */
push %ax
xor %ax, %ax
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
- mov $RAM_DATA_ACPI_SEG, %ax
+ mov $GDT_DATA_ACPI_SEG, %ax
mov %ax, %ds
pop %ax
@@ -177,10 +177,10 @@ __lcall_instr = RELOCATED(.)
/* Now that we are in protected mode
* jump to a 32 bit code segment.
*/
- ljmpl $RAM_CODE_SEG, $RELOCATED(1f)
+ ljmpl $GDT_CODE_SEG, $RELOCATED(1f)
1:
.code32
- mov $RAM_DATA_SEG, %ax
+ mov $GDT_DATA_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -233,7 +233,7 @@ __realmode_interrupt:
movl %eax, __registers + 20 /* edi */
/* This configures CS properly for real mode. */
- ljmp $RAM_CODE16_SEG, $RELOCATED(1f)
+ ljmp $GDT_CODE16_SEG, $RELOCATED(1f)
1:
.code16 /* 16 bit code from here on... */
@@ -241,7 +241,7 @@ __realmode_interrupt:
* descriptors. They will retain these configurations (limits,
* writability, etc.) once protected mode is turned off.
*/
- mov $RAM_DATA16_SEG, %ax
+ mov $GDT_DATA16_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -305,10 +305,10 @@ __intXX_instr = RELOCATED(.)
movl %eax, %cr0
/* Now that we are in protected mode jump to a 32-bit code segment. */
- ljmpl $RAM_CODE_SEG, $RELOCATED(1f)
+ ljmpl $GDT_CODE_SEG, $RELOCATED(1f)
1:
.code32
- mov $RAM_DATA_SEG, %ax
+ mov $GDT_DATA_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -354,10 +354,10 @@ __interrupt_handler_16bit = RELOCATED(.)
movl %eax, %cr0
/* ... and jump to a 32 bit code segment. */
- ljmpl $RAM_CODE_SEG, $RELOCATED(1f)
+ ljmpl $GDT_CODE_SEG, $RELOCATED(1f)
1:
.code32
- mov $RAM_DATA_SEG, %ax
+ mov $GDT_DATA_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -371,14 +371,14 @@ __interrupt_handler_16bit = RELOCATED(.)
call *%eax
/* Now return to real mode ... */
- ljmp $RAM_CODE16_SEG, $RELOCATED(1f)
+ ljmp $GDT_CODE16_SEG, $RELOCATED(1f)
1:
.code16
/* Load the segment registers with properly configured segment
* descriptors. They will retain these configurations (limits,
* writability, etc.) once protected mode is turned off.
*/
- mov $RAM_DATA16_SEG, %ax
+ mov $GDT_DATA16_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig
index 942591585d8e..715ec2a759bd 100644
--- a/src/drivers/intel/fsp2_0/Kconfig
+++ b/src/drivers/intel/fsp2_0/Kconfig
@@ -475,4 +475,22 @@ config BUILDING_WITH_DEBUG_FSP
Enable this option if you are using a debug build of the FSP (Firmware Support Package)
in your project.
+config USE_COREBOOT_FOR_BMP_RENDERING
+ bool
+ default n
+ help
+ This option forces coreboot to use its native bitmap (BMP) image rendering
+ and skip using the FSP for this purpose during the boot process.
+
+ If this option is selected (y), the platform will rely on the
+ coreboot native implementation for rendering BMP images. This might be
+ chosen if there are issues with FSP rendering or if native rendering
+ is preferred for specific reasons.
+
+ If this option is not selected (n), the FSP's capabilities for BMP rendering
+ will be utilized.
+
+ Platforms can choose to override this Kconfig option based on their
+ specific graphics requirements and FSP capabilities.
+
endif
diff --git a/src/drivers/intel/fsp2_0/Makefile.mk b/src/drivers/intel/fsp2_0/Makefile.mk
index 18a62e3b5796..16905ca3734b 100644
--- a/src/drivers/intel/fsp2_0/Makefile.mk
+++ b/src/drivers/intel/fsp2_0/Makefile.mk
@@ -35,6 +35,7 @@ ramstage-$(CONFIG_FSP_NVS_DATA_POST_SILICON_INIT) += save_mrc_data.c
ramstage-$(CONFIG_MMA) += mma_core.c
ramstage-$(CONFIG_ENABLE_FSP_ERROR_INFO) += fsp_error_info_hob.c
ramstage-$(CONFIG_BMP_LOGO) += fsp_gop_blt.c
+ramstage-$(CONFIG_USE_COREBOOT_FOR_BMP_RENDERING) += cb_logo.c
ifneq ($(CONFIG_NO_FSP_TEMP_RAM_EXIT),y)
postcar-$(CONFIG_FSP_CAR) += temp_ram_exit.c
diff --git a/src/drivers/intel/fsp2_0/cb_logo.c b/src/drivers/intel/fsp2_0/cb_logo.c
new file mode 100644
index 000000000000..cc62a1c55339
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/cb_logo.c
@@ -0,0 +1,175 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#define __SIMPLE_DEVICE__
+
+#include <bootmode.h>
+#include <console/console.h>
+#include <cpu/x86/mtrr.h>
+#include <device/pci_ops.h>
+#include <fsp/api.h>
+#include <fsp/fsp_gop_blt.h>
+#include <fsp/graphics.h>
+#include <fsp/util.h>
+#include <intelblocks/graphics.h>
+#include <soc/iomap.h>
+#include <soc/soc_chip.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct logo_coordinates {
+ uint32_t x;
+ uint32_t y;
+};
+
+/*
+ * Programs the Local Memory BAR (LMEMBAR) for the IGD.
+ *
+ * This function disables PCI command bits related to I/O, memory, and bus mastering
+ * for the IGD, programs the LMEMBAR with the provided base address, and then
+ * re-enables the PCI command bits.
+ */
+static void program_igd_lmembar(uint32_t base)
+{
+ const uint16_t disable_mask = ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
+ const uint16_t enable_mask = (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
+
+ /* Disable response in IO, MMIO space and Bus Master. */
+ pci_and_config16(SA_DEV_IGD, PCI_COMMAND, disable_mask);
+
+ /* Program IGD Base Address Register 2 aka LMEMBAR */
+ pci_write_config32(SA_DEV_IGD, PCI_BASE_ADDRESS_2, base);
+
+ /* Enable response in IO, MMIO space and Bus Master. */
+ pci_or_config16(SA_DEV_IGD, PCI_COMMAND, enable_mask);
+}
+
+/*
+ * Calculates the destination coordinates for the logo based on alignment settings.
+ *
+ * horizontal_resolution: The horizontal resolution of the display panel.
+ * vertical_resolution: The vertical resolution of the display panel.
+ * logo_width: The width of the logo bitmap.
+ * logo_height: The height of the logo bitmap.
+ * valignment: The vertical alignment setting.
+ *
+ * Returning `struct logo_coordinates` that contains the calculated x and y coordinates
+ * for rendering the logo.
+ */
+static struct logo_coordinates calculate_logo_coordinates(
+ uint32_t horizontal_resolution, uint32_t vertical_resolution,
+ uint32_t logo_width, uint32_t logo_height, enum fw_splash_vertical_alignment valignment)
+{
+ struct logo_coordinates coords;
+ /* Always horizontally centered */
+ coords.x = (horizontal_resolution - logo_width) / 2;
+
+ switch (valignment) {
+ case FW_SPLASH_VALIGNMENT_MIDDLE:
+ coords.y = vertical_resolution / 2;
+ break;
+ case FW_SPLASH_VALIGNMENT_TOP:
+ coords.y = 0;
+ break;
+ case FW_SPLASH_VALIGNMENT_BOTTOM:
+ coords.y = vertical_resolution - logo_height;
+ break;
+ default: /* FW_SPLASH_VALIGNMENT_CENTER (default) */
+ coords.y = (vertical_resolution - logo_height) / 2;
+ break;
+ }
+
+ return coords;
+}
+
+/*
+ * Copies the logo to the framebuffer.
+ *
+ * framebuffer_base: The base address of the framebuffer.
+ * bytes_per_scanline: The number of bytes per scanline in the framebuffer.
+ * logo_buffer_addr: The address of the logo data in BLT format.
+ * logo_width: The width of the logo bitmap.
+ * logo_height: The height of the logo bitmap.
+ * dest_x: The destination x-coordinate in the framebuffer for rendering the logo.
+ * dest_y: The destination y-coordinate in the framebuffer for rendering the logo.
+ */
+static void copy_logo_to_framebuffer(
+ uintptr_t framebuffer_base, uint32_t bytes_per_scanline,
+ efi_uintn_t logo_buffer_addr, uint32_t logo_width, uint32_t logo_height,
+ efi_uintn_t dest_x, efi_uintn_t dest_y)
+{
+ size_t pixel_size = sizeof(efi_graphics_output_blt_pixel);
+ size_t logo_line_bytes = logo_width * pixel_size;
+ efi_uintn_t framebuffer_offset = framebuffer_base + dest_y * bytes_per_scanline
+ + dest_x * pixel_size;
+ uint8_t *dst_row_address = (uint8_t *)framebuffer_offset;
+ uint8_t *src_row_address = (uint8_t *)(uintptr_t)logo_buffer_addr;
+ for (uint32_t i = 0; i < logo_height; i++) {
+ memcpy(dst_row_address, src_row_address, logo_line_bytes);
+ dst_row_address += bytes_per_scanline;
+ src_row_address += logo_line_bytes;
+ }
+}
+
+void soc_load_logo_by_coreboot(void)
+{
+ size_t size;
+ const struct hob_graphics_info *ginfo;
+ struct soc_intel_common_config *config = chip_get_common_soc_structure();
+ efi_uintn_t logo, blt_size;
+ efi_uintn_t blt_buffer_addr;
+ uint32_t logo_size, logo_height, logo_width;
+ int temp_mtrr_index = -1;
+
+ /* Find the graphics information HOB */
+ ginfo = fsp_find_extension_hob_by_guid(fsp_graphics_info_guid, &size);
+ if (!ginfo || ginfo->framebuffer_base == 0) {
+ printk(BIOS_ERR, "Graphics information HOB not found or invalid framebuffer base.\n");
+ return;
+ }
+
+ /* Program the IGD LMEMBAR */
+ program_igd_lmembar(GMADR_BASE);
+
+ /* Set up a temporary Write Combine (WC) MTRR for the GMADR range */
+ temp_mtrr_index = acquire_and_configure_mtrr(GMADR_BASE, GMADR_SIZE, MTRR_TYPE_WRCOMB);
+ if (temp_mtrr_index < 0) {
+ printk(BIOS_ERR, "Failed to configure WC MTRR for GMADR.\n");
+ return;
+ }
+
+ uintptr_t framebuffer_bar = ginfo->framebuffer_base;
+ uint32_t horizontal_resolution = ginfo->horizontal_resolution;
+ uint32_t vertical_resolution = ginfo->vertical_resolution;
+ uint32_t bytes_per_scanline = ginfo->pixels_per_scanline *
+ sizeof(efi_graphics_output_blt_pixel);
+
+ /*
+ * Adjusts panel orientation for external display when the lid is closed.
+ *
+ * When the lid is closed, indicating the onboard display is inactive,
+ * below logic forces the panel orientation to normal. This ensures proper display
+ * on an external monitor, as rotated orientations are typically not suitable in
+ * such state.
+ */
+ if (CONFIG(VBOOT_LID_SWITCH) ? !get_lid_switch() : !CONFIG(RUN_FSP_GOP))
+ config->panel_orientation = LB_FB_ORIENTATION_NORMAL;
+
+ /* Convert BMP logo to GOP BLT format */
+ fsp_convert_bmp_to_gop_blt(&logo, &logo_size, &blt_buffer_addr, &blt_size,
+ &logo_height, &logo_width, config->panel_orientation);
+
+ /* Override logo alignment if the default screen orientation is not normal */
+ if (config->panel_orientation != LB_FB_ORIENTATION_NORMAL)
+ config->logo_valignment = FW_SPLASH_VALIGNMENT_CENTER;
+
+ /* Calculate logo destination coordinates */
+ struct logo_coordinates logo_coords = calculate_logo_coordinates(horizontal_resolution,
+ vertical_resolution, logo_width, logo_height, config->logo_valignment);
+
+ /* Copy the logo to the framebuffer */
+ copy_logo_to_framebuffer(framebuffer_bar, bytes_per_scanline, blt_buffer_addr, logo_width,
+ logo_height, logo_coords.x, logo_coords.y);
+
+ /* Clear temporary Write Combine (WC) MTRR */
+ clear_var_mtrr(temp_mtrr_index);
+}
diff --git a/src/drivers/intel/fsp2_0/fsp_gop_blt.c b/src/drivers/intel/fsp2_0/fsp_gop_blt.c
index 087fb02df0e1..2ab716c4b764 100644
--- a/src/drivers/intel/fsp2_0/fsp_gop_blt.c
+++ b/src/drivers/intel/fsp2_0/fsp_gop_blt.c
@@ -100,12 +100,12 @@ static uint32_t calculate_blt_buffer_size(efi_bmp_image_header *header)
return blt_buffer_size;
}
-static uint32_t get_color_map_num(efi_bmp_image_header *header)
+static int get_color_map_num(efi_bmp_image_header *header)
{
- uint32_t col_map_number = 0;
+ int col_map_number;
if (header == NULL)
- return 0;
+ return -1;
switch (header->BitPerPixel) {
case 1:
@@ -118,6 +118,11 @@ static uint32_t get_color_map_num(efi_bmp_image_header *header)
col_map_number = 256;
break;
default:
+ /*
+ * For other bit depths (e.g., 24-bit and 32-bit) that doesn't have
+ * a standard palette, col_map_number remains 0.
+ */
+ col_map_number = 0;
break;
}
@@ -127,7 +132,7 @@ static uint32_t get_color_map_num(efi_bmp_image_header *header)
*/
if (header->ImageOffset - sizeof(efi_bmp_image_header) <
sizeof(efi_bmp_color_map) * col_map_number)
- return 0;
+ return -1;
return col_map_number;
}
@@ -450,7 +455,7 @@ void fsp_convert_bmp_to_gop_blt(efi_uintn_t *logo, uint32_t *logo_size,
if (!blt_buffer_size)
return;
- if (!get_color_map_num(bmp_header))
+ if (get_color_map_num(bmp_header) < 0)
return;
bool is_standard_orientation = (orientation == LB_FB_ORIENTATION_NORMAL ||
diff --git a/src/drivers/intel/fsp2_0/graphics.c b/src/drivers/intel/fsp2_0/graphics.c
index b7466a55ab5e..08609b67c183 100644
--- a/src/drivers/intel/fsp2_0/graphics.c
+++ b/src/drivers/intel/fsp2_0/graphics.c
@@ -15,25 +15,6 @@ enum pixel_format {
pixel_bitmask = 2, /* defined by <rgb>_mask values */
};
-static const uint8_t fsp_graphics_info_guid[16] = {
- 0xce, 0x2c, 0xf6, 0x39, 0x25, 0x68, 0x69, 0x46,
- 0xbb, 0x56, 0x54, 0x1a, 0xba, 0x75, 0x3a, 0x07
-};
-
-struct hob_graphics_info {
- uint64_t framebuffer_base;
- uint32_t framebuffer_size;
- uint32_t version;
- uint32_t horizontal_resolution;
- uint32_t vertical_resolution;
- uint32_t pixel_format; /* See enum pixel_format */
- uint32_t red_mask;
- uint32_t green_mask;
- uint32_t blue_mask;
- uint32_t reserved_mask;
- uint32_t pixels_per_scanline;
-} __packed;
-
struct pixel {
uint8_t pos;
uint8_t size;
diff --git a/src/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h
index 0cbefbe9ae41..9ff32be6fcf3 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/api.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/api.h
@@ -85,8 +85,33 @@ void platform_fsp_notify_status(enum fsp_notify_phase phase);
/* Initialize memory margin analysis settings. */
void setup_mma(FSP_M_CONFIG *memory_cfg);
-/* Update the SOC specific logo param and load the logo. */
-void soc_load_logo(FSPS_UPD *supd);
+/*
+ * Populate UPD entries for the logo if the platform utilizes
+ * the FSP's capability for rendering bitmap (BMP) images.
+ */
+void soc_load_logo_by_fsp(FSPS_UPD *supd);
+/*
+ * API that allows coreboot to perform native logo rendering after FSP display initialization.
+ *
+ * This implementation handles rendering the boot logo directly within coreboot.
+ * It depends on the FSP to initialize the display panel.
+ * Once the FSP completes display initialization and transfers control, coreboot
+ * renders the logo.
+ *
+ * Note: This native approach may introduce a ~10-30ms delay in displaying
+ * BMP images compared to rendering via FSP (when `USE_COREBOOT_FOR_BMP_RENDERING`
+ * Kconfig is not enable).
+ *
+ * coreboot native logo rendering provides greater flexibility for platform-specific
+ * logo customizations (e.g., alignment) that are not feasible or practical to implement
+ * within the FSP (silicon firmware) depending upon the OEM device need.
+ */
+#if CONFIG(USE_COREBOOT_FOR_BMP_RENDERING)
+void soc_load_logo_by_coreboot(void);
+#else
+static inline void soc_load_logo_by_coreboot(void) { /* nop */ }
+#endif
+
/* Update the SOC specific memory config param for mma. */
void soc_update_memory_params_for_mma(FSP_M_CONFIG *memory_cfg,
struct mma_config_param *mma_cfg);
diff --git a/src/drivers/intel/fsp2_0/include/fsp/fsp_gop_blt.h b/src/drivers/intel/fsp2_0/include/fsp/fsp_gop_blt.h
index 4e1f68952e1b..377607929a83 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/fsp_gop_blt.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/fsp_gop_blt.h
@@ -3,6 +3,7 @@
#ifndef FSP_GOP_BLT_H
#define FSP_GOP_BLT_H
+#include <boot/coreboot_tables.h>
#include <efi/efi_datatype.h>
#include <types.h>
diff --git a/src/drivers/intel/fsp2_0/include/fsp/graphics.h b/src/drivers/intel/fsp2_0/include/fsp/graphics.h
index a5f781f87fc6..7348237f1b09 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/graphics.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/graphics.h
@@ -5,6 +5,25 @@
#include <types.h>
+static const uint8_t fsp_graphics_info_guid[16] = {
+ 0xce, 0x2c, 0xf6, 0x39, 0x25, 0x68, 0x69, 0x46,
+ 0xbb, 0x56, 0x54, 0x1a, 0xba, 0x75, 0x3a, 0x07
+};
+
+struct hob_graphics_info {
+ uint64_t framebuffer_base;
+ uint32_t framebuffer_size;
+ uint32_t version;
+ uint32_t horizontal_resolution;
+ uint32_t vertical_resolution;
+ uint32_t pixel_format; /* See enum pixel_format */
+ uint32_t red_mask;
+ uint32_t green_mask;
+ uint32_t blue_mask;
+ uint32_t reserved_mask;
+ uint32_t pixels_per_scanline;
+} __packed;
+
/*
* Report the fsp_graphics_info_guid HOB to framebuffer info.
*
diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c
index f3472420bc6f..76636dd7a89e 100644
--- a/src/drivers/intel/fsp2_0/silicon_init.c
+++ b/src/drivers/intel/fsp2_0/silicon_init.c
@@ -124,9 +124,12 @@ static void do_silicon_init(struct fsp_header *hdr)
/* Give SoC/mainboard a chance to populate entries */
platform_fsp_silicon_init_params_cb(upd);
- /* Populate logo related entries */
- if (CONFIG(BMP_LOGO))
- soc_load_logo(upd);
+ /*
+ * Populate UPD entries for the logo if the platform utilizes
+ * the FSP's capability for rendering bitmap (BMP) images.
+ */
+ if (CONFIG(BMP_LOGO) && !CONFIG(USE_COREBOOT_FOR_BMP_RENDERING))
+ soc_load_logo_by_fsp(upd);
/* Call SiliconInit */
silicon_init = (void *)(uintptr_t)(hdr->image_base +
@@ -154,6 +157,17 @@ static void do_silicon_init(struct fsp_header *hdr)
fsp_debug_after_silicon_init(status);
fsps_return_value_handler(FSP_SILICON_INIT_API, status);
+ /*
+ * Only applies for SoC platforms prior to FSP 2.2 specification:
+ * If a BMP logo is enabled (`BMP_LOGO`) and the platform is
+ * configured to skip the FSP for rendering logo bitmap
+ * (`USE_COREBOOT_FOR_BMP_RENDERING`), then call the coreboot
+ * native function to handle BMP logo loading and display.
+ */
+ if (!CONFIG(PLATFORM_USES_FSP2_2) && CONFIG(BMP_LOGO) &&
+ CONFIG(USE_COREBOOT_FOR_BMP_RENDERING))
+ soc_load_logo_by_coreboot();
+
/* Reinitialize CPUs if FSP-S has done MP Init */
if (CONFIG(USE_INTEL_FSP_MP_INIT) && !fsp_is_multi_phase_init_enabled())
do_mpinit_after_fsp();
@@ -202,6 +216,15 @@ static void do_silicon_init(struct fsp_header *hdr)
timestamp_add_now(TS_FSP_MULTI_PHASE_SI_INIT_END);
post_code(POSTCODE_FSP_MULTI_PHASE_SI_INIT_EXIT);
+ /*
+ * If a BMP logo is enabled (`BMP_LOGO`) and the platform is
+ * configured to skip the FSP for rendering logo bitmap
+ * (`USE_COREBOOT_FOR_BMP_RENDERING`), then call the coreboot
+ * native function to handle BMP logo loading and display.
+ */
+ if (CONFIG(BMP_LOGO) && CONFIG(USE_COREBOOT_FOR_BMP_RENDERING))
+ soc_load_logo_by_coreboot();
+
/* Reinitialize CPUs if FSP-S has done MP Init */
if (CONFIG(USE_INTEL_FSP_MP_INIT))
do_mpinit_after_fsp();
@@ -269,7 +292,7 @@ void fsp_silicon_init(void)
fsp_display_timestamp();
}
-__weak void soc_load_logo(FSPS_UPD *supd) { }
+__weak void soc_load_logo_by_fsp(FSPS_UPD *supd) { }
static void release_logo(void *arg_unused)
{
diff --git a/src/drivers/smmstore/ramstage.c b/src/drivers/smmstore/ramstage.c
index 1cbf9fb28a5f..507678754c94 100644
--- a/src/drivers/smmstore/ramstage.c
+++ b/src/drivers/smmstore/ramstage.c
@@ -28,6 +28,10 @@ void lb_smmstorev2(struct lb_header *header)
store->size = sizeof(*store);
store->com_buffer = (uintptr_t)cbmem_entry_start(e);
store->com_buffer_size = cbmem_entry_size(e);
+ if (info.mmap_addr < 4ULL * GiB)
+ store->mmap_addr_deprecated = info.mmap_addr;
+ else
+ store->mmap_addr_deprecated = 0;
store->mmap_addr = info.mmap_addr;
store->num_blocks = info.num_blocks;
store->block_size = info.block_size;
diff --git a/src/include/cpu/x86/gdt.h b/src/include/cpu/x86/gdt.h
index 27a863ee3308..767e79467fee 100644
--- a/src/include/cpu/x86/gdt.h
+++ b/src/include/cpu/x86/gdt.h
@@ -3,16 +3,28 @@
#ifndef CPU_X86_GDT
#define CPU_X86_GDT
+#ifndef __ASSEMBLER__
/* These symbols are defined in c_start.S. */
extern char gdt[];
extern char per_cpu_segment_descriptors[];
extern uint32_t per_cpu_segment_selector;
extern char gdt_end[];
extern char idtarg[];
+#endif
-/* These symbols are defined in secondary.S. */
-extern char _secondary_gdt_addr[];
-extern char _secondary_start[];
-extern char _secondary_start_end[];
+/* Offset to GDT's segment descriptors: */
+#define GDT_CODE_SEG 0x08
+#define GDT_DATA_SEG 0x10
+#define GDT_CODE_SEG64 0x18
+/*
+ * This define is placed here to make sure future romstage programmers
+ * know about it.
+ * It is used only in SMM for STM setup code.
+ */
+#define GDT_TASK_STATE_SEG 0x20
+
+#define GDT_CODE16_SEG 0x28
+#define GDT_DATA16_SEG 0x30
+#define GDT_DATA_ACPI_SEG 0x38
#endif /* CPU_X86_GDT */
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 930edfdef7d6..87aee95c67f4 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -124,9 +124,11 @@ static inline int get_var_mtrr_count(void)
return rdmsr(MTRR_CAP_MSR).lo & MTRR_CAP_VCNT;
}
-void set_var_mtrr(unsigned int reg, unsigned int base, unsigned int size,
+int acquire_and_configure_mtrr(unsigned int base, unsigned int size, unsigned int type);
+void set_var_mtrr(unsigned int index, unsigned int base, unsigned int size,
unsigned int type);
int get_free_var_mtrr(void);
+void clear_var_mtrr(int index);
void clear_all_var_mtrr(void);
asmlinkage void display_mtrrs(void);
diff --git a/src/include/smmstore.h b/src/include/smmstore.h
index 595fe8b29bd5..4ee4c55c750b 100644
--- a/src/include/smmstore.h
+++ b/src/include/smmstore.h
@@ -69,7 +69,7 @@ struct smmstore_params_init {
struct smmstore_params_info {
uint32_t num_blocks;
uint32_t block_size;
- uint32_t mmap_addr;
+ uint64_t mmap_addr;
} __packed;
/*
diff --git a/src/mainboard/amd/birman/devicetree_phoenix_opensil.cb b/src/mainboard/amd/birman/devicetree_phoenix_opensil.cb
index 99169315456a..75b50a199db7 100644
--- a/src/mainboard/amd/birman/devicetree_phoenix_opensil.cb
+++ b/src/mainboard/amd/birman/devicetree_phoenix_opensil.cb
@@ -1,7 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-# TODO: Update for birman
-
chip soc/amd/phoenix
register "common_config.espi_config" = "{
.std_io_decode_bitmap = ESPI_DECODE_IO_0x80_EN | ESPI_DECODE_IO_0X2E_0X2F_EN | ESPI_DECODE_IO_0X60_0X64_EN,
diff --git a/src/mainboard/asus/h61-series/Kconfig b/src/mainboard/asus/h61-series/Kconfig
index 4c4fd7e2be8c..d09ed1e244ab 100644
--- a/src/mainboard/asus/h61-series/Kconfig
+++ b/src/mainboard/asus/h61-series/Kconfig
@@ -12,6 +12,16 @@ config BOARD_ASUS_H61_SERIES
select SOUTHBRIDGE_INTEL_BD82X6X
select USE_NATIVE_RAMINIT
+config BOARD_ASUS_H61M_A_USB3
+ select BOARD_ASUS_H61_SERIES
+ select BOARD_ROMSIZE_KB_8192
+ select HAVE_CMOS_DEFAULT
+ select HAVE_OPTION_TABLE
+ select NO_UART_ON_SUPERIO
+ select REALTEK_8168_RESET
+ select RT8168_SET_LED_MODE
+ select SUPERIO_NUVOTON_NCT6779D
+
config BOARD_ASUS_H61M_CS
select BOARD_ASUS_H61_SERIES
select BOARD_ROMSIZE_KB_8192
@@ -75,12 +85,13 @@ config MAINBOARD_DIR
default "asus/h61-series"
config VARIANT_DIR
- default "h61m-cs" if BOARD_ASUS_H61M_CS
- default "p8h61-m_lx" if BOARD_ASUS_P8H61_M_LX
- default "p8h61-m_lx3_r2_0" if BOARD_ASUS_P8H61_M_LX3_R2_0
- default "p8h61-m_pro" if BOARD_ASUS_P8H61_M_PRO
+ default "h61m-a_usb3" if BOARD_ASUS_H61M_A_USB3
+ default "h61m-cs" if BOARD_ASUS_H61M_CS
+ default "p8h61-m_lx" if BOARD_ASUS_P8H61_M_LX
+ default "p8h61-m_lx3_r2_0" if BOARD_ASUS_P8H61_M_LX3_R2_0
+ default "p8h61-m_pro" if BOARD_ASUS_P8H61_M_PRO
default "p8h61-m_pro_cm6630" if BOARD_ASUS_P8H61_M_PRO_CM6630
- default "p8h67-i_deluxe" if BOARD_ASUS_P8H67_I_DELUXE
+ default "p8h67-i_deluxe" if BOARD_ASUS_P8H67_I_DELUXE
config MAINBOARD_PART_NUMBER
default "H61M-CS" if BOARD_ASUS_H61M_CS
diff --git a/src/mainboard/asus/h61-series/Kconfig.name b/src/mainboard/asus/h61-series/Kconfig.name
index eee48c0f91c7..e1e2317f093d 100644
--- a/src/mainboard/asus/h61-series/Kconfig.name
+++ b/src/mainboard/asus/h61-series/Kconfig.name
@@ -1,5 +1,8 @@
## SPDX-License-Identifier: GPL-2.0-only
+config BOARD_ASUS_H61M_A_USB3
+ bool "H61M-A/USB3"
+
config BOARD_ASUS_H61M_CS
bool "H61M-CS"
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/board_info.txt b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/board_info.txt
new file mode 100644
index 000000000000..9008bcc862cc
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/board_info.txt
@@ -0,0 +1,6 @@
+Category: desktop
+Board URL: https://www.asus.com/supportonly/h61mausb3/helpdesk_knowledge/
+ROM package: DIP-8
+ROM protocol: SPI
+ROM socketed: y
+Flashrom support: y
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/cmos.default b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/cmos.default
new file mode 100644
index 000000000000..76c0b2d6ce33
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/cmos.default
@@ -0,0 +1,7 @@
+## SPDX-License-Identifier: GPL-2.0-only
+
+boot_option=Fallback
+debug_level=Debug
+power_on_after_fail=Enable
+sata_mode=AHCI
+gfx_uma_size=32M
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/cmos.layout b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/cmos.layout
new file mode 100644
index 000000000000..227711afa286
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/cmos.layout
@@ -0,0 +1,65 @@
+## SPDX-License-Identifier: GPL-2.0-only
+
+# -----------------------------------------------------------------
+entries
+
+# -----------------------------------------------------------------
+0 120 r 0 reserved_memory
+
+# -----------------------------------------------------------------
+# RTC_BOOT_BYTE (coreboot hardcoded)
+384 1 e 4 boot_option
+388 4 h 0 reboot_counter
+
+# -----------------------------------------------------------------
+# coreboot config options: console
+395 4 e 6 debug_level
+
+# coreboot config options: southbridge
+409 2 e 7 power_on_after_fail
+
+421 1 e 9 sata_mode
+
+# coreboot config options: cpu
+
+# coreboot config options: northbridge
+432 3 e 11 gfx_uma_size
+
+# coreboot config options: check sums
+984 16 h 0 check_sum
+
+# -----------------------------------------------------------------
+
+enumerations
+
+#ID value text
+1 0 Disable
+1 1 Enable
+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
+7 0 Disable
+7 1 Enable
+7 2 Keep
+9 0 AHCI
+9 1 IDE
+11 0 32M
+11 1 64M
+11 2 96M
+11 3 128M
+11 4 160M
+11 5 192M
+11 6 224M
+
+# -----------------------------------------------------------------
+checksums
+
+checksum 392 439 984
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/data.vbt b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/data.vbt
new file mode 100644
index 000000000000..7739a7fb36d2
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/data.vbt
Binary files differ
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/early_init.c b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/early_init.c
new file mode 100644
index 000000000000..37da16c471b6
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/early_init.c
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <bootblock_common.h>
+#include <device/pnp_ops.h>
+#include <superio/nuvoton/common/nuvoton.h>
+#include <superio/nuvoton/nct6779d/nct6779d.h>
+
+#define GLOBAL_DEV PNP_DEV(0x2e, 0)
+#define ACPI_DEV PNP_DEV(0x2e, NCT6779D_ACPI)
+
+void bootblock_mainboard_early_init(void)
+{
+ nuvoton_pnp_enter_conf_state(GLOBAL_DEV);
+
+ /* Select SIO pin states. */
+ pnp_write_config(GLOBAL_DEV, 0x1c, 0x71);
+ pnp_write_config(GLOBAL_DEV, 0x1d, 0x0e);
+ pnp_write_config(GLOBAL_DEV, 0x22, 0xd7);
+ pnp_write_config(GLOBAL_DEV, 0x24, 0x00);
+ pnp_write_config(GLOBAL_DEV, 0x2a, 0x48);
+ pnp_write_config(GLOBAL_DEV, 0x2c, 0x00);
+ pnp_write_config(GLOBAL_DEV, 0x2f, 0x01);
+
+ /* Power RAM in S3. */
+ pnp_set_logical_device(ACPI_DEV);
+ pnp_write_config(ACPI_DEV, 0xe4, 0x10);
+
+ nuvoton_pnp_exit_conf_state(GLOBAL_DEV);
+}
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/gma-mainboard.ads b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/gma-mainboard.ads
new file mode 100644
index 000000000000..20c53ef0f44b
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/gma-mainboard.ads
@@ -0,0 +1,21 @@
+-- SPDX-License-Identifier: GPL-2.0-or-later
+
+with HW.GFX.GMA;
+with HW.GFX.GMA.Display_Probing;
+
+use HW.GFX.GMA;
+use HW.GFX.GMA.Display_Probing;
+
+private package GMA.Mainboard is
+
+ -- For a three-pipe setup, bandwidth is shared between the 2nd and
+ -- the 3rd pipe. Thus, probe ports that likely have a high-resolution
+ -- display attached first.
+
+ ports : constant Port_List :=
+ (HDMI2, -- mainboard HDMI port
+ HDMI1, -- mainboard DVI-D port
+ Analog,
+ others => Disabled);
+
+end GMA.Mainboard;
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/gpio.c b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/gpio.c
new file mode 100644
index 000000000000..66fc05a68059
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/gpio.c
@@ -0,0 +1,211 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <southbridge/intel/common/gpio.h>
+
+static const struct pch_gpio_set1 pch_gpio_set1_mode = {
+ .gpio0 = GPIO_MODE_GPIO,
+ .gpio1 = GPIO_MODE_GPIO,
+ .gpio2 = GPIO_MODE_GPIO,
+ .gpio3 = GPIO_MODE_GPIO,
+ .gpio4 = GPIO_MODE_GPIO,
+ .gpio5 = GPIO_MODE_GPIO,
+ .gpio6 = GPIO_MODE_GPIO,
+ .gpio7 = GPIO_MODE_GPIO,
+ .gpio8 = GPIO_MODE_GPIO,
+ .gpio9 = GPIO_MODE_NATIVE,
+ .gpio10 = GPIO_MODE_GPIO,
+ .gpio11 = GPIO_MODE_GPIO,
+ .gpio12 = GPIO_MODE_GPIO,
+ .gpio13 = GPIO_MODE_GPIO,
+ .gpio14 = GPIO_MODE_GPIO,
+ .gpio15 = GPIO_MODE_GPIO,
+ .gpio16 = GPIO_MODE_GPIO,
+ .gpio17 = GPIO_MODE_GPIO,
+ .gpio18 = GPIO_MODE_NATIVE,
+ .gpio19 = GPIO_MODE_GPIO,
+ .gpio20 = GPIO_MODE_GPIO,
+ .gpio21 = GPIO_MODE_GPIO,
+ .gpio22 = GPIO_MODE_GPIO,
+ .gpio23 = GPIO_MODE_GPIO,
+ .gpio24 = GPIO_MODE_GPIO,
+ .gpio25 = GPIO_MODE_NATIVE,
+ .gpio26 = GPIO_MODE_NATIVE,
+ .gpio27 = GPIO_MODE_GPIO,
+ .gpio28 = GPIO_MODE_GPIO,
+ .gpio29 = GPIO_MODE_GPIO,
+ .gpio30 = GPIO_MODE_GPIO,
+ .gpio31 = GPIO_MODE_GPIO,
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_direction = {
+ .gpio0 = GPIO_DIR_OUTPUT,
+ .gpio1 = GPIO_DIR_INPUT,
+ .gpio2 = GPIO_DIR_INPUT,
+ .gpio3 = GPIO_DIR_INPUT,
+ .gpio4 = GPIO_DIR_INPUT,
+ .gpio5 = GPIO_DIR_INPUT,
+ .gpio6 = GPIO_DIR_INPUT,
+ .gpio7 = GPIO_DIR_INPUT,
+ .gpio8 = GPIO_DIR_INPUT,
+ .gpio10 = GPIO_DIR_INPUT,
+ .gpio11 = GPIO_DIR_INPUT,
+ .gpio12 = GPIO_DIR_INPUT,
+ .gpio13 = GPIO_DIR_INPUT,
+ .gpio14 = GPIO_DIR_INPUT,
+ .gpio15 = GPIO_DIR_INPUT,
+ .gpio16 = GPIO_DIR_INPUT,
+ .gpio17 = GPIO_DIR_INPUT,
+ .gpio19 = GPIO_DIR_INPUT,
+ .gpio20 = GPIO_DIR_INPUT,
+ .gpio21 = GPIO_DIR_INPUT,
+ .gpio22 = GPIO_DIR_INPUT,
+ .gpio23 = GPIO_DIR_INPUT,
+ .gpio24 = GPIO_DIR_INPUT,
+ .gpio27 = GPIO_DIR_INPUT,
+ .gpio28 = GPIO_DIR_INPUT,
+ .gpio29 = GPIO_DIR_INPUT,
+ .gpio30 = GPIO_DIR_INPUT,
+ .gpio31 = GPIO_DIR_INPUT,
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_level = {
+ .gpio0 = GPIO_LEVEL_LOW,
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_reset = {
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_invert = {
+ .gpio1 = GPIO_INVERT,
+ .gpio13 = GPIO_INVERT,
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_blink = {
+};
+
+static const struct pch_gpio_set2 pch_gpio_set2_mode = {
+ .gpio32 = GPIO_MODE_GPIO,
+ .gpio33 = GPIO_MODE_GPIO,
+ .gpio34 = GPIO_MODE_GPIO,
+ .gpio35 = GPIO_MODE_GPIO,
+ .gpio36 = GPIO_MODE_GPIO,
+ .gpio37 = GPIO_MODE_GPIO,
+ .gpio38 = GPIO_MODE_GPIO,
+ .gpio39 = GPIO_MODE_GPIO,
+ .gpio40 = GPIO_MODE_NATIVE,
+ .gpio41 = GPIO_MODE_NATIVE,
+ .gpio42 = GPIO_MODE_GPIO,
+ .gpio43 = GPIO_MODE_NATIVE,
+ .gpio44 = GPIO_MODE_GPIO,
+ .gpio45 = GPIO_MODE_GPIO,
+ .gpio46 = GPIO_MODE_GPIO,
+ .gpio47 = GPIO_MODE_NATIVE,
+ .gpio48 = GPIO_MODE_GPIO,
+ .gpio49 = GPIO_MODE_GPIO,
+ .gpio50 = GPIO_MODE_GPIO,
+ .gpio51 = GPIO_MODE_GPIO,
+ .gpio52 = GPIO_MODE_GPIO,
+ .gpio53 = GPIO_MODE_GPIO,
+ .gpio54 = GPIO_MODE_GPIO,
+ .gpio55 = GPIO_MODE_GPIO,
+ .gpio56 = GPIO_MODE_NATIVE,
+ .gpio57 = GPIO_MODE_GPIO,
+ .gpio58 = GPIO_MODE_GPIO,
+ .gpio59 = GPIO_MODE_NATIVE,
+ .gpio60 = GPIO_MODE_GPIO,
+ .gpio61 = GPIO_MODE_GPIO,
+ .gpio62 = GPIO_MODE_NATIVE,
+ .gpio63 = GPIO_MODE_GPIO,
+};
+
+static const struct pch_gpio_set2 pch_gpio_set2_direction = {
+ .gpio32 = GPIO_DIR_INPUT,
+ .gpio33 = GPIO_DIR_INPUT,
+ .gpio34 = GPIO_DIR_INPUT,
+ .gpio35 = GPIO_DIR_INPUT,
+ .gpio36 = GPIO_DIR_INPUT,
+ .gpio37 = GPIO_DIR_INPUT,
+ .gpio38 = GPIO_DIR_INPUT,
+ .gpio39 = GPIO_DIR_INPUT,
+ .gpio42 = GPIO_DIR_INPUT,
+ .gpio44 = GPIO_DIR_INPUT,
+ .gpio45 = GPIO_DIR_INPUT,
+ .gpio46 = GPIO_DIR_INPUT,
+ .gpio48 = GPIO_DIR_INPUT,
+ .gpio49 = GPIO_DIR_INPUT,
+ .gpio50 = GPIO_DIR_INPUT,
+ .gpio51 = GPIO_DIR_INPUT,
+ .gpio52 = GPIO_DIR_INPUT,
+ .gpio53 = GPIO_DIR_INPUT,
+ .gpio54 = GPIO_DIR_INPUT,
+ .gpio55 = GPIO_DIR_INPUT,
+ .gpio57 = GPIO_DIR_INPUT,
+ .gpio58 = GPIO_DIR_INPUT,
+ .gpio60 = GPIO_DIR_INPUT,
+ .gpio61 = GPIO_DIR_INPUT,
+ .gpio63 = GPIO_DIR_OUTPUT,
+};
+
+static const struct pch_gpio_set2 pch_gpio_set2_level = {
+ .gpio63 = GPIO_LEVEL_HIGH,
+};
+
+static const struct pch_gpio_set2 pch_gpio_set2_reset = {
+ .gpio57 = GPIO_RESET_RSMRST,
+ .gpio63 = GPIO_RESET_RSMRST,
+};
+
+static const struct pch_gpio_set3 pch_gpio_set3_mode = {
+ .gpio64 = GPIO_MODE_GPIO,
+ .gpio65 = GPIO_MODE_NATIVE,
+ .gpio66 = GPIO_MODE_GPIO,
+ .gpio67 = GPIO_MODE_NATIVE,
+ .gpio68 = GPIO_MODE_GPIO,
+ .gpio69 = GPIO_MODE_GPIO,
+ .gpio70 = GPIO_MODE_GPIO,
+ .gpio71 = GPIO_MODE_GPIO,
+ .gpio72 = GPIO_MODE_GPIO,
+ .gpio73 = GPIO_MODE_NATIVE,
+ .gpio74 = GPIO_MODE_GPIO,
+ .gpio75 = GPIO_MODE_NATIVE,
+};
+
+static const struct pch_gpio_set3 pch_gpio_set3_direction = {
+ .gpio64 = GPIO_DIR_INPUT,
+ .gpio66 = GPIO_DIR_INPUT,
+ .gpio68 = GPIO_DIR_INPUT,
+ .gpio69 = GPIO_DIR_INPUT,
+ .gpio70 = GPIO_DIR_INPUT,
+ .gpio71 = GPIO_DIR_INPUT,
+ .gpio72 = GPIO_DIR_INPUT,
+ .gpio74 = GPIO_DIR_INPUT,
+};
+
+static const struct pch_gpio_set3 pch_gpio_set3_level = {
+};
+
+static const struct pch_gpio_set3 pch_gpio_set3_reset = {
+};
+
+const struct pch_gpio_map mainboard_gpio_map = {
+ .set1 = {
+ .mode = &pch_gpio_set1_mode,
+ .direction = &pch_gpio_set1_direction,
+ .level = &pch_gpio_set1_level,
+ .blink = &pch_gpio_set1_blink,
+ .invert = &pch_gpio_set1_invert,
+ .reset = &pch_gpio_set1_reset,
+ },
+ .set2 = {
+ .mode = &pch_gpio_set2_mode,
+ .direction = &pch_gpio_set2_direction,
+ .level = &pch_gpio_set2_level,
+ .reset = &pch_gpio_set2_reset,
+ },
+ .set3 = {
+ .mode = &pch_gpio_set3_mode,
+ .direction = &pch_gpio_set3_direction,
+ .level = &pch_gpio_set3_level,
+ .reset = &pch_gpio_set3_reset,
+ },
+};
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/hda_verb.c b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/hda_verb.c
new file mode 100644
index 000000000000..1af52eb94e7e
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/hda_verb.c
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <device/azalia_device.h>
+
+const u32 cim_verb_data[] = {
+ 0x10ec0887, /* Codec Vendor / Device ID: Realtek */
+ 0x10438445, /* Subsystem ID */
+ 15, /* Number of 4 dword sets */
+ AZALIA_SUBVENDOR(0, 0x10438445),
+ AZALIA_PIN_CFG(0, 0x11, 0x40330000),
+ AZALIA_PIN_CFG(0, 0x12, AZALIA_PIN_CFG_NC(0)),
+ AZALIA_PIN_CFG(0, 0x14, 0x01014010),
+ AZALIA_PIN_CFG(0, 0x15, AZALIA_PIN_CFG_NC(0)),
+ AZALIA_PIN_CFG(0, 0x16, AZALIA_PIN_CFG_NC(0)),
+ AZALIA_PIN_CFG(0, 0x17, AZALIA_PIN_CFG_NC(0)),
+ AZALIA_PIN_CFG(0, 0x18, 0x01a19030),
+ AZALIA_PIN_CFG(0, 0x19, 0x02a19040),
+ AZALIA_PIN_CFG(0, 0x1a, 0x0181303f),
+ AZALIA_PIN_CFG(0, 0x1b, 0x02214020),
+ AZALIA_PIN_CFG(0, 0x1c, AZALIA_PIN_CFG_NC(0)),
+ AZALIA_PIN_CFG(0, 0x1d, 0x4024c601),
+ AZALIA_PIN_CFG(0, 0x1e, AZALIA_PIN_CFG_NC(0)),
+ AZALIA_PIN_CFG(0, 0x1f, AZALIA_PIN_CFG_NC(0)),
+
+ 0x8086281c, /* Codec Vendor / Device ID: Intel */
+ 0x80860101, /* Subsystem ID */
+ 10, /* Number of 4 dword sets */
+ AZALIA_SUBVENDOR(2, 0x80860101),
+ AZALIA_PIN_CFG(2, 0x04, 0x18560010),
+ AZALIA_PIN_CFG(2, 0x06, 0x18560010),
+ AZALIA_PIN_CFG(2, 0x08, 0x18560010),
+ AZALIA_PIN_CFG(2, 0x0a, 0x18560010),
+ AZALIA_PIN_CFG(2, 0x0b, 0x18560010),
+ AZALIA_PIN_CFG(2, 0x0c, 0x18560010),
+ AZALIA_PIN_CFG(2, 0x0d, 0x18560010),
+ AZALIA_PIN_CFG(2, 0x0e, 0x18560010),
+ AZALIA_PIN_CFG(2, 0x0f, 0x18560010),
+
+ 0x80862805, /* Codec Vendor / Device ID: Intel */
+ 0x80860101, /* Subsystem ID */
+ 4, /* Number of 4 dword sets */
+ AZALIA_SUBVENDOR(3, 0x80860101),
+ AZALIA_PIN_CFG(3, 0x05, 0x58560010),
+ AZALIA_PIN_CFG(3, 0x06, 0x58560020),
+ AZALIA_PIN_CFG(3, 0x07, 0x18560030),
+
+};
+
+const u32 pc_beep_verbs[0] = {};
+
+AZALIA_ARRAY_SIZES;
diff --git a/src/mainboard/asus/h61-series/variants/h61m-a_usb3/overridetree.cb b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/overridetree.cb
new file mode 100644
index 000000000000..be9667a328d9
--- /dev/null
+++ b/src/mainboard/asus/h61-series/variants/h61m-a_usb3/overridetree.cb
@@ -0,0 +1,82 @@
+## SPDX-License-Identifier: GPL-2.0-or-later
+
+chip northbridge/intel/sandybridge
+ register "gpu_dp_b_hotplug" = "4"
+ register "gpu_dp_d_hotplug" = "4"
+ device domain 0 on
+ subsystemid 0x1043 0x844d inherit
+ chip southbridge/intel/bd82x6x
+ register "usb_port_config" = "{
+ { 1, 0x95f, 0 },
+ { 1, 0x95f, 0 },
+ { 1, 0x9df, 1 },
+ { 1, 0xfff, 1 },
+ { 1, 0x95f, 2 },
+ { 1, 0xfbf, 2 },
+ { 1, 0xb57, 3 },
+ { 1, 0xb57, 3 },
+ { 1, 0x353, 4 },
+ { 1, 0x353, 4 },
+ { 1, 0xb5f, 6 },
+ { 1, 0xb5f, 5 },
+ { 1, 0xb57, 5 },
+ { 1, 0xb57, 6 },
+ }"
+ register "pcie_port_coalesce" = "1"
+ register "gen1_dec" = "0x000c0291"
+ device ref hda on
+ subsystemid 0x1043 0x8445
+ end
+ device ref pcie_rp1 off end
+ device ref pcie_rp2 on end # ASM1042 USB 3.0 controller
+ device ref pcie_rp3 off end
+ device ref pcie_rp4 on end # PCIEX1_1 slot
+ device ref pcie_rp5 on end # PCIEX1_2 slot
+ device ref pcie_rp6 on # Realtek Gigabit NIC
+ device pci 00.0 on end
+ end
+ device ref pcie_rp7 off end
+ device ref pcie_rp8 off end
+
+ device ref lpc on
+ chip superio/nuvoton/nct6779d
+ device pnp 2e.1 off end # Parallel
+ device pnp 2e.2 off end # UART A
+ device pnp 2e.3 off end # UART B, IR
+ device pnp 2e.5 on # Keyboard
+ io 0x60 = 0x0060
+ io 0x62 = 0x0064
+ irq 0x70 = 1
+ irq 0x72 = 12
+ end
+ device pnp 2e.6 off end # CIR
+ device pnp 2e.7 off end # GPIO6-8
+ device pnp 2e.8 off end # WDT1, GPIO0, GPIO1
+ device pnp 2e.108 on end # GPIO0
+ device pnp 2e.9 off end # GPIO1-8
+ device pnp 2e.109 off end # GPIO1
+ device pnp 2e.209 off end # GPIO2
+ device pnp 2e.309 off end # GPIO3
+ device pnp 2e.409 off end # GPIO4
+ device pnp 2e.509 off end # GPIO5
+ device pnp 2e.609 off end # GPIO6
+ device pnp 2e.709 off end # GPIO7
+ device pnp 2e.a on # ACPI
+ irq 0xe7 = 0x11
+ irq 0xf2 = 0x5d
+ end
+ device pnp 2e.b on # H/W Monitor, FP LED
+ io 0x60 = 0x0290
+ io 0x62 = 0
+ irq 0x70 = 0
+ end
+ device pnp 2e.d off end # WDT1
+ device pnp 2e.e off end # CIR WAKE-UP
+ device pnp 2e.f off end # GPIO Push-pull/Open-drain selection
+ device pnp 2e.14 off end # PORT80 UART
+ device pnp 2e.16 off end # Deep Sleep
+ end
+ end
+ end
+ end
+end
diff --git a/src/mainboard/google/brya/variants/uldrenite/gpio.c b/src/mainboard/google/brya/variants/uldrenite/gpio.c
index d453adb1810b..667a369604e8 100644
--- a/src/mainboard/google/brya/variants/uldrenite/gpio.c
+++ b/src/mainboard/google/brya/variants/uldrenite/gpio.c
@@ -143,18 +143,18 @@ static const struct pad_config gpio_table[] = {
PAD_NC_LOCK(GPP_D11, NONE, LOCK_CONFIG),
/* D12 : ISH_SPI_MOSI ==> GPP_D12_STRAP */
PAD_NC_LOCK(GPP_D12, NONE, LOCK_CONFIG),
- /* D13 : UART0_ISH_RXD ==> NC */
- PAD_NC(GPP_D13, NONE),
- /* D14 : UART0_ISH_TXD ==> LCD_CBL_DET# */
- PAD_CFG_GPO(GPP_D14, 1, DEEP),
+ /* D13 : UART0_ISH_RXD */
+ PAD_CFG_NF(GPP_D13, NONE, DEEP, NF1),
+ /* D14 : UART0_ISH_TXD */
+ PAD_CFG_NF(GPP_D14, NONE, DEEP, NF1),
/* D15 : GPP_D15 ==> SOC_TS_I2C_RST# */
PAD_CFG_GPO_LOCK(GPP_D15, 1, LOCK_CONFIG),
/* D16 : ISH_UART0_CTS# ==> SOC_TS_I2C_INT# */
PAD_CFG_GPI_APIC(GPP_D16, NONE, PLTRST, LEVEL, INVERT),
- /* D17 : NC ==> UART1_ISH_RX_DBG_TX */
- PAD_CFG_NF(GPP_D17, NONE, DEEP, NF2),
- /* D18 : NC ==> UART1_ISH_TX_DBG_RX */
- PAD_CFG_NF(GPP_D18, NONE, DEEP, NF2),
+ /* D17 : NC */
+ PAD_NC(GPP_D17, NONE),
+ /* D18 : LCD_CBL_DET# */
+ PAD_CFG_GPO(GPP_D18, 1, DEEP),
/* D19 : I2S_MCLK1_OUT ==> NC */
PAD_NC(GPP_D19, NONE),
diff --git a/src/mainboard/google/brya/variants/uldrenite/variant.c b/src/mainboard/google/brya/variants/uldrenite/variant.c
index 532752837f34..75809e233f94 100644
--- a/src/mainboard/google/brya/variants/uldrenite/variant.c
+++ b/src/mainboard/google/brya/variants/uldrenite/variant.c
@@ -8,6 +8,7 @@
#include <fw_config.h>
#include <sar.h>
#include <soc/bootblock.h>
+#include <stdlib.h>
const char *get_wifi_sar_cbfs_filename(void)
{
@@ -40,7 +41,7 @@ static const struct pad_config lte_disable_pads[] = {
PAD_NC(GPP_H23, NONE),
};
-static const struct pad_config ish_disable_pads[] = {
+static const struct pad_config ish_uart0_disable_pads[] = {
/* A16 : ISH_GP5 ==> NC */
PAD_NC_LOCK(GPP_A16, NONE, LOCK_CONFIG),
/* B5 : GPP_B5 ==> NC */
@@ -49,12 +50,46 @@ static const struct pad_config ish_disable_pads[] = {
PAD_NC(GPP_B6, NONE),
/* D1 : ISH_GP1 ==> NC */
PAD_NC(GPP_D1, NONE),
+ /* D13 : UART0_ISH_RXD ==> NC */
+ PAD_NC(GPP_D13, NONE),
+ /* D14 : UART0_ISH_TXD ==> NC */
+ PAD_NC(GPP_D14, NONE),
+ /* E9 : SOC_ACC2_INT ==> NC */
+ PAD_NC_LOCK(GPP_E9, NONE, LOCK_CONFIG),
+};
+
+static const struct pad_config switch_ish_uart1_pads[] = {
+ /* D13 : UART0_ISH_RXD ==> NC */
+ PAD_NC(GPP_D13, NONE),
+ /* D14 : UART0_ISH_TXD ==> LCD_CBL_DET# */
+ PAD_CFG_GPO(GPP_D14, 1, DEEP),
+ /* D17 : NC ==> UART1_ISH_RDX */
+ PAD_CFG_NF(GPP_D17, NONE, DEEP, NF2),
+ /* D18 : LCD_CBL_DET# ==> UART1_ISH_TDX */
+ PAD_CFG_NF(GPP_D18, NONE, DEEP, NF2),
+};
+
+static const struct pad_config ish_uart1_disable_pads[] = {
+ /* A16 : ISH_GP5 ==> NC */
+ PAD_NC_LOCK(GPP_A16, NONE, LOCK_CONFIG),
+ /* B5 : GPP_B5 ==> NC */
+ PAD_NC(GPP_B5, NONE),
+ /* B6 : GPP_B6 ==> NC */
+ PAD_NC(GPP_B6, NONE),
+ /* D1 : ISH_GP1 ==> NC */
+ PAD_NC(GPP_D1, NONE),
+ /* D17 : UART1_ISH_RDX ==> NC */
+ PAD_NC(GPP_D17, NONE),
+ /* D18 : UART1_ISH_TDX ==> NC*/
+ PAD_NC(GPP_D18, NONE),
/* E9 : SOC_ACC2_INT ==> NC */
PAD_NC_LOCK(GPP_E9, NONE, LOCK_CONFIG),
};
void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
{
+ uint32_t board_version = board_id();
+
if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_NONE))) {
printk(BIOS_INFO, "Disable touchscreen GPIO pins.\n");
gpio_padbased_override(padbased_table, touchscreen_disable_pads,
@@ -65,10 +100,24 @@ void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
gpio_padbased_override(padbased_table, lte_disable_pads,
ARRAY_SIZE(lte_disable_pads));
}
- if (!fw_config_probe(FW_CONFIG(ISH, ISH_ENABLE))) {
- printk(BIOS_INFO, "Disable ISH GPIO pins.\n");
- gpio_padbased_override(padbased_table, ish_disable_pads,
- ARRAY_SIZE(ish_disable_pads));
+
+ /* b/415605630: Support different ISH UART mappings according the board id */
+ if (board_version < 2) {
+ /* Override ISH UART0 to ISH UART1 */
+ gpio_padbased_override(padbased_table, switch_ish_uart1_pads,
+ ARRAY_SIZE(switch_ish_uart1_pads));
+
+ if (!fw_config_probe(FW_CONFIG(ISH, ISH_ENABLE))) {
+ printk(BIOS_INFO, "Disable ISH GPIO pins is based on ISH UART1.\n");
+ gpio_padbased_override(padbased_table, ish_uart1_disable_pads,
+ ARRAY_SIZE(ish_uart1_disable_pads));
+ }
+ } else {
+ if (!fw_config_probe(FW_CONFIG(ISH, ISH_ENABLE))) {
+ printk(BIOS_INFO, "Disable ISH GPIO pins is based on ISH UART0.\n");
+ gpio_padbased_override(padbased_table, ish_uart0_disable_pads,
+ ARRAY_SIZE(ish_uart0_disable_pads));
+ }
}
}
@@ -122,3 +171,17 @@ void variant_update_descriptor(void)
configure_descriptor(fivr_bytes, ARRAY_SIZE(fivr_bytes));
}
}
+
+void variant_configure_pads(void)
+{
+ const struct pad_config *base_pads;
+ struct pad_config *padbased_table;
+ size_t base_num;
+
+ padbased_table = new_padbased_table();
+ base_pads = variant_gpio_table(&base_num);
+ gpio_padbased_override(padbased_table, base_pads, base_num);
+ fw_config_gpio_padbased_override(padbased_table);
+ gpio_configure_pads_with_padbased(padbased_table);
+ free(padbased_table);
+}
diff --git a/src/mainboard/google/drallion/Kconfig b/src/mainboard/google/drallion/Kconfig
index 484fd027cadf..cd14d2c10e54 100644
--- a/src/mainboard/google/drallion/Kconfig
+++ b/src/mainboard/google/drallion/Kconfig
@@ -22,6 +22,7 @@ config BOARD_GOOGLE_BASEBOARD_DRALLION
select MAINBOARD_USES_IFD_EC_REGION
select SMBIOS_SERIAL_FROM_VPD if VPD
select SOC_INTEL_COMETLAKE_1
+ select SOC_INTEL_COMMON_BLOCK_DTT_STATIC_ASL
select SOC_INTEL_COMMON_BLOCK_HDA_VERB
select SOC_INTEL_COMMON_BLOCK_SMM_ESPI_DISABLE
select SYSTEM_TYPE_LAPTOP
diff --git a/src/mainboard/google/fatcat/variants/fatcat/overridetree.cb b/src/mainboard/google/fatcat/variants/fatcat/overridetree.cb
index 565aad6f98a5..858205902d6a 100644
--- a/src/mainboard/google/fatcat/variants/fatcat/overridetree.cb
+++ b/src/mainboard/google/fatcat/variants/fatcat/overridetree.cb
@@ -128,6 +128,7 @@ chip soc/intel/pantherlake
#| I2C5 | Touchpad |
#+-------------------+---------------------------+
register "common_soc_config" = "{
+ .logo_valignment = FW_SPLASH_VALIGNMENT_MIDDLE,
.chipset_lockdown = CHIPSET_LOCKDOWN_COREBOOT,
.i2c[1] = {
.speed = I2C_SPEED_FAST,
diff --git a/src/mainboard/google/fatcat/variants/francka/overridetree.cb b/src/mainboard/google/fatcat/variants/francka/overridetree.cb
index b44cdc629168..405be4547d09 100644
--- a/src/mainboard/google/fatcat/variants/francka/overridetree.cb
+++ b/src/mainboard/google/fatcat/variants/francka/overridetree.cb
@@ -206,7 +206,7 @@ chip soc/intel/pantherlake
register "generic.irq" = "ACPI_IRQ_LEVEL_LOW(GPP_E01_IRQ)"
register "generic.detect" = "1"
register "generic.reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_B08)"
- register "generic.reset_delay_ms" = "200"
+ register "generic.reset_delay_ms" = "10"
register "generic.enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_B18)"
register "generic.enable_delay_ms" = "12"
register "generic.has_power_resource" = "1"
diff --git a/src/mainboard/google/hatch/Kconfig b/src/mainboard/google/hatch/Kconfig
index 82a632692abe..850234153f98 100644
--- a/src/mainboard/google/hatch/Kconfig
+++ b/src/mainboard/google/hatch/Kconfig
@@ -26,6 +26,7 @@ config BOARD_GOOGLE_BASEBOARD_HATCH
select MAINBOARD_HAS_TPM2
select MB_HAS_ACTIVE_HIGH_SD_PWR_ENABLE
select SOC_INTEL_COMETLAKE_1
+ select SOC_INTEL_COMMON_BLOCK_DTT_STATIC_ASL
select SPI_TPM
select SYSTEM_TYPE_LAPTOP
select TPM_GOOGLE_CR50
diff --git a/src/mainboard/google/ocelot/variants/ocelot/overridetree.cb b/src/mainboard/google/ocelot/variants/ocelot/overridetree.cb
index 30daba557269..f0c1039c016d 100644
--- a/src/mainboard/google/ocelot/variants/ocelot/overridetree.cb
+++ b/src/mainboard/google/ocelot/variants/ocelot/overridetree.cb
@@ -288,7 +288,6 @@ chip soc/intel/pantherlake
end
end
- device ref ipu off end
device ref iaa off end
device ref thc0 on
@@ -356,8 +355,6 @@ chip soc/intel/pantherlake
device ref tbt_pcie_rp0 on end
device ref tbt_pcie_rp1 on end
- device ref tbt_pcie_rp2 on end
- device ref tbt_pcie_rp3 on end
device ref tcss_xhci on
chip drivers/usb/acpi
device ref tcss_root_hub on
@@ -373,18 +370,6 @@ chip soc/intel/pantherlake
register "group" = "ACPI_PLD_GROUP(3, 2)"
device ref tcss_usb3_port1 on end
end
- chip drivers/usb/acpi
- register "desc" = ""USB3 Type-C Port C2""
- register "type" = "UPC_TYPE_C_USB2_SS_SWITCH"
- register "group" = "ACPI_PLD_GROUP(2, 2)"
- device ref tcss_usb3_port2 on end
- end
- chip drivers/usb/acpi
- register "desc" = ""USB3 Type-C Port C3""
- register "type" = "UPC_TYPE_C_USB2_SS_SWITCH"
- register "group" = "ACPI_PLD_GROUP(1, 2)"
- device ref tcss_usb3_port3 on end
- end
end
end
end
@@ -401,18 +386,6 @@ chip soc/intel/pantherlake
device generic 0 on end
end
end
- device ref tcss_dma1 on
- chip drivers/intel/usb4/retimer
- register "dfp[0].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B21)"
- use tcss_usb3_port2 as dfp[0].typec_port
- device generic 0 on end
- end
- chip drivers/intel/usb4/retimer
- register "dfp[1].power_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B21)"
- use tcss_usb3_port3 as dfp[1].typec_port
- device generic 0 on end
- end
- end
device ref ish on
probe ISH ISH_ENABLE
@@ -578,22 +551,6 @@ chip soc/intel/pantherlake
device generic 0 on end
end
end # Gen4 M.2 SSD
- device ref pcie_rp9 on
- probe STORAGE STORAGE_NVME_GEN5
- probe STORAGE STORAGE_UNKNOWN
- register "pcie_rp[PCIE_RP(9)]" = "{
- .clk_src = 1,
- .clk_req = 1,
- .flags = PCIE_RP_CLK_REQ_DETECT | PCIE_RP_LTR | PCIE_RP_AER,
- }"
- chip soc/intel/common/block/pcie/rtd3
- register "is_storage" = "true"
- register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_B16)"
- register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_E03)"
- register "srcclk_pin" = "1"
- device generic 0 on end
- end
- end # Gen5 M.2 SSD
device ref cnvi_wifi on
probe WIFI WIFI_CNVI_6
probe WIFI WIFI_CNVI_7
diff --git a/src/mainboard/google/sarien/Kconfig b/src/mainboard/google/sarien/Kconfig
index 5f678aa4befc..666fb8f7f070 100644
--- a/src/mainboard/google/sarien/Kconfig
+++ b/src/mainboard/google/sarien/Kconfig
@@ -20,6 +20,7 @@ config BOARD_GOOGLE_BASEBOARD_SARIEN
select MAINBOARD_HAS_TPM2
select MAINBOARD_USES_IFD_EC_REGION
select SMBIOS_SERIAL_FROM_VPD if VPD
+ select SOC_INTEL_COMMON_BLOCK_DTT_STATIC_ASL
select SOC_INTEL_COMMON_BLOCK_HDA_VERB
select SOC_INTEL_COMMON_BLOCK_SMM_ESPI_DISABLE
select SOC_INTEL_WHISKEYLAKE
diff --git a/src/mainboard/google/volteer/variants/elemi/ramstage.c b/src/mainboard/google/volteer/variants/elemi/ramstage.c
index f7a174d88865..16261b7d45d7 100644
--- a/src/mainboard/google/volteer/variants/elemi/ramstage.c
+++ b/src/mainboard/google/volteer/variants/elemi/ramstage.c
@@ -3,17 +3,31 @@
#include <delay.h>
#include <gpio.h>
#include <baseboard/variants.h>
+#include <ec/google/chromeec/ec.h>
void variant_ramstage_init(void)
{
- /*
- * Assert FPMCU reset and enable power to FPMCU,
- * wait for power rail to stabilize,
- * and then deassert FPMCU reset.
- * Waiting for the power rail to stabilize can take a while.
- */
- gpio_output(GPP_C23, 0);
- gpio_output(GPP_A21, 1);
- mdelay(1);
- gpio_output(GPP_C23, 1);
+ uint32_t sku_id = google_chromeec_get_board_sku();
+
+ switch (sku_id) {
+ case 102:
+ case 104:
+ case 107:
+ case 109:
+ case 115:
+ /*
+ * Assert FPMCU reset and enable power to FPMCU,
+ * wait for power rail to stabilize,
+ * and then deassert FPMCU reset.
+ * Waiting for the power rail to stabilize can take a while.
+ */
+ gpio_output(GPP_C23, 0);
+ gpio_output(GPP_A21, 1);
+ mdelay(1);
+ gpio_output(GPP_C23, 1);
+ break;
+ default:
+ /* SKU does not have FP Sensor, do not enable FPMCU */
+ break;
+ }
}
diff --git a/src/mainboard/intel/coffeelake_rvp/variants/baseboard/devicetree.cb b/src/mainboard/intel/coffeelake_rvp/variants/baseboard/devicetree.cb
index 16c68cd1a3c0..476e4f78dba1 100644
--- a/src/mainboard/intel/coffeelake_rvp/variants/baseboard/devicetree.cb
+++ b/src/mainboard/intel/coffeelake_rvp/variants/baseboard/devicetree.cb
@@ -43,33 +43,18 @@ chip soc/intel/cannonlake
register "s0ix_enable" = "false"
device domain 0 on
- device pci 00.0 on end # Host Bridge
- device pci 02.0 on end # Integrated Graphics Device
- device pci 04.0 on end # SA Thermal device
- device pci 12.0 on end # Thermal Subsystem
- device pci 12.5 off end # UFS SCS
- device pci 12.6 off end # GSPI #2
- device pci 14.0 on end # USB xHCI
- device pci 14.1 off end # USB xDCI (OTG)
- device pci 14.5 on end # SDCard
- device pci 16.0 on end # Management Engine Interface 1
- device pci 16.1 off end # Management Engine Interface 2
- device pci 16.2 off end # Management Engine IDE-R
- device pci 16.3 off end # Management Engine KT Redirection
- device pci 16.4 off end # Management Engine Interface 3
- device pci 16.5 off end # Management Engine Interface 4
- device pci 1e.0 on end # UART #0
- device pci 1e.2 off end # GSPI #0
- device pci 1e.3 off end # GSPI #1
- device pci 1f.0 on
+ device ref igpu on end
+ device ref dptf on end
+ device ref thermal on end
+ device ref xhci on end
+ device ref sdxc on end
+ device ref uart0 on end
+ device ref lpc_espi on
chip drivers/pc80/tpm
device pnp 0c31.0 on end
end
- end # LPC Interface
- device pci 1f.1 on end # P2SB
- device pci 1f.2 hidden end # Power Management Controller
- device pci 1f.3 on end # Intel HDA
- device pci 1f.4 on end # SMBus
- device pci 1f.5 on end # PCH SPI
+ end
+ device ref hda on end
+ device ref smbus on end
end
end
diff --git a/src/mainboard/intel/coffeelake_rvp/variants/cfl_h/overridetree.cb b/src/mainboard/intel/coffeelake_rvp/variants/cfl_h/overridetree.cb
index a10d271610d5..d36f9e22a412 100644
--- a/src/mainboard/intel/coffeelake_rvp/variants/cfl_h/overridetree.cb
+++ b/src/mainboard/intel/coffeelake_rvp/variants/cfl_h/overridetree.cb
@@ -61,15 +61,11 @@ chip soc/intel/cannonlake
register "PcieClkSrcClkReq[9]" = "9"
device domain 0 on
- device pci 15.0 on end # I2C #0
- device pci 15.1 on end # I2C #1
- device pci 15.2 off end # I2C #2
- device pci 15.3 off end # I2C #3
- device pci 17.0 on end # SATA
- device pci 19.0 off end # I2C #4 (Not available on PCH-H)
- device pci 19.1 off end # I2C #5 (Not available on PCH-H)
- device pci 19.2 on end # UART #2
- device pci 1a.0 on end # eMMC
+ device ref i2c0 on end
+ device ref i2c1 on end
+ device ref sata on end
+ device ref uart2 on end
+ device ref emmc on end
device ref pcie_rp1 on # x4 SLOT1
register "PcieRpSlotImplemented[0]" = "1"
end
@@ -79,9 +75,6 @@ chip soc/intel/cannonlake
device ref pcie_rp9 on
register "PcieRpSlotImplemented[8]" = "1"
end
- device pci 1e.1 off end # UART #1
- device pci 1e.2 off end # GSPI #0
- device pci 1e.3 off end # GSPI #1
- device pci 1f.6 on end # GbE
+ device ref gbe on end
end
end
diff --git a/src/mainboard/intel/coffeelake_rvp/variants/cfl_s/overridetree.cb b/src/mainboard/intel/coffeelake_rvp/variants/cfl_s/overridetree.cb
index c8c443486fc7..607eb6a37155 100644
--- a/src/mainboard/intel/coffeelake_rvp/variants/cfl_s/overridetree.cb
+++ b/src/mainboard/intel/coffeelake_rvp/variants/cfl_s/overridetree.cb
@@ -63,21 +63,19 @@ chip soc/intel/cannonlake
register "PcieClkSrcClkReq[10]" = "10"
device domain 0 on
- device pci 14.3 on
+ device ref cnvi_wifi on
chip drivers/wifi/generic
register "wake" = "PME_B0_EN_BIT"
device generic 0 on end
end
- end # CNVi wifi
- device pci 15.0 on end # I2C #0
- device pci 15.1 on end # I2C #1
- device pci 15.2 on end # I2C #2
- device pci 15.3 on end # I2C #3
- device pci 17.0 on end # SATA
- device pci 19.0 off end # I2C #4 (Not available on PCH-H)
- device pci 19.1 off end # I2C #5 (Not available on PCH-H)
- device pci 19.2 on end # UART #2
- device pci 1a.0 on end # eMMC
+ end
+ device ref i2c0 on end
+ device ref i2c1 on end
+ device ref i2c2 on end
+ device ref i2c3 on end
+ device ref sata on end
+ device ref uart2 on end
+ device ref emmc on end
device ref pcie_rp1 on
register "PcieRpSlotImplemented[0]" = "1"
end
@@ -102,7 +100,6 @@ chip soc/intel/cannonlake
device ref pcie_rp21 on # x4 SLOT 2
register "PcieRpSlotImplemented[20]" = "1"
end
- device pci 1e.1 off end # UART #1
- device pci 1f.6 on end # GbE
+ device ref gbe on end
end
end
diff --git a/src/mainboard/intel/coffeelake_rvp/variants/cfl_u/overridetree.cb b/src/mainboard/intel/coffeelake_rvp/variants/cfl_u/overridetree.cb
index 25d084ac163b..908632093c3e 100644
--- a/src/mainboard/intel/coffeelake_rvp/variants/cfl_u/overridetree.cb
+++ b/src/mainboard/intel/coffeelake_rvp/variants/cfl_u/overridetree.cb
@@ -38,16 +38,15 @@ chip soc/intel/cannonlake
}"
device domain 0 on
- device pci 14.3 on
+ device ref cnvi_wifi on
chip drivers/wifi/generic
register "wake" = "PME_B0_EN_BIT"
device generic 0 on end
end
- end # CNVi wifi
- device pci 15.0 on end # I2C #0
- device pci 15.1 on end # I2C #1
- device pci 15.2 off end # I2C #2
- device pci 15.3 on
+ end
+ device ref i2c0 on end
+ device ref i2c1 on end
+ device ref i2c3 on
chip drivers/i2c/max98373
register "interleave_mode" = "1"
register "vmon_slot_no" = "4"
@@ -57,12 +56,10 @@ chip soc/intel/cannonlake
register "name" = ""MAXR""
device i2c 32 on end
end
- end # I2C #3
- device pci 17.0 off end # SATA
- device pci 19.0 on end # I2C #4
- device pci 19.1 off end # I2C #5
- device pci 19.2 on end # UART #2
- device pci 1a.0 on end # eMMC
+ end
+ device ref i2c4 on end
+ device ref uart2 on end
+ device ref emmc on end
device ref pcie_rp1 on # x4 SLOT1
register "PcieRpSlotImplemented[0]" = "1"
end
@@ -72,9 +69,5 @@ chip soc/intel/cannonlake
device ref pcie_rp9 on
register "PcieRpSlotImplemented[8]" = "1"
end
- device pci 1e.1 off end # UART #1
- device pci 1e.2 off end # GSPI #0
- device pci 1e.3 off end # GSPI #1
- device pci 1f.6 off end # GbE
end
end
diff --git a/src/mainboard/intel/coffeelake_rvp/variants/cml_u/overridetree.cb b/src/mainboard/intel/coffeelake_rvp/variants/cml_u/overridetree.cb
index 1f3bf9074bce..a14e9910c1ff 100644
--- a/src/mainboard/intel/coffeelake_rvp/variants/cml_u/overridetree.cb
+++ b/src/mainboard/intel/coffeelake_rvp/variants/cml_u/overridetree.cb
@@ -59,22 +59,19 @@ chip soc/intel/cannonlake
register "sdcard_cd_gpio" = "GPP_G5"
device domain 0 on
- device pci 14.3 on
+ device ref cnvi_wifi on
chip drivers/wifi/generic
register "wake" = "PME_B0_EN_BIT"
device generic 0 on end
end
- end # CNVi wifi
- device pci 14.5 on end # SDCard
- device pci 15.0 on end # I2C #0
- device pci 15.1 on end # I2C #1
- device pci 15.2 off end # I2C #2
- device pci 15.3 off end # I2C #3
- device pci 17.0 on end # SATA
- device pci 19.0 on end # I2C #4
- device pci 19.1 off end # I2C #5
- device pci 19.2 on end # UART #2
- device pci 1a.0 on end # eMMC
+ end
+ device ref sdxc on end
+ device ref i2c0 on end
+ device ref i2c1 on end
+ device ref sata on end
+ device ref i2c4 on end
+ device ref uart2 on end
+ device ref emmc on end
device ref pcie_rp1 on # x4 SLOT1
register "PcieRpSlotImplemented[0]" = "1"
end
@@ -84,7 +81,6 @@ chip soc/intel/cannonlake
device ref pcie_rp9 on
register "PcieRpSlotImplemented[8]" = "1"
end
- device pci 1e.1 off end # UART #1
- device pci 1f.6 on end # GbE
+ device ref gbe on end
end
end
diff --git a/src/mainboard/intel/coffeelake_rvp/variants/whl_u/overridetree.cb b/src/mainboard/intel/coffeelake_rvp/variants/whl_u/overridetree.cb
index 309082ed4d3b..ded8e72c2391 100644
--- a/src/mainboard/intel/coffeelake_rvp/variants/whl_u/overridetree.cb
+++ b/src/mainboard/intel/coffeelake_rvp/variants/whl_u/overridetree.cb
@@ -44,21 +44,18 @@ chip soc/intel/cannonlake
register "sdcard_cd_gpio" = "GPP_G5"
device domain 0 on
- device pci 14.3 on
+ device ref cnvi_wifi on
chip drivers/wifi/generic
register "wake" = "PME_B0_EN_BIT"
device generic 0 on end
end
- end # CNVi wifi
- device pci 15.0 on end # I2C #0
- device pci 15.1 on end # I2C #1
- device pci 15.2 off end # I2C #2
- device pci 15.3 off end # I2C #3
- device pci 17.0 on end # SATA
- device pci 19.0 on end # I2C #4
- device pci 19.1 off end # I2C #5
- device pci 19.2 on end # UART #2
- device pci 1a.0 on end # eMMC
+ end
+ device ref i2c0 on end
+ device ref i2c1 on end
+ device ref sata on end
+ device ref i2c4 on end
+ device ref uart2 on end
+ device ref emmc on end
device ref pcie_rp1 on # x4 SLOT1
register "PcieRpSlotImplemented[0]" = "1"
end
@@ -68,7 +65,6 @@ chip soc/intel/cannonlake
device ref pcie_rp9 on
register "PcieRpSlotImplemented[8]" = "1"
end
- device pci 1e.1 off end # UART #1
- device pci 1f.6 on end # GbE
+ device ref gbe on end
end
end
diff --git a/src/mainboard/intel/ptlrvp/mainboard.c b/src/mainboard/intel/ptlrvp/mainboard.c
index e14c5ace797c..5b80d9d650af 100644
--- a/src/mainboard/intel/ptlrvp/mainboard.c
+++ b/src/mainboard/intel/ptlrvp/mainboard.c
@@ -28,12 +28,15 @@ void __weak variant_update_soc_chip_config(struct soc_intel_pantherlake_config *
static void mainboard_init(void *chip_info)
{
struct pad_config *padbased_table;
- const struct pad_config *base_pads;
- size_t base_num;
+ const struct pad_config *base_pads, *variant_diff_pads;
+ size_t base_num, variant_diff_num;
padbased_table = new_padbased_table();
base_pads = variant_gpio_table(&base_num);
gpio_padbased_override(padbased_table, base_pads, base_num);
+ variant_diff_pads = variant_board_gpio_diff_table(&variant_diff_num);
+ if (variant_diff_pads)
+ gpio_padbased_override(padbased_table, variant_diff_pads, variant_diff_num);
fw_config_gpio_padbased_override(padbased_table);
gpio_configure_pads_with_padbased(padbased_table);
free(padbased_table);
diff --git a/src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h b/src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h
index 0ee09a5835ba..05ddf5bb5f27 100644
--- a/src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/intel/ptlrvp/variants/baseboard/include/baseboard/variants.h
@@ -23,6 +23,7 @@ enum ptl_boardid {
*/
const struct pad_config *variant_gpio_table(size_t *num);
+const struct pad_config *variant_board_gpio_diff_table(size_t *num);
const struct pad_config *variant_early_gpio_table(size_t *num);
const struct pad_config *variant_romstage_gpio_table(size_t *num);
void fw_config_configure_pre_mem_gpio(void);
diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk b/src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk
index b9f1fd15dd42..598167cbe49d 100644
--- a/src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk
+++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/Makefile.mk
@@ -7,3 +7,4 @@ romstage-$(CONFIG_FW_CONFIG) += fw_config.c
ramstage-y += gpio.c
romstage-$(CONFIG_FW_CONFIG) += variant.c
ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
+ramstage-$(CONFIG_FW_CONFIG) += variant.c
diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c b/src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c
index 9531065689c7..7b4dbe3c9f6b 100644
--- a/src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c
+++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/gpio.c
@@ -3,10 +3,11 @@
#include <baseboard/gpio.h>
#include <baseboard/variants.h>
#include <boardid.h>
+#include <ec/intel/board_id.h>
#include <soc/gpio.h>
/* Pad configuration in ramstage*/
-static const struct pad_config gpio_table[] = {
+static const struct pad_config t3_gpio_table[] = {
/* GPP_A00: ESPI_IO0_EC_R */
/* GPP_A00 : GPP_A00 ==> ESPI_IO0_EC_R configured on reset, do not touch */
@@ -391,10 +392,48 @@ static const struct pad_config romstage_gpio_table[] = {
PAD_CFG_NF(GPP_C01, NONE, DEEP, NF1),
};
+/* Pad difference in ramstage for LP5 T4 RVP */
+static const struct pad_config t4_gpio_diff_table[] = {
+ /* GPP_B09: MOD_TCSS2_DISP_HPD1 */
+ PAD_CFG_NF(GPP_B09, NONE, DEEP, NF2),
+ /* GPP_B10: MOD_TCSS1_DISP_HPD2 */
+ PAD_CFG_NF(GPP_B10, NONE, DEEP, NF2),
+ /* GPP_B11: GEN4_SSD_PWREN */
+ PAD_CFG_GPO(GPP_B11, 1, PLTRST),
+
+ /* GPP_B14: Not used */
+ PAD_NC(GPP_B14, NONE),
+
+ /* GPP_B17: MOD_TCSS2_LSX_DIR_SEL_EDP_VDD_EN */
+ PAD_CFG_NF(GPP_B17, NONE, DEEP, NF2),
+
+ /* GPP_C06: X4_PCIE_SLOT_PWR_EN_N */
+ PAD_CFG_GPO(GPP_C06, 0, DEEP),
+ /* GPP_C07: X4_DT_PCIE_RST_N */
+ PAD_CFG_GPO(GPP_C07, 1, DEEP),
+
+ /* GPP_D01: MOD_TCSS2_TYP_A_VBUS_EN_EDP_BKLT_EN */
+ PAD_CFG_NF(GPP_D01, NONE, DEEP, NF2),
+ /* GPP_D02: MOD_TCSS2_EDP_BKLT_CTRL */
+ PAD_CFG_NF(GPP_D02, NONE, DEEP, NF2),
+
+ /* GPP_D20: CLKREQ7_X4_GEN5_DT_CEM_SLOT_N */
+ PAD_CFG_NF(GPP_D20, NONE, DEEP, NF1),
+
+ /* GPP_E08: M2_GEN4_SSD_RESET_N */
+ PAD_CFG_GPO(GPP_E08, 1, PLTRST),
+
+ /* GPP_F23: SMC_LID */
+ PAD_CFG_GPI_TRIG_OWN(GPP_F23, NONE, DEEP, LEVEL, ACPI),
+
+ /* GPP_V17: TCP_RT_S0IX_ENTRY_EXIT_N */
+ PAD_CFG_GPO(GPP_V17, 1, PLTRST),
+};
+
const struct pad_config *variant_gpio_table(size_t *num)
{
- *num = ARRAY_SIZE(gpio_table);
- return gpio_table;
+ *num = ARRAY_SIZE(t3_gpio_table);
+ return t3_gpio_table;
}
const struct pad_config *variant_early_gpio_table(size_t *num)
@@ -410,6 +449,24 @@ const struct pad_config *variant_romstage_gpio_table(size_t *num)
return romstage_gpio_table;
}
+const struct pad_config *variant_board_gpio_diff_table(size_t *num)
+{
+ int board_id = get_rvp_board_id();
+
+ switch (board_id) {
+ case PTLP_LP5_T3_RVP:
+ return NULL;
+ case PTLP_LP5_T4_RVP:
+ *num = ARRAY_SIZE(t4_gpio_diff_table);
+ return t4_gpio_diff_table;
+ case GCS_32GB:
+ case GCS_64GB:
+ return NULL;
+ default:
+ die("Unknown board ID = 0x%x\n", board_id);
+ }
+}
+
static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE0_NAME),
CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE1_NAME),
diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c
index 6a1706fe9fe1..350405dc2920 100644
--- a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c
+++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory.c
@@ -65,7 +65,7 @@ static const struct mb_cfg gcs_mem_config = {
},
};
-static const struct mb_cfg lp5_mem_config = {
+static const struct mb_cfg lp5_t3_mem_config = {
.type = MEM_TYPE_LP5X,
.lpx_dq_map = {
@@ -125,6 +125,66 @@ static const struct mb_cfg lp5_mem_config = {
},
};
+static const struct mb_cfg lp5_t4_mem_config = {
+ .type = MEM_TYPE_LP5X,
+
+ .lpx_dq_map = {
+ .ddr0 = {
+ .dq0 = { 10, 8, 11, 9, 15, 12, 14, 13 },
+ .dq1 = { 6, 7, 5, 4, 3, 1, 0, 2 },
+ },
+ .ddr1 = {
+ .dq0 = { 1, 0, 3, 2, 7, 6, 5, 4 },
+ .dq1 = { 14, 13, 12, 15, 11, 9, 8, 10 },
+ },
+ .ddr2 = {
+ .dq0 = { 13, 14, 12, 15, 8, 10, 9, 11 },
+ .dq1 = { 6, 7, 5, 4, 1, 3, 2, 0 },
+ },
+ .ddr3 = {
+ .dq0 = { 6, 5, 7, 4, 3, 2, 0, 1 },
+ .dq1 = { 14, 13, 12, 15, 11, 9, 8, 10 },
+ },
+ .ddr4 = {
+ .dq0 = { 10, 8, 9, 11, 13, 12, 14, 15 },
+ .dq1 = { 1, 3, 0, 2, 4, 7, 5, 6 },
+ },
+ .ddr5 = {
+ .dq0 = { 1, 0, 2, 3, 7, 6, 5, 4 },
+ .dq1 = { 10, 8, 11, 9, 13, 12, 14, 15 },
+ },
+ .ddr6 = {
+ .dq0 = { 10, 8, 11, 9, 13, 12, 14, 15 },
+ .dq1 = { 6, 5, 7, 4, 0, 1, 2, 3 },
+ },
+ .ddr7 = {
+ .dq0 = { 1, 0, 2, 3, 7, 4, 6, 5 },
+ .dq1 = { 14, 13, 15, 12, 10, 11, 9, 8 },
+ },
+ },
+
+ .lpx_dqs_map = {
+ .ddr0 = { .dqs0 = 1, .dqs1 = 0 },
+ .ddr1 = { .dqs0 = 0, .dqs1 = 1 },
+ .ddr2 = { .dqs0 = 1, .dqs1 = 0 },
+ .ddr3 = { .dqs0 = 0, .dqs1 = 1 },
+ .ddr4 = { .dqs0 = 1, .dqs1 = 0 },
+ .ddr5 = { .dqs0 = 0, .dqs1 = 1 },
+ .ddr6 = { .dqs0 = 1, .dqs1 = 0 },
+ .ddr7 = { .dqs0 = 0, .dqs1 = 1 }
+ },
+
+ .ect = true, /* Early Command Training */
+
+ .lp_ddr_dq_dqs_re_training = 1,
+
+ .user_bd = BOARD_TYPE_ULT_ULX,
+
+ .lp5x_config = {
+ .ccc_config = 0xFF,
+ },
+};
+
static const struct mb_cfg ddr5_mem_config = {
.type = MEM_TYPE_DDR5,
@@ -149,8 +209,9 @@ const struct mb_cfg *variant_memory_params(void)
switch (board_id) {
case PTLP_LP5_T3_RVP:
+ return &lp5_t3_mem_config;
case PTLP_LP5_T4_RVP:
- return &lp5_mem_config;
+ return &lp5_t4_mem_config;
case GCS_32GB:
case GCS_64GB:
return &gcs_mem_config;
diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk
index 1a93597f4e47..5575815d1b21 100644
--- a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk
+++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/Makefile.mk
@@ -6,3 +6,4 @@
SPD_SOURCES =
SPD_SOURCES += spd/lp5/set-0/spd-7.hex # ID = 0(0b0000) Parts = H58G56BK7BX068
SPD_SOURCES += spd/lp5/set-0/spd-10.hex # ID = 1(0b0001) Parts = H58G66BK8BX067
+SPD_SOURCES += spd/lp5/set-0/spd-11.hex # ID = 2(0b0010) Parts = H58G56BK8BX068
diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt
index 7f7236d0eca2..244c063804ef 100644
--- a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt
+++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/dram_id.generated.txt
@@ -6,3 +6,4 @@
DRAM Part Name ID to assign
H58G56BK7BX068 0 (0000)
H58G66BK8BX067 1 (0001)
+H58G56BK8BX068 2 (0010)
diff --git a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt
index 86a6e201d78f..98255ad4d3b3 100644
--- a/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt
+++ b/src/mainboard/intel/ptlrvp/variants/ptlrvp/memory/mem_parts_used.txt
@@ -11,3 +11,4 @@
# Part Name
H58G56BK7BX068
H58G66BK8BX067
+H58G56BK8BX068
diff --git a/src/mainboard/lenovo/m900_tiny/data.vbt b/src/mainboard/lenovo/m900_tiny/data.vbt
index 7e6fe3dc1399..4c26ae512bd8 100644
--- a/src/mainboard/lenovo/m900_tiny/data.vbt
+++ b/src/mainboard/lenovo/m900_tiny/data.vbt
Binary files differ
diff --git a/src/mainboard/starlabs/starbook/variants/tgl/gpio.c b/src/mainboard/starlabs/starbook/variants/tgl/gpio.c
index 0aa6cbe7b4d6..82d1a21a0e94 100644
--- a/src/mainboard/starlabs/starbook/variants/tgl/gpio.c
+++ b/src/mainboard/starlabs/starbook/variants/tgl/gpio.c
@@ -97,15 +97,17 @@ const struct pad_config gpio_table[] = {
PAD_CFG_GPO(GPP_B14, 0, RSMRST), /* Top Swap [ Disabled / Enabled ] */
PAD_CFG_GPO(GPP_B18, 0, RSMRST), /* Reboot Support [ Enabled / Disabled ] */
PAD_CFG_GPO(GPP_C2, 1, RSMRST), /* TLS Confidentiality [ Disabled / Enabled ] */
- PAD_CFG_GPO(GPP_B23, 0, DEEP), /* XTAL [ 38.4Mhz / 19.2MHz ] */
- PAD_CFG_GPO(GPP_C5, 0, RSMRST), /* eSPI [ Enabled / Disabled ] */
+ PAD_CFG_GPO(GPP_B22, 0, RSMRST), /* eSPI [ Enabled / Disabled ] */
PAD_CFG_GPO(GPP_E6, 0, RSMRST), /* JTAG ODT [ Disabled / Enabled ] */
- PAD_CFG_GPO(GPP_E21, 0, RSMRST), /* TBT LSX #1 [ 1.8V / 3.3V ] */
+ PAD_CFG_GPO(GPP_C5, 0, RSMRST), /* BFX Strap 2 Bit 1 [ Disabled / Enabled ] */
PAD_CFG_GPO(GPP_H0, 0, RSMRST), /* BFX Strap 2 Bit 2 [ Disabled / Enabled ] */
PAD_CFG_GPO(GPP_H1, 0, RSMRST), /* BFX Strap 2 Bit 3 [ Disabled / Enabled ] */
PAD_CFG_GPO(GPP_H2, 0, RSMRST), /* BFX Strap 2 Bit 4 [ Disabled / Enabled ] */
+ PAD_CFG_GPO(GPP_E21, 0, RSMRST), /* TBT LSX #1 [ 1,8V / 3.3V ] */
PAD_CFG_GPO(GPP_F7, 0, RSMRST), /* MCRO LDO [ Disabled / Bypass ] */
PAD_CFG_GPO(GPD7, 0, RSMRST), /* RTC Clock Delay [ Disabled / 95ms ] */
+ PAD_CFG_GPO(GPP_B23, 0, DEEP), /* CPUNSSC [ 19.2MHz / 38.4MHz ] */
+ PAD_CFG_GPO(GPP_F10, 0, DEEP), /* XTAL Mode [ Attached / Single ] */
PAD_NC(GPD2, NONE),
PAD_NC(GPD6, NONE),
@@ -140,8 +142,6 @@ const struct pad_config gpio_table[] = {
PAD_NC(GPP_B19, NONE),
PAD_NC(GPP_B20, NONE),
PAD_NC(GPP_B21, NONE),
- PAD_NC(GPP_B22, NONE),
-
PAD_NC(GPP_C3, NONE),
PAD_NC(GPP_C4, NONE),
PAD_NC(GPP_C9, NONE),
@@ -198,7 +198,6 @@ const struct pad_config gpio_table[] = {
PAD_NC(GPP_F6, NONE),
PAD_NC(GPP_F8, NONE),
PAD_NC(GPP_F9, NONE),
- PAD_NC(GPP_F10, NONE),
PAD_NC(GPP_F11, NONE),
PAD_NC(GPP_F12, NONE),
PAD_NC(GPP_F13, NONE),
@@ -213,6 +212,7 @@ const struct pad_config gpio_table[] = {
PAD_NC(GPP_F22, NONE),
PAD_NC(GPP_F23, NONE),
+ /* H3: Not Connected */
PAD_NC(GPP_H3, NONE),
PAD_NC(GPP_H4, NONE),
PAD_NC(GPP_H5, NONE),
diff --git a/src/security/intel/stm/StmPlatformSmm.c b/src/security/intel/stm/StmPlatformSmm.c
index 9c5ae5264e5b..99e62c77c032 100644
--- a/src/security/intel/stm/StmPlatformSmm.c
+++ b/src/security/intel/stm/StmPlatformSmm.c
@@ -4,6 +4,7 @@
#include <security/intel/stm/SmmStm.h>
#include <security/intel/stm/StmPlatformResource.h>
#include <security/tpm/tspi.h>
+#include <cpu/x86/gdt.h>
#include <cpu/x86/smm.h>
#include <cpu/x86/msr.h>
@@ -11,7 +12,6 @@
#include <console/console.h>
#include <stdbool.h>
#include <stdint.h>
-#include <arch/rom_segs.h>
/*
* Load STM image to MSEG
@@ -109,11 +109,11 @@ void setup_smm_descriptor(void *smbase, int32_t apic_id, int32_t entry32_off)
psd->acpi_rsdp = 0;
psd->bios_hw_resource_requirements_ptr =
(uint64_t)((uintptr_t)get_stm_resource());
- psd->smm_cs = ROM_CODE_SEG;
- psd->smm_ds = ROM_DATA_SEG;
- psd->smm_ss = ROM_DATA_SEG;
- psd->smm_other_segment = ROM_DATA_SEG;
- psd->smm_tr = SMM_TASK_STATE_SEG;
+ psd->smm_cs = GDT_CODE_SEG;
+ psd->smm_ds = GDT_DATA_SEG;
+ psd->smm_ss = GDT_DATA_SEG;
+ psd->smm_other_segment = GDT_DATA_SEG;
+ psd->smm_tr = GDT_TASK_STATE_SEG;
// At this point the coreboot smm_stub is relative to the default
// smbase and not the one for the smi handler in tseg. So we have
diff --git a/src/security/intel/txt/getsec_enteraccs.S b/src/security/intel/txt/getsec_enteraccs.S
index ff9db05f0608..9c0f5319a3f7 100644
--- a/src/security/intel/txt/getsec_enteraccs.S
+++ b/src/security/intel/txt/getsec_enteraccs.S
@@ -3,7 +3,7 @@
#include <cpu/x86/mtrr.h>
#include <cpu/x86/cr.h>
#include <cpu/x86/msr.h>
-#include <arch/ram_segs.h>
+#include <cpu/x86/gdt.h>
#include "getsec_mtrr_setup.inc"
@@ -257,10 +257,10 @@ cond_clear_var_mtrrs:
lgdt -48(%ebp)
/* Set cs */
- ljmp $RAM_CODE_SEG, $1f
+ ljmp $GDT_CODE_SEG, $1f
1:
/* Fix segment registers */
- movl $RAM_DATA_SEG, %eax
+ movl $GDT_DATA_SEG, %eax
movl %eax, %ds
movl %eax, %es
movl %eax, %ss
diff --git a/src/soc/amd/mendocino/fsp_s_params.c b/src/soc/amd/mendocino/fsp_s_params.c
index 5393eba911f7..23b2cfe5ced3 100644
--- a/src/soc/amd/mendocino/fsp_s_params.c
+++ b/src/soc/amd/mendocino/fsp_s_params.c
@@ -59,7 +59,7 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
payload_preload();
}
-void soc_load_logo(FSPS_UPD *supd)
+void soc_load_logo_by_fsp(FSPS_UPD *supd)
{
size_t logo_size;
supd->FspsConfig.logo_bmp_buffer = (uint32_t)(uintptr_t)bmp_load_logo(&logo_size);
diff --git a/src/soc/amd/phoenix/Kconfig b/src/soc/amd/phoenix/Kconfig
index 995b1cc535f7..ac227b9f6fd0 100644
--- a/src/soc/amd/phoenix/Kconfig
+++ b/src/soc/amd/phoenix/Kconfig
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# TODO: Evaluate what can be moved to a common directory
-# TODO: Update for Phoenix
config SOC_AMD_PHOENIX_BASE
bool
diff --git a/src/soc/amd/phoenix/Makefile.mk b/src/soc/amd/phoenix/Makefile.mk
index 878ebe7bb7c6..68cc935f7535 100644
--- a/src/soc/amd/phoenix/Makefile.mk
+++ b/src/soc/amd/phoenix/Makefile.mk
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# TODO: Move as much as possible to common
-# TODO: Update for Phoenix
ifeq ($(CONFIG_SOC_AMD_PHOENIX_BASE),y)
diff --git a/src/soc/amd/phoenix/acpi.c b/src/soc/amd/phoenix/acpi.c
index 1475b6166ad9..0f0ec26daebc 100644
--- a/src/soc/amd/phoenix/acpi.c
+++ b/src/soc/amd/phoenix/acpi.c
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-/* TODO: Update for Phoenix */
/* TODO: See what can be made common */
/* ACPI - create the Fixed ACPI Description Tables (FADT) */
diff --git a/src/soc/amd/phoenix/chip.h b/src/soc/amd/phoenix/chip.h
index eabd44518e1c..fb0ef0f78a22 100644
--- a/src/soc/amd/phoenix/chip.h
+++ b/src/soc/amd/phoenix/chip.h
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-/* TODO: Update for Phoenix */
-
#ifndef PHOENIX_CHIP_H
#define PHOENIX_CHIP_H
diff --git a/src/soc/intel/alderlake/Makefile.mk b/src/soc/intel/alderlake/Makefile.mk
index 55fc83ea7c52..6262cf29993e 100644
--- a/src/soc/intel/alderlake/Makefile.mk
+++ b/src/soc/intel/alderlake/Makefile.mk
@@ -70,11 +70,6 @@ endif
CPPFLAGS_common += -I$(src)/soc/intel/alderlake
CPPFLAGS_common += -I$(src)/soc/intel/alderlake/include
-# Include the missing MemInfoHob.h from vendorcode
-ifeq ($(CONFIG_SOC_INTEL_RAPTORLAKE_PCH_S)$(CONFIG_FSP_TYPE_IOT),yy)
-CPPFLAGS_common += -I$(src)/vendorcode/intel/fsp/fsp2_0/iot/raptorlake_s
-endif
-
ifeq ($(CONFIG_SOC_INTEL_ALDERLAKE_PCH_S),y)
# 06-97-00, 06-97-01, 06-97-04 are ADL-S Engineering Samples
# 06-97-02 are ADL-S/HX Quality Samples but also ADL-HX Engineering Samples
diff --git a/src/soc/intel/alderlake/fsp_params.c b/src/soc/intel/alderlake/fsp_params.c
index 380f40ba601d..a788319efc6f 100644
--- a/src/soc/intel/alderlake/fsp_params.c
+++ b/src/soc/intel/alderlake/fsp_params.c
@@ -1249,6 +1249,9 @@ static void soc_silicon_init_params(FSP_S_CONFIG *s_cfg,
/* Override settings per board if required. */
mainboard_update_soc_chip_config(config);
+ /* Runtime configuration of S0ix */
+ config->s0ix_enable = get_uint_option("s0ix_enable", config->s0ix_enable);
+
void (*const fill_fsps_params[])(FSP_S_CONFIG *s_cfg,
const struct soc_intel_alderlake_config *config) = {
fill_fsps_lpss_params,
@@ -1378,7 +1381,7 @@ __weak void mainboard_silicon_init_params(FSP_S_CONFIG *s_cfg)
}
/* Handle FSP logo params */
-void soc_load_logo(FSPS_UPD *supd)
+void soc_load_logo_by_fsp(FSPS_UPD *supd)
{
struct soc_intel_common_config *config = chip_get_common_soc_structure();
FSP_S_CONFIG *s_cfg = &supd->FspsConfig;
diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c
index ab5b5d884d0f..c5553780ea59 100644
--- a/src/soc/intel/apollolake/chip.c
+++ b/src/soc/intel/apollolake/chip.c
@@ -914,7 +914,7 @@ void mainboard_silicon_init_params(FSP_S_CONFIG *silconfig)
}
/* Handle FSP logo params */
-void soc_load_logo(FSPS_UPD *supd)
+void soc_load_logo_by_fsp(FSPS_UPD *supd)
{
size_t logo_size;
supd->FspsConfig.LogoPtr = (uint32_t)(uintptr_t)bmp_load_logo(&logo_size);
diff --git a/src/soc/intel/cannonlake/fsp_params.c b/src/soc/intel/cannonlake/fsp_params.c
index 993efbb10785..2e00018f369d 100644
--- a/src/soc/intel/cannonlake/fsp_params.c
+++ b/src/soc/intel/cannonlake/fsp_params.c
@@ -801,7 +801,7 @@ __weak void mainboard_silicon_init_params(FSPS_UPD *supd)
}
/* Handle FSP logo params */
-void soc_load_logo(FSPS_UPD *supd)
+void soc_load_logo_by_fsp(FSPS_UPD *supd)
{
size_t logo_size;
supd->FspsConfig.LogoPtr = (uintptr_t)bmp_load_logo(&logo_size);
diff --git a/src/soc/intel/common/block/include/intelblocks/cfg.h b/src/soc/intel/common/block/include/intelblocks/cfg.h
index 856352096147..299e923d85c4 100644
--- a/src/soc/intel/common/block/include/intelblocks/cfg.h
+++ b/src/soc/intel/common/block/include/intelblocks/cfg.h
@@ -14,6 +14,76 @@ enum {
};
/*
+ * Specifies the vertical alignment for the splash screen image.
+ *
+ * Visual Guide (representing the display area and the [LOGO]):
+ *
+ * Each option dictates the vertical placement of the splash image
+ * within the display's height.
+ */
+enum fw_splash_vertical_alignment {
+ /* FW_SPLASH_VALIGNMENT_CENTER:
+ * The splash image is centered vertically `(Y-axis - logo_height)/2` on the screen.
+ * The center of the [LOGO] aligns with the vertical center of the screen.
+ *
+ * +---------------+
+ * | |
+ * | |
+ * | [LOGO] | <-- Vertically Centered
+ * | |
+ * | |
+ * +---------------+
+ */
+ FW_SPLASH_VALIGNMENT_CENTER = 0,
+
+ /* FW_SPLASH_VALIGNMENT_TOP:
+ * The splash image is aligned to the top edge of the screen.
+ *
+ * +---------------+
+ * | [LOGO] | <-- Top Aligned
+ * | |
+ * | |
+ * | |
+ * | |
+ * +---------------+
+ */
+ FW_SPLASH_VALIGNMENT_TOP = 1,
+
+ /* FW_SPLASH_VALIGNMENT_BOTTOM:
+ * The splash image is aligned to the bottom edge of the screen.
+ *
+ * +---------------+
+ * | |
+ * | |
+ * | |
+ * | |
+ * | [LOGO] | <-- Bottom Aligned
+ * +---------------+
+ */
+ FW_SPLASH_VALIGNMENT_BOTTOM = 2,
+
+ /* FW_SPLASH_VALIGNMENT_MIDDLE:
+ * The splash image is placed in the vertical middle `(Y-axis/2)` of the screen
+ * (without considering the `logo height`). This means the TOP EDGE of the
+ * [LOGO] aligns with the screen's vertical midpoint line.
+ *
+ * +---------------+
+ * | (Upper Half) |
+ * | |
+ * | [LOGO] | <-- [LOGO] aligns at Middle of the Y-axis
+ * | |
+ * | (Lower Half) |
+ * +---------------+
+ *
+ * Note: The distinction between CENTER and MIDDLE is relevant as in for MIDDLE
+ * alignment, it ignores the logo height (i.e., the logo's top edge is placed
+ * at the screen's Y-midpoint). CENTER alignment, by contrast, would place
+ * the geometrical center of the logo at the screen's Y-midpoint.
+ */
+ FW_SPLASH_VALIGNMENT_MIDDLE = 3,
+};
+
+/*
* This structure will hold data required by common blocks.
* These are soc specific configurations which will be filled by soc.
* We'll fill this structure once during init and use the data in common block.
@@ -26,6 +96,7 @@ struct soc_intel_common_config {
uint8_t pch_thermal_trip;
struct mmc_dll_params emmc_dll;
enum lb_fb_orientation panel_orientation;
+ enum fw_splash_vertical_alignment logo_valignment;
};
/* This function to retrieve soc config structure required by common code */
diff --git a/src/soc/intel/elkhartlake/fsp_params.c b/src/soc/intel/elkhartlake/fsp_params.c
index 2f2e7408c470..082acaf7ae2c 100644
--- a/src/soc/intel/elkhartlake/fsp_params.c
+++ b/src/soc/intel/elkhartlake/fsp_params.c
@@ -505,6 +505,9 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
/* Override/Fill FSP Silicon Param for mainboard */
mainboard_silicon_init_params(params);
+
+ /* Runtime configuration of S0ix */
+ config->s0ix_enable = get_uint_option("s0ix_enable", config->s0ix_enable);
}
/* Mainboard GPIO Configuration */
diff --git a/src/soc/intel/jasperlake/fsp_params.c b/src/soc/intel/jasperlake/fsp_params.c
index 3bad53342407..b01610d2fed8 100644
--- a/src/soc/intel/jasperlake/fsp_params.c
+++ b/src/soc/intel/jasperlake/fsp_params.c
@@ -253,6 +253,9 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
/* Override/Fill FSP Silicon Param for mainboard */
mainboard_silicon_init_params(params);
+
+ /* Runtime configuration of S0ix */
+ config->s0ix_enable = get_uint_option("s0ix_enable", config->s0ix_enable);
}
/* Mainboard GPIO Configuration */
diff --git a/src/soc/intel/meteorlake/fsp_params.c b/src/soc/intel/meteorlake/fsp_params.c
index ad85702dbeb7..30ea478432ba 100644
--- a/src/soc/intel/meteorlake/fsp_params.c
+++ b/src/soc/intel/meteorlake/fsp_params.c
@@ -784,6 +784,9 @@ static void soc_silicon_init_params(FSP_S_CONFIG *s_cfg,
/* Override settings per board if required. */
mainboard_update_soc_chip_config(config);
+ /* Runtime configuration of S0ix */
+ config->s0ix_enable = get_uint_option("s0ix_enable", config->s0ix_enable);
+
void (*fill_fsps_params[])(FSP_S_CONFIG *s_cfg,
const struct soc_intel_meteorlake_config *config) = {
fill_fsps_lpss_params,
@@ -868,7 +871,7 @@ __weak void mainboard_silicon_init_params(FSP_S_CONFIG *s_cfg)
}
/* Handle FSP logo params */
-void soc_load_logo(FSPS_UPD *supd)
+void soc_load_logo_by_fsp(FSPS_UPD *supd)
{
struct soc_intel_common_config *config = chip_get_common_soc_structure();
FSP_S_CONFIG *s_cfg = &supd->FspsConfig;
diff --git a/src/soc/intel/pantherlake/Kconfig b/src/soc/intel/pantherlake/Kconfig
index 23eaaa61edf4..6787642f24e4 100644
--- a/src/soc/intel/pantherlake/Kconfig
+++ b/src/soc/intel/pantherlake/Kconfig
@@ -72,7 +72,7 @@ config SOC_INTEL_PANTHERLAKE_BASE
select SOC_INTEL_COMMON_BLOCK_HECI1_DISABLE_USING_PMC_IPC
select SOC_INTEL_COMMON_BLOCK_IOC
select SOC_INTEL_COMMON_BLOCK_IOE_P2SB
- select SOC_INTEL_COMMON_BLOCK_IPU
+ select SOC_INTEL_COMMON_BLOCK_IPU if SOC_INTEL_PANTHERLAKE
select SOC_INTEL_COMMON_BLOCK_IRQ
select SOC_INTEL_COMMON_BLOCK_ME_SPEC_21
select SOC_INTEL_COMMON_BLOCK_MEMINIT
@@ -104,6 +104,7 @@ config SOC_INTEL_PANTHERLAKE_BASE
select TSC_MONOTONIC_TIMER
select UDELAY_TSC
select UDK_202302_BINDING
+ select USE_COREBOOT_FOR_BMP_RENDERING
select USE_X86_64_SUPPORT
select X86_INIT_NEED_1_SIPI
help
@@ -192,7 +193,8 @@ config HEAP_SIZE
config CHIPSET_DEVICETREE
string
- default "soc/intel/pantherlake/chipset.cb"
+ default "soc/intel/pantherlake/chipset_wcl.cb" if SOC_INTEL_WILDCATLAKE
+ default "soc/intel/pantherlake/chipset_ptl.cb"
config EXT_BIOS_WIN_BASE
default 0xf8000000
@@ -230,15 +232,18 @@ endif # SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES
config MAX_TBT_ROOT_PORTS
int
+ default 2 if SOC_INTEL_WILDCATLAKE
default 4
config MAX_ROOT_PORTS
int
+ default 6 if SOC_INTEL_WILDCATLAKE
default 10 if SOC_INTEL_PANTHERLAKE_H
default 12
config MAX_PCIE_CLOCK_SRC
int
+ default 6 if SOC_INTEL_WILDCATLAKE
default 9
config SMM_TSEG_SIZE
diff --git a/src/soc/intel/pantherlake/acpi.c b/src/soc/intel/pantherlake/acpi.c
index 1c965f411ee1..0252e1c5032a 100644
--- a/src/soc/intel/pantherlake/acpi.c
+++ b/src/soc/intel/pantherlake/acpi.c
@@ -214,12 +214,14 @@ static struct min_sleep_state min_pci_sleep_states[] = {
{ PCI_DEVFN_PCIE4, ACPI_DEVICE_SLEEP_D0 },
{ PCI_DEVFN_PCIE5, ACPI_DEVICE_SLEEP_D0 },
{ PCI_DEVFN_PCIE6, ACPI_DEVICE_SLEEP_D0 },
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
{ PCI_DEVFN_PCIE7, ACPI_DEVICE_SLEEP_D0 },
{ PCI_DEVFN_PCIE8, ACPI_DEVICE_SLEEP_D0 },
{ PCI_DEVFN_PCIE9, ACPI_DEVICE_SLEEP_D0 },
{ PCI_DEVFN_PCIE10, ACPI_DEVICE_SLEEP_D0 },
{ PCI_DEVFN_PCIE11, ACPI_DEVICE_SLEEP_D0 },
{ PCI_DEVFN_PCIE12, ACPI_DEVICE_SLEEP_D0 },
+#endif
{ PCI_DEVFN_UART0, ACPI_DEVICE_SLEEP_D3 },
{ PCI_DEVFN_UART1, ACPI_DEVICE_SLEEP_D3 },
{ PCI_DEVFN_GSPI0, ACPI_DEVICE_SLEEP_D3 },
diff --git a/src/soc/intel/pantherlake/bootblock/report_platform.c b/src/soc/intel/pantherlake/bootblock/report_platform.c
index 28ec7473af32..07e12619161d 100644
--- a/src/soc/intel/pantherlake/bootblock/report_platform.c
+++ b/src/soc/intel/pantherlake/bootblock/report_platform.c
@@ -32,6 +32,8 @@ static struct {
{ PCI_DID_INTEL_PTL_H_ID_2, "Pantherlake H" },
{ PCI_DID_INTEL_PTL_H_ID_3, "Pantherlake H" },
{ PCI_DID_INTEL_PTL_H_ID_4, "Pantherlake H" },
+ { PCI_DID_INTEL_WCL_ID_1, "Wildcatlake" },
+ { PCI_DID_INTEL_WCL_ID_2, "Wildcatlake" },
};
static struct {
@@ -102,6 +104,38 @@ static struct {
{ PCI_DID_INTEL_PTL_H_ESPI_29, "Pantherlake SOC-H" },
{ PCI_DID_INTEL_PTL_H_ESPI_30, "Pantherlake SOC-H" },
{ PCI_DID_INTEL_PTL_H_ESPI_31, "Pantherlake SOC-H" },
+ { PCI_DID_INTEL_WCL_ESPI_0, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_1, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_2, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_3, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_4, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_5, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_6, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_7, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_8, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_9, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_10, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_11, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_12, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_13, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_14, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_15, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_16, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_17, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_18, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_19, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_20, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_21, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_22, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_23, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_24, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_25, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_26, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_27, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_28, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_29, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_30, "Wildcatlake SOC" },
+ { PCI_DID_INTEL_WCL_ESPI_31, "Wildcatlake SOC" },
};
static struct {
@@ -112,6 +146,8 @@ static struct {
{ PCI_DID_INTEL_PTL_H_GT2_1, "Pantherlake-H GT2" },
{ PCI_DID_INTEL_PTL_H_GT2_2, "Pantherlake-H GT2" },
{ PCI_DID_INTEL_PTL_H_GT2_3, "Pantherlake-H GT2" },
+ { PCI_DID_INTEL_WCL_GT2_1, "Wildcatlake GT2" },
+ { PCI_DID_INTEL_WCL_GT2_2, "Wildcatlake GT2" },
};
static inline uint8_t get_dev_revision(pci_devfn_t dev)
diff --git a/src/soc/intel/pantherlake/chip.c b/src/soc/intel/pantherlake/chip.c
index 5fe2a37043b8..317fa5fa0e13 100644
--- a/src/soc/intel/pantherlake/chip.c
+++ b/src/soc/intel/pantherlake/chip.c
@@ -102,12 +102,14 @@ const char *soc_acpi_name(const struct device *dev)
case PCI_DEVFN_PCIE4: return "RP04";
case PCI_DEVFN_PCIE5: return "RP05";
case PCI_DEVFN_PCIE6: return "RP06";
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
case PCI_DEVFN_PCIE7: return "RP07";
case PCI_DEVFN_PCIE8: return "RP08";
case PCI_DEVFN_PCIE9: return "RP09";
case PCI_DEVFN_PCIE10: return "RP10";
case PCI_DEVFN_PCIE11: return "RP11";
case PCI_DEVFN_PCIE12: return "RP12";
+#endif
case PCI_DEVFN_PMC: return "PMC";
case PCI_DEVFN_UART0: return "UAR0";
case PCI_DEVFN_UART1: return "UAR1";
diff --git a/src/soc/intel/pantherlake/chipset.cb b/src/soc/intel/pantherlake/chipset_ptl.cb
index 0c57a7def608..0c57a7def608 100644
--- a/src/soc/intel/pantherlake/chipset.cb
+++ b/src/soc/intel/pantherlake/chipset_ptl.cb
diff --git a/src/soc/intel/pantherlake/chipset_wcl.cb b/src/soc/intel/pantherlake/chipset_wcl.cb
new file mode 100644
index 000000000000..c5f1d2bd1109
--- /dev/null
+++ b/src/soc/intel/pantherlake/chipset_wcl.cb
@@ -0,0 +1,132 @@
+chip soc/intel/pantherlake
+
+ device cpu_cluster 0 on end
+
+ # TODO: Add WCL power limits
+
+ # Reduce the size of BasicMemoryTests to speed up the boot time.
+ register "lower_basic_mem_test_size" = "true"
+
+ # NOTE: if any variant wants to override this value, use the same format
+ # as register "common_soc_config.pch_thermal_trip" = "value", instead of
+ # putting it under register "common_soc_config" in overridetree.cb file.
+ register "common_soc_config.pch_thermal_trip" = "125"
+
+ device domain 0 on
+ device pci 00.0 alias system_agent on end
+ device pci 02.0 alias igpu on end
+ device pci 04.0 alias dtt off end
+ device pci 06.0 alias pcie_rp5 off end
+ device pci 06.1 alias pcie_rp6 off end
+ device pci 07.0 alias tbt_pcie_rp0 off
+ chip soc/intel/common/block/usb4
+ use tcss_dma0 as usb4_port
+ device generic 0 on end
+ end
+ end
+ device pci 07.1 alias tbt_pcie_rp1 off
+ chip soc/intel/common/block/usb4
+ use tcss_dma0 as usb4_port
+ device generic 1 on end
+ end
+ end
+ device pci 0a.0 alias crashlog on end
+ device pci 0b.0 alias npu off end
+ device pci 0c.0 alias iaa on end
+ device pci 0d.0 alias tcss_xhci off
+ chip drivers/usb/acpi
+ register "type" = "UPC_TYPE_HUB"
+ device usb 0.0 alias tcss_root_hub off
+ chip drivers/usb/acpi
+ device usb 3.0 alias tcss_usb3_port0 off end
+ end
+ chip drivers/usb/acpi
+ device usb 3.1 alias tcss_usb3_port1 off end
+ end
+ end
+ end
+ end
+ device pci 0d.2 alias tcss_dma0 off end
+ device pci 0e.0 alias vmd off end
+ device pci 10.0 alias thc0 off end
+ device pci 10.1 alias thc1 off end
+ device pci 12.0 alias ish off end
+ device pci 12.1 alias p2sb2 hidden end
+ device pci 12.6 alias gspi0a off end
+ device pci 13.0 alias heci_1 off end
+ device pci 13.1 alias heci_2 off end
+ device pci 13.2 alias heci_3 off end
+ device pci 14.0 alias xhci on
+ chip drivers/usb/acpi
+ register "type" = "UPC_TYPE_HUB"
+ device usb 0.0 alias xhci_root_hub off
+ chip drivers/usb/acpi
+ device usb 2.0 alias usb2_port1 off end
+ end
+ chip drivers/usb/acpi
+ device usb 2.1 alias usb2_port2 off end
+ end
+ chip drivers/usb/acpi
+ device usb 2.2 alias usb2_port3 off end
+ end
+ chip drivers/usb/acpi
+ device usb 2.3 alias usb2_port4 off end
+ end
+ chip drivers/usb/acpi
+ device usb 2.4 alias usb2_port5 off end
+ end
+ chip drivers/usb/acpi
+ device usb 2.5 alias usb2_port6 off end
+ end
+ chip drivers/usb/acpi
+ device usb 2.6 alias usb2_port7 off end
+ end
+ chip drivers/usb/acpi
+ device usb 2.7 alias usb2_port8 off end
+ end
+ chip drivers/usb/acpi
+ device usb 3.0 alias usb3_port1 off end
+ end
+ chip drivers/usb/acpi
+ device usb 3.1 alias usb3_port2 off end
+ end
+ end
+ end
+ end
+ device pci 14.2 alias pmc_shared_sram off end
+ device pci 14.3 alias cnvi_wifi off end
+ device pci 14.7 alias cnvi_bluetooth off end
+ device pci 14.5 alias ieh off end
+ device pci 15.0 alias i2c0 off end
+ device pci 15.1 alias i2c1 off end
+ device pci 15.2 alias i2c2 off end
+ device pci 15.3 alias i2c3 off end
+ device pci 16.0 alias heci1 on end
+ device pci 16.1 alias heci2 off end
+ device pci 16.4 alias heci3 off end
+ device pci 16.5 alias heci4 off end
+ device pci 17.0 alias ufs off end
+ device pci 18.0 alias eheci1 off end
+ device pci 18.1 alias eheci2 off end
+ device pci 18.2 alias eheci3 off end
+ device pci 19.0 alias i2c4 off end
+ device pci 19.1 alias i2c5 off end
+ device pci 19.2 alias uart2 off end
+ device pci 1c.0 alias pcie_rp1 off end
+ device pci 1c.1 alias pcie_rp2 off end
+ device pci 1c.2 alias pcie_rp3 off end
+ device pci 1c.3 alias pcie_rp4 off end
+ device pci 1e.0 alias uart0 off end
+ device pci 1e.1 alias uart1 off end
+ device pci 1e.2 alias gspi0 off end
+ device pci 1e.3 alias gspi1 off end
+ device pci 1f.0 alias soc_espi on end
+ device pci 1f.1 alias p2sb hidden end
+ device pci 1f.2 alias pmc hidden end
+ device pci 1f.3 alias hda off end
+ device pci 1f.4 alias smbus off end
+ device pci 1f.5 alias fast_spi on end
+ device pci 1f.6 alias gbe off end
+ device pci 1f.7 alias npk off end
+ end
+end
diff --git a/src/soc/intel/pantherlake/elog.c b/src/soc/intel/pantherlake/elog.c
index 7750058be4f7..5abf766fc7ee 100644
--- a/src/soc/intel/pantherlake/elog.c
+++ b/src/soc/intel/pantherlake/elog.c
@@ -36,6 +36,7 @@ static void pch_log_rp_wake_source(void)
{ PCI_DEVFN_PCIE4, ELOG_WAKE_SOURCE_PME_PCIE4 },
{ PCI_DEVFN_PCIE5, ELOG_WAKE_SOURCE_PME_PCIE5 },
{ PCI_DEVFN_PCIE6, ELOG_WAKE_SOURCE_PME_PCIE6 },
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
{ PCI_DEVFN_PCIE7, ELOG_WAKE_SOURCE_PME_PCIE7 },
{ PCI_DEVFN_PCIE8, ELOG_WAKE_SOURCE_PME_PCIE8 },
{ PCI_DEVFN_PCIE9, ELOG_WAKE_SOURCE_PME_PCIE9 },
@@ -44,6 +45,7 @@ static void pch_log_rp_wake_source(void)
{ PCI_DEVFN_PCIE11, ELOG_WAKE_SOURCE_PME_PCIE11 },
{ PCI_DEVFN_PCIE12, ELOG_WAKE_SOURCE_PME_PCIE12 },
#endif
+#endif
};
for (size_t i = 0; i < MIN(CONFIG_MAX_ROOT_PORTS, ARRAY_SIZE(pme_map)); i++) {
@@ -62,7 +64,9 @@ static void pch_log_pme_internal_wake_source(void)
{ PCI_DEVFN_XHCI, ELOG_WAKE_SOURCE_PME_XHCI },
{ PCI_DEVFN_USBOTG, ELOG_WAKE_SOURCE_PME_XDCI },
{ PCI_DEVFN_CNVI_WIFI, ELOG_WAKE_SOURCE_PME_WIFI },
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
{ PCI_DEVFN_TCSS_XDCI, ELOG_WAKE_SOURCE_PME_TCSS_XDCI },
+#endif
};
const struct xhci_wake_info xhci_wake_info[] = {
{ PCI_DEVFN_XHCI, ELOG_WAKE_SOURCE_PME_XHCI },
diff --git a/src/soc/intel/pantherlake/fsp_params.c b/src/soc/intel/pantherlake/fsp_params.c
index cac866f39ab7..f45d333032e7 100644
--- a/src/soc/intel/pantherlake/fsp_params.c
+++ b/src/soc/intel/pantherlake/fsp_params.c
@@ -119,6 +119,7 @@ static const struct slot_irq_constraints irq_constraints[] = {
FIXED_INT_PIRQ(PCI_DEVFN_DPTF, PCI_INT_A, PIRQ_A),
},
},
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
{
.slot = PCI_DEV_SLOT_IPU,
.fns = {
@@ -127,15 +128,21 @@ static const struct slot_irq_constraints irq_constraints[] = {
FIXED_INT_PIRQ(PCI_DEVFN_IPU, PCI_INT_A, PIRQ_A),
},
},
+#endif
{
.slot = PCI_DEV_SLOT_PCIE_2,
.fns = {
+#if CONFIG(SOC_INTEL_WILDCATLAKE)
+ FIXED_INT_PIRQ(PCI_DEVFN_PCIE5, PCI_INT_A, PIRQ_A),
+ FIXED_INT_PIRQ(PCI_DEVFN_PCIE6, PCI_INT_B, PIRQ_B),
+#else
FIXED_INT_PIRQ(PCI_DEVFN_PCIE9, PCI_INT_A, PIRQ_A),
FIXED_INT_PIRQ(PCI_DEVFN_PCIE10, PCI_INT_B, PIRQ_B),
#if CONFIG(SOC_INTEL_PANTHERLAKE_H)
FIXED_INT_PIRQ(PCI_DEVFN_PCIE11, PCI_INT_C, PIRQ_C),
FIXED_INT_PIRQ(PCI_DEVFN_PCIE12, PCI_INT_D, PIRQ_D),
#endif
+#endif
},
},
{
@@ -143,8 +150,10 @@ static const struct slot_irq_constraints irq_constraints[] = {
.fns = {
ANY_PIRQ(PCI_DEVFN_TBT0),
ANY_PIRQ(PCI_DEVFN_TBT1),
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
ANY_PIRQ(PCI_DEVFN_TBT2),
ANY_PIRQ(PCI_DEVFN_TBT3),
+#endif
},
},
{
@@ -201,7 +210,7 @@ static const struct slot_irq_constraints irq_constraints[] = {
ANY_PIRQ(PCI_DEVFN_CSE_4),
},
},
-#if CONFIG(SOC_INTEL_PANTHERLAKE_U_H)
+#if (CONFIG(SOC_INTEL_PANTHERLAKE_U_H) || CONFIG(SOC_INTEL_WILDCATLAKE))
{
.slot = PCI_DEV_SLOT_UFS,
.fns = {
@@ -224,10 +233,12 @@ static const struct slot_irq_constraints irq_constraints[] = {
FIXED_INT_PIRQ(PCI_DEVFN_PCIE2, PCI_INT_B, PIRQ_B),
FIXED_INT_PIRQ(PCI_DEVFN_PCIE3, PCI_INT_C, PIRQ_C),
FIXED_INT_PIRQ(PCI_DEVFN_PCIE4, PCI_INT_D, PIRQ_D),
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
FIXED_INT_PIRQ(PCI_DEVFN_PCIE5, PCI_INT_A, PIRQ_A),
FIXED_INT_PIRQ(PCI_DEVFN_PCIE6, PCI_INT_B, PIRQ_B),
FIXED_INT_PIRQ(PCI_DEVFN_PCIE7, PCI_INT_C, PIRQ_C),
FIXED_INT_PIRQ(PCI_DEVFN_PCIE8, PCI_INT_D, PIRQ_D),
+#endif
},
},
{
@@ -789,7 +800,7 @@ __weak void mainboard_silicon_init_params(FSP_S_CONFIG *s_cfg)
}
/* Handle FSP logo params */
-void soc_load_logo(FSPS_UPD *supd)
+void soc_load_logo_by_fsp(FSPS_UPD *supd)
{
efi_uintn_t logo, blt_size;
uint32_t logo_size;
diff --git a/src/soc/intel/pantherlake/include/soc/iomap.h b/src/soc/intel/pantherlake/include/soc/iomap.h
index 0bd56975a902..fac9c03f1cde 100644
--- a/src/soc/intel/pantherlake/include/soc/iomap.h
+++ b/src/soc/intel/pantherlake/include/soc/iomap.h
@@ -86,6 +86,10 @@
#define IOM_BASE_SIZE 0x10000
#define IOM_BASE_ADDR_MAX 0x401080ffff /* ((IOM_BASE_ADDR + IOM_BASE_SIZE) - 1) */
+/* Temporary MMIO address for GMADR (aka LMEMBAR) with 256MB */
+#define GMADR_BASE 0xB0000000
+#define GMADR_SIZE 0x10000000
+
/* I/O port address space */
#define ACPI_BASE_ADDRESS 0x1800
#define ACPI_BASE_SIZE 0x100
diff --git a/src/soc/intel/pantherlake/include/soc/pci_devs.h b/src/soc/intel/pantherlake/include/soc/pci_devs.h
index a69f4820c8b6..dc7130cbb50f 100644
--- a/src/soc/intel/pantherlake/include/soc/pci_devs.h
+++ b/src/soc/intel/pantherlake/include/soc/pci_devs.h
@@ -33,6 +33,12 @@
#define PCI_DEV_IPU _PCI_DEV(IPU, 0)
#define PCI_DEV_SLOT_PCIE_2 0x06
+#if CONFIG(SOC_INTEL_WILDCATLAKE)
+#define PCI_DEVFN_PCIE5 _PCI_DEVFN(PCIE_2, 0)
+#define PCI_DEVFN_PCIE6 _PCI_DEVFN(PCIE_2, 1)
+#define PCI_DEV_PCIE5 _PCI_DEV(PCIE_2, 0)
+#define PCI_DEV_PCIE6 _PCI_DEV(PCIE_2, 1)
+#else
#define PCI_DEVFN_PCIE9 _PCI_DEVFN(PCIE_2, 0)
#define PCI_DEVFN_PCIE10 _PCI_DEVFN(PCIE_2, 1)
#define PCI_DEVFN_PCIE11 _PCI_DEVFN(PCIE_2, 2)
@@ -41,6 +47,7 @@
#define PCI_DEV_PCIE10 _PCI_DEV(PCIE_2, 1)
#define PCI_DEV_PCIE11 _PCI_DEV(PCIE_2, 2)
#define PCI_DEV_PCIE12 _PCI_DEV(PCIE_2, 3)
+#endif
#define PCI_DEV_SLOT_TBT 0x07
#define PCI_DEVFN_TBT(x) _PCI_DEVFN(TBT, (x))
@@ -48,11 +55,11 @@
#define PCI_DEVFN_TBT0 _PCI_DEVFN(TBT, 0)
#define PCI_DEVFN_TBT1 _PCI_DEVFN(TBT, 1)
#define PCI_DEVFN_TBT2 _PCI_DEVFN(TBT, 2)
-#define PCI_DEVFN_TBT3 _PCI_DEVFN(TBT, 3)
+#define PCI_DEVFN_TBT3 _PCI_DEVFN(TBT, 3)
#define PCI_DEV_TBT0 _PCI_DEV(TBT, 0)
#define PCI_DEV_TBT1 _PCI_DEV(TBT, 1)
#define PCI_DEV_TBT2 _PCI_DEV(TBT, 2)
-#define PCI_DEV_TBT3 _PCI_DEV(TBT, 3)
+#define PCI_DEV_TBT3 _PCI_DEV(TBT, 3)
#define PCI_DEV_SLOT_TELEMETRY 0x0a
#define PCI_DEVFN_TELEMETRY _PCI_DEVFN(TELEMETRY, 0)
@@ -143,7 +150,7 @@
#define PCI_DEV_CSE_3 _PCI_DEV(CSE, 4)
#define PCI_DEV_CSE_4 _PCI_DEV(CSE, 5)
-#if CONFIG(SOC_INTEL_PANTHERLAKE_U_H)
+#if (CONFIG(SOC_INTEL_PANTHERLAKE_U_H) || CONFIG(SOC_INTEL_WILDCATLAKE))
#define PCI_DEV_SLOT_UFS 0x17
#define PCI_DEVFN_UFS _PCI_DEVFN(UFS, 0)
#define PCI_DEV_UFS _PCI_DEV(UFS, 0)
@@ -170,19 +177,23 @@
#define PCI_DEVFN_PCIE2 _PCI_DEVFN(PCIE_1, 1)
#define PCI_DEVFN_PCIE3 _PCI_DEVFN(PCIE_1, 2)
#define PCI_DEVFN_PCIE4 _PCI_DEVFN(PCIE_1, 3)
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
#define PCI_DEVFN_PCIE5 _PCI_DEVFN(PCIE_1, 4)
#define PCI_DEVFN_PCIE6 _PCI_DEVFN(PCIE_1, 5)
#define PCI_DEVFN_PCIE7 _PCI_DEVFN(PCIE_1, 6)
#define PCI_DEVFN_PCIE8 _PCI_DEVFN(PCIE_1, 7)
+#endif
#define PCI_DEV_PCIE1 _PCI_DEV(PCIE_1, 0)
#define PCI_DEV_PCIE2 _PCI_DEV(PCIE_1, 1)
#define PCI_DEV_PCIE3 _PCI_DEV(PCIE_1, 2)
#define PCI_DEV_PCIE4 _PCI_DEV(PCIE_1, 3)
+#if CONFIG(SOC_INTEL_PANTHERLAKE)
#define PCI_DEV_PCIE5 _PCI_DEV(PCIE_1, 4)
#define PCI_DEV_PCIE6 _PCI_DEV(PCIE_1, 5)
#define PCI_DEV_PCIE7 _PCI_DEV(PCIE_1, 6)
#define PCI_DEV_PCIE8 _PCI_DEV(PCIE_1, 7)
+#endif
#define PCI_DEV_SLOT_SIO2 0x1e
#define PCI_DEVFN_UART0 _PCI_DEVFN(SIO2, 0)
diff --git a/src/soc/intel/pantherlake/pcie_rp.c b/src/soc/intel/pantherlake/pcie_rp.c
index 604e7af1b221..cacbab83ad52 100644
--- a/src/soc/intel/pantherlake/pcie_rp.c
+++ b/src/soc/intel/pantherlake/pcie_rp.c
@@ -18,7 +18,11 @@ static const struct pcie_rp_group tbt_rp_groups[] = {
};
static const struct pcie_rp_group ptl_rp_groups[] = {
+#if CONFIG(SOC_INTEL_WILDCATLAKE)
+ { .slot = PCI_DEV_SLOT_PCIE_1, .count = 4, .lcap_port_base = 1 },
+#else
{ .slot = PCI_DEV_SLOT_PCIE_1, .count = 8, .lcap_port_base = 1 },
+#endif
#if CONFIG(SOC_INTEL_PANTHERLAKE_U_H)
{ .slot = PCI_DEV_SLOT_PCIE_2, .count = 4, .lcap_port_base = 1 },
#else
diff --git a/src/soc/intel/skylake/chip.c b/src/soc/intel/skylake/chip.c
index 0356c3e8ddf9..0061c10ae810 100644
--- a/src/soc/intel/skylake/chip.c
+++ b/src/soc/intel/skylake/chip.c
@@ -511,7 +511,7 @@ __weak void mainboard_silicon_init_params(FSP_S_CONFIG *params)
}
/* Handle FSP logo params */
-void soc_load_logo(FSPS_UPD *supd)
+void soc_load_logo_by_fsp(FSPS_UPD *supd)
{
size_t logo_size;
supd->FspsConfig.LogoPtr = (uint32_t)(uintptr_t)bmp_load_logo(&logo_size);
diff --git a/src/soc/intel/tigerlake/fsp_params.c b/src/soc/intel/tigerlake/fsp_params.c
index c3400b45c93f..35562d1a697b 100644
--- a/src/soc/intel/tigerlake/fsp_params.c
+++ b/src/soc/intel/tigerlake/fsp_params.c
@@ -682,6 +682,9 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
params->SiSkipSsidProgramming = 0;
mainboard_silicon_init_params(params);
+
+ /* Runtime configuration of S0ix */
+ config->s0ix_enable = get_uint_option("s0ix_enable", config->s0ix_enable);
}
/*
diff --git a/src/vendorcode/intel/fsp/fsp2_0/iot/raptorlake_s/MemInfoHob.h b/src/vendorcode/intel/fsp/fsp2_0/iot/raptorlake_s/MemInfoHob.h
deleted file mode 100644
index 989bfb1a954a..000000000000
--- a/src/vendorcode/intel/fsp/fsp2_0/iot/raptorlake_s/MemInfoHob.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/** @file
- This file contains definitions required for creation of
- Memory S3 Save data, Memory Info data and Memory Platform
- data hobs.
-
-@copyright
- Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-@par Specification Reference:
-**/
-#ifndef _MEM_INFO_HOB_H_
-#define _MEM_INFO_HOB_H_
-
-
-#pragma pack (push, 1)
-
-extern EFI_GUID gSiMemoryS3DataGuid;
-extern EFI_GUID gSiMemoryInfoDataGuid;
-extern EFI_GUID gSiMemoryPlatformDataGuid;
-
-#define MAX_NODE 2
-#define MAX_CH 4
-#define MAX_DIMM 2
-// Must match definitions in
-// Intel\ClientOneSiliconPkg\IpBlock\MemoryInit\Mtl\Include\MrcInterface.h
-#define HOB_MAX_SAGV_POINTS 4
-
-///
-/// Host reset states from MRC.
-///
-#define WARM_BOOT 2
-
-#define R_MC_CHNL_RANK_PRESENT 0x7C
-#define B_RANK0_PRS BIT0
-#define B_RANK1_PRS BIT1
-#define B_RANK2_PRS BIT4
-#define B_RANK3_PRS BIT5
-
-// @todo remove and use the MdePkg\Include\Pi\PiHob.h
-#if !defined(_PEI_HOB_H_) && !defined(__PI_HOB_H__)
-#ifndef __HOB__H__
-typedef struct _EFI_HOB_GENERIC_HEADER {
- UINT16 HobType;
- UINT16 HobLength;
- UINT32 Reserved;
-} EFI_HOB_GENERIC_HEADER;
-
-typedef struct _EFI_HOB_GUID_TYPE {
- EFI_HOB_GENERIC_HEADER Header;
- EFI_GUID Name;
- ///
- /// Guid specific data goes here
- ///
-} EFI_HOB_GUID_TYPE;
-#endif
-#endif
-
-///
-/// Defines taken from MRC so avoid having to include MrcInterface.h
-///
-
-//
-// Matches MAX_SPD_SAVE define in MRC
-//
-#ifndef MAX_SPD_SAVE
-#define MAX_SPD_SAVE 29
-#endif
-
-//
-// MRC version description.
-//
-typedef struct {
- UINT8 Major; ///< Major version number
- UINT8 Minor; ///< Minor version number
- UINT8 Rev; ///< Revision number
- UINT8 Build; ///< Build number
-} SiMrcVersion;
-
-//
-// Matches MrcChannelSts enum in MRC
-//
-#ifndef CHANNEL_NOT_PRESENT
-#define CHANNEL_NOT_PRESENT 0 // There is no channel present on the controller.
-#endif
-#ifndef CHANNEL_DISABLED
-#define CHANNEL_DISABLED 1 // There is a channel present but it is disabled.
-#endif
-#ifndef CHANNEL_PRESENT
-#define CHANNEL_PRESENT 2 // There is a channel present and it is enabled.
-#endif
-
-//
-// Matches MrcDimmSts enum in MRC
-//
-#ifndef DIMM_ENABLED
-#define DIMM_ENABLED 0 // DIMM/rank Pair is enabled, presence will be detected.
-#endif
-#ifndef DIMM_DISABLED
-#define DIMM_DISABLED 1 // DIMM/rank Pair is disabled, regardless of presence.
-#endif
-#ifndef DIMM_PRESENT
-#define DIMM_PRESENT 2 // There is a DIMM present in the slot/rank pair and it will be used.
-#endif
-#ifndef DIMM_NOT_PRESENT
-#define DIMM_NOT_PRESENT 3 // There is no DIMM present in the slot/rank pair.
-#endif
-
-//
-// Matches MrcBootMode enum in MRC
-//
-#ifndef __MRC_BOOT_MODE__
-#define __MRC_BOOT_MODE__ //The below values are originated from MrcCommonTypes.h
- #ifndef INT32_MAX
- #define INT32_MAX (0x7FFFFFFF)
- #endif //INT32_MAX
-typedef enum {
- bmCold, ///< Cold boot
- bmWarm, ///< Warm boot
- bmS3, ///< S3 resume
- bmFast, ///< Fast boot
- MrcBootModeMax, ///< MRC_BOOT_MODE enumeration maximum value.
- MrcBootModeDelim = INT32_MAX ///< This value ensures the enum size is consistent on both sides of the PPI.
-} MRC_BOOT_MODE;
-#endif //__MRC_BOOT_MODE__
-
-//
-// Matches MrcDdrType enum in MRC
-//
-#ifndef MRC_DDR_TYPE_DDR5
-#define MRC_DDR_TYPE_DDR5 1
-#endif
-#ifndef MRC_DDR_TYPE_LPDDR5
-#define MRC_DDR_TYPE_LPDDR5 2
-#endif
-#ifndef MRC_DDR_TYPE_LPDDR4
-#define MRC_DDR_TYPE_LPDDR4 3
-#endif
-#ifndef MRC_DDR_TYPE_UNKNOWN
-#define MRC_DDR_TYPE_UNKNOWN 4
-#endif
-
-#define MAX_PROFILE_NUM 7 // number of memory profiles supported
-#define MAX_XMP_PROFILE_NUM 5 // number of XMP profiles supported
-
-#define MAX_TRACE_REGION 5
-#define MAX_TRACE_CACHE_TYPE 2
-
-//
-// DIMM timings
-//
-typedef struct {
- UINT32 tCK; ///< Memory cycle time, in femtoseconds.
- UINT16 NMode; ///< Number of tCK cycles for the channel DIMM's command rate mode.
- UINT16 tCL; ///< Number of tCK cycles for the channel DIMM's CAS latency.
- UINT16 tCWL; ///< Number of tCK cycles for the channel DIMM's minimum CAS write latency time.
- UINT16 tFAW; ///< Number of tCK cycles for the channel DIMM's minimum four activate window delay time.
- UINT16 tRAS; ///< Number of tCK cycles for the channel DIMM's minimum active to precharge delay time.
- UINT16 tRCDtRP; ///< Number of tCK cycles for the channel DIMM's minimum RAS# to CAS# delay time and Row Precharge delay time.
- UINT16 tREFI; ///< Number of tCK cycles for the channel DIMM's minimum Average Periodic Refresh Interval.
- UINT16 tRFC; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
- UINT16 tRFCpb; ///< Number of tCK cycles for the channel DIMM's minimum per bank refresh recovery delay time.
- UINT16 tRFC2; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
- UINT16 tRFC4; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
- UINT16 tRPab; ///< Number of tCK cycles for the channel DIMM's minimum row precharge delay time for all banks.
- UINT16 tRRD; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time.
- UINT16 tRRD_L; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time for same bank groups.
- UINT16 tRRD_S; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time for different bank groups.
- UINT16 tRTP; ///< Number of tCK cycles for the channel DIMM's minimum internal read to precharge command delay time.
- UINT16 tWR; ///< Number of tCK cycles for the channel DIMM's minimum write recovery time.
- UINT16 tWTR; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time.
- UINT16 tWTR_L; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time for same bank groups.
- UINT16 tWTR_S; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time for different bank groups.
- UINT16 tCCD_L; ///< Number of tCK cycles for the channel DIMM's minimum CAS-to-CAS delay for same bank group.
-} MRC_CH_TIMING;
-
-typedef struct {
- UINT16 tRDPRE; ///< Read CAS to Precharge cmd delay
-} MRC_IP_TIMING;
-
-///
-/// Memory SMBIOS & OC Memory Data Hob
-///
-typedef struct {
- UINT8 Status; ///< See MrcDimmStatus for the definition of this field.
- UINT8 DimmId;
- UINT32 DimmCapacity; ///< DIMM size in MBytes.
- UINT16 MfgId;
- UINT8 ModulePartNum[20]; ///< Module part number for DDR3 is 18 bytes however for DRR4 20 bytes as per JEDEC Spec, so reserving 20 bytes
- UINT8 RankInDimm; ///< The number of ranks in this DIMM.
- UINT8 SpdDramDeviceType; ///< Save SPD DramDeviceType information needed for SMBIOS structure creation.
- UINT8 SpdModuleType; ///< Save SPD ModuleType information needed for SMBIOS structure creation.
- UINT8 SpdModuleMemoryBusWidth; ///< Save SPD ModuleMemoryBusWidth information needed for SMBIOS structure creation.
- UINT8 SpdSave[MAX_SPD_SAVE]; ///< Save SPD Manufacturing information needed for SMBIOS structure creation.
- UINT16 Speed; ///< The maximum capable speed of the device, in MHz
- UINT8 MdSocket; ///< MdSocket: 0 = Memory Down, 1 = Socketed. Needed for SMBIOS structure creation.
-} DIMM_INFO;
-
-typedef struct {
- UINT8 Status; ///< Indicates whether this channel should be used.
- UINT8 ChannelId;
- UINT8 DimmCount; ///< Number of valid DIMMs that exist in the channel.
- MRC_CH_TIMING Timing[MAX_PROFILE_NUM]; ///< The channel timing values.
- DIMM_INFO DimmInfo[MAX_DIMM]; ///< Save the DIMM output characteristics.
-} CHANNEL_INFO;
-
-typedef struct {
- UINT8 Status; ///< Indicates whether this controller should be used.
- UINT16 DeviceId; ///< The PCI device id of this memory controller.
- UINT8 RevisionId; ///< The PCI revision id of this memory controller.
- UINT8 ChannelCount; ///< Number of valid channels that exist on the controller.
- CHANNEL_INFO ChannelInfo[MAX_CH]; ///< The following are channel level definitions.
-} CONTROLLER_INFO;
-
-typedef struct {
- UINT64 BaseAddress; ///< Trace Base Address
- UINT64 TotalSize; ///< Total Trace Region of Same Cache type
- UINT8 CacheType; ///< Trace Cache Type
- UINT8 ErrorCode; ///< Trace Region Allocation Fail Error code
- UINT8 Rsvd[2];
-} PSMI_MEM_INFO;
-
-/// This data structure contains per-SaGv timing values that are considered output by the MRC.
-typedef struct {
- UINT32 DataRate; ///< The memory rate for the current SaGv Point in units of MT/s
- MRC_CH_TIMING JedecTiming; ///< Timings used for this entry's corresponding SaGv Point - derived from JEDEC SPD spec
- MRC_IP_TIMING IpTiming; ///< Timings used for this entry's corresponding SaGv Point - IP specific
-} HOB_SAGV_TIMING_OUT;
-
-/// This data structure contains SAGV config values that are considered output by the MRC.
-typedef struct {
- UINT32 NumSaGvPointsEnabled; ///< Count of the total number of SAGV Points enabled.
- UINT32 SaGvPointMask; ///< Bit mask where each bit indicates an enabled SAGV point.
- HOB_SAGV_TIMING_OUT SaGvTiming[HOB_MAX_SAGV_POINTS];
-} HOB_SAGV_INFO;
-
-typedef struct {
- UINT8 Revision;
- UINT16 DataWidth; ///< Data width, in bits, of this memory device
- /** As defined in SMBIOS 3.0 spec
- Section 7.18.2 and Table 75
- **/
- UINT8 MemoryType; ///< DDR type: DDR3, DDR4, or LPDDR3
- UINT16 MaximumMemoryClockSpeed;///< The maximum capable speed of the device, in megahertz (MHz)
- UINT16 ConfiguredMemoryClockSpeed; ///< The configured clock speed to the memory device, in megahertz (MHz)
- /** As defined in SMBIOS 3.0 spec
- Section 7.17.3 and Table 72
- **/
- UINT8 ErrorCorrectionType;
-
- SiMrcVersion Version;
- BOOLEAN EccSupport;
- UINT8 MemoryProfile;
- UINT8 IsDMBRunning; ///< Deprecated.
- UINT32 TotalPhysicalMemorySize;
- UINT32 DefaultXmptCK[MAX_XMP_PROFILE_NUM];///< Stores the tCK value read from SPD XMP profiles if they exist.
- ///
- /// Set of bit flags showing XMP and User Profile capability status for the DIMMs detected in system. For each bit, 1 is supported, 0 is unsupported.
- /// Bit 0: XMP Profile 1 capability status
- /// Bit 1: XMP Profile 2 capability status
- /// Bit 2: XMP Profile 3 capability status
- /// Bit 3: User Profile 4 capability status
- /// Bit 4: User Profile 5 capability status
- ///
- UINT8 XmpProfileEnable;
- UINT8 XmpConfigWarning; ///< If XMP capable DIMMs config support only 1DPC, but 2DPC is installed
- UINT8 Ratio; ///< DDR Frequency Ratio, Max Value 255
- UINT8 RefClk;
- UINT32 VddVoltage[MAX_PROFILE_NUM];
- UINT32 VddqVoltage[MAX_PROFILE_NUM];
- UINT32 VppVoltage[MAX_PROFILE_NUM];
- CONTROLLER_INFO Controller[MAX_NODE];
- UINT16 Ratio_UINT16; ///< DDR Frequency Ratio, used for programs that require ratios higher then 255
- UINT32 NumPopulatedChannels; ///< Total number of memory channels populated
- HOB_SAGV_INFO SagvConfigInfo; ///< This data structure contains SAGV config values that are considered output by the MRC.
- UINT16 TotalMemWidth; ///< Total Memory Width in bits from all populated channels
- BOOLEAN MemorySpeedReducedWrongDimmSlot; ///< Can be used by OEM BIOS to display a warning on the screen that DDR speed was reduced due to wrong DIMM population
- BOOLEAN MemorySpeedReducedMixedConfig; ///< Can be used by OEM BIOS to display a warning on the screen that DDR speed was reduced due to mixed DIMM config
- BOOLEAN DynamicMemoryBoostTrainingFailed; ///< TRUE if Dynamic Memory Boost failed to train and was force disabled on the last full training boot. FALSE otherwise.
-} MEMORY_INFO_DATA_HOB;
-
-/**
- Memory Platform Data Hob
-
- <b>Revision 1:</b>
- - Initial version.
- <b>Revision 2:</b>
- - Added TsegBase, PrmrrSize, PrmrrBase, Gttbase, MmioSize, PciEBaseAddress fields
-**/
-typedef struct {
- UINT8 Revision;
- UINT8 Reserved[3];
- UINT32 BootMode;
- UINT32 TsegSize;
- UINT32 TsegBase;
- UINT32 PrmrrSize;
- UINT64 PrmrrBase;
- UINT32 GttBase;
- UINT32 MmioSize;
- UINT32 PciEBaseAddress;
- PSMI_MEM_INFO PsmiInfo[MAX_TRACE_CACHE_TYPE];
- PSMI_MEM_INFO PsmiRegionInfo[MAX_TRACE_REGION];
- BOOLEAN MrcBasicMemoryTestPass;
-} MEMORY_PLATFORM_DATA;
-
-typedef struct {
- EFI_HOB_GUID_TYPE EfiHobGuidType;
- MEMORY_PLATFORM_DATA Data;
- UINT8 *Buffer;
-} MEMORY_PLATFORM_DATA_HOB;
-
-#pragma pack (pop)
-
-#endif // _MEM_INFO_HOB_H_
diff --git a/util/autoport/ec_none.go b/util/autoport/ec_none.go
index a1a0df94f07e..ceb84a052816 100644
--- a/util/autoport/ec_none.go
+++ b/util/autoport/ec_none.go
@@ -16,9 +16,6 @@ Method(_PTS, 1)
}
`)
- si := Create(ctx, "acpi/superio.asl")
- defer si.Close()
-
- ec := Create(ctx, "acpi/ec.asl")
- defer ec.Close()
+ Create_Empty(ctx, "acpi/superio.asl", ASL)
+ Create_Empty(ctx, "acpi/ec.asl", ASL)
}
diff --git a/util/autoport/main.go b/util/autoport/main.go
index c4f884a985a2..1246e3277cd0 100644
--- a/util/autoport/main.go
+++ b/util/autoport/main.go
@@ -120,8 +120,9 @@ var CommentFormatStrings map[Filetype]string = map[Filetype]string {
type License string
const (
- GPL2_only License = "GPL-2.0-only"
- GPL2_or_later = "GPL-2.0-or-later"
+ CC_PDDC License = "CC-PDDC"
+ GPL2_only = "GPL-2.0-only"
+ GPL2_or_later = "GPL-2.0-or-later"
)
var KconfigBool map[string]bool = map[string]bool{}
@@ -233,6 +234,13 @@ func Create(ctx Context, name string) *os.File {
}
return mf
}
+func Create_Empty(ctx Context, name string, filetype Filetype) {
+ f := Create(ctx, name)
+ defer f.Close()
+ Add_SPDX(f, filetype, CC_PDDC)
+ Add_Comment(f, filetype,
+ "Please update the license if adding licensable material.")
+}
func Add_SPDX(f *os.File, filetype Filetype, license License) {
Add_Comment(f, filetype, "SPDX-License-Identifier: " + string(license))