Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1203
-gerrit
commit a2d2a6b483485d8a2dc7b0af5893201f6454377c Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Tue Jul 10 13:27:26 2012 +0300
Add global uma_resource()
Like ram_resource(), but reserved and not cacheable.
Switch all AMD northbridges to use this one.
Change-Id: I88515c6a0f59f80fd8607c390d0d4a2a35d805f2 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/devices/device_util.c | 15 +++++++++++++++ src/include/device/device.h | 2 ++ src/northbridge/amd/agesa/family10/northbridge.c | 14 +------------- src/northbridge/amd/agesa/family12/northbridge.c | 17 +---------------- src/northbridge/amd/agesa/family14/northbridge.c | 16 +--------------- src/northbridge/amd/agesa/family15/northbridge.c | 14 +------------- src/northbridge/amd/agesa/family15tn/northbridge.c | 16 ++-------------- src/northbridge/amd/amdfam10/northbridge.c | 14 +------------- src/northbridge/amd/amdk8/northbridge.c | 14 +------------- 9 files changed, 25 insertions(+), 97 deletions(-)
diff --git a/src/devices/device_util.c b/src/devices/device_util.c index 5225938..4e25eb1 100644 --- a/src/devices/device_util.c +++ b/src/devices/device_util.c @@ -822,6 +822,21 @@ void ram_resource(device_t dev, unsigned long index, IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; }
+void uma_resource(device_t dev, unsigned long index, + unsigned long basek, unsigned long sizek) +{ + struct resource *resource; + + if (!sizek) + return; + + resource = new_resource(dev, index); + resource->base = ((resource_t)basek) << 10; + resource->size = ((resource_t)sizek) << 10; + resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | + IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; +} + void tolm_test(void *gp, struct device *dev, struct resource *new) { struct resource **best_p = gp; diff --git a/src/include/device/device.h b/src/include/device/device.h index 0aea1d6..c4332e5 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -159,6 +159,8 @@ unsigned int scan_static_bus(device_t bus, unsigned int max);
void ram_resource(device_t dev, unsigned long index, unsigned long basek, unsigned long sizek); +void uma_resource(device_t dev, unsigned long index, + unsigned long basek, unsigned long sizek); void tolm_test(void *gp, struct device *dev, struct resource *new); u32 find_pci_tolm(struct bus *bus);
diff --git a/src/northbridge/amd/agesa/family10/northbridge.c b/src/northbridge/amd/agesa/family10/northbridge.c index 7b73987..3a1eb7b 100644 --- a/src/northbridge/amd/agesa/family10/northbridge.c +++ b/src/northbridge/amd/agesa/family10/northbridge.c @@ -910,18 +910,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA extern uint64_t uma_memory_base, uma_memory_size; - -static void add_uma_resource(struct device *dev, int index) -{ - struct resource *resource; - - printk(BIOS_DEBUG, "Adding UMA memory area\n"); - resource = new_resource(dev, index); - resource->base = (resource_t) uma_memory_base; - resource->size = (resource_t) uma_memory_size; - resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | - IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; -} #endif
static void amdfam10_domain_set_resources(device_t dev) @@ -1102,7 +1090,7 @@ static void amdfam10_domain_set_resources(device_t dev) }
#if CONFIG_GFXUMA - add_uma_resource(dev, 7); + uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10); #endif
for(link = dev->link_list; link; link = link->next) { diff --git a/src/northbridge/amd/agesa/family12/northbridge.c b/src/northbridge/amd/agesa/family12/northbridge.c index efc0a48..50694c7 100644 --- a/src/northbridge/amd/agesa/family12/northbridge.c +++ b/src/northbridge/amd/agesa/family12/northbridge.c @@ -340,20 +340,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA extern uint64_t uma_memory_base, uma_memory_size; - -static void add_uma_resource(struct device *dev, int index) -{ - struct resource *resource; - - printk(BIOS_DEBUG, "\nFam12h - northbridge.c - add_uma_resource - Start.\n"); - - resource = new_resource(dev, index); - resource->base = (resource_t) uma_memory_base; - resource->size = (resource_t) uma_memory_size; - resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | - IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; - printk(BIOS_DEBUG, "Fam12h - northbridge.c - add_uma_resource - End.\n"); -} #endif
static void read_resources(device_t dev) @@ -759,8 +745,7 @@ printk(BIOS_DEBUG, " adsr - mmio_basek = %x.\n",mmio_basek); printk(BIOS_DEBUG, " adsr - high_tables_size = %x.\n",high_tables_size);
#if CONFIG_GFXUMA - printk(BIOS_DEBUG, "adsr - adding uma resource.\n"); - add_uma_resource(dev, 7); + uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10); #endif
for(link = dev->link_list; link; link = link->next) { diff --git a/src/northbridge/amd/agesa/family14/northbridge.c b/src/northbridge/amd/agesa/family14/northbridge.c index f7c3b8e..9e6b257 100644 --- a/src/northbridge/amd/agesa/family14/northbridge.c +++ b/src/northbridge/amd/agesa/family14/northbridge.c @@ -328,19 +328,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA extern uint64_t uma_memory_base, uma_memory_size; - -static void add_uma_resource(struct device *dev, int index) -{ - struct resource *resource; - - printk(BIOS_DEBUG, "\nFam14h - Adding UMA memory.\n"); - - resource = new_resource(dev, index); - resource->base = (resource_t) uma_memory_base; - resource->size = (resource_t) uma_memory_size; - resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | - IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; -} #endif
static void read_resources(device_t dev) @@ -733,8 +720,7 @@ static void domain_set_resources(device_t dev) high_tables_size);
#if CONFIG_GFXUMA - printk(BIOS_DEBUG, "adsr - adding uma resource.\n"); - add_uma_resource(dev, 7); + uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10); #endif
for (link = dev->link_list; link; link = link->next) { diff --git a/src/northbridge/amd/agesa/family15/northbridge.c b/src/northbridge/amd/agesa/family15/northbridge.c index 130086e..c76c963 100644 --- a/src/northbridge/amd/agesa/family15/northbridge.c +++ b/src/northbridge/amd/agesa/family15/northbridge.c @@ -628,18 +628,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA extern uint64_t uma_memory_base, uma_memory_size; -static void add_uma_resource(struct device *dev, int index) -{ - struct resource *resource; - - printk(BIOS_DEBUG, "Adding UMA memory area\n"); - resource = new_resource(dev, index); - resource->base = (resource_t) uma_memory_base; - resource->size = (resource_t) uma_memory_size; - resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | - IORESOURCE_FIXED | IORESOURCE_STORED | - IORESOURCE_ASSIGNED; -} #endif
static void domain_set_resources(device_t dev) @@ -821,7 +809,7 @@ static void domain_set_resources(device_t dev) }
#if CONFIG_GFXUMA - add_uma_resource(dev, 7); + uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10); #endif
for(link = dev->link_list; link; link = link->next) { diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c index 3df5c60..ef5f1d8 100644 --- a/src/northbridge/amd/agesa/family15tn/northbridge.c +++ b/src/northbridge/amd/agesa/family15tn/northbridge.c @@ -615,18 +615,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA == 1 extern uint64_t uma_memory_base, uma_memory_size; -static void add_uma_resource(struct device *dev, int index) -{ - struct resource *resource; - - printk(BIOS_DEBUG, "Adding UMA memory area\n"); - resource = new_resource(dev, index); - resource->base = (resource_t) uma_memory_base; - resource->size = (resource_t) uma_memory_size; - resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | - IORESOURCE_FIXED | IORESOURCE_STORED | - IORESOURCE_ASSIGNED; -} #endif
static void domain_set_resources(device_t dev) @@ -806,8 +794,8 @@ static void domain_set_resources(device_t dev) #endif }
-#if CONFIG_GFXUMA == 1 - add_uma_resource(dev, 7); +#if CONFIG_GFXUMA + uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10); #endif
for(link = dev->link_list; link; link = link->next) { diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c index 3b20684..dd2a9af 100644 --- a/src/northbridge/amd/amdfam10/northbridge.c +++ b/src/northbridge/amd/amdfam10/northbridge.c @@ -849,18 +849,6 @@ static void disable_hoist_memory(unsigned long hole_startk, int node_id)
#if CONFIG_GFXUMA extern uint64_t uma_memory_base, uma_memory_size; - -static void add_uma_resource(struct device *dev, int index) -{ - struct resource *resource; - - printk(BIOS_DEBUG, "Adding UMA memory area\n"); - resource = new_resource(dev, index); - resource->base = (resource_t) uma_memory_base; - resource->size = (resource_t) uma_memory_size; - resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | - IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; -} #endif
static void amdfam10_domain_set_resources(device_t dev) @@ -1090,7 +1078,7 @@ static void amdfam10_domain_set_resources(device_t dev) }
#if CONFIG_GFXUMA - add_uma_resource(dev, 7); + uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10); #endif
for(link = dev->link_list; link; link = link->next) { diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c index 5eeeda2..621c0f1 100644 --- a/src/northbridge/amd/amdk8/northbridge.c +++ b/src/northbridge/amd/amdk8/northbridge.c @@ -824,18 +824,6 @@ static u32 hoist_memory(unsigned long hole_startk, int node_id)
#if CONFIG_GFXUMA extern uint64_t uma_memory_base, uma_memory_size; - -static void add_uma_resource(struct device *dev, int index) -{ - struct resource *resource; - - printk(BIOS_DEBUG, "Adding UMA memory area\n"); - resource = new_resource(dev, index); - resource->base = (resource_t) uma_memory_base; - resource->size = (resource_t) uma_memory_size; - resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | - IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; -} #endif
static void amdk8_domain_set_resources(device_t dev) @@ -1073,7 +1061,7 @@ static void amdk8_domain_set_resources(device_t dev) }
#if CONFIG_GFXUMA - add_uma_resource(dev, 7); + uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10); #endif assign_resources(dev->link_list);