diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2007-05-15 13:35:33 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-05-29 15:02:44 -0700 |
commit | b0c8d885ce645aee5027a75e4149ba4be265b55d (patch) | |
tree | b251dd646c19199ad69d8c91b6aa5d483e946aed | |
parent | fdc293d40c2fdd184d89bd38257ade2437c4cbc1 (diff) |
Update a bunch of FreeBSD port code.
Tested on r200/r300. i915 updates still remain to be done.
-rw-r--r-- | bsd-core/Makefile | 1 | ||||
-rw-r--r-- | bsd-core/ati_pcigart.c | 21 | ||||
-rw-r--r-- | bsd-core/drmP.h | 28 | ||||
-rw-r--r-- | bsd-core/drm_agpsupport.c | 2 | ||||
-rw-r--r-- | bsd-core/drm_drv.c | 12 | ||||
-rw-r--r-- | shared-core/i915_dma.c | 4 |
6 files changed, 43 insertions, 25 deletions
diff --git a/bsd-core/Makefile b/bsd-core/Makefile index db563a65..00889dae 100644 --- a/bsd-core/Makefile +++ b/bsd-core/Makefile @@ -69,4 +69,3 @@ drm_pciids.h: ${SHARED}/drm_pciids.txt ${SHAREDFILES}: ln -sf ${SHARED}/$@ $@ - diff --git a/bsd-core/ati_pcigart.c b/bsd-core/ati_pcigart.c index d48d0a80..682eace6 100644 --- a/bsd-core/ati_pcigart.c +++ b/bsd-core/ati_pcigart.c @@ -32,8 +32,6 @@ #include "drmP.h" #define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */ -#define ATI_MAX_PCIGART_PAGES 8192 /* 32 MB aperture, 4K pages */ -#define ATI_PCIGART_TABLE_SIZE 32768 int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) { @@ -48,7 +46,7 @@ int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { /* GART table in system memory */ - dev->sg->dmah = drm_pci_alloc(dev, ATI_PCIGART_TABLE_SIZE, 0, + dev->sg->dmah = drm_pci_alloc(dev, gart_info->table_size, 0, 0xfffffffful); if (dev->sg->dmah == NULL) { DRM_ERROR("cannot allocate PCI GART table!\n"); @@ -63,9 +61,9 @@ int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) pci_gart = gart_info->addr; } - pages = DRM_MIN(dev->sg->pages, ATI_MAX_PCIGART_PAGES); + pages = DRM_MIN(dev->sg->pages, gart_info->table_size / sizeof(u32)); - bzero(pci_gart, ATI_PCIGART_TABLE_SIZE); + bzero(pci_gart, gart_info->table_size); KASSERT(PAGE_SIZE >= ATI_PCIGART_PAGE_SIZE, ("page size too small")); @@ -73,10 +71,17 @@ int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) page_base = (u32) dev->sg->busaddr[i]; for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { - if (gart_info->is_pcie) - *pci_gart = (cpu_to_le32(page_base) >> 8) | 0xc; - else + switch(gart_info->gart_reg_if) { + case DRM_ATI_GART_IGP: + *pci_gart = cpu_to_le32(page_base | 0xc); + break; + case DRM_ATI_GART_PCIE: + *pci_gart = cpu_to_le32((page_base >> 8) | 0xc); + break; + default: *pci_gart = cpu_to_le32(page_base); + break; + } pci_gart++; page_base += ATI_PCIGART_PAGE_SIZE; } diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index 9ebb12ae..9ba3d502 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -47,6 +47,9 @@ typedef struct drm_file drm_file_t; #include <sys/systm.h> #include <sys/conf.h> #include <sys/stat.h> +#if __FreeBSD_version >= 700000 +#include <sys/priv.h> +#endif #include <sys/proc.h> #include <sys/lock.h> #include <sys/fcntl.h> @@ -230,7 +233,11 @@ enum { #define PAGE_ALIGN(addr) round_page(addr) /* DRM_SUSER returns true if the user is superuser */ +#if __FreeBSD_version >= 700000 +#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0) +#else #define DRM_SUSER(p) (suser(p) == 0) +#endif #define DRM_AGP_FIND_DEVICE() agp_find_device() #define DRM_MTRR_WC MDF_WRITECOMBINE #define jiffies ticks @@ -394,19 +401,6 @@ do { \ } \ } while (0) -#define DRM_GETSAREA() \ -do { \ - drm_local_map_t *map; \ - DRM_SPINLOCK_ASSERT(&dev->dev_lock); \ - TAILQ_FOREACH(map, &dev->maplist, link) { \ - if (map->type == _DRM_SHM && \ - map->flags & _DRM_CONTAINS_LOCK) { \ - dev_priv->sarea = map; \ - break; \ - } \ - } \ -} while (0) - #if defined(__FreeBSD__) && __FreeBSD_version > 500000 #define DRM_WAIT_ON( ret, queue, timeout, condition ) \ for ( ret = 0 ; !ret && !(condition) ; ) { \ @@ -627,12 +621,17 @@ typedef struct drm_vbl_sig { #define DRM_ATI_GART_MAIN 1 #define DRM_ATI_GART_FB 2 +#define DRM_ATI_GART_PCI 1 +#define DRM_ATI_GART_PCIE 2 +#define DRM_ATI_GART_IGP 3 + typedef struct ati_pcigart_info { int gart_table_location; - int is_pcie; + int gart_reg_if; void *addr; dma_addr_t bus_addr; drm_local_map_t mapping; + int table_size; } drm_ati_pcigart_info; struct drm_driver_info { @@ -822,6 +821,7 @@ dev_type_read(drm_read); dev_type_poll(drm_poll); dev_type_mmap(drm_mmap); #endif +extern drm_local_map_t *drm_getsarea(drm_device_t *dev); /* File operations helpers (drm_fops.c) */ #ifdef __FreeBSD__ diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c index 0406f50e..28239d1b 100644 --- a/bsd-core/drm_agpsupport.c +++ b/bsd-core/drm_agpsupport.c @@ -43,7 +43,7 @@ static int drm_device_find_capability(drm_device_t *dev, int cap) { #ifdef __FreeBSD__ -#if __FreeBSD_version >= 700010 +#if __FreeBSD_version >= 602102 return (pci_find_extcap(dev->device, cap, NULL) == 0); #else diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 9fb10c53..baaeb43c 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -912,6 +912,18 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags, return DRM_ERR(retcode); } +drm_local_map_t *drm_getsarea(drm_device_t *dev) +{ + drm_local_map_t *map; + + DRM_SPINLOCK_ASSERT(&dev->dev_lock); + TAILQ_FOREACH(map, &dev->maplist, link) { + if (map->type == _DRM_SHM && (map->flags & _DRM_CONTAINS_LOCK)) + return map; + } + + return NULL; +} #if DRM_LINUX diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index 8991a3ce..5ea0bdab 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -471,7 +471,9 @@ int i915_emit_mi_flush(drm_device_t *dev, uint32_t flush) static int i915_dispatch_cmdbuffer(drm_device_t * dev, drm_i915_cmdbuffer_t * cmd) { +#ifdef I915_HAVE_FENCE drm_i915_private_t *dev_priv = dev->dev_private; +#endif int nbox = cmd->num_cliprects; int i = 0, count, ret; @@ -856,7 +858,7 @@ static int i915_mmio(DRM_IOCTL_ARGS) return DRM_ERR(EINVAL); e = &mmio_table[mmio.reg]; - base = dev_priv->mmio_map->handle + e->offset; + base = (u8 *) dev_priv->mmio_map->handle + e->offset; switch (mmio.read_write) { case I915_MMIO_READ: |