diff options
author | Jacob Garber <jgarber1@ualberta.ca> | 2019-06-10 16:32:47 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-07-10 10:15:51 +0000 |
commit | 975a7e3ba3e646f91a5c6e73968e9efd1a1521f1 (patch) | |
tree | 266c482f7ccd3bf7eadbe006f68ac33b7cc0f69b /src/northbridge | |
parent | 64fb4a32e0b7e51f25f530d232fefc14c7523def (diff) | |
download | coreboot-975a7e3ba3e646f91a5c6e73968e9efd1a1521f1.tar.xz |
nb/intel/nehalem: Tidy quickpath_reserved calculation
- Remove unnecessary braces
- Move variable assignment out of function call
- Do not find lowest bit set of 0, which is undefined
- Use unsigned integer when bit shifting
Change-Id: I8651f8cd04165d8d31c44f7919ad5e43499d3d4c
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1229562
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33381
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/northbridge')
-rw-r--r-- | src/northbridge/intel/nehalem/raminit.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c index 0b5f44c73f..b4ff85cdd4 100644 --- a/src/northbridge/intel/nehalem/raminit.c +++ b/src/northbridge/intel/nehalem/raminit.c @@ -1434,14 +1434,17 @@ static void program_total_memory_map(struct raminfo *info) memory_map[2] = TOUUD | 1; quickpath_reserved = 0; - { - u32 t; + u32 t = pci_read_config32(PCI_DEV(QUICKPATH_BUS, 0, 1), 0x68); - gav(t = pci_read_config32(PCI_DEV(QUICKPATH_BUS, 0, 1), 0x68)); - if (t & 0x800) - quickpath_reserved = - (1 << find_lowest_bit_set32(t >> 20)); + gav(t); + + if (t & 0x800) { + u32 shift = t >> 20; + if (shift == 0) + die("Quickpath value is 0\n"); + quickpath_reserved = (u32)1 << find_lowest_bit_set32(shift); } + if (memory_remap) TOUUD -= quickpath_reserved; |