Allocators for different memory regions types
Hide some details of the resource allocator from rest of the world. These should come in handy when fixing some aspects of MTRR setup. Change-Id: I8acad98f25e56cd8bae64fb52539d81ce94f9c73 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/1367 Reviewed-by: Patrick Georgi <patrick@georgi-clan.de> Tested-by: build bot (Jenkins) Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
This commit is contained in:
parent
19e99f5cf1
commit
ecf1ed49c7
|
@ -795,8 +795,8 @@ void show_all_devs_resources(int debug_level, const char* msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ram_resource(device_t dev, unsigned long index,
|
void fixed_mem_resource(device_t dev, unsigned long index,
|
||||||
unsigned long basek, unsigned long sizek)
|
unsigned long basek, unsigned long sizek, unsigned long type)
|
||||||
{
|
{
|
||||||
struct resource *resource;
|
struct resource *resource;
|
||||||
|
|
||||||
|
@ -806,23 +806,10 @@ void ram_resource(device_t dev, unsigned long index,
|
||||||
resource = new_resource(dev, index);
|
resource = new_resource(dev, index);
|
||||||
resource->base = ((resource_t)basek) << 10;
|
resource->base = ((resource_t)basek) << 10;
|
||||||
resource->size = ((resource_t)sizek) << 10;
|
resource->size = ((resource_t)sizek) << 10;
|
||||||
resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
|
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
|
||||||
IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
|
IORESOURCE_STORED | IORESOURCE_ASSIGNED;
|
||||||
}
|
|
||||||
|
|
||||||
void uma_resource(device_t dev, unsigned long index,
|
resource->flags |= type;
|
||||||
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_UMA_FB |
|
|
||||||
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)
|
||||||
|
|
|
@ -170,10 +170,21 @@ void pci_domain_read_resources(struct device *dev);
|
||||||
unsigned int pci_domain_scan_bus(struct device *dev, unsigned int max);
|
unsigned int pci_domain_scan_bus(struct device *dev, unsigned int max);
|
||||||
unsigned int scan_static_bus(device_t bus, unsigned int max);
|
unsigned int scan_static_bus(device_t bus, unsigned int max);
|
||||||
|
|
||||||
void ram_resource(device_t dev, unsigned long index,
|
void fixed_mem_resource(device_t dev, unsigned long index,
|
||||||
unsigned long basek, unsigned long sizek);
|
unsigned long basek, unsigned long sizek, unsigned long type);
|
||||||
void uma_resource(device_t dev, unsigned long index,
|
|
||||||
unsigned long basek, unsigned long sizek);
|
#define ram_resource(dev, idx, basek, sizek) \
|
||||||
|
fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_CACHEABLE)
|
||||||
|
|
||||||
|
#define bad_ram_resource(dev, idx, basek, sizek) \
|
||||||
|
fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE | IORESOURCE_CACHEABLE )
|
||||||
|
|
||||||
|
#define uma_resource(dev, idx, basek, sizek) \
|
||||||
|
fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE | IORESOURCE_UMA_FB)
|
||||||
|
|
||||||
|
#define mmio_resource(dev, idx, basek, sizek) \
|
||||||
|
fixed_mem_resource(dev, idx, basek, sizek, IORESOURCE_RESERVE)
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue