aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2022-08-02 11:38:18 +1000
committerThomas Heijligen <src@posteo.de>2022-08-08 20:56:34 +0000
commit1a9175f272e39bcbd01e2d0e742fe5eaa6e43f6f (patch)
treee7df8ec66422ee77b8bee993904bf09144e4f714
parent83a30d01cb0aaf6371b8271747f1db2c64f47edc (diff)
downloadflashrom-1a9175f272e39bcbd01e2d0e742fe5eaa6e43f6f.tar.gz
flashrom-1a9175f272e39bcbd01e2d0e742fe5eaa6e43f6f.tar.bz2
flashrom-1a9175f272e39bcbd01e2d0e742fe5eaa6e43f6f.zip
ich_descriptors.c: Reduce i/o op paths in read_descriptor_reg()
Simplify I/O operations to one path after all branch logic is complete. Work towards consolidated enum ich gen branch logic. Change-Id: I37d22217a7cfc4cffc4f6cfe7b1df6f30df3ca92 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66349 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Thomas Heijligen <src@posteo.de>
-rw-r--r--ich_descriptors.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ich_descriptors.c b/ich_descriptors.c
index 87096037..1cb75830 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -1278,8 +1278,11 @@ int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors
static uint32_t read_descriptor_reg(enum ich_chipset cs, uint8_t section, uint16_t offset, void *spibar)
{
uint32_t control = 0;
+ uint32_t woffset, roffset;
+
control |= (section << FDOC_FDSS_OFF) & FDOC_FDSS;
control |= (offset << FDOC_FDSI_OFF) & FDOC_FDSI;
+
switch (cs) {
case CHIPSET_100_SERIES_SUNRISE_POINT:
case CHIPSET_C620_SERIES_LEWISBURG:
@@ -1292,12 +1295,16 @@ static uint32_t read_descriptor_reg(enum ich_chipset cs, uint8_t section, uint16
case CHIPSET_GEMINI_LAKE:
case CHIPSET_JASPER_LAKE:
case CHIPSET_ELKHART_LAKE:
- mmio_le_writel(control, spibar + PCH100_REG_FDOC);
- return mmio_le_readl(spibar + PCH100_REG_FDOD);
+ woffset = PCH100_REG_FDOC;
+ roffset = PCH100_REG_FDOD;
+ break;
default:
- mmio_le_writel(control, spibar + ICH9_REG_FDOC);
- return mmio_le_readl(spibar + ICH9_REG_FDOD);
+ woffset = ICH9_REG_FDOC;
+ roffset = ICH9_REG_FDOD;
}
+
+ mmio_le_writel(control, spibar + woffset);
+ return mmio_le_readl(spibar + roffset);
}
int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc)