In drm_ioremap, provide extra slots for mapping AGP memory space; it's not
reasonable to assume that these regions will show up in a VGA BAR.
This commit is contained in:
parent
ef049074f2
commit
0f6e823d07
@ -848,6 +848,7 @@ struct drm_device {
|
|||||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
struct pci_attach_args pa;
|
struct pci_attach_args pa;
|
||||||
pci_map_data_t pci_map_data[DRM_MAX_PCI_RESOURCE];
|
pci_map_data_t pci_map_data[DRM_MAX_PCI_RESOURCE];
|
||||||
|
pci_map_data_t agp_map_data[DRM_MAX_PCI_RESOURCE];
|
||||||
int unit; /* drm unit number */
|
int unit; /* drm unit number */
|
||||||
#endif
|
#endif
|
||||||
void *irqh; /* Handle from bus_setup_intr */
|
void *irqh; /* Handle from bus_setup_intr */
|
||||||
|
@ -120,6 +120,47 @@ void *drm_ioremap(drm_device_t *dev, drm_local_map_t *map)
|
|||||||
return dev->pci_map_data[i].vaddr;
|
return dev->pci_map_data[i].vaddr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* failed to find a valid mapping; all hope isn't lost though */
|
||||||
|
for(i = 0; i<DRM_MAX_PCI_RESOURCE; i++) {
|
||||||
|
if (dev->agp_map_data[i].mapped > 0 &&
|
||||||
|
dev->agp_map_data[i].base == map->offset &&
|
||||||
|
dev->agp_map_data[i].size >= map->size) {
|
||||||
|
map->bst = dev->pa.pa_memt;
|
||||||
|
map->cnt = &(dev->agp_map_data[i].mapped);
|
||||||
|
map->mapsize = dev->agp_map_data[i].size;
|
||||||
|
dev->agp_map_data[i].mapped++;
|
||||||
|
map->bsh = dev->agp_map_data[i].bsh;
|
||||||
|
return dev->agp_map_data[i].vaddr;
|
||||||
|
}
|
||||||
|
if (dev->agp_map_data[i].mapped == 0) {
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
map->bst = dev->pa.pa_memt;
|
||||||
|
dev->agp_map_data[i].mapped++;
|
||||||
|
dev->agp_map_data[i].size = map->size;
|
||||||
|
dev->agp_map_data[i].flags = BUS_SPACE_MAP_LINEAR;
|
||||||
|
dev->agp_map_data[i].maptype = PCI_MAPREG_TYPE_MEM;
|
||||||
|
map->cnt = &(dev->agp_map_data[i].mapped);
|
||||||
|
map->mapsize = dev->agp_map_data[i].size;
|
||||||
|
|
||||||
|
rv = bus_space_map(map->bst, map->offset,
|
||||||
|
dev->agp_map_data[i].size,
|
||||||
|
dev->agp_map_data[i].flags, &map->bsh);
|
||||||
|
if (rv) {
|
||||||
|
dev->agp_map_data[i].mapped--;
|
||||||
|
DRM_DEBUG("ioremap: failed to map (%d)\n", rv);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
dev->agp_map_data[i].bsh = map->bsh;
|
||||||
|
dev->agp_map_data[i].vaddr =
|
||||||
|
bus_space_vaddr(map->bst, map->bsh);
|
||||||
|
DRM_DEBUG("ioremap agp mem found: %p\n",
|
||||||
|
dev->agp_map_data[i].vaddr);
|
||||||
|
return dev->agp_map_data[i].vaddr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now we can give up... */
|
||||||
DRM_DEBUG("drm_ioremap failed: offset=%lx size=%lu\n",
|
DRM_DEBUG("drm_ioremap failed: offset=%lx size=%lu\n",
|
||||||
map->offset, map->size);
|
map->offset, map->size);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user