summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2022-04-14 19:05:52 +0530
committerSubrata Banik <subratabanik@google.com>2022-04-23 17:17:51 +0000
commitf48b84330f7ce4b156fb4cac0ff42c48befff6e5 (patch)
tree88244d5b56ac938059d8df3959165378c37537a4
parent5530316024f5429ff9b6611e8abb1eaceefb7a45 (diff)
soc/intel/common/smbus: Add `finalize` operation for smbus
This patch implements the required operations to perform prior to booting to OS using coreboot native driver when platform decides to skip FSP notify APIs i.e. Post PCI Enumeration. The smbus `.final` operation ensures locking the TCO register when coreboot decides to skip FspNotifyApi() calls. BUG=b:211954778 TEST=Able to build google/brya with these changes and coreboot log with this code change as below with ADL SoC skip calling into FspNotifyAPIs: [INFO ] Finalize devices... [DEBUG] PCI: 00:1f.4 final > localhost ~ # lspci -xxx | less 00:1f.4 Intel Corporation Alder Lake PCH-P SMBus Host Controller (rev 01) Offset 8, Bit 12 a.k.a TCO Lock bit is set (meaning locked). Signed-off-by: Subrata Banik <subratabanik@google.com> Change-Id: Ie945680049514e6c5d797790a381a6946e836926 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63640 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
-rw-r--r--src/soc/intel/common/block/smbus/smbus.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/smbus/smbus.c b/src/soc/intel/common/block/smbus/smbus.c
index d1b65230b3..7fdbffc5ce 100644
--- a/src/soc/intel/common/block/smbus/smbus.c
+++ b/src/soc/intel/common/block/smbus/smbus.c
@@ -7,6 +7,7 @@
#include <device/pci_ids.h>
#include <soc/smbus.h>
#include <device/smbus_host.h>
+#include <intelblocks/tco.h>
#include "smbuslib.h"
static int lsmbus_read_byte(struct device *dev, u8 address)
@@ -63,6 +64,19 @@ static void smbus_read_resources(struct device *dev)
IORESOURCE_STORED | IORESOURCE_ASSIGNED;
}
+/*
+ * `finalize_smbus` function is native implementation of equivalent events
+ * performed by each FSP NotifyPhase() API invocations.
+ *
+ * Operations are:
+ * 1. TCO Lock.
+ */
+static void finalize_smbus(struct device *dev)
+{
+ if (!CONFIG(USE_FSP_NOTIFY_PHASE_POST_PCI_ENUM))
+ tco_lockdown();
+}
+
static struct device_operations smbus_ops = {
.read_resources = smbus_read_resources,
.set_resources = pci_dev_set_resources,
@@ -71,6 +85,7 @@ static struct device_operations smbus_ops = {
.init = pch_smbus_init,
.ops_pci = &pci_dev_ops_pci,
.ops_smbus_bus = &lops_smbus_bus,
+ .final = finalize_smbus,
};
static const unsigned short pci_device_ids[] = {