Allocating Resource for Legacy VGA Buffer
Eric W. Biederman
ebiederman at lnxi.com
Fri Dec 3 16:05:01 CET 2004
Li-Ta Lo <ollie at lanl.gov> writes:
> 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 ?
The resource allocator should and it does in other cases.
Hmm. You don't even allocate this resource in read_resources
so the resource allocator might should not even see it.
The IORESOURCE_PREFETCH is not correct for that area though.
Setting up write-combining MSRs would be a very bad thing
to have happen. Which is what IORESOURCE_PREFETCH implies is
legal.
Eric
> 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