Update a bunch of FreeBSD port code.
Tested on r200/r300. i915 updates still remain to be done.main
parent
fdc293d40c
commit
b0c8d885ce
|
@ -69,4 +69,3 @@ drm_pciids.h: ${SHARED}/drm_pciids.txt
|
|||
|
||||
${SHAREDFILES}:
|
||||
ln -sf ${SHARED}/$@ $@
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue