merge with 2.4.10 kernel

main
Alan Hourihane 2001-09-25 09:32:16 +00:00
parent 390440c939
commit ca820fca87
18 changed files with 69 additions and 98 deletions

View File

@ -103,7 +103,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
goto done;
}
#if defined(__alpha__)
if ( !dev->pdev ) {
DRM_ERROR( "PCI device unknown!\n" );
goto done;
@ -118,9 +117,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
address = 0;
goto done;
}
#else
bus_address = virt_to_bus( (void *)address );
#endif
pci_gart = (u32 *)address;
@ -130,7 +126,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) );
for ( i = 0 ; i < pages ; i++ ) {
#if defined(__alpha__)
/* we need to support large memory configurations */
entry->busaddr[i] = pci_map_single(dev->pdev,
page_address( entry->pagelist[i] ),
@ -144,9 +139,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
goto done;
}
page_base = (u32) entry->busaddr[i];
#else
page_base = page_to_bus( entry->pagelist[i] );
#endif
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
*pci_gart++ = cpu_to_le32( page_base );
page_base += ATI_PCIGART_PAGE_SIZE;
@ -155,7 +148,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
ret = 1;
#if __i386__
#if defined(__i386__) || defined(__x86_64__)
asm volatile ( "wbinvd" ::: "memory" );
#else
mb();
@ -171,7 +164,6 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
unsigned long addr,
dma_addr_t bus_addr)
{
#if defined(__alpha__)
drm_sg_mem_t *entry = dev->sg;
unsigned long pages;
int i;
@ -197,8 +189,6 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
}
}
#endif
if ( addr ) {
DRM(ati_free_pcigart_table)( addr );
}

View File

