nb/intel/i945: Fix domain resources

Fixed resources have to be registered early during
read_resources() phase, such that device allocator
will avoid them.

Change-Id: Iff5f1426015a908e988ff757055034c87085c0f5
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/27119
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans 2018-06-15 19:37:23 +02:00 committed by Patrick Georgi
parent 00fa4f01e4
commit 794f56bdf5
1 changed files with 13 additions and 3 deletions

View File

@ -57,7 +57,7 @@ static int get_pcie_bar(u32 *base)
return 0; return 0;
} }
static void pci_domain_set_resources(struct device *dev) static void mch_domain_read_resources(struct device *dev)
{ {
uint32_t pci_tolm, tseg_sizek; uint32_t pci_tolm, tseg_sizek;
uint8_t tolud; uint8_t tolud;
@ -66,6 +66,8 @@ static void pci_domain_set_resources(struct device *dev)
uint64_t uma_memory_base = 0, uma_memory_size = 0; uint64_t uma_memory_base = 0, uma_memory_size = 0;
uint64_t tseg_memory_base = 0, tseg_memory_size = 0; uint64_t tseg_memory_base = 0, tseg_memory_size = 0;
pci_domain_read_resources(dev);
/* Can we find out how much memory we can use at most /* Can we find out how much memory we can use at most
* this way? * this way?
*/ */
@ -113,6 +115,14 @@ static void pci_domain_set_resources(struct device *dev)
ram_resource(dev, 4, 768, (tomk - 768)); ram_resource(dev, 4, 768, (tomk - 768));
uma_resource(dev, 5, uma_memory_base >> 10, uma_memory_size >> 10); uma_resource(dev, 5, uma_memory_base >> 10, uma_memory_size >> 10);
mmio_resource(dev, 6, tseg_memory_base >> 10, tseg_memory_size >> 10); mmio_resource(dev, 6, tseg_memory_base >> 10, tseg_memory_size >> 10);
}
static void mch_domain_set_resources(struct device *dev)
{
struct resource *res;
for (res = dev->resource_list; res; res = res->next)
report_resource_stored(dev, res, "");
assign_resources(dev->link_list); assign_resources(dev->link_list);
} }
@ -138,8 +148,8 @@ static const char *northbridge_acpi_name(const struct device *dev)
* See e7525/northbridge.c for an example. * See e7525/northbridge.c for an example.
*/ */
static struct device_operations pci_domain_ops = { static struct device_operations pci_domain_ops = {
.read_resources = pci_domain_read_resources, .read_resources = mch_domain_read_resources,
.set_resources = pci_domain_set_resources, .set_resources = mch_domain_set_resources,
.enable_resources = NULL, .enable_resources = NULL,
.init = NULL, .init = NULL,
.scan_bus = pci_domain_scan_bus, .scan_bus = pci_domain_scan_bus,