On Tuesday, March 8, 2005 10:47 am, Jesse Barnes wrote:
> Here are a few small fixes to get r300 going on ia64. Thanks to Stephane
> for pointing out the resource size mismatch. The patch just fixes that
> (PCI resources in Linux are 'unsigned long' at the moment, not 'unsigned
> int') and adds the checking for write combining regions I posted earlier
> since I don't think that's been applied.
Here's a more complete patch that fixes up some ppc stuff as well.
Jesse
Index: drm/linux-core/drmP.h
===================================================================
RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drmP.h,v
retrieving revision 1.2
diff -u -p -r1.2 drmP.h
--- drm/linux-core/drmP.h 2 Mar 2005 03:54:27 -0000 1.2
+++ drm/linux-core/drmP.h 8 Mar 2005 19:00:54 -0000
@@ -55,6 +55,9 @@
#include <linux/smp_lock.h> /* For (un)lock_kernel */
#include <linux/mm.h>
#include <linux/pagemap.h>
+#ifdef __ia64__
+#include <linux/efi.h>
+#endif
#if defined(__alpha__) || defined(__powerpc__)
#include <asm/pgtable.h> /* For pte_wrprotect */
#endif
@@ -850,7 +853,7 @@ extern int drm_addmap(struct inode *inod
unsigned int cmd, unsigned long arg);
extern int drm_rmmap(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int drm_initmap(drm_device_t * dev, unsigned int offset,
+extern int drm_initmap(drm_device_t * dev, unsigned long offset,
unsigned int size, unsigned int resource, int type,
int flags);
extern int drm_addbufs(struct inode *inode, struct file *filp,
Index: drm/linux-core/drm_bufs.c
===================================================================
RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drm_bufs.c,v
retrieving revision 1.2
diff -u -p -r1.2 drm_bufs.c
--- drm/linux-core/drm_bufs.c 2 Mar 2005 03:54:27 -0000 1.2
+++ drm/linux-core/drm_bufs.c 8 Mar 2005 19:00:54 -0000
@@ -53,7 +53,7 @@ EXPORT_SYMBOL(drm_get_resource_len);
* type. Adds the map to the map list drm_device::maplist. Adds MTRR's where
* applicable and if supported by the kernel.
*/
-int drm_initmap(drm_device_t * dev, unsigned int offset, unsigned int size,
+int drm_initmap(drm_device_t * dev, unsigned long offset, unsigned int size,
unsigned int resource, int type, int flags)
{
drm_map_t *map;
@@ -63,7 +63,7 @@ int drm_initmap(drm_device_t * dev, unsi
if ((offset & (~PAGE_MASK)) || (size & (~PAGE_MASK)))
return -EINVAL;
-#if !defined(__sparc__) && !defined(__alpha__)
+#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) &&
!defined(__powerpc__)
if (offset + size < offset || offset < virt_to_phys(high_memory))
return -EINVAL;
#endif
@@ -198,7 +198,7 @@ int drm_addmap(struct inode *inode, stru
/* addmap didn't match an existing permanent
map, that's an error */
return -EINVAL;
}
-#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__)
+#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) &&
!defined(__powerpc__)
if (map->offset + map->size < map->offset ||
map->offset < virt_to_phys(high_memory)) {
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
Index: drm/linux-core/drm_vm.c
===================================================================
RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drm_vm.c,v
retrieving revision 1.2
diff -u -p -r1.2 drm_vm.c
--- drm/linux-core/drm_vm.c 2 Mar 2005 03:54:27 -0000 1.2
+++ drm/linux-core/drm_vm.c 8 Mar 2005 19:00:54 -0000
@@ -639,9 +639,13 @@ int drm_mmap(struct file *filp, struct v
vma->vm_flags |= VM_IO; /* not in core dump */
}
#if defined(__ia64__)
- if (map->type != _DRM_AGP)
+ if (efi_range_is_wc(vma->vm_start, vma->vm_end -
+ vma->vm_start) && (map->type != _DRM_AGP))
vma->vm_page_prot =
- pgprot_writecombine(vma->vm_page_prot);
+ pgprot_writecombine(vma->vm_page_prot);
+ else
+ vma->vm_page_prot =
+ pgprot_noncached(vma->vm_page_prot);
#endif
offset = dev->driver->get_reg_ofs(dev);
#ifdef __sparc__