nb/intel/i945/northbridge.c: Improve readability

This cosmetic change does 2 things:
- change bitwise shifting to division
- Make the division by / KiB explicit for fixed legacy ranges like
  0xa0000-0xbffff.

Change-Id: I626989fa6625e0b3613a11e709c614d40a788b0e
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49623
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Arthur Heymans 2021-01-18 00:36:54 +01:00 committed by Angel Pons
parent e8ac16e7e9
commit a6e4afc1cb
1 changed files with 10 additions and 10 deletions

View File

@ -74,7 +74,7 @@ static void mch_domain_read_resources(struct device *dev)
printk(BIOS_DEBUG, "IGD decoded, subtracting ");
int uma_size = decode_igd_memory_size((reg16 >> 4) & 7);
printk(BIOS_DEBUG, "%dM UMA\n", uma_size >> 10);
printk(BIOS_DEBUG, "%dM UMA\n", uma_size / KiB);
tomk_stolen -= uma_size;
/* For reserving UMA memory in the memory map */
@ -85,15 +85,15 @@ static void mch_domain_read_resources(struct device *dev)
(unsigned int)uma_memory_base);
}
tseg_sizek = decode_tseg_size(pci_read_config8(d0f0, ESMRAMC)) >> 10;
printk(BIOS_DEBUG, "TSEG decoded, subtracting %dM\n", tseg_sizek >> 10);
tseg_sizek = decode_tseg_size(pci_read_config8(d0f0, ESMRAMC)) / KiB;
printk(BIOS_DEBUG, "TSEG decoded, subtracting %dM\n", tseg_sizek / KiB);
tomk_stolen -= tseg_sizek;
tseg_memory_base = tomk_stolen * 1024ULL;
tseg_memory_size = tseg_sizek * 1024ULL;
/* cbmem_top can be shifted downwards due to alignment.
Mark the region between cbmem_top and tomk as unusable */
cbmem_topk = ((uint32_t)cbmem_top() >> 10);
cbmem_topk = ((uint32_t)cbmem_top() / KiB);
delta_cbmem = tomk_stolen - cbmem_topk;
tomk_stolen -= delta_cbmem;
@ -103,16 +103,16 @@ static void mch_domain_read_resources(struct device *dev)
* number is always 0
*/
printk(BIOS_INFO, "Available memory: %dK", (uint32_t)tomk_stolen);
printk(BIOS_INFO, " (%dM)\n", (uint32_t)(tomk_stolen >> 10));
printk(BIOS_INFO, " (%dM)\n", (uint32_t)(tomk_stolen / KiB));
/* Report the memory regions */
ram_resource(dev, 3, 0, 640);
ram_resource(dev, 4, 768, (tomk - 768));
uma_resource(dev, 5, uma_memory_base >> 10, uma_memory_size >> 10);
mmio_resource(dev, 6, tseg_memory_base >> 10, tseg_memory_size >> 10);
ram_resource(dev, 3, 0, 0xa0000 / KiB);
ram_resource(dev, 4, 0xc0000 / KiB, (tomk - 0xc0000 / KiB));
uma_resource(dev, 5, uma_memory_base / KiB, uma_memory_size / KiB);
mmio_resource(dev, 6, tseg_memory_base / KiB, tseg_memory_size / KiB);
uma_resource(dev, 7, cbmem_topk, delta_cbmem);
/* legacy VGA memory */
mmio_resource(dev, 8, 640, 768 - 640);
mmio_resource(dev, 8, 0xa0000 / KiB, (0xc0000 - 0xa0000) / KiB);
}
static void mch_domain_set_resources(struct device *dev)