diff options
author | Eric Anholt <anholt@freebsd.org> | 2005-11-08 02:38:01 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2005-11-08 02:38:01 +0000 |
commit | 1a256df4804e4e987f81226a5d8e0573363607ee (patch) | |
tree | 31749f8042cfdd36260f195fb3af65c7bab46e51 /bsd-core | |
parent | 145b23b55220bdfc6639d3279ad96310faa650a3 (diff) |
Catch FreeBSD up to the pcie gart changes. Required minor modification to
radeon_cp.c to use a drm_local_map_t-type mapping (drm_core_ioremap
rather than drm_ioremap), which contains private device mapping
information on BSD. I also changed the ati_pcigart interface to use
"void *" for pointers to kva rather than "unsigned long". While PCIGART
support appears to be broken on FreeBSD currently, I think this is not
new, and BusType PCI remains working on my r100 in Linux.
Diffstat (limited to 'bsd-core')
-rw-r--r-- | bsd-core/ati_pcigart.c | 46 | ||||
-rw-r--r-- | bsd-core/drmP.h | 20 |
2 files changed, 38 insertions, 28 deletions
diff --git a/bsd-core/ati_pcigart.c b/bsd-core/ati_pcigart.c index 71b08d68..d48d0a80 100644 --- a/bsd-core/ati_pcigart.c +++ b/bsd-core/ati_pcigart.c @@ -35,32 +35,34 @@ #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, unsigned long *addr, - dma_addr_t *bus_addr, int is_pcie) +int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) { unsigned long pages; - u32 *pci_gart = 0, page_base; + u32 *pci_gart = NULL, page_base; int i, j; - *addr = 0; - *bus_addr = 0; - if (dev->sg == NULL) { DRM_ERROR( "no scatter/gather memory!\n" ); return 0; } - dev->sg->dmah = drm_pci_alloc(dev, ATI_PCIGART_TABLE_SIZE, 0, - 0xfffffffful); - if (dev->sg->dmah == NULL) { - DRM_ERROR("cannot allocate PCI GART table!\n"); - return 0; + 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, + 0xfffffffful); + if (dev->sg->dmah == NULL) { + DRM_ERROR("cannot allocate PCI GART table!\n"); + return 0; + } + + gart_info->addr = (void *)dev->sg->dmah->vaddr; + gart_info->bus_addr = dev->sg->dmah->busaddr; + pci_gart = (u32 *)dev->sg->dmah->vaddr; + } else { + /* GART table in framebuffer memory */ + pci_gart = gart_info->addr; } - - *addr = (long)dev->sg->dmah->vaddr; - *bus_addr = dev->sg->dmah->busaddr; - pci_gart = (u32 *)dev->sg->dmah->vaddr; - + pages = DRM_MIN(dev->sg->pages, ATI_MAX_PCIGART_PAGES); bzero(pci_gart, ATI_PCIGART_TABLE_SIZE); @@ -71,12 +73,9 @@ int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr, page_base = (u32) dev->sg->busaddr[i]; for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { - if (is_pcie) { - *pci_gart = (cpu_to_le32(page_base)>>8) | 0xc; - DRM_DEBUG("PCIE: %d %08X %08X to %p\n", i, - page_base, (cpu_to_le32(page_base)>>8)|0xc, - pci_gart); - } else + if (gart_info->is_pcie) + *pci_gart = (cpu_to_le32(page_base) >> 8) | 0xc; + else *pci_gart = cpu_to_le32(page_base); pci_gart++; page_base += ATI_PCIGART_PAGE_SIZE; @@ -88,8 +87,7 @@ int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr, return 1; } -int drm_ati_pcigart_cleanup(drm_device_t *dev, unsigned long addr, - dma_addr_t bus_addr) +int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) { if (dev->sg == NULL) { DRM_ERROR( "no scatter/gather memory!\n" ); diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index b98049c3..dda12560 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -622,6 +622,18 @@ typedef struct drm_vbl_sig { int pid; } drm_vbl_sig_t; +/* location of GART table */ +#define DRM_ATI_GART_MAIN 1 +#define DRM_ATI_GART_FB 2 + +typedef struct ati_pcigart_info { + int gart_table_location; + int is_pcie; + void *addr; + dma_addr_t bus_addr; + drm_local_map_t mapping; +} drm_ati_pcigart_info; + struct drm_driver_info { int (*load)(struct drm_device *, unsigned long flags); int (*firstopen)(struct drm_device *); @@ -907,10 +919,10 @@ extern int drm_sysctl_cleanup(drm_device_t *dev); #endif /* __FreeBSD__ */ /* ATI PCIGART support (ati_pcigart.c) */ -int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr, - dma_addr_t *bus_addr, int is_pcie); -int drm_ati_pcigart_cleanup(drm_device_t *dev, unsigned long addr, - dma_addr_t bus_addr); +int drm_ati_pcigart_init(drm_device_t *dev, + drm_ati_pcigart_info *gart_info); +int drm_ati_pcigart_cleanup(drm_device_t *dev, + drm_ati_pcigart_info *gart_info); /* Locking IOCTL support (drm_drv.c) */ int drm_lock(DRM_IOCTL_ARGS); |