diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 5839910a..44e20307 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -546,7 +546,11 @@ typedef struct drm_device { drm_agp_head_t *agp; #endif #ifdef __alpha__ +#if LINUX_VERSION_CODE < 0x020403 struct pci_controler *hose; +#else + struct pci_controller *hose; +#endif #endif drm_sg_mem_t *sg; /* Scatter gather memory */ unsigned long *ctx_bitmap; diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 27c84775..770183ec 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -164,8 +164,10 @@ static drm_ioctl_desc_t DRM(ioctls)[] = { [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { DRM(addmap), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { DRM(rmmap), 1, 0 }, +#if __HAVE_CTX_BITMAP [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { DRM(setsareactx), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { DRM(getsareactx), 1, 0 }, +#endif [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { DRM(addctx), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { DRM(rmctx), 1, 1 }, diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h index 83cca0b1..e86db408 100644 --- a/linux-core/drm_memory.h +++ b/linux-core/drm_memory.h @@ -307,11 +307,17 @@ void DRM(free)(void *pt, size_t size, int area) unsigned long DRM(alloc_pages)(int order, int area) { +#ifdef __linux__ unsigned long address; +#endif +#ifdef __FreeBSD_ + vm_offset_t address; +#endif unsigned long bytes = PAGE_SIZE << order; unsigned long addr; unsigned int sz; +#ifdef __linux__ DRM_OS_SPINLOCK(&DRM(mem_lock)); if ((DRM(ram_used) >> PAGE_SHIFT) > (DRM_RAM_PERCENT * DRM(ram_available)) / 100) { @@ -319,6 +325,7 @@ unsigned long DRM(alloc_pages)(int order, int area) return 0; } DRM_OS_SPINUNLOCK(&DRM(mem_lock)); +#endif #ifdef __linux__ address = __get_free_pages(GFP_KERNEL, order); @@ -497,13 +504,13 @@ int DRM(free_agp)(agp_memory *handle, int pages) device_t dev = agp_find_device(); if (!dev) - return NULL; + return EINVAL; #endif if (!handle) { DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Attempt to free NULL AGP handle\n"); - return retval;; + return retval; } if (DRM(agp_free_memory)(handle)) { diff --git a/linux/drmP.h b/linux/drmP.h index 5839910a..44e20307 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -546,7 +546,11 @@ typedef struct drm_device { drm_agp_head_t *agp; #endif #ifdef __alpha__ +#if LINUX_VERSION_CODE < 0x020403 struct pci_controler *hose; +#else + struct pci_controller *hose; +#endif #endif drm_sg_mem_t *sg; /* Scatter gather memory */ unsigned long *ctx_bitmap; diff --git a/linux/drm_drv.h b/linux/drm_drv.h index 27c84775..770183ec 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -164,8 +164,10 @@ static drm_ioctl_desc_t DRM(ioctls)[] = { [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { DRM(addmap), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { DRM(rmmap), 1, 0 }, +#if __HAVE_CTX_BITMAP [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { DRM(setsareactx), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { DRM(getsareactx), 1, 0 }, +#endif [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { DRM(addctx), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { DRM(rmctx), 1, 1 }, diff --git a/linux/drm_memory.h b/linux/drm_memory.h index 83cca0b1..e86db408 100644 --- a/linux/drm_memory.h +++ b/linux/drm_memory.h @@ -307,11 +307,17 @@ void DRM(free)(void *pt, size_t size, int area) unsigned long DRM(alloc_pages)(int order, int area) { +#ifdef __linux__ unsigned long address; +#endif +#ifdef __FreeBSD_ + vm_offset_t address; +#endif unsigned long bytes = PAGE_SIZE << order; unsigned long addr; unsigned int sz; +#ifdef __linux__ DRM_OS_SPINLOCK(&DRM(mem_lock)); if ((DRM(ram_used) >> PAGE_SHIFT) > (DRM_RAM_PERCENT * DRM(ram_available)) / 100) { @@ -319,6 +325,7 @@ unsigned long DRM(alloc_pages)(int order, int area) return 0; } DRM_OS_SPINUNLOCK(&DRM(mem_lock)); +#endif #ifdef __linux__ address = __get_free_pages(GFP_KERNEL, order); @@ -497,13 +504,13 @@ int DRM(free_agp)(agp_memory *handle, int pages) device_t dev = agp_find_device(); if (!dev) - return NULL; + return EINVAL; #endif if (!handle) { DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Attempt to free NULL AGP handle\n"); - return retval;; + return retval; } if (DRM(agp_free_memory)(handle)) { diff --git a/linux/radeon_cp.c b/linux/radeon_cp.c index f8d8c2ea..670c3dd4 100644 --- a/linux/radeon_cp.c +++ b/linux/radeon_cp.c @@ -38,6 +38,12 @@ #define RADEON_FIFO_DEBUG 0 +#if defined(__alpha__) +# define PCIGART_ENABLED +#else +# undef PCIGART_ENABLED +#endif + /* CP microcode (from ATI) */ static u32 radeon_cp_microcode[][2] = { @@ -659,7 +665,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) dev_priv->is_pci = init->is_pci; -#if 1 +#if !defined(PCIGART_ENABLED) /* PCI support is not 100% working, so we disable it here. */ if ( dev_priv->is_pci ) { @@ -671,7 +677,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) #endif if ( dev_priv->is_pci && !dev->sg ) { - DRM_DEBUG( "PCI GART memory not allocated!\n" ); DRM_ERROR( "PCI GART memory not allocated!\n" ); DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; @@ -878,7 +883,6 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) if ( dev_priv->is_pci ) { dev_priv->phys_pci_gart = DRM(ati_pcigart_init)( dev ); if ( !dev_priv->phys_pci_gart ) { - DRM_DEBUG( "failed to init PCI GART!\n" ); DRM_ERROR( "failed to init PCI GART!\n" ); DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); @@ -904,7 +908,14 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) /* Turn off AGP aperture -- is this required for PCIGART? */ - RADEON_WRITE( RADEON_MC_AGP_LOCATION, 0 ); + RADEON_WRITE( RADEON_MC_AGP_LOCATION, 0xffffffc0 ); /* ?? */ + RADEON_WRITE( RADEON_AGP_COMMAND, 0 ); /* clear AGP_COMMAND */ +#if defined(__alpha__) + /* HACK! something is clobbering MEM_CNTL on Alpha! */ + DRM_ERROR( "MEM_CNTL 0x%x\n", + RADEON_READ(0x0140) ); + RADEON_WRITE(0x0140, 0x29002901); +#endif } else { /* Turn off PCI GART */ diff --git a/linux/radeon_drv.h b/linux/radeon_drv.h index ca349c2c..4217beee 100644 --- a/linux/radeon_drv.h +++ b/linux/radeon_drv.h @@ -181,6 +181,7 @@ extern int radeon_cp_indirect( struct inode *inode, struct file *filp, * for Radeon kernel driver. */ +#define RADEON_AGP_COMMAND 0x0f60 #define RADEON_AUX_SCISSOR_CNTL 0x26f0 # define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24) # define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25)