summaryrefslogtreecommitdiffstats
path: root/src/northbridge/intel/haswell/pcie.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-20 14:07:22 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-06-22 04:46:03 +0000
commit6e0dd4e4ffd850d48849907c815fbef50092aa17 (patch)
tree2138beeea22dfae8fc060bd584eac29aab49c621 /src/northbridge/intel/haswell/pcie.c
parent24e14f9437a597f633b70caf4040cf1712901419 (diff)
downloadcoreboot-6e0dd4e4ffd850d48849907c815fbef50092aa17.tar.gz
coreboot-6e0dd4e4ffd850d48849907c815fbef50092aa17.tar.bz2
coreboot-6e0dd4e4ffd850d48849907c815fbef50092aa17.zip
nb/intel/haswell/pcie.c: Introduce helper variable
Introduce a helper variable to avoid some redundancy and to reduce the diffstat noise in follow-up changes. Tested with BUILD_TIMELESS=1, Asrock B85M Pro4 remains identical. Change-Id: I490675aaddd2b5a13d990664431f79a605999254 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55689 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/northbridge/intel/haswell/pcie.c')
-rw-r--r--src/northbridge/intel/haswell/pcie.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/northbridge/intel/haswell/pcie.c b/src/northbridge/intel/haswell/pcie.c
index d93639932fce..cea3f6ac8427 100644
--- a/src/northbridge/intel/haswell/pcie.c
+++ b/src/northbridge/intel/haswell/pcie.c
@@ -54,7 +54,9 @@ static void peg_enable(struct device *dev)
assert(func < ARRAY_SIZE(config->peg_cfg));
- const bool slot_implemented = !config->peg_cfg[func].is_onboard;
+ const struct peg_config *peg_cfg = &config->peg_cfg[func];
+
+ const bool slot_implemented = !peg_cfg->is_onboard;
if (slot_implemented) {
/* Default is 1, but register is R/WO and needs to be written to once */
@@ -69,7 +71,7 @@ static void peg_enable(struct device *dev)
/* Physical slot number (zero for ports connected to onboard devices) */
slotcap &= ~(0x1fff << 19);
if (slot_implemented) {
- uint16_t slot_number = config->peg_cfg[func].phys_slot_number & 0x1fff;
+ uint16_t slot_number = peg_cfg->phys_slot_number & 0x1fff;
if (slot_number == 0) {
/* Slot number must be non-zero and unique */
slot_number = func + 1;
@@ -79,9 +81,9 @@ static void peg_enable(struct device *dev)
/* Default to 1.0 watt scale */
slotcap &= ~(3 << 15);
- slotcap |= (config->peg_cfg[func].power_limit_scale & 3) << 15;
+ slotcap |= (peg_cfg->power_limit_scale & 3) << 15;
- uint8_t power_limit_value = config->peg_cfg[func].power_limit_value;
+ uint8_t power_limit_value = peg_cfg->power_limit_value;
if (power_limit_value == 0) {
/* Default to 75 watts */
power_limit_value = 75;