@ -443,6 +443,8 @@ typedef struct drm_agp_head {
int acquired;
unsigned long base;
int agp_mtrr;
int cant_use_aperture;
unsigned long page_mask;
} drm_agp_head_t;
#endif
@ -451,9 +453,7 @@ typedef struct drm_sg_mem {
void *virtual;
int pages;
struct page **pagelist;
#if defined(__alpha__)
dma_addr_t *busaddr;
#endif
} drm_sg_mem_t;
typedef struct drm_sigdata {
@ -544,8 +544,8 @@ typedef struct drm_device {
#if __REALLY_HAVE_AGP
drm_agp_head_t *agp;
#endif
#ifdef __alpha__
struct pci_dev *pdev;
#ifdef __alpha__
#if LINUX_VERSION_CODE < 0x020403
struct pci_controler *hose;
#else

View File

@ -308,6 +308,14 @@ drm_agp_head_t *DRM(agp_init)(void)
default: head->chipset = "Unknown"; break;
}
#if LINUX_VERSION_CODE <= 0x020408
head->cant_use_aperture = 0;
head->page_mask = ~(0xfff);
#else
head->cant_use_aperture = head->agp_info.cant_use_aperture;
head->page_mask = head->agp_info.page_mask;
#endif
DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n",
head->agp_info.version.major,
head->agp_info.version.minor,

View File

@ -181,7 +181,7 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_ctx_priv_map_t request;
drm_map_t *map = NULL;
drm_map_list_t *r_list;
drm_map_list_t *r_list = NULL;
struct list_head *list;
if (copy_from_user(&request,

View File

@ -220,6 +220,7 @@ static char *drm_opts = NULL;
MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_PARM( drm_opts, "s" );
MODULE_LICENSE("GPL and additional rights");
static int DRM(setup)( drm_device_t *dev )
{

View File

@ -98,7 +98,6 @@ int DRM(setunique)(struct inode *inode, struct file *filp,
}
sprintf(dev->devname, "%s@%s", dev->name, dev->unique);
#ifdef __alpha__
do {
struct pci_dev *pci_dev;
int b, d, f;
@ -116,10 +115,11 @@ int DRM(setunique)(struct inode *inode, struct file *filp,
pci_dev = pci_find_slot(b, PCI_DEVFN(d,f));
if (pci_dev) {
dev->pdev = pci_dev;
#ifdef __alpha__
dev->hose = pci_dev->sysdata;
#endif
}
} while(0);
#endif
return 0;
}

View File

@ -47,11 +47,9 @@ void DRM(sg_cleanup)( drm_sg_mem_t *entry )
vfree( entry->virtual );
#if defined(__alpha__)
DRM(free)( entry->busaddr,
entry->pages * sizeof(*entry->busaddr),
DRM_MEM_PAGES );
#endif
DRM(free)( entry->pagelist,
entry->pages * sizeof(*entry->pagelist),
DRM_MEM_PAGES );
@ -99,7 +97,6 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
return -ENOMEM;
}
#if defined(__alpha__)
entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr),
DRM_MEM_PAGES );
if ( !entry->busaddr ) {
@ -112,15 +109,12 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
return -ENOMEM;
}
memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) );
#endif
entry->virtual = vmalloc_32( pages << PAGE_SHIFT );
if ( !entry->virtual ) {
#if defined(__alpha__)
DRM(free)( entry->busaddr,
entry->pages * sizeof(*entry->busaddr),
DRM_MEM_PAGES );
#endif
DRM(free)( entry->pagelist,
entry->pages * sizeof(*entry->pagelist),
DRM_MEM_PAGES );

View File

@ -60,7 +60,7 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access)
{
#if defined(__alpha__) && __REALLY_HAVE_AGP
#if __REALLY_HAVE_AGP
drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev;
drm_map_t *map = NULL;
@ -70,6 +70,9 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
/*
* Find the right map
*/
if(!dev->agp->cant_use_aperture) goto vm_nopage_error;
list_for_each(list, &dev->maplist->head) {
r_list = (drm_map_list_t *)list;
map = r_list->map;
@ -83,10 +86,12 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
struct drm_agp_mem *agpmem;
struct page *page;
#if __alpha__
/*
* Make it a bus-relative address
* Adjust to a bus-relative address
*/
baddr -= dev->hose->mem_space->start;
#endif
/*
* It's AGP memory - find the real physical page to map
@ -97,27 +102,24 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
break;
}
if (!agpmem) {
/*
* Oops - no memory found
*/
return NOPAGE_SIGBUS; /* couldn't find it */
}
if (!agpmem) goto vm_nopage_error;
/*
* Get the page, inc the use count, and return it
*/
offset = (baddr - agpmem->bound) >> PAGE_SHIFT;
agpmem->memory->memory[offset] &= ~1UL; /* HACK */
agpmem->memory->memory[offset] &= dev->agp->page_mask;
page = virt_to_page(__va(agpmem->memory->memory[offset]));
#if 0
DRM_ERROR("baddr = 0x%lx page = 0x%lx, offset = 0x%lx\n",
baddr, __va(agpmem->memory->memory[offset]), offset);
#endif
get_page(page);
DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx\n",
baddr, __va(agpmem->memory->memory[offset]), offset);
return page;
}
#endif
vm_nopage_error:
#endif /* __REALLY_HAVE_AGP */
return NOPAGE_SIGBUS; /* Disallow mremap */
}

View File

@ -103,7 +103,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
goto done;
}
#if defined(__alpha__)
if ( !dev->pdev ) {
DRM_ERROR( "PCI device unknown!\n" );
goto done;
@ -118,9 +117,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
address = 0;
goto done;
}
#else
bus_address = virt_to_bus( (void *)address );
#endif
pci_gart = (u32 *)address;
@ -130,7 +126,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) );
for ( i = 0 ; i < pages ; i++ ) {
#if defined(__alpha__)
/* we need to support large memory configurations */
entry->busaddr[i] = pci_map_single(dev->pdev,
page_address( entry->pagelist[i] ),
@ -144,9 +139,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
goto done;
}
page_base = (u32) entry->busaddr[i];
#else
page_base = page_to_bus( entry->pagelist[i] );
#endif
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
*pci_gart++ = cpu_to_le32( page_base );
page_base += ATI_PCIGART_PAGE_SIZE;
@ -155,7 +148,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
ret = 1;
#if __i386__
#if defined(__i386__) || defined(__x86_64__)
asm volatile ( "wbinvd" ::: "memory" );
#else
mb();
@ -171,7 +164,6 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
unsigned long addr,
dma_addr_t bus_addr)
{
#if defined(__alpha__)
drm_sg_mem_t *entry = dev->sg;
unsigned long pages;
int i;
@ -197,8 +189,6 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
}
}
#endif
if ( addr ) {
DRM(ati_free_pcigart_table)( addr );
}

