Re: Allocating Resource for Legacy VGA Buffer

2004-12-04 Thread Li-Ta Lo
On Fri, 2004-12-03 at 19:20, Eric W. Biederman wrote:
> Li-Ta Lo <[EMAIL PROTECTED]> writes:
> 
> > Eric,
> > 
> > I tried to allocate a MEM resource for legacy VGA framebuffer (0xA -
> > 0xB) 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  0xA to 0x002ff. 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.
> 

The problem is I have no way to know which node/link the
VGA connects to at the read_resources time. So I can not
return a correct resource which these info embedded.

I tried to extend the pci_read_resources() to include the
memory resource 0xa-0xbf as the read_resources()
method of the VGA device. It does not work neither. The
read_resources() does return one more resource but the
bridges ignore it. Did I miss something ?

Ollie


___
Linuxbios mailing list
[EMAIL PROTECTED]
http://www.clustermatic.org/mailman/listinfo/linuxbios


Re: Allocating Resource for Legacy VGA Buffer

2004-12-03 Thread Eric W. Biederman
Li-Ta Lo <[EMAIL PROTECTED]> writes:

> Eric,
> 
> I tried to allocate a MEM resource for legacy VGA framebuffer (0xA -
> 0xB) 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  0xA to 0x002ff. 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 = 0xa;
>   resource->size = 0x2;
>   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);
>   }
>   }
> }
___
Linuxbios mailing list
[EMAIL PROTECTED]
http://www.clustermatic.org/mailman/listinfo/linuxbios


Allocating Resource for Legacy VGA Buffer

2004-12-02 Thread Li-Ta Lo
Eric,

I tried to allocate a MEM resource for legacy VGA framebuffer (0xA -
0xB) 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  0xA to 0x002ff. 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 = 0xa;
resource->size = 0x2;
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);
}
}
}


___
Linuxbios mailing list
[EMAIL PROTECTED]
http://www.clustermatic.org/mailman/listinfo/linuxbios