diff --git a/Documentation/gfx/display-panel.md b/Documentation/gfx/display-panel.md
new file mode 100644
index 0000000000..3bab0896fd
--- /dev/null
+++ b/Documentation/gfx/display-panel.md
@@ -0,0 +1,64 @@
+Display Panel Specifics
+=======================
+
+Timing Parameters
+-----------------
+
+From the binary file `edid` in the sys filesystem on Linux, the panel can be
+identified. The exact path may differ slightly. Here is an example:
+
+```sh
+$ strings /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/edid
+@0 5
+LG Display
+LP140WF3-SPD1
+```
+
+To figure out the timing parameters, refer to the [Intel Programmer's Reference
+Manuals](https://01.org/linuxgraphics/documentation/hardware-specification-prms)
+and try to find the datasheet of the panel using the information from `edid`.
+In the example above, you would search for `LP140WF3-SPD1`. Find a table listing
+the power sequence timing parameters, which are usually named T[N] and also
+referenced in Intel's respective registers listing. You need the values for
+`PP_ON_DELAYS`, `PP_OFF_DELAYS` and `PP_DIVISOR` for your `devicetree.cb`:
+
+```eval_rst
++-----------------------------+---------------------------------------+-----+
+| Intel docs | devicetree.cb | eDP |
++-----------------------------+---------------------------------------+-----+
+| Power up delay | `gpu_panel_power_up_delay` | T3 |
++-----------------------------+---------------------------------------+-----+
+| Power on to backlight on | `gpu_panel_power_backlight_on_delay` | T7 |
++-----------------------------+---------------------------------------+-----+
+| Power Down delay | `gpu_panel_power_down_delay` | T10 |
++-----------------------------+---------------------------------------+-----+
+| Backlight off to power down | `gpu_panel_power_backlight_off_delay` | T9 |
++-----------------------------+---------------------------------------+-----+
+| Power Cycle Delay | `gpu_panel_power_cycle_delay` | T12 |
++-----------------------------+---------------------------------------+-----+
+```
+
+Intel GPU Tools and VBT
+-----------------------
+
+The Intel GPU tools are in a package called either `intel-gpu-tools` or
+`igt-gpu-tools` in most distributions of Linux-based operating systems.
+In the coreboot `util/` directory, you can find `intelvbttool`.
+
+From a running system, you can dump the register values directly:
+```sh
+$ intel_reg dump --all | grep PCH_PP
+ PCH_PP_STATUS (0x000c7200): 0x80000008
+ PCH_PP_CONTROL (0x000c7204): 0x00000007
+ PCH_PP_ON_DELAYS (0x000c7208): 0x07d00001
+ PCH_PP_OFF_DELAYS (0x000c720c): 0x01f40001
+ PCH_PP_DIVISOR (0x000c7210): 0x0004af06
+```
+
+You can obtain the timing values from a VBT (Video BIOS Table), which you can
+dump from a vendor UEFI image:
+```sh
+$ intel_vbt_decode data.vbt | grep T3
+ Power Sequence: T3 2000 T7 10 T9 2000 T10 500 T12 5000
+ T3 optimization: no
+```
diff --git a/Documentation/gfx/libgfxinit.md b/Documentation/gfx/libgfxinit.md
index c50761a14e..c000f27d60 100644
--- a/Documentation/gfx/libgfxinit.md
+++ b/Documentation/gfx/libgfxinit.md
@@ -55,6 +55,9 @@ follows:
GMA: Per Board Configuration
----------------------------
+In order to set up the display panel, see the
+[display panel-specific documentation](/gfx/display-panel.md).
+
There are a few Kconfig symbols to consider. To indicate that a
board can initialize graphics through *libgfxinit*:
diff --git a/Documentation/index.md b/Documentation/index.md
index 6dbbf4d91f..76faffa497 100644
--- a/Documentation/index.md
+++ b/Documentation/index.md
@@ -173,6 +173,7 @@ Contents:
* [Dealing with Untrusted Input in SMM](technotes/2017-02-dealing-with-untrusted-input-in-smm.md)
* [GPIO toggling in ACPI AML](acpi/gpio.md)
* [Native Graphics Initialization with libgfxinit](gfx/libgfxinit.md)
+* [Display panel-specific documentation](gfx/display-panel.md)
* [Architecture-specific documentation](arch/index.md)
* [Northbridge-specific documentation](northbridge/index.md)
* [System on Chip-specific documentation](soc/index.md)
diff --git a/Documentation/mainboard/hp/z220_sff.md b/Documentation/mainboard/hp/z220_sff.md
new file mode 100644
index 0000000000..0dfa653937
--- /dev/null
+++ b/Documentation/mainboard/hp/z220_sff.md
@@ -0,0 +1,70 @@
+# HP Z220 SFF Workstation
+
+This page describes how to run coreboot on the [HP Z220 SFF Workstation] desktop
+from [HP].
+
+## TODO
+
+The following things are still missing from this coreboot port:
+
+- Extended HWM reporting
+- Advanced LED control
+- Advanced power configuration in S3
+
+## Flashing coreboot
+
+```eval_rst
++---------------------+-------------+
+| Type | Value |
++=====================+=============+
+| Socketed flash | no |
++---------------------+-------------+
+| Model | N25Q128..3E |
++---------------------+-------------+
+| Size | 16 MiB |
++---------------------+-------------+
+| In circuit flashing | yes |
++---------------------+-------------+
+| Package | SOIC-16 |
++---------------------+-------------+
+| Write protection | No |
++---------------------+-------------+
+| Dual BIOS feature | No |
++---------------------+-------------+
+| Internal flashing | yes |
++---------------------+-------------+
+```
+
+### Internal programming
+
+The SPI flash can be accessed using [flashrom].
+
+### External programming
+
+External programming with an SPI adapter and [flashrom] does work, but it powers the
+whole southbridge complex. You need to supply enough current through the programming adapter.
+
+If you want to use a SOIC pomona test clip, you have to cut the 2nd DRAM DIMM holder,
+as otherwise there's not enough space near the flash.
+
+## Technology
+
+```eval_rst
++------------------+--------------------------------------------------+
+| Northbridge | :doc:`../../northbridge/intel/sandybridge/index` |
++------------------+--------------------------------------------------+
+| Southbridge | bd82x6x |
++------------------+--------------------------------------------------+
+| CPU | model_206ax |
++------------------+--------------------------------------------------+
+| SuperIO | :doc:`../../superio/nuvoton/npcd378` |
++------------------+--------------------------------------------------+
+| EC | |
++------------------+--------------------------------------------------+
+| Coprocessor | Intel ME |
++------------------+--------------------------------------------------+
+```
+
+[HP Z220 SFF Workstation]: https://support.hp.com/za-en/document/c03386950
+[HP]: https://www.hp.com/
+[flashrom]: https://flashrom.org/Flashrom
diff --git a/Documentation/mainboard/index.md b/Documentation/mainboard/index.md
index f63ef763fb..03af2c338c 100644
--- a/Documentation/mainboard/index.md
+++ b/Documentation/mainboard/index.md
@@ -54,6 +54,7 @@ The boards in this section are not real mainboards, but emulators.
## HP
- [Compaq 8200 Elite SFF](hp/compaq_8200_sff.md)
+- [Z220 Workstation SFF](hp/z220_sff.md)
### EliteBook series
diff --git a/Documentation/soc/amd/family17h.md b/Documentation/soc/amd/family17h.md
new file mode 100755
index 0000000000..dc3de13ffe
--- /dev/null
+++ b/Documentation/soc/amd/family17h.md
@@ -0,0 +1,224 @@
+# AMD Family 17h in coreboot
+
+## Abstract
+
+Beginning with Family 17h products (a.k.a. “Zen” cores), AMD
+changed their paradigm for initializing the system and this requires
+major modifications to the execution flow of coreboot. This file
+discusses the new boot flow, and challenges, and the tradeoffs of the
+initial port into coreboot.
+
+## Introduction
+
+Family 17h products are x86-based designs. This documentation assumes
+familiarity with x86, its reset state and its early initialization
+requirements.
+
+To the extent necessary, the role of the Platform Security Processor
+(a.k.a. PSP) in system initialization is addressed here. AMD has
+historically required an NDA for access to the PSP
+specification1. coreboot relies on util/amdfwtool to build
+the structures and add various other firmware to the final image. The
+Family 17h PSP design guide adds a new BIOS Directory Table, similar to
+the PSP Directory Table.
+
+Support in coreboot for modern AMD products is based on AMD’s
+reference code: AMD Generic Encapsulated Software Architecture
+(AGESATM). AGESA contains the technology for enabling DRAM,
+configuring proprietary core logic, assistance with generating ACPI
+tables, and other features.
+
+AGESA for products earlier than Family 17h is known as v5 or
+Arch20082. Also note that coreboot currently contains both
+open source AGESA and closed source implementations (binaryPI) compiled
+from AGESA.
+
+The first AMD Family 17h device ported to coreboot is codenamed
+“Picasso”3, and will be added to soc/amd/picasso.
+
+## Additional Definitions
+
+* PSP, Platform Security Processor: Onboard ARM processor that runs
+alongside the main x86 processor; may be viewed as analogous to the
+IntelR Management Engine
+* FCH, Fusion Control Hub, the logical southbridge within the SOC
+* ABL - AGESA Bootloader - Processor initialization code that runs on
+the PSP
+* PSP Directory Table - A structured list of pointers to PSP firmware
+and other controller binaries
+* BIOS Directory Table - A structured list of pointers to BIOS
+related firmware images
+* Embedded Firmware Structure - Signature and pointers used by the
+PSP to locate the PSP Directory Table and BIOS Directory Table; these
+items are generated during coreboot build and are located in the SPI ROM
+* Verstage - The code to verify the firmware contained in the
+writable section of the SPI ROM
+* APCB - AMD PSP Customization Block - A binary containing PSP and
+system configuration preferences (analogous to v5 BUILDOPT_ options),
+and generated by APCBTool to be added to coreboot/utils later
+* APOB - AGESA PSP Output Buffer - A buffer in main memory for
+storing AGESA BootLoader output. There are no plans for this to be
+parsed by coreboot
+
+## Problem Statements
+
+AMD has ported early AGESA features to the PSP, which now discovers,
+enables and trains DRAM. Unlike any other x86 device in coreboot, a
+Picasso system has DRAM online prior to the first instruction fetch.
+
+Cache-as-RAM (CAR) is no longer a supportable feature in AMD hardware.
+Early code expecting CAR behavior must account for writes
+escaping the L2 cache and going to DRAM.
+
+Without any practical need for CAR, or DRAM initialization, coreboot
+should arguably skip bootblock and romstage, and possibly use ramstage
+as the BIOS image. This approach presents a number of challenges:
+
+* At the entry of ramstage, x86 processors are in flat protected
+mode. Picasso’s initial state is nearly identical to any other x86
+at reset, except its CS shadow register’s base and limit put its
+execution within DRAM, not at 0xfffffff0. Picasso requires initial
+programming and entry into protected mode prior to ramstage.
+* coreboot expects cbmem initialization during romstage.
+
+AGESA supporting Picasso is now at v9. Unlike Arch2008, which defines
+granular entry points for easy inclusion to a legacy BIOS, v9 is
+rewritten for compilation into a UEFI. The source follows UEFI
+standards, i.e. assumes the presence of UEFI phases, implements
+dependency expressions, much functionality is rewritten as libraries,
+etc. It would, in no way, fit into the v5 model used in coreboot.
+
+* For the foreseeable future, AGESA source will distributed only
+under NDA.
+
+## Basic Pre-x86 Boot Flow
+
+The following steps occur prior to x86 processor operation.
+
+* System power on
+* PSP executes immutable on-chip boot ROM
+* PSP locates the Embedded Firmware Table and PSP Directory Table in
+the SPI ROM
+* PSP verifies and executes the PSP off-chip bootloader
+* ChromeOS systems:
+ * Off-chip bootloader attempts to locate verstage via the RO BIOS
+Directory Table
+ * If verstage is not found, booting continues with ABLs below
+ * Verstage initializes, setting up GPIOs, UART if needed,
+communication path to the EC, and the SPI controller for direct access
+to the flash device.
+ * Verstage verifies the RW sections (as is typically performed by
+the main processor)
+ * Verstage locates the Embedded Firmware Directory within the
+verified FMAP section and passes a pointer to the PSP bootloader. If
+the verification fails, it passes a pointer to the RO header to the
+bootloader.
+* PSP parses the PSP Directory Table to find the ABLs and executes
+them
+* An ABL parses the APCB for system configuration preferences
+* An ABL initializes system main memory, locates the compressed BIOS
+image in the SPI ROM, and decompresses it into DRAM
+* An ABL writes the APOB to DRAM for consumption by the x86-based
+AGESA
+* PSP releases the x86 processor from reset. The x86 core fetches
+and executes instructions from the reset vector
+
+## Picasso Reset Vector and First Instructions
+
+As mentioned above, prior to releasing the x86 main core from reset,
+the PSP decompresses a BIOS image into DRAM. The PSP uses a specific
+BIOS Directory Table entry type to determine the source address (in
+flash), the destination address (in DRAM), and the destination size.
+The decompressed image is at the top of the destination region. The
+PSP then
+
+Calculates the x86 reset vector as
+
+ reset_vector = dest_addr + dest_size - 0x10
+
+Sets x86 CS descriptor shadow register to
+
+ base = dest_addr + dest_size - 0x10000
+ limit = 0xffff
+
+Like all x86 devices, the main core is allowed to begin executing
+instructions with
+
+ CS:IP = 0xf000:0xfff0
+
+For example, assume the BIOS Directory Table indicates
+
+ destination = 0x9b00000
+ size = 0x300000
+
+… then the BIOS image is placed at the topmost position the region
+0x9b00000-0x9dfffff and
+
+ reset_vector = 0x9dffff0
+ CS_shdw_base = 0x9df0000
+ CS:IP = 0xf000:0xfff0
+
+Although the x86 behaves as though it began executing at 0xfffffff0
+i.e. 0xf000:0xfff0, the initial GDT load must use the physical address
+of the table and not the typical CS-centric address. And, the first
+jump to protected mode must jump to the physical address in DRAM. Any
+code that is position-dependent must be linked to run at the final
+destination.
+
+## Initial coreboot Implementation
+
+Supporting Picasso doesn’t fit well with many of the coreboot
+assumptions. Initial porting shall attempt to fit within existing
+coreboot paradigms and make minimal changes to common code.
+
+### CAR and bootblock
+
+The coreboot bootblock contains features Picasso doesn’t require or
+can’t use, and is assumed to execute in an unusable location.
+Picasso’s requirement for bootblock in coreboot will be eliminated.
+
+### Hybrid romstage
+
+Picasso’s x86 reset state doesn’t meet the coreboot expectations
+for jumping directly to ramstage. The primary feature of romstage is
+also not needed, however there are other important features that are
+typically in romstage that Picasso does need.
+
+The romstage architecture is designed around the presence of CAR.
+Several features implement ROMSTAGE_CBMEM_INIT_HOOK, expecting to move
+data from CAR to cbmem. The hybrid romstage consumes DRAM for the
+purpose of implementing the expected CAR storage. This region as well
+as the DRAM where romstage is decompressed must be reserved and
+unavailable to the OS.
+
+The initial Picasso port implements a hybrid romstage that contains the
+first instruction fetched at the reset vector. It minimally configures
+flat protected mode, initializes cbmem, then loads the next stage.
+Future work will consider breaking the dependencies mentioned above
+and/or potentially loading ramstage directly from the PSP.
+
+## AGESA v9 on Picasso
+
+Due to the current inability to publish AGESA source, a pre-built
+binary solution remains a requirement. The rewrite from v5 to v9 for
+direct inclusion into UEFI source makes modifying it for conforming to
+the existing v5 interface impractical.
+
+Given the UEFI nature of modern AGESA, and the existing open source
+work from Intel, Picasso shall support AGESA via an FSP-like prebuilt
+image. The Intel Firmware Support Package4 combines
+reference code with EDK II source to create a modular image with
+discoverable entry points. coreboot source already contains knowledge
+of FSP, how to parse it, integrate it, and how to communicate with it.
+
+## Footnotes
+
+1. “AMD Platform Security Processor BIOS Architecture Design Guide
+for AMD Family 17h Processors” (PID #55758) and “AMD Platform
+Security Processor BIOS Architecture Design Guide” (PID #54267) for
+earlier products
+2. [https://www.amd.com/system/files/TechDocs/44065_Arch2008.pdf](https://www.amd.com/system/files/TechDocs/44065_Arch2008.pdf)
+3. [https://en.wikichip.org/wiki/amd/cores/picasso](https://en.wikichip.org/wiki/amd/cores/picasso)
+4. [https://www.intel.com/content/www/us/en/intelligent-systems/intel-firmware-support-package/intel-fsp-overview.html](https://www.intel.com/content/www/us/en/intelligent-systems/intel-firmware-support-package/intel-fsp-overview.html)
+
diff --git a/Documentation/soc/amd/index.md b/Documentation/soc/amd/index.md
new file mode 100644
index 0000000000..7945b488f5
--- /dev/null
+++ b/Documentation/soc/amd/index.md
@@ -0,0 +1,8 @@
+# AMD SOC-specific documentation
+
+This section contains documentation about coreboot on specific AMD SOCs.
+
+## Technology
+
+- [Family 17h](family17h.md)
+
diff --git a/Documentation/soc/index.md b/Documentation/soc/index.md
index 04e2b2f2eb..fccddbd025 100644
--- a/Documentation/soc/index.md
+++ b/Documentation/soc/index.md
@@ -4,5 +4,6 @@ This section contains documentation about coreboot on specific SOCs.
## Vendor
+- [AMD](amd/index.md)
- [Cavium](cavium/index.md)
- [Intel](intel/index.md)
diff --git a/Makefile.inc b/Makefile.inc
index d4f7597e82..14cd50c79d 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -1058,7 +1058,14 @@ ifneq ($(FIT_ENTRY),)
FIT_OPTIONS += -q $(FIT_ENTRY)
endif
-$(obj)/coreboot.rom: $(obj)/coreboot.pre $(objcbfs)/ramstage.elf $(CBFSTOOL) $$(INTERMEDIATE)
+ifeq ($(CONFIG_HAVE_RAMSTAGE),y)
+RAMSTAGE=$(objcbfs)/ramstage.elf
+else
+RAMSTAGE=
+endif
+
+$(obj)/coreboot.rom: $(obj)/coreboot.pre $(RAMSTAGE) $(CBFSTOOL) $$(INTERMEDIATE)
+
@printf " CBFS $(subst $(obj)/,,$(@))\n"
# The full ROM may be larger than the CBFS part, so create an empty
# file (filled with \377 = 0xff) and copy the CBFS image over it.
@@ -1128,8 +1135,8 @@ endif # CONFIG_NO_FIXED_XIP_ROM_SIZE
endif # CONFIG_NO_XIP_EARLY_STAGES
endif # CONFIG_ARCH_ROMSTAGE_X86_32 / CONFIG_ARCH_ROMSTAGE_X86_64
-cbfs-files-y += $(CONFIG_CBFS_PREFIX)/ramstage
-$(CONFIG_CBFS_PREFIX)/ramstage-file := $(objcbfs)/ramstage.elf
+cbfs-files-$(CONFIG_HAVE_RAMSTAGE) += $(CONFIG_CBFS_PREFIX)/ramstage
+$(CONFIG_CBFS_PREFIX)/ramstage-file := $(RAMSTAGE)
$(CONFIG_CBFS_PREFIX)/ramstage-type := stage
$(CONFIG_CBFS_PREFIX)/ramstage-compression := $(CBFS_COMPRESS_FLAG)
diff --git a/payloads/libpayload/configs/config.mistral b/payloads/libpayload/configs/config.mistral
index e305fb6700..23bf54e811 100644
--- a/payloads/libpayload/configs/config.mistral
+++ b/payloads/libpayload/configs/config.mistral
@@ -3,3 +3,6 @@ CONFIG_LP_ARCH_ARM64=y
CONFIG_LP_TIMER_ARM64_ARCH=y
CONFIG_LP_SERIAL_CONSOLE=y
CONFIG_LP_QCS405_SERIAL_CONSOLE=y
+CONFIG_LP_USB=y
+CONFIG_LP_USB_EHCI=y
+CONFIG_LP_USB_XHCI=y
diff --git a/payloads/libpayload/drivers/i8042/i8042.h b/payloads/libpayload/drivers/i8042/i8042.h
index e864ac9263..643167ef40 100644
--- a/payloads/libpayload/drivers/i8042/i8042.h
+++ b/payloads/libpayload/drivers/i8042/i8042.h
@@ -63,7 +63,6 @@
#define I8042_KBCMD_EN 0xf4
#define I8042_KBCMD_DEFAULT_DIS 0xf5
#define I8042_KBCMD_SET_DEFAULT 0xf6
-#define I8042_KBCMD_ACK 0xfa
#define I8042_KBCMD_RESEND 0xfe
#define I8042_KBCMD_RESET 0xff
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c
index 240385ce6d..3e5f988c48 100644
--- a/payloads/libpayload/drivers/i8042/keyboard.c
+++ b/payloads/libpayload/drivers/i8042/keyboard.c
@@ -172,7 +172,7 @@ static unsigned char keyboard_cmd(unsigned char cmd)
{
i8042_write_data(cmd);
- return i8042_wait_read_ps2() == I8042_KBCMD_ACK;
+ return i8042_wait_read_ps2() == 0xfa;
}
int keyboard_havechar(void)
@@ -317,42 +317,27 @@ void keyboard_init(void)
/* Enable first PS/2 port */
i8042_cmd(I8042_CMD_EN_KB);
- /* Reset keyboard and self test (keyboard side) */
- ret = keyboard_cmd(I8042_KBCMD_RESET);
- if (!ret) {
- printf("ERROR: Keyboard reset failed!\n");
- return;
- }
-
/* Set scancode set 1 */
ret = keyboard_cmd(I8042_KBCMD_SET_SCANCODE);
- if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE)) {
- printf("ERROR: Keyboard set scancode failed!\n");
+ if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE))
return;
- }
ret = keyboard_cmd(I8042_SCANCODE_SET_1);
- if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE)) {
- printf("ERROR: Keyboard scancode set#1 failed!\n");
+ if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE))
return;
- }
/*
* Set default parameters.
* Fix for broken QEMU ps/2 make scancodes.
*/
ret = keyboard_cmd(0xf6);
- if (!ret) {
- printf("ERROR: Keyboard set default params failed!\n");
+ if (!ret)
return;
- }
/* Enable scanning */
ret = keyboard_cmd(I8042_KBCMD_EN);
- if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE)) {
- printf("ERROR: Keyboard enable scanning failed!\n");
+ if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE))
return;
- }
console_add_input_driver(&cons);
}
diff --git a/src/Kconfig b/src/Kconfig
index d30aa99f06..5d74d671b2 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -129,6 +129,7 @@ config STATIC_OPTION_TABLE
config COMPRESS_RAMSTAGE
bool "Compress ramstage with LZMA"
+ depends on HAVE_RAMSTAGE
# Default value set at the end of the file
help
Compress ramstage to save memory in the flash image. Note
@@ -137,7 +138,7 @@ config COMPRESS_RAMSTAGE
config COMPRESS_PRERAM_STAGES
bool "Compress romstage and verstage with LZ4"
- depends on !ARCH_X86
+ depends on !ARCH_X86 && (HAVE_ROMSTAGE || HAVE_VERSTAGE)
# Default value set at the end of the file
help
Compress romstage and (if it exists) verstage with LZ4 to save flash
@@ -148,6 +149,7 @@ config COMPRESS_PRERAM_STAGES
config COMPRESS_BOOTBLOCK
bool
+ depends on HAVE_BOOTBLOCK
help
This option can be used to compress the bootblock with LZ4 and attach
a small self-decompression stub to its front. This can drastically
@@ -234,6 +236,7 @@ config NO_RELOCATABLE_RAMSTAGE
config RELOCATABLE_RAMSTAGE
bool
+ depends on HAVE_RAMSTAGE
default !NO_RELOCATABLE_RAMSTAGE
select RELOCATABLE_MODULES
help
@@ -277,10 +280,13 @@ config BOOTSPLASH_FILE
The path and filename of the file to use as graphical bootsplash
screen. The file format has to be jpg.
+config HAVE_RAMPAYLOAD
+ bool
+
config RAMPAYLOAD
bool "Enable coreboot flow without executing ramstage"
default n
- depends on ARCH_X86
+ depends on HAVE_RAMPAYLOAD
help
If this option is enabled, coreboot flow will skip ramstage
loading and execution of ramstage to load payload.
@@ -1188,3 +1194,26 @@ config BOOTSPLASH_FILE
config CBFS_SIZE
default ROM_SIZE
+
+config HAVE_BOOTBLOCK
+ bool
+ default y
+
+config HAVE_VERSTAGE
+ bool
+ depends on VBOOT_SEPARATE_VERSTAGE
+ default y
+
+config HAVE_ROMSTAGE
+ bool
+ default y
+
+config HAVE_POSTCAR
+ bool
+ depends on POSTCAR_STAGE
+ default y
+
+config HAVE_RAMSTAGE
+ bool
+ default n if RAMPAYLOAD
+ default y
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 7e518d8c93..025b933dba 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -336,13 +336,6 @@ ramstage-$(CONFIG_COOP_MULTITASKING) += thread_switch.S
ramstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.S
-smm-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c
-smm-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S
-smm-y += memcpy.c
-smm-y += memmove.c
-smm-y += memset.c
-smm-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
-
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
rmodules_x86_32-y += memcpy.c
rmodules_x86_32-y += memmove.c
@@ -379,11 +372,6 @@ ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),)
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c
endif
endif # CONFIG_GENERATE_ACPI_TABLES
-ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
-ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),)
-smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c
-endif
-endif
ramstage-libs ?=
@@ -408,3 +396,16 @@ else
endif
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64
+
+smm-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c
+smm-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S
+smm-y += memcpy.c
+smm-y += memmove.c
+smm-y += memset.c
+smm-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
+
+ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
+ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),)
+smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c
+endif
+endif
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index e283f4da31..74cd25a858 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -514,6 +514,63 @@ void acpigen_write_field(const char *name, struct fieldlist *l, size_t count,
acpigen_pop_len();
}
+/*
+ * Generate ACPI AML code for IndexField
+ * Arg0: region name
+ * Arg1: Pointer to struct fieldlist.
+ * Arg2: no. of entries in Arg1
+ * Arg3: flags which indicate filed access type, lock rule & update rule.
+ * Example with fieldlist
+ * struct fieldlist l[] = {
+ * FIELDLIST_OFFSET(0x84),
+ * FIELDLIST_NAMESTR("PMCS", 2),
+ * };
+ * acpigen_write_field("IDX", "DATA" l, ARRAY_SIZE(l), FIELD_ANYACC |
+ * FIELD_NOLOCK |
+ * FIELD_PRESERVE);
+ * Output:
+ * IndexField (IDX, DATA, AnyAcc, NoLock, Preserve)
+ * {
+ * Offset (0x84),
+ * PMCS, 2
+ * }
+ */
+void acpigen_write_indexfield(const char *idx, const char *data,
+ struct fieldlist *l, size_t count, uint8_t flags)
+{
+ uint16_t i;
+ uint32_t current_bit_pos = 0;
+
+ /* FieldOp */
+ acpigen_emit_ext_op(INDEX_FIELD_OP);
+ /* Package Length */
+ acpigen_write_len_f();
+ /* NameString 4 chars only */
+ acpigen_emit_simple_namestring(idx);
+ /* NameString 4 chars only */
+ acpigen_emit_simple_namestring(data);
+ /* Field Flag */
+ acpigen_emit_byte(flags);
+
+ for (i = 0; i < count; i++) {
+ switch (l[i].type) {
+ case NAME_STRING:
+ acpigen_write_field_name(l[i].name, l[i].bits);
+ current_bit_pos += l[i].bits;
+ break;
+ case OFFSET:
+ acpigen_write_field_offset(l[i].bits, current_bit_pos);
+ current_bit_pos = l[i].bits;
+ break;
+ default:
+ printk(BIOS_ERR, "%s: Invalid field type 0x%X\n"
+ , __func__, l[i].type);
+ break;
+ }
+ }
+ acpigen_pop_len();
+}
+
void acpigen_write_empty_PCT(void)
{
/*
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index 6114667c6c..db003fe113 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -420,6 +420,12 @@ void acpigen_write_opregion(struct opregion *opreg);
*/
void acpigen_write_field(const char *name, struct fieldlist *l, size_t count,
uint8_t flags);
+/*
+ * Generate ACPI AML code for IndexField
+ * This function takes input index name, data name, fieldlist, count & flags.
+ */
+void acpigen_write_indexfield(const char *idx, const char *data,
+ struct fieldlist *l, size_t count, uint8_t flags);
int get_cst_entries(acpi_cstate_t **);
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c
index e5d0ceab4d..732b767bf6 100644
--- a/src/arch/x86/postcar_loader.c
+++ b/src/arch/x86/postcar_loader.c
@@ -154,8 +154,7 @@ static void load_postcar_cbfs(struct prog *prog, struct postcar_frame *pcf)
finalize_load(rsl.params, pcf->stack);
- if (!CONFIG(NO_STAGE_CACHE))
- stage_cache_add(STAGE_POSTCAR, prog);
+ stage_cache_add(STAGE_POSTCAR, prog);
}
void run_postcar_phase(struct postcar_frame *pcf)
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index bf627f280f..54c2b09c4a 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -372,6 +372,11 @@ static int create_smbios_type17_for_dimm(struct dimm_info *dimm,
dimm->module_part_number[DIMM_INFO_PART_NUMBER_SIZE - 1] = '\0';
smbios_fill_dimm_part_number((char *)dimm->module_part_number, t);
+ /* Voltage Levels */
+ t->configured_voltage = dimm->vdd_voltage;
+ t->minimum_voltage = dimm->vdd_voltage;
+ t->maximum_voltage = dimm->vdd_voltage;
+
/* Synchronous = 1 */
t->type_detail = 0x0080;
/* no handle for error information */
diff --git a/src/commonlib/include/commonlib/cbmem_id.h b/src/commonlib/include/commonlib/cbmem_id.h
index 535ba3394c..2236c95b8f 100644
--- a/src/commonlib/include/commonlib/cbmem_id.h
+++ b/src/commonlib/include/commonlib/cbmem_id.h
@@ -19,6 +19,7 @@
#define CBMEM_ID_ACPI 0x41435049
#define CBMEM_ID_ACPI_GNVS 0x474e5653
+#define CBMEM_ID_ACPI_UCSI 0x55435349
#define CBMEM_ID_AFTER_CAR 0xc4787a93
#define CBMEM_ID_AGESA_RUNTIME 0x41474553
#define CBMEM_ID_AMDMCT_MEMINFO 0x494D454E
@@ -82,6 +83,7 @@
#define CBMEM_ID_TO_NAME_TABLE \
{ CBMEM_ID_ACPI, "ACPI " }, \
{ CBMEM_ID_ACPI_GNVS, "ACPI GNVS " }, \
+ { CBMEM_ID_ACPI_UCSI, "ACPI UCSI " }, \
{ CBMEM_ID_AGESA_RUNTIME, "AGESA RSVD " }, \
{ CBMEM_ID_AFTER_CAR, "AFTER CAR " }, \
{ CBMEM_ID_AMDMCT_MEMINFO, "AMDMEM INFO" }, \
diff --git a/src/console/die.c b/src/console/die.c
index 513d1c4097..3a17126264 100644
--- a/src/console/die.c
+++ b/src/console/die.c
@@ -30,17 +30,15 @@ __weak void die_notify(void)
}
/* Report a fatal error */
-void __noreturn die(const char *msg)
+void __noreturn die(const char *fmt, ...)
{
- printk(BIOS_EMERG, "%s", msg);
+ va_list args;
+
+ va_start(args, fmt);
+ vprintk(BIOS_EMERG, fmt, args);
+ va_end(args);
+
die_notify();
halt();
}
-
-/* Report a fatal error with a post code */
-void __noreturn die_with_post_code(uint8_t value, const char *msg)
-{
- post_code(value);
- die(msg);
-}
#endif
diff --git a/src/console/printk.c b/src/console/printk.c
index 09522158a7..8606bbb5c9 100644
--- a/src/console/printk.c
+++ b/src/console/printk.c
@@ -45,7 +45,7 @@ static void wrap_putchar_cbmemc(unsigned char byte, void *data)
__cbmemc_tx_byte(byte);
}
-int vprintk(int msg_level, const char *fmt, va_list args)
+int do_vprintk(int msg_level, const char *fmt, va_list args)
{
int i, log_this;
@@ -91,7 +91,7 @@ int do_printk(int msg_level, const char *fmt, ...)
int i;
va_start(args, fmt);
- i = vprintk(msg_level, fmt, args);
+ i = do_vprintk(msg_level, fmt, args);
va_end(args);
return i;
diff --git a/src/cpu/x86/Makefile.inc b/src/cpu/x86/Makefile.inc
index 3e8a6648f4..65c092133f 100644
--- a/src/cpu/x86/Makefile.inc
+++ b/src/cpu/x86/Makefile.inc
@@ -17,23 +17,27 @@ SIPI_RMOD=$(SIPI_ELF).rmod
SIPI_BIN=$(SIPI_ELF:.elf=)
SIPI_DOTO=$(SIPI_ELF:.elf=.o)
-ifeq ($(CONFIG_PARALLEL_MP),y)
-ramstage-srcs += $(SIPI_BIN).manual
-endif
-rmodules_$(ARCH-ramstage-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S
-
-$(SIPI_DOTO): $(call src-to-obj,rmodules_$(ARCH-ramstage-y),src/cpu/x86/sipi_vector.S)
- $(CC_rmodules_$(ARCH-ramstage-y)) $(CFLAGS_rmodules_$(ARCH-ramstage-y)) -nostdlib -r -o $@ $^
-
-ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
-$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_DOTO), 0,x86_32))
+ifeq ($(CONFIG_HAVE_RAMSTAGE),y)
+TARGET_STAGE=ramstage
+else ifeq ($(CONFIG_RAMPAYLOAD),y)
+TARGET_STAGE=postcar
else
-$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_DOTO), 0,x86_64))
+$(error Halting the build due to unknown TARGET_STAGE select)
endif
+ifeq ($(CONFIG_PARALLEL_MP),y)
+$(TARGET_STAGE)-srcs += $(SIPI_BIN).manual
+endif
+rmodules_$(ARCH-$(TARGET_STAGE)-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S
+
+$(SIPI_DOTO): $(call src-to-obj,rmodules_$(ARCH-$(TARGET_STAGE)-y),src/cpu/x86/sipi_vector.S)
+ $(CC_rmodules_$(ARCH-$(TARGET_STAGE)-y)) $(CFLAGS_rmodules_$(ARCH-$(TARGET_STAGE)-y)) -nostdlib -r -o $@ $^
+
+$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_DOTO), 0,$(ARCH-$(TARGET_STAGE)-y)))
+
$(SIPI_BIN): $(SIPI_RMOD)
- $(OBJCOPY_ramstage) -O binary $< $@
+ $(OBJCOPY_$(TARGET_STAGE)) -O binary $< $@
-$(call src-to-obj,ramstage,$(SIPI_BIN).manual): $(SIPI_BIN)
+$(call src-to-obj,$(TARGET_STAGE),$(SIPI_BIN).manual): $(SIPI_BIN)
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
- cd $(dir $<); $(OBJCOPY_rmodules_$(ARCH-ramstage-y)) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
+ cd $(dir $<); $(OBJCOPY_rmodules_$(ARCH-$(TARGET_STAGE)-y)) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
diff --git a/src/drivers/intel/fsp1_1/Makefile.inc b/src/drivers/intel/fsp1_1/Makefile.inc
index 93f3b59d4b..10877b9482 100644
--- a/src/drivers/intel/fsp1_1/Makefile.inc
+++ b/src/drivers/intel/fsp1_1/Makefile.inc
@@ -21,6 +21,7 @@ verstage-y += fsp_util.c
verstage-$(CONFIG_SEPARATE_VERSTAGE) += verstage.c
bootblock-y += bootblock.c
+bootblock-$(CONFIG_USE_GENERIC_FSP_CAR_INC) += cache_as_ram.S
bootblock-y += fsp_util.c
romstage-y += car.c
@@ -42,8 +43,6 @@ ramstage-$(CONFIG_MMA) += mma_core.c
CPPFLAGS_common += -Isrc/drivers/intel/fsp1_1/include
-cpu_incs-$(CONFIG_USE_GENERIC_FSP_CAR_INC) += $(src)/drivers/intel/fsp1_1/cache_as_ram.inc
-
postcar-y += stage_cache.c
ifneq ($(CONFIG_SKIP_FSP_CAR),y)
postcar-y += temp_ram_exit.c
diff --git a/src/drivers/intel/fsp1_1/cache_as_ram.inc b/src/drivers/intel/fsp1_1/cache_as_ram.S
similarity index 93%
rename from src/drivers/intel/fsp1_1/cache_as_ram.inc
rename to src/drivers/intel/fsp1_1/cache_as_ram.S
index 493dbc8d04..3460b9da34 100644
--- a/src/drivers/intel/fsp1_1/cache_as_ram.inc
+++ b/src/drivers/intel/fsp1_1/cache_as_ram.S
@@ -5,6 +5,7 @@
* Copyright (C) 2007-2008 coresystems GmbH
* Copyright (C) 2013-2014 Sage Electronic Engineering, LLC.
* Copyright (C) 2015 Intel Corp.
+ * Copyright (C) 2018-2019 Eltan B.V.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,6 +17,8 @@
* GNU General Public License for more details.
*/
+#include
+
/*
* Replacement for cache_as_ram.inc when using the FSP binary. This code
* locates the FSP binary, initializes the cache as RAM and performs the
@@ -24,8 +27,10 @@
* performs the final stage of initialization.
*/
-/* I/O delay between post codes on failure */
-#define LHLT_DELAY 0x50000
+#define LHLT_DELAY 0x50000 /* I/O delay between post codes on failure */
+
+.global bootblock_pre_c_entry
+bootblock_pre_c_entry:
/*
* Per FSP1.1 specs, following registers are preserved:
* EBX, EDI, ESI, EBP, MM0, MM1
@@ -129,10 +134,9 @@ CAR_init_done:
/* Need to align stack to 16 bytes at call instruction. Account for
the pushes below. */
andl $0xfffffff0, %esp
- subl $4, %esp
+ subl $8, %esp
- /* Push BIST and initial timestamp on the stack */
- pushl %ebx /* bist */
+ /* Push initial timestamp on the stack */
movd %mm1, %eax
pushl %eax /* tsc[63:32] */
movd %mm0, %eax
@@ -141,12 +145,10 @@ CAR_init_done:
before_romstage:
post_code(0x2A)
- /* Call bootblock_c_entry_bist(uint64_t base_timestamp, uint32_t bist)
- in cpu/intel/car/romstage.c */
- call bootblock_c_entry_bist
+ /* Call bootblock_c_entry(uint64_t base_timestamp) */
+ call bootblock_c_entry
- movb $0x69, %ah
- jmp .Lhlt
+ /* Never reached */
halt1:
/*
diff --git a/src/drivers/intel/fsp1_1/car.c b/src/drivers/intel/fsp1_1/car.c
index dd17664036..67ed099695 100644
--- a/src/drivers/intel/fsp1_1/car.c
+++ b/src/drivers/intel/fsp1_1/car.c
@@ -101,18 +101,6 @@ void mainboard_romstage_entry(unsigned long bist)
* is still enabled. We can directly access work buffer here. */
struct prog fsp = PROG_INIT(PROG_REFCODE, "fsp.bin");
- if (!CONFIG(C_ENVIRONMENT_BOOTBLOCK)) {
- /* Call into pre-console init code then initialize console. */
- car_soc_pre_console_init();
- car_mainboard_pre_console_init();
- console_init();
-
- display_mtrrs();
-
- car_soc_post_console_init();
- car_mainboard_post_console_init();
- }
-
if (prog_locate(&fsp))
die_with_post_code(POST_INVALID_CBFS, "Unable to locate fsp.bin");
@@ -125,19 +113,3 @@ void mainboard_romstage_entry(unsigned long bist)
cache_as_ram_stage_main(fih);
}
-
-void __weak car_mainboard_pre_console_init(void)
-{
-}
-
-void __weak car_soc_pre_console_init(void)
-{
-}
-
-void __weak car_mainboard_post_console_init(void)
-{
-}
-
-void __weak car_soc_post_console_init(void)
-{
-}
diff --git a/src/drivers/intel/fsp1_1/include/fsp/car.h b/src/drivers/intel/fsp1_1/include/fsp/car.h
index 8d7a683672..3d99fa6dc9 100644
--- a/src/drivers/intel/fsp1_1/include/fsp/car.h
+++ b/src/drivers/intel/fsp1_1/include/fsp/car.h
@@ -24,12 +24,4 @@
* cache_as_ram_stage_main() is the stack pointer to use in RAM after
* exiting cache-as-ram mode. */
void cache_as_ram_stage_main(FSP_INFO_HEADER *fih);
-
-/* Mainboard and SoC initialization prior to console. */
-void car_mainboard_pre_console_init(void);
-void car_soc_pre_console_init(void);
-/* Mainboard and SoC initialization post console initialization. */
-void car_mainboard_post_console_init(void);
-void car_soc_post_console_init(void);
-
#endif
diff --git a/src/drivers/lenovo/hybrid_graphics/Kconfig b/src/drivers/lenovo/hybrid_graphics/Kconfig
index 389dfb919f..222d4fd2f2 100644
--- a/src/drivers/lenovo/hybrid_graphics/Kconfig
+++ b/src/drivers/lenovo/hybrid_graphics/Kconfig
@@ -1,3 +1,5 @@
config DRIVERS_LENOVO_HYBRID_GRAPHICS
bool
default n
+ # for dual graphics we need to set this
+ select ONBOARD_VGA_IS_PRIMARY
diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c
index a805609c5e..4e1043edb7 100644
--- a/src/drivers/spi/adesto.c
+++ b/src/drivers/spi/adesto.c
@@ -201,11 +201,6 @@ out:
static const struct spi_flash_ops spi_flash_ops = {
.write = adesto_write,
.erase = spi_flash_cmd_erase,
-#if CONFIG(SPI_FLASH_NO_FAST_READ)
- .read = spi_flash_cmd_read_slow,
-#else
- .read = spi_flash_cmd_read_fast,
-#endif
};
int spi_flash_probe_adesto(const struct spi_slave *spi, u8 *idcode,
diff --git a/src/drivers/spi/amic.c b/src/drivers/spi/amic.c
index 64c91cc79f..b580dc3df0 100644
--- a/src/drivers/spi/amic.c
+++ b/src/drivers/spi/amic.c
@@ -176,11 +176,6 @@ out:
static const struct spi_flash_ops spi_flash_ops = {
.write = amic_write,
.erase = spi_flash_cmd_erase,
-#if CONFIG(SPI_FLASH_NO_FAST_READ)
- .read = spi_flash_cmd_read_slow,
-#else
- .read = spi_flash_cmd_read_fast,
-#endif
};
int spi_flash_probe_amic(const struct spi_slave *spi, u8 *idcode,
diff --git a/src/drivers/spi/atmel.c b/src/drivers/spi/atmel.c
index 7d6e172755..58a2862eeb 100644
--- a/src/drivers/spi/atmel.c
+++ b/src/drivers/spi/atmel.c
@@ -157,11 +157,6 @@ out:
static const struct spi_flash_ops spi_flash_ops = {
.write = atmel_write,
.erase = spi_flash_cmd_erase,
-#if CONFIG(SPI_FLASH_NO_FAST_READ)
- .read = spi_flash_cmd_read_slow,
-#else
- .read = spi_flash_cmd_read_fast,
-#endif
};
int spi_flash_probe_atmel(const struct spi_slave *spi, u8 *idcode,
diff --git a/src/drivers/spi/cbfs_spi.c b/src/drivers/spi/cbfs_spi.c
index e311752dee..ad282c695b 100644
--- a/src/drivers/spi/cbfs_spi.c
+++ b/src/drivers/spi/cbfs_spi.c
@@ -31,21 +31,18 @@ static struct spi_flash spi_flash_info;
static bool spi_flash_init_done;
/*
- * Set this to 1 to debug SPI speed, 0 to disable it
- * The format is:
+ * SPI speed logging for big transfers available with BIOS_DEBUG. The format is:
*
- * read SPI 62854 7db7: 10416 us, 3089 KB/s, 24.712 Mbps
+ * read SPI 0x62854 0x7db7: 10416 us, 3089 KB/s, 24.712 Mbps
*
* The important number is the last one. It should roughly match your SPI
* clock. If it doesn't, your driver might need a little tuning.
*/
-#define SPI_SPEED_DEBUG 0
-
static ssize_t spi_readat(const struct region_device *rd, void *b,
size_t offset, size_t size)
{
struct stopwatch sw;
- bool show = SPI_SPEED_DEBUG && size >= 4 * KiB;
+ bool show = size >= 4 * KiB && console_log_level(BIOS_DEBUG);
if (show)
stopwatch_init(&sw);
@@ -58,7 +55,7 @@ static ssize_t spi_readat(const struct region_device *rd, void *b,
u64 speed; /* KiB/s */
int bps; /* Bits per second */
- speed = (u64)size * 1000 / usecs;
+ speed = size * 1000 / usecs;
bps = speed * 8;
printk(BIOS_DEBUG, "read SPI %#zx %#zx: %ld us, %lld KB/s, %d.%03d Mbps\n",
diff --git a/src/drivers/spi/eon.c b/src/drivers/spi/eon.c
index 33e12a000f..f3cf70ef1b 100644
--- a/src/drivers/spi/eon.c
+++ b/src/drivers/spi/eon.c
@@ -292,7 +292,6 @@ static const struct spi_flash_ops spi_flash_ops = {
.write = eon_write,
.erase = spi_flash_cmd_erase,
.status = spi_flash_cmd_status,
- .read = spi_flash_cmd_read_fast,
};
int spi_flash_probe_eon(const struct spi_slave *spi, u8 *idcode,
diff --git a/src/drivers/spi/gigadevice.c b/src/drivers/spi/gigadevice.c
index 83216c06d1..1ff594a24a 100644
--- a/src/drivers/spi/gigadevice.c
+++ b/src/drivers/spi/gigadevice.c
@@ -41,118 +41,131 @@
struct gigadevice_spi_flash_params {
uint16_t id;
- /* Log2 of page size in power-of-two mode */
- uint8_t l2_page_size;
- uint16_t pages_per_sector;
- uint16_t sectors_per_block;
- uint16_t nr_blocks;
- const char *name;
+ uint8_t dual_spi : 1;
+ uint8_t _reserved_for_flags : 3;
+ uint8_t l2_page_size_shift : 4;
+ uint8_t pages_per_sector_shift : 4;
+ uint8_t sectors_per_block_shift : 4;
+ uint8_t nr_blocks_shift;
+ const char name[10];
};
static const struct gigadevice_spi_flash_params gigadevice_spi_flash_table[] = {
{
- .id = 0x3114,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 16,
- .name = "GD25T80",
+ .id = 0x3114,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 4,
+ .name = "GD25T80",
},
{
- .id = 0x4014,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 16,
- .name = "GD25Q80(B)",
+ .id = 0x4014,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 4,
+ .dual_spi = 1,
+ .name = "GD25Q80",
+ }, /* also GD25Q80B */
+ {
+ .id = 0x4015,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 5,
+ .dual_spi = 1,
+ .name = "GD25Q16",
+ }, /* also GD25Q16B */
+ {
+ .id = 0x4016,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 6,
+ .dual_spi = 1,
+ .name = "GD25Q32B",
+ }, /* also GD25Q32B */
+ {
+ .id = 0x4017,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 7,
+ .dual_spi = 1,
+ .name = "GD25Q64",
+ }, /* also GD25Q64B, GD25B64C */
+ {
+ .id = 0x4018,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 8,
+ .dual_spi = 1,
+ .name = "GD25Q128",
+ }, /* also GD25Q128B */
+ {
+ .id = 0x4214,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 4,
+ .dual_spi = 1,
+ .name = "GD25VQ80C",
},
{
- .id = 0x4015,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 32,
- .name = "GD25Q16(B)",
+ .id = 0x4215,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 5,
+ .dual_spi = 1,
+ .name = "GD25VQ16C",
},
{
- .id = 0x4016,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 64,
- .name = "GD25Q32(B)",
+ .id = 0x6014,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 4,
+ .dual_spi = 1,
+ .name = "GD25LQ80",
},
{
- .id = 0x4017,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 128,
- .name = "GD25Q64(B)/GD25B64C",
+ .id = 0x6015,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 5,
+ .dual_spi = 1,
+ .name = "GD25LQ16",
},
{
- .id = 0x4018,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 256,
- .name = "GD25Q128(B)",
+ .id = 0x6016,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 6,
+ .dual_spi = 1,
+ .name = "GD25LQ32",
},
{
- .id = 0x4214,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 16,
- .name = "GD25VQ80C",
- },
+ .id = 0x6017,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 7,
+ .dual_spi = 1,
+ .name = "GD25LQ64C",
+ }, /* also GD25LB64C */
{
- .id = 0x4215,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 32,
- .name = "GD25VQ16C",
- },
- {
- .id = 0x6014,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 16,
- .name = "GD25LQ80",
- },
- {
- .id = 0x6015,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 32,
- .name = "GD25LQ16",
- },
- {
- .id = 0x6016,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 64,
- .name = "GD25LQ32",
- },
- {
- .id = 0x6017,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 128,
- .name = "GD25LQ64C/GD25LB64C",
- },
- {
- .id = 0x6018,
- .l2_page_size = 8,
- .pages_per_sector = 16,
- .sectors_per_block = 16,
- .nr_blocks = 256,
- .name = "GD25LQ128",
+ .id = 0x6018,
+ .l2_page_size_shift = 8,
+ .pages_per_sector_shift = 4,
+ .sectors_per_block_shift = 4,
+ .nr_blocks_shift = 8,
+ .dual_spi = 1,
+ .name = "GD25LQ128",
},
};
@@ -222,11 +235,6 @@ static const struct spi_flash_ops spi_flash_ops = {
.write = gigadevice_write,
.erase = spi_flash_cmd_erase,
.status = spi_flash_cmd_status,
-#if CONFIG(SPI_FLASH_NO_FAST_READ)
- .read = spi_flash_cmd_read_slow,
-#else
- .read = spi_flash_cmd_read_fast,
-#endif
};
int spi_flash_probe_gigadevice(const struct spi_slave *spi, u8 *idcode,
@@ -252,10 +260,12 @@ int spi_flash_probe_gigadevice(const struct spi_slave *spi, u8 *idcode,
flash->name = params->name;
/* Assuming power-of-two page size initially. */
- flash->page_size = 1 << params->l2_page_size;
- flash->sector_size = flash->page_size * params->pages_per_sector;
- flash->size = flash->sector_size * params->sectors_per_block *
- params->nr_blocks;
+ flash->page_size = 1 << params->l2_page_size_shift;
+ flash->sector_size = flash->page_size *
+ (1 << params->pages_per_sector_shift);
+ flash->size = flash->sector_size *
+ (1 << params->sectors_per_block_shift) *
+ (1 << params->nr_blocks_shift);
flash->erase_cmd = CMD_GD25_SE;
flash->status_cmd = CMD_GD25_RDSR;
diff --git a/src/drivers/spi/macronix.c b/src/drivers/spi/macronix.c
index 1610ca18c8..5a97b8f794 100644
--- a/src/drivers/spi/macronix.c
+++ b/src/drivers/spi/macronix.c
@@ -268,11 +268,6 @@ static const struct spi_flash_ops spi_flash_ops = {
.write = macronix_write,
.erase = spi_flash_cmd_erase,
.status = spi_flash_cmd_status,
-#if CONFIG(SPI_FLASH_NO_FAST_READ)
- .read = spi_flash_cmd_read_slow,
-#else
- .read = spi_flash_cmd_read_fast,
-#endif
};
int spi_flash_probe_macronix(const struct spi_slave *spi, u8 *idcode,
diff --git a/src/drivers/spi/spansion.c b/src/drivers/spi/spansion.c
index e687bf8471..4a241baf09 100644
--- a/src/drivers/spi/spansion.c
+++ b/src/drivers/spi/spansion.c
@@ -282,7 +282,6 @@ static int spansion_write(const struct spi_flash *flash, u32 offset, size_t len,
static const struct spi_flash_ops spi_flash_ops = {
.write = spansion_write,
.erase = spi_flash_cmd_erase,
- .read = spi_flash_cmd_read_slow,
.status = spi_flash_cmd_status,
};
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index ae1d2efb22..a81306e386 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -31,7 +31,7 @@ static void spi_flash_addr(u32 addr, u8 *cmd)
static int do_spi_flash_cmd(const struct spi_slave *spi, const void *dout,
size_t bytes_out, void *din, size_t bytes_in)
{
- int ret = 1;
+ int ret;
/*
* SPI flash requires command-response kind of behavior. Thus, two
* separate SPI vectors are required -- first to transmit dout and other
@@ -49,11 +49,39 @@ static int do_spi_flash_cmd(const struct spi_slave *spi, const void *dout,
if (!bytes_in)
count = 1;
- if (spi_claim_bus(spi))
+ ret = spi_claim_bus(spi);
+ if (ret)
return ret;
- if (spi_xfer_vector(spi, vectors, count) == 0)
- ret = 0;
+ ret = spi_xfer_vector(spi, vectors, count);
+
+ spi_release_bus(spi);
+ return ret;
+}
+
+static int do_dual_read_cmd(const struct spi_slave *spi, const void *dout,
+ size_t bytes_out, void *din, size_t bytes_in)
+{
+ int ret;
+
+ /*
+ * spi_xfer_vector() will automatically fall back to .xfer() if
+ * .xfer_vector() is unimplemented. So using vector API here is more
+ * flexible, even though a controller that implements .xfer_vector()
+ * and (the non-vector based) .xfer_dual() but not .xfer() would be
+ * pretty odd.
+ */
+ struct spi_op vector = { .dout = dout, .bytesout = bytes_out,
+ .din = NULL, .bytesin = 0 };
+
+ ret = spi_claim_bus(spi);
+ if (ret)
+ return ret;
+
+ ret = spi_xfer_vector(spi, &vector, 1);
+
+ if (!ret)
+ ret = spi->ctrlr->xfer_dual(spi, NULL, 0, din, bytes_in);
spi_release_bus(spi);
return ret;
@@ -68,18 +96,6 @@ int spi_flash_cmd(const struct spi_slave *spi, u8 cmd, void *response, size_t le
return ret;
}
-static int spi_flash_cmd_read(const struct spi_slave *spi, const u8 *cmd,
- size_t cmd_len, void *data, size_t data_len)
-{
- int ret = do_spi_flash_cmd(spi, cmd, cmd_len, data, data_len);
- if (ret) {
- printk(BIOS_WARNING, "SF: Failed to send read command (%zu bytes): %d\n",
- data_len, ret);
- }
-
- return ret;
-}
-
/* TODO: This code is quite possibly broken and overflowing stacks. Fix ASAP! */
#pragma GCC diagnostic push
#if defined(__GNUC__) && !defined(__clang__)
@@ -103,34 +119,43 @@ int spi_flash_cmd_write(const struct spi_slave *spi, const u8 *cmd,
}
#pragma GCC diagnostic pop
-static int spi_flash_cmd_read_array(const struct spi_slave *spi, u8 *cmd,
- size_t cmd_len, u32 offset,
- size_t len, void *data)
-{
- spi_flash_addr(offset, cmd);
- return spi_flash_cmd_read(spi, cmd, cmd_len, data, len);
-}
-
/* Perform the read operation honoring spi controller fifo size, reissuing
* the read command until the full request completed. */
-static int spi_flash_cmd_read_array_wrapped(const struct spi_slave *spi,
- u8 *cmd, size_t cmd_len, u32 offset,
- size_t len, void *buf)
+static int spi_flash_read_chunked(const struct spi_flash *flash, u32 offset,
+ size_t len, void *buf)
{
- int ret;
- size_t xfer_len;
+ u8 cmd[5];
+ int ret, cmd_len;
+ int (*do_cmd)(const struct spi_slave *spi, const void *din,
+ size_t in_bytes, void *out, size_t out_bytes);
+
+ if (CONFIG(SPI_FLASH_NO_FAST_READ)) {
+ cmd_len = 4;
+ cmd[0] = CMD_READ_ARRAY_SLOW;
+ do_cmd = do_spi_flash_cmd;
+ } else if (flash->flags.dual_spi && flash->spi.ctrlr->xfer_dual) {
+ cmd_len = 5;
+ cmd[0] = CMD_READ_FAST_DUAL_OUTPUT;
+ cmd[4] = 0;
+ do_cmd = do_dual_read_cmd;
+ } else {
+ cmd_len = 5;
+ cmd[0] = CMD_READ_ARRAY_FAST;
+ cmd[4] = 0;
+ do_cmd = do_spi_flash_cmd;
+ }
+
uint8_t *data = buf;
-
while (len) {
- xfer_len = spi_crop_chunk(spi, cmd_len, len);
-
- /* Perform the read. */
- ret = spi_flash_cmd_read_array(spi, cmd, cmd_len,
- offset, xfer_len, data);
-
- if (ret)
+ size_t xfer_len = spi_crop_chunk(&flash->spi, cmd_len, len);
+ spi_flash_addr(offset, cmd);
+ ret = do_cmd(&flash->spi, cmd, cmd_len, data, xfer_len);
+ if (ret) {
+ printk(BIOS_WARNING,
+ "SF: Failed to send read command %#.2x(%#x, %#zx): %d\n",
+ cmd[0], offset, xfer_len, ret);
return ret;
-
+ }
offset += xfer_len;
data += xfer_len;
len -= xfer_len;
@@ -139,28 +164,6 @@ static int spi_flash_cmd_read_array_wrapped(const struct spi_slave *spi,
return 0;
}
-int spi_flash_cmd_read_fast(const struct spi_flash *flash, u32 offset,
- size_t len, void *data)
-{
- u8 cmd[5];
-
- cmd[0] = CMD_READ_ARRAY_FAST;
- cmd[4] = 0x00;
-
- return spi_flash_cmd_read_array_wrapped(&flash->spi, cmd, sizeof(cmd),
- offset, len, data);
-}
-
-int spi_flash_cmd_read_slow(const struct spi_flash *flash, u32 offset,
- size_t len, void *data)
-{
- u8 cmd[4];
-
- cmd[0] = CMD_READ_ARRAY_SLOW;
- return spi_flash_cmd_read_array_wrapped(&flash->spi, cmd, sizeof(cmd),
- offset, len, data);
-}
-
int spi_flash_cmd_poll_bit(const struct spi_flash *flash, unsigned long timeout,
u8 cmd, u8 poll_bit)
{
@@ -174,7 +177,7 @@ int spi_flash_cmd_poll_bit(const struct spi_flash *flash, unsigned long timeout,
mono_time_add_msecs(&end, timeout);
do {
- ret = spi_flash_cmd_read(spi, &cmd, 1, &status, 1);
+ ret = do_spi_flash_cmd(spi, &cmd, 1, &status, 1);
if (ret)
return -1;
if ((status & poll_bit) == 0)
@@ -377,8 +380,12 @@ int spi_flash_probe(unsigned int bus, unsigned int cs, struct spi_flash *flash)
return -1;
}
- printk(BIOS_INFO, "SF: Detected %s with sector size 0x%x, total 0x%x\n",
- flash->name, flash->sector_size, flash->size);
+ const char *mode_string = "";
+ if (flash->flags.dual_spi && spi.ctrlr->xfer_dual)
+ mode_string = " (Dual SPI mode)";
+ printk(BIOS_INFO,
+ "SF: Detected %s with sector size 0x%x, total 0x%x%s\n",
+ flash->name, flash->sector_size, flash->size, mode_string);
if (bus == CONFIG_BOOT_DEVICE_SPI_FLASH_BUS
&& flash->size != CONFIG_ROM_SIZE) {
printk(BIOS_ERR, "SF size 0x%x does not correspond to"
@@ -391,7 +398,10 @@ int spi_flash_probe(unsigned int bus, unsigned int cs, struct spi_flash *flash)
int spi_flash_read(const struct spi_flash *flash, u32 offset, size_t len,
void *buf)
{
- return flash->ops->read(flash, offset, len, buf);
+ if (flash->ops->read)
+ return flash->ops->read(flash, offset, len, buf);
+
+ return spi_flash_read_chunked(flash, offset, len, buf);
}
int spi_flash_write(const struct spi_flash *flash, u32 offset, size_t len,
diff --git a/src/drivers/spi/spi_flash_internal.h b/src/drivers/spi/spi_flash_internal.h
index a89610a7bc..4a9e289029 100644
--- a/src/drivers/spi/spi_flash_internal.h
+++ b/src/drivers/spi/spi_flash_internal.h
@@ -23,6 +23,8 @@
#define CMD_READ_ARRAY_FAST 0x0b
#define CMD_READ_ARRAY_LEGACY 0xe8
+#define CMD_READ_FAST_DUAL_OUTPUT 0x3b
+
#define CMD_READ_STATUS 0x05
#define CMD_WRITE_ENABLE 0x06
@@ -34,12 +36,6 @@
/* Send a single-byte command to the device and read the response */
int spi_flash_cmd(const struct spi_slave *spi, u8 cmd, void *response, size_t len);
-int spi_flash_cmd_read_fast(const struct spi_flash *flash, u32 offset,
- size_t len, void *data);
-
-int spi_flash_cmd_read_slow(const struct spi_flash *flash, u32 offset,
- size_t len, void *data);
-
/*
* Send a multi-byte command to the device followed by (optional)
* data. Used for programming the flash array, etc.
diff --git a/src/drivers/spi/sst.c b/src/drivers/spi/sst.c
index e4ea7805dd..abe3f2ace6 100644
--- a/src/drivers/spi/sst.c
+++ b/src/drivers/spi/sst.c
@@ -55,14 +55,12 @@ static const struct spi_flash_ops spi_flash_ops_write_ai = {
.write = sst_write_ai,
.erase = spi_flash_cmd_erase,
.status = spi_flash_cmd_status,
- .read = spi_flash_cmd_read_fast,
};
static const struct spi_flash_ops spi_flash_ops_write_256 = {
.write = sst_write_256,
.erase = spi_flash_cmd_erase,
.status = spi_flash_cmd_status,
- .read = spi_flash_cmd_read_fast,
};
#define SST_SECTOR_SIZE (4 * 1024)
diff --git a/src/drivers/spi/stmicro.c b/src/drivers/spi/stmicro.c
index fb24b27266..6625764268 100644
--- a/src/drivers/spi/stmicro.c
+++ b/src/drivers/spi/stmicro.c
@@ -351,7 +351,6 @@ out:
static const struct spi_flash_ops spi_flash_ops = {
.write = stmicro_write,
.erase = spi_flash_cmd_erase,
- .read = spi_flash_cmd_read_fast,
};
int spi_flash_probe_stmicro(const struct spi_slave *spi, u8 *idcode,
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 11a518746c..9e9bb00464 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -26,7 +26,9 @@
struct winbond_spi_flash_params {
uint16_t id;
- uint8_t l2_page_size_shift;
+ uint8_t dual_spi : 1;
+ uint8_t _reserved_for_flags : 3;
+ uint8_t l2_page_size_shift : 4;
uint8_t pages_per_sector_shift : 4;
uint8_t sectors_per_block_shift : 4;
uint8_t nr_blocks_shift;
@@ -123,6 +125,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 4,
.name = "W25X80",
+ .dual_spi = 1,
},
{
.id = 0x3015,
@@ -131,6 +134,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 5,
.name = "W25X16",
+ .dual_spi = 1,
},
{
.id = 0x3016,
@@ -139,6 +143,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 6,
.name = "W25X32",
+ .dual_spi = 1,
},
{
.id = 0x3017,
@@ -147,6 +152,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 7,
.name = "W25X64",
+ .dual_spi = 1,
},
{
.id = 0x4014,
@@ -155,6 +161,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 4,
.name = "W25Q80_V",
+ .dual_spi = 1,
},
{
.id = 0x4015,
@@ -163,6 +170,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 5,
.name = "W25Q16_V",
+ .dual_spi = 1,
.protection_granularity_shift = 16,
.bp_bits = 3,
},
@@ -173,6 +181,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 5,
.name = "W25Q16DW",
+ .dual_spi = 1,
.protection_granularity_shift = 16,
.bp_bits = 3,
},
@@ -183,6 +192,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 6,
.name = "W25Q32_V",
+ .dual_spi = 1,
.protection_granularity_shift = 16,
.bp_bits = 3,
},
@@ -193,6 +203,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 6,
.name = "W25Q32DW",
+ .dual_spi = 1,
.protection_granularity_shift = 16,
.bp_bits = 3,
},
@@ -203,6 +214,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 7,
.name = "W25Q64_V",
+ .dual_spi = 1,
.protection_granularity_shift = 17,
.bp_bits = 3,
},
@@ -213,6 +225,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 7,
.name = "W25Q64DW",
+ .dual_spi = 1,
.protection_granularity_shift = 17,
.bp_bits = 3,
},
@@ -223,6 +236,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 8,
.name = "W25Q128_V",
+ .dual_spi = 1,
.protection_granularity_shift = 18,
.bp_bits = 3,
},
@@ -233,6 +247,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 8,
.name = "W25Q128FW",
+ .dual_spi = 1,
.protection_granularity_shift = 18,
.bp_bits = 3,
},
@@ -243,6 +258,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 8,
.name = "W25Q128J",
+ .dual_spi = 1,
.protection_granularity_shift = 18,
.bp_bits = 3,
},
@@ -253,6 +269,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 9,
.name = "W25Q256_V",
+ .dual_spi = 1,
.protection_granularity_shift = 16,
.bp_bits = 4,
},
@@ -263,6 +280,7 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
.sectors_per_block_shift = 4,
.nr_blocks_shift = 9,
.name = "W25Q256J",
+ .dual_spi = 1,
.protection_granularity_shift = 16,
.bp_bits = 4,
},
@@ -646,11 +664,6 @@ static const struct spi_flash_ops spi_flash_ops = {
.write = winbond_write,
.erase = spi_flash_cmd_erase,
.status = spi_flash_cmd_status,
-#if CONFIG(SPI_FLASH_NO_FAST_READ)
- .read = spi_flash_cmd_read_slow,
-#else
- .read = spi_flash_cmd_read_fast,
-#endif
.get_write_protection = winbond_get_write_protection,
.set_write_protection = winbond_set_write_protection,
};
@@ -686,6 +699,8 @@ int spi_flash_probe_winbond(const struct spi_slave *spi, u8 *idcode,
flash->erase_cmd = CMD_W25_SE;
flash->status_cmd = CMD_W25_RDSR;
+ flash->flags.dual_spi = params->dual_spi;
+
flash->ops = &spi_flash_ops;
flash->driver_private = params;
diff --git a/src/ec/google/wilco/acpi/ec.asl b/src/ec/google/wilco/acpi/ec.asl
index 675ee3778e..4fa887b1b4 100644
--- a/src/ec/google/wilco/acpi/ec.asl
+++ b/src/ec/google/wilco/acpi/ec.asl
@@ -57,6 +57,9 @@ Device (EC0)
If (\DPTE == One) {
W (DWST, Arg1)
}
+
+ /* Initialize UCSI */
+ ^UCSI.INIT ()
}
/*
@@ -165,6 +168,7 @@ Device (EC0)
#include "lid.asl"
#include "platform.asl"
#include "vbtn.asl"
+ #include "ucsi.asl"
#ifdef EC_ENABLE_DPTF
#include "dptf.asl"
#endif
diff --git a/src/ec/google/wilco/acpi/ec_ram.asl b/src/ec/google/wilco/acpi/ec_ram.asl
index 0de39475bc..47e9072dcb 100644
--- a/src/ec/google/wilco/acpi/ec_ram.asl
+++ b/src/ec/google/wilco/acpi/ec_ram.asl
@@ -143,3 +143,54 @@ Name (DWHY, Package () { 0x37, 0xff, WR }) /* DPTF: Write Hysteresis */
Name (DWTQ, Package () { 0x38, 0xff, WR }) /* DPTF: Write Trip Query */
Name (CSOS, Package () { 0xb8, 0xff, WR }) /* OS support for S0ix */
Name (CSEX, Package () { 0xb9, 0xff, WR }) /* OS enter(1)/exit(0) S0ix */
+
+/*
+ * EC UCSI
+ */
+Name (UVR0, Package () { 0x80, 0xff, RD }) /* UCSI Version */
+Name (UVR1, Package () { 0x81, 0xff, RD }) /* UCSI Version */
+Name (UCI0, Package () { 0x84, 0xff, RD }) /* UCSI Change Indicator */
+Name (UCI1, Package () { 0x85, 0xff, RD }) /* UCSI Change Indicator */
+Name (UCI2, Package () { 0x86, 0xff, RD }) /* UCSI Change Indicator */
+Name (UCI3, Package () { 0x87, 0xff, RD }) /* UCSI Change Indicator */
+Name (UCL0, Package () { 0x88, 0xff, WR }) /* UCSI Control */
+Name (UCL1, Package () { 0x89, 0xff, WR }) /* UCSI Control */
+Name (UCL2, Package () { 0x8a, 0xff, WR }) /* UCSI Control */
+Name (UCL3, Package () { 0x8b, 0xff, WR }) /* UCSI Control */
+Name (UCL4, Package () { 0x8c, 0xff, WR }) /* UCSI Control */
+Name (UCL5, Package () { 0x8d, 0xff, WR }) /* UCSI Control */
+Name (UCL6, Package () { 0x8e, 0xff, WR }) /* UCSI Control */
+Name (UCL7, Package () { 0x8f, 0xff, WR }) /* UCSI Control */
+Name (UMI0, Package () { 0x90, 0xff, RD }) /* UCSI Message In */
+Name (UMI1, Package () { 0x91, 0xff, RD }) /* UCSI Message In */
+Name (UMI2, Package () { 0x92, 0xff, RD }) /* UCSI Message In */
+Name (UMI3, Package () { 0x93, 0xff, RD }) /* UCSI Message In */
+Name (UMI4, Package () { 0x94, 0xff, RD }) /* UCSI Message In */
+Name (UMI5, Package () { 0x95, 0xff, RD }) /* UCSI Message In */
+Name (UMI6, Package () { 0x96, 0xff, RD }) /* UCSI Message In */
+Name (UMI7, Package () { 0x97, 0xff, RD }) /* UCSI Message In */
+Name (UMI8, Package () { 0x98, 0xff, RD }) /* UCSI Message In */
+Name (UMI9, Package () { 0x99, 0xff, RD }) /* UCSI Message In */
+Name (UMIA, Package () { 0x9a, 0xff, RD }) /* UCSI Message In */
+Name (UMIB, Package () { 0x9b, 0xff, RD }) /* UCSI Message In */
+Name (UMIC, Package () { 0x9c, 0xff, RD }) /* UCSI Message In */
+Name (UMID, Package () { 0x9d, 0xff, RD }) /* UCSI Message In */
+Name (UMIE, Package () { 0x9e, 0xff, RD }) /* UCSI Message In */
+Name (UMIF, Package () { 0x9f, 0xff, RD }) /* UCSI Message In */
+Name (UMO0, Package () { 0xa0, 0xff, WR }) /* UCSI Message Out */
+Name (UMO1, Package () { 0xa1, 0xff, WR }) /* UCSI Message Out */
+Name (UMO2, Package () { 0xa2, 0xff, WR }) /* UCSI Message Out */
+Name (UMO3, Package () { 0xa3, 0xff, WR }) /* UCSI Message Out */
+Name (UMO4, Package () { 0xa4, 0xff, WR }) /* UCSI Message Out */
+Name (UMO5, Package () { 0xa5, 0xff, WR }) /* UCSI Message Out */
+Name (UMO6, Package () { 0xa6, 0xff, WR }) /* UCSI Message Out */
+Name (UMO7, Package () { 0xa7, 0xff, WR }) /* UCSI Message Out */
+Name (UMO8, Package () { 0xa8, 0xff, WR }) /* UCSI Message Out */
+Name (UMO9, Package () { 0xa9, 0xff, WR }) /* UCSI Message Out */
+Name (UMOA, Package () { 0xaa, 0xff, WR }) /* UCSI Message Out */
+Name (UMOB, Package () { 0xab, 0xff, WR }) /* UCSI Message Out */
+Name (UMOC, Package () { 0xac, 0xff, WR }) /* UCSI Message Out */
+Name (UMOD, Package () { 0xad, 0xff, WR }) /* UCSI Message Out */
+Name (UMOE, Package () { 0xae, 0xff, WR }) /* UCSI Message Out */
+Name (UMOF, Package () { 0xaf, 0xff, WR }) /* UCSI Message Out */
+Name (UCTL, Package () { 0xb0, 0xff, WR }) /* UCSI Control Register */
diff --git a/src/ec/google/wilco/acpi/event.asl b/src/ec/google/wilco/acpi/event.asl
index fab4fc46c3..f6534d3773 100644
--- a/src/ec/google/wilco/acpi/event.asl
+++ b/src/ec/google/wilco/acpi/event.asl
@@ -145,3 +145,10 @@ Method (_Q66, 0, Serialized)
ECQ4 (Local0)
}
}
+
+/* UCSI SCI uses a unique event code */
+Method (_Q79, 0, Serialized)
+{
+ Printf ("EC _Q79 UCSI Event")
+ Notify (^UCSI, 0x80)
+}
diff --git a/src/ec/google/wilco/acpi/ucsi.asl b/src/ec/google/wilco/acpi/ucsi.asl
new file mode 100644
index 0000000000..f69e5924e7
--- /dev/null
+++ b/src/ec/google/wilco/acpi/ucsi.asl
@@ -0,0 +1,157 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+Device (UCSI)
+{
+ Name (_HID, "GOOG000E")
+ Name (_CID, EisaId ("PNP0CA0"))
+ Name (_DDN, "Wilco EC UCSI")
+ Name (_UID, One)
+ Name (_ADR, Zero)
+ Name (_STA, 0xf)
+
+ /* Value written to EC control register to start UCSI command */
+ Name (UCMD, 0xE0)
+
+ /* Shared memory fields are defined in the SSDT */
+ External (VER0, FieldUnitObj)
+ External (VER1, FieldUnitObj)
+ External (CCI0, FieldUnitObj)
+ External (CCI1, FieldUnitObj)
+ External (CCI2, FieldUnitObj)
+ External (CCI3, FieldUnitObj)
+ External (CTL0, FieldUnitObj)
+ External (CTL1, FieldUnitObj)
+ External (CTL2, FieldUnitObj)
+ External (CTL3, FieldUnitObj)
+ External (CTL4, FieldUnitObj)
+ External (CTL5, FieldUnitObj)
+ External (CTL6, FieldUnitObj)
+ External (CTL7, FieldUnitObj)
+ External (MGI0, FieldUnitObj)
+ External (MGI1, FieldUnitObj)
+ External (MGI2, FieldUnitObj)
+ External (MGI3, FieldUnitObj)
+ External (MGI4, FieldUnitObj)
+ External (MGI5, FieldUnitObj)
+ External (MGI6, FieldUnitObj)
+ External (MGI7, FieldUnitObj)
+ External (MGI8, FieldUnitObj)
+ External (MGI9, FieldUnitObj)
+ External (MGIA, FieldUnitObj)
+ External (MGIB, FieldUnitObj)
+ External (MGIC, FieldUnitObj)
+ External (MGID, FieldUnitObj)
+ External (MGIE, FieldUnitObj)
+ External (MGIF, FieldUnitObj)
+ External (MGO0, FieldUnitObj)
+ External (MGO1, FieldUnitObj)
+ External (MGO2, FieldUnitObj)
+ External (MGO3, FieldUnitObj)
+ External (MGO4, FieldUnitObj)
+ External (MGO5, FieldUnitObj)
+ External (MGO6, FieldUnitObj)
+ External (MGO7, FieldUnitObj)
+ External (MGO8, FieldUnitObj)
+ External (MGO9, FieldUnitObj)
+ External (MGOA, FieldUnitObj)
+ External (MGOB, FieldUnitObj)
+ External (MGOC, FieldUnitObj)
+ External (MGOD, FieldUnitObj)
+ External (MGOE, FieldUnitObj)
+ External (MGOF, FieldUnitObj)
+
+ Method (INIT)
+ {
+ /* Read UCSI version from EC into shared memory */
+ ^VER0 = R (^^UVR0)
+ ^VER1 = R (^^UVR1)
+ }
+
+ Method (_DSM, 4, Serialized)
+ {
+ If (Arg0 != ToUUID ("6f8398c2-7ca4-11e4-ad36-631042b5008f")) {
+ Return (Buffer (One) { Zero })
+ }
+
+ Switch (ToInteger (Arg2))
+ {
+ Case (Zero)
+ {
+ Return (Buffer (One) { 0x07 })
+ }
+ Case (One)
+ {
+ /* Write Message Out */
+ W (^^UMO0, ^MGO0)
+ W (^^UMO1, ^MGO1)
+ W (^^UMO2, ^MGO2)
+ W (^^UMO3, ^MGO3)
+ W (^^UMO4, ^MGO4)
+ W (^^UMO5, ^MGO5)
+ W (^^UMO6, ^MGO6)
+ W (^^UMO7, ^MGO7)
+ W (^^UMO8, ^MGO8)
+ W (^^UMO9, ^MGO9)
+ W (^^UMOA, ^MGOA)
+ W (^^UMOB, ^MGOB)
+ W (^^UMOC, ^MGOC)
+ W (^^UMOD, ^MGOD)
+ W (^^UMOE, ^MGOE)
+ W (^^UMOF, ^MGOF)
+
+ /* Write Control */
+ W (^^UCL0, ^CTL0)
+ W (^^UCL1, ^CTL1)
+ W (^^UCL2, ^CTL2)
+ W (^^UCL3, ^CTL3)
+ W (^^UCL4, ^CTL4)
+ W (^^UCL5, ^CTL5)
+ W (^^UCL6, ^CTL6)
+ W (^^UCL7, ^CTL7)
+
+ /* Start EC Command */
+ W (^^UCTL, ^UCMD)
+ }
+ Case (2)
+ {
+ /* Read Message In */
+ ^MGI0 = R (^^UMI0)
+ ^MGI1 = R (^^UMI1)
+ ^MGI2 = R (^^UMI2)
+ ^MGI3 = R (^^UMI3)
+ ^MGI4 = R (^^UMI4)
+ ^MGI5 = R (^^UMI5)
+ ^MGI6 = R (^^UMI6)
+ ^MGI7 = R (^^UMI7)
+ ^MGI8 = R (^^UMI8)
+ ^MGI9 = R (^^UMI9)
+ ^MGIA = R (^^UMIA)
+ ^MGIB = R (^^UMIB)
+ ^MGIC = R (^^UMIC)
+ ^MGID = R (^^UMID)
+ ^MGIE = R (^^UMIE)
+ ^MGIF = R (^^UMIF)
+
+ /* Read Status */
+ ^CCI0 = R (^^UCI0)
+ ^CCI1 = R (^^UCI1)
+ ^CCI2 = R (^^UCI2)
+ ^CCI3 = R (^^UCI3)
+ }
+ }
+ Return (Buffer (One) { Zero })
+ }
+}
diff --git a/src/ec/google/wilco/chip.c b/src/ec/google/wilco/chip.c
index 9b0be19f9a..09211f82ab 100644
--- a/src/ec/google/wilco/chip.c
+++ b/src/ec/google/wilco/chip.c
@@ -14,7 +14,10 @@
*/
#include
+#include
+#include
#include
+#include
#include
#include
#include
@@ -25,6 +28,64 @@
#include "ec.h"
#include "chip.h"
+/*
+ * The UCSI fields are defined in the UCSI specification at
+ * https://www.intel.com/content/www/us/en/io/universal-serial-bus/usb-type-c-ucsi-spec.html
+ * https://www.intel.com/content/www/us/en/io/universal-serial-bus/bios-implementation-of-ucsi.html
+ */
+
+static struct fieldlist ucsi_region_fields[] = {
+ FIELDLIST_NAMESTR("VER0", 8),
+ FIELDLIST_NAMESTR("VER1", 8),
+ FIELDLIST_NAMESTR("RSV0", 8),
+ FIELDLIST_NAMESTR("RSV1", 8),
+ FIELDLIST_NAMESTR("CCI0", 8),
+ FIELDLIST_NAMESTR("CCI1", 8),
+ FIELDLIST_NAMESTR("CCI2", 8),
+ FIELDLIST_NAMESTR("CCI3", 8),
+ FIELDLIST_NAMESTR("CTL0", 8),
+ FIELDLIST_NAMESTR("CTL1", 8),
+ FIELDLIST_NAMESTR("CTL2", 8),
+ FIELDLIST_NAMESTR("CTL3", 8),
+ FIELDLIST_NAMESTR("CTL4", 8),
+ FIELDLIST_NAMESTR("CTL5", 8),
+ FIELDLIST_NAMESTR("CTL6", 8),
+ FIELDLIST_NAMESTR("CTL7", 8),
+ FIELDLIST_NAMESTR("MGI0", 8),
+ FIELDLIST_NAMESTR("MGI1", 8),
+ FIELDLIST_NAMESTR("MGI2", 8),
+ FIELDLIST_NAMESTR("MGI3", 8),
+ FIELDLIST_NAMESTR("MGI4", 8),
+ FIELDLIST_NAMESTR("MGI5", 8),
+ FIELDLIST_NAMESTR("MGI6", 8),
+ FIELDLIST_NAMESTR("MGI7", 8),
+ FIELDLIST_NAMESTR("MGI8", 8),
+ FIELDLIST_NAMESTR("MGI9", 8),
+ FIELDLIST_NAMESTR("MGIA", 8),
+ FIELDLIST_NAMESTR("MGIB", 8),
+ FIELDLIST_NAMESTR("MGIC", 8),
+ FIELDLIST_NAMESTR("MGID", 8),
+ FIELDLIST_NAMESTR("MGIE", 8),
+ FIELDLIST_NAMESTR("MGIF", 8),
+ FIELDLIST_NAMESTR("MGO0", 8),
+ FIELDLIST_NAMESTR("MGO1", 8),
+ FIELDLIST_NAMESTR("MGO2", 8),
+ FIELDLIST_NAMESTR("MGO3", 8),
+ FIELDLIST_NAMESTR("MGO4", 8),
+ FIELDLIST_NAMESTR("MGO5", 8),
+ FIELDLIST_NAMESTR("MGO6", 8),
+ FIELDLIST_NAMESTR("MGO7", 8),
+ FIELDLIST_NAMESTR("MGO8", 8),
+ FIELDLIST_NAMESTR("MGO9", 8),
+ FIELDLIST_NAMESTR("MGOA", 8),
+ FIELDLIST_NAMESTR("MGOB", 8),
+ FIELDLIST_NAMESTR("MGOC", 8),
+ FIELDLIST_NAMESTR("MGOD", 8),
+ FIELDLIST_NAMESTR("MGOE", 8),
+ FIELDLIST_NAMESTR("MGOF", 8),
+};
+static const size_t ucsi_region_len = ARRAY_SIZE(ucsi_region_fields);
+
static void wilco_ec_post_complete(void *unused)
{
wilco_ec_send(KB_BIOS_PROGRESS, BIOS_PROGRESS_POST_COMPLETE);
@@ -111,11 +172,47 @@ static void wilco_ec_read_resources(struct device *dev)
wilco_ec_resource(dev, 2, CONFIG_EC_BASE_PACKET, 16);
}
+static void wilco_ec_fill_ssdt_generator(struct device *dev)
+{
+ struct opregion opreg;
+ void *region_ptr;
+
+ if (!dev->enabled)
+ return;
+
+ region_ptr = cbmem_add(CBMEM_ID_ACPI_UCSI, ucsi_region_len);
+ if (!region_ptr)
+ return;
+ memset(region_ptr, 0, ucsi_region_len);
+
+ opreg.name = "UCSM";
+ opreg.regionspace = SYSTEMMEMORY;
+ opreg.regionoffset = (uintptr_t)region_ptr;
+ opreg.regionlen = ucsi_region_len;
+
+ acpigen_write_scope(acpi_device_path_join(dev, "UCSI"));
+ acpigen_write_name("_CRS");
+ acpigen_write_resourcetemplate_header();
+ acpigen_write_mem32fixed(1, (uintptr_t)region_ptr, ucsi_region_len);
+ acpigen_write_resourcetemplate_footer();
+ acpigen_write_opregion(&opreg);
+ acpigen_write_field(opreg.name, ucsi_region_fields, ucsi_region_len,
+ FIELD_ANYACC | FIELD_LOCK | FIELD_PRESERVE);
+ acpigen_pop_len(); /* Scope */
+}
+
+static const char *wilco_ec_acpi_name(const struct device *dev)
+{
+ return "EC0";
+}
+
static struct device_operations ops = {
- .init = wilco_ec_init,
- .read_resources = wilco_ec_read_resources,
- .enable_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .init = wilco_ec_init,
+ .read_resources = wilco_ec_read_resources,
+ .enable_resources = DEVICE_NOOP,
+ .set_resources = DEVICE_NOOP,
+ .acpi_fill_ssdt_generator = wilco_ec_fill_ssdt_generator,
+ .acpi_name = wilco_ec_acpi_name,
};
static struct pnp_info info[] = {
diff --git a/src/include/console/console.h b/src/include/console/console.h
index 082ba29be8..e5b753e8b6 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -42,8 +42,9 @@ void post_log_clear(void);
#endif
/* this function is weak and can be overridden by a mainboard function. */
void mainboard_post(u8 value);
-void __noreturn die(const char *msg);
-void __noreturn die_with_post_code(uint8_t value, const char *msg);
+void __noreturn die(const char *fmt, ...);
+#define die_with_post_code(value, fmt, ...) \
+ do { post_code(value); die(fmt, ##__VA_ARGS__); } while (0)
/*
* This function is weak and can be overridden to provide additional
@@ -62,8 +63,8 @@ asmlinkage void console_init(void);
int console_log_level(int msg_level);
void do_putchar(unsigned char byte);
-#define printk(LEVEL, fmt, args...) \
- do { do_printk(LEVEL, fmt, ##args); } while (0)
+#define printk(LEVEL, fmt, args...) do_printk(LEVEL, fmt, ##args)
+#define vprintk(LEVEL, fmt, args) do_vprintk(LEVEL, fmt, args)
enum { CONSOLE_LOG_NONE = 0, CONSOLE_LOG_FAST, CONSOLE_LOG_ALL };
@@ -83,14 +84,15 @@ static inline int get_console_loglevel(void)
static inline void console_init(void) {}
static inline int console_log_level(int msg_level) { return 0; }
static inline void printk(int LEVEL, const char *fmt, ...) {}
+static inline void vprintk(int LEVEL, const char *fmt, va_list args) {}
static inline void do_putchar(unsigned char byte) {}
#endif
-int vprintk(int msg_level, const char *fmt, va_list args);
-
int do_printk(int msg_level, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
+int do_vprintk(int msg_level, const char *fmt, va_list args);
+
#endif /* !__ROMCC__ */
#endif /* CONSOLE_CONSOLE_H_ */
diff --git a/src/include/device/pci_ids.h b/src/include/device/pci_ids.h
index a35e134dc9..2c8fadcc6f 100644
--- a/src/include/device/pci_ids.h
+++ b/src/include/device/pci_ids.h
@@ -2696,8 +2696,8 @@
#define PCI_DEVICE_ID_INTEL_SPT_H_Q170 0xa146
#define PCI_DEVICE_ID_INTEL_SPT_H_Q150 0xa147
#define PCI_DEVICE_ID_INTEL_SPT_H_B150 0xa148
-#define PCI_DEVICE_ID_INTEL_KBP_H_C236 0xa149
-#define PCI_DEVICE_ID_INTEL_SPT_H_C236 0xa150
+#define PCI_DEVICE_ID_INTEL_SPT_H_C236 0xa149
+#define PCI_DEVICE_ID_INTEL_SPT_H_CM236 0xa150
#define PCI_DEVICE_ID_INTEL_SPT_H_PREMIUM 0xa14e
#define PCI_DEVICE_ID_INTEL_SPT_H_H110 0xa143
#define PCI_DEVICE_ID_INTEL_SPT_H_QM170 0xa14d
@@ -2723,13 +2723,13 @@
#define PCI_DEVICE_ID_INTEL_CNL_Y_PREMIUM_LPC 0x9d83
#define PCI_DEVICE_ID_INTEL_CNP_H_LPC_Q370 0xa306
#define PCI_DEVICE_ID_INTEL_CNP_H_LPC_QM370 0xa30c
-#define PCI_DEVICE_ID_INTEL_ICL_U_SUPER_U_LPC 0x3480
-#define PCI_DEVICE_ID_INTEL_ICL_U_SUPER_U_LPC_REV0 0x3481
-#define PCI_DEVICE_ID_INTEL_ICL_U_PREMIUM_LPC 0x3482
-#define PCI_DEVICE_ID_INTEL_ICL_BASE_Y_LPC 0x3483
-#define PCI_DEVICE_ID_INTEL_ICL_BASE_U_LPC 0x3484
-#define PCI_DEVICE_ID_INTEL_ICL_Y_PREMIUM_LPC 0x3487
-#define PCI_DEVICE_ID_INTEL_ICL_SUPER_Y_LPC 0x3486
+#define PCI_DEVICE_ID_INTEL_ICL_U_SUPER_U_ESPI 0x3480
+#define PCI_DEVICE_ID_INTEL_ICL_U_SUPER_U_ESPI_REV0 0x3481
+#define PCI_DEVICE_ID_INTEL_ICL_U_PREMIUM_ESPI 0x3482
+#define PCI_DEVICE_ID_INTEL_ICL_BASE_Y_ESPI 0x3483
+#define PCI_DEVICE_ID_INTEL_ICL_BASE_U_ESPI 0x3484
+#define PCI_DEVICE_ID_INTEL_ICL_Y_PREMIUM_ESPI 0x3487
+#define PCI_DEVICE_ID_INTEL_ICL_SUPER_Y_ESPI 0x3486
#define PCI_DEVICE_ID_INTEL_CMP_SUPER_U_LPC 0x0281
#define PCI_DEVICE_ID_INTEL_CMP_PREMIUM_Y_LPC 0x0283
#define PCI_DEVICE_ID_INTEL_CMP_PREMIUM_U_LPC 0x0284
@@ -3076,7 +3076,10 @@
#define PCI_DEVICE_ID_INTEL_SKL_ID_U 0x1904
#define PCI_DEVICE_ID_INTEL_SKL_ID_Y 0x190c
#define PCI_DEVICE_ID_INTEL_SKL_ID_ULX 0x1924
+#define PCI_DEVICE_ID_INTEL_SKL_ID_H_2 0x1900
#define PCI_DEVICE_ID_INTEL_SKL_ID_H 0x1910
+#define PCI_DEVICE_ID_INTEL_SKL_ID_S_2 0x190f
+#define PCI_DEVICE_ID_INTEL_SKL_ID_S_4 0x191f
#define PCI_DEVICE_ID_INTEL_KBL_ID_S 0x590f
#define PCI_DEVICE_ID_INTEL_SKL_ID_H_EM 0x1918
#define PCI_DEVICE_ID_INTEL_SKL_ID_DT 0x191f
diff --git a/src/include/memory_info.h b/src/include/memory_info.h
index 93c7b6bfc9..ad3c1775f9 100644
--- a/src/include/memory_info.h
+++ b/src/include/memory_info.h
@@ -86,6 +86,10 @@ struct dimm_info {
* See the smbios.h smbios_memory_bus_width enum.
*/
uint8_t bus_width;
+ /*
+ * Voltage Level
+ */
+ uint16_t vdd_voltage;
} __packed;
struct memory_info {
diff --git a/src/include/rules.h b/src/include/rules.h
index ce968f0dd9..fcb827df90 100644
--- a/src/include/rules.h
+++ b/src/include/rules.h
@@ -257,9 +257,14 @@
#endif
+#if CONFIG(RAMPAYLOAD)
+/* ENV_PAYLOAD_LOADER is set to ENV_POSTCAR when CONFIG_RAMPAYLOAD is enabled */
+#define ENV_PAYLOAD_LOADER ENV_POSTCAR
+#else
/* ENV_PAYLOAD_LOADER is set when you are in a stage that loads the payload.
* For now, that is the ramstage. */
#define ENV_PAYLOAD_LOADER ENV_RAMSTAGE
+#endif
/**
* For pre-DRAM stages and post-CAR always build with simple device model, ie.
diff --git a/src/include/spi-generic.h b/src/include/spi-generic.h
index c24aadd926..d0f957f1f9 100644
--- a/src/include/spi-generic.h
+++ b/src/include/spi-generic.h
@@ -125,6 +125,7 @@ enum {
* setup: Setup given SPI device bus.
* xfer: Perform one SPI transfer operation.
* xfer_vector: Vector of SPI transfer operations.
+ * xfer_dual: (optional) Perform one SPI transfer in Dual SPI mode.
* max_xfer_size: Maximum transfer size supported by the controller
* (0 = invalid,
* SPI_CTRLR_DEFAULT_MAX_XFER_SIZE = unlimited)
@@ -145,6 +146,8 @@ struct spi_ctrlr {
size_t bytesout, void *din, size_t bytesin);
int (*xfer_vector)(const struct spi_slave *slave,
struct spi_op vectors[], size_t count);
+ int (*xfer_dual)(const struct spi_slave *slave, const void *dout,
+ size_t bytesout, void *din, size_t bytesin);
uint32_t max_xfer_size;
uint32_t flags;
int (*flash_probe)(const struct spi_slave *slave,
diff --git a/src/include/spi_flash.h b/src/include/spi_flash.h
index 936b0abe85..3a0c383676 100644
--- a/src/include/spi_flash.h
+++ b/src/include/spi_flash.h
@@ -90,6 +90,13 @@ struct spi_flash_ops {
struct spi_flash {
struct spi_slave spi;
u8 vendor;
+ union {
+ u8 raw;
+ struct {
+ u8 dual_spi : 1;
+ u8 _reserved : 7;
+ };
+ } flags;
u16 model;
const char *name;
u32 size;
diff --git a/src/include/stage_cache.h b/src/include/stage_cache.h
index 28cb85998b..192cfb9014 100644
--- a/src/include/stage_cache.h
+++ b/src/include/stage_cache.h
@@ -32,14 +32,21 @@ enum {
STAGE_S3_DATA,
};
+#if CONFIG(CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) \
+ || CONFIG(RELOCATABLE_RAMSTAGE)
/* Cache the loaded stage provided according to the parameters. */
void stage_cache_add(int stage_id, const struct prog *stage);
+/* Load the cached stage at given location returning the stage entry point. */
+void stage_cache_load_stage(int stage_id, struct prog *stage);
+#else /* CONFIG_NO_STAGE_CACHE */
+static inline void stage_cache_add(int stage_id, const struct prog *stage) {}
+static inline void stage_cache_load_stage(int stage_id, struct prog *stage) {}
+#endif
+
/* Cache non-specific data or code. */
void stage_cache_add_raw(int stage_id, const void *base, const size_t size);
/* Get a pointer to cached raw data and its size. */
void stage_cache_get_raw(int stage_id, void **base, size_t *size);
-/* Load the cached stage at given location returning the stage entry point. */
-void stage_cache_load_stage(int stage_id, struct prog *stage);
/* Fill in parameters for the external stage cache, if utilized. */
void stage_cache_external_region(void **base, size_t *size);
diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c
index a21663fc0f..81ec2ec3c4 100644
--- a/src/lib/prog_loaders.c
+++ b/src/lib/prog_loaders.c
@@ -74,11 +74,6 @@ fail:
halt();
}
-void __weak stage_cache_add(int stage_id,
- const struct prog *stage) {}
-void __weak stage_cache_load_stage(int stage_id,
- struct prog *stage) {}
-
static void ramstage_cache_invalid(void)
{
printk(BIOS_ERR, "ramstage cache invalid.\n");
@@ -155,8 +150,7 @@ void run_ramstage(void)
} else if (load_nonrelocatable_ramstage(&ramstage))
goto fail;
- if (!CONFIG(NO_STAGE_CACHE))
- stage_cache_add(STAGE_RAMSTAGE, &ramstage);
+ stage_cache_add(STAGE_RAMSTAGE, &ramstage);
timestamp_add_now(TS_END_COPYRAM);
diff --git a/src/mainboard/Kconfig b/src/mainboard/Kconfig
index 363df55da2..c88d31719e 100644
--- a/src/mainboard/Kconfig
+++ b/src/mainboard/Kconfig
@@ -24,6 +24,8 @@ config BOARD_ROMSIZE_KB_2048
bool
config BOARD_ROMSIZE_KB_4096
bool
+config BOARD_ROMSIZE_KB_6144
+ bool
config BOARD_ROMSIZE_KB_8192
bool
config BOARD_ROMSIZE_KB_10240
@@ -47,6 +49,7 @@ choice
default COREBOOT_ROMSIZE_KB_1024 if BOARD_ROMSIZE_KB_1024
default COREBOOT_ROMSIZE_KB_2048 if BOARD_ROMSIZE_KB_2048
default COREBOOT_ROMSIZE_KB_4096 if BOARD_ROMSIZE_KB_4096
+ default COREBOOT_ROMSIZE_KB_6144 if BOARD_ROMSIZE_KB_6144
default COREBOOT_ROMSIZE_KB_8192 if BOARD_ROMSIZE_KB_8192
default COREBOOT_ROMSIZE_KB_10240 if BOARD_ROMSIZE_KB_10240
default COREBOOT_ROMSIZE_KB_12288 if BOARD_ROMSIZE_KB_12288
@@ -94,6 +97,11 @@ config COREBOOT_ROMSIZE_KB_4096
help
Choose this option if you have a 4096 KB (4 MB) ROM chip.
+config COREBOOT_ROMSIZE_KB_6144
+ bool "6144 KB (6 MB)"
+ help
+ Choose this option if you have a 6144 KB (6 MB) ROM chip.
+
config COREBOOT_ROMSIZE_KB_8192
bool "8192 KB (8 MB)"
help
@@ -136,6 +144,7 @@ config COREBOOT_ROMSIZE_KB
default 1024 if COREBOOT_ROMSIZE_KB_1024
default 2048 if COREBOOT_ROMSIZE_KB_2048
default 4096 if COREBOOT_ROMSIZE_KB_4096
+ default 6144 if COREBOOT_ROMSIZE_KB_6144
default 8192 if COREBOOT_ROMSIZE_KB_8192
default 10240 if COREBOOT_ROMSIZE_KB_10240
default 12288 if COREBOOT_ROMSIZE_KB_12288
@@ -153,6 +162,7 @@ config ROM_SIZE
default 0x100000 if COREBOOT_ROMSIZE_KB_1024
default 0x200000 if COREBOOT_ROMSIZE_KB_2048
default 0x400000 if COREBOOT_ROMSIZE_KB_4096
+ default 0x600000 if COREBOOT_ROMSIZE_KB_6144
default 0x800000 if COREBOOT_ROMSIZE_KB_8192
default 0xa00000 if COREBOOT_ROMSIZE_KB_10240
default 0xc00000 if COREBOOT_ROMSIZE_KB_12288
diff --git a/src/mainboard/amd/gardenia/bootblock/bootblock.c b/src/mainboard/amd/gardenia/bootblock/bootblock.c
index 140bc07529..2f4be03ddf 100644
--- a/src/mainboard/amd/gardenia/bootblock/bootblock.c
+++ b/src/mainboard/amd/gardenia/bootblock/bootblock.c
@@ -23,5 +23,5 @@ void bootblock_mainboard_early_init(void)
size_t num_gpios;
const struct soc_amd_gpio *gpios;
gpios = early_gpio_table(&num_gpios);
- sb_program_gpios(gpios, num_gpios);
+ program_gpios(gpios, num_gpios);
}
diff --git a/src/mainboard/amd/gardenia/mainboard.c b/src/mainboard/amd/gardenia/mainboard.c
index b3f2285ef0..3a4090cf92 100644
--- a/src/mainboard/amd/gardenia/mainboard.c
+++ b/src/mainboard/amd/gardenia/mainboard.c
@@ -82,7 +82,7 @@ static void mainboard_init(void *chip_info)
size_t num_gpios;
const struct soc_amd_gpio *gpios;
gpios = gpio_table(&num_gpios);
- sb_program_gpios(gpios, num_gpios);
+ program_gpios(gpios, num_gpios);
}
/*************************************************
diff --git a/src/mainboard/apple/macbook21/devicetree.cb b/src/mainboard/apple/macbook21/devicetree.cb
index 9da3891a72..5ce28a27a9 100644
--- a/src/mainboard/apple/macbook21/devicetree.cb
+++ b/src/mainboard/apple/macbook21/devicetree.cb
@@ -64,7 +64,6 @@ chip northbridge/intel/i945
register "gpi1_routing" = "2"
register "gpi7_routing" = "2"
- register "sata_ahci" = "0x1"
register "sata_ports_implemented" = "0x04"
register "gpe0_en" = "0x11000006"
diff --git a/src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/devicetree.cb b/src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/devicetree.cb
index 156fe3fd64..acb8ac6702 100644
--- a/src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/devicetree.cb
+++ b/src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/devicetree.cb
@@ -51,7 +51,6 @@ chip northbridge/intel/x4x # Northbridge
register "gpi13_routing" = "2"
register "ide_enable_primary" = "0x1"
- register "sata_ahci" = "0x0" # AHCI not supported on this ICH7 variant
register "sata_ports_implemented" = "0x3"
register "gpe0_en" = "0x440"
diff --git a/src/mainboard/asrock/g41c-gs/variants/g41m-gs/devicetree.cb b/src/mainboard/asrock/g41c-gs/variants/g41m-gs/devicetree.cb
index ba2f00d1ec..f4d1dc4291 100644
--- a/src/mainboard/asrock/g41c-gs/variants/g41m-gs/devicetree.cb
+++ b/src/mainboard/asrock/g41c-gs/variants/g41m-gs/devicetree.cb
@@ -46,7 +46,6 @@ chip northbridge/intel/x4x # Northbridge
register "pirqh_routing" = "0x0b"
register "ide_enable_primary" = "0x1"
- register "sata_ahci" = "0x0" # AHCI not supported on this ICH7 variant
register "sata_ports_implemented" = "0x3"
register "gpe0_en" = "0x440"
diff --git a/src/mainboard/asrock/g41c-gs/variants/g41m-s3/devicetree.cb b/src/mainboard/asrock/g41c-gs/variants/g41m-s3/devicetree.cb
index 45a20142f4..2fd6e4f649 100644
--- a/src/mainboard/asrock/g41c-gs/variants/g41m-s3/devicetree.cb
+++ b/src/mainboard/asrock/g41c-gs/variants/g41m-s3/devicetree.cb
@@ -44,7 +44,6 @@ chip northbridge/intel/x4x # Northbridge
register "pirqh_routing" = "0x0b"
register "ide_enable_primary" = "0x1"
- register "sata_ahci" = "0x0" # AHCI not supported on this ICH7 variant
register "sata_ports_implemented" = "0x3"
register "gpe0_en" = "0x440"
diff --git a/src/mainboard/asrock/g41c-gs/variants/g41m-vs3-r2/devicetree.cb b/src/mainboard/asrock/g41c-gs/variants/g41m-vs3-r2/devicetree.cb
index b458115134..5479faf3e9 100644
--- a/src/mainboard/asrock/g41c-gs/variants/g41m-vs3-r2/devicetree.cb
+++ b/src/mainboard/asrock/g41c-gs/variants/g41m-vs3-r2/devicetree.cb
@@ -46,7 +46,6 @@ chip northbridge/intel/x4x # Northbridge
register "pirqh_routing" = "0x0b"
register "ide_enable_primary" = "0x1"
- register "sata_ahci" = "0x0" # AHCI not supported on this ICH7 variant
register "gpe0_en" = "0x440"
device pci 1b.0 on # Audio
diff --git a/src/mainboard/asus/p5gc-mx/devicetree.cb b/src/mainboard/asus/p5gc-mx/devicetree.cb
index 2f7d2781d7..de63da2a5d 100644
--- a/src/mainboard/asus/p5gc-mx/devicetree.cb
+++ b/src/mainboard/asus/p5gc-mx/devicetree.cb
@@ -53,7 +53,6 @@ chip northbridge/intel/i945
register "ide_legacy_combined" = "0x0"
register "ide_enable_primary" = "0x1"
register "ide_enable_secondary" = "0x0"
- register "sata_ahci" = "0x0"
register "p_cnt_throttling_supported" = "0"
diff --git a/src/mainboard/asus/p5qpl-am/devicetree.cb b/src/mainboard/asus/p5qpl-am/devicetree.cb
index 63ae8ce3c5..bc023d24c9 100644
--- a/src/mainboard/asus/p5qpl-am/devicetree.cb
+++ b/src/mainboard/asus/p5qpl-am/devicetree.cb
@@ -43,7 +43,6 @@ chip northbridge/intel/x4x # Northbridge
# 2 SCI (if corresponding GPIO_EN bit is also set)
register "ide_enable_primary" = "0x1"
- register "sata_ahci" = "0x0" # AHCI not supported on this ICH7 variant
register "gpe0_en" = "0x04000440"
device pci 1b.0 on end # Audio
diff --git a/src/mainboard/foxconn/d41s/devicetree.cb b/src/mainboard/foxconn/d41s/devicetree.cb
index 75df88e5c6..a611ee35c5 100644
--- a/src/mainboard/foxconn/d41s/devicetree.cb
+++ b/src/mainboard/foxconn/d41s/devicetree.cb
@@ -40,7 +40,6 @@ chip northbridge/intel/pineview # Northbridge
register "pirqf_routing" = "0x0b"
register "pirqg_routing" = "0x0b"
register "pirqh_routing" = "0x0b"
- register "sata_ahci" = "0x1"
register "sata_ports_implemented" = "0x3"
register "gpe0_en" = "0x441"
diff --git a/src/mainboard/foxconn/g41s-k/devicetree.cb b/src/mainboard/foxconn/g41s-k/devicetree.cb
index ca952ba7c6..b196e24961 100644
--- a/src/mainboard/foxconn/g41s-k/devicetree.cb
+++ b/src/mainboard/foxconn/g41s-k/devicetree.cb
@@ -47,7 +47,6 @@ chip northbridge/intel/x4x # Northbridge
register "ide_enable_primary" = "0x0"
register "ide_enable_secondary" = "0x0"
- register "sata_ahci" = "0x0" # AHCI does not work
register "sata_ports_implemented" = "0x3"
device pci 1b.0 on end # Audio
diff --git a/src/mainboard/getac/p470/devicetree.cb b/src/mainboard/getac/p470/devicetree.cb
index c0cad6a387..c99455322b 100644
--- a/src/mainboard/getac/p470/devicetree.cb
+++ b/src/mainboard/getac/p470/devicetree.cb
@@ -57,7 +57,6 @@ chip northbridge/intel/i945
register "ide_legacy_combined" = "0x1"
register "ide_enable_primary" = "0x1"
register "ide_enable_secondary" = "0x0"
- register "sata_ahci" = "0x0"
register "c3_latency" = "85"
register "docking_supported" = "1"
diff --git a/src/mainboard/gigabyte/ga-945gcm-s2l/devicetree.cb b/src/mainboard/gigabyte/ga-945gcm-s2l/devicetree.cb
index 7ed4d199aa..1c69613cbe 100644
--- a/src/mainboard/gigabyte/ga-945gcm-s2l/devicetree.cb
+++ b/src/mainboard/gigabyte/ga-945gcm-s2l/devicetree.cb
@@ -76,7 +76,6 @@ chip northbridge/intel/i945
register "ide_legacy_combined" = "0x0"
register "ide_enable_primary" = "0x1"
register "ide_enable_secondary" = "0x0"
- register "sata_ahci" = "0x0"
register "c3_latency" = "85"
register "p_cnt_throttling_supported" = "0"
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb b/src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb
index 8b47c4f21f..d24eb5d6ac 100644
--- a/src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb
@@ -48,7 +48,6 @@ chip northbridge/intel/x4x # Northbridge
register "ide_legacy_combined" = "0x0" # Combined mode broken
register "ide_enable_primary" = "0x1"
register "ide_enable_secondary" = "0x0"
- register "sata_ahci" = "0x0" # AHCI does not work
register "sata_ports_implemented" = "0x3"
register "gpe0_en" = "0x40"
diff --git a/src/mainboard/google/cyan/Makefile.inc b/src/mainboard/google/cyan/Makefile.inc
index 92b0422279..027c49cc8f 100644
--- a/src/mainboard/google/cyan/Makefile.inc
+++ b/src/mainboard/google/cyan/Makefile.inc
@@ -14,8 +14,9 @@
## GNU General Public License for more details.
##
+bootblock-$(CONFIG_ENABLE_BUILTIN_COM1) += com_init.c
+
romstage-$(CONFIG_CHROMEOS) += chromeos.c
-romstage-$(CONFIG_ENABLE_BUILTIN_COM1) += com_init.c
romstage-y += spd/spd.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
diff --git a/src/mainboard/google/cyan/com_init.c b/src/mainboard/google/cyan/com_init.c
index 44260bb1eb..b08dbce630 100644
--- a/src/mainboard/google/cyan/com_init.c
+++ b/src/mainboard/google/cyan/com_init.c
@@ -14,14 +14,14 @@
* GNU General Public License for more details.
*/
+#include
#include
#include
#include
#include
#include
-#include
-void car_mainboard_pre_console_init(void)
+void bootblock_mainboard_early_init(void)
{
uint32_t reg;
uint32_t *pad_config_reg;
diff --git a/src/mainboard/google/dragonegg/romstage_fsp_params.c b/src/mainboard/google/dragonegg/romstage_fsp_params.c
index f2c6851a3f..f1f5143ab5 100644
--- a/src/mainboard/google/dragonegg/romstage_fsp_params.c
+++ b/src/mainboard/google/dragonegg/romstage_fsp_params.c
@@ -13,9 +13,74 @@
* GNU General Public License for more details.
*/
+#include
#include
+#include
+#include
#include
+static uintptr_t mainboard_get_spd_data(void)
+{
+ char *spd_file;
+ size_t spd_file_len;
+ int spd_index;
+ const size_t spd_len = CONFIG_DIMM_SPD_SIZE;
+ const char *spd_bin = "spd.bin";
+
+ spd_index = variant_memory_sku();
+ assert(spd_index >= 0);
+ printk(BIOS_INFO, "SPD index %d\n", spd_index);
+
+ /* Load SPD data from CBFS */
+ spd_file = cbfs_boot_map_with_leak(spd_bin, CBFS_TYPE_SPD,
+ &spd_file_len);
+ if (!spd_file)
+ die("SPD data not found.");
+
+ /* make sure we have at least one SPD in the file. */
+ if (spd_file_len < spd_len)
+ die("Missing SPD data.");
+
+ /* Make sure we did not overrun the buffer */
+ if (spd_file_len < ((spd_index + 1) * spd_len))
+ die("Invalid SPD index.");
+
+ spd_index *= spd_len;
+
+ return (uintptr_t)(spd_file + spd_index);
+}
+
void mainboard_memory_init_params(FSPM_UPD *mupd)
{
+ FSP_M_CONFIG *mem_cfg = &mupd->FspmConfig;
+ struct lpddr4_config mem_params;
+
+ memset(&mem_params, 0, sizeof(mem_params));
+ variant_memory_params(&mem_params);
+
+ if (mem_params.dq_map && mem_params.dq_map_size)
+ memcpy(&mem_cfg->DqByteMapCh0, mem_params.dq_map,
+ mem_params.dq_map_size);
+
+ if (mem_params.dqs_map && mem_params.dqs_map_size)
+ memcpy(&mem_cfg->DqsMapCpu2DramCh0, mem_params.dqs_map,
+ mem_params.dqs_map_size);
+
+ memcpy(&mem_cfg->RcompResistor, mem_params.rcomp_resistor,
+ mem_params.rcomp_resistor_size);
+
+ memcpy(&mem_cfg->RcompTarget, mem_params.rcomp_target,
+ mem_params.rcomp_target_size);
+
+ mem_cfg->MemorySpdPtr00 = mainboard_get_spd_data();
+ mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00;
+ mem_cfg->MemorySpdDataLen = CONFIG_DIMM_SPD_SIZE;
+ mem_cfg->DqPinsInterleaved = 0;
+ mem_cfg->CaVrefConfig = 0x2;
+ mem_cfg->ECT = 1; /* Early Command Training Enabled */
+ mem_cfg->RefClk = 0; /* Auto Select CLK freq */
+ mem_cfg->SpdAddressTable[0] = 0x0;
+ mem_cfg->SpdAddressTable[1] = 0x0;
+ mem_cfg->SpdAddressTable[2] = 0x0;
+ mem_cfg->SpdAddressTable[3] = 0x0;
}
diff --git a/src/mainboard/google/dragonegg/variants/baseboard/devicetree.cb b/src/mainboard/google/dragonegg/variants/baseboard/devicetree.cb
index f820924280..b3b93f55ca 100644
--- a/src/mainboard/google/dragonegg/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/dragonegg/variants/baseboard/devicetree.cb
@@ -102,8 +102,8 @@ chip soc/intel/icelake
[PchSerialIoIndexI2C1] = PchSerialIoPci,
[PchSerialIoIndexI2C2] = PchSerialIoPci,
[PchSerialIoIndexI2C3] = PchSerialIoPci,
- [PchSerialIoIndexI2C4] = PchSerialIoDisabled,
- [PchSerialIoIndexI2C5] = PchSerialIoPci,
+ [PchSerialIoIndexI2C4] = PchSerialIoSkipInit,
+ [PchSerialIoIndexI2C5] = PchSerialIoDisabled,
}"
register "SerialIoGSpiMode" = "{
diff --git a/src/mainboard/google/eve/devicetree.cb b/src/mainboard/google/eve/devicetree.cb
index bffcf844e6..50f9114913 100644
--- a/src/mainboard/google/eve/devicetree.cb
+++ b/src/mainboard/google/eve/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "100"
+ register "gpu_pp_down_delay_ms" = "500"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "1000"
+
# Enable deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "1"
diff --git a/src/mainboard/google/fizz/variants/baseboard/devicetree.cb b/src/mainboard/google/fizz/variants/baseboard/devicetree.cb
index f1c846e596..c1afe3d439 100644
--- a/src/mainboard/google/fizz/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/fizz/variants/baseboard/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "200"
+ register "gpu_pp_down_delay_ms" = " 50"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "200"
+
# Deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "0"
diff --git a/src/mainboard/google/glados/variants/asuka/devicetree.cb b/src/mainboard/google/glados/variants/asuka/devicetree.cb
index 13dfa29bbd..cddb10d11a 100644
--- a/src/mainboard/google/glados/variants/asuka/devicetree.cb
+++ b/src/mainboard/google/glados/variants/asuka/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "200"
+ register "gpu_pp_down_delay_ms" = " 50"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "1000"
+
# Enable deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "0"
diff --git a/src/mainboard/google/glados/variants/caroline/devicetree.cb b/src/mainboard/google/glados/variants/caroline/devicetree.cb
index 1a67ccea7c..aabf179b93 100644
--- a/src/mainboard/google/glados/variants/caroline/devicetree.cb
+++ b/src/mainboard/google/glados/variants/caroline/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "200"
+ register "gpu_pp_down_delay_ms" = " 50"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "1000"
+
# Enable deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "0"
diff --git a/src/mainboard/google/glados/variants/cave/devicetree.cb b/src/mainboard/google/glados/variants/cave/devicetree.cb
index 9a2fc12fc0..993cab0cee 100644
--- a/src/mainboard/google/glados/variants/cave/devicetree.cb
+++ b/src/mainboard/google/glados/variants/cave/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "200"
+ register "gpu_pp_down_delay_ms" = " 50"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "1000"
+
# Enable deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "0"
diff --git a/src/mainboard/google/glados/variants/chell/devicetree.cb b/src/mainboard/google/glados/variants/chell/devicetree.cb
index de8641c421..a3797571ff 100644
--- a/src/mainboard/google/glados/variants/chell/devicetree.cb
+++ b/src/mainboard/google/glados/variants/chell/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "200"
+ register "gpu_pp_down_delay_ms" = " 50"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "1000"
+
# Enable deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "0"
diff --git a/src/mainboard/google/glados/variants/glados/devicetree.cb b/src/mainboard/google/glados/variants/glados/devicetree.cb
index 0d27a44ca2..1d9e6cdf1f 100644
--- a/src/mainboard/google/glados/variants/glados/devicetree.cb
+++ b/src/mainboard/google/glados/variants/glados/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "200"
+ register "gpu_pp_down_delay_ms" = " 50"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "1000"
+
# Enable deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "0"
diff --git a/src/mainboard/google/glados/variants/lars/devicetree.cb b/src/mainboard/google/glados/variants/lars/devicetree.cb
index 204ade23b0..b8871d196d 100644
--- a/src/mainboard/google/glados/variants/lars/devicetree.cb
+++ b/src/mainboard/google/glados/variants/lars/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "200"
+ register "gpu_pp_down_delay_ms" = " 50"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "1000"
+
# Enable deep Sx states
register "deep_s5_enable_ac" = "1"
register "deep_s5_enable_dc" = "1"
diff --git a/src/mainboard/google/glados/variants/sentry/devicetree.cb b/src/mainboard/google/glados/variants/sentry/devicetree.cb
index 89120a3d4e..7f52586e3d 100644
--- a/src/mainboard/google/glados/variants/sentry/devicetree.cb
+++ b/src/mainboard/google/glados/variants/sentry/devicetree.cb
@@ -1,5 +1,13 @@
chip soc/intel/skylake
+ register "gpu_pp_up_delay_ms" = "200"
+ register "gpu_pp_down_delay_ms" = " 50"
+ register "gpu_pp_cycle_delay_ms" = "500"
+ register "gpu_pp_backlight_on_delay_ms" = " 1"
+ register "gpu_pp_backlight_off_delay_ms" = "200"
+
+ register "gpu_pch_backlight_pwm_hz" = "1000"
+
# Enable deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "0"
diff --git a/src/mainboard/google/hatch/chromeos-16MiB.fmd b/src/mainboard/google/hatch/chromeos-16MiB.fmd
index 1594ab3a52..eb92bb0a01 100644
--- a/src/mainboard/google/hatch/chromeos-16MiB.fmd
+++ b/src/mainboard/google/hatch/chromeos-16MiB.fmd
@@ -4,17 +4,17 @@ FLASH@0xff000000 0x1000000 {
SI_ME@0x1000 0x3ff000
}
SI_BIOS@0x400000 0xc00000 {
- RW_SECTION_A@0x0 0x380000 {
+ RW_SECTION_A@0x0 0x368000 {
VBLOCK_A@0x0 0x10000
- FW_MAIN_A(CBFS)@0x10000 0x36ffc0
- RW_FWID_A@0x37ffc0 0x40
+ FW_MAIN_A(CBFS)@0x10000 0x357fc0
+ RW_FWID_A@0x367fc0 0x40
}
- RW_SECTION_B@0x380000 0x380000 {
+ RW_SECTION_B@0x368000 0x368000 {
VBLOCK_B@0x0 0x10000
- FW_MAIN_B(CBFS)@0x10000 0x36ffc0
- RW_FWID_B@0x37ffc0 0x40
+ FW_MAIN_B(CBFS)@0x10000 0x357fc0
+ RW_FWID_B@0x367fc0 0x40
}
- RW_MISC@0x700000 0x30000 {
+ RW_MISC@0x6D0000 0x30000 {
UNIFIED_MRC_CACHE@0x0 0x20000 {
RECOVERY_MRC_CACHE@0x0 0x10000
RW_MRC_CACHE@0x10000 0x10000
@@ -27,7 +27,8 @@ FLASH@0xff000000 0x1000000 {
RW_VPD(PRESERVE)@0x28000 0x2000
RW_NVRAM(PRESERVE)@0x2a000 0x6000
}
- RW_LEGACY(CBFS)@0x730000 0xd0000
+ # RW_LEGACY needs to be minimum of 1MB
+ RW_LEGACY(CBFS)@0x700000 0x100000
WP_RO@0x800000 0x400000 {
RO_VPD(PRESERVE)@0x0 0x4000
RO_SECTION@0x4000 0x3fc000 {
diff --git a/src/mainboard/google/hatch/spd/8G_3200.spd.hex b/src/mainboard/google/hatch/spd/8G_3200.spd.hex
new file mode 100644
index 0000000000..7388ad60f7
--- /dev/null
+++ b/src/mainboard/google/hatch/spd/8G_3200.spd.hex
@@ -0,0 +1,32 @@
+23 11 0C 03 45 21 00 08 00 60 00 03 02 03 00 00
+00 00 05 0D F8 FF 2B 00 6E 6E 6E 11 00 6E F0 0A
+20 08 00 05 00 F0 2B 34 28 00 78 00 14 3C 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 9C B5 00 00 00 00 E7 00 D0 19
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/src/mainboard/google/hatch/spd/LP_16G_2133.spd.hex b/src/mainboard/google/hatch/spd/LP_16G_2133.spd.hex
new file mode 100644
index 0000000000..04d640f0ae
--- /dev/null
+++ b/src/mainboard/google/hatch/spd/LP_16G_2133.spd.hex
@@ -0,0 +1,32 @@
+24 01 0F 0E 15 1A B4 08 00 00 00 0B 0A 03 00 00
+00 00 08 FF D4 01 00 00 78 00 90 A8 90 90 06 D0
+02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 08 7F C2 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/src/mainboard/google/hatch/variants/baseboard/devicetree.cb b/src/mainboard/google/hatch/variants/baseboard/devicetree.cb
index 1123d53734..112c279fcb 100644
--- a/src/mainboard/google/hatch/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/hatch/variants/baseboard/devicetree.cb
@@ -28,7 +28,7 @@ chip soc/intel/cannonlake
# Enable System Agent dynamic frequency
register "SaGv" = "SaGv_Enabled"
# Enable heci communication
- register "HeciEnabled" = "1"
+ register "HeciEnabled" = "0"
# Enable Speed Shift Technology support
register "speed_shift_enable" = "1"
# Enable S0ix
@@ -99,7 +99,9 @@ chip soc/intel/cannonlake
register "gpio_pm[COMM_1]" = "MISCCFG_ENABLE_GPIO_PM_CONFIG"
register "gpio_pm[COMM_2]" = "MISCCFG_ENABLE_GPIO_PM_CONFIG"
register "gpio_pm[COMM_3]" = "MISCCFG_ENABLE_GPIO_PM_CONFIG"
- register "gpio_pm[COMM_4]" = "MISCCFG_GPSIDEDPCGEN | MISCCFG_GPRTCDLCGEN | MISCCFG_GSXSLCGEN | MISCCFG_GPDPCGEN | MISCCFG_GPDLCGEN"
+ # Disable clock gating on this community so that cr50's short irq
+ # pulses won't be missed.
+ register "gpio_pm[COMM_4]" = "0"
device cpu_cluster 0 on
device lapic 0 on end
diff --git a/src/mainboard/google/kahlee/bootblock/bootblock.c b/src/mainboard/google/kahlee/bootblock/bootblock.c
index 038cfe22c2..e403684a41 100644
--- a/src/mainboard/google/kahlee/bootblock/bootblock.c
+++ b/src/mainboard/google/kahlee/bootblock/bootblock.c
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include
@@ -29,7 +30,7 @@ void bootblock_mainboard_early_init(void)
mainboard_ec_init();
gpios = variant_early_gpio_table(&num_gpios);
- sb_program_gpios(gpios, num_gpios);
+ program_gpios(gpios, num_gpios);
}
void bootblock_mainboard_init(void)
@@ -61,5 +62,5 @@ void bootblock_mainboard_init(void)
}
/* Setup TPM decode before verstage */
- sb_tpm_decode_spi();
+ lpc_tpm_decode_spi();
}
diff --git a/src/mainboard/google/kahlee/ec.c b/src/mainboard/google/kahlee/ec.c
index 7164591e11..1080902702 100644
--- a/src/mainboard/google/kahlee/ec.c
+++ b/src/mainboard/google/kahlee/ec.c
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
#include
#include
@@ -49,7 +50,7 @@ static void early_ec_init(void)
printk(BIOS_DEBUG,
"LPC Setup google_chromeec_ioport_range: %04x, %08zx\n",
ec_ioport_base, ec_ioport_size);
- status = sb_set_wideio_range(ec_ioport_base, ec_ioport_size);
+ status = lpc_set_wideio_range(ec_ioport_base, ec_ioport_size);
if (status == WIDEIO_RANGE_ERROR)
printk(BIOS_WARNING, "ERROR: Failed to assign a range\n");
else
diff --git a/src/mainboard/google/kahlee/mainboard.c b/src/mainboard/google/kahlee/mainboard.c
index cfd5637633..f218f3f31b 100644
--- a/src/mainboard/google/kahlee/mainboard.c
+++ b/src/mainboard/google/kahlee/mainboard.c
@@ -27,6 +27,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -126,7 +127,7 @@ static void mainboard_init(void *chip_info)
mainboard_ec_init();
gpios = variant_gpio_table(&num_gpios);
- sb_program_gpios(gpios, num_gpios);
+ program_gpios(gpios, num_gpios);
/*
* Some platforms use SCI not generated by a GPIO pin (event above 23).
diff --git a/src/mainboard/google/kahlee/romstage.c b/src/mainboard/google/kahlee/romstage.c
index 32f8356521..8bc766e112 100644
--- a/src/mainboard/google/kahlee/romstage.c
+++ b/src/mainboard/google/kahlee/romstage.c
@@ -34,7 +34,7 @@ void mainboard_romstage_entry(int s3_resume)
const struct soc_amd_gpio *gpios;
gpios = variant_romstage_gpio_table(&num_gpios);
- sb_program_gpios(gpios, num_gpios);
+ program_gpios(gpios, num_gpios);
variant_romstage_entry(s3_resume);
}
diff --git a/src/mainboard/google/kahlee/variants/aleena/devicetree.cb b/src/mainboard/google/kahlee/variants/aleena/devicetree.cb
index c55bb8bdb4..3dc2c2aabc 100644
--- a/src/mainboard/google/kahlee/variants/aleena/devicetree.cb
+++ b/src/mainboard/google/kahlee/variants/aleena/devicetree.cb
@@ -19,7 +19,7 @@ chip soc/amd/stoneyridge
}"
register "dram_clear_on_reset" = "DRAM_CONTENTS_KEEP"
register "uma_mode" = "UMAMODE_SPECIFIED_SIZE"
- register "uma_size" = "32 * MiB"
+ register "uma_size" = "16 * MiB"
register "stapm_percent" = "80"
register "stapm_time_ms" = "2500000"
register "stapm_power_mw" = "7800"
diff --git a/src/mainboard/google/kahlee/variants/careena/devicetree.cb b/src/mainboard/google/kahlee/variants/careena/devicetree.cb
index 5124e41dab..635b23735c 100644
--- a/src/mainboard/google/kahlee/variants/careena/devicetree.cb
+++ b/src/mainboard/google/kahlee/variants/careena/devicetree.cb
@@ -19,7 +19,7 @@ chip soc/amd/stoneyridge
}"
register "dram_clear_on_reset" = "DRAM_CONTENTS_KEEP"
register "uma_mode" = "UMAMODE_SPECIFIED_SIZE"
- register "uma_size" = "32 * MiB"
+ register "uma_size" = "16 * MiB"
register "stapm_percent" = "68"
register "stapm_time_ms" = "2500000"
register "stapm_power_mw" = "7800"
diff --git a/src/mainboard/google/kahlee/variants/grunt/devicetree.cb b/src/mainboard/google/kahlee/variants/grunt/devicetree.cb
index b37e1bf0ac..d73c47c6b8 100644
--- a/src/mainboard/google/kahlee/variants/grunt/devicetree.cb
+++ b/src/mainboard/google/kahlee/variants/grunt/devicetree.cb
@@ -19,7 +19,7 @@ chip soc/amd/stoneyridge
}"
register "dram_clear_on_reset" = "DRAM_CONTENTS_KEEP"
register "uma_mode" = "UMAMODE_SPECIFIED_SIZE"
- register "uma_size" = "32 * MiB"
+ register "uma_size" = "16 * MiB"
register "stapm_percent" = "80"
register "stapm_time_ms" = "2500000"
register "stapm_power_mw" = "7800"
diff --git a/src/mainboard/google/kahlee/variants/liara/devicetree.cb b/src/mainboard/google/kahlee/variants/liara/devicetree.cb
index a929c46704..30028275c8 100644
--- a/src/mainboard/google/kahlee/variants/liara/devicetree.cb
+++ b/src/mainboard/google/kahlee/variants/liara/devicetree.cb
@@ -19,7 +19,7 @@ chip soc/amd/stoneyridge
}"
register "dram_clear_on_reset" = "DRAM_CONTENTS_KEEP"
register "uma_mode" = "UMAMODE_SPECIFIED_SIZE"
- register "uma_size" = "32 * MiB"
+ register "uma_size" = "16 * MiB"
register "lvds_poseq_varybl_to_blon" = "0x5" # in 4ms
register "lvds_poseq_blon_to_varybl" = "0x5" # in 4ms
diff --git a/src/mainboard/google/mistral/chromeos.fmd b/src/mainboard/google/mistral/chromeos.fmd
index 633df2ee42..76cdd50d91 100644
--- a/src/mainboard/google/mistral/chromeos.fmd
+++ b/src/mainboard/google/mistral/chromeos.fmd
@@ -22,7 +22,7 @@ FLASH@0x0 8M {
GBB 0x2f00
RO_FRID 0x100
}
- RO_VPD 128K
+ RO_VPD(PRESERVE) 128K
RO_DDR_TRAINING(PRESERVE) 8K
}
diff --git a/src/mainboard/google/octopus/Kconfig b/src/mainboard/google/octopus/Kconfig
index 48753ed4b1..8ca9251cfc 100644
--- a/src/mainboard/google/octopus/Kconfig
+++ b/src/mainboard/google/octopus/Kconfig
@@ -121,26 +121,18 @@ config TPM_TIS_ACPI_INTERRUPT
int
default 63 # GPE0_DW1_31 (GPIO_63)
-config DRAM_PART_NUM_IN_CBI
+config DRAM_PART_NUM_NOT_ALWAYS_IN_CBI
bool
- default y if BOARD_GOOGLE_PHASER
- default y if BOARD_GOOGLE_MEEP
- default y if BOARD_GOOGLE_AMPTON
- default y if BOARD_GOOGLE_FLEEX
default y if BOARD_GOOGLE_BOBBA
- default y if BOARD_GOOGLE_CASTA
- default y if BOARD_GOOGLE_BLOOG
-
-config DRAM_PART_NUM_ALWAYS_IN_CBI
- bool
- depends on DRAM_PART_NUM_IN_CBI
- default y if BOARD_GOOGLE_AMPTON
- default y if BOARD_GOOGLE_CASTA
- default y if BOARD_GOOGLE_BLOOG
+ default y if BOARD_GOOGLE_FLEEX
+ default y if BOARD_GOOGLE_MEEP
+ default y if BOARD_GOOGLE_OCTOPUS
+ default y if BOARD_GOOGLE_PHASER
+ default y if BOARD_GOOGLE_YORP
config DRAM_PART_IN_CBI_BOARD_ID_MIN
int
- depends on DRAM_PART_NUM_IN_CBI && !DRAM_PART_NUM_ALWAYS_IN_CBI
+ depends on DRAM_PART_NUM_NOT_ALWAYS_IN_CBI
default 255 if BOARD_GOOGLE_YORP
default 2 if BOARD_GOOGLE_PHASER
default 2 if BOARD_GOOGLE_FLEEX
diff --git a/src/mainboard/google/octopus/romstage.c b/src/mainboard/google/octopus/romstage.c
index ff0354dc10..d878d0d33f 100644
--- a/src/mainboard/google/octopus/romstage.c
+++ b/src/mainboard/google/octopus/romstage.c
@@ -37,12 +37,7 @@ void mainboard_save_dimm_info(void)
char part_num_store[DIMM_INFO_PART_NUMBER_SIZE];
const char *part_num = NULL;
- if (!CONFIG(DRAM_PART_NUM_IN_CBI)) {
- save_dimm_info_by_sku_config();
- return;
- }
-
- if (!CONFIG(DRAM_PART_NUM_ALWAYS_IN_CBI)) {
+ if (CONFIG(DRAM_PART_NUM_NOT_ALWAYS_IN_CBI)) {
/* Fall back on part numbers encoded in lp4cfg array. */
if ((int)board_id() < CONFIG_DRAM_PART_IN_CBI_BOARD_ID_MIN) {
save_dimm_info_by_sku_config();
diff --git a/src/mainboard/google/octopus/variants/baseboard/memory.c b/src/mainboard/google/octopus/variants/baseboard/memory.c
index fc7c87dcb2..604295b283 100644
--- a/src/mainboard/google/octopus/variants/baseboard/memory.c
+++ b/src/mainboard/google/octopus/variants/baseboard/memory.c
@@ -205,10 +205,7 @@ static const struct lpddr4_cfg cbi_lp4cfg = {
const struct lpddr4_cfg *__weak variant_lpddr4_config(void)
{
- if (!CONFIG(DRAM_PART_NUM_IN_CBI))
- return &non_cbi_lp4cfg;
-
- if (!CONFIG(DRAM_PART_NUM_ALWAYS_IN_CBI)) {
+ if (CONFIG(DRAM_PART_NUM_NOT_ALWAYS_IN_CBI)) {
/* Fall back non cbi memory config. */
if ((int)board_id() < CONFIG_DRAM_PART_IN_CBI_BOARD_ID_MIN)
return &non_cbi_lp4cfg;
diff --git a/src/mainboard/google/poppy/variants/atlas/devicetree.cb b/src/mainboard/google/poppy/variants/atlas/devicetree.cb
index 1ea28a0e5f..7fcb3b8b3e 100644
--- a/src/mainboard/google/poppy/variants/atlas/devicetree.cb
+++ b/src/mainboard/google/poppy/variants/atlas/devicetree.cb
@@ -155,20 +155,6 @@ chip soc/intel/skylake
register "PcieRpAdvancedErrorReporting[0]" = "1"
register "PcieRpLtrEnable[0]" = "1"
- # PCIe Root port 5 (NVMe)
- # PcieRpEnable: Enable root port
- # PcieRpClkReqSupport: Enable CLKREQ#
- # PcieRpClkReqNumber: Uses SRCCLKREQ4#
- # PcieRpClkSrcNumber: Uses CLKOUT_PCIE_4
- # PcieRpAdvancedErrorReporting: Enable Advanced Error Reporting
- # PcieRpLtrEnable: Enable Latency Tolerance Reporting Mechanism
- register "PcieRpEnable[4]" = "1"
- register "PcieRpClkReqSupport[4]" = "1"
- register "PcieRpClkReqNumber[4]" = "4"
- register "PcieRpClkSrcNumber[4]" = "4"
- register "PcieRpAdvancedErrorReporting[4]" = "1"
- register "PcieRpLtrEnable[4]" = "1"
-
# USB 2.0
register "usb2_ports[0]" = "USB2_PORT_LONG(OC0)" # Type-C Port 1
register "usb2_ports[1]" = "USB2_PORT_EMPTY" # Empty
@@ -374,7 +360,7 @@ chip soc/intel/skylake
device pci 1c.1 off end # PCI Express Port 2
device pci 1c.2 off end # PCI Express Port 3
device pci 1c.3 off end # PCI Express Port 4
- device pci 1c.4 on end # PCI Express Port 5 (NVMe)
+ device pci 1c.4 off end # PCI Express Port 5
device pci 1c.5 off end # PCI Express Port 6
device pci 1c.6 off end # PCI Express Port 7
device pci 1c.7 off end # PCI Express Port 8
diff --git a/src/mainboard/google/poppy/variants/atlas/gpio.c b/src/mainboard/google/poppy/variants/atlas/gpio.c
index 372c66a5a0..5cc1a4fc5d 100644
--- a/src/mainboard/google/poppy/variants/atlas/gpio.c
+++ b/src/mainboard/google/poppy/variants/atlas/gpio.c
@@ -78,8 +78,8 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_NC(GPP_B7),
/* B8 : SRCCLKREQ3# ==> WLAN_PE_RST */
PAD_CFG_GPO(GPP_B8, 0, RSMRST),
- /* B9 : SRCCLKREQ4# ==> NVME_PCIE_CLKREQ_L */
- PAD_CFG_NF(GPP_B9, NONE, DEEP, NF1),
+ /* B9 : SRCCLKREQ4# ==> NC */
+ PAD_CFG_NC(GPP_B9),
/* B10 : SRCCLKREQ5# ==> NC */
PAD_CFG_NC(GPP_B10),
/* B11 : EXT_PWR_GATE# ==> NC */
diff --git a/src/mainboard/google/poppy/variants/nami/mainboard.c b/src/mainboard/google/poppy/variants/nami/mainboard.c
index 23870175b7..adb8c00579 100644
--- a/src/mainboard/google/poppy/variants/nami/mainboard.c
+++ b/src/mainboard/google/poppy/variants/nami/mainboard.c
@@ -215,7 +215,6 @@ const char *mainboard_vbt_filename(void)
return "vbt-bard.bin";
default:
return "vbt.bin";
- break;
}
}
diff --git a/src/mainboard/google/sarien/variants/arcada/devicetree.cb b/src/mainboard/google/sarien/variants/arcada/devicetree.cb
index 767df1f795..ce960a74c0 100644
--- a/src/mainboard/google/sarien/variants/arcada/devicetree.cb
+++ b/src/mainboard/google/sarien/variants/arcada/devicetree.cb
@@ -15,7 +15,7 @@ chip soc/intel/cannonlake
# FSP configuration
register "SaGv" = "SaGv_Enabled"
- register "HeciEnabled" = "1"
+ register "HeciEnabled" = "0"
register "SataSalpSupport" = "1"
register "SataMode" = "Sata_AHCI"
register "SataPortsEnable[2]" = "1"
diff --git a/src/mainboard/google/sarien/variants/arcada/include/variant/acpi/dptf.asl b/src/mainboard/google/sarien/variants/arcada/include/variant/acpi/dptf.asl
index 4d380713e2..73e1decc1b 100644
--- a/src/mainboard/google/sarien/variants/arcada/include/variant/acpi/dptf.asl
+++ b/src/mainboard/google/sarien/variants/arcada/include/variant/acpi/dptf.asl
@@ -13,26 +13,26 @@
* GNU General Public License for more details.
*/
-#define DPTF_CPU_PASSIVE 90
-#define DPTF_CPU_CRITICAL 105
+#define DPTF_CPU_PASSIVE 98
+#define DPTF_CPU_CRITICAL 108
/* Skin Sensor for CPU VR temperature monitor */
#define DPTF_TSR0_SENSOR_ID 1
#define DPTF_TSR0_SENSOR_NAME "Skin"
-#define DPTF_TSR0_PASSIVE 60
-#define DPTF_TSR0_CRITICAL 105
+#define DPTF_TSR0_PASSIVE 55
+#define DPTF_TSR0_CRITICAL 100
/* Memory Sensor for DDR temperature monitor */
#define DPTF_TSR1_SENSOR_ID 2
#define DPTF_TSR1_SENSOR_NAME "DDR"
-#define DPTF_TSR1_PASSIVE 70
-#define DPTF_TSR1_CRITICAL 95
+#define DPTF_TSR1_PASSIVE 53
+#define DPTF_TSR1_CRITICAL 100
/* M.2 Sensor for Ambient temperature monitor */
#define DPTF_TSR2_SENSOR_ID 3
#define DPTF_TSR2_SENSOR_NAME "Ambient"
-#define DPTF_TSR2_PASSIVE 37
-#define DPTF_TSR2_CRITICAL 80
+#define DPTF_TSR2_PASSIVE 38
+#define DPTF_TSR2_CRITICAL 93
#undef DPTF_ENABLE_FAN_CONTROL
#undef DPTF_ENABLE_CHARGER
@@ -42,10 +42,10 @@ Name (DTRT, Package () {
Package () { \_SB.PCI0.TCPU, \_SB.PCI0.TCPU, 500, 100, 0, 0, 0, 0 },
/* CPU Throttle Effect on Skin (TSR0) */
- Package () { \_SB.PCI0.TCPU, \_SB.DPTF.TSR0, 500, 30, 0, 0, 0, 0 },
+ Package () { \_SB.PCI0.TCPU, \_SB.DPTF.TSR0, 400, 40, 0, 0, 0, 0 },
/* CPU Throttle Effect on DDR (TSR1) */
- Package () { \_SB.PCI0.TCPU, \_SB.DPTF.TSR1, 100, 50, 2, 0, 0, 0 },
+ Package () { \_SB.PCI0.TCPU, \_SB.DPTF.TSR1, 300, 50, 2, 0, 0, 0 },
/* CPU Throttle Effect on Ambient (TSR2) */
Package () { \_SB.PCI0.TCPU, \_SB.DPTF.TSR2, 1000, 100, 1, 0, 0, 0 },
diff --git a/src/mainboard/google/sarien/variants/sarien/devicetree.cb b/src/mainboard/google/sarien/variants/sarien/devicetree.cb
index c96423c93d..739a849715 100644
--- a/src/mainboard/google/sarien/variants/sarien/devicetree.cb
+++ b/src/mainboard/google/sarien/variants/sarien/devicetree.cb
@@ -15,7 +15,7 @@ chip soc/intel/cannonlake
# FSP configuration
register "SaGv" = "SaGv_Enabled"
- register "HeciEnabled" = "1"
+ register "HeciEnabled" = "0"
register "SataSalpSupport" = "1"
register "SataMode" = "Sata_AHCI"
register "SataPortsEnable[0]" = "1"
diff --git a/src/mainboard/hp/z220_sff_workstation/Kconfig b/src/mainboard/hp/z220_sff_workstation/Kconfig
new file mode 100644
index 0000000000..4598de2040
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/Kconfig
@@ -0,0 +1,60 @@
+if BOARD_HP_COMPAQ_8200_ELITE_SFF_PC
+
+config BOARD_SPECIFIC_OPTIONS
+ def_bool y
+ select BOARD_ROMSIZE_KB_16384
+ select HAVE_ACPI_RESUME
+ select HAVE_ACPI_TABLES
+ select INTEL_INT15
+ select NORTHBRIDGE_INTEL_SANDYBRIDGE
+ select SERIRQ_CONTINUOUS_MODE
+ select SOUTHBRIDGE_INTEL_BD82X6X
+ select USE_NATIVE_RAMINIT
+ select MAINBOARD_HAS_LPC_TPM
+ select MAINBOARD_HAS_TPM1
+ select HAVE_OPTION_TABLE
+ select HAVE_CMOS_DEFAULT
+ select SUPERIO_NUVOTON_NPCD378
+ select MAINBOARD_HAS_LIBGFXINIT
+ select INTEL_GMA_HAVE_VBT
+
+config VBOOT
+ select VBOOT_VBNV_CMOS
+ select VBOOT_NO_BOARD_SUPPORT
+ select GBB_FLAG_DISABLE_LID_SHUTDOWN
+ select GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC
+ select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC
+ select GBB_FLAG_DISABLE_FWMP
+
+config VBOOT_VBNV_OFFSET
+ hex
+ default 0x2a
+
+config MAINBOARD_DIR
+ string
+ default hp/z220_sff_workstation
+
+config MAINBOARD_PART_NUMBER
+ string
+ default "HP Z220 SFF Workstation"
+
+config VGA_BIOS_FILE
+ string
+ default "pci8086,0102.rom"
+
+config VGA_BIOS_ID
+ string
+ default "8086,0102"
+
+config DRAM_RESET_GATE_GPIO
+ int
+ default 60
+
+config MAX_CPUS
+ int
+ default 8
+
+config USBDEBUG_HCD_INDEX
+ int
+ default 2
+endif
diff --git a/src/mainboard/hp/z220_sff_workstation/Kconfig.name b/src/mainboard/hp/z220_sff_workstation/Kconfig.name
new file mode 100644
index 0000000000..b6cfda6e9a
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/Kconfig.name
@@ -0,0 +1,2 @@
+config BOARD_HP_COMPAQ_8200_ELITE_SFF_PC
+ bool "Z220 SFF Workstation"
diff --git a/src/mainboard/hp/z220_sff_workstation/Makefile.inc b/src/mainboard/hp/z220_sff_workstation/Makefile.inc
new file mode 100644
index 0000000000..ebe01aea99
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/Makefile.inc
@@ -0,0 +1,2 @@
+romstage-y += gpio.c
+ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/hp/z220_sff_workstation/acpi/ec.asl b/src/mainboard/hp/z220_sff_workstation/acpi/ec.asl
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/soc/amd/common/block/acpi/halt.c b/src/mainboard/hp/z220_sff_workstation/acpi/platform.asl
similarity index 51%
rename from src/soc/amd/common/block/acpi/halt.c
rename to src/mainboard/hp/z220_sff_workstation/acpi/platform.asl
index 200b3c12f5..02a1b54b87 100644
--- a/src/soc/amd/common/block/acpi/halt.c
+++ b/src/mainboard/hp/z220_sff_workstation/acpi/platform.asl
@@ -1,7 +1,7 @@
/*
* This file is part of the coreboot project.
*
- * Copyright (C) 2018 Google Inc.
+ * Copyright (C) 2018 Patrick Rudolph
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -13,21 +13,14 @@
* GNU General Public License for more details.
*/
-#include
-#include
-#include
-#include
-
-void poweroff(void)
+Method(_WAK, 1, NotSerialized)
{
- acpi_write32(MMIO_ACPI_PM1_CNT_BLK,
- (SLP_TYP_S5 << SLP_TYP_SHIFT) | SLP_EN);
+ \_SB.PCI0.LPCB.SIO0.SIOW (Arg0)
- /*
- * Setting SLP_TYP_S5 in PM1 triggers SLP_SMI, which is handled by SMM
- * to transition to S5 state. If halt is called in SMM, then it prevents
- * the SMI handler from being triggered and system never enters S5.
- */
- if (!ENV_SMM)
- halt();
+ Return(Package(){0,0})
+}
+
+Method(_PTS, 1, NotSerialized)
+{
+ \_SB.PCI0.LPCB.SIO0.SIOS (Arg0)
}
diff --git a/src/mainboard/hp/z220_sff_workstation/acpi/superio.asl b/src/mainboard/hp/z220_sff_workstation/acpi/superio.asl
new file mode 100644
index 0000000000..630c5e8033
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/acpi/superio.asl
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018 Patrick Rudolph
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+
+#undef SUPERIO_DEV
+#undef SUPERIO_PNP_BASE
+#define SUPERIO_DEV SIO0
+#define SUPERIO_PNP_BASE 0x2e
+
+#define SUPERIO_SHOW_SP2
+#define SUPERIO_SHOW_KBC
+
+#include
+
+Scope (\_GPE)
+{
+ Method (_L08, 0, NotSerialized)
+ {
+ \_SB.PCI0.LPCB.SIO0.SIOH ()
+ }
+
+ Method (_L0D, 0, NotSerialized)
+ {
+ Notify (\_SB.PCI0.EHC1, 0x02)
+ Notify (\_SB.PCI0.EHC2, 0x02)
+ //FIXME: Add GBE device
+ //Notify (\_SB.PCI0.GBE, 0x02)
+ }
+
+ Method (_L09, 0, NotSerialized)
+ {
+ Notify (\_SB.PCI0.RP01, 0x02)
+ Notify (\_SB.PCI0.RP02, 0x02)
+ Notify (\_SB.PCI0.RP03, 0x02)
+ Notify (\_SB.PCI0.RP04, 0x02)
+ Notify (\_SB.PCI0.RP05, 0x02)
+ Notify (\_SB.PCI0.RP06, 0x02)
+ Notify (\_SB.PCI0.RP07, 0x02)
+ Notify (\_SB.PCI0.RP08, 0x02)
+ Notify (\_SB.PCI0.PEGP, 0x02)
+ }
+}
diff --git a/src/mainboard/hp/z220_sff_workstation/acpi_tables.c b/src/mainboard/hp/z220_sff_workstation/acpi_tables.c
new file mode 100644
index 0000000000..084e7e5a5f
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/acpi_tables.c
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008-2009 coresystems GmbH
+ * Copyright (C) 2014 Vladimir Serbinenko
+ * Copyright (C) 2018 Patrick Rudolph
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+
+void acpi_create_gnvs(global_nvs_t *gnvs)
+{
+ /* Disable USB ports in S3 by default */
+ gnvs->s3u0 = 0;
+ gnvs->s3u1 = 0;
+
+ /* Disable USB ports in S5 by default */
+ gnvs->s5u0 = 0;
+ gnvs->s5u1 = 0;
+
+ gnvs->tcrt = 100;
+ gnvs->tpsv = 90;
+}
diff --git a/src/mainboard/hp/z220_sff_workstation/board_info.txt b/src/mainboard/hp/z220_sff_workstation/board_info.txt
new file mode 100644
index 0000000000..4d6f6f98b7
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/board_info.txt
@@ -0,0 +1,7 @@
+Category: desktop
+Board URL: https://support.hp.com/de-de/product/HP-Compaq-8200-Elite-Small-Form-Factor-PC/5037931
+ROM IC: MX25L6405
+ROM package: SOIC-8
+ROM socketed: no
+Flashrom support: yes
+Release year: 2013
diff --git a/src/mainboard/hp/z220_sff_workstation/cmos.default b/src/mainboard/hp/z220_sff_workstation/cmos.default
new file mode 100644
index 0000000000..6d27a79c66
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/cmos.default
@@ -0,0 +1,7 @@
+boot_option=Fallback
+debug_level=Debug
+power_on_after_fail=Enable
+nmi=Enable
+sata_mode=AHCI
+gfx_uma_size=32M
+psu_fan_lvl=3
diff --git a/src/mainboard/hp/z220_sff_workstation/cmos.layout b/src/mainboard/hp/z220_sff_workstation/cmos.layout
new file mode 100644
index 0000000000..6602afad2d
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/cmos.layout
@@ -0,0 +1,116 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2007-2008 coresystems GmbH
+## Copyright (C) 2014 Vladimir Serbinenko
+## Copyright (C) 2018 Patrick Rudolph
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+
+# -----------------------------------------------------------------
+entries
+
+# -----------------------------------------------------------------
+# Status Register A
+# -----------------------------------------------------------------
+# Status Register B
+# -----------------------------------------------------------------
+# Status Register C
+#96 4 r 0 status_c_rsvd
+#100 1 r 0 uf_flag
+#101 1 r 0 af_flag
+#102 1 r 0 pf_flag
+#103 1 r 0 irqf_flag
+# -----------------------------------------------------------------
+# Status Register D
+#104 7 r 0 status_d_rsvd
+#111 1 r 0 valid_cmos_ram
+# -----------------------------------------------------------------
+# Diagnostic Status Register
+#112 8 r 0 diag_rsvd1
+
+# -----------------------------------------------------------------
+0 120 r 0 reserved_memory
+#120 264 r 0 unused
+
+# -----------------------------------------------------------------
+# RTC_BOOT_BYTE (coreboot hardcoded)
+384 1 e 4 boot_option
+388 4 h 0 reboot_counter
+#390 2 r 0 unused?
+
+# -----------------------------------------------------------------
+# coreboot config options: console
+#392 3 r 0 unused
+395 4 e 6 debug_level
+#399 1 r 0 unused
+400 3 h 0 psu_fan_lvl
+#403 5 r 0 unused
+
+# coreboot config options: southbridge
+408 1 e 1 nmi
+409 2 e 7 power_on_after_fail
+
+#411 10 r 0 unused
+421 1 e 9 sata_mode
+#422 10 r 0 unused
+
+# coreboot config options: northbridge
+432 3 e 11 gfx_uma_size
+#435 549 r 0 unused
+
+448 128 r 0 vbnv
+
+# SandyBridge MRC Scrambler Seed values
+896 32 r 0 mrc_scrambler_seed
+928 32 r 0 mrc_scrambler_seed_s3
+960 16 r 0 mrc_scrambler_seed_chk
+
+# coreboot config options: check sums
+984 16 h 0 check_sum
+
+# -----------------------------------------------------------------
+
+enumerations
+
+#ID value text
+1 0 Disable
+1 1 Enable
+2 0 Enable
+2 1 Disable
+4 0 Fallback
+4 1 Normal
+6 0 Emergency
+6 1 Alert
+6 2 Critical
+6 3 Error
+6 4 Warning
+6 5 Notice
+6 6 Info
+6 7 Debug
+6 8 Spew
+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 415 984
diff --git a/src/mainboard/hp/z220_sff_workstation/data.vbt b/src/mainboard/hp/z220_sff_workstation/data.vbt
new file mode 100644
index 0000000000..c1fd6d1e13
Binary files /dev/null and b/src/mainboard/hp/z220_sff_workstation/data.vbt differ
diff --git a/src/mainboard/hp/z220_sff_workstation/devicetree.cb b/src/mainboard/hp/z220_sff_workstation/devicetree.cb
new file mode 100644
index 0000000000..68e7c63767
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/devicetree.cb
@@ -0,0 +1,225 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2018 Patrick Rudolph
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; version 2 of
+## the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+
+chip northbridge/intel/sandybridge
+ register "gfx.did" = "{ 0x80000100, 0x80000240, 0x80000410 }"
+ register "gfx.link_frequency_270_mhz" = "0"
+ register "gfx.ndid" = "3"
+ register "gfx.use_spread_spectrum_clock" = "0"
+ register "gpu_dp_b_hotplug" = "0"
+ register "gpu_dp_c_hotplug" = "0"
+ register "gpu_dp_d_hotplug" = "0"
+
+ device cpu_cluster 0x0 on
+ chip cpu/intel/model_206ax
+ register "c1_acpower" = "1"
+ register "c1_battery" = "1"
+ register "c2_acpower" = "3"
+ register "c2_battery" = "3"
+ register "c3_acpower" = "5"
+ register "c3_battery" = "5"
+ device lapic 0x0 on end
+ device lapic 0xacac off end
+ end
+ end
+
+ register "pci_mmio_size" = "2048"
+
+ device domain 0x0 on
+ chip southbridge/intel/bd82x6x # Intel Series 7 PCH
+ register "c2_latency" = "0x0065"
+ register "docking_supported" = "0"
+ register "gen1_dec" = "0x00fc0601"
+ register "gen2_dec" = "0x00fc0801"
+ register "p_cnt_throttling_supported" = "1"
+ register "pcie_hotplug_map" = "{ 0, 0, 0, 0, 0, 0, 0, 0 }"
+ register "pcie_port_coalesce" = "1"
+ register "sata_interface_speed_support" = "0x3"
+ register "sata_port_map" = "0xf"
+ register "spi_lvscc" = "0x2005"
+ register "spi_uvscc" = "0x2005"
+ device pci 14.0 on # xHCI
+ subsystemid 0x103c 0x1791
+ end
+ device pci 16.0 on # Management Engine Interface 1
+ subsystemid 0x103c 0x1791
+ end
+ device pci 16.1 off # Management Engine Interface 2
+ end
+ device pci 16.2 off # Management Engine IDE-R
+ end
+ device pci 16.3 on # Management Engine KT
+ subsystemid 0x103c 0x1791
+ end
+ device pci 19.0 on # Intel Gigabit Ethernet
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1a.0 on # USB2 EHCI #2
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1b.0 on # High Definition Audio Audio controller
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1c.0 on # PCIe Port #1
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1c.1 off # PCIe Port #2
+ end
+ device pci 1c.2 off # PCIe Port #3
+ end
+ device pci 1c.3 off # PCIe Port #4
+ end
+ device pci 1c.4 on # PCIe Port #5
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1c.5 off # PCIe Port #6
+ end
+ device pci 1c.6 on # PCIe Port #7
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1c.7 on # PCIe Port #8
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1d.0 on # USB2 EHCI #1
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1e.0 on # PCI bridge
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1f.0 on # LPC bridge PCI-LPC bridge
+ subsystemid 0x103c 0x1791
+ chip superio/nuvoton/npcd378
+ device pnp 2e.0 off end # Floppy
+ device pnp 2e.1 on # Parallel port
+ # global
+
+ # serialice: Vendor writes:
+ irq 0x14 = 0x9c
+ irq 0x1c = 0xa8
+ irq 0x1d = 0x08
+ irq 0x22 = 0x3f
+ irq 0x1a = 0xb0
+ # dumped from superiotool:
+ irq 0x1b = 0x1e
+ irq 0x27 = 0x08
+ irq 0x2a = 0x20
+ irq 0x2d = 0x01
+ # parallel port
+ io 0x60 = 0x378
+ irq 0x70 = 0x07
+ drq 0x74 = 0x01
+ end
+ device pnp 2e.2 off # COM1
+ io 0x60 = 0x2f8
+ irq 0x70 = 3
+ end
+ device pnp 2e.3 on # COM2, IR
+ io 0x60 = 0x3f8
+ irq 0x70 = 4
+ end
+ device pnp 2e.4 on # LED control
+ io 0x60 = 0x600
+ # IOBASE[0h] = bit0 LED red / green
+ # IOBASE[0h] = bit1-4 LED PWM duty cycle
+ # IOBASE[1h] = bit6 SWCC
+
+ io 0x62 = 0x610
+ # IOBASE [0h] = GPES
+ # IOBASE [1h] = GPEE
+ # IOBASE [4h:7h] = 32bit upcounter at 1Mhz
+ # IOBASE [8h:bh] = GPS
+ # IOBASE [ch:fh] = GPE
+ end
+ device pnp 2e.5 on # Mouse
+ irq 0x70 = 0xc
+ end
+ device pnp 2e.6 on # Keyboard
+ io 0x60 = 0x0060
+ io 0x62 = 0x0064
+ irq 0x70 = 0x01
+ # serialice: Vendor writes:
+ drq 0xf0 = 0x40
+ end
+ device pnp 2e.7 on # WDT ?
+ io 0x60 = 0x620
+ end
+ device pnp 2e.8 on # HWM
+ io 0x60 = 0x800
+ # IOBASE[0h:feh] HWM page
+ # IOBASE[ffh] bit0-bit3 page selector
+
+ drq 0xf0 = 0x20
+ drq 0xf1 = 0x01
+ drq 0xf2 = 0x40
+ drq 0xf3 = 0x01
+
+ drq 0xf4 = 0x66
+ drq 0xf5 = 0x67
+ drq 0xf6 = 0x66
+ drq 0xf7 = 0x01
+ end
+ device pnp 2e.f on # GPIO OD ?
+ drq 0xf1 = 0x97
+ drq 0xf2 = 0x01
+ drq 0xf5 = 0x08
+ drq 0xfe = 0x80
+ end
+ device pnp 2e.15 on # BUS ?
+ io 0x60 = 0x0680
+ io 0x62 = 0x0690
+ end
+ device pnp 2e.1c on # Suspend Control ?
+ io 0x60 = 0x640
+ # writing to IOBASE[5h]
+ # 0x0: Power off
+ # 0x9: Power off and bricked until CMOS battery removed
+ end
+ device pnp 2e.1e on # GPIO ?
+ io 0x60 = 0x660
+ drq 0xf4 = 0x01
+ # skip the following, as it
+ # looks like remapped registers
+ #drq 0xf5 = 0x06
+ #drq 0xf6 = 0x60
+ #drq 0xfe = 0x03
+ end
+ end
+ chip drivers/pc80/tpm
+ device pnp 4e.0 on end # TPM module
+ end
+ end
+ device pci 1f.2 on # SATA Controller 1
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1f.3 on # SMBus
+ subsystemid 0x103c 0x1791
+ end
+ device pci 1f.5 off # SATA Controller 2
+ end
+ device pci 1f.6 off # Thermal
+ end
+ end
+ device pci 00.0 on # Host bridge Host bridge
+ subsystemid 0x103c 0x1791
+ end
+ device pci 01.0 on # PCIe Bridge for discrete graphics
+ subsystemid 0x103c 0x1791
+ end
+ device pci 02.0 on # Internal graphics VGA controller
+ subsystemid 0x103c 0x1791
+ end
+ end
+end
diff --git a/src/mainboard/hp/z220_sff_workstation/dsdt.asl b/src/mainboard/hp/z220_sff_workstation/dsdt.asl
new file mode 100644
index 0000000000..ef67ee7477
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/dsdt.asl
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018 Patrick Rudolph
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB
+#define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB
+#define ACPI_VIDEO_DEVICE \_SB.PCI0.GFX0
+#include
+DefinitionBlock(
+ "dsdt.aml",
+ "DSDT",
+ 0x02, // DSDT revision: ACPI v2.0 and up
+ OEM_ID,
+ ACPI_TABLE_CREATOR,
+ 0x20141018 // OEM revision
+)
+{
+ // Some generic macros
+ #include "acpi/platform.asl"
+ #include
+ #include
+ /* global NVS and variables. */
+ #include
+ #include
+
+ Scope (\_SB) {
+ Device (PCI0)
+ {
+ #include
+ #include
+ #include
+ }
+ }
+}
diff --git a/src/mainboard/hp/z220_sff_workstation/gma-mainboard.ads b/src/mainboard/hp/z220_sff_workstation/gma-mainboard.ads
new file mode 100644
index 0000000000..6d5680d6a9
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/gma-mainboard.ads
@@ -0,0 +1,29 @@
+--
+-- Copyright (C) 2018 Patrick Rudolph
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+
+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
+
+ ports : constant Port_List :=
+ (DP2,
+ HDMI2,
+ Analog,
+ others => Disabled);
+
+end GMA.Mainboard;
diff --git a/src/mainboard/hp/z220_sff_workstation/gpio.c b/src/mainboard/hp/z220_sff_workstation/gpio.c
new file mode 100644
index 0000000000..397f08b955
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/gpio.c
@@ -0,0 +1,206 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008-2009 coresystems GmbH
+ * Copyright (C) 2014 Vladimir Serbinenko
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+
+static const struct pch_gpio_set1 pch_gpio_set1_mode = {
+ .gpio0 = GPIO_MODE_GPIO,
+ .gpio1 = GPIO_MODE_GPIO,
+ .gpio2 = GPIO_MODE_NATIVE,
+ .gpio3 = GPIO_MODE_NATIVE,
+ .gpio4 = GPIO_MODE_NATIVE,
+ .gpio5 = GPIO_MODE_NATIVE,
+ .gpio6 = GPIO_MODE_GPIO,
+ .gpio7 = GPIO_MODE_GPIO,
+ .gpio8 = GPIO_MODE_GPIO,
+ .gpio9 = GPIO_MODE_NATIVE,
+ .gpio10 = GPIO_MODE_NATIVE,
+ .gpio11 = GPIO_MODE_NATIVE,
+ .gpio12 = GPIO_MODE_NATIVE,
+ .gpio13 = GPIO_MODE_GPIO,
+ .gpio14 = GPIO_MODE_NATIVE,
+ .gpio15 = GPIO_MODE_GPIO,
+ .gpio16 = GPIO_MODE_GPIO,
+ .gpio17 = GPIO_MODE_GPIO,
+ .gpio18 = GPIO_MODE_NATIVE,
+ .gpio19 = GPIO_MODE_NATIVE,
+ .gpio20 = GPIO_MODE_NATIVE,
+ .gpio21 = GPIO_MODE_GPIO,
+ .gpio22 = GPIO_MODE_GPIO,
+ .gpio23 = GPIO_MODE_NATIVE,
+ .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_NATIVE,
+ .gpio31 = GPIO_MODE_GPIO,
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_direction = {
+ .gpio0 = GPIO_DIR_INPUT,
+ .gpio1 = GPIO_DIR_INPUT,
+ .gpio6 = GPIO_DIR_INPUT,
+ .gpio7 = GPIO_DIR_INPUT,
+ .gpio8 = GPIO_DIR_INPUT,
+ .gpio13 = GPIO_DIR_INPUT,
+ .gpio15 = GPIO_DIR_OUTPUT,
+ .gpio16 = GPIO_DIR_INPUT,
+ .gpio17 = GPIO_DIR_OUTPUT,
+ .gpio21 = GPIO_DIR_INPUT,
+ .gpio22 = GPIO_DIR_INPUT,
+ .gpio24 = GPIO_DIR_INPUT,
+ .gpio27 = GPIO_DIR_INPUT,
+ .gpio28 = GPIO_DIR_OUTPUT,
+ .gpio29 = GPIO_DIR_OUTPUT,
+ .gpio31 = GPIO_DIR_INPUT,
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_level = {
+ .gpio15 = GPIO_LEVEL_LOW,
+ .gpio17 = GPIO_LEVEL_LOW,
+ .gpio28 = GPIO_LEVEL_LOW,
+ .gpio29 = GPIO_LEVEL_HIGH,
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_reset = {
+};
+
+static const struct pch_gpio_set1 pch_gpio_set1_invert = {
+ .gpio0 = GPIO_INVERT,
+ .gpio1 = GPIO_INVERT,
+ .gpio6 = GPIO_INVERT,
+ .gpio7 = 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_NATIVE,
+ .gpio43 = GPIO_MODE_GPIO,
+ .gpio44 = GPIO_MODE_NATIVE,
+ .gpio45 = GPIO_MODE_NATIVE,
+ .gpio46 = GPIO_MODE_GPIO,
+ .gpio47 = GPIO_MODE_NATIVE,
+ .gpio48 = GPIO_MODE_GPIO,
+ .gpio49 = GPIO_MODE_GPIO,
+ .gpio50 = GPIO_MODE_NATIVE,
+ .gpio51 = GPIO_MODE_NATIVE,
+ .gpio52 = GPIO_MODE_NATIVE,
+ .gpio53 = GPIO_MODE_NATIVE,
+ .gpio54 = GPIO_MODE_GPIO,
+ .gpio55 = GPIO_MODE_GPIO,
+ .gpio56 = GPIO_MODE_NATIVE,
+ .gpio57 = GPIO_MODE_GPIO,
+ .gpio58 = GPIO_MODE_NATIVE,
+ .gpio59 = GPIO_MODE_NATIVE,
+ .gpio60 = GPIO_MODE_NATIVE,
+ .gpio61 = GPIO_MODE_GPIO,
+ .gpio62 = GPIO_MODE_NATIVE,
+ .gpio63 = GPIO_MODE_NATIVE,
+};
+
+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,
+ .gpio43 = GPIO_DIR_INPUT,
+ .gpio46 = GPIO_DIR_INPUT,
+ .gpio48 = GPIO_DIR_INPUT,
+ .gpio49 = GPIO_DIR_INPUT,
+ .gpio54 = GPIO_DIR_INPUT,
+ .gpio55 = GPIO_DIR_INPUT,
+ .gpio57 = GPIO_DIR_INPUT,
+ .gpio61 = GPIO_DIR_INPUT,
+};
+
+static const struct pch_gpio_set2 pch_gpio_set2_level = {
+};
+
+static const struct pch_gpio_set2 pch_gpio_set2_reset = {
+};
+
+static const struct pch_gpio_set3 pch_gpio_set3_mode = {
+ .gpio64 = GPIO_MODE_NATIVE,
+ .gpio65 = GPIO_MODE_NATIVE,
+ .gpio66 = GPIO_MODE_NATIVE,
+ .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_NATIVE,
+ .gpio75 = GPIO_MODE_NATIVE,
+};
+
+static const struct pch_gpio_set3 pch_gpio_set3_direction = {
+ .gpio68 = GPIO_DIR_INPUT,
+ .gpio69 = GPIO_DIR_INPUT,
+ .gpio70 = GPIO_DIR_INPUT,
+ .gpio71 = GPIO_DIR_OUTPUT,
+ .gpio72 = GPIO_DIR_INPUT,
+};
+
+static const struct pch_gpio_set3 pch_gpio_set3_level = {
+ .gpio71 = GPIO_LEVEL_LOW,
+};
+
+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/hp/z220_sff_workstation/hda_verb.c b/src/mainboard/hp/z220_sff_workstation/hda_verb.c
new file mode 100644
index 0000000000..91804c187b
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/hda_verb.c
@@ -0,0 +1,76 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008-2009 coresystems GmbH
+ * Copyright (C) 2014 Vladimir Serbinenko
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+
+const u32 cim_verb_data[] = {
+ 0x10ec0221, /* Codec Vendor / Device ID: Realtek */
+ 0x103c1791, /* Subsystem ID */
+
+ 0x0000000b, /* Number of 4 dword sets */
+ /* NID 0x01: Subsystem ID. */
+ AZALIA_SUBVENDOR(0x0, 0x103c1791),
+
+ /* NID 0x12. */
+ AZALIA_PIN_CFG(0x0, 0x12, 0x403c0000),
+
+ /* NID 0x14. */
+ AZALIA_PIN_CFG(0x0, 0x14, 0x01014020),
+
+ /* NID 0x17. */
+ AZALIA_PIN_CFG(0x0, 0x17, 0x90170110),
+
+ /* NID 0x18. */
+ AZALIA_PIN_CFG(0x0, 0x18, 0x411111f0),
+
+ /* NID 0x19. */
+ AZALIA_PIN_CFG(0x0, 0x19, 0x411111f0),
+
+ /* NID 0x1a. */
+ AZALIA_PIN_CFG(0x0, 0x1a, 0x02a11030),
+
+ /* NID 0x1b. */
+ AZALIA_PIN_CFG(0x0, 0x1b, 0x0181303f),
+
+ /* NID 0x1d. */
+ AZALIA_PIN_CFG(0x0, 0x1d, 0x40400001),
+
+ /* NID 0x1e. */
+ AZALIA_PIN_CFG(0x0, 0x1e, 0x411111f0),
+
+ /* NID 0x21. */
+ AZALIA_PIN_CFG(0x0, 0x21, 0x0221102f),
+ 0x80862806, /* Codec Vendor / Device ID: Intel */
+ 0x103c1791, /* Subsystem ID */
+
+ 0x00000004, /* Number of 4 dword sets */
+ /* NID 0x01: Subsystem ID. */
+ AZALIA_SUBVENDOR(0x3, 0x103c1791),
+
+ /* NID 0x05. */
+ AZALIA_PIN_CFG(0x3, 0x05, 0x58560010),
+
+ /* NID 0x06. */
+ AZALIA_PIN_CFG(0x3, 0x06, 0x18560020),
+
+ /* NID 0x07. */
+ AZALIA_PIN_CFG(0x3, 0x07, 0x58560030),
+};
+
+const u32 pc_beep_verbs[0] = {};
+
+AZALIA_ARRAY_SIZES;
diff --git a/src/mainboard/hp/z220_sff_workstation/mainboard.c b/src/mainboard/hp/z220_sff_workstation/mainboard.c
new file mode 100644
index 0000000000..2d6499f9dd
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/mainboard.c
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Vladimir Serbinenko
+ * Copyright (C) 2018 Patrick Rudolph
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include
+#include
+#include
+#include
+
+#if CONFIG(GENERATE_SMBIOS_TABLES)
+static int mainboard_smbios_data(struct device *dev, int *handle,
+ unsigned long *current)
+{
+ int len = 0;
+
+ // add IPMI Device Information
+ len += smbios_write_type38(
+ current, handle,
+ SMBIOS_BMC_INTERFACE_KCS,
+ 0x20, // IPMI Version
+ 0x20, // I2C address
+ 0xff, // no NV storage
+ 0, // IO port interface address
+ 0,
+ 0); // no IRQ
+
+ return len;
+}
+#endif
+
+static void mainboard_enable(struct device *dev)
+{
+ install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_NONE,
+ GMA_INT15_PANEL_FIT_DEFAULT,
+ GMA_INT15_BOOT_DISPLAY_DEFAULT, 0);
+#if CONFIG(GENERATE_SMBIOS_TABLES)
+ dev->ops->get_smbios_data = mainboard_smbios_data;
+#endif
+}
+
+struct chip_operations mainboard_ops = {
+ .enable_dev = mainboard_enable,
+};
diff --git a/src/mainboard/hp/z220_sff_workstation/romstage.c b/src/mainboard/hp/z220_sff_workstation/romstage.c
new file mode 100644
index 0000000000..0804dd0c7a
--- /dev/null
+++ b/src/mainboard/hp/z220_sff_workstation/romstage.c
@@ -0,0 +1,85 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008-2009 coresystems GmbH
+ * Copyright (C) 2014 Vladimir Serbinenko
+ * Copyright (C) 2018 Patrick Rudolph
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define SERIAL_DEV PNP_DEV(0x2e, NPCD378_SP2)
+
+void pch_enable_lpc(void)
+{
+ /*
+ * Enable SuperIO, TPM, Keyboard, LPT, COMA
+ * (COMB can be equip on expansion header)
+ */
+ pci_write_config16(PCH_LPC_DEV, LPC_EN,
+ CNF2_LPC_EN | CNF1_LPC_EN | KBC_LPC_EN | LPT_LPC_EN |
+ COMB_LPC_EN | COMA_LPC_EN);
+
+ /* COMA: 3F8h, COMB: 2F8h */
+ pci_write_config16(PCH_LPC_DEV, LPC_IO_DEC, 0x0010);
+}
+
+void mainboard_rcba_config(void)
+{
+}
+
+const struct southbridge_usb_port mainboard_usb_ports[] = {
+ { 1, 0, 0 },
+ { 1, 0, 0 },
+ { 1, 0, 0 },
+ { 1, 0, 0 },
+ { 1, 0, 3 },
+ { 1, 0, 3 },
+ { 1, 0, 3 },
+ { 1, 0, 3 },
+ { 1, 1, 5 },
+ { 1, 0, 5 },
+ { 1, 0, 5 },
+ { 1, 0, 5 },
+ { 1, 0, 7 },
+ { 1, 0, 7 },
+};
+
+void mainboard_early_init(int s3resume)
+{
+}
+
+void mainboard_config_superio(void)
+{
+ if (CONFIG(CONSOLE_SERIAL))
+ nuvoton_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
+}
+
+void mainboard_get_spd(spd_raw_data *spd, bool id_only)
+{
+ /* BTX mainboard: Reversed mapping */
+ read_spd(&spd[3], 0x50, id_only);
+ read_spd(&spd[2], 0x51, id_only);
+ read_spd(&spd[1], 0x52, id_only);
+ read_spd(&spd[0], 0x53, id_only);
+}
diff --git a/src/mainboard/ibase/mb899/devicetree.cb b/src/mainboard/ibase/mb899/devicetree.cb
index f81a68b711..0c5962fea0 100644
--- a/src/mainboard/ibase/mb899/devicetree.cb
+++ b/src/mainboard/ibase/mb899/devicetree.cb
@@ -36,7 +36,6 @@ chip northbridge/intel/i945
register "ide_legacy_combined" = "0x0"
register "ide_enable_primary" = "0x1"
register "ide_enable_secondary" = "0x0"
- register "sata_ahci" = "0x1"
register "c3_latency" = "85"
register "p_cnt_throttling_supported" = "0"
diff --git a/src/mainboard/intel/d510mo/devicetree.cb b/src/mainboard/intel/d510mo/devicetree.cb
index a00861043e..825611ef22 100644
--- a/src/mainboard/intel/d510mo/devicetree.cb
+++ b/src/mainboard/intel/d510mo/devicetree.cb
@@ -38,7 +38,6 @@ chip northbridge/intel/pineview # Northbridge
register "pirqf_routing" = "0x0b"
register "pirqg_routing" = "0x0b"
register "pirqh_routing" = "0x0b"
- register "sata_ahci" = "0x1"
register "sata_ports_implemented" = "0x3"
register "gpe0_en" = "0x20000040"
diff --git a/src/mainboard/intel/d945gclf/devicetree.cb b/src/mainboard/intel/d945gclf/devicetree.cb
index 716654c6eb..573b9c80ed 100644
--- a/src/mainboard/intel/d945gclf/devicetree.cb
+++ b/src/mainboard/intel/d945gclf/devicetree.cb
@@ -50,7 +50,6 @@ chip northbridge/intel/i945
register "ide_legacy_combined" = "0x0"
register "ide_enable_primary" = "0x1"
register "ide_enable_secondary" = "0x0"
- register "sata_ahci" = "0x0"
register "c3_latency" = "85"
register "p_cnt_throttling_supported" = "0"
diff --git a/src/mainboard/intel/dg41wv/devicetree.cb b/src/mainboard/intel/dg41wv/devicetree.cb
index be28763a00..295fbc4f38 100644
--- a/src/mainboard/intel/dg41wv/devicetree.cb
+++ b/src/mainboard/intel/dg41wv/devicetree.cb
@@ -63,7 +63,6 @@ chip northbridge/intel/x4x # Northbridge
register "gpi15_routing" = "2"
register "ide_enable_primary" = "0x1"
- register "sata_ahci" = "0x0" # AHCI not supported on this ICH7 variant
register "gpe0_en" = "0x440"
device pci 1b.0 on # Audio
diff --git a/src/mainboard/intel/icelake_rvp/romstage_fsp_params.c b/src/mainboard/intel/icelake_rvp/romstage_fsp_params.c
index b9ce3941f4..fd1638bfab 100644
--- a/src/mainboard/intel/icelake_rvp/romstage_fsp_params.c
+++ b/src/mainboard/intel/icelake_rvp/romstage_fsp_params.c
@@ -14,12 +14,55 @@
*/
#include
+#include
#include
#include
#include
-
+#include "board_id.h"
#include "spd/spd.h"
void mainboard_memory_init_params(FSPM_UPD *mupd)
{
+ FSP_M_CONFIG *mem_cfg = &mupd->FspmConfig;
+ u8 spd_index = (get_board_id() & 0x1F) & 0x7;
+ printk(BIOS_DEBUG, "spd index is 0x%x\n", spd_index);
+
+ if (spd_index > 0 && spd_index != 2) {
+ struct region_device spd_rdev;
+
+ if (get_spd_cbfs_rdev(&spd_rdev, spd_index) < 0)
+ die("spd.bin not found\n");
+
+ mem_cfg->MemorySpdDataLen = region_device_sz(&spd_rdev);
+
+ /* Memory leak is ok since we have memory mapped boot media */
+ mem_cfg->MemorySpdPtr00 = (uintptr_t)rdev_mmap_full(&spd_rdev);
+ mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00;
+
+ mem_cfg->SpdAddressTable[0] = 0x0;
+ mem_cfg->SpdAddressTable[1] = 0x0;
+ mem_cfg->SpdAddressTable[2] = 0x0;
+ mem_cfg->SpdAddressTable[3] = 0x0;
+ } else {
+ mem_cfg->MemorySpdPtr00 = 0;
+ mem_cfg->MemorySpdPtr01 = 0;
+ mem_cfg->MemorySpdPtr10 = 0;
+ mem_cfg->MemorySpdPtr11 = 0;
+
+ mem_cfg->SpdAddressTable[0] = 0xA0;
+ mem_cfg->SpdAddressTable[1] = 0xA2;
+ mem_cfg->SpdAddressTable[2] = 0xA4;
+ mem_cfg->SpdAddressTable[3] = 0xA6;
+ }
+ mem_cfg->DqPinsInterleaved = 0;
+ mem_cfg->CaVrefConfig = 0x2; /* VREF_CA->CHA/CHB */
+ mem_cfg->ECT = 1; /* Early Command Training Enabled */
+ mem_cfg->RefClk = 0; /* Auto Select CLK freq */
+
+ mainboard_fill_dq_map_ch0(&mem_cfg->DqByteMapCh0);
+ mainboard_fill_dq_map_ch1(&mem_cfg->DqByteMapCh1);
+ mainboard_fill_dqs_map_ch0(&mem_cfg->DqsMapCpu2DramCh0);
+ mainboard_fill_dqs_map_ch1(&mem_cfg->DqsMapCpu2DramCh1);
+ mainboard_fill_rcomp_res_data(&mem_cfg->RcompResistor);
+ mainboard_fill_rcomp_strength_data(&mem_cfg->RcompTarget);
}
diff --git a/src/mainboard/intel/strago/Makefile.inc b/src/mainboard/intel/strago/Makefile.inc
index bbef8b956e..e6f0c9e652 100644
--- a/src/mainboard/intel/strago/Makefile.inc
+++ b/src/mainboard/intel/strago/Makefile.inc
@@ -14,8 +14,9 @@
## GNU General Public License for more details.
##
+bootblock-$(CONFIG_ENABLE_BUILTIN_COM1) += com_init.c
+
romstage-$(CONFIG_MAINBOARD_HAS_CHROMEOS) += chromeos.c
-romstage-$(CONFIG_ENABLE_BUILTIN_COM1) += com_init.c
ramstage-$(CONFIG_MAINBOARD_HAS_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_MAINBOARD_HAS_CHROMEOS) += ec.c
diff --git a/src/mainboard/intel/strago/com_init.c b/src/mainboard/intel/strago/com_init.c
index b89d65566e..695ea9806b 100644
--- a/src/mainboard/intel/strago/com_init.c
+++ b/src/mainboard/intel/strago/com_init.c
@@ -14,12 +14,12 @@
* GNU General Public License for more details.
*/
+#include
#include
#include
#include
#include
#include
-#include
/*
* return family number and internal pad number in that community
@@ -30,7 +30,7 @@
/* family number in high byte and inner pad number in lowest byte */
-void car_mainboard_pre_console_init(void)
+void bootblock_mainboard_early_init(void)
{
uint32_t reg;
uint32_t *pad_config_reg;
diff --git a/src/mainboard/kontron/986lcd-m/devicetree.cb b/src/mainboard/kontron/986lcd-m/devicetree.cb
index 5e00109ebb..cd7929c31a 100644
--- a/src/mainboard/kontron/986lcd-m/devicetree.cb
+++ b/src/mainboard/kontron/986lcd-m/devicetree.cb
@@ -36,7 +36,6 @@ chip northbridge/intel/i945
register "ide_legacy_combined" = "0x1"
register "ide_enable_primary" = "0x1"
register "ide_enable_secondary" = "0x1"
- register "sata_ahci" = "0x0"
register "c3_latency" = "85"
register "p_cnt_throttling_supported" = "0"
diff --git a/src/mainboard/lenovo/t400/Kconfig b/src/mainboard/lenovo/t400/Kconfig
index 2bd67c28bc..2caf1d3b65 100644
--- a/src/mainboard/lenovo/t400/Kconfig
+++ b/src/mainboard/lenovo/t400/Kconfig
@@ -62,10 +62,6 @@ config CBFS_SIZE
hex
default 0x200000
-config ONBOARD_VGA_IS_PRIMARY
- bool
- default y
-
config INTEL_GMA_VBT_FILE
default "src/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/data.vbt"
diff --git a/src/mainboard/lenovo/t420/Kconfig b/src/mainboard/lenovo/t420/Kconfig
index 02bcc4f4a4..5148604a68 100644
--- a/src/mainboard/lenovo/t420/Kconfig
+++ b/src/mainboard/lenovo/t420/Kconfig
@@ -75,8 +75,4 @@ config VGA_BIOS_ID
string
default "8086,0126"
-config ONBOARD_VGA_IS_PRIMARY
- bool
- default y
-
endif # BOARD_LENOVO_T420
diff --git a/src/mainboard/lenovo/t420s/Kconfig b/src/mainboard/lenovo/t420s/Kconfig
index 60735b049d..190f35e4b5 100644
--- a/src/mainboard/lenovo/t420s/Kconfig
+++ b/src/mainboard/lenovo/t420s/Kconfig
@@ -74,8 +74,4 @@ config VGA_BIOS_ID
string
default "8086,0126"
-config ONBOARD_VGA_IS_PRIMARY
- bool
- default y
-
endif # BOARD_LENOVO_T420S
diff --git a/src/mainboard/lenovo/t520/Kconfig b/src/mainboard/lenovo/t520/Kconfig
index e847f8e39d..d4934d6685 100644
--- a/src/mainboard/lenovo/t520/Kconfig
+++ b/src/mainboard/lenovo/t520/Kconfig
@@ -84,8 +84,4 @@ config VGA_BIOS_FILE
string
default "pci8086,0126.rom"
-config ONBOARD_VGA_IS_PRIMARY
- bool
- default y
-
endif
diff --git a/src/mainboard/lenovo/t530/Kconfig b/src/mainboard/lenovo/t530/Kconfig
index 5b5b7ffa49..5fd9118e94 100644
--- a/src/mainboard/lenovo/t530/Kconfig
+++ b/src/mainboard/lenovo/t530/Kconfig
@@ -62,8 +62,4 @@ config VGA_BIOS_FILE
default "pci8086,0106.rom" if BOARD_LENOVO_T530
default "pci8086,0166.rom" if BOARD_LENOVO_W530
-config ONBOARD_VGA_IS_PRIMARY
- bool
- default y
-
endif
diff --git a/src/mainboard/lenovo/t60/devicetree.cb b/src/mainboard/lenovo/t60/devicetree.cb
index b4c8fb8b4f..28e0574188 100644
--- a/src/mainboard/lenovo/t60/devicetree.cb
+++ b/src/mainboard/lenovo/t60/devicetree.cb
@@ -72,7 +72,6 @@ chip northbridge/intel/i945
register "gpi12_routing" = "2"
register "gpi8_routing" = "2"
- register "sata_ahci" = "0x1"
register "sata_ports_implemented" = "0x01"
register "gpe0_en" = "0x11000006"
diff --git a/src/mainboard/lenovo/thinkcentre_a58/devicetree.cb b/src/mainboard/lenovo/thinkcentre_a58/devicetree.cb
index cc3ef49f25..ace2bfbff2 100644
--- a/src/mainboard/lenovo/thinkcentre_a58/devicetree.cb
+++ b/src/mainboard/lenovo/thinkcentre_a58/devicetree.cb
@@ -44,7 +44,6 @@ chip northbridge/intel/x4x # Northbridge
register "gpi13_routing" = "1" # ??vendor
register "ide_enable_primary" = "0x1"
- register "sata_ahci" = "0x0" # AHCI not supported on this ICH7 variant
register "gpe0_en" = "0x440"
device pci 1b.0 on end # Audio
diff --git a/src/mainboard/lenovo/x60/devicetree.cb b/src/mainboard/lenovo/x60/devicetree.cb
index 87cfa849ee..b3d87ccb4b 100644
--- a/src/mainboard/lenovo/x60/devicetree.cb
+++ b/src/mainboard/lenovo/x60/devicetree.cb
@@ -65,7 +65,6 @@ chip northbridge/intel/i945
register "gpi12_routing" = "1"
register "gpi8_routing" = "2"
- register "sata_ahci" = "0x1"
register "sata_ports_implemented" = "0x01"
register "gpe0_en" = "0x11000006"
diff --git a/src/mainboard/lenovo/z61t/devicetree.cb b/src/mainboard/lenovo/z61t/devicetree.cb
index 8519b31035..d35c62b09c 100644
--- a/src/mainboard/lenovo/z61t/devicetree.cb
+++ b/src/mainboard/lenovo/z61t/devicetree.cb
@@ -71,7 +71,6 @@ chip northbridge/intel/i945
register "gpi12_routing" = "2"
register "gpi8_routing" = "2"
- register "sata_ahci" = "0x1"
register "sata_ports_implemented" = "0x01"
register "gpe0_en" = "0x11000006"
diff --git a/src/mainboard/roda/rk886ex/devicetree.cb b/src/mainboard/roda/rk886ex/devicetree.cb
index 082a9e894c..3ba9d2c331 100644
--- a/src/mainboard/roda/rk886ex/devicetree.cb
+++ b/src/mainboard/roda/rk886ex/devicetree.cb
@@ -61,7 +61,6 @@ chip northbridge/intel/i945
register "ide_legacy_combined" = "0x1"
register "ide_enable_primary" = "0x1"
register "ide_enable_secondary" = "0x0"
- register "sata_ahci" = "0x0"
device pci 1b.0 off end # High Definition Audio
device pci 1c.0 on end # PCIe port 1
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/Makefile.inc b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/Makefile.inc
index adf9aff0d4..03759d2633 100644
--- a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/Makefile.inc
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/Makefile.inc
@@ -1,2 +1,5 @@
+romstage-y += gpio.c
+
+ramstage-y += gpio.c
ramstage-y += mainboard.c
ramstage-y += ptn3460.c
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/gpio.c b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/gpio.c
new file mode 100644
index 0000000000..7a424d131e
--- /dev/null
+++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/gpio.c
@@ -0,0 +1,417 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2016 Google Inc.
+ * Copyright (C) 2017-2018 Siemens AG
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+
+/*
+ * Pad configuration in ramstage. The order largely follows the 'GPIO Muxing'
+ * table found in EDS vol 1, but some pins aren't grouped functionally in
+ * the table so those were moved for more logical grouping.
+ */
+static const struct pad_config gpio_table[] = {
+
+ /* Southwest Community */
+
+ /* PCIE_WAKE[0:3]_N */
+ PAD_CFG_NF(GPIO_205, NONE, DEEP, NF1), /* PCIE_WAKE0_N */
+ PAD_CFG_NF(GPIO_206, NONE, DEEP, NF1), /* PCIE_WAKE1_N */
+ PAD_CFG_NF(GPIO_207, NONE, DEEP, NF1), /* PCIE_WAKE2_N */
+ PAD_CFG_NF(GPIO_208, NONE, DEEP, NF1), /* PCIE_WAKE3_N */
+
+ /* EMMC interface. */
+ PAD_CFG_NF(GPIO_156, DN_20K, DEEP, NF1), /* EMMC_CLK */
+ PAD_CFG_NF(GPIO_157, NONE, DEEP, NF1), /* EMMC_D0 */
+ PAD_CFG_NF(GPIO_158, NONE, DEEP, NF1), /* EMMC_D1 */
+ PAD_CFG_NF(GPIO_159, NONE, DEEP, NF1), /* EMMC_D2 */
+ PAD_CFG_NF(GPIO_160, NONE, DEEP, NF1), /* EMMC_D3 */
+ PAD_CFG_NF(GPIO_161, NONE, DEEP, NF1), /* EMMC_D4 */
+ PAD_CFG_NF(GPIO_162, NONE, DEEP, NF1), /* EMMC_D5 */
+ PAD_CFG_NF(GPIO_163, NONE, DEEP, NF1), /* EMMC_D6 */
+ PAD_CFG_NF(GPIO_164, NONE, DEEP, NF1), /* EMMC_D7 */
+ PAD_CFG_NF(GPIO_165, NONE, DEEP, NF1), /* EMMC_CMD */
+ PAD_CFG_NF(GPIO_182, DN_20K, DEEP, NF1), /* EMMC_RCLK */
+
+ /* SDIO -- unused */
+ PAD_CFG_GPI(GPIO_166, DN_20K, DEEP), /* SDIO_CLK */
+ PAD_CFG_GPI(GPIO_167, NONE, DEEP), /* SDIO_D0 */
+ /* Configure SDIO to enable power gating. */
+ PAD_CFG_GPI(GPIO_168, NONE, DEEP), /* SDIO_D1 */
+ PAD_CFG_GPI(GPIO_169, NONE, DEEP), /* SDIO_D2 */
+ PAD_CFG_GPI(GPIO_170, NONE, DEEP), /* SDIO_D3 */
+ PAD_CFG_GPI(GPIO_171, NONE, DEEP), /* SDIO_CMD */
+
+ /* SDCARD */
+ /* Pull down clock by 20K. */
+ PAD_CFG_NF(GPIO_172, DN_20K, DEEP, NF1), /* SDCARD_CLK */
+ PAD_CFG_NF(GPIO_173, UP_20K, DEEP, NF1), /* SDCARD_D0 */
+ PAD_CFG_NF(GPIO_174, UP_20K, DEEP, NF1), /* SDCARD_D1 */
+ PAD_CFG_NF(GPIO_175, UP_20K, DEEP, NF1), /* SDCARD_D2 */
+ PAD_CFG_NF(GPIO_176, UP_20K, DEEP, NF1), /* SDCARD_D3 */
+ /* Card detect is active LOW with external pull up. */
+ PAD_CFG_NF(GPIO_177, NONE, DEEP, NF1), /* SDCARD_CD_N */
+ PAD_CFG_NF(GPIO_178, UP_20K, DEEP, NF1), /* SDCARD_CMD */
+ /* CLK feedback, internal signal, needs 20K pull down. */
+ PAD_CFG_NF(GPIO_179, DN_20K, DEEP, NF1), /* SDCARD_CLK_FB */
+ PAD_CFG_GPI(GPIO_186, NONE, DEEP), /* SDCARD_LVL_WP */
+ /* EN_SD_SOCKET_PWR_L for SD slot power control. Default on. */
+ PAD_CFG_GPO(GPIO_183, 1, DEEP), /* SDIO_PWR_DOWN_N */
+
+ /* SMBus */
+ PAD_CFG_GPI(SMB_ALERTB, NONE, DEEP), /* SMB_ALERT _N */
+ PAD_CFG_NF(SMB_CLK, NONE, DEEP, NF1), /* SMB_CLK */
+ PAD_CFG_NF(SMB_DATA, NONE, DEEP, NF1), /* SMB_DATA */
+
+ /* LPC */
+ PAD_CFG_NF(LPC_ILB_SERIRQ, NONE, DEEP, NF1), /* LPC_SERIRQ */
+ PAD_CFG_NF(LPC_CLKOUT0, NONE, DEEP, NF1), /* LPC_CLKOUT0 */
+ PAD_CFG_GPI(LPC_CLKOUT1, UP_20K, DEEP), /* LPC_CLKOUT1 */
+ PAD_CFG_NF(LPC_AD0, NONE, DEEP, NF1), /* LPC_AD0 */
+ PAD_CFG_NF(LPC_AD1, NONE, DEEP, NF1), /* LPC_AD1 */
+ PAD_CFG_NF(LPC_AD2, NONE, DEEP, NF1), /* LPC_AD2 */
+ PAD_CFG_NF(LPC_AD3, NONE, DEEP, NF1), /* LPC_AD3 */
+ PAD_CFG_NF(LPC_CLKRUNB, NONE, DEEP, NF1), /* LPC_CLKRUN_N */
+ PAD_CFG_NF(LPC_FRAMEB, NONE, DEEP, NF1), /* LPC_FRAME_N */
+
+ /* West Community */
+
+ /* I2C0 - I2C Level Shifter */
+ PAD_CFG_NF(GPIO_124, NONE, DEEP, NF1), /* LPSS_I2C0_SDA */
+ PAD_CFG_NF(GPIO_125, NONE, DEEP, NF1), /* LPSS_I2C0_SCL */
+
+ /* I2C[1:7] -- unused */
+ PAD_CFG_GPI(GPIO_126, UP_20K, DEEP), /* LPSS_I2C1_SDA */
+ PAD_CFG_GPI(GPIO_127, UP_20K, DEEP), /* LPSS_I2C1_SCL */
+ PAD_CFG_GPI(GPIO_128, UP_20K, DEEP), /* LPSS_I2C2_SDA */
+ PAD_CFG_GPI(GPIO_129, UP_20K, DEEP), /* LPSS_I2C2_SCL */
+ PAD_CFG_GPI(GPIO_130, UP_20K, DEEP), /* LPSS_I2C3_SDA */
+ PAD_CFG_GPI(GPIO_131, UP_20K, DEEP), /* LPSS_I2C3_SCL */
+ PAD_CFG_GPI(GPIO_132, UP_20K, DEEP), /* LPSS_I2C4_SDA */
+ PAD_CFG_GPI(GPIO_133, UP_20K, DEEP), /* LPSS_I2C4_SCL */
+ PAD_CFG_GPI(GPIO_134, UP_20K, DEEP), /* LPSS_I2C5_SDA */
+ PAD_CFG_GPI(GPIO_135, UP_20K, DEEP), /* LPSS_I2C5_SCL */
+ PAD_CFG_GPI(GPIO_136, UP_20K, DEEP), /* LPSS_I2C6_SDA */
+ PAD_CFG_GPI(GPIO_137, UP_20K, DEEP), /* LPSS_I2C6_SCL */
+ PAD_CFG_GPI(GPIO_138, UP_20K, DEEP), /* LPSS_I2C7_SDA */
+ PAD_CFG_GPI(GPIO_139, UP_20K, DEEP), /* LPSS_I2C7_SCL */
+
+ /* ISH_GPIO_[0:9] -- unused */
+ PAD_CFG_GPI(GPIO_146, DN_20K, DEEP), /* ISH_GPIO_0 */
+ PAD_CFG_GPI(GPIO_147, DN_20K, DEEP), /* ISH_GPIO_1 */
+ PAD_CFG_GPI(GPIO_148, DN_20K, DEEP), /* ISH_GPIO_2 */
+ PAD_CFG_GPI(GPIO_149, DN_20K, DEEP), /* ISH_GPIO_3 */
+ PAD_CFG_GPI(GPIO_150, DN_20K, DEEP), /* ISH_GPIO_4 */
+ PAD_CFG_GPI(GPIO_151, DN_20K, DEEP), /* ISH_GPIO_5 */
+ PAD_CFG_GPI(GPIO_152, DN_20K, DEEP), /* ISH_GPIO_6 */
+ PAD_CFG_GPI(GPIO_153, DN_20K, DEEP), /* ISH_GPIO_7 */
+ PAD_CFG_GPI(GPIO_154, DN_20K, DEEP), /* ISH_GPIO_8 */
+ PAD_CFG_GPI(GPIO_155, DN_20K, DEEP), /* ISH_GPIO_9 */
+
+ /* PCIE_CLKREQ[0:3]_N */
+ PAD_CFG_NF(GPIO_209, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPIO_210, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPIO_211, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPIO_212, NONE, DEEP, NF1),
+
+ /* OSC_CLK_OUT_0 - RES_CLK_CPU_FPGA */
+ PAD_CFG_NF(OSC_CLK_OUT_0, DN_20K, DEEP, NF1),
+ /* OSC_CLK_OUT_[1:4] -- unused */
+ PAD_CFG_GPI(OSC_CLK_OUT_1, DN_20K, DEEP),
+ PAD_CFG_GPI(OSC_CLK_OUT_2, DN_20K, DEEP),
+ PAD_CFG_GPI(OSC_CLK_OUT_3, DN_20K, DEEP),
+ PAD_CFG_GPI(OSC_CLK_OUT_4, DN_20K, DEEP),
+
+ /* PMU Signals */
+ PAD_CFG_GPI(PMU_AC_PRESENT, NONE, DEEP), /* PMU_AC_PRESENT */
+ PAD_CFG_NF(PMU_BATLOW_B, UP_20K, DEEP, NF1), /* PMU_BATLOW_N */
+ PAD_CFG_NF(PMU_PLTRST_B, NONE, DEEP, NF1), /* PMU_PLTRST_N */
+ PAD_CFG_NF(PMU_PWRBTN_B, NONE, DEEP, NF1), /* PMU_PWRBTN_N */
+ PAD_CFG_NF(PMU_RESETBUTTON_B, NONE, DEEP, NF1), /* PMU_RSTBTN_N */
+ /* PMU_SLP_S0_N */
+ PAD_CFG_NF_IOSSTATE(PMU_SLP_S0_B, NONE, DEEP, NF1, IGNORE),
+ PAD_CFG_NF(PMU_SLP_S3_B, NONE, DEEP, NF1), /* PMU_SLP_S3_N */
+ PAD_CFG_NF(PMU_SLP_S4_B, NONE, DEEP, NF1), /* PMU_SLP_S4_N */
+ PAD_CFG_NF(PMU_SUSCLK, NONE, DEEP, NF1), /* PMU_SUSCLK */
+ PAD_CFG_GPO(PMU_WAKE_B, 1, DEEP), /* EN_PP3300_EMMC */
+ PAD_CFG_NF(SUS_STAT_B, NONE, DEEP, NF1), /* SUS_STAT_N */
+ PAD_CFG_NF(SUSPWRDNACK, NONE, DEEP, NF1), /* SUSPWRDNACK */
+
+ /* Northwest Community */
+
+ /* DDI0 SDA and SCL -- unused */
+ PAD_CFG_GPI(GPIO_187, DN_20K, DEEP), /* HV_DDI0_DDC_SDA */
+ PAD_CFG_GPI(GPIO_188, DN_20K, DEEP), /* HV_DDI0_DDC_SCL */
+ /* DDI1 SDA and SCL - Display-Port */
+ PAD_CFG_NF(GPIO_189, NONE, DEEP, NF1), /* HV_DDI1_DDC_SDA */
+ PAD_CFG_NF(GPIO_190, NONE, DEEP, NF1), /* HV_DDI1_DDC_SCL */
+
+ /* MIPI I2C -- unused */
+ PAD_CFG_GPI(GPIO_191, DN_20K, DEEP), /* MIPI_I2C_SDA */
+ PAD_CFG_GPI(GPIO_192, DN_20K, DEEP), /* MIPI_I2C_SCL */
+
+ /* Panel 0 control -- unused */
+ PAD_CFG_TERM_GPO(GPIO_193, 0, DN_20K, DEEP), /* PNL0_VDDEN */
+ PAD_CFG_TERM_GPO(GPIO_194, 0, DN_20K, DEEP), /* PNL0_BKLTEN */
+ PAD_CFG_TERM_GPO(GPIO_195, 0, DN_20K, DEEP), /* PNL0_BKLTCTL */
+
+ /* Panel 1 control -- unused */
+ PAD_CFG_GPI(GPIO_196, DN_20K, DEEP), /* PNL1_VDDEN */
+ PAD_CFG_GPI(GPIO_197, DN_20K, DEEP), /* PNL1_BKLTEN */
+ PAD_CFG_GPI(GPIO_198, DN_20K, DEEP), /* PNL1_BKLTCTL */
+
+ /* DDI[0:1]_HPD -- unused */
+ PAD_CFG_GPI(GPIO_199, NONE, DEEP), /* XHPD_DP */
+ PAD_CFG_GPI(GPIO_200, DN_20K, DEEP), /* unused */
+
+ /* MDSI signals -- unused */
+ PAD_CFG_GPI(GPIO_201, DN_20K, DEEP), /* MDSI_A_TE */
+ PAD_CFG_GPI(GPIO_202, DN_20K, DEEP), /* MDSI_C_TE */
+
+ /* USB overcurrent pins. */
+ PAD_CFG_NF(GPIO_203, NONE, DEEP, NF1), /* USB_OC0_N */
+ PAD_CFG_NF(GPIO_204, NONE, DEEP, NF1), /* USB_OC1_N */
+
+ /* PMC SPI -- almost entirely unused. */
+ PAD_CFG_GPI(PMC_SPI_FS0, UP_20K, DEEP),
+ PAD_CFG_NF(PMC_SPI_FS1, NONE, DEEP, NF2), /* XHPD_EDP_APL */
+ PAD_CFG_GPI(PMC_SPI_FS2, UP_20K, DEEP),
+ PAD_CFG_GPI(PMC_SPI_RXD, DN_20K, DEEP),
+ PAD_CFG_GPI(PMC_SPI_TXD, DN_20K, DEEP),
+ PAD_CFG_GPI(PMC_SPI_CLK, DN_20K, DEEP),
+
+ /* PMIC Signals unused signals related to an old PMIC interface. */
+ PAD_CFG_GPO(PMIC_PWRGOOD, 1, DEEP), /* PMIC_PWRGOOD */
+ PAD_CFG_GPI(PMIC_RESET_B, DN_20K, DEEP), /* PMIC_RESET_B */
+ PAD_CFG_TERM_GPO(GPIO_213, 0, DN_20K, DEEP), /* NFC_OUT_RESERVE */
+ PAD_CFG_TERM_GPO(GPIO_214, 0, DN_20K, DEEP), /* NFC_EN */
+ PAD_CFG_GPI(GPIO_215, DN_20K, DEEP), /* NFC_IN_RESERVE */
+ /* THERMTRIP_N */
+ PAD_CFG_NF(PMIC_THERMTRIP_B, UP_20K, DEEP, NF1),
+ /* Disable reset for PCIe switch. */
+ PAD_CFG_GPO(PMIC_STDBY, 1, DEEP),
+ PAD_CFG_NF(PROCHOT_B, NONE, DEEP, NF1), /* PROCHOT_N */
+ PAD_CFG_NF(PMIC_I2C_SCL, NONE, DEEP, NF1), /* PMIC_I2C_SCL */
+ PAD_CFG_NF(PMIC_I2C_SDA, NONE, DEEP, NF1), /* PMIC_I2C_SDA */
+
+ /* I2S1 -- unused */
+ PAD_CFG_GPI(GPIO_74, DN_20K, DEEP), /* I2S1_MCLK */
+ PAD_CFG_GPI(GPIO_75, DN_20K, DEEP), /* I2S1_BCLK */
+ PAD_CFG_GPI(GPIO_76, DN_20K, DEEP), /* I2S1_WS_SYNC */
+ PAD_CFG_GPI(GPIO_77, DN_20K, DEEP), /* I2S1_SDI */
+ PAD_CFG_GPI(GPIO_78, DN_20K, DEEP), /* I2S1_SDO */
+
+ /* DMIC or I2S4 -- unused */
+ PAD_CFG_GPI(GPIO_79, DN_20K, DEEP), /* AVS_M_CLK_A1 */
+ PAD_CFG_GPI(GPIO_80, DN_20K, DEEP), /* AVS_M_CLK_B1 */
+ PAD_CFG_GPI(GPIO_81, DN_20K, DEEP), /* AVS_M_DATA_1 */
+ PAD_CFG_GPI(GPIO_82, DN_20K, DEEP), /* AVS_M_CLK_AB2 */
+ PAD_CFG_GPI(GPIO_83, DN_20K, DEEP), /* AVS_M_DATA_2 */
+
+ /* I2S2 -- unused */
+ PAD_CFG_GPI(GPIO_84, DN_20K, DEEP), /* AVS_I2S2_MCLK */
+ PAD_CFG_GPI(GPIO_85, DN_20K, DEEP), /* AVS_I2S2_BCLK */
+ PAD_CFG_GPI(GPIO_86, DN_20K, DEEP), /* AVS_I2S2_WS_SYNC */
+ PAD_CFG_GPI(GPIO_87, DN_20K, DEEP), /* AVS_I2S2_SDI */
+ PAD_CFG_GPI(GPIO_88, DN_20K, DEEP), /* AVS_I2S2_SDO */
+
+ /* I2S3 -- unused */
+ PAD_CFG_GPI(GPIO_89, DN_20K, DEEP), /* AVS_I2S3_BCLK */
+ PAD_CFG_GPI(GPIO_90, DN_20K, DEEP), /* AVS_I2S3_WS_SYNC */
+ PAD_CFG_GPI(GPIO_91, DN_20K, DEEP), /* AVS_I2S3_SDI */
+ PAD_CFG_GPI(GPIO_92, DN_20K, DEEP), /* AVS_I2S3_SDO */
+
+ /* Fast SPI */
+ /* FST_SPI_CS0_B */
+ PAD_CFG_NF_IOSSTATE(GPIO_97, NATIVE, DEEP, NF1, IGNORE),
+ /* FST_SPI_CS1_B -- unused */
+ PAD_CFG_GPI(GPIO_98, DN_20K, DEEP),
+ /* FST_SPI_MOSI_IO0 */
+ PAD_CFG_NF_IOSSTATE(GPIO_99, NATIVE, DEEP, NF1, IGNORE),
+ /* FST_SPI_MISO_IO1 */
+ PAD_CFG_NF_IOSSTATE(GPIO_100, NATIVE, DEEP, NF1, IGNORE),
+ /* FST_IO2 -- MEM_CONFIG0 */
+ PAD_CFG_NF(GPIO_101, NATIVE, DEEP, NF1),
+ /* FST_IO3 -- MEM_CONFIG1 */
+ PAD_CFG_NF(GPIO_102, NATIVE, DEEP, NF1),
+ /* FST_SPI_CLK */
+ PAD_CFG_NF_IOSSTATE(GPIO_103, NATIVE, DEEP, NF1, IGNORE),
+ /* FST_SPI_CLK_FB */
+ PAD_CFG_NF_IOSSTATE(FST_SPI_CLK_FB, NATIVE, DEEP, NF1, IGNORE),
+
+ /* SIO_SPI_0 -- unused */
+ PAD_CFG_GPI(GPIO_104, DN_20K, DEEP), /* GP_SSP_0_CLK */
+ PAD_CFG_GPI(GPIO_105, DN_20K, DEEP), /* GP_SSP_0_FS0 */
+ PAD_CFG_GPI(GPIO_106, UP_20K, DEEP), /* GP_SSP_0_FS1 */
+ PAD_CFG_GPI(GPIO_109, DN_20K, DEEP), /* GP_SSP_0_RXD */
+ PAD_CFG_GPI(GPIO_110, DN_20K, DEEP), /* GP_SSP_0_TXD */
+
+ /* SIO_SPI_1 -- unused */
+ PAD_CFG_GPI(GPIO_111, DN_20K, DEEP), /* GP_SSP_1_CLK */
+ PAD_CFG_GPI(GPIO_112, DN_20K, DEEP), /* GP_SSP_1_FS0 */
+ PAD_CFG_GPI(GPIO_113, DN_20K, DEEP), /* GP_SSP_1_FS1 */
+ PAD_CFG_GPI(GPIO_116, DN_20K, DEEP), /* GP_SSP_1_RXD */
+ PAD_CFG_GPI(GPIO_117, DN_20K, DEEP), /* GP_SSP_1_TXD */
+
+ /* SIO_SPI_2 -- unused */
+ PAD_CFG_GPI(GPIO_118, DN_20K, DEEP), /* GP_SSP_2_CLK */
+ PAD_CFG_GPI(GPIO_119, DN_20K, DEEP), /* GP_SSP_2_FS0 */
+ PAD_CFG_GPI(GPIO_120, DN_20K, DEEP), /* GP_SSP_2_FS1 */
+ PAD_CFG_GPI(GPIO_121, DN_20K, DEEP), /* GP_SSP_2_FS2 */
+ PAD_CFG_GPI(GPIO_122, DN_20K, DEEP), /* GP_SSP_2_RXD */
+ PAD_CFG_GPI(GPIO_123, NONE, DEEP), /* GP_SSP_2_TXD */
+
+ /* North Community */
+
+ /* Debug tracing. */
+ PAD_CFG_GPI(GPIO_0, DN_20K, DEEP), /* TRACE_0_CLK_VNN */
+ PAD_CFG_GPI(GPIO_1, DN_20K, DEEP), /* TRACE_0_DATA0_VNN */
+ PAD_CFG_GPI(GPIO_2, DN_20K, DEEP), /* TRACE_0_DATA1_VNN */
+ PAD_CFG_GPI(GPIO_3, DN_20K, DEEP), /* TRACE_0_DATA2_VNN */
+ PAD_CFG_GPI(GPIO_4, DN_20K, DEEP), /* TRACE_0_DATA3_VNN */
+ PAD_CFG_GPI(GPIO_5, DN_20K, DEEP), /* TRACE_0_DATA4_VNN */
+ PAD_CFG_GPI(GPIO_6, DN_20K, DEEP), /* TRACE_0_DATA5_VNN */
+ PAD_CFG_GPI(GPIO_7, DN_20K, DEEP), /* TRACE_0_DATA6_VNN */
+ PAD_CFG_GPI(GPIO_8, DN_20K, DEEP), /* TRACE_0_DATA7_VNN */
+
+ PAD_CFG_GPI(GPIO_9, DN_20K, DEEP), /* TRACE_1_CLK_VNN */
+ PAD_CFG_GPI(GPIO_10, DN_20K, DEEP), /* TRACE_1_DATA0_VNN */
+ PAD_CFG_GPI(GPIO_11, DN_20K, DEEP), /* TRACE_1_DATA1_VNN */
+ PAD_CFG_GPI(GPIO_12, DN_20K, DEEP), /* TRACE_1_DATA2_VNN */
+ PAD_CFG_GPI(GPIO_13, DN_20K, DEEP), /* TRACE_1_DATA3_VNN */
+ PAD_CFG_GPI(GPIO_14, DN_20K, DEEP), /* TRACE_1_DATA4_VNN */
+ PAD_CFG_GPI(GPIO_15, DN_20K, DEEP), /* TRACE_1_DATA5_VNN */
+ PAD_CFG_GPI(GPIO_16, DN_20K, DEEP), /* TRACE_1_DATA6_VNN */
+ PAD_CFG_GPI(GPIO_17, DN_20K, DEEP), /* TRACE_1_DATA7_VNN */
+
+ PAD_CFG_GPI(GPIO_18, DN_20K, DEEP), /* TRACE_2_CLK_VNN */
+ PAD_CFG_GPI(GPIO_19, DN_20K, DEEP), /* TRACE_2_DATA0_VNN */
+ PAD_CFG_GPI(GPIO_20, DN_20K, DEEP), /* TRACE_2_DATA1_VNN */
+ PAD_CFG_GPI(GPIO_21, DN_20K, DEEP), /* TRACE_2_DATA2_VNN */
+ PAD_CFG_GPI(GPIO_22, DN_20K, DEEP), /* TRACE_2_DATA3_VNN */
+ PAD_CFG_GPI(GPIO_23, DN_20K, DEEP), /* TRACE_2_DATA4_VNN */
+ PAD_CFG_GPI(GPIO_24, DN_20K, DEEP), /* TRACE_2_DATA5_VNN */
+ PAD_CFG_GPI(GPIO_25, DN_20K, DEEP), /* TRACE_2_DATA6_VNN */
+ PAD_CFG_GPI(GPIO_26, DN_20K, DEEP), /* TRACE_2_DATA7_VNN */
+
+ PAD_CFG_GPI(GPIO_27, DN_20K, DEEP), /* TRIGOUT_0 */
+ PAD_CFG_GPI(GPIO_28, DN_20K, DEEP), /* TRIGOUT_1 */
+ PAD_CFG_GPI(GPIO_29, DN_20K, DEEP), /* TRIGIN_0 */
+
+ PAD_CFG_GPI(GPIO_30, DN_20K, DEEP), /* ISH_GPIO_12 */
+ PAD_CFG_GPO(GPIO_31, 1, DEEP), /* ISH_GPIO_13 */
+ PAD_CFG_GPI(GPIO_32, NONE, DEEP), /* ISH_GPIO_14 */
+ PAD_CFG_GPI(GPIO_33, DN_20K, DEEP), /* ISH_GPIO_15 */
+
+ /* PWM[0:3] -- unused */
+ PAD_CFG_GPI(GPIO_34, DN_20K, DEEP),
+ PAD_CFG_GPI(GPIO_35, DN_20K, DEEP),
+ PAD_CFG_GPI(GPIO_36, DN_20K, DEEP),
+ PAD_CFG_GPI(GPIO_37, DN_20K, DEEP),
+
+ /* LPSS_UART[0:2] */
+ PAD_CFG_GPI(GPIO_38, UP_20K, DEEP), /* LPSS_UART0_RXD - unused */
+ PAD_CFG_GPI(GPIO_39, DN_20K, DEEP), /* LPSS_UART0_TXD - unused */
+ PAD_CFG_GPI(GPIO_40, DN_20K, DEEP), /* LPSS_UART0_RTS - unused */
+ PAD_CFG_GPI(GPIO_41, UP_20K, DEEP), /* LPSS_UART0_CTS - unused */
+ PAD_CFG_GPI(GPIO_42, NONE, DEEP), /* LPSS_UART1_RXD - unused */
+ PAD_CFG_GPI(GPIO_43, DN_20K, DEEP), /* LPSS_UART1_TXD - unused */
+ PAD_CFG_GPI(GPIO_44, UP_20K, DEEP), /* LPSS_UART1_RTS - unused */
+ PAD_CFG_GPI(GPIO_45, UP_20K, DEEP), /* LPSS_UART1_CTS - unused */
+ PAD_CFG_NF(GPIO_46, NATIVE, DEEP, NF1), /* LPSS_UART2_RXD */
+ /* LPSS_UART2_TXD */
+ PAD_CFG_NF_IOSSTATE(GPIO_47, NATIVE, DEEP, NF1, Tx1RxDCRx0),
+ PAD_CFG_GPI(GPIO_48, DN_20K, DEEP), /* LPSS_UART2_RTS - unused */
+ PAD_CFG_GPI(GPIO_49, UP_20K, DEEP), /* LPSS_UART2_CTS - unused */
+
+ /* Camera interface -- completely unused. */
+ PAD_CFG_GPI(GPIO_62, DN_20K, DEEP), /* GP_CAMERASB00 */
+ PAD_CFG_GPI(GPIO_63, DN_20K, DEEP), /* GP_CAMERASB01 */
+ PAD_CFG_GPI(GPIO_64, DN_20K, DEEP), /* GP_CAMERASB02 */
+ PAD_CFG_GPI(GPIO_65, DN_20K, DEEP), /* GP_CAMERASB03 */
+ PAD_CFG_GPI(GPIO_66, DN_20K, DEEP), /* GP_CAMERASB04 */
+ PAD_CFG_GPI(GPIO_67, DN_20K, DEEP), /* GP_CAMERASB05 */
+ PAD_CFG_GPI(GPIO_68, DN_20K, DEEP), /* GP_CAMERASB06 */
+ PAD_CFG_GPI(GPIO_69, DN_20K, DEEP), /* GP_CAMERASB07 */
+ PAD_CFG_GPI(GPIO_70, DN_20K, DEEP), /* GP_CAMERASB08 */
+ PAD_CFG_GPI(GPIO_71, DN_20K, DEEP), /* GP_CAMERASB09 */
+ PAD_CFG_GPI(GPIO_72, DN_20K, DEEP), /* GP_CAMERASB10 */
+ PAD_CFG_GPI(GPIO_73, DN_20K, DEEP), /* GP_CAMERASB11 */
+
+ /* CNV bridge described into IAFW Vol2. */
+ /* GPIO_[216:219] described into EDS Vol1. */
+ PAD_CFG_GPO(CNV_BRI_DT, 0, DEEP), /* Reserve of FPGA */
+ PAD_CFG_GPO(CNV_BRI_RSP, 0, DEEP), /* Reserve of FPGA */
+ PAD_CFG_GPO(CNV_RGI_DT, 0, DEEP), /* Reserve of FPGA */
+ PAD_CFG_NF(CNV_RGI_RSP, UP_20K, DEEP, NF1), /* eMMC */
+
+ /* Serial VID */
+ PAD_CFG_NF(SVID0_ALERT_B, NONE, DEEP, NF1), /* SVID0_ALERT_B */
+ PAD_CFG_NF(SVID0_DATA, UP_20K, DEEP, NF1), /* SVID0_DATA */
+ PAD_CFG_NF(SVID0_CLK, UP_20K, DEEP, NF1), /* SVID0_CLK */
+};
+
+const struct pad_config *__weak variant_gpio_table(size_t *num)
+{
+ *num = ARRAY_SIZE(gpio_table);
+ return gpio_table;
+}
+
+/* GPIOs needed prior to ramstage. */
+static const struct pad_config early_gpio_table[] = {
+
+ /* Debug tracing. */
+ PAD_CFG_GPI(GPIO_0, DN_20K, DEEP), /* TRACE_0_CLK_VNN */
+ PAD_CFG_GPI(GPIO_1, DN_20K, DEEP), /* TRACE_0_DATA0_VNN */
+ PAD_CFG_GPI(GPIO_2, DN_20K, DEEP), /* TRACE_0_DATA1_VNN */
+ PAD_CFG_GPI(GPIO_3, DN_20K, DEEP), /* TRACE_0_DATA2_VNN */
+ PAD_CFG_GPI(GPIO_4, DN_20K, DEEP), /* TRACE_0_DATA3_VNN */
+ PAD_CFG_GPI(GPIO_5, DN_20K, DEEP), /* TRACE_0_DATA4_VNN */
+ PAD_CFG_GPI(GPIO_6, DN_20K, DEEP), /* TRACE_0_DATA5_VNN */
+ PAD_CFG_GPI(GPIO_7, DN_20K, DEEP), /* TRACE_0_DATA6_VNN */
+ PAD_CFG_GPI(GPIO_8, DN_20K, DEEP), /* TRACE_0_DATA7_VNN */
+
+ PAD_CFG_GPO(GPIO_13, 0, DEEP), /* PERST# */
+ PAD_CFG_GPO(GPIO_15, 0, DEEP), /* PERST# */
+ PAD_CFG_GPO(GPIO_17, 1, DEEP), /* PFET */
+ PAD_CFG_GPO(GPIO_19, 1, DEEP), /* PFET */
+ PAD_CFG_GPO(GPIO_152, 0, DEEP), /* PERST# */
+
+ /* SMBus */
+ PAD_CFG_NF(SMB_CLK, NONE, DEEP, NF1), /* SMB_CLK */
+ PAD_CFG_NF(SMB_DATA, NONE, DEEP, NF1), /* SMB_DATA */
+
+ /* LPC */
+ PAD_CFG_NF(LPC_ILB_SERIRQ, NONE, DEEP, NF1), /* LPC_SERIRQ */
+ PAD_CFG_NF(LPC_CLKOUT0, NONE, DEEP, NF1), /* LPC_CLKOUT0 */
+ /* LPC_CLKOUT1 - unused */
+ PAD_CFG_GPI(LPC_CLKOUT1, DN_20K, DEEP),
+ PAD_CFG_NF(LPC_AD0, NONE, DEEP, NF1), /* LPC_AD0 */
+ PAD_CFG_NF(LPC_AD1, NONE, DEEP, NF1), /* LPC_AD1 */
+ PAD_CFG_NF(LPC_AD2, NONE, DEEP, NF1), /* LPC_AD2 */
+ PAD_CFG_NF(LPC_AD3, NONE, DEEP, NF1), /* LPC_AD3 */
+ PAD_CFG_NF(LPC_CLKRUNB, NONE, DEEP, NF1), /* LPC_CLKRUN_N */
+ PAD_CFG_NF(LPC_FRAMEB, NONE, DEEP, NF1), /* LPC_FRAME_N */
+
+ /* Enable reset for PCIe switch. */
+ PAD_CFG_GPO(PMIC_STDBY, 0, DEEP),
+};
+
+const struct pad_config *__weak
+variant_early_gpio_table(size_t *num)
+{
+ *num = ARRAY_SIZE(early_gpio_table);
+ return early_gpio_table;
+}
diff --git a/src/northbridge/intel/gm45/raminit.c b/src/northbridge/intel/gm45/raminit.c
index 2826d7418c..b7ccdecdad 100644
--- a/src/northbridge/intel/gm45/raminit.c
+++ b/src/northbridge/intel/gm45/raminit.c
@@ -1593,7 +1593,8 @@ static void jedec_init(const timings_t *const timings,
int ch, r;
FOR_EACH_POPULATED_RANK(dimms, ch, r) {
/* We won't do this in dual-interleaved mode,
- so don't care about the offset. */
+ so don't care about the offset.
+ Mirrored ranks aren't taken into account here. */
const u32 rankaddr = raminit_get_rank_addr(ch, r);
printk(BIOS_DEBUG, "JEDEC init @0x%08x\n", rankaddr);
MCHBAR32(DCC_MCHBAR) = (MCHBAR32(DCC_MCHBAR) & ~DCC_SET_EREG_MASK) | DCC_SET_EREGx(2);
diff --git a/src/northbridge/intel/pineview/raminit.c b/src/northbridge/intel/pineview/raminit.c
index 282765efcc..72063cbdad 100644
--- a/src/northbridge/intel/pineview/raminit.c
+++ b/src/northbridge/intel/pineview/raminit.c
@@ -1835,7 +1835,6 @@ static void sdram_dradrb(struct sysinfo *s)
static u8 sampledqs(u32 dqshighaddr, u32 strobeaddr, u8 highlow, u8 count)
{
- volatile u32 strobedata;
u8 dqsmatches = 1;
while (count--) {
MCHBAR8(0x5d8) = MCHBAR8(0x5d8) & ~0x2;
@@ -1843,7 +1842,7 @@ static u8 sampledqs(u32 dqshighaddr, u32 strobeaddr, u8 highlow, u8 count)
MCHBAR8(0x5d8) = MCHBAR8(0x5d8) | 0x2;
hpet_udelay(1);
barrier();
- strobedata = read32((void *)strobeaddr);
+ read32((void *)strobeaddr);
barrier();
hpet_udelay(1);
diff --git a/src/northbridge/intel/sandybridge/Makefile.inc b/src/northbridge/intel/sandybridge/Makefile.inc
index ba55466026..c77f3bac6a 100644
--- a/src/northbridge/intel/sandybridge/Makefile.inc
+++ b/src/northbridge/intel/sandybridge/Makefile.inc
@@ -43,7 +43,6 @@ mrc.bin-position := 0xfffa0000
mrc.bin-type := mrc
endif
romstage-y += romstage.c
-romstage-y += iommu.c
romstage-y += early_init.c
romstage-y += ../../../arch/x86/walkcbfs.S
diff --git a/src/northbridge/intel/sandybridge/early_init.c b/src/northbridge/intel/sandybridge/early_init.c
index fd3d34f2de..0c6ef7ebdf 100644
--- a/src/northbridge/intel/sandybridge/early_init.c
+++ b/src/northbridge/intel/sandybridge/early_init.c
@@ -2,7 +2,9 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2007-2010 coresystems GmbH
+ * Copyright (C) 2015 secunet Security Networks AG
* Copyright (C) 2011 Google Inc
+ * Copyright (C) 2018 Patrick Rudolph
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,6 +19,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -25,6 +29,41 @@
#include "sandybridge.h"
+static void systemagent_vtd_init(void)
+{
+ const u32 capid0_a = pci_read_config32(PCI_DEV(0, 0, 0), CAPID0_A);
+ if (capid0_a & (1 << 23))
+ return;
+
+ /* setup BARs */
+ MCHBAR32(0x5404) = IOMMU_BASE1 >> 32;
+ MCHBAR32(0x5400) = IOMMU_BASE1 | 1;
+ MCHBAR32(0x5414) = IOMMU_BASE2 >> 32;
+ MCHBAR32(0x5410) = IOMMU_BASE2 | 1;
+
+ /* lock policies */
+ write32((void *)(IOMMU_BASE1 + 0xff0), 0x80000000);
+
+ const struct device *const azalia = pcidev_on_root(0x1b, 0);
+ if (azalia && azalia->enabled) {
+ write32((void *)(IOMMU_BASE2 + 0xff0), 0x20000000);
+ write32((void *)(IOMMU_BASE2 + 0xff0), 0xa0000000);
+ } else {
+ write32((void *)(IOMMU_BASE2 + 0xff0), 0x80000000);
+ }
+}
+
+static void enable_pam_region(void)
+{
+ pci_write_config8(PCI_DEV(0, 0x00, 0), PAM0, 0x30);
+ pci_write_config8(PCI_DEV(0, 0x00, 0), PAM1, 0x33);
+ pci_write_config8(PCI_DEV(0, 0x00, 0), PAM2, 0x33);
+ pci_write_config8(PCI_DEV(0, 0x00, 0), PAM3, 0x33);
+ pci_write_config8(PCI_DEV(0, 0x00, 0), PAM4, 0x33);
+ pci_write_config8(PCI_DEV(0, 0x00, 0), PAM5, 0x33);
+ pci_write_config8(PCI_DEV(0, 0x00, 0), PAM6, 0x33);
+}
+
static void sandybridge_setup_bars(void)
{
printk(BIOS_DEBUG, "Setting up static northbridge registers...");
@@ -36,15 +75,6 @@ static void sandybridge_setup_bars(void)
pci_write_config32(PCI_DEV(0, 0x00, 0), DMIBAR, (uintptr_t)DEFAULT_DMIBAR | 1);
pci_write_config32(PCI_DEV(0, 0x00, 0), DMIBAR + 4, (0LL+(uintptr_t)DEFAULT_DMIBAR) >> 32);
- /* Set C0000-FFFFF to access RAM on both reads and writes */
- pci_write_config8(PCI_DEV(0, 0x00, 0), PAM0, 0x30);
- pci_write_config8(PCI_DEV(0, 0x00, 0), PAM1, 0x33);
- pci_write_config8(PCI_DEV(0, 0x00, 0), PAM2, 0x33);
- pci_write_config8(PCI_DEV(0, 0x00, 0), PAM3, 0x33);
- pci_write_config8(PCI_DEV(0, 0x00, 0), PAM4, 0x33);
- pci_write_config8(PCI_DEV(0, 0x00, 0), PAM5, 0x33);
- pci_write_config8(PCI_DEV(0, 0x00, 0), PAM6, 0x33);
-
printk(BIOS_DEBUG, " done\n");
}
@@ -156,7 +186,7 @@ static void start_peg_link_training(void)
}
}
-void sandybridge_early_initialization(void)
+void systemagent_early_init(void)
{
u32 capid0_a;
u32 deven;
@@ -179,8 +209,11 @@ void sandybridge_early_initialization(void)
/* Setup all BARs required for early PCIe and raminit */
sandybridge_setup_bars();
+ /* Set C0000-FFFFF to access RAM on both reads and writes */
+ enable_pam_region();
+
/* Setup IOMMU BARs */
- sandybridge_init_iommu();
+ systemagent_vtd_init();
/* Device Enable, don't touch PEG bits */
deven = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN) | DEVEN_IGD;
diff --git a/src/northbridge/intel/sandybridge/iommu.c b/src/northbridge/intel/sandybridge/iommu.c
deleted file mode 100644
index 339397d068..0000000000
--- a/src/northbridge/intel/sandybridge/iommu.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2015 secunet Security Networks AG
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; version 2 of
- * the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include
-
-#include
-#include
-#include
-#include
-
-#include "sandybridge.h"
-
-void sandybridge_init_iommu(void)
-{
- const u32 capid0_a = pci_read_config32(PCI_DEV(0, 0, 0), 0xe4);
- if (capid0_a & (1 << 23))
- return;
-
- /* setup BARs */
- MCHBAR32(0x5404) = IOMMU_BASE1 >> 32;
- MCHBAR32(0x5400) = IOMMU_BASE1 | 1;
- MCHBAR32(0x5414) = IOMMU_BASE2 >> 32;
- MCHBAR32(0x5410) = IOMMU_BASE2 | 1;
-
- /* lock policies */
- write32((void *)(IOMMU_BASE1 + 0xff0), 0x80000000);
-
- const struct device *const azalia = pcidev_on_root(0x1b, 0);
- if (azalia && azalia->enabled) {
- write32((void *)(IOMMU_BASE2 + 0xff0), 0x20000000);
- write32((void *)(IOMMU_BASE2 + 0xff0), 0xa0000000);
- } else {
- write32((void *)(IOMMU_BASE2 + 0xff0), 0x80000000);
- }
-}
diff --git a/src/northbridge/intel/sandybridge/romstage.c b/src/northbridge/intel/sandybridge/romstage.c
index 76b3088388..2cef5f2605 100644
--- a/src/northbridge/intel/sandybridge/romstage.c
+++ b/src/northbridge/intel/sandybridge/romstage.c
@@ -74,8 +74,8 @@ void mainboard_romstage_entry(unsigned long bist)
/* Perform some early chipset initialization required
* before RAM initialization can work
*/
- sandybridge_early_initialization();
- printk(BIOS_DEBUG, "Back from sandybridge_early_initialization()\n");
+ systemagent_early_init();
+ printk(BIOS_DEBUG, "Back from systemagent_early_init()\n");
s3resume = southbridge_detect_s3_resume();
diff --git a/src/northbridge/intel/sandybridge/sandybridge.h b/src/northbridge/intel/sandybridge/sandybridge.h
index 77165f6931..88b7b56864 100644
--- a/src/northbridge/intel/sandybridge/sandybridge.h
+++ b/src/northbridge/intel/sandybridge/sandybridge.h
@@ -216,7 +216,7 @@ static inline void barrier(void) { asm("" ::: "memory"); }
void intel_sandybridge_finalize_smm(void);
#else /* !__SMM__ */
int bridge_silicon_revision(void);
-void sandybridge_early_initialization(void);
+void systemagent_early_init(void);
void sandybridge_init_iommu(void);
void sandybridge_late_initialization(void);
void northbridge_romstage_finalize(int s3resume);
diff --git a/src/security/vboot/vboot_logic.c b/src/security/vboot/vboot_logic.c
index 626310010c..7b98be28e4 100644
--- a/src/security/vboot/vboot_logic.c
+++ b/src/security/vboot/vboot_logic.c
@@ -364,8 +364,7 @@ void verstage_main(void)
printk(BIOS_INFO, "Recovery requested (%x)\n", rv);
save_if_needed(&ctx);
extend_pcrs(&ctx); /* ignore failures */
- timestamp_add_now(TS_END_VBOOT);
- return;
+ goto verstage_main_exit;
}
printk(BIOS_INFO, "Reboot requested (%x)\n", rv);
@@ -447,6 +446,8 @@ void verstage_main(void)
printk(BIOS_INFO, "Slot %c is selected\n", is_slot_a(&ctx) ? 'A' : 'B');
vboot_set_selected_region(region_device_region(&fw_main));
+
+ verstage_main_exit:
vboot_finalize_work_context(&ctx);
timestamp_add_now(TS_END_VBOOT);
}
diff --git a/src/soc/amd/stoneyridge/acpi/gpio_lib.asl b/src/soc/amd/common/acpi/gpio_bank_lib.asl
similarity index 100%
rename from src/soc/amd/stoneyridge/acpi/gpio_lib.asl
rename to src/soc/amd/common/acpi/gpio_bank_lib.asl
diff --git a/src/soc/amd/stoneyridge/acpi/lpc.asl b/src/soc/amd/common/acpi/lpc.asl
similarity index 100%
rename from src/soc/amd/stoneyridge/acpi/lpc.asl
rename to src/soc/amd/common/acpi/lpc.asl
diff --git a/src/soc/amd/common/block/acpi/Kconfig b/src/soc/amd/common/block/acpi/Kconfig
new file mode 100644
index 0000000000..2b87f186fb
--- /dev/null
+++ b/src/soc/amd/common/block/acpi/Kconfig
@@ -0,0 +1,6 @@
+config SOC_AMD_COMMON_BLOCK_ACPI
+ bool
+ depends on SOC_AMD_COMMON_BLOCK_ACPIMMIO
+ default n
+ help
+ Select this option to use the AcpiMmio ACPI registers.
diff --git a/src/soc/amd/common/block/acpi/Makefile.inc b/src/soc/amd/common/block/acpi/Makefile.inc
index b67eadab8f..708631a5e9 100644
--- a/src/soc/amd/common/block/acpi/Makefile.inc
+++ b/src/soc/amd/common/block/acpi/Makefile.inc
@@ -1,2 +1,6 @@
-ramstage-y += halt.c
-smm-y += halt.c
+bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
+verstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
+romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
+postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
+smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI) += acpi.c
diff --git a/src/soc/amd/common/block/acpi/acpi.c b/src/soc/amd/common/block/acpi/acpi.c
new file mode 100644
index 0000000000..e18933bb81
--- /dev/null
+++ b/src/soc/amd/common/block/acpi/acpi.c
@@ -0,0 +1,181 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+void poweroff(void)
+{
+ acpi_write32(MMIO_ACPI_PM1_CNT_BLK,
+ (SLP_TYP_S5 << SLP_TYP_SHIFT) | SLP_EN);
+
+ /*
+ * Setting SLP_TYP_S5 in PM1 triggers SLP_SMI, which is handled by SMM
+ * to transition to S5 state. If halt is called in SMM, then it prevents
+ * the SMI handler from being triggered and system never enters S5.
+ */
+ if (!ENV_SMM)
+ halt();
+}
+
+static uint16_t reset_pm1_status(void)
+{
+ uint16_t pm1_sts = acpi_read16(MMIO_ACPI_PM1_STS);
+ acpi_write16(MMIO_ACPI_PM1_STS, pm1_sts);
+ return pm1_sts;
+}
+
+static void print_num_status_bits(int num_bits, uint32_t status,
+ const char *const bit_names[])
+{
+ int i;
+
+ if (!status)
+ return;
+
+ for (i = num_bits - 1; i >= 0; i--) {
+ if (status & (1 << i)) {
+ if (bit_names[i])
+ printk(BIOS_DEBUG, "%s ", bit_names[i]);
+ else
+ printk(BIOS_DEBUG, "BIT%d ", i);
+ }
+ }
+}
+
+static uint16_t print_pm1_status(uint16_t pm1_sts)
+{
+ static const char *const pm1_sts_bits[16] = {
+ [0] = "TMROF",
+ [4] = "BMSTATUS",
+ [5] = "GBL",
+ [8] = "PWRBTN",
+ [10] = "RTC",
+ [14] = "PCIEXPWAK",
+ [15] = "WAK",
+ };
+
+ if (!pm1_sts)
+ return 0;
+
+ printk(BIOS_DEBUG, "PM1_STS: ");
+ print_num_status_bits(ARRAY_SIZE(pm1_sts_bits), pm1_sts, pm1_sts_bits);
+ printk(BIOS_DEBUG, "\n");
+
+ return pm1_sts;
+}
+
+static void log_pm1_status(uint16_t pm1_sts)
+{
+ if (!CONFIG(ELOG))
+ return;
+
+ if (pm1_sts & WAK_STS)
+ elog_add_event_byte(ELOG_TYPE_ACPI_WAKE,
+ acpi_is_wakeup_s3() ? ACPI_S3 : ACPI_S5);
+
+ if (pm1_sts & PWRBTN_STS)
+ elog_add_event_wake(ELOG_WAKE_SOURCE_PWRBTN, 0);
+
+ if (pm1_sts & RTC_STS)
+ elog_add_event_wake(ELOG_WAKE_SOURCE_RTC, 0);
+
+ if (pm1_sts & PCIEXPWAK_STS)
+ elog_add_event_wake(ELOG_WAKE_SOURCE_PCIE, 0);
+}
+
+static void save_sws(uint16_t pm1_status)
+{
+ struct soc_power_reg *sws;
+ uint32_t reg32;
+ uint16_t reg16;
+
+ sws = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(struct soc_power_reg));
+ if (sws == NULL)
+ return;
+ sws->pm1_sts = pm1_status;
+ sws->pm1_en = acpi_read16(MMIO_ACPI_PM1_EN);
+ reg32 = acpi_read32(MMIO_ACPI_GPE0_STS);
+ acpi_write32(MMIO_ACPI_GPE0_STS, reg32);
+ sws->gpe0_sts = reg32;
+ sws->gpe0_en = acpi_read32(MMIO_ACPI_GPE0_EN);
+ reg16 = acpi_read16(MMIO_ACPI_PM1_CNT_BLK);
+ reg16 &= SLP_TYP;
+ sws->wake_from = reg16 >> SLP_TYP_SHIFT;
+}
+
+void acpi_clear_pm1_status(void)
+{
+ uint16_t pm1_sts = reset_pm1_status();
+
+ save_sws(pm1_sts);
+ log_pm1_status(pm1_sts);
+ print_pm1_status(pm1_sts);
+}
+
+int acpi_get_sleep_type(void)
+{
+ return acpi_sleep_from_pm1(acpi_read16(MMIO_ACPI_PM1_CNT_BLK));
+}
+
+int vboot_platform_is_resuming(void)
+{
+ if (!(acpi_read16(MMIO_ACPI_PM1_STS) & WAK_STS))
+ return 0;
+
+ return acpi_get_sleep_type() == ACPI_S3;
+}
+
+/* If a system reset is about to be requested, modify the PM1 register so it
+ * will never be misinterpreted as an S3 resume. */
+void set_pm1cnt_s5(void)
+{
+ uint16_t pm1;
+
+ pm1 = acpi_read16(MMIO_ACPI_PM1_CNT_BLK);
+ pm1 &= ~SLP_TYP;
+ pm1 |= SLP_TYP_S5 << SLP_TYP_SHIFT;
+ acpi_write16(MMIO_ACPI_PM1_CNT_BLK, pm1);
+}
+
+void vboot_platform_prepare_reboot(void)
+{
+ set_pm1cnt_s5();
+}
+
+void acpi_enable_sci(void)
+{
+ uint32_t pm1;
+
+ pm1 = acpi_read32(MMIO_ACPI_PM1_CNT_BLK);
+ pm1 |= ACPI_PM1_CNT_SCIEN;
+ acpi_write32(MMIO_ACPI_PM1_CNT_BLK, pm1);
+}
+
+void acpi_disable_sci(void)
+{
+ uint32_t pm1;
+
+ pm1 = acpi_read32(MMIO_ACPI_PM1_CNT_BLK);
+ pm1 &= ~ACPI_PM1_CNT_SCIEN;
+ acpi_write32(MMIO_ACPI_PM1_CNT_BLK, pm1);
+}
diff --git a/src/soc/amd/common/block/acpimmio/mmio_util.c b/src/soc/amd/common/block/acpimmio/mmio_util.c
index 7d4c4c5df1..edb3882e6f 100644
--- a/src/soc/amd/common/block/acpimmio/mmio_util.c
+++ b/src/soc/amd/common/block/acpimmio/mmio_util.c
@@ -67,38 +67,41 @@ void pm_io_write32(uint8_t reg, uint32_t value)
/* smbus pci read/write - access registers at 0xfed80000 - currently unused */
+#if SUPPORTS_ACPIMMIO_SMI_BASE
/* smi read/write - access registers at 0xfed80200 */
-uint8_t smi_read8(uint8_t offset)
+uint8_t smi_read8(uint8_t reg)
{
- return read8((void *)(ACPIMMIO_SMI_BASE + offset));
+ return read8((void *)(ACPIMMIO_SMI_BASE + reg));
}
-uint16_t smi_read16(uint8_t offset)
+uint16_t smi_read16(uint8_t reg)
{
- return read16((void *)(ACPIMMIO_SMI_BASE + offset));
+ return read16((void *)(ACPIMMIO_SMI_BASE + reg));
}
-uint32_t smi_read32(uint8_t offset)
+uint32_t smi_read32(uint8_t reg)
{
- return read32((void *)(ACPIMMIO_SMI_BASE + offset));
+ return read32((void *)(ACPIMMIO_SMI_BASE + reg));
}
-void smi_write8(uint8_t offset, uint8_t value)
+void smi_write8(uint8_t reg, uint8_t value)
{
- write8((void *)(ACPIMMIO_SMI_BASE + offset), value);
+ write8((void *)(ACPIMMIO_SMI_BASE + reg), value);
}
-void smi_write16(uint8_t offset, uint16_t value)
+void smi_write16(uint8_t reg, uint16_t value)
{
- write16((void *)(ACPIMMIO_SMI_BASE + offset), value);
+ write16((void *)(ACPIMMIO_SMI_BASE + reg), value);
}
-void smi_write32(uint8_t offset, uint32_t value)
+void smi_write32(uint8_t reg, uint32_t value)
{
- write32((void *)(ACPIMMIO_SMI_BASE + offset), value);
+ write32((void *)(ACPIMMIO_SMI_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_SMI_BASE */
+#if SUPPORTS_ACPIMMIO_PMIO_BASE
/* pm read/write - access registers at 0xfed80300 */
u8 pm_read8(u8 reg)
@@ -130,58 +133,60 @@ void pm_write32(u8 reg, u32 value)
{
write32((void *)(ACPIMMIO_PMIO_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_PMIO_BASE */
-/* pm2 read/write - access registers at 0xfed80400 - currently unused */
+#if SUPPORTS_ACPIMMIO_PMIO2_BASE
+/* pm2 read/write - access registers at 0xfed80400 - currently unused by any soc */
+#endif
+#if SUPPORTS_ACPIMMIO_BIOSRAM_BASE
/* biosram read/write - access registers at 0xfed80500 */
-uint8_t biosram_read8(uint8_t offset)
+uint8_t biosram_read8(uint8_t reg)
{
- return read8((void *)(ACPIMMIO_BIOSRAM_BASE + offset));
+ return read8((void *)(ACPIMMIO_BIOSRAM_BASE + reg));
}
-uint16_t biosram_read16(uint8_t offset) /* Must be 1 byte at a time */
+uint16_t biosram_read16(uint8_t reg) /* Must be 1 byte at a time */
{
- int i;
- uint16_t value = 0;
- for (i = sizeof(value) - 1 ; i >= 0 ; i--)
- value = (value << 8) | biosram_read8(offset + i);
- return value;
+ return (biosram_read8(reg + sizeof(uint8_t)) << 8 | biosram_read8(reg));
}
-uint32_t biosram_read32(uint8_t offset)
+uint32_t biosram_read32(uint8_t reg)
{
- uint32_t value = biosram_read16(offset + sizeof(uint16_t)) << 16;
- return value | biosram_read16(offset);
+ uint32_t value = biosram_read16(reg + sizeof(uint16_t)) << 16;
+ return value | biosram_read16(reg);
}
-void biosram_write8(uint8_t offset, uint8_t value)
+void biosram_write8(uint8_t reg, uint8_t value)
{
- write8((void *)(ACPIMMIO_BIOSRAM_BASE + offset), value);
+ write8((void *)(ACPIMMIO_BIOSRAM_BASE + reg), value);
}
-void biosram_write16(uint8_t offset, uint16_t value)
+void biosram_write16(uint8_t reg, uint16_t value)
{
- int i;
- for (i = 0 ; i < sizeof(value) ; i++) {
- biosram_write8(offset + i, value & 0xff);
- value >>= 8;
- }
+ biosram_write8(reg, value & 0xff);
+ value >>= 8;
+ biosram_write8(reg + sizeof(uint8_t), value & 0xff);
}
-void biosram_write32(uint8_t offset, uint32_t value)
+void biosram_write32(uint8_t reg, uint32_t value)
{
- int i;
- for (i = 0 ; i < sizeof(value) ; i++) {
- biosram_write8(offset + i, value & 0xff);
- value >>= 8;
- }
+ biosram_write16(reg, value & 0xffff);
+ value >>= 16;
+ biosram_write16(reg + sizeof(uint16_t), value & 0xffff);
}
+#endif /* SUPPORTS_ACPIMMIO_BIOSRAM_BASE */
-/* cmosram read/write - access registers at 0xfed80600 - currently unused */
+#if SUPPORTS_ACPIMMIO_CMOSRAM_BASE
+/* cmosram read/write - access registers at 0xfed80600 - currently unused by any soc */
+#endif
-/* cmos read/write - access registers at 0xfed80700 - currently unused */
+#if SUPPORTS_ACPIMMIO_CMOS_BASE
+/* cmos read/write - access registers at 0xfed80700 - currently unused by any soc */
+#endif
+#if SUPPORTS_ACPIMMIO_ACPI_BASE
/* acpi read/write - access registers at 0xfed80800 */
u8 acpi_read8(u8 reg)
@@ -213,8 +218,10 @@ void acpi_write32(u8 reg, u32 value)
{
write32((void *)(ACPIMMIO_ACPI_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_ACPI_BASE */
-/* asf read/write - access registers at 0xfed80900 - not currently used */
+#if SUPPORTS_ACPIMMIO_ASF_BASE
+/* asf read/write - access registers at 0xfed80900 */
u8 asf_read8(u8 reg)
{
@@ -235,8 +242,10 @@ void asf_write16(u8 reg, u16 value)
{
write16((void *)(ACPIMMIO_ASF_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_ASF_BASE */
-/* smbus read/write - access registers at 0xfed80a00 and ASF at 0xfed80900 */
+#if SUPPORTS_ACPIMMIO_SMBUS_BASE
+/* smbus read/write - access registers at 0xfed80a00 */
u8 smbus_read8(u8 reg)
{
@@ -257,11 +266,17 @@ void smbus_write16(u8 reg, u16 value)
{
write16((void *)(ACPIMMIO_SMBUS_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_SMBUS_BASE */
-/* wdt read/write - access registers at 0xfed80b00 - not currently used */
+#if SUPPORTS_ACPIMMIO_WDT_BASE
+/* wdt read/write - access registers at 0xfed80b00 - not currently used by any soc */
+#endif
-/* hpet read/write - access registers at 0xfed80c00 - not currently used */
+#if SUPPORTS_ACPIMMIO_HPET_BASE
+/* hpet read/write - access registers at 0xfed80c00 - not currently used by any soc */
+#endif
+#if SUPPORTS_ACPIMMIO_IOMUX_BASE
/* iomux read/write - access registers at 0xfed80d00 */
u8 iomux_read8(u8 reg)
@@ -293,7 +308,9 @@ void iomux_write32(u8 reg, u32 value)
{
write32((void *)(ACPIMMIO_IOMUX_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_IOMUX_BASE */
+#if SUPPORTS_ACPIMMIO_MISC_BASE
/* misc read/write - access registers at 0xfed80e00 */
u8 misc_read8(u8 reg)
@@ -325,13 +342,25 @@ void misc_write32(u8 reg, u32 value)
{
write32((void *)(ACPIMMIO_MISC_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_MISC_BASE */
-/* dpvga read/write - access registers at 0xfed81400 - not currently used */
+#if SUPPORTS_ACPIMMIO_DPVGA_BASE
+/* dpvga read/write - access registers at 0xfed81400 - not currently used by any soc */
+#endif
-/* gpio bk 0 read/write - access registers at 0xfed81500 - not currently used */
-/* gpio bk 1 read/write - access registers at 0xfed81600 - not currently used */
-/* gpio bk 2 read/write - access registers at 0xfed81700 - not currently used */
+#if SUPPORTS_ACPIMMIO_GPIO0_BASE || SUPPORTS_ACPIMMIO_GPIO1_BASE \
+ || SUPPORTS_ACPIMMIO_GPIO2_BASE
+/*
+ * No helpers are currently in use however common/block//gpio.c accesses
+ * the registers directly.
+ */
+/* gpio bk 0 read/write - access registers at 0xfed81500 */
+/* gpio bk 1 read/write - access registers at 0xfed81600 */
+/* gpio bk 2 read/write - access registers at 0xfed81700 */
+#endif
+
+#if SUPPORTS_ACPIMMIO_XHCIPM_BASE
/* xhci_pm read/write - access registers at 0xfed81c00 */
uint8_t xhci_pm_read8(uint8_t reg)
@@ -363,10 +392,14 @@ void xhci_pm_write32(uint8_t reg, uint32_t value)
{
write32((void *)(ACPIMMIO_XHCIPM_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_XHCIPM_BASE */
-/* acdc_tmr read/write - access registers at 0xfed81d00 */
+#if SUPPORTS_ACPIMMIO_ACDCTMR_BASE
+/* acdc_tmr read/write - access registers at 0xfed81d00 - not currently used by any soc */
+#endif
-/* aoac read/write - access registers at 0xfed81e00 - not currently used */
+#if SUPPORTS_ACPIMMIO_AOAC_BASE
+/* aoac read/write - access registers at 0xfed81e00 */
u8 aoac_read8(u8 reg)
{
@@ -377,3 +410,4 @@ void aoac_write8(u8 reg, u8 value)
{
write8((void *)(ACPIMMIO_AOAC_BASE + reg), value);
}
+#endif /* SUPPORTS_ACPIMMIO_AOAC_BASE */
diff --git a/src/soc/amd/common/block/alink/Kconfig b/src/soc/amd/common/block/alink/Kconfig
new file mode 100644
index 0000000000..75cf66f194
--- /dev/null
+++ b/src/soc/amd/common/block/alink/Kconfig
@@ -0,0 +1,5 @@
+config SOC_AMD_COMMON_BLOCK_ALINK
+ bool
+ default n
+ help
+ Select this option to access the FCH A-link configuration registers.
diff --git a/src/soc/amd/common/block/alink/Makefile.inc b/src/soc/amd/common/block/alink/Makefile.inc
new file mode 100644
index 0000000000..720a7cbd82
--- /dev/null
+++ b/src/soc/amd/common/block/alink/Makefile.inc
@@ -0,0 +1,6 @@
+bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
+verstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
+romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
+postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
+smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_ALINK) += alink.c
diff --git a/src/soc/amd/common/block/alink/alink.c b/src/soc/amd/common/block/alink/alink.c
new file mode 100644
index 0000000000..f481f6b340
--- /dev/null
+++ b/src/soc/amd/common/block/alink/alink.c
@@ -0,0 +1,95 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+
+void alink_ab_indx(u32 reg_space, u32 reg_addr, u32 mask, u32 val)
+{
+ u32 tmp;
+
+ outl((reg_space & 0x7) << 29 | reg_addr, AB_INDX);
+ tmp = inl(AB_DATA);
+ /* rpr 4.2
+ * For certain revisions of the chip, the ABCFG registers,
+ * with an address of 0x100NN (where 'N' is any hexadecimal
+ * number), require an extra programming step.*/
+ outl(0, AB_INDX);
+
+ tmp &= ~mask;
+ tmp |= val;
+
+ // printk(BIOS_DEBUG, "about write %x, index=%x", tmp,
+ // (reg_space&0x3)<<29 | reg_addr);
+
+ /* probably we dont have to do it again. */
+ outl((reg_space & 0x7) << 29 | reg_addr, AB_INDX);
+ outl(tmp, AB_DATA);
+ outl(0, AB_INDX);
+}
+
+void alink_rc_indx(u32 reg_space, u32 reg_addr, u32 port, u32 mask, u32 val)
+{
+ u32 tmp;
+
+ outl((reg_space & 0x7) << 29 | (port & 3) << 24 | reg_addr, AB_INDX);
+ tmp = inl(AB_DATA);
+ /* rpr 4.2
+ * For certain revisions of the chip, the ABCFG registers,
+ * with an address of 0x100NN (where 'N' is any hexadecimal
+ * number), require an extra programming step.*/
+ outl(0, AB_INDX);
+
+ tmp &= ~mask;
+ tmp |= val;
+
+ //printk(BIOS_DEBUG, "about write %x, index=%x", tmp,
+ // (reg_space&0x3)<<29 | (port&3) << 24 | reg_addr);
+
+ /* probably we dont have to do it again. */
+ outl((reg_space & 0x7) << 29 | (port & 3) << 24 | reg_addr, AB_INDX);
+ outl(tmp, AB_DATA);
+ outl(0, AB_INDX);
+}
+
+/*
+ * space = 0: AX_INDXC, AX_DATAC
+ * space = 1: AX_INDXP, AX_DATAP
+ */
+void alink_ax_indx(u32 space /*c or p? */, u32 axindc, u32 mask, u32 val)
+{
+ u32 tmp;
+
+ /* read axindc to tmp */
+ outl(space << 29 | space << 3 | 0x30, AB_INDX);
+ outl(axindc, AB_DATA);
+ outl(0, AB_INDX);
+ outl(space << 29 | space << 3 | 0x34, AB_INDX);
+ tmp = inl(AB_DATA);
+ outl(0, AB_INDX);
+
+ tmp &= ~mask;
+ tmp |= val;
+
+ /* write tmp */
+ outl(space << 29 | space << 3 | 0x30, AB_INDX);
+ outl(axindc, AB_DATA);
+ outl(0, AB_INDX);
+ outl(space << 29 | space << 3 | 0x34, AB_INDX);
+ outl(tmp, AB_DATA);
+ outl(0, AB_INDX);
+}
diff --git a/src/soc/amd/common/block/gpio_banks/Kconfig b/src/soc/amd/common/block/gpio_banks/Kconfig
new file mode 100644
index 0000000000..115aa2cc52
--- /dev/null
+++ b/src/soc/amd/common/block/gpio_banks/Kconfig
@@ -0,0 +1,8 @@
+config SOC_AMD_COMMON_BLOCK_BANKED_GPIOS
+ bool
+ depends on SOC_AMD_COMMON_BLOCK_ACPIMMIO
+ default n
+ help
+ Select this option to use the newer style banks of GPIO signals.
+ These are at offsets +0x1500, +0x1600, and +0x1700 from the AcpiMmio
+ base.
diff --git a/src/soc/amd/common/block/gpio_banks/Makefile.inc b/src/soc/amd/common/block/gpio_banks/Makefile.inc
new file mode 100644
index 0000000000..f1555b12b8
--- /dev/null
+++ b/src/soc/amd/common/block/gpio_banks/Makefile.inc
@@ -0,0 +1,6 @@
+bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
+verstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
+romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
+postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
+smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_BANKED_GPIOS) += gpio.c
diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c
new file mode 100644
index 0000000000..17e3de09e3
--- /dev/null
+++ b/src/soc/amd/common/block/gpio_banks/gpio.c
@@ -0,0 +1,310 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Google Inc.
+ * Copyright (C) 2015 Intel Corporation
+ * Copyright (C) 2017 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+static int get_gpio_gevent(uint8_t gpio, const struct soc_amd_event *table,
+ size_t items)
+{
+ int i;
+
+ for (i = 0; i < items; i++) {
+ if ((table + i)->gpio == gpio)
+ return (int)(table + i)->event;
+ }
+ return -1;
+}
+
+static void mem_read_write32(uint32_t *address, uint32_t value, uint32_t mask)
+{
+ uint32_t reg32;
+
+ value &= mask;
+ reg32 = read32(address);
+ reg32 &= ~mask;
+ reg32 |= value;
+ write32(address, reg32);
+}
+
+static void program_smi(uint32_t flag, int gevent_num)
+{
+ uint32_t trigger;
+
+ trigger = flag & FLAGS_TRIGGER_MASK;
+ /*
+ * Only level trigger is allowed for SMI. Trigger values are 0
+ * through 3, with 0-1 being level trigger and 2-3 being edge
+ * trigger. GPIO_TRIGGER_EDGE_LOW is 2, so trigger has to be
+ * less than GPIO_TRIGGER_EDGE_LOW.
+ */
+ assert(trigger < GPIO_TRIGGER_EDGE_LOW);
+
+ if (trigger == GPIO_TRIGGER_LEVEL_HIGH)
+ configure_gevent_smi(gevent_num, SMI_MODE_SMI,
+ SMI_SCI_LVL_HIGH);
+ if (trigger == GPIO_TRIGGER_LEVEL_LOW)
+ configure_gevent_smi(gevent_num, SMI_MODE_SMI,
+ SMI_SCI_LVL_LOW);
+}
+
+static void get_sci_config_bits(uint32_t flag, uint32_t *edge, uint32_t *level)
+{
+ uint32_t trigger;
+
+ trigger = flag & FLAGS_TRIGGER_MASK;
+ switch (trigger) {
+ case GPIO_TRIGGER_LEVEL_LOW:
+ *edge = SCI_TRIGGER_LEVEL;
+ *level = 0;
+ break;
+ case GPIO_TRIGGER_LEVEL_HIGH:
+ *edge = SCI_TRIGGER_LEVEL;
+ *level = 1;
+ break;
+ case GPIO_TRIGGER_EDGE_LOW:
+ *edge = SCI_TRIGGER_EDGE;
+ *level = 0;
+ break;
+ case GPIO_TRIGGER_EDGE_HIGH:
+ *edge = SCI_TRIGGER_EDGE;
+ *level = 1;
+ break;
+ default:
+ break;
+ }
+}
+
+uintptr_t gpio_get_address(gpio_t gpio_num)
+{
+ uintptr_t gpio_address;
+
+ if (gpio_num < 64)
+ gpio_address = GPIO_BANK0_CONTROL(gpio_num);
+ else if (gpio_num < 128)
+ gpio_address = GPIO_BANK1_CONTROL(gpio_num);
+ else
+ gpio_address = GPIO_BANK2_CONTROL(gpio_num);
+
+ return gpio_address;
+}
+
+int gpio_get(gpio_t gpio_num)
+{
+ uint32_t reg;
+ uintptr_t gpio_address = gpio_get_address(gpio_num);
+
+ reg = read32((void *)gpio_address);
+
+ return !!(reg & GPIO_PIN_STS);
+}
+
+void gpio_set(gpio_t gpio_num, int value)
+{
+ uint32_t reg;
+ uintptr_t gpio_address = gpio_get_address(gpio_num);
+
+ reg = read32((void *)gpio_address);
+ reg &= ~GPIO_OUTPUT_MASK;
+ reg |= !!value << GPIO_OUTPUT_SHIFT;
+ write32((void *)gpio_address, reg);
+}
+
+void gpio_input_pulldown(gpio_t gpio_num)
+{
+ uint32_t reg;
+ uintptr_t gpio_address = gpio_get_address(gpio_num);
+
+ reg = read32((void *)gpio_address);
+ reg &= ~GPIO_PULLUP_ENABLE;
+ reg |= GPIO_PULLDOWN_ENABLE;
+ write32((void *)gpio_address, reg);
+}
+
+void gpio_input_pullup(gpio_t gpio_num)
+{
+ uint32_t reg;
+ uintptr_t gpio_address = gpio_get_address(gpio_num);
+
+ reg = read32((void *)gpio_address);
+ reg &= ~GPIO_PULLDOWN_ENABLE;
+ reg |= GPIO_PULLUP_ENABLE;
+ write32((void *)gpio_address, reg);
+}
+
+void gpio_input(gpio_t gpio_num)
+{
+ uint32_t reg;
+ uintptr_t gpio_address = gpio_get_address(gpio_num);
+
+ reg = read32((void *)gpio_address);
+ reg &= ~GPIO_OUTPUT_ENABLE;
+ write32((void *)gpio_address, reg);
+}
+
+void gpio_output(gpio_t gpio_num, int value)
+{
+ uint32_t reg;
+ uintptr_t gpio_address = gpio_get_address(gpio_num);
+
+ reg = read32((void *)gpio_address);
+ reg |= GPIO_OUTPUT_ENABLE;
+ write32((void *)gpio_address, reg);
+ gpio_set(gpio_num, value);
+}
+
+const char *gpio_acpi_path(gpio_t gpio)
+{
+ return "\\_SB.GPIO";
+}
+
+uint16_t gpio_acpi_pin(gpio_t gpio)
+{
+ return gpio;
+}
+
+__weak void soc_gpio_hook(uint8_t gpio, uint8_t mux) {}
+
+void program_gpios(const struct soc_amd_gpio *gpio_list_ptr, size_t size)
+{
+ uint32_t *gpio_ptr, *inter_master;
+ uint32_t control, control_flags, edge_level, direction;
+ uint32_t mask, bit_edge, bit_level;
+ uint8_t mux, index, gpio;
+ int gevent_num;
+ const struct soc_amd_event *gev_tbl;
+ size_t gev_items;
+
+ inter_master = (uint32_t *)(uintptr_t)(ACPIMMIO_GPIO0_BASE
+ + GPIO_MASTER_SWITCH);
+ direction = 0;
+ edge_level = 0;
+ mask = 0;
+
+ /*
+ * Disable blocking wake/interrupt status generation while updating
+ * debounce registers. Otherwise when a debounce register is updated
+ * the whole GPIO controller will zero out all interrupt enable status
+ * bits while the delay happens. This could cause us to drop the bits
+ * due to the read-modify-write that happens on each register.
+ *
+ * Additionally disable interrupt generation so we don't get any
+ * spurious interrupts while updating the registers.
+ */
+ mem_read_write32(inter_master, 0, GPIO_MASK_STS_EN | GPIO_INTERRUPT_EN);
+
+ soc_get_gpio_event_table(&gev_tbl, &gev_items);
+
+ for (index = 0; index < size; index++) {
+ gpio = gpio_list_ptr[index].gpio;
+ mux = gpio_list_ptr[index].function;
+ control = gpio_list_ptr[index].control;
+ control_flags = gpio_list_ptr[index].flags;
+
+ iomux_write8(gpio, mux & AMD_GPIO_MUX_MASK);
+ iomux_read8(gpio); /* Flush posted write */
+
+ soc_gpio_hook(gpio, mux);
+
+ gpio_ptr = (uint32_t *)gpio_get_address(gpio);
+
+ if (control_flags & GPIO_SPECIAL_FLAG) {
+ gevent_num = get_gpio_gevent(gpio, gev_tbl, gev_items);
+ if (gevent_num < 0) {
+ printk(BIOS_WARNING, "Warning: GPIO pin %d has"
+ " no associated gevent!\n", gpio);
+ continue;
+ }
+ switch (control_flags & GPIO_SPECIAL_MASK) {
+ case GPIO_DEBOUNCE_FLAG:
+ mem_read_write32(gpio_ptr, control,
+ GPIO_DEBOUNCE_MASK);
+ break;
+ case GPIO_WAKE_FLAG:
+ mem_read_write32(gpio_ptr, control,
+ INT_WAKE_MASK);
+ break;
+ case GPIO_INT_FLAG:
+ mem_read_write32(gpio_ptr, control,
+ AMD_GPIO_CONTROL_MASK);
+ break;
+ case GPIO_SMI_FLAG:
+ mem_read_write32(gpio_ptr, control,
+ INT_SCI_SMI_MASK);
+ program_smi(control_flags, gevent_num);
+ break;
+ case GPIO_SCI_FLAG:
+ mem_read_write32(gpio_ptr, control,
+ INT_SCI_SMI_MASK);
+ get_sci_config_bits(control_flags, &bit_edge,
+ &bit_level);
+ edge_level |= bit_edge << gevent_num;
+ direction |= bit_level << gevent_num;
+ mask |= (1 << gevent_num);
+ soc_route_sci(gevent_num);
+ break;
+ default:
+ printk(BIOS_WARNING, "Error, flags 0x%08x\n",
+ control_flags);
+ break;
+ }
+ } else {
+ mem_read_write32(gpio_ptr, control,
+ AMD_GPIO_CONTROL_MASK);
+ }
+ }
+
+ /*
+ * Re-enable interrupt status generation.
+ *
+ * We leave MASK_STATUS disabled because the kernel may reconfigure the
+ * debounce registers while the drivers load. This will cause interrupts
+ * to be missed during boot.
+ */
+ mem_read_write32(inter_master, GPIO_INTERRUPT_EN, GPIO_INTERRUPT_EN);
+
+ /* Set all SCI trigger direction (high/low) */
+ mem_read_write32((uint32_t *)
+ (uintptr_t)(ACPIMMIO_SMI_BASE + SMI_SCI_TRIG),
+ direction, mask);
+
+ /* Set all SCI trigger level (edge/level) */
+ mem_read_write32((uint32_t *)
+ (uintptr_t)(ACPIMMIO_SMI_BASE + SMI_SCI_LEVEL),
+ edge_level, mask);
+}
+
+int gpio_interrupt_status(gpio_t gpio)
+{
+ uintptr_t gpio_address = gpio_get_address(gpio);
+ uint32_t reg = read32((void *)gpio_address);
+
+ if (reg & GPIO_INT_STATUS) {
+ /* Clear interrupt status, preserve wake status */
+ reg &= ~GPIO_WAKE_STATUS;
+ write32((void *)gpio_address, reg);
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/src/soc/amd/common/block/hda/Kconfig b/src/soc/amd/common/block/hda/Kconfig
new file mode 100644
index 0000000000..775de2fd8c
--- /dev/null
+++ b/src/soc/amd/common/block/hda/Kconfig
@@ -0,0 +1,6 @@
+config SOC_AMD_COMMON_BLOCK_HDA
+ bool
+ default n
+ help
+ Select this option to use AMD common High Definition Audio
+ driver support.
diff --git a/src/soc/amd/common/block/hda/Makefile.inc b/src/soc/amd/common/block/hda/Makefile.inc
new file mode 100644
index 0000000000..d6f1b3275a
--- /dev/null
+++ b/src/soc/amd/common/block/hda/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_HDA) += hda.c
diff --git a/src/soc/amd/stoneyridge/hda.c b/src/soc/amd/common/block/hda/hda.c
similarity index 97%
rename from src/soc/amd/stoneyridge/hda.c
rename to src/soc/amd/common/block/hda/hda.c
index 0ab2f91ee7..f4ea732fba 100644
--- a/src/soc/amd/stoneyridge/hda.c
+++ b/src/soc/amd/common/block/hda/hda.c
@@ -17,7 +17,6 @@
#include
#include
#include
-#include
static const unsigned short pci_device_ids[] = {
PCI_DEVICE_ID_AMD_SB900_HDA,
diff --git a/src/soc/amd/common/block/include/amdblocks/acpi.h b/src/soc/amd/common/block/include/amdblocks/acpi.h
new file mode 100644
index 0000000000..cf266ed7d8
--- /dev/null
+++ b/src/soc/amd/common/block/include/amdblocks/acpi.h
@@ -0,0 +1,42 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 Google, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __AMDBLOCKS_ACPI_H__
+#define __AMDBLOCKS_ACPI_H__
+
+#include
+
+/* ACPI MMIO registers 0xfed80800 */
+#define MMIO_ACPI_PM1_STS 0x00
+#define MMIO_ACPI_PM1_EN 0x02
+#define MMIO_ACPI_PM1_CNT_BLK 0x04
+ /* sleep types defined in arch/x86/include/arch/acpi.h */
+#define ACPI_PM1_CNT_SCIEN BIT(0)
+#define MMIO_ACPI_PM_TMR_BLK 0x08
+#define MMIO_ACPI_CPU_CONTROL 0x0c
+#define MMIO_ACPI_GPE0_STS 0x14
+#define MMIO_ACPI_GPE0_EN 0x18
+
+void acpi_clear_pm1_status(void);
+
+/*
+ * If a system reset is about to be requested, modify the PM1 register so it
+ * will never be misinterpreted as an S3 resume.
+ */
+void set_pm1cnt_s5(void);
+void acpi_enable_sci(void);
+void acpi_disable_sci(void);
+
+#endif /* __AMDBLOCKS_ACPI_H__ */
diff --git a/src/soc/amd/common/block/include/amdblocks/acpimmio.h b/src/soc/amd/common/block/include/amdblocks/acpimmio.h
index e1cf7cbdc2..32da867137 100644
--- a/src/soc/amd/common/block/include/amdblocks/acpimmio.h
+++ b/src/soc/amd/common/block/include/amdblocks/acpimmio.h
@@ -18,83 +18,250 @@
#ifndef __AMDBLOCKS_ACPIMMIO_H__
#define __AMDBLOCKS_ACPIMMIO_H__
+/* iomap.h must indicate if the device uses a block, optional if unused. */
+#include
+#ifndef SUPPORTS_ACPIMMIO_SMI_BASE
+ #define SUPPORTS_ACPIMMIO_SMI_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_PMIO_BASE
+ #define SUPPORTS_ACPIMMIO_PMIO_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_PMIO2_BASE
+ #define SUPPORTS_ACPIMMIO_PMIO2_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_BIOSRAM_BASE
+ #define SUPPORTS_ACPIMMIO_BIOSRAM_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_CMOSRAM_BASE
+ #define SUPPORTS_ACPIMMIO_CMOSRAM_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_CMOS_BASE
+ #define SUPPORTS_ACPIMMIO_CMOS_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_ACPI_BASE
+ #define SUPPORTS_ACPIMMIO_ACPI_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_ASF_BASE
+ #define SUPPORTS_ACPIMMIO_ASF_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_SMBUS_BASE
+ #define SUPPORTS_ACPIMMIO_SMBUS_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_WDT_BASE
+ #define SUPPORTS_ACPIMMIO_WDT_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_HPET_BASE
+ #define SUPPORTS_ACPIMMIO_HPET_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_IOMUX_BASE
+ #define SUPPORTS_ACPIMMIO_IOMUX_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_MISC_BASE
+ #define SUPPORTS_ACPIMMIO_MISC_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_DPVGA_BASE
+ #define SUPPORTS_ACPIMMIO_DPVGA_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_GPIO0_BASE
+ #define SUPPORTS_ACPIMMIO_GPIO0_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_GPIO1_BASE
+ #define SUPPORTS_ACPIMMIO_GPIO1_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_GPIO2_BASE
+ #define SUPPORTS_ACPIMMIO_GPIO2_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_XHCIPM_BASE
+ #define SUPPORTS_ACPIMMIO_XHCIPM_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_ACDCTMR_BASE
+ #define SUPPORTS_ACPIMMIO_ACDCTMR_BASE 0
+#endif
+#ifndef SUPPORTS_ACPIMMIO_AOAC_BASE
+ #define SUPPORTS_ACPIMMIO_AOAC_BASE 0
+#endif
+
+/*
+ * The following AcpiMmio register block mapping represents definitions
+ * that have been documented in AMD publications. All blocks aren't
+ * implemented in all products, so the caller should be careful not to
+ * inadvertently access a non-existent block. The definitions within
+ * each block are also subject to change across products. Please refer
+ * to the appropriate RRG, the BKDG, or PPR for the product.
+ *
+ * The base address is configurable in older products, but defaults to
+ * 0xfed80000. The address is fixed at 0xfed80000 in newer products.
+ *
+ * +---------------------------------------------------------------------------+
+ * |0x000 SMBus PCI space |
+ * | * Dual-mapped to PCI configuration header of D14F0 |
+ * +---------------------------------------------------------------------------+
+ * |0x100 GPIO configuration registers |
+ * | * old style, never implemented with newer style |
+ * +---------------------------------------------------------------------------+
+ * |0x200 SMI configuration registers |
+ * +---------------------------------------------------------------------------+
+ * |0x300 Power Management registers |
+ * | * Dual-mapped via IO Index/Data 0xcd6/0xcd7 (byte access only) |
+ * +---------------------------------------------------------------------------+
+ * |0x400 Power Management 2 registers |
+ * +---------------------------------------------------------------------------+
+ * |0x500 BIOS RAM |
+ * | * General-purpose storage in S3 domain |
+ * | * Byte access only |
+ * +---------------------------------------------------------------------------+
+ * |0x600 CMOS RAM |
+ * | * Dual-mapped to storage at Alt RTC Index/Data (0x72/0x73) |
+ * | * Byte access only |
+ * +---------------------------------------------------------------------------+
+ * |0x700 CMOS |
+ * | * Dual-mapped to storage at RTC Index/Data (0x70/0x71) |
+ * | * Byte access only |
+ * +---------------------------------------------------------------------------+
+ * |0x800 Standard ACPI registers |
+ * | * Dual-mapped to I/O ACPI registers |
+ * +---------------------------------------------------------------------------+
+ * |0x900 ASF controller registers |
+ * | * Dual-mapped to I/O ASF controller registers |
+ * +---------------------------------------------------------------------------+
+ * |0xa00 SMBus controller registers |
+ * | * Dual-mapped to I/O SMBus controller registers |
+ * +---------------------------------------------------------------------------+
+ * |0xb00 WDT registers |
+ * | * Dual-mapped to WDT registers, typ. enabled at 0xfeb00000 |
+ * +---------------------------------------------------------------------------+
+ * |0xc00 HPET registers |
+ * | * Dual-mapped to HPET registers, typ. enabled at 0xfed00000 |
+ * +---------------------------------------------------------------------------+
+ * |0xd00 MUX configuration registers for GPIO signals |
+ * +---------------------------------------------------------------------------+
+ * |0xe00 Miscellaneous registers |
+ * +---------------------------------------------------------------------------+
+ * |0x1000 Serial debug bus |
+ * +---------------------------------------------------------------------------+
+ * |0x1400 DP-VGA |
+ * +---------------------------------------------------------------------------+
+ * |0x1500 GPIO configuration registers bank 0 |
+ * | * new style, never implemented with older style |
+ * +---------------------------------------------------------------------------+
+ * |0x1600 GPIO configuration registers bank 1 |
+ * | * new style, never implemented with older style |
+ * +---------------------------------------------------------------------------+
+ * |0x1700 GPIO configuration registers bank 2 |
+ * | * new style, never implemented with older style |
+ * +---------------------------------------------------------------------------+
+ * |0x1c00 xHCI Power Management registers |
+ * +---------------------------------------------------------------------------+
+ * |0x1d00 Wake device (AC DC timer) |
+ * +---------------------------------------------------------------------------+
+ * |0x1e00 Always On Always Connect registers |
+ * +---------------------------------------------------------------------------+
+ */
+
+/* Enable the AcpiMmio range at 0xfed80000 */
void enable_acpimmio_decode(void);
+
+/* Access PM registers using IO cycles */
uint8_t pm_io_read8(uint8_t reg);
uint16_t pm_io_read16(uint8_t reg);
uint32_t pm_io_read32(uint8_t reg);
void pm_io_write8(uint8_t reg, uint8_t value);
void pm_io_write16(uint8_t reg, uint16_t value);
void pm_io_write32(uint8_t reg, uint32_t value);
-uint8_t smi_read8(uint8_t offset);
-uint16_t smi_read16(uint8_t offset);
-uint32_t smi_read32(uint8_t offset);
-void smi_write8(uint8_t offset, uint8_t value);
-void smi_write16(uint8_t offset, uint16_t value);
-void smi_write32(uint8_t offset, uint32_t value);
+
+/* Access SMI registers at 0xfed80100 */
+uint8_t smi_read8(uint8_t reg);
+uint16_t smi_read16(uint8_t reg);
+uint32_t smi_read32(uint8_t reg);
+void smi_write8(uint8_t reg, uint8_t value);
+void smi_write16(uint8_t reg, uint16_t value);
+void smi_write32(uint8_t reg, uint32_t value);
+
+/* Access Power Management registers at 0xfed80300 */
uint8_t pm_read8(uint8_t reg);
uint16_t pm_read16(uint8_t reg);
uint32_t pm_read32(uint8_t reg);
void pm_write8(uint8_t reg, uint8_t value);
void pm_write16(uint8_t reg, uint16_t value);
void pm_write32(uint8_t reg, uint32_t value);
+
+/* Access Power Management 2 registers at 0xfed80400 */
uint8_t pm2_read8(uint8_t reg);
uint16_t pm2_read16(uint8_t reg);
uint32_t pm2_read32(uint8_t reg);
void pm2_write8(uint8_t reg, uint8_t value);
void pm2_write16(uint8_t reg, uint16_t value);
void pm2_write32(uint8_t reg, uint32_t value);
-uint8_t biosram_read8(uint8_t offset);
-void biosram_write8(uint8_t offset, uint8_t value);
-uint16_t biosram_read16(uint8_t offset);
-uint32_t biosram_read32(uint8_t offset);
-void biosram_write16(uint8_t offset, uint16_t value);
-void biosram_write32(uint8_t offset, uint32_t value);
+
+/* Access BIOS RAM storage at 0xfed80500 */
+uint8_t biosram_read8(uint8_t reg);
+uint16_t biosram_read16(uint8_t reg);
+uint32_t biosram_read32(uint8_t reg);
+void biosram_write8(uint8_t reg, uint8_t value);
+void biosram_write16(uint8_t reg, uint16_t value);
+void biosram_write32(uint8_t reg, uint32_t value);
+
+/* Access ACPI registers at 0xfed80800 */
uint8_t acpi_read8(uint8_t reg);
uint16_t acpi_read16(uint8_t reg);
uint32_t acpi_read32(uint8_t reg);
void acpi_write8(uint8_t reg, uint8_t value);
void acpi_write16(uint8_t reg, uint16_t value);
void acpi_write32(uint8_t reg, uint32_t value);
+
+/* Access ASF controller registers at 0xfed80900 */
uint8_t asf_read8(uint8_t reg);
uint16_t asf_read16(uint8_t reg);
-uint32_t asf_read32(uint8_t reg);
void asf_write8(uint8_t reg, uint8_t value);
void asf_write16(uint8_t reg, uint16_t value);
-void asf_write32(uint8_t reg, uint32_t value);
+
+/* Access SMBus controller registers at 0xfed80a00 */
uint8_t smbus_read8(uint8_t reg);
uint16_t smbus_read16(uint8_t reg);
void smbus_write8(uint8_t reg, uint8_t value);
void smbus_write16(uint8_t reg, uint16_t value);
+
+/* Access WDT registers at 0xfed80b00 */
uint8_t wdt_read8(uint8_t reg);
uint16_t wdt_read16(uint8_t reg);
uint32_t wdt_read32(uint8_t reg);
void wdt_write8(uint8_t reg, uint8_t value);
void wdt_write16(uint8_t reg, uint16_t value);
void wdt_write32(uint8_t reg, uint32_t value);
+
+/* Access HPET registers at 0xfed80c00 */
uint8_t hpet_read8(uint8_t reg);
uint16_t hpet_read16(uint8_t reg);
uint32_t hpet_read32(uint8_t reg);
void hpet_write8(uint8_t reg, uint8_t value);
void hpet_write16(uint8_t reg, uint16_t value);
void hpet_write32(uint8_t reg, uint32_t value);
+
+/* Access GPIO MUX registers at 0xfed80d00 */
uint8_t iomux_read8(uint8_t reg);
uint16_t iomux_read16(uint8_t reg);
uint32_t iomux_read32(uint8_t reg);
void iomux_write8(uint8_t reg, uint8_t value);
void iomux_write16(uint8_t reg, uint16_t value);
void iomux_write32(uint8_t reg, uint32_t value);
+
+/* Access Miscellaneous registers at 0xfed80e00 */
uint8_t misc_read8(uint8_t reg);
uint16_t misc_read16(uint8_t reg);
uint32_t misc_read32(uint8_t reg);
void misc_write8(uint8_t reg, uint8_t value);
void misc_write16(uint8_t reg, uint16_t value);
void misc_write32(uint8_t reg, uint32_t value);
+
+/* Access xHCI Power Management registers at 0xfed81c00 */
uint8_t xhci_pm_read8(uint8_t reg);
uint16_t xhci_pm_read16(uint8_t reg);
uint32_t xhci_pm_read32(uint8_t reg);
void xhci_pm_write8(uint8_t reg, uint8_t value);
void xhci_pm_write16(uint8_t reg, uint16_t value);
void xhci_pm_write32(uint8_t reg, uint32_t value);
+
+/* Access Always On Always Connect registers at 0xfed81e00 */
uint8_t aoac_read8(uint8_t reg);
void aoac_write8(uint8_t reg, uint8_t value);
diff --git a/src/soc/amd/common/block/include/amdblocks/alink.h b/src/soc/amd/common/block/include/amdblocks/alink.h
new file mode 100644
index 0000000000..a6f748b809
--- /dev/null
+++ b/src/soc/amd/common/block/include/amdblocks/alink.h
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __AMDBLOCKS_ALINK_H__
+#define __AMDBLOCKS_ALINK_H__
+
+#include
+
+#define AB_INDX 0xcd8
+#define AB_DATA (AB_INDX + 4)
+
+#define AX_INDXC 0
+#define AX_INDXP 2
+#define AXCFG 4
+#define ABCFG 6
+#define RC_INDXC 1
+#define RC_INDXP 3
+
+#define abcfg_reg(reg, mask, val) \
+ alink_ab_indx((ABCFG), (reg), (mask), (val))
+#define axcfg_reg(reg, mask, val) \
+ alink_ab_indx((AXCFG), (reg), (mask), (val))
+#define axindxc_reg(reg, mask, val) \
+ alink_ax_indx((AX_INDXC), (reg), (mask), (val))
+#define axindxp_reg(reg, mask, val) \
+ alink_ax_indx((AX_INDXP), (reg), (mask), (val))
+#define rcindxc_reg(reg, port, mask, val) \
+ alink_rc_indx((RC_INDXC), (reg), (port), (mask), (val))
+#define rcindxp_reg(reg, port, mask, val) \
+ alink_rc_indx((RC_INDXP), (reg), (port), (mask), (val))
+
+void alink_rc_indx(u32 reg_space, u32 reg_addr, u32 port, u32 mask, u32 val);
+void alink_ab_indx(u32 reg_space, u32 reg_addr, u32 mask, u32 val);
+void alink_ax_indx(u32 space /* c or p? */, u32 axindc, u32 mask, u32 val);
+
+#endif /* __AMDBLOCKS_ALINK_H__ */
diff --git a/src/soc/amd/common/block/include/amdblocks/gpio_banks.h b/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
new file mode 100644
index 0000000000..da841347fb
--- /dev/null
+++ b/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
@@ -0,0 +1,308 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __AMDBLOCK_GPIO_BANKS_H__
+#define __AMDBLOCK_GPIO_BANKS_H__
+
+#include
+#include
+
+struct soc_amd_gpio {
+ uint8_t gpio;
+ uint8_t function;
+ uint32_t control;
+ uint32_t flags;
+};
+
+struct soc_amd_event {
+ uint8_t gpio;
+ uint8_t event;
+};
+
+#define GPIO_BANK0_CONTROL(gpio) (ACPIMMIO_GPIO0_BASE + ((gpio) * 4))
+#define GPIO_BANK1_CONTROL(gpio) (ACPIMMIO_GPIO1_BASE + (((gpio) - 64) * 4))
+#define GPIO_BANK2_CONTROL(gpio) (ACPIMMIO_GPIO2_BASE + (((gpio) - 128) * 4))
+
+#define GPIO_MASTER_SWITCH 0xFC
+#define GPIO_MASK_STS_EN BIT(28)
+#define GPIO_INTERRUPT_EN BIT(30)
+
+#define GPIO_PIN_IN (1 << 0) /* for byte access */
+#define GPIO_PIN_OUT (1 << 6) /* for byte access */
+
+#define GPIO_EDGE_TRIG (0 << 8)
+#define GPIO_LEVEL_TRIG (1 << 8)
+#define GPIO_TRIGGER_MASK (1 << 8)
+
+#define GPIO_ACTIVE_HIGH (0 << 9)
+#define GPIO_ACTIVE_LOW (1 << 9)
+#define GPIO_ACTIVE_BOTH (2 << 9)
+#define GPIO_ACTIVE_MASK (3 << 9)
+
+#define GPIO_INT_STATUS_EN (1 << 11)
+#define GPIO_INT_DELIVERY_EN (1 << 12)
+#define GPIO_INTERRUPT_MASK (3 << 11)
+#define GPIO_S0I3_WAKE_EN (1 << 13)
+#define GPIO_S3_WAKE_EN (1 << 14)
+#define GPIO_S4_S5_WAKE_EN (1 << 15)
+
+#define GPIO_PIN_STS (1 << 16)
+#define GPIO_PULLUP_ENABLE (1 << 20)
+#define GPIO_PULLDOWN_ENABLE (1 << 21)
+#define GPIO_OUTPUT_SHIFT 22
+#define GPIO_OUTPUT_MASK (1 << GPIO_OUTPUT_SHIFT)
+#define GPIO_OUTPUT_VALUE (1 << GPIO_OUTPUT_SHIFT)
+#define GPIO_OUTPUT_ENABLE (1 << 23)
+
+#define GPIO_INT_STATUS (1 << 28)
+#define GPIO_WAKE_STATUS (1 << 29)
+
+enum {
+ GEVENT_0,
+ GEVENT_1,
+ GEVENT_2,
+ GEVENT_3,
+ GEVENT_4,
+ GEVENT_5,
+ GEVENT_6,
+ GEVENT_7,
+ GEVENT_8,
+ GEVENT_9,
+ GEVENT_10,
+ GEVENT_11,
+ GEVENT_12,
+ GEVENT_13,
+ GEVENT_14,
+ GEVENT_15,
+ GEVENT_16,
+ GEVENT_17,
+ GEVENT_18,
+ GEVENT_19,
+ GEVENT_20,
+ GEVENT_21,
+ GEVENT_22,
+ GEVENT_23,
+ GEVENT_24,
+ GEVENT_25,
+ GEVENT_26,
+ GEVENT_27,
+ GEVENT_28,
+ GEVENT_29,
+ GEVENT_30,
+ GEVENT_31,
+};
+
+#define GPIO_OUTPUT_OUT_HIGH (GPIO_OUTPUT_ENABLE | GPIO_OUTPUT_VALUE)
+#define GPIO_OUTPUT_OUT_LOW GPIO_OUTPUT_ENABLE
+
+#define GPIO_PULL_PULL_UP GPIO_PULLUP_ENABLE
+#define GPIO_PULL_PULL_DOWN GPIO_PULLDOWN_ENABLE
+#define GPIO_PULL_PULL_NONE 0
+
+#define AMD_GPIO_CONTROL_MASK 0x00f4ff00
+#define AMD_GPIO_MUX_MASK 0x03
+
+/* Definitions for PAD_INT. */
+#define GPIO_INT_EDGE_HIGH (GPIO_ACTIVE_HIGH | GPIO_EDGE_TRIG)
+#define GPIO_INT_EDGE_LOW (GPIO_ACTIVE_LOW | GPIO_EDGE_TRIG)
+#define GPIO_INT_BOTH_EDGES (GPIO_ACTIVE_BOTH | GPIO_EDGE_TRIG)
+#define GPIO_INT_LEVEL_HIGH (GPIO_ACTIVE_HIGH | GPIO_LEVEL_TRIG)
+#define GPIO_INT_LEVEL_LOW (GPIO_ACTIVE_LOW | GPIO_LEVEL_TRIG)
+
+enum {
+ GPIO_TRIGGER_LEVEL_LOW,
+ GPIO_TRIGGER_LEVEL_HIGH,
+ GPIO_TRIGGER_EDGE_LOW,
+ GPIO_TRIGGER_EDGE_HIGH,
+};
+
+#define GPIO_TRIGGER_INVALID -1
+#define SCI_TRIGGER_EDGE 0
+#define SCI_TRIGGER_LEVEL 1
+
+#define GPIO_SPECIAL_FLAG (1 << 31)
+#define GPIO_DEBOUNCE_FLAG (1 << 30)
+#define GPIO_WAKE_FLAG (1 << 29)
+#define GPIO_INT_FLAG (1 << 28)
+#define GPIO_SMI_FLAG (1 << 27)
+#define GPIO_SCI_FLAG (1 << 26)
+#define GPIO_FLAG_DEBOUNCE (GPIO_SPECIAL_FLAG | GPIO_DEBOUNCE_FLAG)
+#define GPIO_FLAG_WAKE (GPIO_SPECIAL_FLAG | GPIO_WAKE_FLAG)
+#define GPIO_FLAG_INT (GPIO_SPECIAL_FLAG | GPIO_INT_FLAG)
+#define GPIO_FLAG_SCI (GPIO_SPECIAL_FLAG | GPIO_SCI_FLAG)
+#define GPIO_FLAG_SMI (GPIO_SPECIAL_FLAG | GPIO_SMI_FLAG)
+
+#define FLAGS_TRIGGER_MASK 0x00000003
+#define GPIO_SPECIAL_MASK 0x7c000000
+#define GPIO_DEBOUNCE_MASK 0x000000ff
+#define INT_TRIGGER_MASK 0x00000700
+#define INT_WAKE_MASK 0x0000e700
+#define INT_SCI_SMI_MASK 0x00f40000
+
+#define IN_GLITCH_SHIFT 5
+#define GLITCH_LOW 1
+#define GLITCH_HIGH 2
+#define GLITCH_NONE 3
+#define GPIO_IN_PRESERVE_LOW_GLITCH (GLITCH_LOW << IN_GLITCH_SHIFT)
+#define GPIO_IN_PRESERVE_HIGH_GLITCH (GLITCH_HIGH << IN_GLITCH_SHIFT)
+#define GPIO_IN_REMOVE_GLITCH (GLITCH_NONE << IN_GLITCH_SHIFT)
+
+#define GPIO_TIMEBASE_61uS 0
+#define GPIO_TIMEBASE_183uS (1 << 4)
+#define GPIO_TIMEBASE_15560uS (1 << 7)
+#define GPIO_TIMEBASE_62440uS (GPIO_TIMEBASE_183uS | \
+ GPIO_TIMEBASE_15560uS)
+#define GPIO_IN_DEBOUNCE_DISABLED (0 | GPIO_TIMEBASE_61uS)
+#define GPIO_IN_60uS (1 | GPIO_TIMEBASE_61uS)
+#define GPIO_IN_120uS (2 | GPIO_TIMEBASE_61uS)
+#define GPIO_IN_200uS (3 | GPIO_TIMEBASE_61uS)
+#define GPIO_IN_500uS (8 | GPIO_TIMEBASE_61uS)
+#define GPIO_IN_1mS (5 | GPIO_TIMEBASE_183uS)
+#define GPIO_IN_2mS (11 | GPIO_TIMEBASE_183uS)
+#define GPIO_IN_15mS (1 | GPIO_TIMEBASE_15560uS)
+#define GPIO_IN_50mS (3 | GPIO_TIMEBASE_15560uS)
+#define GPIO_IN_100mS (6 | GPIO_TIMEBASE_15560uS)
+#define GPIO_IN_200mS (13 | GPIO_TIMEBASE_15560uS)
+#define GPIO_IN_500mS (8 | GPIO_TIMEBASE_62440uS)
+
+#define GPIO_EVENT_INT_STATUS GPIO_INT_STATUS_EN
+#define GPIO_EVENT_INT_DELIVER GPIO_INT_DELIVERY_EN
+#define GPIO_EVENT_INT_STATUS_DELIVER (GPIO_INT_STATUS_EN | \
+ GPIO_INT_DELIVERY_EN)
+#define GPIO_WAKE_S0i3 (1 << 13)
+#define GPIO_WAKE_S3 (1 << 14)
+#define GPIO_WAKE_S4_S5 (1 << 15)
+#define GPIO_WAKE_S0i3_S4_S5 (GPIO_WAKE_S0i3 | GPIO_WAKE_S4_S5)
+#define GPIO_WAKE_S3_S4_S5 (GPIO_WAKE_S3 | GPIO_WAKE_S4_S5)
+
+/*
+ * Several macros are available to declare programming of GPIO pins, and if
+ * needed, more than 1 macro can be used for any pin. However, some macros
+ * will have no effect if combined. For example debounce only affects input
+ * or one of the interrupts. Some macros should not be combined, such as SMI
+ * and regular interrupt. The defined macros and their parameters are:
+ * PAD_NF Define native alternate function for the pin.
+ * pin the pin to be programmed
+ * function the native function
+ * pull pull up, pull down or no pull
+ * PAD_GPI The pin is a GPIO input
+ * pin the pin to be programmed
+ * pull pull up, pull down or no pull
+ * PAD_GPO The pin is a GPIO output
+ * pin the pin to be programmed
+ * direction high or low
+ * PAD_INT The pin is regular interrupt that works while booting
+ * pin the pin to be programmed
+ * pull pull up, pull down or no pull
+ * trigger LEVEL_LOW, LEVEL_HIGH, EDGE_LOW, EDGE_HIGH, BOTH_EDGES
+ * action STATUS, DELIVER, STATUS_DELIVER
+ * PAD_SCI The pin is a SCI source
+ * pin the pin to be programmed
+ * pull pull up, pull down or no pull
+ * trigger LEVEL_LOW, LEVEL_HIGH, EDGE_LOW, EDGE_HIGH
+ * PAD_SMI The pin is a SMI source
+ * pin the pin to be programmed
+ * pull pull up, pull down or no pull
+ * trigger LEVEL_LOW, LEVEL_HIGH
+ * PAD_WAKE The pin can wake, use after PAD_INT or PAD_SCI
+ * pin the pin to be programmed
+ * pull pull up, pull down or no pull
+ * trigger LEVEL_LOW, LEVEL_HIGH, EDGE_LOW, EDGE_HIGH, BOTH_EDGES
+ * type S0i3, S3, S4_S5 or S4_S5 combinations (S0i3_S3 invalid)
+ * PAD_DEBOUNCE The input or interrupt will be debounced, invalid after
+ * PAD_NF
+ * pin the pin to be programmed
+ * debounce_type preserve low glitch, preserve high glitch, no glitch
+ * debounce_time the debounce time
+ */
+
+/* Native function pad configuration */
+#define PAD_NF(pin, func, pull) \
+ { .gpio = (pin), \
+ .function = pin ## _IOMUX_ ## func, \
+ .control = GPIO_PULL ## _ ## pull, \
+ .flags = 0 }
+/* General purpose input pad configuration */
+#define PAD_GPI(pin, pull) \
+ { .gpio = (pin), \
+ .function = pin ## _IOMUX_ ## GPIOxx, \
+ .control = GPIO_PULL ## _ ## pull, \
+ .flags = 0 }
+/* General purpose output pad configuration */
+#define PAD_GPO(pin, direction) \
+ { .gpio = (pin), \
+ .function = pin ## _IOMUX_ ## GPIOxx, \
+ .control = GPIO_OUTPUT ## _OUT_ ## direction, \
+ .flags = 0 }
+/* Auxiliary macro for legacy interrupt and wake */
+#define PAD_AUX1(pull, trigger) (GPIO_PULL ## _ ## pull | \
+ GPIO_INT ## _ ## trigger)
+/* Legacy interrupt pad configuration */
+#define PAD_INT(pin, pull, trigger, action) \
+ { .gpio = (pin), \
+ .function = pin ## _IOMUX_ ## GPIOxx, \
+ .control = (PAD_AUX1(pull, trigger) | \
+ GPIO_EVENT_INT ## _ ## action), \
+ .flags = GPIO_FLAG_INT }
+/* Auxiliary macro for SCI and SMI */
+#define PAD_AUX2(trigger, flag) (GPIO_TRIGGER ## _ ## trigger | flag)
+/* SCI pad configuration */
+#define PAD_SCI(pin, pull, trigger) \
+ { .gpio = (pin), \
+ .function = pin ## _IOMUX_ ## GPIOxx, \
+ .control = GPIO_PULL ## _ ## pull, \
+ .flags = PAD_AUX2(trigger, GPIO_FLAG_SCI) }
+/* SMI pad configuration */
+#define PAD_SMI(pin, pull, trigger) \
+ { .gpio = (pin), \
+ .function = pin ## _IOMUX_ ## GPIOxx, \
+ .control = GPIO_PULL ## _ ## pull, \
+ .flags = PAD_AUX2(trigger, GPIO_FLAG_SMI) }
+/* WAKE pad configuration */
+#define PAD_WAKE(pin, pull, trigger, type) \
+ { .gpio = (pin), \
+ .function = pin ## _IOMUX_ ## GPIOxx, \
+ .control = (PAD_AUX1(pull, trigger) | \
+ GPIO_WAKE ## _ ## type), \
+ .flags = GPIO_FLAG_WAKE }
+/* pin debounce configuration */
+#define PAD_DEBOUNCE(pin, type, time) \
+ { .gpio = (pin), \
+ .function = pin ## _IOMUX_ ## GPIOxx, \
+ .control = (GPIO_IN ## _ ## type | GPIO_IN ## _ ## time), \
+ .flags = GPIO_FLAG_DEBOUNCE }
+
+typedef uint32_t gpio_t;
+
+/* Get the address of the control register of a particular pin */
+uintptr_t gpio_get_address(gpio_t gpio_num);
+
+/**
+ * @brief program a particular set of GPIO
+ *
+ * @param gpio_list_ptr = pointer to array of gpio configurations
+ * @param size = number of entries in array
+ *
+ * @return none
+ */
+void program_gpios(const struct soc_amd_gpio *gpio_list_ptr, size_t size);
+/* Return the interrupt status and clear if set. */
+int gpio_interrupt_status(gpio_t gpio);
+/* Implemented by soc, provides table of avaialable GPIO mapping to Gevents */
+void soc_get_gpio_event_table(const struct soc_amd_event **table, size_t *items);
+/* May be implemented by soc to handle special cases */
+void soc_gpio_hook(uint8_t gpio, uint8_t mux);
+
+#endif /* __AMDBLOCK_GPIO_BANKS_H__ */
diff --git a/src/soc/amd/common/block/include/amdblocks/lpc.h b/src/soc/amd/common/block/include/amdblocks/lpc.h
new file mode 100644
index 0000000000..7b33d7ad11
--- /dev/null
+++ b/src/soc/amd/common/block/include/amdblocks/lpc.h
@@ -0,0 +1,176 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 Google, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __AMDBLOCKS_LPC_H__
+#define __AMDBLOCKS_LPC_H__
+
+#include
+
+/* PCI registers for D14F3 */
+#define LPC_PCI_CONTROL 0x40
+#define LEGACY_DMA_EN BIT(2)
+
+#define LPC_IO_PORT_DECODE_ENABLE 0x44
+#define DECODE_ENABLE_PARALLEL_PORT0 BIT(0)
+#define DECODE_ENABLE_PARALLEL_PORT1 BIT(1)
+#define DECODE_ENABLE_PARALLEL_PORT2 BIT(2)
+#define DECODE_ENABLE_PARALLEL_PORT3 BIT(3)
+#define DECODE_ENABLE_PARALLEL_PORT4 BIT(4)
+#define DECODE_ENABLE_PARALLEL_PORT5 BIT(5)
+#define DECODE_ENABLE_SERIAL_PORT0 BIT(6)
+#define DECODE_ENABLE_SERIAL_PORT1 BIT(7)
+#define DECODE_ENABLE_SERIAL_PORT2 BIT(8)
+#define DECODE_ENABLE_SERIAL_PORT3 BIT(9)
+#define DECODE_ENABLE_SERIAL_PORT4 BIT(10)
+#define DECODE_ENABLE_SERIAL_PORT5 BIT(11)
+#define DECODE_ENABLE_SERIAL_PORT6 BIT(12)
+#define DECODE_ENABLE_SERIAL_PORT7 BIT(13)
+#define DECODE_ENABLE_AUDIO_PORT0 BIT(14)
+#define DECODE_ENABLE_AUDIO_PORT1 BIT(15)
+#define DECODE_ENABLE_AUDIO_PORT2 BIT(16)
+#define DECODE_ENABLE_AUDIO_PORT3 BIT(17)
+#define DECODE_ENABLE_MIDI_PORT0 BIT(18)
+#define DECODE_ENABLE_MIDI_PORT1 BIT(19)
+#define DECODE_ENABLE_MIDI_PORT2 BIT(20)
+#define DECODE_ENABLE_MIDI_PORT3 BIT(21)
+#define DECODE_ENABLE_MSS_PORT0 BIT(22)
+#define DECODE_ENABLE_MSS_PORT1 BIT(23)
+#define DECODE_ENABLE_MSS_PORT2 BIT(24)
+#define DECODE_ENABLE_MSS_PORT3 BIT(25)
+#define DECODE_ENABLE_FDC_PORT0 BIT(26)
+#define DECODE_ENABLE_FDC_PORT1 BIT(27)
+#define DECODE_ENABLE_GAME_PORT BIT(28)
+#define DECODE_ENABLE_KBC_PORT BIT(29)
+#define DECODE_ENABLE_ACPIUC_PORT BIT(30)
+#define DECODE_ENABLE_ADLIB_PORT BIT(31)
+
+#define LPC_IO_OR_MEM_DECODE_ENABLE 0x48
+#define LPC_WIDEIO2_ENABLE BIT(25)
+#define LPC_WIDEIO1_ENABLE BIT(24)
+#define DECODE_IO_PORT_ENABLE6 BIT(23)
+#define DECODE_IO_PORT_ENABLE5 BIT(22)
+#define DECODE_IO_PORT_ENABLE4 BIT(21)
+#define DECODE_MEM_PORT_ENABLE1 BIT(20)
+#define DECODE_IO_PORT_ENABLE3 BIT(19)
+#define DECODE_IO_PORT_ENABLE2 BIT(18)
+#define DECODE_IO_PORT_ENABLE1 BIT(17)
+#define DECODE_IO_PORT_ENABLE0 BIT(16)
+#define LPC_SYNC_TIMEOUT_COUNT_ENABLE BIT(7)
+#define LPC_DECODE_RTC_IO_ENABLE BIT(6)
+#define DECODE_MEM_PORT_ENABLE0 BIT(5)
+#define LPC_WIDEIO0_ENABLE BIT(2)
+#define DECODE_ALTERNATE_SIO_ENABLE BIT(1)
+#define DECODE_SIO_ENABLE BIT(0)
+#define WIDEIO_RANGE_ERROR -1
+
+/* Assuming word access to higher word (register 0x4a) */
+#define LPC_IO_OR_MEM_DEC_EN_HIGH 0x4a
+#define LPC_WIDEIO2_ENABLE_H BIT(9)
+#define LPC_WIDEIO1_ENABLE_H BIT(8)
+#define DECODE_IO_PORT_ENABLE6_H BIT(7)
+#define DECODE_IO_PORT_ENABLE5_H BIT(6)
+#define DECODE_IO_PORT_ENABLE4_H BIT(5)
+#define DECODE_IO_PORT_ENABLE3_H BIT(3)
+#define DECODE_IO_PORT_ENABLE2_H BIT(2)
+#define DECODE_IO_PORT_ENABLE1_H BIT(1)
+#define DECODE_IO_PORT_ENABLE0_H BIT(0)
+
+#define LPC_MEM_PORT1 0x4c
+#define LPC_MEM_PORT0 0x60
+
+/* Register 0x64 is 32-bit, composed by two 16-bit sub-registers.
+ For ease of access, each sub-register is declared separetely. */
+#define LPC_WIDEIO_GENERIC_PORT 0x64
+#define LPC_WIDEIO1_GENERIC_PORT 0x66
+#define ROM_ADDRESS_RANGE1_START 0x68
+#define ROM_ADDRESS_RANGE1_END 0x6a
+#define ROM_ADDRESS_RANGE2_START 0x6c
+#define ROM_ADDRESS_RANGE2_END 0x6e
+
+#define LPC_ALT_WIDEIO_RANGE_ENABLE 0x74
+#define LPC_ALT_WIDEIO2_ENABLE BIT(3)
+#define LPC_ALT_WIDEIO1_ENABLE BIT(2)
+#define LPC_ALT_WIDEIO0_ENABLE BIT(0)
+
+#define LPC_MISC_CONTROL_BITS 0x78
+#define LPC_NOHOG BIT(0)
+
+#define LPC_TRUSTED_PLATFORM_MODULE 0x7c
+#define TPM_12_EN BIT(0)
+#define TPM_LEGACY_EN BIT(2)
+
+#define LPC_WIDEIO2_GENERIC_PORT 0x90
+
+#define SPIROM_BASE_ADDRESS_REGISTER 0xa0
+#define SPI_BASE_RESERVED (BIT(4) | BIT(5))
+#define ROUTE_TPM_2_SPI BIT(3)
+#define SPI_ABORT_ENABLE BIT(2)
+#define SPI_ROM_ENABLE BIT(1)
+#define SPI_ROM_ALT_ENABLE BIT(0)
+#define SPI_PRESERVE_BITS (BIT(0) | BIT(1) | BIT(2) | BIT(3))
+
+/* LPC register 0xb8 is DWORD, here there are definitions for byte
+ access. For example, bits 31-24 are accessed through byte access
+ at register 0xbb. */
+#define LPC_ROM_DMA_EC_HOST_CONTROL 0xb8
+#define SPI_FROM_HOST_PREFETCH_EN BIT(24)
+#define SPI_FROM_USB_PREFETCH_EN BIT(23)
+
+#define LPC_HOST_CONTROL 0xbb
+#define PREFETCH_EN_SPI_FROM_HOST BIT(0)
+#define T_START_ENH BIT(3)
+
+/* LPC is typically enabled very early, but this function is last opportunity */
+void soc_late_lpc_bridge_enable(void);
+void lpc_enable_port80(void);
+void lpc_enable_pci_port80(void);
+void lpc_enable_decode(uint32_t decodes);
+uintptr_t lpc_spibase(void);
+void lpc_tpm_decode(void);
+void lpc_tpm_decode_spi(void);
+void lpc_enable_rom(void);
+void lpc_enable_spi_prefetch(void);
+
+/**
+ * @brief Find the size of a particular wide IO
+ *
+ * @param index = index of desired wide IO
+ *
+ * @return size of desired wide IO
+ */
+uint16_t lpc_wideio_size(int index);
+/**
+ * @brief Identify if any LPC wide IO is covering the IO range
+ *
+ * @param start = start of IO range
+ * @param size = size of IO range
+ *
+ * @return Index of wide IO covering the range or error
+ */
+int lpc_find_wideio_range(uint16_t start, uint16_t size);
+/**
+ * @brief Program a LPC wide IO to support an IO range
+ *
+ * @param start = start of range to be routed through wide IO
+ * @param size = size of range to be routed through wide IO
+ *
+ * @return Index of wide IO register used or error
+ */
+int lpc_set_wideio_range(uint16_t start, uint16_t size);
+
+uintptr_t lpc_get_spibase(void);
+void lpc_set_spibase(uint32_t base, uint32_t enable);
+
+#endif /* __AMDBLOCKS_LPC_H__ */
diff --git a/src/soc/amd/common/block/include/amdblocks/sata.h b/src/soc/amd/common/block/include/amdblocks/sata.h
new file mode 100644
index 0000000000..2a21436525
--- /dev/null
+++ b/src/soc/amd/common/block/include/amdblocks/sata.h
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __AMDBLOCKS_SATA_H__
+#define __AMDBLOCKS_SATA_H__
+
+#include
+
+void soc_enable_sata_features(struct device *dev);
+
+#endif /* __AMDBLOCKS_SATA_H__ */
diff --git a/src/soc/amd/common/block/iommu/Kconfig b/src/soc/amd/common/block/iommu/Kconfig
new file mode 100644
index 0000000000..4580400a7c
--- /dev/null
+++ b/src/soc/amd/common/block/iommu/Kconfig
@@ -0,0 +1,5 @@
+config SOC_AMD_COMMON_BLOCK_IOMMU
+ bool
+ default n
+ help
+ Select this option to use AMD common IOMMU support.
diff --git a/src/soc/amd/common/block/iommu/Makefile.inc b/src/soc/amd/common/block/iommu/Makefile.inc
new file mode 100644
index 0000000000..d08dbfcc33
--- /dev/null
+++ b/src/soc/amd/common/block/iommu/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_IOMMU) += iommu.c
diff --git a/src/soc/amd/stoneyridge/iommu.c b/src/soc/amd/common/block/iommu/iommu.c
similarity index 89%
rename from src/soc/amd/stoneyridge/iommu.c
rename to src/soc/amd/common/block/iommu/iommu.c
index e33402ac43..1c982ca00d 100644
--- a/src/soc/amd/stoneyridge/iommu.c
+++ b/src/soc/amd/common/block/iommu/iommu.c
@@ -43,13 +43,17 @@ static struct device_operations iommu_ops = {
.read_resources = iommu_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
- .init = 0,
- .scan_bus = 0,
.ops_pci = &lops_pci,
};
+static const unsigned short pci_device_ids[] = {
+ PCI_DEVICE_ID_AMD_15H_MODEL_303F_NB_IOMMU,
+ PCI_DEVICE_ID_AMD_15H_MODEL_707F_NB_IOMMU,
+ 0
+};
+
static const struct pci_driver iommu_driver __pci_driver = {
.ops = &iommu_ops,
.vendor = PCI_VENDOR_ID_AMD,
- .device = PCI_DEVICE_ID_AMD_15H_MODEL_707F_NB_IOMMU,
+ .devices = pci_device_ids,
};
diff --git a/src/soc/amd/common/block/lpc/Kconfig b/src/soc/amd/common/block/lpc/Kconfig
new file mode 100644
index 0000000000..b0d59a55f4
--- /dev/null
+++ b/src/soc/amd/common/block/lpc/Kconfig
@@ -0,0 +1,5 @@
+config SOC_AMD_COMMON_BLOCK_LPC
+ bool
+ default n
+ help
+ Select this option to use the traditional LPC-ISA bridge at D14F3.
diff --git a/src/soc/amd/common/block/lpc/Makefile.inc b/src/soc/amd/common/block/lpc/Makefile.inc
new file mode 100644
index 0000000000..72b1e42013
--- /dev/null
+++ b/src/soc/amd/common/block/lpc/Makefile.inc
@@ -0,0 +1,8 @@
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc.c
+
+bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
+verstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
+romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
+postcar-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
+smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_LPC) += lpc_util.c
diff --git a/src/soc/amd/stoneyridge/lpc.c b/src/soc/amd/common/block/lpc/lpc.c
similarity index 94%
rename from src/soc/amd/stoneyridge/lpc.c
rename to src/soc/amd/common/block/lpc/lpc.c
index 3ace1fdce6..b896517214 100644
--- a/src/soc/amd/stoneyridge/lpc.c
+++ b/src/soc/amd/common/block/lpc/lpc.c
@@ -28,15 +28,21 @@
#include
#include
#include
+#include
#include
-#include
#include
#include
+#include
+
+/* Most systems should have already enabled the bridge */
+void __weak soc_late_lpc_bridge_enable(void) { }
static void lpc_init(struct device *dev)
{
u8 byte;
+ soc_late_lpc_bridge_enable();
+
/* Initialize isa dma */
isa_dma_init();
@@ -64,8 +70,8 @@ static void lpc_init(struct device *dev)
pci_write_config8(dev, LPC_MISC_CONTROL_BITS, byte);
/*
- * Enable hand-instance of the pulse generator and SPI
- * controller prefetch of flash.
+ * Enable hand-instance of the pulse generator and SPI prefetch from
+ * host (earlier is recommended for boot speed).
*/
byte = pci_read_config8(dev, LPC_HOST_CONTROL);
byte |= PREFETCH_EN_SPI_FROM_HOST | T_START_ENH;
@@ -146,7 +152,7 @@ static void lpc_set_resources(struct device *dev)
/* Special case. The SpiRomEnable and other enables should STAY set. */
res = find_resource(dev, 2);
spi_enable_bits = pci_read_config32(dev, SPIROM_BASE_ADDRESS_REGISTER);
- spi_enable_bits &= SPI_PRESERVE_BITS;
+ spi_enable_bits &= SPI_BASE_ALIGNMENT - 1;
pci_write_config32(dev, SPIROM_BASE_ADDRESS_REGISTER,
res->base | spi_enable_bits);
@@ -247,9 +253,9 @@ static void set_child_resource(struct device *dev, struct device *child,
break;
default:
rsize = 0;
- wideio_index = sb_find_wideio_range(base, res->size);
+ wideio_index = lpc_find_wideio_range(base, res->size);
if (wideio_index != WIDEIO_RANGE_ERROR) {
- rsize = sb_wideio_size(wideio_index);
+ rsize = lpc_wideio_size(wideio_index);
printk(BIOS_DEBUG, "Covered by wideIO");
printk(BIOS_DEBUG, " %d\n", wideio_index);
}
@@ -260,7 +266,7 @@ static void set_child_resource(struct device *dev, struct device *child,
*reg_x |= set_x;
/* check if we can fit resource in variable range */
} else {
- wideio_index = sb_set_wideio_range(base, res->size);
+ wideio_index = lpc_set_wideio_range(base, res->size);
if (wideio_index != WIDEIO_RANGE_ERROR) {
/* preserve wide IO related bits. */
*reg_x = pci_read_config32(dev,
diff --git a/src/soc/amd/common/block/lpc/lpc_util.c b/src/soc/amd/common/block/lpc/lpc_util.c
new file mode 100644
index 0000000000..008d14c34e
--- /dev/null
+++ b/src/soc/amd/common/block/lpc/lpc_util.c
@@ -0,0 +1,308 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2010-2017 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* The LPC-ISA bridge is always at D14F3 */
+#if !defined(__SIMPLE_DEVICE__)
+#include
+#define _LPCB_DEV pcidev_on_root(0x14, 0x3)
+#else
+#define _LPCB_DEV PCI_DEV(0, 0x14, 0x3)
+#endif
+
+/*
+ * Structure to simplify code obtaining the total of used wide IO
+ * registers and the size assigned to each.
+ */
+static const struct wide_io_ioport_and_bits {
+ uint32_t enable;
+ uint16_t port;
+ uint8_t alt;
+} wio_io_en[] = {
+ {
+ .enable = LPC_WIDEIO0_ENABLE,
+ .port = LPC_WIDEIO_GENERIC_PORT,
+ .alt = LPC_ALT_WIDEIO0_ENABLE
+ },
+ {
+ .enable = LPC_WIDEIO1_ENABLE,
+ .port = LPC_WIDEIO1_GENERIC_PORT,
+ .alt = LPC_ALT_WIDEIO1_ENABLE
+ },
+ {
+ .enable = LPC_WIDEIO2_ENABLE,
+ .port = LPC_WIDEIO2_GENERIC_PORT,
+ .alt = LPC_ALT_WIDEIO2_ENABLE
+ }
+};
+
+/**
+ * @brief Find the size of a particular wide IO
+ *
+ * @param index = index of desired wide IO
+ *
+ * @return size of desired wide IO
+ */
+uint16_t lpc_wideio_size(int index)
+{
+ uint32_t enable_register;
+ uint16_t size = 0;
+ uint8_t alternate_register;
+
+ if (index >= ARRAY_SIZE(wio_io_en))
+ return size;
+ enable_register = pci_read_config32(_LPCB_DEV,
+ LPC_IO_OR_MEM_DECODE_ENABLE);
+ alternate_register = pci_read_config8(_LPCB_DEV,
+ LPC_ALT_WIDEIO_RANGE_ENABLE);
+ if (enable_register & wio_io_en[index].enable)
+ size = (alternate_register & wio_io_en[index].alt) ?
+ 16 : 512;
+ return size;
+}
+
+/**
+ * @brief Identify if any LPC wide IO is covering the IO range
+ *
+ * @param start = start of IO range
+ * @param size = size of IO range
+ *
+ * @return Index of wide IO covering the range or error
+ */
+int lpc_find_wideio_range(uint16_t start, uint16_t size)
+{
+ int i, index = WIDEIO_RANGE_ERROR;
+ uint16_t end, current_size, start_wideio, end_wideio;
+
+ end = start + size;
+ for (i = 0; i < ARRAY_SIZE(wio_io_en); i++) {
+ current_size = lpc_wideio_size(i);
+ if (current_size == 0)
+ continue;
+ start_wideio = pci_read_config16(_LPCB_DEV,
+ wio_io_en[i].port);
+ end_wideio = start_wideio + current_size;
+ if ((start >= start_wideio) && (end <= end_wideio)) {
+ index = i;
+ break;
+ }
+ }
+ return index;
+}
+
+/**
+ * @brief Program a LPC wide IO to support an IO range
+ *
+ * @param start = start of range to be routed through wide IO
+ * @param size = size of range to be routed through wide IO
+ *
+ * @return Index of wide IO register used or error
+ */
+int lpc_set_wideio_range(uint16_t start, uint16_t size)
+{
+ int i, index = WIDEIO_RANGE_ERROR;
+ uint32_t enable_register;
+ uint8_t alternate_register;
+
+ enable_register = pci_read_config32(_LPCB_DEV,
+ LPC_IO_OR_MEM_DECODE_ENABLE);
+ alternate_register = pci_read_config8(_LPCB_DEV,
+ LPC_ALT_WIDEIO_RANGE_ENABLE);
+ for (i = 0; i < ARRAY_SIZE(wio_io_en); i++) {
+ if (enable_register & wio_io_en[i].enable)
+ continue;
+ index = i;
+ pci_write_config16(_LPCB_DEV, wio_io_en[i].port, start);
+ enable_register |= wio_io_en[i].enable;
+ pci_write_config32(_LPCB_DEV, LPC_IO_OR_MEM_DECODE_ENABLE,
+ enable_register);
+ if (size <= 16)
+ alternate_register |= wio_io_en[i].alt;
+ else
+ alternate_register &= ~wio_io_en[i].alt;
+ pci_write_config8(_LPCB_DEV,
+ LPC_ALT_WIDEIO_RANGE_ENABLE,
+ alternate_register);
+ break;
+ }
+ return index;
+}
+
+void lpc_enable_port80(void)
+{
+ u8 byte;
+
+ byte = pci_read_config8(_LPCB_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH);
+ byte |= DECODE_IO_PORT_ENABLE4_H;
+ pci_write_config8(_LPCB_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH, byte);
+}
+
+void lpc_enable_pci_port80(void)
+{
+ u8 byte;
+
+ byte = pci_read_config8(_LPCB_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH);
+ byte &= ~DECODE_IO_PORT_ENABLE4_H; /* disable lpc port 80 */
+ pci_write_config8(_LPCB_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH, byte);
+}
+
+void lpc_enable_decode(uint32_t decodes)
+{
+ pci_write_config32(_LPCB_DEV, LPC_IO_PORT_DECODE_ENABLE, decodes);
+}
+
+uintptr_t lpc_spibase(void)
+{
+ u32 base, enables;
+
+ /* Make sure the base address is predictable */
+ base = pci_read_config32(_LPCB_DEV, SPIROM_BASE_ADDRESS_REGISTER);
+ enables = base & SPI_PRESERVE_BITS;
+ base &= ~(SPI_PRESERVE_BITS | SPI_BASE_RESERVED);
+
+ if (!base) {
+ base = SPI_BASE_ADDRESS;
+ pci_write_config32(_LPCB_DEV, SPIROM_BASE_ADDRESS_REGISTER,
+ base | enables | SPI_ROM_ENABLE);
+ /* PCI_COMMAND_MEMORY is read-only and enabled. */
+ }
+ return base;
+}
+
+/*
+ * Enable FCH to decode TPM associated Memory and IO regions
+ *
+ * Enable decoding of TPM cycles defined in TPM 1.2 spec
+ * Enable decoding of legacy TPM addresses: IO addresses 0x7f-
+ * 0x7e and 0xef-0xee.
+ * This function should be called if TPM is connected in any way to the FCH and
+ * conforms to the regions decoded.
+ * Absent any other routing configuration the TPM cycles will be claimed by the
+ * LPC bus
+ */
+void lpc_tpm_decode(void)
+{
+ u32 value;
+
+ value = pci_read_config32(_LPCB_DEV, LPC_TRUSTED_PLATFORM_MODULE);
+ value |= TPM_12_EN | TPM_LEGACY_EN;
+ pci_write_config32(_LPCB_DEV, LPC_TRUSTED_PLATFORM_MODULE, value);
+}
+
+/*
+ * Enable FCH to decode TPM associated Memory and IO regions to SPI
+ *
+ * This should be used if TPM is connected to SPI bus.
+ * Assumes SPI address space is already configured via a call to lpc_spibase().
+ */
+void lpc_tpm_decode_spi(void)
+{
+ /* Enable TPM decoding to FCH */
+ lpc_tpm_decode();
+
+ /* Route TPM accesses to SPI */
+ u32 spibase = pci_read_config32(_LPCB_DEV,
+ SPIROM_BASE_ADDRESS_REGISTER);
+ pci_write_config32(_LPCB_DEV, SPIROM_BASE_ADDRESS_REGISTER, spibase
+ | ROUTE_TPM_2_SPI);
+}
+
+/*
+ * Enable 4MB (LPC) ROM access at 0xFFC00000 - 0xFFFFFFFF.
+ *
+ * Hardware should enable LPC ROM by pin straps. This function does not
+ * handle the theoretically possible PCI ROM, FWH, or SPI ROM configurations.
+ *
+ * The southbridge power-on default is to map 512K ROM space.
+ *
+ */
+void lpc_enable_rom(void)
+{
+ u8 reg8;
+
+ /*
+ * Decode variable LPC ROM address ranges 1 and 2.
+ * Bits 3-4 are not defined in any publicly available datasheet
+ */
+ reg8 = pci_read_config8(_LPCB_DEV, LPC_IO_OR_MEM_DECODE_ENABLE);
+ reg8 |= (1 << 3) | (1 << 4);
+ pci_write_config8(_LPCB_DEV, LPC_IO_OR_MEM_DECODE_ENABLE, reg8);
+
+ /*
+ * LPC ROM address range 1:
+ * Enable LPC ROM range mirroring start at 0x000e(0000).
+ */
+ pci_write_config16(_LPCB_DEV, ROM_ADDRESS_RANGE1_START, 0x000e);
+
+ /* Enable LPC ROM range mirroring end at 0x000f(ffff). */
+ pci_write_config16(_LPCB_DEV, ROM_ADDRESS_RANGE1_END, 0x000f);
+
+ /*
+ * LPC ROM address range 2:
+ *
+ * Enable LPC ROM range start at:
+ * 0xfff8(0000): 512KB
+ * 0xfff0(0000): 1MB
+ * 0xffe0(0000): 2MB
+ * 0xffc0(0000): 4MB
+ */
+ pci_write_config16(_LPCB_DEV, ROM_ADDRESS_RANGE2_START, 0x10000
+ - (CONFIG_COREBOOT_ROMSIZE_KB >> 6));
+
+ /* Enable LPC ROM range end at 0xffff(ffff). */
+ pci_write_config16(_LPCB_DEV, ROM_ADDRESS_RANGE2_END, 0xffff);
+}
+
+void lpc_enable_spi_prefetch(void)
+{
+ uint32_t dword;
+
+ dword = pci_read_config32(_LPCB_DEV, LPC_ROM_DMA_EC_HOST_CONTROL);
+ dword |= SPI_FROM_HOST_PREFETCH_EN | SPI_FROM_USB_PREFETCH_EN;
+ pci_write_config32(_LPCB_DEV, LPC_ROM_DMA_EC_HOST_CONTROL, dword);
+}
+
+uintptr_t lpc_get_spibase(void)
+{
+ u32 base;
+
+ base = pci_read_config32(_LPCB_DEV, SPIROM_BASE_ADDRESS_REGISTER);
+ base = ALIGN_DOWN(base, SPI_BASE_ALIGNMENT);
+ return (uintptr_t)base;
+}
+
+void lpc_set_spibase(u32 base, u32 enable)
+{
+ u32 reg32;
+
+ /* only two types of CS# enables are allowed */
+ enable &= SPI_ROM_ENABLE | SPI_ROM_ALT_ENABLE;
+
+ reg32 = pci_read_config32(_LPCB_DEV, SPIROM_BASE_ADDRESS_REGISTER);
+
+ reg32 &= SPI_BASE_ALIGNMENT - 1; /* preserve only reserved, enables */
+ reg32 &= ~(SPI_ROM_ENABLE | SPI_ROM_ALT_ENABLE);
+ reg32 |= enable;
+ reg32 |= ALIGN_DOWN(base, SPI_BASE_ALIGNMENT);
+
+ pci_write_config32(_LPCB_DEV, SPIROM_BASE_ADDRESS_REGISTER, reg32);
+}
diff --git a/src/soc/amd/common/block/s3/Kconfig b/src/soc/amd/common/block/s3/Kconfig
index 0880163d54..ebc1695d9b 100644
--- a/src/soc/amd/common/block/s3/Kconfig
+++ b/src/soc/amd/common/block/s3/Kconfig
@@ -1,6 +1,7 @@
config SOC_AMD_COMMON_BLOCK_S3
bool
default n
+ depends on SOC_AMD_COMMON_BLOCK_ACPI
select CACHE_MRC_SETTINGS
select MRC_WRITE_NV_LATE
help
diff --git a/src/soc/amd/common/block/s3/s3_resume.c b/src/soc/amd/common/block/s3/s3_resume.c
index 0ba2f13b46..74aa79c398 100644
--- a/src/soc/amd/common/block/s3/s3_resume.c
+++ b/src/soc/amd/common/block/s3/s3_resume.c
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
/* Training data versioning is not supported or tracked. */
#define DEFAULT_MRC_VERSION 0
diff --git a/src/soc/amd/common/block/sata/Kconfig b/src/soc/amd/common/block/sata/Kconfig
new file mode 100644
index 0000000000..0c3d5bc0a1
--- /dev/null
+++ b/src/soc/amd/common/block/sata/Kconfig
@@ -0,0 +1,5 @@
+config SOC_AMD_COMMON_BLOCK_SATA
+ bool
+ default n
+ help
+ Select this option to use AMD common SATA driver support.
diff --git a/src/soc/amd/common/block/sata/Makefile.inc b/src/soc/amd/common/block/sata/Makefile.inc
new file mode 100644
index 0000000000..59b99eb9b4
--- /dev/null
+++ b/src/soc/amd/common/block/sata/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_HDA) += sata.c
diff --git a/src/soc/amd/common/block/sata/sata.c b/src/soc/amd/common/block/sata/sata.c
new file mode 100644
index 0000000000..cbbc7cfd92
--- /dev/null
+++ b/src/soc/amd/common/block/sata/sata.c
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+void __weak soc_enable_sata_features(struct device *dev) { }
+
+static struct device_operations sata_ops = {
+ .read_resources = pci_dev_read_resources,
+ .set_resources = pci_dev_set_resources,
+ .enable_resources = pci_dev_enable_resources,
+ .init = soc_enable_sata_features,
+};
+
+static const unsigned short pci_device_ids[] = {
+ PCI_DEVICE_ID_AMD_CZ_SATA,
+ PCI_DEVICE_ID_AMD_CZ_SATA_AHCI,
+ 0
+};
+
+static const struct pci_driver sata0_driver __pci_driver = {
+ .ops = &sata_ops,
+ .vendor = PCI_VENDOR_ID_AMD,
+ .devices = pci_device_ids,
+};
diff --git a/src/soc/amd/stoneyridge/Kconfig b/src/soc/amd/stoneyridge/Kconfig
index d4e1feb251..ba82565bf4 100644
--- a/src/soc/amd/stoneyridge/Kconfig
+++ b/src/soc/amd/stoneyridge/Kconfig
@@ -46,8 +46,14 @@ config CPU_SPECIFIC_OPTIONS
select SOC_AMD_PI
select SOC_AMD_COMMON
select SOC_AMD_COMMON_BLOCK
+ select SOC_AMD_COMMON_BLOCK_IOMMU
select SOC_AMD_COMMON_BLOCK_ACPIMMIO
+ select SOC_AMD_COMMON_BLOCK_BANKED_GPIOS
+ select SOC_AMD_COMMON_BLOCK_ACPI
+ select SOC_AMD_COMMON_BLOCK_LPC
select SOC_AMD_COMMON_BLOCK_PCI
+ select SOC_AMD_COMMON_BLOCK_HDA
+ select SOC_AMD_COMMON_BLOCK_SATA
select SOC_AMD_COMMON_BLOCK_PI
select SOC_AMD_COMMON_BLOCK_PSP
select SOC_AMD_COMMON_BLOCK_CAR
diff --git a/src/soc/amd/stoneyridge/Makefile.inc b/src/soc/amd/stoneyridge/Makefile.inc
index 68dba097c1..babd878524 100644
--- a/src/soc/amd/stoneyridge/Makefile.inc
+++ b/src/soc/amd/stoneyridge/Makefile.inc
@@ -46,7 +46,6 @@ bootblock-$(CONFIG_USBDEBUG) += enable_usbdebug.c
bootblock-y += monotonic_timer.c
bootblock-y += pmutil.c
bootblock-y += reset.c
-bootblock-y += sb_util.c
bootblock-y += tsc_freq.c
bootblock-y += southbridge.c
bootblock-y += nb_util.c
@@ -61,7 +60,6 @@ romstage-y += gpio.c
romstage-y += monotonic_timer.c
romstage-y += pmutil.c
romstage-y += reset.c
-romstage-y += sb_util.c
romstage-y += smbus.c
romstage-y += smbus_spd.c
romstage-y += ramtop.c
@@ -75,7 +73,6 @@ romstage-$(CONFIG_HAVE_SMI_HANDLER) += smi_util.c
verstage-y += gpio.c
verstage-y += i2c.c
verstage-y += monotonic_timer.c
-verstage-y += sb_util.c
verstage-y += pmutil.c
verstage-y += reset.c
verstage-$(CONFIG_STONEYRIDGE_UART) += uart.c
@@ -86,7 +83,6 @@ verstage-$(CONFIG_SPI_FLASH) += spi.c
postcar-y += monotonic_timer.c
postcar-$(CONFIG_STONEYRIDGE_UART) += uart.c
postcar-y += ramtop.c
-postcar-y += sb_util.c
postcar-y += nb_util.c
postcar-$(CONFIG_VBOOT_MEASURED_BOOT) += i2c.c
postcar-y += tsc_freq.c
@@ -99,12 +95,8 @@ ramstage-y += mca.c
ramstage-$(CONFIG_USBDEBUG) += enable_usbdebug.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
ramstage-y += gpio.c
-ramstage-y += hda.c
-ramstage-y += iommu.c
ramstage-y += monotonic_timer.c
ramstage-y += southbridge.c
-ramstage-y += sb_util.c
-ramstage-y += lpc.c
ramstage-y += northbridge.c
ramstage-y += pmutil.c
ramstage-y += reset.c
@@ -124,7 +116,6 @@ ramstage-y += nb_util.c
smm-y += monotonic_timer.c
smm-y += smihandler.c
smm-y += smi_util.c
-smm-y += sb_util.c
smm-y += tsc_freq.c
smm-$(CONFIG_DEBUG_SMI) += uart.c
smm-$(CONFIG_SPI_FLASH) += spi.c
diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c
index 4f11ea227a..d1ea24ffd5 100644
--- a/src/soc/amd/stoneyridge/acpi.c
+++ b/src/soc/amd/stoneyridge/acpi.c
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -99,7 +100,7 @@ void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt)
fadt->s4bios_req = 0; /* Not supported */
fadt->pstate_cnt = 0; /* Not supported */
fadt->cst_cnt = 0; /* Not supported */
- acpi_write32(MMIO_ACPI_PM1_CNT_BLK, 0); /* clear SCI_EN */
+ acpi_disable_sci();
} else {
fadt->smi_cmd = 0; /* disable system management mode */
fadt->acpi_enable = 0; /* unused if SMI_CMD = 0 */
@@ -107,7 +108,7 @@ void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt)
fadt->s4bios_req = 0; /* unused if SMI_CMD = 0 */
fadt->pstate_cnt = 0; /* unused if SMI_CMD = 0 */
fadt->cst_cnt = 0x00; /* unused if SMI_CMD = 0 */
- acpi_write32(MMIO_ACPI_PM1_CNT_BLK, 1); /* set SCI_EN */
+ acpi_enable_sci();
}
fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK;
@@ -317,9 +318,9 @@ static void acpigen_soc_get_gpio_in_local5(uintptr_t addr)
static int acpigen_soc_get_gpio_val(unsigned int gpio_num, uint32_t mask)
{
- if (gpio_num >= GPIO_TOTAL_PINS) {
+ if (gpio_num >= SOC_GPIO_TOTAL_PINS) {
printk(BIOS_WARNING, "Warning: Pin %d should be smaller than"
- " %d\n", gpio_num, GPIO_TOTAL_PINS);
+ " %d\n", gpio_num, SOC_GPIO_TOTAL_PINS);
return -1;
}
uintptr_t addr = (uintptr_t) gpio_get_address(gpio_num);
@@ -347,9 +348,9 @@ static int acpigen_soc_get_gpio_val(unsigned int gpio_num, uint32_t mask)
static int acpigen_soc_set_gpio_val(unsigned int gpio_num, uint32_t val)
{
- if (gpio_num >= GPIO_TOTAL_PINS) {
+ if (gpio_num >= SOC_GPIO_TOTAL_PINS) {
printk(BIOS_WARNING, "Warning: Pin %d should be smaller than"
- " %d\n", gpio_num, GPIO_TOTAL_PINS);
+ " %d\n", gpio_num, SOC_GPIO_TOTAL_PINS);
return -1;
}
uintptr_t addr = (uintptr_t) gpio_get_address(gpio_num);
diff --git a/src/soc/amd/stoneyridge/acpi/sb_fch.asl b/src/soc/amd/stoneyridge/acpi/sb_fch.asl
index 4c1196dad6..e7975f8d94 100644
--- a/src/soc/amd/stoneyridge/acpi/sb_fch.asl
+++ b/src/soc/amd/stoneyridge/acpi/sb_fch.asl
@@ -22,7 +22,7 @@ Device (AAHB)
Name (_UID, 0x0)
Name (_CRS, ResourceTemplate()
{
- Memory32Fixed (ReadWrite, 0xFEDC0000, 0x2000)
+ Memory32Fixed (ReadWrite, ALINK_AHB_ADDRESS, 0x2000)
})
Method (_STA, 0x0, NotSerialized)
diff --git a/src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl b/src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl
index 1334df11c4..3623814080 100644
--- a/src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl
+++ b/src/soc/amd/stoneyridge/acpi/sb_pci0_fch.asl
@@ -51,7 +51,7 @@ Device(SBUS) {
/* 0:14.2 - I2S Audio */
/* 0:14.3 - LPC */
-#include "lpc.asl"
+#include
/* 0:14.7 - SD Controller */
Device(SDCN) {
diff --git a/src/soc/amd/stoneyridge/acpi/soc.asl b/src/soc/amd/stoneyridge/acpi/soc.asl
index 6fd838a56d..52c7ee6c00 100644
--- a/src/soc/amd/stoneyridge/acpi/soc.asl
+++ b/src/soc/amd/stoneyridge/acpi/soc.asl
@@ -28,4 +28,4 @@ Device(PCI0) {
#include "sb_fch.asl"
/* Add GPIO library */
-#include
+#include
diff --git a/src/soc/amd/stoneyridge/gpio.c b/src/soc/amd/stoneyridge/gpio.c
index 7c9680582c..f63a0d93a4 100644
--- a/src/soc/amd/stoneyridge/gpio.c
+++ b/src/soc/amd/stoneyridge/gpio.c
@@ -15,14 +15,11 @@
* GNU General Public License for more details.
*/
-#include
-#include
-#include
-#include
+#include
+#include
#include
#include
-#include
-#include "chip.h"
+#include
static const struct soc_amd_event gpio_event_table[] = {
{ GPIO_1, GEVENT_19 },
@@ -51,290 +48,20 @@ static const struct soc_amd_event gpio_event_table[] = {
{ GPIO_69, GEVENT_17 },
};
-static int get_gpio_gevent(uint8_t gpio)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(gpio_event_table); i++) {
- if (gpio_event_table[i].gpio == gpio)
- return (int)gpio_event_table[i].event;
- }
- return -1;
-}
-
-static void mem_read_write32(uint32_t *address, uint32_t value, uint32_t mask)
-{
- uint32_t reg32;
-
- value &= mask;
- reg32 = read32(address);
- reg32 &= ~mask;
- reg32 |= value;
- write32(address, reg32);
-}
-
-__weak void configure_gevent_smi(uint8_t gevent, uint8_t mode, uint8_t level)
-{
- printk(BIOS_WARNING, "Warning: SMI disabled!\n");
-}
-
-static void program_smi(uint32_t flag, int gevent_num)
-{
- uint32_t trigger;
-
- trigger = flag & FLAGS_TRIGGER_MASK;
- /*
- * Only level trigger is allowed for SMI. Trigger values are 0
- * through 3, with 0-1 being level trigger and 2-3 being edge
- * trigger. GPIO_TRIGGER_EDGE_LOW is 2, so trigger has to be
- * less than GPIO_TRIGGER_EDGE_LOW.
- */
- assert(trigger < GPIO_TRIGGER_EDGE_LOW);
-
- if (trigger == GPIO_TRIGGER_LEVEL_HIGH)
- configure_gevent_smi(gevent_num, SMI_MODE_SMI,
- SMI_SCI_LVL_HIGH);
- if (trigger == GPIO_TRIGGER_LEVEL_LOW)
- configure_gevent_smi(gevent_num, SMI_MODE_SMI,
- SMI_SCI_LVL_LOW);
-}
-
-static void route_sci(uint8_t event)
+void soc_route_sci(uint8_t event)
{
smi_write8(SMI_SCI_MAP(event), event);
}
-static void get_sci_config_bits(uint32_t flag, uint32_t *edge, uint32_t *level)
+void soc_get_gpio_event_table(const struct soc_amd_event **table, size_t *items)
{
- uint32_t trigger;
-
- trigger = flag & FLAGS_TRIGGER_MASK;
- switch (trigger) {
- case GPIO_TRIGGER_LEVEL_LOW:
- *edge = SCI_TRIGGER_LEVEL;
- *level = 0;
- break;
- case GPIO_TRIGGER_LEVEL_HIGH:
- *edge = SCI_TRIGGER_LEVEL;
- *level = 1;
- break;
- case GPIO_TRIGGER_EDGE_LOW:
- *edge = SCI_TRIGGER_EDGE;
- *level = 0;
- break;
- case GPIO_TRIGGER_EDGE_HIGH:
- *edge = SCI_TRIGGER_EDGE;
- *level = 1;
- break;
- default:
- break;
- }
+ *table = gpio_event_table;
+ *items = ARRAY_SIZE(gpio_event_table);
}
-uintptr_t gpio_get_address(gpio_t gpio_num)
+void soc_gpio_hook(uint8_t gpio, uint8_t mux)
{
- uintptr_t gpio_address;
-
- if (gpio_num < 64)
- gpio_address = GPIO_BANK0_CONTROL(gpio_num);
- else if (gpio_num < 128)
- gpio_address = GPIO_BANK1_CONTROL(gpio_num);
- else
- gpio_address = GPIO_BANK2_CONTROL(gpio_num);
-
- return gpio_address;
-}
-
-int gpio_get(gpio_t gpio_num)
-{
- uint32_t reg;
- uintptr_t gpio_address = gpio_get_address(gpio_num);
-
- reg = read32((void *)gpio_address);
-
- return !!(reg & GPIO_PIN_STS);
-}
-
-void gpio_set(gpio_t gpio_num, int value)
-{
- uint32_t reg;
- uintptr_t gpio_address = gpio_get_address(gpio_num);
-
- reg = read32((void *)gpio_address);
- reg &= ~GPIO_OUTPUT_MASK;
- reg |= !!value << GPIO_OUTPUT_SHIFT;
- write32((void *)gpio_address, reg);
-}
-
-void gpio_input_pulldown(gpio_t gpio_num)
-{
- uint32_t reg;
- uintptr_t gpio_address = gpio_get_address(gpio_num);
-
- reg = read32((void *)gpio_address);
- reg &= ~GPIO_PULLUP_ENABLE;
- reg |= GPIO_PULLDOWN_ENABLE;
- write32((void *)gpio_address, reg);
-}
-
-void gpio_input_pullup(gpio_t gpio_num)
-{
- uint32_t reg;
- uintptr_t gpio_address = gpio_get_address(gpio_num);
-
- reg = read32((void *)gpio_address);
- reg &= ~GPIO_PULLDOWN_ENABLE;
- reg |= GPIO_PULLUP_ENABLE;
- write32((void *)gpio_address, reg);
-}
-
-void gpio_input(gpio_t gpio_num)
-{
- uint32_t reg;
- uintptr_t gpio_address = gpio_get_address(gpio_num);
-
- reg = read32((void *)gpio_address);
- reg &= ~GPIO_OUTPUT_ENABLE;
- write32((void *)gpio_address, reg);
-}
-
-void gpio_output(gpio_t gpio_num, int value)
-{
- uint32_t reg;
- uintptr_t gpio_address = gpio_get_address(gpio_num);
-
- reg = read32((void *)gpio_address);
- reg |= GPIO_OUTPUT_ENABLE;
- write32((void *)gpio_address, reg);
- gpio_set(gpio_num, value);
-}
-
-const char *gpio_acpi_path(gpio_t gpio)
-{
- return "\\_SB.GPIO";
-}
-
-uint16_t gpio_acpi_pin(gpio_t gpio)
-{
- return gpio;
-}
-
-void sb_program_gpios(const struct soc_amd_gpio *gpio_list_ptr, size_t size)
-{
- uint32_t *gpio_ptr, *inter_master;
- uint32_t control, control_flags, edge_level, direction;
- uint32_t mask, bit_edge, bit_level;
- uint8_t mux, index, gpio;
- int gevent_num;
-
- inter_master = (uint32_t *)(uintptr_t)(ACPIMMIO_GPIO0_BASE
- + GPIO_MASTER_SWITCH);
- direction = 0;
- edge_level = 0;
- mask = 0;
-
- /*
- * Disable blocking wake/interrupt status generation while updating
- * debounce registers. Otherwise when a debounce register is updated
- * the whole GPIO controller will zero out all interrupt enable status
- * bits while the delay happens. This could cause us to drop the bits
- * due to the read-modify-write that happens on each register.
- *
- * Additionally disable interrupt generation so we don't get any
- * spurious interrupts while updating the registers.
- */
- mem_read_write32(inter_master, 0, GPIO_MASK_STS_EN | GPIO_INTERRUPT_EN);
-
- for (index = 0; index < size; index++) {
- gpio = gpio_list_ptr[index].gpio;
- mux = gpio_list_ptr[index].function;
- control = gpio_list_ptr[index].control;
- control_flags = gpio_list_ptr[index].flags;
-
- iomux_write8(gpio, mux & AMD_GPIO_MUX_MASK);
- iomux_read8(gpio); /* Flush posted write */
- /* special case if pin 2 is assigned to wake */
- if ((gpio == 2) && !(mux & AMD_GPIO_MUX_MASK))
- route_sci(GPIO_2_EVENT);
- gpio_ptr = (uint32_t *)gpio_get_address(gpio);
-
- if (control_flags & GPIO_SPECIAL_FLAG) {
- gevent_num = get_gpio_gevent(gpio);
- if (gevent_num < 0) {
- printk(BIOS_WARNING, "Warning: GPIO pin %d has"
- " no associated gevent!\n", gpio);
- continue;
- }
- switch (control_flags & GPIO_SPECIAL_MASK) {
- case GPIO_DEBOUNCE_FLAG:
- mem_read_write32(gpio_ptr, control,
- GPIO_DEBOUNCE_MASK);
- break;
- case GPIO_WAKE_FLAG:
- mem_read_write32(gpio_ptr, control,
- INT_WAKE_MASK);
- break;
- case GPIO_INT_FLAG:
- mem_read_write32(gpio_ptr, control,
- AMD_GPIO_CONTROL_MASK);
- break;
- case GPIO_SMI_FLAG:
- mem_read_write32(gpio_ptr, control,
- INT_SCI_SMI_MASK);
- program_smi(control_flags, gevent_num);
- break;
- case GPIO_SCI_FLAG:
- mem_read_write32(gpio_ptr, control,
- INT_SCI_SMI_MASK);
- get_sci_config_bits(control_flags, &bit_edge,
- &bit_level);
- edge_level |= bit_edge << gevent_num;
- direction |= bit_level << gevent_num;
- mask |= (1 << gevent_num);
- route_sci(gevent_num);
- break;
- default:
- printk(BIOS_WARNING, "Error, flags 0x%08x\n",
- control_flags);
- break;
- }
- } else {
- mem_read_write32(gpio_ptr, control,
- AMD_GPIO_CONTROL_MASK);
- }
- }
-
- /*
- * Re-enable interrupt status generation.
- *
- * We leave MASK_STATUS disabled because the kernel may reconfigure the
- * debounce registers while the drivers load. This will cause interrupts
- * to be missed during boot.
- */
- mem_read_write32(inter_master, GPIO_INTERRUPT_EN, GPIO_INTERRUPT_EN);
-
- /* Set all SCI trigger direction (high/low) */
- mem_read_write32((uint32_t *)
- (uintptr_t)(ACPIMMIO_SMI_BASE + SMI_SCI_TRIG),
- direction, mask);
-
- /* Set all SCI trigger level (edge/level) */
- mem_read_write32((uint32_t *)
- (uintptr_t)(ACPIMMIO_SMI_BASE + SMI_SCI_LEVEL),
- edge_level, mask);
-}
-
-int gpio_interrupt_status(gpio_t gpio)
-{
- uintptr_t gpio_address = gpio_get_address(gpio);
- uint32_t reg = read32((void *)gpio_address);
-
- if (reg & GPIO_INT_STATUS) {
- /* Clear interrupt status, preserve wake status */
- reg &= ~GPIO_WAKE_STATUS;
- write32((void *)gpio_address, reg);
- return 1;
- }
-
- return 0;
+ /* Always program Gevent when WAKE_L_AGPIO2 is configured as WAKE_L */
+ if ((gpio == 2) && !(mux & AMD_GPIO_MUX_MASK))
+ soc_route_sci(GPIO_2_EVENT);
}
diff --git a/src/soc/amd/stoneyridge/i2c.c b/src/soc/amd/stoneyridge/i2c.c
index c3e5539e19..7f65a4f3f3 100644
--- a/src/soc/amd/stoneyridge/i2c.c
+++ b/src/soc/amd/stoneyridge/i2c.c
@@ -203,7 +203,7 @@ void sb_reset_i2c_slaves(void)
/* Save and reprogram I2C SCL pins */
for (i = 0; i < saved_pins_count; i++)
save_i2c_pin_registers(i2c_2_gpi[i].gpio, &save_table[i]);
- sb_program_gpios(i2c_2_gpi, saved_pins_count);
+ program_gpios(i2c_2_gpi, saved_pins_count);
/*
* Toggle SCL back and forth 9 times under 100KHz. A single read is
diff --git a/src/soc/amd/stoneyridge/include/soc/gpio.h b/src/soc/amd/stoneyridge/include/soc/gpio.h
index 26d0336d0a..d8774f051a 100644
--- a/src/soc/amd/stoneyridge/include/soc/gpio.h
+++ b/src/soc/amd/stoneyridge/include/soc/gpio.h
@@ -21,59 +21,13 @@
#ifndef __ACPI__
#include
-#include
-#include
+#include
-struct soc_amd_gpio {
- uint8_t gpio;
- uint8_t function;
- uint32_t control;
- uint32_t flags;
-};
+/* The following sections describe only the GPIOs defined for this SOC */
-struct soc_amd_event {
- uint8_t gpio;
- uint8_t event;
-};
+#define SOC_GPIO_TOTAL_PINS 149
-#define GPIO_MASTER_SWITCH 0xFC
-#define GPIO_MASK_STS_EN BIT(28)
-#define GPIO_INTERRUPT_EN BIT(30)
-
-#define GPIO_TOTAL_PINS 149
-#define GPIO_PIN_IN (1 << 0) /* for byte access */
-#define GPIO_PIN_OUT (1 << 6) /* for byte access */
-
-#define GPIO_EDGE_TRIG (0 << 8)
-#define GPIO_LEVEL_TRIG (1 << 8)
-#define GPIO_TRIGGER_MASK (1 << 8)
-
-#define GPIO_ACTIVE_HIGH (0 << 9)
-#define GPIO_ACTIVE_LOW (1 << 9)
-#define GPIO_ACTIVE_BOTH (2 << 9)
-#define GPIO_ACTIVE_MASK (3 << 9)
-
-#define GPIO_INT_STATUS_EN (1 << 11)
-#define GPIO_INT_DELIVERY_EN (1 << 12)
-#define GPIO_INTERRUPT_MASK (3 << 11)
-#define GPIO_S0I3_WAKE_EN (1 << 13)
-#define GPIO_S3_WAKE_EN (1 << 14)
-#define GPIO_S4_S5_WAKE_EN (1 << 15)
-
-#define GPIO_PIN_STS (1 << 16)
-#define GPIO_PULLUP_ENABLE (1 << 20)
-#define GPIO_PULLDOWN_ENABLE (1 << 21)
-#define GPIO_OUTPUT_SHIFT 22
-#define GPIO_OUTPUT_MASK (1 << GPIO_OUTPUT_SHIFT)
-#define GPIO_OUTPUT_VALUE (1 << GPIO_OUTPUT_SHIFT)
-#define GPIO_OUTPUT_ENABLE (1 << 23)
-
-#define GPIO_INT_STATUS (1 << 28)
-#define GPIO_WAKE_STATUS (1 << 29)
-
-/* GPIO_0 - GPIO_62 */
-#define GPIO_BANK0_CONTROL(gpio) \
- (AMD_SB_ACPI_MMIO_ADDR + 0x1500 + ((gpio) * 4))
+/* Bank 0: GPIO_0 - GPIO_62 */
#define GPIO_0 0
#define GPIO_1 1
#define GPIO_2 2
@@ -105,9 +59,7 @@ struct soc_amd_event {
#define GPIO_40 40
#define GPIO_42 42
-/* GPIO_64 - GPIO_127 */
-#define GPIO_BANK1_CONTROL(gpio) \
- (AMD_SB_ACPI_MMIO_ADDR + 0x1600 + (((gpio) - 64) * 4))
+/* Bank 1: GPIO_64 - GPIO_127 */
#define GPIO_64 64
#define GPIO_65 65
#define GPIO_66 66
@@ -150,10 +102,7 @@ struct soc_amd_event {
#define GPIO_122 122
#define GPIO_126 126
-/* GPIO_128 - GPIO_183 */
-#define GPIO_BANK2_CONTROL(gpio) \
- (AMD_SB_ACPI_MMIO_ADDR + 0x1700 + (((gpio) - 128) * 4))
-/* GPIO_128 Reserved */
+/* Bank 2: GPIO_128 - GPIO_183 */
#define GPIO_129 129
#define GPIO_130 130
#define GPIO_131 131
@@ -353,230 +302,7 @@ struct soc_amd_event {
#define GPIO_148_IOMUX_I2C1_SDA 0
#define GPIO_148_IOMUX_GPIOxx 1
-enum {
- GEVENT_0,
- GEVENT_1,
- GEVENT_2,
- GEVENT_3,
- GEVENT_4,
- GEVENT_5,
- GEVENT_6,
- GEVENT_7,
- GEVENT_8,
- GEVENT_9,
- GEVENT_10,
- GEVENT_11,
- GEVENT_12,
- GEVENT_13,
- GEVENT_14,
- GEVENT_15,
- GEVENT_16,
- GEVENT_17,
- GEVENT_18,
- GEVENT_19,
- GEVENT_20,
- GEVENT_21,
- GEVENT_22,
- GEVENT_23,
-};
#define GPIO_2_EVENT GEVENT_8
-#define GPIO_OUTPUT_OUT_HIGH (GPIO_OUTPUT_ENABLE | GPIO_OUTPUT_VALUE)
-#define GPIO_OUTPUT_OUT_LOW GPIO_OUTPUT_ENABLE
-
-#define GPIO_PULL_PULL_UP GPIO_PULLUP_ENABLE
-#define GPIO_PULL_PULL_DOWN GPIO_PULLDOWN_ENABLE
-#define GPIO_PULL_PULL_NONE 0
-
-#define AMD_GPIO_CONTROL_MASK 0x00f4ff00
-#define AMD_GPIO_MUX_MASK 0x03
-
-/* Definitions for PAD_INT. */
-#define GPIO_INT_EDGE_HIGH (GPIO_ACTIVE_HIGH | GPIO_EDGE_TRIG)
-#define GPIO_INT_EDGE_LOW (GPIO_ACTIVE_LOW | GPIO_EDGE_TRIG)
-#define GPIO_INT_BOTH_EDGES (GPIO_ACTIVE_BOTH | GPIO_EDGE_TRIG)
-#define GPIO_INT_LEVEL_HIGH (GPIO_ACTIVE_HIGH | GPIO_LEVEL_TRIG)
-#define GPIO_INT_LEVEL_LOW (GPIO_ACTIVE_LOW | GPIO_LEVEL_TRIG)
-
-enum {
- GPIO_TRIGGER_LEVEL_LOW,
- GPIO_TRIGGER_LEVEL_HIGH,
- GPIO_TRIGGER_EDGE_LOW,
- GPIO_TRIGGER_EDGE_HIGH,
-};
-
-#define GPIO_TRIGGER_INVALID -1
-#define SCI_TRIGGER_EDGE 0
-#define SCI_TRIGGER_LEVEL 1
-
-#define GPIO_SPECIAL_FLAG (1 << 31)
-#define GPIO_DEBOUNCE_FLAG (1 << 30)
-#define GPIO_WAKE_FLAG (1 << 29)
-#define GPIO_INT_FLAG (1 << 28)
-#define GPIO_SMI_FLAG (1 << 27)
-#define GPIO_SCI_FLAG (1 << 26)
-#define GPIO_FLAG_DEBOUNCE (GPIO_SPECIAL_FLAG | GPIO_DEBOUNCE_FLAG)
-#define GPIO_FLAG_WAKE (GPIO_SPECIAL_FLAG | GPIO_WAKE_FLAG)
-#define GPIO_FLAG_INT (GPIO_SPECIAL_FLAG | GPIO_INT_FLAG)
-#define GPIO_FLAG_SCI (GPIO_SPECIAL_FLAG | GPIO_SCI_FLAG)
-#define GPIO_FLAG_SMI (GPIO_SPECIAL_FLAG | GPIO_SMI_FLAG)
-
-#define FLAGS_TRIGGER_MASK 0x00000003
-#define GPIO_SPECIAL_MASK 0x7c000000
-#define GPIO_DEBOUNCE_MASK 0x000000ff
-#define INT_TRIGGER_MASK 0x00000700
-#define INT_WAKE_MASK 0x0000e700
-#define INT_SCI_SMI_MASK 0x00f40000
-
-#define IN_GLITCH_SHIFT 5
-#define GLITCH_LOW 1
-#define GLITCH_HIGH 2
-#define GLITCH_NONE 3
-#define GPIO_IN_PRESERVE_LOW_GLITCH (GLITCH_LOW << IN_GLITCH_SHIFT)
-#define GPIO_IN_PRESERVE_HIGH_GLITCH (GLITCH_HIGH << IN_GLITCH_SHIFT)
-#define GPIO_IN_REMOVE_GLITCH (GLITCH_NONE << IN_GLITCH_SHIFT)
-
-#define GPIO_TIMEBASE_61uS 0
-#define GPIO_TIMEBASE_183uS (1 << 4)
-#define GPIO_TIMEBASE_15560uS (1 << 7)
-#define GPIO_TIMEBASE_62440uS (GPIO_TIMEBASE_183uS | \
- GPIO_TIMEBASE_15560uS)
-#define GPIO_IN_DEBOUNCE_DISABLED (0 | GPIO_TIMEBASE_61uS)
-#define GPIO_IN_60uS (1 | GPIO_TIMEBASE_61uS)
-#define GPIO_IN_120uS (2 | GPIO_TIMEBASE_61uS)
-#define GPIO_IN_200uS (3 | GPIO_TIMEBASE_61uS)
-#define GPIO_IN_500uS (8 | GPIO_TIMEBASE_61uS)
-#define GPIO_IN_1mS (5 | GPIO_TIMEBASE_183uS)
-#define GPIO_IN_2mS (11 | GPIO_TIMEBASE_183uS)
-#define GPIO_IN_15mS (1 | GPIO_TIMEBASE_15560uS)
-#define GPIO_IN_50mS (3 | GPIO_TIMEBASE_15560uS)
-#define GPIO_IN_100mS (6 | GPIO_TIMEBASE_15560uS)
-#define GPIO_IN_200mS (13 | GPIO_TIMEBASE_15560uS)
-#define GPIO_IN_500mS (8 | GPIO_TIMEBASE_62440uS)
-
-#define GPIO_EVENT_INT_STATUS GPIO_INT_STATUS_EN
-#define GPIO_EVENT_INT_DELIVER GPIO_INT_DELIVERY_EN
-#define GPIO_EVENT_INT_STATUS_DELIVER (GPIO_INT_STATUS_EN | \
- GPIO_INT_DELIVERY_EN)
-#define GPIO_WAKE_S0i3 (1 << 13)
-#define GPIO_WAKE_S3 (1 << 14)
-#define GPIO_WAKE_S4_S5 (1 << 15)
-#define GPIO_WAKE_S0i3_S4_S5 (GPIO_WAKE_S0i3 | GPIO_WAKE_S4_S5)
-#define GPIO_WAKE_S3_S4_S5 (GPIO_WAKE_S3 | GPIO_WAKE_S4_S5)
-
-/*
- * Several macros are available to declare programming of GPIO pins, and if
- * needed, more than 1 macro can be used for any pin. However, some macros
- * will have no effect if combined. For example debounce only affects input
- * or one of the interrupts. Some macros should not be combined, such as SMI
- * and regular interrupt. The defined macros and their parameters are:
- * PAD_NF Define native alternate function for the pin.
- * pin the pin to be programmed
- * function the native function
- * pull pull up, pull down or no pull
- * PAD_GPI The pin is a GPIO input
- * pin the pin to be programmed
- * pull pull up, pull down or no pull
- * PAD_GPO The pin is a GPIO output
- * pin the pin to be programmed
- * direction high or low
- * PAD_INT The pin is regular interrupt that works while booting
- * pin the pin to be programmed
- * pull pull up, pull down or no pull
- * trigger LEVEL_LOW, LEVEL_HIGH, EDGE_LOW, EDGE_HIGH, BOTH_EDGES
- * action STATUS, DELIVER, STATUS_DELIVER
- * PAD_SCI The pin is a SCI source
- * pin the pin to be programmed
- * pull pull up, pull down or no pull
- * trigger LEVEL_LOW, LEVEL_HIGH, EDGE_LOW, EDGE_HIGH
- * PAD_SMI The pin is a SMI source
- * pin the pin to be programmed
- * pull pull up, pull down or no pull
- * trigger LEVEL_LOW, LEVEL_HIGH
- * PAD_WAKE The pin can wake, use after PAD_INT or PAD_SCI
- * pin the pin to be programmed
- * pull pull up, pull down or no pull
- * trigger LEVEL_LOW, LEVEL_HIGH, EDGE_LOW, EDGE_HIGH, BOTH_EDGES
- * type S0i3, S3, S4_S5 or S4_S5 combinations (S0i3_S3 invalid)
- * PAD_DEBOUNCE The input or interrupt will be debounced, invalid after
- * PAD_NF
- * pin the pin to be programmed
- * debounce_type preserve low glitch, preserve high glitch, no glitch
- * debounce_time the debounce time
- */
-
-/* Native function pad configuration */
-#define PAD_NF(pin, func, pull) \
- { .gpio = (pin), \
- .function = pin ## _IOMUX_ ## func, \
- .control = GPIO_PULL ## _ ## pull, \
- .flags = 0 }
-/* General purpose input pad configuration */
-#define PAD_GPI(pin, pull) \
- { .gpio = (pin), \
- .function = pin ## _IOMUX_ ## GPIOxx, \
- .control = GPIO_PULL ## _ ## pull, \
- .flags = 0 }
-/* General purpose output pad configuration */
-#define PAD_GPO(pin, direction) \
- { .gpio = (pin), \
- .function = pin ## _IOMUX_ ## GPIOxx, \
- .control = GPIO_OUTPUT ## _OUT_ ## direction, \
- .flags = 0 }
-/* Auxiliary macro for legacy interrupt and wake */
-#define PAD_AUX1(pull, trigger) (GPIO_PULL ## _ ## pull | \
- GPIO_INT ## _ ## trigger)
-/* Legacy interrupt pad configuration */
-#define PAD_INT(pin, pull, trigger, action) \
- { .gpio = (pin), \
- .function = pin ## _IOMUX_ ## GPIOxx, \
- .control = (PAD_AUX1(pull, trigger) | \
- GPIO_EVENT_INT ## _ ## action), \
- .flags = GPIO_FLAG_INT }
-/* Auxiliary macro for SCI and SMI */
-#define PAD_AUX2(trigger, flag) (GPIO_TRIGGER ## _ ## trigger | flag)
-/* SCI pad configuration */
-#define PAD_SCI(pin, pull, trigger) \
- { .gpio = (pin), \
- .function = pin ## _IOMUX_ ## GPIOxx, \
- .control = GPIO_PULL ## _ ## pull, \
- .flags = PAD_AUX2(trigger, GPIO_FLAG_SCI) }
-/* SMI pad configuration */
-#define PAD_SMI(pin, pull, trigger) \
- { .gpio = (pin), \
- .function = pin ## _IOMUX_ ## GPIOxx, \
- .control = GPIO_PULL ## _ ## pull, \
- .flags = PAD_AUX2(trigger, GPIO_FLAG_SMI) }
-/* WAKE pad configuration */
-#define PAD_WAKE(pin, pull, trigger, type) \
- { .gpio = (pin), \
- .function = pin ## _IOMUX_ ## GPIOxx, \
- .control = (PAD_AUX1(pull, trigger) | \
- GPIO_WAKE ## _ ## type), \
- .flags = GPIO_FLAG_WAKE }
-/* pin debounce configuration */
-#define PAD_DEBOUNCE(pin, type, time) \
- { .gpio = (pin), \
- .function = pin ## _IOMUX_ ## GPIOxx, \
- .control = (GPIO_IN ## _ ## type | GPIO_IN ## _ ## time), \
- .flags = GPIO_FLAG_DEBOUNCE }
-
-typedef uint32_t gpio_t;
-/* Get the address of the control register of a particular pin */
-uintptr_t gpio_get_address(gpio_t gpio_num);
-
-/**
- * @brief program a particular set of GPIO
- *
- * @param gpio_list_ptr = pointer to array of gpio configurations
- * @param size = number of entries in array
- *
- * @return none
- */
-void sb_program_gpios(const struct soc_amd_gpio *gpio_list_ptr, size_t size);
-
-/* Return the interrupt status and clear if set. */
-int gpio_interrupt_status(gpio_t gpio);
-
#endif /* __ACPI__ */
#endif /* __STONEYRIDGE_GPIO_H__ */
diff --git a/src/soc/amd/stoneyridge/include/soc/iomap.h b/src/soc/amd/stoneyridge/include/soc/iomap.h
index 1caef3362f..612b6e871b 100644
--- a/src/soc/amd/stoneyridge/include/soc/iomap.h
+++ b/src/soc/amd/stoneyridge/include/soc/iomap.h
@@ -22,8 +22,27 @@
#define SPI_BASE_ADDRESS 0xfec10000
#define IO_APIC2_ADDR 0xfec20000
-/* AcpiMmio blocks are at fixed offsets from FED8_0000h, enabled in PMx04[1] */
+/*
+ * AcpiMmio blocks are at fixed offsets from FED8_0000h and enabled in PMx04[1].
+ * All ranges not specified as supported below may, or may not, be listed in
+ * any documentation but should be considered reserved through FED8_1FFFh.
+ */
#include
+#define SUPPORTS_ACPIMMIO_SMI_BASE 1 /* 0xfed80100 */
+#define SUPPORTS_ACPIMMIO_PMIO_BASE 1 /* 0xfed80300 */
+#define SUPPORTS_ACPIMMIO_BIOSRAM_BASE 1 /* 0xfed80500 */
+#define SUPPORTS_ACPIMMIO_ACPI_BASE 1 /* 0xfed80800 */
+#define SUPPORTS_ACPIMMIO_ASF_BASE 1 /* 0xfed80900 */
+#define SUPPORTS_ACPIMMIO_SMBUS_BASE 1 /* 0xfed80a00 */
+#define SUPPORTS_ACPIMMIO_IOMUX_BASE 1 /* 0xfed80d00 */
+#define SUPPORTS_ACPIMMIO_MISC_BASE 1 /* 0xfed80e00 */
+#define SUPPORTS_ACPIMMIO_GPIO0_BASE 1 /* 0xfed81500 */
+#define SUPPORTS_ACPIMMIO_GPIO1_BASE 1 /* 0xfed81800 */
+#define SUPPORTS_ACPIMMIO_GPIO2_BASE 1 /* 0xfed81700 */
+#define SUPPORTS_ACPIMMIO_XHCIPM_BASE 1 /* 0xfed81c00 */
+#define SUPPORTS_ACPIMMIO_AOAC_BASE 1 /* 0xfed81e00 */
+
+#define ALINK_AHB_ADDRESS 0xfedc0000
/* I2C fixed address */
#define I2C_BASE_ADDRESS 0xfedc2000
diff --git a/src/soc/amd/stoneyridge/include/soc/smbus.h b/src/soc/amd/stoneyridge/include/soc/smbus.h
index 71f7fafa5e..391084d807 100644
--- a/src/soc/amd/stoneyridge/include/soc/smbus.h
+++ b/src/soc/amd/stoneyridge/include/soc/smbus.h
@@ -21,38 +21,15 @@
#define SMB_SPEED_400KHZ (66000000 / (400000 * 4))
-#define AX_INDXC 0
-#define AX_INDXP 2
-#define AXCFG 4
-#define ABCFG 6
-#define RC_INDXC 1
-#define RC_INDXP 3
-
/*
* Between 1-10 seconds, We should never timeout normally
* Longer than this is just painful when a timeout condition occurs.
*/
#define SMBUS_TIMEOUT (100 * 1000 * 10)
-#define abcfg_reg(reg, mask, val) \
- alink_ab_indx((ABCFG), (reg), (mask), (val))
-#define axcfg_reg(reg, mask, val) \
- alink_ab_indx((AXCFG), (reg), (mask), (val))
-#define axindxc_reg(reg, mask, val) \
- alink_ax_indx((AX_INDXC), (reg), (mask), (val))
-#define axindxp_reg(reg, mask, val) \
- alink_ax_indx((AX_INDXP), (reg), (mask), (val))
-#define rcindxc_reg(reg, port, mask, val) \
- alink_rc_indx((RC_INDXC), (reg), (port), (mask), (val))
-#define rcindxp_reg(reg, port, mask, val) \
- alink_rc_indx((RC_INDXP), (reg), (port), (mask), (val))
-
int do_smbus_read_byte(u32 mmio, u8 device, u8 address);
int do_smbus_write_byte(u32 mmio, u8 device, u8 address, u8 val);
int do_smbus_recv_byte(u32 mmio, u8 device);
int do_smbus_send_byte(u32 mmio, u8 device, u8 val);
-void alink_rc_indx(u32 reg_space, u32 reg_addr, u32 port, u32 mask, u32 val);
-void alink_ab_indx(u32 reg_space, u32 reg_addr, u32 mask, u32 val);
-void alink_ax_indx(u32 space /*c or p? */, u32 axindc, u32 mask, u32 val);
#endif /* __STONEYRIDGE_SMBUS_H__ */
diff --git a/src/soc/amd/stoneyridge/include/soc/smi.h b/src/soc/amd/stoneyridge/include/soc/smi.h
index d22b8dbdd5..000eed8554 100644
--- a/src/soc/amd/stoneyridge/include/soc/smi.h
+++ b/src/soc/amd/stoneyridge/include/soc/smi.h
@@ -233,6 +233,7 @@ void configure_gevent_smi(uint8_t gevent, uint8_t mode, uint8_t level);
void configure_scimap(const struct sci_source *sci);
void disable_gevent_smi(uint8_t gevent);
void gpe_configure_sci(const struct sci_source *scis, size_t num_gpes);
+void soc_route_sci(uint8_t event);
#ifndef __SMM__
void enable_smi_generation(void);
diff --git a/src/soc/amd/stoneyridge/include/soc/southbridge.h b/src/soc/amd/stoneyridge/include/soc/southbridge.h
index 6734efb04d..ad4040759c 100644
--- a/src/soc/amd/stoneyridge/include/soc/southbridge.h
+++ b/src/soc/amd/stoneyridge/include/soc/southbridge.h
@@ -103,15 +103,6 @@
#define PM_USB_ENABLE 0xef
#define PM_USB_ALL_CONTROLLERS 0x7f
-/* ACPI MMIO registers 0xfed80800 */
-#define MMIO_ACPI_PM1_STS 0x00
-#define MMIO_ACPI_PM1_EN 0x02
-#define MMIO_ACPI_PM1_CNT_BLK 0x04
-#define MMIO_ACPI_CPU_CONTROL 0x0c
-#define MMIO_ACPI_GPE0_STS 0x14
-#define MMIO_ACPI_GPE0_EN 0x18
-#define MMIO_ACPI_PM_TMR_BLK 0x08
-
/* SMBUS MMIO offsets 0xfed80a00 */
#define SMBHSTSTAT 0x0
#define SMBHST_STAT_FAILED 0x10
@@ -256,126 +247,16 @@
#define GPE0_LIMIT 28
#define TOTAL_BITS(a) (8 * sizeof(a))
-/*
- * PCI Config Space Definitions
- */
-
-/* ISA Bridge D14F3 */
-#define LPC_PCI_CONTROL 0x40
-#define LEGACY_DMA_EN BIT(2)
-
-#define LPC_IO_PORT_DECODE_ENABLE 0x44
-#define DECODE_ENABLE_PARALLEL_PORT0 BIT(0)
-#define DECODE_ENABLE_PARALLEL_PORT1 BIT(1)
-#define DECODE_ENABLE_PARALLEL_PORT2 BIT(2)
-#define DECODE_ENABLE_PARALLEL_PORT3 BIT(3)
-#define DECODE_ENABLE_PARALLEL_PORT4 BIT(4)
-#define DECODE_ENABLE_PARALLEL_PORT5 BIT(5)
-#define DECODE_ENABLE_SERIAL_PORT0 BIT(6)
-#define DECODE_ENABLE_SERIAL_PORT1 BIT(7)
-#define DECODE_ENABLE_SERIAL_PORT2 BIT(8)
-#define DECODE_ENABLE_SERIAL_PORT3 BIT(9)
-#define DECODE_ENABLE_SERIAL_PORT4 BIT(10)
-#define DECODE_ENABLE_SERIAL_PORT5 BIT(11)
-#define DECODE_ENABLE_SERIAL_PORT6 BIT(12)
-#define DECODE_ENABLE_SERIAL_PORT7 BIT(13)
-#define DECODE_ENABLE_AUDIO_PORT0 BIT(14)
-#define DECODE_ENABLE_AUDIO_PORT1 BIT(15)
-#define DECODE_ENABLE_AUDIO_PORT2 BIT(16)
-#define DECODE_ENABLE_AUDIO_PORT3 BIT(17)
-#define DECODE_ENABLE_MIDI_PORT0 BIT(18)
-#define DECODE_ENABLE_MIDI_PORT1 BIT(19)
-#define DECODE_ENABLE_MIDI_PORT2 BIT(20)
-#define DECODE_ENABLE_MIDI_PORT3 BIT(21)
-#define DECODE_ENABLE_MSS_PORT0 BIT(22)
-#define DECODE_ENABLE_MSS_PORT1 BIT(23)
-#define DECODE_ENABLE_MSS_PORT2 BIT(24)
-#define DECODE_ENABLE_MSS_PORT3 BIT(25)
-#define DECODE_ENABLE_FDC_PORT0 BIT(26)
-#define DECODE_ENABLE_FDC_PORT1 BIT(27)
-#define DECODE_ENABLE_GAME_PORT BIT(28)
-#define DECODE_ENABLE_KBC_PORT BIT(29)
-#define DECODE_ENABLE_ACPIUC_PORT BIT(30)
-#define DECODE_ENABLE_ADLIB_PORT BIT(31)
-
-#define LPC_IO_OR_MEM_DECODE_ENABLE 0x48
-#define LPC_WIDEIO2_ENABLE BIT(25)
-#define LPC_WIDEIO1_ENABLE BIT(24)
-#define DECODE_IO_PORT_ENABLE6 BIT(23)
-#define DECODE_IO_PORT_ENABLE5 BIT(22)
-#define DECODE_IO_PORT_ENABLE4 BIT(21)
-#define DECODE_MEM_PORT_ENABLE1 BIT(20)
-#define DECODE_IO_PORT_ENABLE3 BIT(19)
-#define DECODE_IO_PORT_ENABLE2 BIT(18)
-#define DECODE_IO_PORT_ENABLE1 BIT(17)
-#define DECODE_IO_PORT_ENABLE0 BIT(16)
-#define LPC_SYNC_TIMEOUT_COUNT_ENABLE BIT(7)
-#define LPC_DECODE_RTC_IO_ENABLE BIT(6)
-#define DECODE_MEM_PORT_ENABLE0 BIT(5)
-#define LPC_WIDEIO0_ENABLE BIT(2)
-#define DECODE_ALTERNATE_SIO_ENABLE BIT(1)
-#define DECODE_SIO_ENABLE BIT(0)
-#define WIDEIO_RANGE_ERROR -1
-#define TOTAL_WIDEIO_PORTS 3
-
-/* Assuming word access to higher word (register 0x4a) */
-#define LPC_IO_OR_MEM_DEC_EN_HIGH 0x4a
-#define LPC_WIDEIO2_ENABLE_H BIT(9)
-#define LPC_WIDEIO1_ENABLE_H BIT(8)
-#define DECODE_IO_PORT_ENABLE6_H BIT(7)
-#define DECODE_IO_PORT_ENABLE5_H BIT(6)
-#define DECODE_IO_PORT_ENABLE4_H BIT(5)
-#define DECODE_IO_PORT_ENABLE3_H BIT(3)
-#define DECODE_IO_PORT_ENABLE2_H BIT(2)
-#define DECODE_IO_PORT_ENABLE1_H BIT(1)
-#define DECODE_IO_PORT_ENABLE0_H BIT(0)
-
-#define LPC_MEM_PORT1 0x4c
-#define LPC_MEM_PORT0 0x60
-
-/* Register 0x64 is 32-bit, composed by two 16-bit sub-registers.
- For ease of access, each sub-register is declared separetely. */
-#define LPC_WIDEIO_GENERIC_PORT 0x64
-#define LPC_WIDEIO1_GENERIC_PORT 0x66
-#define ROM_ADDRESS_RANGE1_START 0x68
-#define ROM_ADDRESS_RANGE1_END 0x6a
-#define ROM_ADDRESS_RANGE2_START 0x6c
-#define ROM_ADDRESS_RANGE2_END 0x6e
-
-#define LPC_ALT_WIDEIO_RANGE_ENABLE 0x74
-#define LPC_ALT_WIDEIO2_ENABLE BIT(3)
-#define LPC_ALT_WIDEIO1_ENABLE BIT(2)
-#define LPC_ALT_WIDEIO0_ENABLE BIT(0)
-
-#define LPC_MISC_CONTROL_BITS 0x78
-#define LPC_NOHOG BIT(0)
-
-#define LPC_TRUSTED_PLATFORM_MODULE 0x7c
-#define TPM_12_EN BIT(0)
-#define TPM_LEGACY_EN BIT(2)
-
-#define LPC_WIDEIO2_GENERIC_PORT 0x90
-
-#define SPIROM_BASE_ADDRESS_REGISTER 0xa0
-#define SPI_BASE_RESERVED (BIT(4) | BIT(5))
-#define ROUTE_TPM_2_SPI BIT(3)
-#define SPI_ABORT_ENABLE BIT(2)
-#define SPI_ROM_ENABLE BIT(1)
-#define SPI_ROM_ALT_ENABLE BIT(0)
-#define SPI_PRESERVE_BITS (BIT(0) | BIT(1) | BIT(2) | BIT(3))
-
-/* LPC register 0xb8 is DWORD, here there are definitions for byte
- access. For example, bits 31-24 are accessed through byte access
- at register 0xbb. */
-#define LPC_ROM_DMA_EC_HOST_CONTROL 0xb8
-#define SPI_FROM_HOST_PREFETCH_EN BIT(24)
-#define SPI_FROM_USB_PREFETCH_EN BIT(23)
-
-#define LPC_HOST_CONTROL 0xbb
-#define PREFETCH_EN_SPI_FROM_HOST BIT(0)
-#define T_START_ENH BIT(3)
+/* SATA Controller D11F0 */
+#define SATA_MISC_CONTROL_REG 0x40
+#define SATA_MISC_SUBCLASS_WREN BIT(0)
+/* Register in AHCIBaseAddress (BAR5 at D11F0x24) */
+#define SATA_CAPABILITIES_REG 0xfc
+#define SATA_CAPABILITY_SPM BIT(12)
/* SPI Controller (base address in D14F3xA0) */
+#define SPI_BASE_ALIGNMENT BIT(6)
+
#define SPI_CNTRL0 0x00
#define SPI_BUSY BIT(31)
#define SPI_READ_MODE_MASK (BIT(30) | BIT(29) | BIT(18))
@@ -475,23 +356,13 @@ struct soc_power_reg {
#define XHCI_FW_BOOTRAM_SIZE 0x8000
void enable_aoac_devices(void);
-void sb_enable_rom(void);
void sb_clk_output_48Mhz(u32 osc);
void sb_disable_4dw_burst(void);
void sb_enable(struct device *dev);
void southbridge_final(void *chip_info);
void southbridge_init(void *chip_info);
-void sb_lpc_port80(void);
-void sb_lpc_decode(void);
-void sb_pci_port80(void);
void sb_read_mode(u32 mode);
void sb_set_spi100(u16 norm, u16 fast, u16 alt, u16 tpm);
-void sb_tpm_decode(void);
-void sb_tpm_decode_spi(void);
-void lpc_wideio_512_window(uint16_t base);
-void lpc_wideio_16_window(uint16_t base);
-uint16_t pm_acpi_pm_cnt_blk(void);
-uint16_t pm_acpi_pm_evt_blk(void);
void bootblock_fch_early_init(void);
void bootblock_fch_init(void);
/**
@@ -526,33 +397,6 @@ uint32_t get_uma_size(void);
* @return 64bit base address
*/
uint64_t get_uma_base(void);
-/**
- * @brief Find the size of a particular wide IO
- *
- * @param index = index of desired wide IO
- *
- * @return size of desired wide IO
- */
-uint16_t sb_wideio_size(int index);
-/**
- * @brief Identify if any LPC wide IO is covering the IO range
- *
- * @param start = start of IO range
- * @param size = size of IO range
- *
- * @return Index of wide IO covering the range or error
- */
-int sb_find_wideio_range(uint16_t start, uint16_t size);
-/**
- * @brief Program a LPC wide IO to support an IO range
- *
- * @param start = start of range to be routed through wide IO
- * @param size = size of range to be routed through wide IO
- *
- * @return Index of wide IO register used or error
- */
-int sb_set_wideio_range(uint16_t start, uint16_t size);
-
/*
* Call the mainboard to get the USB Over Current Map. The mainboard
* returns the map and 0 on Success or -1 on error or no map. There is
@@ -568,10 +412,4 @@ void i2c_soc_early_init(void);
/* Initialize all the i2c buses that are not marked with early init. */
void i2c_soc_init(void);
-/*
- * If a system reset is about to be requested, modify the PM1 register so it
- * will never be misinterpreted as an S3 resume.
- */
-void set_pm1cnt_s5(void);
-
#endif /* __STONEYRIDGE_H__ */
diff --git a/src/soc/amd/stoneyridge/pmutil.c b/src/soc/amd/stoneyridge/pmutil.c
index 7367251193..59de34890f 100644
--- a/src/soc/amd/stoneyridge/pmutil.c
+++ b/src/soc/amd/stoneyridge/pmutil.c
@@ -25,29 +25,3 @@ int vbnv_cmos_failed(void)
/* If CMOS power has failed, the century will be set to 0xff */
return cmos_read(RTC_CLK_ALTCENTURY) == 0xff;
}
-
-int vboot_platform_is_resuming(void)
-{
- if (!(acpi_read16(MMIO_ACPI_PM1_STS) & WAK_STS))
- return 0;
-
- uint16_t pm_cnt = acpi_read16(MMIO_ACPI_PM1_CNT_BLK);
- return acpi_sleep_from_pm1(pm_cnt) == ACPI_S3;
-}
-
-/* If a system reset is about to be requested, modify the PM1 register so it
- * will never be misinterpreted as an S3 resume. */
-void set_pm1cnt_s5(void)
-{
- uint16_t pm1;
-
- pm1 = acpi_read16(MMIO_ACPI_PM1_CNT_BLK);
- pm1 &= ~SLP_TYP;
- pm1 |= SLP_TYP_S5 << SLP_TYP_SHIFT;
- acpi_write16(MMIO_ACPI_PM1_CNT_BLK, pm1);
-}
-
-void vboot_platform_prepare_reboot(void)
-{
- set_pm1cnt_s5();
-}
diff --git a/src/soc/amd/stoneyridge/sata.c b/src/soc/amd/stoneyridge/sata.c
index 52932e27f0..6740698dd2 100644
--- a/src/soc/amd/stoneyridge/sata.c
+++ b/src/soc/amd/stoneyridge/sata.c
@@ -17,60 +17,32 @@
#include
#include
#include
+#include
+#include
#include
-
-static void sata_init(struct device *dev)
+void soc_enable_sata_features(struct device *dev)
{
- /**************************************
- * Configure the SATA port multiplier *
- **************************************/
- #define BYTE_TO_DWORD_OFFSET(x) (x/4)
- #define AHCI_BASE_ADDRESS_REG 0x24
- #define MISC_CONTROL_REG 0x40
- #define UNLOCK_BIT (1<<0)
- #define SATA_CAPABILITIES_REG 0xfc
- #define CFG_CAP_SPM (1<<12)
+ u8 *ahci_ptr;
+ u32 misc_ctl, cap_cfg;
- u32 *ahci_ptr = (void *)(uintptr_t)ALIGN_DOWN(
- pci_read_config32(dev, AHCI_BASE_ADDRESS_REG), 256);
u32 temp;
/* unlock the write-protect */
- temp = pci_read_config32(dev, MISC_CONTROL_REG);
- temp |= UNLOCK_BIT;
- pci_write_config32(dev, MISC_CONTROL_REG, temp);
+ misc_ctl = pci_read_config32(dev, SATA_MISC_CONTROL_REG);
+ misc_ctl |= SATA_MISC_SUBCLASS_WREN;
+ pci_write_config32(dev, SATA_MISC_CONTROL_REG, misc_ctl);
/* set the SATA AHCI mode to allow port expanders */
- *(ahci_ptr + BYTE_TO_DWORD_OFFSET(SATA_CAPABILITIES_REG))
- |= CFG_CAP_SPM;
+ ahci_ptr = (u8 *)(uintptr_t)ALIGN_DOWN(
+ pci_read_config32(dev, PCI_BASE_ADDRESS_5), 256);
+
+ cap_cfg = read32(ahci_ptr + SATA_CAPABILITIES_REG);
+ cap_cfg |= SATA_CAPABILITY_SPM;
+ write32(ahci_ptr + SATA_CAPABILITIES_REG, cap_cfg);
/* lock the write-protect */
- temp = pci_read_config32(dev, MISC_CONTROL_REG);
- temp &= ~UNLOCK_BIT;
- pci_write_config32(dev, MISC_CONTROL_REG, temp);
-};
-
-static struct pci_operations lops_pci = {
- /* .set_subsystem = pci_dev_set_subsystem, */
-};
-
-static struct device_operations sata_ops = {
- .read_resources = pci_dev_read_resources,
- .set_resources = pci_dev_set_resources,
- .enable_resources = pci_dev_enable_resources,
- .init = sata_init,
- .ops_pci = &lops_pci,
-};
-
-static const unsigned short pci_device_ids[] = {
- PCI_DEVICE_ID_AMD_CZ_SATA,
- PCI_DEVICE_ID_AMD_CZ_SATA_AHCI,
- 0
-};
-
-static const struct pci_driver sata0_driver __pci_driver = {
- .ops = &sata_ops,
- .vendor = PCI_VENDOR_ID_AMD,
- .devices = pci_device_ids,
+ temp = pci_read_config32(dev, SATA_MISC_CONTROL_REG);
+ temp &= ~SATA_MISC_SUBCLASS_WREN;
+ pci_write_config32(dev, SATA_MISC_CONTROL_REG, temp);
};
diff --git a/src/soc/amd/stoneyridge/sb_util.c b/src/soc/amd/stoneyridge/sb_util.c
deleted file mode 100644
index 11bf73a723..0000000000
--- a/src/soc/amd/stoneyridge/sb_util.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright 2017 Advanced Micro Devices, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include
-#include
-#include
-#include
-#include
-
-uint16_t pm_acpi_pm_cnt_blk(void)
-{
- return pm_read16(PM1_CNT_BLK);
-}
-
-uint16_t pm_acpi_pm_evt_blk(void)
-{
- return pm_read16(PM_EVT_BLK);
-}
-
-int acpi_get_sleep_type(void)
-{
- return acpi_sleep_from_pm1(inw(pm_acpi_pm_cnt_blk()));
-}
-
-void save_uma_size(uint32_t size)
-{
- biosram_write32(BIOSRAM_UMA_SIZE, size);
-}
-
-void save_uma_base(uint64_t base)
-{
- biosram_write32(BIOSRAM_UMA_BASE, (uint32_t) base);
- biosram_write32(BIOSRAM_UMA_BASE + 4, (uint32_t) (base >> 32));
-}
-
-uint32_t get_uma_size(void)
-{
- return biosram_read32(BIOSRAM_UMA_SIZE);
-}
-
-uint64_t get_uma_base(void)
-{
- uint64_t base;
- base = biosram_read32(BIOSRAM_UMA_BASE);
- base |= ((uint64_t)(biosram_read32(BIOSRAM_UMA_BASE + 4)) << 32);
- return base;
-}
diff --git a/src/soc/amd/stoneyridge/smbus.c b/src/soc/amd/stoneyridge/smbus.c
index df7a86edc7..31457f98b8 100644
--- a/src/soc/amd/stoneyridge/smbus.c
+++ b/src/soc/amd/stoneyridge/smbus.c
@@ -189,79 +189,3 @@ int do_smbus_write_byte(u32 mmio, u8 device, u8 address, u8 val)
return 0;
}
-
-void alink_ab_indx(u32 reg_space, u32 reg_addr, u32 mask, u32 val)
-{
- u32 tmp;
-
- outl((reg_space & 0x7) << 29 | reg_addr, AB_INDX);
- tmp = inl(AB_DATA);
- /* rpr 4.2
- * For certain revisions of the chip, the ABCFG registers,
- * with an address of 0x100NN (where 'N' is any hexadecimal
- * number), require an extra programming step.*/
- outl(0, AB_INDX);
-
- tmp &= ~mask;
- tmp |= val;
-
- // printk(BIOS_DEBUG, "about write %x, index=%x", tmp,
- // (reg_space&0x3)<<29 | reg_addr);
-
- /* probably we dont have to do it again. */
- outl((reg_space & 0x7) << 29 | reg_addr, AB_INDX);
- outl(tmp, AB_DATA);
- outl(0, AB_INDX);
-}
-
-void alink_rc_indx(u32 reg_space, u32 reg_addr, u32 port, u32 mask, u32 val)
-{
- u32 tmp;
-
- outl((reg_space & 0x7) << 29 | (port & 3) << 24 | reg_addr, AB_INDX);
- tmp = inl(AB_DATA);
- /* rpr 4.2
- * For certain revisions of the chip, the ABCFG registers,
- * with an address of 0x100NN (where 'N' is any hexadecimal
- * number), require an extra programming step.*/
- outl(0, AB_INDX);
-
- tmp &= ~mask;
- tmp |= val;
-
- //printk(BIOS_DEBUG, "about write %x, index=%x", tmp,
- // (reg_space&0x3)<<29 | (port&3) << 24 | reg_addr);
-
- /* probably we dont have to do it again. */
- outl((reg_space & 0x7) << 29 | (port & 3) << 24 | reg_addr, AB_INDX);
- outl(tmp, AB_DATA);
- outl(0, AB_INDX);
-}
-
-/*
- * space = 0: AX_INDXC, AX_DATAC
- * space = 1: AX_INDXP, AX_DATAP
- */
-void alink_ax_indx(u32 space /*c or p? */, u32 axindc, u32 mask, u32 val)
-{
- u32 tmp;
-
- /* read axindc to tmp */
- outl(space << 29 | space << 3 | 0x30, AB_INDX);
- outl(axindc, AB_DATA);
- outl(0, AB_INDX);
- outl(space << 29 | space << 3 | 0x34, AB_INDX);
- tmp = inl(AB_DATA);
- outl(0, AB_INDX);
-
- tmp &= ~mask;
- tmp |= val;
-
- /* write tmp */
- outl(space << 29 | space << 3 | 0x30, AB_INDX);
- outl(axindc, AB_DATA);
- outl(0, AB_INDX);
- outl(space << 29 | space << 3 | 0x34, AB_INDX);
- outl(tmp, AB_DATA);
- outl(0, AB_INDX);
-}
diff --git a/src/soc/amd/stoneyridge/smihandler.c b/src/soc/amd/stoneyridge/smihandler.c
index c3aed578ff..d8438bb366 100644
--- a/src/soc/amd/stoneyridge/smihandler.c
+++ b/src/soc/amd/stoneyridge/smihandler.c
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
#include
/* bits in smm_io_trap */
@@ -88,19 +89,14 @@ static void southbridge_smi_gsmi(void)
static void sb_apmc_smi_handler(void)
{
- u32 reg32;
const uint8_t cmd = inb(pm_acpi_smi_cmd_port());
switch (cmd) {
case APM_CNT_ACPI_ENABLE:
- reg32 = acpi_read32(MMIO_ACPI_PM1_CNT_BLK);
- reg32 |= (1 << 0); /* SCI_EN */
- acpi_write32(MMIO_ACPI_PM1_CNT_BLK, reg32);
+ acpi_enable_sci();
break;
case APM_CNT_ACPI_DISABLE:
- reg32 = acpi_read32(MMIO_ACPI_PM1_CNT_BLK);
- reg32 &= ~(1 << 0); /* clear SCI_EN */
- acpi_write32(MMIO_ACPI_PM1_CNT_BLK, reg32);
+ acpi_disable_sci();
break;
case APM_CNT_ELOG_GSMI:
if (CONFIG(ELOG_GSMI))
@@ -203,7 +199,7 @@ static void sb_slp_typ_handler(void)
* An IO cycle is required to trigger the STPCLK/STPGNT
* handshake when the Pm1 write is reissued.
*/
- outw(pm1cnt | SLP_EN, pm_acpi_pm_cnt_blk());
+ outw(pm1cnt | SLP_EN, pm_read16(PM1_CNT_BLK));
hlt();
}
}
diff --git a/src/soc/amd/stoneyridge/southbridge.c b/src/soc/amd/stoneyridge/southbridge.c
index 84db3dd76c..45408ead02 100644
--- a/src/soc/amd/stoneyridge/southbridge.c
+++ b/src/soc/amd/stoneyridge/southbridge.c
@@ -22,11 +22,12 @@
#include
#include
#include
-#include
#include
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -152,130 +153,12 @@ const static struct irq_idx_name irq_association[] = {
{ PIRQ_UART1, "UART1" },
};
-/*
- * Structure to simplify code obtaining the total of used wide IO
- * registers and the size assigned to each.
- */
-static struct wide_io_ioport_and_bits {
- uint32_t enable;
- uint16_t port;
- uint8_t alt;
-} wio_io_en[TOTAL_WIDEIO_PORTS] = {
- {
- LPC_WIDEIO0_ENABLE,
- LPC_WIDEIO_GENERIC_PORT,
- LPC_ALT_WIDEIO0_ENABLE
- },
- {
- LPC_WIDEIO1_ENABLE,
- LPC_WIDEIO1_GENERIC_PORT,
- LPC_ALT_WIDEIO1_ENABLE
- },
- {
- LPC_WIDEIO2_ENABLE,
- LPC_WIDEIO2_GENERIC_PORT,
- LPC_ALT_WIDEIO2_ENABLE
- }
-};
-
const struct irq_idx_name *sb_get_apic_reg_association(size_t *size)
{
*size = ARRAY_SIZE(irq_association);
return irq_association;
}
-/**
- * @brief Find the size of a particular wide IO
- *
- * @param index = index of desired wide IO
- *
- * @return size of desired wide IO
- */
-uint16_t sb_wideio_size(int index)
-{
- uint32_t enable_register;
- uint16_t size = 0;
- uint8_t alternate_register;
-
- if (index >= TOTAL_WIDEIO_PORTS)
- return size;
- enable_register = pci_read_config32(SOC_LPC_DEV,
- LPC_IO_OR_MEM_DECODE_ENABLE);
- alternate_register = pci_read_config8(SOC_LPC_DEV,
- LPC_ALT_WIDEIO_RANGE_ENABLE);
- if (enable_register & wio_io_en[index].enable)
- size = (alternate_register & wio_io_en[index].alt) ?
- 16 : 512;
- return size;
-}
-
-/**
- * @brief Identify if any LPC wide IO is covering the IO range
- *
- * @param start = start of IO range
- * @param size = size of IO range
- *
- * @return Index of wide IO covering the range or error
- */
-int sb_find_wideio_range(uint16_t start, uint16_t size)
-{
- int i, index = WIDEIO_RANGE_ERROR;
- uint16_t end, current_size, start_wideio, end_wideio;
-
- end = start + size;
- for (i = 0; i < TOTAL_WIDEIO_PORTS; i++) {
- current_size = sb_wideio_size(i);
- if (current_size == 0)
- continue;
- start_wideio = pci_read_config16(SOC_LPC_DEV,
- wio_io_en[i].port);
- end_wideio = start_wideio + current_size;
- if ((start >= start_wideio) && (end <= end_wideio)) {
- index = i;
- break;
- }
- }
- return index;
-}
-
-/**
- * @brief Program a LPC wide IO to support an IO range
- *
- * @param start = start of range to be routed through wide IO
- * @param size = size of range to be routed through wide IO
- *
- * @return Index of wide IO register used or error
- */
-int sb_set_wideio_range(uint16_t start, uint16_t size)
-{
- int i, index = WIDEIO_RANGE_ERROR;
- uint32_t enable_register;
- uint8_t alternate_register;
-
- enable_register = pci_read_config32(SOC_LPC_DEV,
- LPC_IO_OR_MEM_DECODE_ENABLE);
- alternate_register = pci_read_config8(SOC_LPC_DEV,
- LPC_ALT_WIDEIO_RANGE_ENABLE);
- for (i = 0; i < TOTAL_WIDEIO_PORTS; i++) {
- if (enable_register & wio_io_en[i].enable)
- continue;
- index = i;
- pci_write_config16(SOC_LPC_DEV, wio_io_en[i].port, start);
- enable_register |= wio_io_en[i].enable;
- pci_write_config32(SOC_LPC_DEV, LPC_IO_OR_MEM_DECODE_ENABLE,
- enable_register);
- if (size <= 16)
- alternate_register |= wio_io_en[i].alt;
- else
- alternate_register &= ~wio_io_en[i].alt;
- pci_write_config8(SOC_LPC_DEV,
- LPC_ALT_WIDEIO_RANGE_ENABLE,
- alternate_register);
- break;
- }
- return index;
-}
-
static void power_on_aoac_device(int aoac_device_control_register)
{
uint8_t byte;
@@ -315,16 +198,7 @@ void enable_aoac_devices(void)
} while (!status);
}
-void sb_pci_port80(void)
-{
- u8 byte;
-
- byte = pci_read_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH);
- byte &= ~DECODE_IO_PORT_ENABLE4_H; /* disable lpc port 80 */
- pci_write_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH, byte);
-}
-
-void sb_lpc_port80(void)
+static void sb_enable_lpc(void)
{
u8 byte;
@@ -332,14 +206,9 @@ void sb_lpc_port80(void)
byte = pm_io_read8(PM_LPC_GATING);
byte |= PM_LPC_ENABLE;
pm_io_write8(PM_LPC_GATING, byte);
-
- /* Enable port 80 LPC decode in pci function 3 configuration space. */
- byte = pci_read_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH);
- byte |= DECODE_IO_PORT_ENABLE4_H; /* enable port 80 */
- pci_write_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DEC_EN_HIGH, byte);
}
-void sb_lpc_decode(void)
+static void sb_lpc_decode(void)
{
u32 tmp = 0;
@@ -357,7 +226,11 @@ void sb_lpc_decode(void)
| DECODE_ENABLE_KBC_PORT | DECODE_ENABLE_ACPIUC_PORT
| DECODE_ENABLE_ADLIB_PORT;
- pci_write_config32(SOC_LPC_DEV, LPC_IO_PORT_DECODE_ENABLE, tmp);
+ /* Decode SIOs at 2E/2F and 4E/4F */
+ if (CONFIG(STONEYRIDGE_LEGACY_FREE))
+ tmp |= DECODE_ALTERNATE_SIO_ENABLE | DECODE_SIO_ENABLE;
+
+ lpc_enable_decode(tmp);
}
static void sb_enable_cf9_io(void)
@@ -397,27 +270,23 @@ void sb_clk_output_48Mhz(u32 osc)
misc_write32(MISC_CLK_CNTL1, ctrl);
}
-static uintptr_t sb_spibase(void)
+static uintptr_t sb_init_spi_base(void)
{
- u32 base, enables;
+ uintptr_t base;
/* Make sure the base address is predictable */
- base = pci_read_config32(SOC_LPC_DEV, SPIROM_BASE_ADDRESS_REGISTER);
- enables = base & SPI_PRESERVE_BITS;
- base &= ~(SPI_PRESERVE_BITS | SPI_BASE_RESERVED);
+ base = lpc_get_spibase();
- if (!base) {
- base = SPI_BASE_ADDRESS;
- pci_write_config32(SOC_LPC_DEV, SPIROM_BASE_ADDRESS_REGISTER,
- base | enables | SPI_ROM_ENABLE);
- /* PCI_COMMAND_MEMORY is read-only and enabled. */
- }
- return (uintptr_t)base;
+ if (base)
+ return base;
+
+ lpc_set_spibase(SPI_BASE_ADDRESS, SPI_ROM_ENABLE);
+ return SPI_BASE_ADDRESS;
}
void sb_set_spi100(u16 norm, u16 fast, u16 alt, u16 tpm)
{
- uintptr_t base = sb_spibase();
+ uintptr_t base = sb_init_spi_base();
write16((void *)(base + SPI100_SPEED_CONFIG),
(norm << SPI_NORM_SPEED_NEW_SH) |
(fast << SPI_FAST_SPEED_NEW_SH) |
@@ -428,7 +297,7 @@ void sb_set_spi100(u16 norm, u16 fast, u16 alt, u16 tpm)
void sb_disable_4dw_burst(void)
{
- uintptr_t base = sb_spibase();
+ uintptr_t base = sb_init_spi_base();
write16((void *)(base + SPI100_HOST_PREF_CONFIG),
read16((void *)(base + SPI100_HOST_PREF_CONFIG))
& ~SPI_RD4DW_EN_HOST);
@@ -436,115 +305,12 @@ void sb_disable_4dw_burst(void)
void sb_read_mode(u32 mode)
{
- uintptr_t base = sb_spibase();
+ uintptr_t base = sb_init_spi_base();
write32((void *)(base + SPI_CNTRL0),
(read32((void *)(base + SPI_CNTRL0))
& ~SPI_READ_MODE_MASK) | mode);
}
-/*
- * Enable FCH to decode TPM associated Memory and IO regions
- *
- * Enable decoding of TPM cycles defined in TPM 1.2 spec
- * Enable decoding of legacy TPM addresses: IO addresses 0x7f-
- * 0x7e and 0xef-0xee.
- * This function should be called if TPM is connected in any way to the FCH and
- * conforms to the regions decoded.
- * Absent any other routing configuration the TPM cycles will be claimed by the
- * LPC bus
- */
-void sb_tpm_decode(void)
-{
- u32 value;
-
- value = pci_read_config32(SOC_LPC_DEV, LPC_TRUSTED_PLATFORM_MODULE);
- value |= TPM_12_EN | TPM_LEGACY_EN;
- pci_write_config32(SOC_LPC_DEV, LPC_TRUSTED_PLATFORM_MODULE, value);
-}
-
-/*
- * Enable FCH to decode TPM associated Memory and IO regions to SPI
- *
- * This should be used if TPM is connected to SPI bus.
- * Assumes SPI address space is already configured via a call to sb_spibase().
- */
-void sb_tpm_decode_spi(void)
-{
- /* Enable TPM decoding to FCH */
- sb_tpm_decode();
-
- /* Route TPM accesses to SPI */
- u32 spibase = pci_read_config32(SOC_LPC_DEV,
- SPIROM_BASE_ADDRESS_REGISTER);
- pci_write_config32(SOC_LPC_DEV, SPIROM_BASE_ADDRESS_REGISTER, spibase
- | ROUTE_TPM_2_SPI);
-}
-
-/*
- * Enable 4MB (LPC) ROM access at 0xFFC00000 - 0xFFFFFFFF.
- *
- * Hardware should enable LPC ROM by pin straps. This function does not
- * handle the theoretically possible PCI ROM, FWH, or SPI ROM configurations.
- *
- * The southbridge power-on default is to map 512K ROM space.
- *
- */
-void sb_enable_rom(void)
-{
- u8 reg8;
-
- /*
- * Decode variable LPC ROM address ranges 1 and 2.
- * Bits 3-4 are not defined in any publicly available datasheet
- */
- reg8 = pci_read_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DECODE_ENABLE);
- reg8 |= (1 << 3) | (1 << 4);
- pci_write_config8(SOC_LPC_DEV, LPC_IO_OR_MEM_DECODE_ENABLE, reg8);
-
- /*
- * LPC ROM address range 1:
- * Enable LPC ROM range mirroring start at 0x000e(0000).
- */
- pci_write_config16(SOC_LPC_DEV, ROM_ADDRESS_RANGE1_START, 0x000e);
-
- /* Enable LPC ROM range mirroring end at 0x000f(ffff). */
- pci_write_config16(SOC_LPC_DEV, ROM_ADDRESS_RANGE1_END, 0x000f);
-
- /*
- * LPC ROM address range 2:
- *
- * Enable LPC ROM range start at:
- * 0xfff8(0000): 512KB
- * 0xfff0(0000): 1MB
- * 0xffe0(0000): 2MB
- * 0xffc0(0000): 4MB
- */
- pci_write_config16(SOC_LPC_DEV, ROM_ADDRESS_RANGE2_START, 0x10000
- - (CONFIG_COREBOOT_ROMSIZE_KB >> 6));
-
- /* Enable LPC ROM range end at 0xffff(ffff). */
- pci_write_config16(SOC_LPC_DEV, ROM_ADDRESS_RANGE2_END, 0xffff);
-}
-
-static void sb_lpc_early_setup(void)
-{
- uint32_t dword;
-
- /* Enable SPI prefetch */
- dword = pci_read_config32(SOC_LPC_DEV, LPC_ROM_DMA_EC_HOST_CONTROL);
- dword |= SPI_FROM_HOST_PREFETCH_EN | SPI_FROM_USB_PREFETCH_EN;
- pci_write_config32(SOC_LPC_DEV, LPC_ROM_DMA_EC_HOST_CONTROL, dword);
-
- if (CONFIG(STONEYRIDGE_LEGACY_FREE)) {
- /* Decode SIOs at 2E/2F and 4E/4F */
- dword = pci_read_config32(SOC_LPC_DEV,
- LPC_IO_OR_MEM_DECODE_ENABLE);
- dword |= DECODE_ALTERNATE_SIO_ENABLE | DECODE_SIO_ENABLE;
- pci_write_config32(SOC_LPC_DEV,
- LPC_IO_OR_MEM_DECODE_ENABLE, dword);
- }
-}
-
static void setup_spread_spectrum(int *reboot)
{
uint16_t rstcfg = pm_read16(PWR_RESET_CFG);
@@ -627,11 +393,12 @@ void bootblock_fch_early_init(void)
{
int reboot = 0;
- sb_enable_rom();
- sb_lpc_port80();
+ lpc_enable_rom();
+ sb_enable_lpc();
+ lpc_enable_port80();
sb_lpc_decode();
- sb_lpc_early_setup();
- sb_spibase();
+ lpc_enable_spi_prefetch();
+ sb_init_spi_base();
sb_disable_4dw_burst(); /* Must be disabled on CZ(ST) */
enable_acpimmio_decode();
fch_smbus_init();
@@ -755,83 +522,6 @@ static void sb_init_acpi_ports(void)
PM_ACPI_TIMER_EN_EN);
}
-static uint16_t reset_pm1_status(void)
-{
- uint16_t pm1_sts = acpi_read16(MMIO_ACPI_PM1_STS);
- acpi_write16(MMIO_ACPI_PM1_STS, pm1_sts);
- return pm1_sts;
-}
-
-static uint16_t print_pm1_status(uint16_t pm1_sts)
-{
- static const char *const pm1_sts_bits[16] = {
- [0] = "TMROF",
- [4] = "BMSTATUS",
- [5] = "GBL",
- [8] = "PWRBTN",
- [10] = "RTC",
- [14] = "PCIEXPWAK",
- [15] = "WAK",
- };
-
- if (!pm1_sts)
- return 0;
-
- printk(BIOS_DEBUG, "PM1_STS: ");
- print_num_status_bits(ARRAY_SIZE(pm1_sts_bits), pm1_sts, pm1_sts_bits);
- printk(BIOS_DEBUG, "\n");
-
- return pm1_sts;
-}
-
-static void sb_log_pm1_status(uint16_t pm1_sts)
-{
- if (!CONFIG(ELOG))
- return;
-
- if (pm1_sts & WAK_STS)
- elog_add_event_byte(ELOG_TYPE_ACPI_WAKE,
- acpi_is_wakeup_s3() ? ACPI_S3 : ACPI_S5);
-
- if (pm1_sts & PWRBTN_STS)
- elog_add_event_wake(ELOG_WAKE_SOURCE_PWRBTN, 0);
-
- if (pm1_sts & RTC_STS)
- elog_add_event_wake(ELOG_WAKE_SOURCE_RTC, 0);
-
- if (pm1_sts & PCIEXPWAK_STS)
- elog_add_event_wake(ELOG_WAKE_SOURCE_PCIE, 0);
-}
-
-static void sb_save_sws(uint16_t pm1_status)
-{
- struct soc_power_reg *sws;
- uint32_t reg32;
- uint16_t reg16;
-
- sws = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(struct soc_power_reg));
- if (sws == NULL)
- return;
- sws->pm1_sts = pm1_status;
- sws->pm1_en = acpi_read16(MMIO_ACPI_PM1_EN);
- reg32 = acpi_read32(MMIO_ACPI_GPE0_STS);
- acpi_write32(MMIO_ACPI_GPE0_STS, reg32);
- sws->gpe0_sts = reg32;
- sws->gpe0_en = acpi_read32(MMIO_ACPI_GPE0_EN);
- reg16 = acpi_read16(MMIO_ACPI_PM1_CNT_BLK);
- reg16 &= SLP_TYP;
- sws->wake_from = reg16 >> SLP_TYP_SHIFT;
-}
-
-static void sb_clear_pm1_status(void)
-{
- uint16_t pm1_sts = reset_pm1_status();
-
- sb_save_sws(pm1_sts);
- sb_log_pm1_status(pm1_sts);
- print_pm1_status(pm1_sts);
-}
-
static int get_index_bit(uint32_t value, uint16_t limit)
{
uint16_t i;
@@ -884,7 +574,7 @@ BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, set_nvs_sws, NULL);
void southbridge_init(void *chip_info)
{
sb_init_acpi_ports();
- sb_clear_pm1_status();
+ acpi_clear_pm1_status();
}
static void set_sb_final_nvs(void)
@@ -959,3 +649,27 @@ static void set_pci_irqs(void *unused)
* on entry into BS_DEV_ENABLE.
*/
BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, set_pci_irqs, NULL);
+
+void save_uma_size(uint32_t size)
+{
+ biosram_write32(BIOSRAM_UMA_SIZE, size);
+}
+
+void save_uma_base(uint64_t base)
+{
+ biosram_write32(BIOSRAM_UMA_BASE, (uint32_t) base);
+ biosram_write32(BIOSRAM_UMA_BASE + 4, (uint32_t) (base >> 32));
+}
+
+uint32_t get_uma_size(void)
+{
+ return biosram_read32(BIOSRAM_UMA_SIZE);
+}
+
+uint64_t get_uma_base(void)
+{
+ uint64_t base;
+ base = biosram_read32(BIOSRAM_UMA_BASE);
+ base |= ((uint64_t)(biosram_read32(BIOSRAM_UMA_BASE + 4)) << 32);
+ return base;
+}
diff --git a/src/soc/amd/stoneyridge/spi.c b/src/soc/amd/stoneyridge/spi.c
index c682d980bb..8abfa160f4 100644
--- a/src/soc/amd/stoneyridge/spi.c
+++ b/src/soc/amd/stoneyridge/spi.c
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include
#define SPI_DEBUG_DRIVER CONFIG(DEBUG_SPI_FLASH)
@@ -103,11 +104,7 @@ static int execute_command(void)
void spi_init(void)
{
- uintptr_t bar;
-
- bar = pci_read_config32(SOC_LPC_DEV, SPIROM_BASE_ADDRESS_REGISTER);
- bar = ALIGN_DOWN(bar, 64);
- set_spibar(bar);
+ set_spibar(lpc_get_spibase());
}
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
diff --git a/src/soc/intel/apollolake/meminit_util_apl.c b/src/soc/intel/apollolake/meminit_util_apl.c
index b272a99efe..16d14d945f 100644
--- a/src/soc/intel/apollolake/meminit_util_apl.c
+++ b/src/soc/intel/apollolake/meminit_util_apl.c
@@ -91,7 +91,9 @@ void save_lpddr4_dimm_info_part_num(const char *dram_part_num)
dram_part_num,
strlen(dram_part_num),
NULL, /* SPD not available */
- memory_info_hob->DataWidth);
+ memory_info_hob->DataWidth,
+ 0,
+ 0);
index++;
}
}
diff --git a/src/soc/intel/apollolake/meminit_util_glk.c b/src/soc/intel/apollolake/meminit_util_glk.c
index 29dcd56767..59e133076a 100644
--- a/src/soc/intel/apollolake/meminit_util_glk.c
+++ b/src/soc/intel/apollolake/meminit_util_glk.c
@@ -97,7 +97,9 @@ void save_lpddr4_dimm_info_part_num(const char *dram_part_num)
dram_part_num,
strlen(dram_part_num),
src_dimm->SpdSave + SPD_SAVE_OFFSET_SERIAL,
- memory_info_hob->DataWidth);
+ memory_info_hob->DataWidth,
+ 0,
+ 0);
index++;
}
}
diff --git a/src/soc/intel/braswell/Kconfig b/src/soc/intel/braswell/Kconfig
index ed5c9728a3..920179f834 100644
--- a/src/soc/intel/braswell/Kconfig
+++ b/src/soc/intel/braswell/Kconfig
@@ -51,15 +51,23 @@ config CPU_SPECIFIC_OPTIONS
select INTEL_GMA_SWSMISCI
select CPU_INTEL_COMMON
select SOUTHBRIDGE_INTEL_COMMON_SMBUS
+ select C_ENVIRONMENT_BOOTBLOCK
+
+config DCACHE_BSP_STACK_SIZE
+ hex
+ default 0x2000
+ help
+ The amount of anticipated stack usage in CAR by bootblock and
+ other stages.
+
+config C_ENV_BOOTBLOCK_SIZE
+ hex
+ default 0x8000
config VBOOT
select VBOOT_MUST_REQUEST_DISPLAY
select VBOOT_STARTS_IN_ROMSTAGE
-config BOOTBLOCK_CPU_INIT
- string
- default "soc/intel/braswell/bootblock/bootblock.c"
-
config MMCONF_BASE_ADDRESS
hex
default 0xe0000000
diff --git a/src/soc/intel/braswell/Makefile.inc b/src/soc/intel/braswell/Makefile.inc
index e479a3c5e5..1017d80c65 100644
--- a/src/soc/intel/braswell/Makefile.inc
+++ b/src/soc/intel/braswell/Makefile.inc
@@ -9,9 +9,14 @@ subdirs-y += ../../../cpu/intel/microcode
subdirs-y += ../../../cpu/intel/turbo
subdirs-y += ../../../cpu/intel/common
+bootblock-y += gpio_support.c
+bootblock-y += bootblock/bootblock.c
+bootblock-y += lpc_init.c
+bootblock-y += pmutil.c
+bootblock-y += tsc_freq.c
+
romstage-y += gpio_support.c
romstage-y += iosf.c
-romstage-y += lpc_init.c
romstage-y += memmap.c
romstage-y += pmutil.c
romstage-y += smbus.c
diff --git a/src/soc/intel/braswell/bootblock/bootblock.c b/src/soc/intel/braswell/bootblock/bootblock.c
index 457b8b895d..2d1a3e8687 100644
--- a/src/soc/intel/braswell/bootblock/bootblock.c
+++ b/src/soc/intel/braswell/bootblock/bootblock.c
@@ -3,6 +3,7 @@
*
* Copyright (C) 2013 Google, Inc.
* Copyright (C) 2015 Intel Corp.
+ * Copyright (C) 2018 Eltan B.V.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,37 +15,93 @@
* GNU General Public License for more details.
*/
+#include
+#include
+#include
#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include
-#include
+#include
+#include
+#include
-static void set_var_mtrr(int reg, uint32_t base, uint32_t size, int type)
+asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
{
- msr_t basem, maskm;
- basem.lo = base | type;
- basem.hi = 0;
- wrmsr(MTRR_PHYS_BASE(reg), basem);
- maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID;
- maskm.hi = (1 << (CONFIG_CPU_ADDR_BITS - 32)) - 1;
- wrmsr(MTRR_PHYS_MASK(reg), maskm);
+ /* Call lib/bootblock.c main */
+ bootblock_main_with_timestamp(base_timestamp, NULL, 0);
}
-static void enable_rom_caching(void)
+static void program_base_addresses(void)
{
- msr_t msr;
+ uint32_t reg;
+ const uint32_t lpc_dev = PCI_DEV(0, LPC_DEV, LPC_FUNC);
- disable_cache();
- /* Why only top 4MiB ? */
- set_var_mtrr(1, 0xffc00000, 4*1024*1024, MTRR_TYPE_WRPROT);
- enable_cache();
+ /* Memory Mapped IO registers. */
+ reg = PMC_BASE_ADDRESS | 2;
+ pci_write_config32(lpc_dev, PBASE, reg);
+ reg = IO_BASE_ADDRESS | 2;
+ pci_write_config32(lpc_dev, IOBASE, reg);
+ reg = ILB_BASE_ADDRESS | 2;
+ pci_write_config32(lpc_dev, IBASE, reg);
+ reg = SPI_BASE_ADDRESS | 2;
+ pci_write_config32(lpc_dev, SBASE, reg);
+ reg = MPHY_BASE_ADDRESS | 2;
+ pci_write_config32(lpc_dev, MPBASE, reg);
+ reg = PUNIT_BASE_ADDRESS | 2;
+ pci_write_config32(lpc_dev, PUBASE, reg);
+ reg = RCBA_BASE_ADDRESS | 1;
+ pci_write_config32(lpc_dev, RCBA, reg);
- /* Enable Variable MTRRs */
- msr.hi = 0x00000000;
- msr.lo = 0x00000800;
- wrmsr(MTRR_DEF_TYPE_MSR, msr);
+ /* IO Port Registers. */
+ reg = ACPI_BASE_ADDRESS | 2;
+ pci_write_config32(lpc_dev, ABASE, reg);
+ reg = GPIO_BASE_ADDRESS | 2;
+ pci_write_config32(lpc_dev, GBASE, reg);
+}
+
+static void tco_disable(void)
+{
+ uint32_t reg;
+
+ reg = inl(ACPI_BASE_ADDRESS + TCO1_CNT);
+ reg |= TCO_TMR_HALT;
+ outl(reg, ACPI_BASE_ADDRESS + TCO1_CNT);
+}
+
+static void spi_init(void)
+{
+ void *scs = (void *)(SPI_BASE_ADDRESS + SCS);
+ void *bcr = (void *)(SPI_BASE_ADDRESS + BCR);
+ uint32_t reg;
+
+ /* Disable generating SMI when setting WPD bit. */
+ write32(scs, read32(scs) & ~SMIWPEN);
+ /*
+ * Enable caching and prefetching in the SPI controller. Disable
+ * the SMM-only BIOS write and set WPD bit.
+ */
+ reg = (read32(bcr) & ~SRC_MASK) | SRC_CACHE_PREFETCH | BCR_WPD;
+ reg &= ~EISS;
+ write32(bcr, reg);
+}
+
+static void soc_rtc_init(void)
+{
+ int rtc_failed = rtc_failure();
+
+ if (rtc_failed) {
+ printk(BIOS_ERR,
+ "RTC Failure detected. Resetting date to %x/%x/%x%x\n",
+ COREBOOT_BUILD_MONTH_BCD,
+ COREBOOT_BUILD_DAY_BCD,
+ 0x20,
+ COREBOOT_BUILD_YEAR_BCD);
+ }
+
+ cmos_init(rtc_failed);
}
static void setup_mmconfig(void)
@@ -67,12 +124,22 @@ static void setup_mmconfig(void)
pci_io_write_config32(IOSF_PCI_DEV, MCR_REG, reg);
}
-static void bootblock_cpu_init(void)
+
+void bootblock_soc_early_init(void)
{
/* Allow memory-mapped PCI config access. */
setup_mmconfig();
- /* Load microcode before any caching. */
- intel_update_microcode_from_cbfs();
- enable_rom_caching();
+ /* Early chipset initialization */
+ program_base_addresses();
+ tco_disable();
+}
+void bootblock_soc_init(void)
+{
+ /* Continue chipset initialization */
+ soc_rtc_init();
+ set_max_freq();
+ spi_init();
+
+ lpc_init();
}
diff --git a/src/soc/intel/braswell/romstage/pmc.c b/src/soc/intel/braswell/include/soc/bootblock.h
similarity index 68%
rename from src/soc/intel/braswell/romstage/pmc.c
rename to src/soc/intel/braswell/include/soc/bootblock.h
index 127458e59c..e6e25ccbb1 100644
--- a/src/soc/intel/braswell/romstage/pmc.c
+++ b/src/soc/intel/braswell/include/soc/bootblock.h
@@ -2,7 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2013 Google Inc.
- * Copyright (C) 2015 Intel Corp.
+ * Copyright (C) 2015-2016 Intel Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,15 +14,9 @@
* GNU General Public License for more details.
*/
-#include
-#include
-#include
+#ifndef _SOC_BOOTBLOCK_H_
+#define _SOC_BOOTBLOCK_H_
-void tco_disable(void)
-{
- uint32_t reg;
+void set_max_freq(void);
- reg = inl(ACPI_BASE_ADDRESS + TCO1_CNT);
- reg |= TCO_TMR_HALT;
- outl(reg, ACPI_BASE_ADDRESS + TCO1_CNT);
-}
+#endif /* _SOC_BOOTBLOCK_H_ */
diff --git a/src/soc/intel/braswell/include/soc/romstage.h b/src/soc/intel/braswell/include/soc/romstage.h
index 4ecbd2c1f9..9fad9bc5a0 100644
--- a/src/soc/intel/braswell/include/soc/romstage.h
+++ b/src/soc/intel/braswell/include/soc/romstage.h
@@ -23,12 +23,10 @@
#include
void gfx_init(void);
-void tco_disable(void);
void punit_init(void);
void set_max_freq(void);
-/* romstage_common.c functions */
-void program_base_addresses(void);
+/* romstage.c functions */
int chipset_prev_sleep_state(struct chipset_power_state *ps);
/* Values for FSP's PcdMemoryTypeEnable */
diff --git a/src/soc/intel/braswell/romstage/Makefile.inc b/src/soc/intel/braswell/romstage/Makefile.inc
index 3d3e407a29..d405133110 100644
--- a/src/soc/intel/braswell/romstage/Makefile.inc
+++ b/src/soc/intel/braswell/romstage/Makefile.inc
@@ -1,3 +1,2 @@
romstage-y += ../../../../cpu/intel/car/romstage.c
-romstage-y += pmc.c
romstage-y += romstage.c
diff --git a/src/soc/intel/braswell/romstage/romstage.c b/src/soc/intel/braswell/romstage/romstage.c
index 8dfc291d1e..e0e22f220e 100644
--- a/src/soc/intel/braswell/romstage/romstage.c
+++ b/src/soc/intel/braswell/romstage/romstage.c
@@ -19,90 +19,13 @@
#include
#include
#include
-#include
-#include
-#include
#include
-#include
-#include
-#include