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>
This commit is contained in:
Subrata Banik 2022-04-14 19:05:52 +05:30
parent 5530316024
commit f48b84330f
1 changed files with 15 additions and 0 deletions

View File

@ -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[] = {