View File

@ -443,6 +443,8 @@ typedef struct drm_agp_head {
int acquired;
unsigned long base;
int agp_mtrr;
int cant_use_aperture;
unsigned long page_mask;
} drm_agp_head_t;
#endif
@ -451,9 +453,7 @@ typedef struct drm_sg_mem {
void *virtual;
int pages;
struct page **pagelist;
#if defined(__alpha__)
dma_addr_t *busaddr;
#endif
} drm_sg_mem_t;
typedef struct drm_sigdata {
@ -544,8 +544,8 @@ typedef struct drm_device {
#if __REALLY_HAVE_AGP
drm_agp_head_t *agp;
#endif
#ifdef __alpha__
struct pci_dev *pdev;
#ifdef __alpha__
#if LINUX_VERSION_CODE < 0x020403
struct pci_controler *hose;
#else

View File

@ -308,6 +308,14 @@ drm_agp_head_t *DRM(agp_init)(void)
default: head->chipset = "Unknown"; break;
}
#if LINUX_VERSION_CODE <= 0x020408
head->cant_use_aperture = 0;
head->page_mask = ~(0xfff);
#else
head->cant_use_aperture = head->agp_info.cant_use_aperture;
head->page_mask = head->agp_info.page_mask;
#endif
DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n",
head->agp_info.version.major,
head->agp_info.version.minor,

View File

@ -181,7 +181,7 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_ctx_priv_map_t request;
drm_map_t *map = NULL;
drm_map_list_t *r_list;
drm_map_list_t *r_list = NULL;
struct list_head *list;
if (copy_from_user(&request,

View File

@ -220,6 +220,7 @@ static char *drm_opts = NULL;
MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_PARM( drm_opts, "s" );
MODULE_LICENSE("GPL and additional rights");
static int DRM(setup)( drm_device_t *dev )
{

View File

@ -98,7 +98,6 @@ int DRM(setunique)(struct inode *inode, struct file *filp,
}
sprintf(dev->devname, "%s@%s", dev->name, dev->unique);
#ifdef __alpha__
do {
struct pci_dev *pci_dev;
int b, d, f;
@ -116,10 +115,11 @@ int DRM(setunique)(struct inode *inode, struct file *filp,
pci_dev = pci_find_slot(b, PCI_DEVFN(d,f));
if (pci_dev) {
dev->pdev = pci_dev;
#ifdef __alpha__
dev->hose = pci_dev->sysdata;
#endif
}
} while(0);
#endif
return 0;
}

View File

@ -47,11 +47,9 @@ void DRM(sg_cleanup)( drm_sg_mem_t *entry )
vfree( entry->virtual );
#if defined(__alpha__)
DRM(free)( entry->busaddr,
entry->pages * sizeof(*entry->busaddr),
DRM_MEM_PAGES );
#endif
DRM(free)( entry->pagelist,
entry->pages * sizeof(*entry->pagelist),
DRM_MEM_PAGES );
@ -99,7 +97,6 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
return -ENOMEM;
}
#if defined(__alpha__)
entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr),
DRM_MEM_PAGES );
if ( !entry->busaddr ) {
@ -112,15 +109,12 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
return -ENOMEM;
}
memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) );
#endif
entry->virtual = vmalloc_32( pages << PAGE_SHIFT );
if ( !entry->virtual ) {
#if defined(__alpha__)
DRM(free)( entry->busaddr,
entry->pages * sizeof(*entry->busaddr),
DRM_MEM_PAGES );
#endif
DRM(free)( entry->pagelist,
entry->pages * sizeof(*entry->pagelist),
DRM_MEM_PAGES );

View File

@ -60,7 +60,7 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access)
{
#if defined(__alpha__) && __REALLY_HAVE_AGP
#if __REALLY_HAVE_AGP
drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev;
drm_map_t *map = NULL;
@ -70,6 +70,9 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
/*
* Find the right map
*/
if(!dev->agp->cant_use_aperture) goto vm_nopage_error;
list_for_each(list, &dev->maplist->head) {
r_list = (drm_map_list_t *)list;
map = r_list->map;
@ -83,10 +86,12 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
struct drm_agp_mem *agpmem;
struct page *page;
#if __alpha__
/*
* Make it a bus-relative address
* Adjust to a bus-relative address
*/
baddr -= dev->hose->mem_space->start;
#endif
/*
* It's AGP memory - find the real physical page to map
@ -97,27 +102,24 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
break;
}
if (!agpmem) {
/*
* Oops - no memory found
*/
return NOPAGE_SIGBUS; /* couldn't find it */
}
if (!agpmem) goto vm_nopage_error;
/*
* Get the page, inc the use count, and return it
*/
offset = (baddr - agpmem->bound) >> PAGE_SHIFT;
agpmem->memory->memory[offset] &= ~1UL; /* HACK */
agpmem->memory->memory[offset] &= dev->agp->page_mask;
page = virt_to_page(__va(agpmem->memory->memory[offset]));
#if 0
DRM_ERROR("baddr = 0x%lx page = 0x%lx, offset = 0x%lx\n",
baddr, __va(agpmem->memory->memory[offset]), offset);
#endif
get_page(page);
DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx\n",
baddr, __va(agpmem->memory->memory[offset]), offset);
return page;
}
#endif
vm_nopage_error:
#endif /* __REALLY_HAVE_AGP */
return NOPAGE_SIGBUS; /* Disallow mremap */
}

