nb/intel/ironlake: Clean up `jedec_read()` function

Deduplicate a condition and reflow some lines.

Tested on HP ProBook 6550b, still reaches TianoCore payload.

Change-Id: If5786f34585e15100385d452b5b03a36da4c7c87
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>
This commit is contained in:
Angel Pons 2022-02-14 14:12:52 +01:00 committed by Felix Held
parent fa5ed059eb
commit 4cee77bce3
1 changed files with 4 additions and 9 deletions

View File

@ -915,19 +915,14 @@ static void jedec_read(struct raminfo *info,
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);