summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2020-12-22 11:31:39 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2021-02-23 05:58:18 +0000
commit5e82d443aa730cce519ca119afdab3bb1de24a71 (patch)
tree4b1d5afed038172a9663cd563fa8c24754417bbc /src
parent01ae4a7706f95bfe77fd629516d3b9436ae9629d (diff)
sb/intel/lynxpoint: Refactor some GNVS
Change-Id: I9524a44f8f4b8e286229d81d10704438f11c4580 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/48857 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/southbridge/intel/lynxpoint/serialio.c26
1 files 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 = {