View File

@ -350,20 +350,11 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev,
tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle;
page_ofs = tmp_ofs >> PAGE_SHIFT;
#if defined(__alpha__)
R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR,
entry->busaddr[page_ofs]);
DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n",
entry->busaddr[page_ofs],
entry->handle + tmp_ofs );
#else
R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR,
page_to_bus(entry->pagelist[page_ofs]));
DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n",
page_to_bus(entry->pagelist[page_ofs]),
entry->handle + tmp_ofs );
#endif
}
/* Set watermark control */

View File

@ -543,8 +543,7 @@ static int radeon_do_engine_reset( drm_device_t *dev )
RADEON_SOFT_RESET_RE |
RADEON_SOFT_RESET_PP |
RADEON_SOFT_RESET_E2 |
RADEON_SOFT_RESET_RB |
RADEON_SOFT_RESET_HDP ) );
RADEON_SOFT_RESET_RB ) );
RADEON_READ( RADEON_RBBM_SOFT_RESET );
RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset &
~( RADEON_SOFT_RESET_CP |
@ -553,8 +552,7 @@ static int radeon_do_engine_reset( drm_device_t *dev )
RADEON_SOFT_RESET_RE |
RADEON_SOFT_RESET_PP |
RADEON_SOFT_RESET_E2 |
RADEON_SOFT_RESET_RB |
RADEON_SOFT_RESET_HDP ) ) );
RADEON_SOFT_RESET_RB ) ) );
RADEON_READ( RADEON_RBBM_SOFT_RESET );
@ -622,20 +620,12 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle;
page_ofs = tmp_ofs >> PAGE_SHIFT;
#if defined(__alpha__)
RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR,
entry->busaddr[page_ofs]);
DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n",
entry->busaddr[page_ofs],
entry->handle + tmp_ofs );
#else
RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR,
page_to_bus(entry->pagelist[page_ofs]));
DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n",
page_to_bus(entry->pagelist[page_ofs]),
entry->handle + tmp_ofs );
#endif
}
/* Set ring buffer size */