Allocating Resource for Legacy VGA Buffer

Li-Ta Lo ollie at lanl.gov
Thu Dec 2 07:14:00 CET 2004


Eric,

I tried to allocate a MEM resource for legacy VGA framebuffer (0xA0000 -
0xBFFFF) on AMDK8 NB Fun 1. I find a new mem_pair and assigned base 
and size of the resource as the code show in the bottom. But at the run 
time the resrouce allocation code still try to allocate that resource
to  0xA0000 to 0x002ffffff. Why it does not care about the 
resource->size field nor the FIXED flag ?

Ollie

static void amdk8_create_vga_resource(device_t dev, unsigned nodeid)
{
	struct resource *resource;
	unsigned link;
	for (link = 0; link < dev->links; link++) {
		if (dev->link[link].bridge_ctrl & PCI_BRIDGE_CTL_VGA) {
			printk_info("%s: bridge on link %d has VGA device\n",
				    dev_path(dev), link);
			printk_info("creating MEM pair for VGA memory\n");
			/* Initialize the io space constraints on the current bus */
			resource =  amdk8_find_mempair(dev, nodeid, link);
			printk_info("MEM pair register %x\n", resource->index - 0x100);
			resource->base = 0xa0000;
			resource->size = 0x20000;
			resource->gran = 16;
			resource->align = 16;
			resource->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM |
IORESOURCE_FIXED | IORESOURCE_ASSIGNED;
		}
	}
}
static void amdk8_set_resources(device_t dev)
{
	unsigned nodeid, link;
	int i;

	/* Find the nodeid */
	nodeid = amdk8_nodeid(dev);	

	amdk8_create_vga_resource(dev, nodeid);
	
	/* Set each resource we have found */
	for (i = 0; i < dev->resources; i++) {
		amdk8_set_resource(dev, &dev->resource[i], nodeid);
	}
	
	for(link = 0; link < dev->links; link++) {
		struct bus *bus;
		bus = &dev->link[link];
		if (bus->children) {
			assign_resources(bus);
		}
	}
}





More information about the coreboot mailing list