From 5e82d443aa730cce519ca119afdab3bb1de24a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Tue, 22 Dec 2020 11:31:39 +0200 Subject: sb/intel/lynxpoint: Refactor some GNVS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9524a44f8f4b8e286229d81d10704438f11c4580 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/48857 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/southbridge/intel/lynxpoint/serialio.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/southbridge/intel/lynxpoint/serialio.c b/src/southbridge/intel/lynxpoint/serialio.c index 0687cec6a1..05263fec39 100644 --- a/src/southbridge/intel/lynxpoint/serialio.c +++ b/src/southbridge/intel/lynxpoint/serialio.c @@ -129,6 +129,17 @@ static void serialio_init_once(int acpi_mode) pch_iobp_update(0xcb000180, ~0x0000003f, 0x0000003f); } +static void update_bars(int sio_index, u32 bar0, u32 bar1) +{ + /* Find ACPI NVS to update BARs */ + struct global_nvs *gnvs = acpi_get_gnvs(); + if (!gnvs) + return; + + gnvs->s0b[sio_index] = bar0; + gnvs->s1b[sio_index] = bar1; +} + static void serialio_init(struct device *dev) { struct southbridge_intel_lynxpoint_config *config = config_of(dev); @@ -205,18 +216,9 @@ static void serialio_init(struct device *dev) return; } - if (config->sio_acpi_mode) { - struct global_nvs *gnvs; - - /* Find ACPI NVS to update BARs */ - gnvs = acpi_get_gnvs(); - if (!gnvs) - return; - - /* Save BAR0 and BAR1 to ACPI NVS */ - gnvs->s0b[sio_index] = (u32)bar0->base; - gnvs->s1b[sio_index] = (u32)bar1->base; - } + /* Save BAR0 and BAR1 to ACPI NVS */ + if (config->sio_acpi_mode) + update_bars(sio_index, (u32)bar0->base, (u32)bar1->base); } static struct device_operations device_ops = { -- cgit v1.2.3