summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2012-07-10 13:27:26 +0300
committerPatrick Georgi <patrick@georgi-clan.de>2012-07-16 18:38:46 +0200
commit63f8c088307c5296809d9499b3b7cbaedb2a4440 (patch)
treeca18116deb580909d452f42f1c35d2fb6e5f53dd
parentd4220691c58934420ad196d4a0903dc88388ae85 (diff)
downloadcoreboot-63f8c088307c5296809d9499b3b7cbaedb2a4440.tar.xz
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> Reviewed-on: http://review.coreboot.org/1203 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
-rw-r--r--src/devices/device_util.c15
-rw-r--r--src/include/device/device.h2
-rw-r--r--src/northbridge/amd/agesa/family10/northbridge.c14
-rw-r--r--src/northbridge/amd/agesa/family12/northbridge.c17
-rw-r--r--src/northbridge/amd/agesa/family14/northbridge.c16
-rw-r--r--src/northbridge/amd/agesa/family15/northbridge.c14
-rw-r--r--src/northbridge/amd/agesa/family15tn/northbridge.c16
-rw-r--r--src/northbridge/amd/amdfam10/northbridge.c14
-rw-r--r--src/northbridge/amd/amdk8/northbridge.c14
9 files changed, 25 insertions, 97 deletions
diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index 7c1cde9895..81d679a206 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -810,6 +810,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 f36710ae0a..eb73c4ef53 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -166,6 +166,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 7b73987e40..3a1eb7ba04 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 efc0a489d8..50694c7416 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 f7c3b8e11f..9e6b257e0f 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 130086eb91..c76c963620 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 3df5c600e8..ef5f1d8416 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 3b20684e75..dd2a9aff16 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 5eeeda21a4..621c0f183b 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);