UPSTREAM: nb/intel/ironlake: Clean up `jedec_read()` function
Deduplicate a condition and reflow some lines.
Tested on HP ProBook 6550b, still reaches TianoCore payload.
(cherry picked from commit 4cee77bce3d7a7426ccc24b2d7d92f4d87955f38)
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61939
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Original-Change-Id: If5786f34585e15100385d452b5b03a36da4c7c87
GitOrigin-RevId: 4cee77bce3d7a7426ccc24b2d7d92f4d87955f38
Change-Id: I113ce30ed50601bf97627b74da4102de28a77e4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/coreboot/+/3487815
Tested-by: CopyBot Service Account <copybot.service@gmail.com>
Reviewed-by: Reka Norman <rekanorman@chromium.org>
Commit-Queue: Reka Norman <rekanorman@chromium.org>
diff --git a/src/northbridge/intel/ironlake/raminit.c b/src/northbridge/intel/ironlake/raminit.c
index fe67f0d..1f55083 100644
--- a/src/northbridge/intel/ironlake/raminit.c
+++ b/src/northbridge/intel/ironlake/raminit.c
@@ -915,19 +915,14 @@
int total_rank, u8 addr3, unsigned int value)
{
/* Handle mirrored mapping. */
- if ((rank & 1) && (info->spd[channel][slot][RANK1_ADDRESS_MAPPING] & 1))
- addr3 = (addr3 & 0xCF) | ((addr3 & 0x10) << 1) |
- ((addr3 >> 1) & 0x10);
+ if ((rank & 1) && (info->spd[channel][slot][RANK1_ADDRESS_MAPPING] & 1)) {
+ addr3 = (addr3 & 0xCF) | ((addr3 & 0x10) << 1) | ((addr3 >> 1) & 0x10);
+ value = (value & ~0x1f8) | ((value >> 1) & 0xa8) | ((value & 0xa8) << 1);
+ }
mchbar_clrsetbits8(0x271, 0x1f << 1, addr3);
mchbar_clrsetbits8(0x671, 0x1f << 1, addr3);
- /* Handle mirrored mapping. */
- if ((rank & 1) && (info->spd[channel][slot][RANK1_ADDRESS_MAPPING] & 1))
- value =
- (value & ~0x1f8) | ((value >> 1) & 0xa8) | ((value & 0xa8)
- << 1);
-
read32p((value << 3) | (total_rank << 28));
mchbar_clrsetbits8(0x271, 0x1f << 1, 1 << 1);