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>
This commit is contained in:
Kyösti Mälkki 2012-07-10 13:27:26 +03:00 committed by Patrick Georgi
parent d4220691c5
commit 63f8c08830
9 changed files with 25 additions and 97 deletions

View File

@ -810,6 +810,21 @@ void ram_resource(device_t dev, unsigned long index,
IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; 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) void tolm_test(void *gp, struct device *dev, struct resource *new)
{ {
struct resource **best_p = gp; struct resource **best_p = gp;

View File

@ -166,6 +166,8 @@ unsigned int scan_static_bus(device_t bus, unsigned int max);
void ram_resource(device_t dev, unsigned long index, void ram_resource(device_t dev, unsigned long index,
unsigned long basek, unsigned long sizek); 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); void tolm_test(void *gp, struct device *dev, struct resource *new);
u32 find_pci_tolm(struct bus *bus); u32 find_pci_tolm(struct bus *bus);

View File

@ -910,18 +910,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
extern uint64_t uma_memory_base, uma_memory_size; 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 #endif
static void amdfam10_domain_set_resources(device_t dev) 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 #if CONFIG_GFXUMA
add_uma_resource(dev, 7); uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10);
#endif #endif
for(link = dev->link_list; link; link = link->next) { for(link = dev->link_list; link; link = link->next) {

View File

@ -340,20 +340,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
extern uint64_t uma_memory_base, uma_memory_size; 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 #endif
static void read_resources(device_t dev) 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); printk(BIOS_DEBUG, " adsr - high_tables_size = %x.\n",high_tables_size);
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
printk(BIOS_DEBUG, "adsr - adding uma resource.\n"); uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10);
add_uma_resource(dev, 7);
#endif #endif
for(link = dev->link_list; link; link = link->next) { for(link = dev->link_list; link; link = link->next) {

View File

@ -328,19 +328,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
extern uint64_t uma_memory_base, uma_memory_size; 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 #endif
static void read_resources(device_t dev) static void read_resources(device_t dev)
@ -733,8 +720,7 @@ static void domain_set_resources(device_t dev)
high_tables_size); high_tables_size);
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
printk(BIOS_DEBUG, "adsr - adding uma resource.\n"); uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10);
add_uma_resource(dev, 7);
#endif #endif
for (link = dev->link_list; link; link = link->next) { for (link = dev->link_list; link; link = link->next) {

View File

@ -628,18 +628,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
extern uint64_t uma_memory_base, uma_memory_size; 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 #endif
static void domain_set_resources(device_t dev) static void domain_set_resources(device_t dev)
@ -821,7 +809,7 @@ static void domain_set_resources(device_t dev)
} }
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
add_uma_resource(dev, 7); uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10);
#endif #endif
for(link = dev->link_list; link; link = link->next) { for(link = dev->link_list; link; link = link->next) {

View File

@ -615,18 +615,6 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
#if CONFIG_GFXUMA == 1 #if CONFIG_GFXUMA == 1
extern uint64_t uma_memory_base, uma_memory_size; 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 #endif
static void domain_set_resources(device_t dev) static void domain_set_resources(device_t dev)
@ -806,8 +794,8 @@ static void domain_set_resources(device_t dev)
#endif #endif
} }
#if CONFIG_GFXUMA == 1 #if CONFIG_GFXUMA
add_uma_resource(dev, 7); uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10);
#endif #endif
for(link = dev->link_list; link; link = link->next) { for(link = dev->link_list; link; link = link->next) {

View File

@ -849,18 +849,6 @@ static void disable_hoist_memory(unsigned long hole_startk, int node_id)
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
extern uint64_t uma_memory_base, uma_memory_size; 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 #endif
static void amdfam10_domain_set_resources(device_t dev) 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 #if CONFIG_GFXUMA
add_uma_resource(dev, 7); uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10);
#endif #endif
for(link = dev->link_list; link; link = link->next) { for(link = dev->link_list; link; link = link->next) {

View File

@ -824,18 +824,6 @@ static u32 hoist_memory(unsigned long hole_startk, int node_id)
#if CONFIG_GFXUMA #if CONFIG_GFXUMA
extern uint64_t uma_memory_base, uma_memory_size; 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 #endif
static void amdk8_domain_set_resources(device_t dev) 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 #if CONFIG_GFXUMA
add_uma_resource(dev, 7); uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10);
#endif #endif
assign_resources(dev->link_list); assign_resources(dev->link_list);