CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: riastradh Date: Mon Apr 20 15:38:13 UTC 2015 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h Log Message: Remove old drm's container_of. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/drm/dist/bsd-core/drmP.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.23 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.24 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.23 Fri Jul 1 18:36:15 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Mon Apr 20 15:38:13 2015 @@ -267,10 +267,6 @@ typedef int irqreturn_t; #define IRQ_NONE 0 #endif -#define container_of(ptr, type, member) ({ \ - __typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - enum { DRM_IS_NOT_AGP, DRM_IS_AGP,
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: chs Date: Sat Jan 10 23:34:49 UTC 2015 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_bufs.c Log Message: initialize "addr" before passing its address to uvm_mmap_dev(). from Onno van der Linden in PR 49536. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.12 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.13 --- src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.12 Sun Dec 14 23:48:59 2014 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Sat Jan 10 23:34:49 2015 @@ -1122,6 +1122,7 @@ int drm_mapbufs(struct drm_device *dev, #elif defined(__NetBSD__) /* XXXNETBSD */ rsize = round_page(size); + addr = NULL; retcode = uvm_mmap_dev(curproc, &addr, rsize, dev->kdev, foff); vaddr = (vaddr_t)addr; DRM_DEBUG("mmap %#lx/%#lx foff %#llx\n", vaddr, rsize, (long long)foff);
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: christos Date: Mon Nov 10 16:32:21 UTC 2014 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_drv.c Log Message: fix the module class. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.25 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.26 --- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.25 Fri Jul 25 04:10:39 2014 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Mon Nov 10 11:32:21 2014 @@ -1124,7 +1124,7 @@ drm_linux_ioctl(DRM_STRUCTPROC *p, struc #if defined(__NetBSD__) /* Module support */ -MODULE(MODULE_CLASS_MISC, drm, "pci"); +MODULE(MODULE_CLASS_DRIVER, drm, "pci"); static int drm_modcmd(modcmd_t cmd, void *arg)
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: riastradh Date: Sat Oct 4 15:51:23 UTC 2014 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_atomic.h Log Message: Canonicalize boolean result from test_and_set_bit. Not actually semantically significant for any callers, but Linux documentation insists it is important, so we'll follow suit. Fixes last part of PR kern/48999. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_atomic.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_atomic.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_atomic.h:1.4 src/sys/external/bsd/drm/dist/bsd-core/drm_atomic.h:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/drm_atomic.h:1.4 Fri Jun 19 03:50:03 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_atomic.h Sat Oct 4 15:51:23 2014 @@ -49,7 +49,7 @@ test_and_set_bit(int b, volatile void *p unsigned int r = *(volatile int *)p & m; *(volatile int *)p |= m; splx(s); - return r; + return !!r; } static __inline void @@ -115,7 +115,7 @@ test_and_set_bit(int b, volatile void *p break; } while (atomic_cas_uint(val, old, old | mask) != old); - return old & mask; + return !!(old & mask); } #endif
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: dholland Date: Sun Jul 27 03:49:25 UTC 2014 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_scatter.c Log Message: Fix misplaced parenthesis, from Henning Petersen in PR 44804. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm/dist/bsd-core/drm_scatter.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_scatter.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_scatter.c:1.3 src/sys/external/bsd/drm/dist/bsd-core/drm_scatter.c:1.4 --- src/sys/external/bsd/drm/dist/bsd-core/drm_scatter.c:1.3 Sat Jun 20 01:07:09 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_scatter.c Sun Jul 27 03:49:25 2014 @@ -129,7 +129,7 @@ drm_sg_alloc(struct drm_device *dev, str if ((ret = bus_dmamem_alloc(dmah->tag, request->size, PAGE_SIZE, 0, dmah->segs, pages, &nsegs, -BUS_DMA_WAITOK) != 0)) { +BUS_DMA_WAITOK)) != 0) { printf("drm: Unable to allocate %lu bytes of DMA, error %d\n", request->size, ret); dmah->tag = NULL;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mlelstv Date: Thu Jun 6 07:55:46 UTC 2013 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_memory.c Log Message: fix build for 'no options MTRR' To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.11 src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.12 --- src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.11 Fri Feb 18 14:26:09 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Thu Jun 6 07:55:46 2013 @@ -38,6 +38,7 @@ #include "drmP.h" + #if defined(__NetBSD__) # ifdef DRM_NO_AGP # define NAGP_I810 0 @@ -56,6 +57,9 @@ # if NGENFB > 0 # include # endif +# if defined(_KERNEL_OPT) +# include "opt_mtrr.h" +# endif #endif MALLOC_DEFINE(DRM_MEM_DMA, "drm_dma", "DRM DMA Data Structures"); @@ -300,7 +304,7 @@ drm_mtrr_del(int __unused handle, unsign int drm_mtrr_add(unsigned long offset, size_t size, int flags) { -#ifdef MTRR_GETSET_KERNEL +#if defined(MTRR) && defined(MTRR_GETSET_KERNEL) struct mtrr mtrrmap; int one = 1; @@ -317,7 +321,7 @@ drm_mtrr_add(unsigned long offset, size_ int drm_mtrr_del(int __unused handle, unsigned long offset, size_t size, int flags) { -#ifdef MTRR_GETSET_KERNEL +#if defined(MTRR) && defined(MTRR_GETSET_KERNEL) struct mtrr mtrrmap; int one = 1;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: chs Date: Sat Sep 29 14:19:43 UTC 2012 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_sysctl.c Log Message: fix the DRM string sysctls to use copyout() instead of strcat() to deliver the data to the user buffer. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c:1.7 src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c:1.8 --- src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c:1.7 Sat Jun 2 21:36:46 2012 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c Sat Sep 29 14:19:43 2012 @@ -164,7 +164,55 @@ int drm_sysctl_cleanup(struct drm_device #ifdef __NetBSD__ #define SYSCTL_OUT(x, y, z) \ - (len+=z,(len<*oldlenp)?(strcat((char*)oldp, y),0):EOVERFLOW) + drm_sysctl_out(oldp, oldlenp, &len, y, z, &error, &retcode); + +static int +drm_sysctl_out(void *oldp, size_t *oldlenp, size_t *lenp, + const char *buf, size_t buflen, + int *errorp, int *retcodep) +{ + size_t copylen; + int error = 0; + + /* + * If there's room left in the user buffer, + * copy out as much data as there is room for. + */ + + if (*lenp < *oldlenp) { + copylen = MIN(buflen, *oldlenp - *lenp); + error = copyout(buf, (char *)oldp + *lenp, copylen); + if (error) { + *errorp = error; + } + } else { + copylen = 0; + } + *lenp += buflen; + + /* + * If we didn't copy everything, remember that we should + * return ENOMEM at the end. + */ + + if (copylen < buflen && *errorp == 0) { + *errorp = ENOMEM; + } + + /* + * If this is the final call (indicated by the buffer + * being the string terminator byte), return the + * total space required in *oldlenp and return + * the saved error in *retcodep. + */ + + if (buflen == 1 && *buf == 0) { + *oldlenp = *lenp; + *retcodep = *errorp; + } + return error; +} + #endif #define DRM_SYSCTL_PRINT(fmt, arg...)\ @@ -181,7 +229,8 @@ static int drm_name_info DRM_SYSCTL_HAND struct drm_device *dev = arg1; #elif defined(__NetBSD__) struct drm_device *dev = rnode->sysctl_data; - int len = 0; + size_t len = 0; + int error = 0; #endif char buf[128]; int retcode; @@ -219,7 +268,8 @@ static int drm_vm_info DRM_SYSCTL_HANDLE struct drm_device *dev = arg1; #elif defined(__NetBSD__) struct drm_device *dev = rnode->sysctl_data; - int len = 0; + size_t len = 0; + int error = 0; #endif drm_local_map_t *map, *tempmaps; const char *types[] = { "FB", "REG", "SHM", "AGP", "SG", "GEM", "TTM" }; @@ -284,7 +334,8 @@ static int drm_bufs_info DRM_SYSCTL_HAND struct drm_device *dev = arg1; #elif defined(__NetBSD__) struct drm_device *dev = rnode->sysctl_data; - int len = 0; + size_t len = 0; + int error = 0; #endif drm_device_dma_t *dma = dev->dma; drm_device_dma_t tempdma; @@ -346,7 +397,8 @@ static int drm_clients_info DRM_SYSCTL_H struct drm_device *dev = arg1; #elif defined(__NetBSD__) struct drm_device *dev = rnode->sysctl_data; - int len = 0; + size_t len = 0; + int error = 0; #endif struct drm_file *priv, *tempprivs; char buf[128];
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: chs Date: Sun Jun 17 15:15:34 UTC 2012 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_bufs.c Log Message: when freeing the DRM_SHM kernel memory that can be mapped by a user process, remove any user mappings before freeing the memory, so that a user process doesn't have still have access to that physical memory after it's reused. this really shouldn't be using kernel malloc'd memory at all, but changing that would be much more involved. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.10 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.11 --- src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.10 Sun Jan 29 11:49:02 2012 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Sun Jun 17 15:15:34 2012 @@ -316,6 +316,22 @@ int drm_addmap_ioctl(struct drm_device * return 0; } +static void +drm_rmmap_user(void *addr, size_t size) +{ + vaddr_t va, eva; + paddr_t pa; + struct vm_page *pg; + + va = (vaddr_t)addr; + eva = va + size; + for (; va < eva; va += PAGE_SIZE) { + pmap_extract(pmap_kernel(), va, &pa); + pg = PHYS_TO_VM_PAGE(pa); + pmap_page_protect(pg, VM_PROT_NONE); + } +} + void drm_rmmap(struct drm_device *dev, drm_local_map_t *map) { DRM_SPINLOCK_ASSERT(&dev->dev_lock); @@ -338,6 +354,11 @@ void drm_rmmap(struct drm_device *dev, d } break; case _DRM_SHM: + + /* + * Remove any user mappings before we free the kernel memory. + */ + drm_rmmap_user(map->handle, map->size); free(map->handle, DRM_MEM_MAPS); break; case _DRM_AGP:
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: drochner Date: Sun Jan 29 11:49:02 UTC 2012 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_bufs.c Log Message: remove incomplete conversion to kmem_alloc -- inconsistent use leads at least to diagnostic panics To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.9 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.10 --- src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.9 Fri Jan 27 19:48:40 2012 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Sun Jan 29 11:49:02 2012 @@ -36,10 +36,6 @@ #include "dev/pci/pcireg.h" #endif -#if defined(__NetBSD__) -#include -#endif - #include "drmP.h" /* Allocation of PCI memory resources (framebuffer, registers, etc.) for @@ -188,11 +184,7 @@ int drm_addmap(struct drm_device * dev, map->mtrr = 1; break; case _DRM_SHM: -#if defined(__NetBSD__) - map->handle = kmem_alloc(map->size, KM_NOSLEEP); -#else map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT); -#endif DRM_DEBUG("%lu %d %p\n", map->size, drm_order(map->size), map->handle); if (!map->handle) { @@ -206,11 +198,7 @@ int drm_addmap(struct drm_device * dev, DRM_LOCK(); if (dev->lock.hw_lock != NULL) { DRM_UNLOCK(); -#if defined(__NetBSD__) -kmem_free(map->handle, map->size); -#else free(map->handle, DRM_MEM_MAPS); -#endif free(map, DRM_MEM_MAPS); return EBUSY; } @@ -350,11 +338,7 @@ void drm_rmmap(struct drm_device *dev, d } break; case _DRM_SHM: -#if defined(__NetBSD__) - kmem_free(map->handle, map->size); -#else free(map->handle, DRM_MEM_MAPS); -#endif break; case _DRM_AGP: case _DRM_SCATTER_GATHER:
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Sun Aug 28 20:37:06 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: savage_drv.c sis_drv.c tdfx_drv.c Log Message: return 'error' not 0, fixes non-module build To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c \ src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c \ src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c:1.6 src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c:1.6 Sun Aug 28 16:19:08 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c Sun Aug 28 20:37:06 2011 @@ -174,7 +174,7 @@ return ENOTTY; } - return 0; + return error; } #endif Index: src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c:1.6 src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c:1.6 Sun Aug 28 16:19:08 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c Sun Aug 28 20:37:06 2011 @@ -168,7 +168,7 @@ return ENOTTY; } - return 0; + return error; } #endif Index: src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c:1.6 src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c:1.6 Sun Aug 28 16:19:08 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c Sun Aug 28 20:37:06 2011 @@ -170,7 +170,7 @@ return ENOTTY; } - return 0; + return error; } #endif
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Sun Aug 28 20:32:35 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: mach64_drv.c Log Message: return 'error' not 0, fixes non-module build To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.6 src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.6 Sun Aug 28 16:19:08 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c Sun Aug 28 20:32:35 2011 @@ -191,7 +191,7 @@ return ENOTTY; } - return 0; + return error; } #endif
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Sun Aug 28 20:22:42 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: i915_drv.c Log Message: return 'error' not 0, fixes non-module build To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.9 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.10 --- src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.9 Sun Aug 28 15:40:50 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c Sun Aug 28 20:22:42 2011 @@ -242,7 +242,7 @@ return ENOTTY; } - return 0; + return error; } #endif
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Wed Aug 3 06:42:59 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_drv.c Log Message: add a little bit of DRM_NO_AGP to help build on ofppc To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.20 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.21 --- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.20 Sun Feb 27 01:02:39 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Wed Aug 3 06:42:59 2011 @@ -112,6 +112,7 @@ DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), +#ifndef DRM_NO_AGP DRM_IOCTL_DEF(DRM_IOCTL_AGP_ACQUIRE, drm_agp_acquire_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_AGP_RELEASE, drm_agp_release_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_AGP_ENABLE, drm_agp_enable_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), @@ -120,6 +121,7 @@ DRM_IOCTL_DEF(DRM_IOCTL_AGP_FREE, drm_agp_free_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_AGP_BIND, drm_agp_bind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_AGP_UNBIND, drm_agp_unbind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), +#endif DRM_IOCTL_DEF(DRM_IOCTL_SG_ALLOC, drm_sg_alloc_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_SG_FREE, drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), @@ -531,6 +533,7 @@ drm_drawable_free_all(dev); DRM_LOCK(); +#ifndef DRM_NO_AGP /* Clear AGP information */ if (dev->agp) { drm_agp_mem_t *entry; @@ -554,6 +557,7 @@ dev->agp->acquired = 0; dev->agp->enabled = 0; } +#endif if (dev->sg != NULL) { drm_sg_cleanup(dev->sg); dev->sg = NULL; @@ -611,6 +615,7 @@ goto error; } +#ifndef DRM_NO_AGP if (drm_core_has_AGP(dev)) { if (drm_device_is_agp(dev)) dev->agp = drm_agp_init(dev); @@ -627,6 +632,7 @@ dev->agp->mtrr = 1; } } +#endif retcode = drm_ctxbitmap_init(dev); if (retcode != 0) {
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jakllsch Date: Mon Jul 25 14:21:52 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_pciids.h Log Message: Add additional Radeon devices from FreeBSD via Dragon Fly BSD. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.6 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.6 Thu Feb 17 23:21:53 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Mon Jul 25 14:21:52 2011 @@ -377,6 +377,7 @@ {0x1002, 0x9487, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon RV730 (AGP)"}, \ {0x1002, 0x948F, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon RV730 (AGP)"}, \ {0x1002, 0x9490, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon HD 4670"}, \ + {0x1002, 0x9495, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon HD 4600 Series"}, \ {0x1002, 0x9498, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon HD 4650"}, \ {0x1002, 0x9480, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4650"}, \ {0x1002, 0x9488, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4670"}, \ @@ -385,6 +386,14 @@ {0x1002, 0x949C, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI FirePro V7750 (FireGL)"}, \ {0x1002, 0x949E, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI FirePro V5700 (FireGL)"}, \ {0x1002, 0x949F, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI FirePro V3750 (FireGL)"}, \ + {0x1002, 0x94A0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4830"}, \ + {0x1002, 0x94A1, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4850"}, \ + {0x1002, 0x94A3, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro M7740"}, \ + {0x1002, 0x94B1, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI RV740"}, \ + {0x1002, 0x94B3, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4770"}, \ + {0x1002, 0x94B4, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4700 Series"}, \ + {0x1002, 0x94B5, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4770"}, \ + {0x1002, 0x94B9, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro M5750"}, \ {0x1002, 0x9540, CHIP_RV710|RADEON_NEW_MEMMAP, "ATI Radeon HD 4550"}, \ {0x1002, 0x9541, CHIP_RV710|RADEON_NEW_MEMMAP, "ATI Radeon RV710"}, \ {0x1002, 0x9542, CHIP_RV710|RADEON_NEW_MEMMAP, "ATI Radeon RV710"}, \ @@ -393,6 +402,7 @@ {0x1002, 0x9552, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4300 Series"}, \ {0x1002, 0x9553, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ {0x1002, 0x9555, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ + {0x1002, 0x9557, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro RG220"}, \ {0x1002, 0x9710, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 4200"}, \ {0x1002, 0x9711, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon RS880"}, \ {0x1002, 0x9712, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon Mobility HD 4200"}, \
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: dyoung Date: Fri Jul 1 18:36:15 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h Log Message: #include instead of . To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/drm/dist/bsd-core/drmP.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.22 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.23 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.22 Thu Jun 9 14:47:15 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Fri Jul 1 18:36:15 2011 @@ -74,7 +74,7 @@ #include #endif #include -#include +#include #if defined(__i386__) || defined(__x86_64__) #include #include
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: joerg Date: Thu Jun 9 14:47:16 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h Log Message: dma_addr_t may not be a 64bit type, so add an explicit cast here instead of silent truncation To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm/dist/bsd-core/drmP.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.21 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.22 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.21 Thu Feb 24 07:59:44 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Thu Jun 9 14:47:15 2011 @@ -696,7 +696,7 @@ }; #ifndef DMA_BIT_MASK -#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1) +#define DMA_BIT_MASK(n) ((dma_addr_t)(((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)) #endif #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jakllsch Date: Sat Mar 5 21:43:39 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_irq.c Log Message: Make interrupt establishment failure be noted like most other PCI drivers do. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.13 src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.14 --- src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.13 Thu Feb 24 07:59:44 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c Sat Mar 5 21:43:38 2011 @@ -228,6 +228,8 @@ dev->irqh = pci_intr_establish(dev->pa.pa_pc, ih, IPL_TTY, drm_irq_handler_wrap, dev); if (!dev->irqh) { + aprint_error_dev(dev->device, + "couldn't establish interrupt at %s\n", istr); retcode = ENOENT; goto err; }
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Sun Feb 27 01:02:40 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_drv.c Log Message: use pa_intrpin instead of pa_intrline for irq#, since drivers treat irq=0 as "no irq" and this matches pa_intrpin encoding To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.19 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.20 --- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.19 Sat Nov 6 22:06:10 2010 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Sun Feb 27 01:02:39 2011 @@ -401,7 +401,7 @@ memcpy(&dev->pa, pa, sizeof(dev->pa)); - dev->irq = pa->pa_intrline; + dev->irq = pa->pa_intrpin; dev->pci_domain = parent_unit; dev->pci_bus = pa->pa_bus; dev->pci_slot = pa->pa_device;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jakllsch Date: Thu Feb 17 23:21:54 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_pciids.h Log Message: Add the RS880 device IDs to radeondrm(4). To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.6 --- src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.5 Thu Jan 6 11:07:48 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Thu Feb 17 23:21:53 2011 @@ -393,7 +393,12 @@ {0x1002, 0x9552, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4300 Series"}, \ {0x1002, 0x9553, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ {0x1002, 0x9555, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ - {0x1002, 0x9712, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon Mobility HD 4200"}, \ + {0x1002, 0x9710, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 4200"}, \ + {0x1002, 0x9711, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon RS880"}, \ + {0x1002, 0x9712, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon Mobility HD 4200"}, \ + {0x1002, 0x9713, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon Mobility RS880"}, \ + {0x1002, 0x9714, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 4290"}, \ + {0x1002, 0x9715, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 4250"}, \ {0, 0, 0, NULL} #define r128_PCI_IDS \
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Tue Feb 15 14:24:23 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_memory.c drm_vm.c Log Message: map the framebuffer and agp with BUS_SPACE_MAP_PREFETCHABLE To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.9 src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.10 --- src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.9 Sat Feb 12 14:49:54 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Tue Feb 15 14:24:23 2011 @@ -197,7 +197,8 @@ dev->agp_map_data[i].mapped++; dev->agp_map_data[i].base = map->offset; dev->agp_map_data[i].size = map->size; - dev->agp_map_data[i].flags = BUS_SPACE_MAP_LINEAR; + dev->agp_map_data[i].flags = BUS_SPACE_MAP_LINEAR | + BUS_SPACE_MAP_PREFETCHABLE; dev->agp_map_data[i].maptype = PCI_MAPREG_TYPE_MEM; map->fullmap = &(dev->agp_map_data[i]); map->mapsize = dev->agp_map_data[i].size; Index: src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c:1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c:1.6 --- src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c:1.5 Sat Jun 20 01:07:09 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c Tue Feb 15 14:24:23 2011 @@ -45,6 +45,7 @@ #elif defined(__NetBSD__) paddr_t phys; unsigned long map_offs; + int flags = 0; #endif #if defined(__FreeBSD__) @@ -135,8 +136,11 @@ case _DRM_REGISTERS: case _DRM_AGP: #if defined(__NetBSD__) + flags = BUS_SPACE_MAP_LINEAR; + if (type == _DRM_FRAME_BUFFER || type == _DRM_AGP) + flags |= BUS_SPACE_MAP_PREFETCHABLE; phys = bus_space_mmap(dev->pa.pa_memt, map->offset, -offset - map->offset, prot, BUS_SPACE_MAP_LINEAR); +offset - map->offset, prot, flags); if (phys == -1) { DRM_ERROR("bus_space_mmap for %" PRIx64 " failed\n", offset); return -1;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Sat Feb 12 14:49:55 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_memory.c Log Message: wsdisplay isn't module friendly so don't add genfb support to the kmod for now To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.8 src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.9 --- src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.8 Fri Feb 11 01:13:02 2011 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Sat Feb 12 14:49:54 2011 @@ -47,7 +47,7 @@ #include "genfb.h" # else # define NAGP_I810 1 -# define NGENFB 1 +# define NGENFB 0 # endif # endif # if NAGP_I810 > 0
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Fri Feb 11 01:13:03 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_memory.c Log Message: Make DRM work with genfb again. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.7 src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.8 --- src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.7 Tue Jan 26 08:01:26 2010 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Fri Feb 11 01:13:02 2011 @@ -44,13 +44,18 @@ # else # if defined(_KERNEL_OPT) #include "agp_i810.h" +#include "genfb.h" # else # define NAGP_I810 1 +# define NGENFB 1 # endif # endif # if NAGP_I810 > 0 # include # endif +# if NGENFB > 0 +# include +# endif #endif MALLOC_DEFINE(DRM_MEM_DMA, "drm_dma", "DRM DMA Data Structures"); @@ -140,6 +145,10 @@ if (agp_i810_borrow(map->offset, &map->bsh)) return bus_space_vaddr(map->bst, map->bsh); #endif +#if NGENFB > 0 +if (genfb_borrow(map->offset, &map->bsh)) + return bus_space_vaddr(map->bst, map->bsh); +#endif DRM_DEBUG("ioremap: failed to map (%d)\n", reason); return NULL;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: cegger Date: Thu Jan 6 11:07:49 UTC 2011 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_pciids.h Log Message: recognize Radeon HD 4200. This lets radeondrm(4) attach. "go ahead" macallan@ To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.4 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.4 Sat Jun 26 23:00:19 2010 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Thu Jan 6 11:07:48 2011 @@ -393,6 +393,7 @@ {0x1002, 0x9552, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4300 Series"}, \ {0x1002, 0x9553, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ {0x1002, 0x9555, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ + {0x1002, 0x9712, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon Mobility HD 4200"}, \ {0, 0, 0, NULL} #define r128_PCI_IDS \
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Wed Nov 10 05:22:56 UTC 2010 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_sysctl.c Log Message: use a sysctllog structure, and sysctl_teardown(), to destroy the drm data. this should actually now fix PR#40029. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c:1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c:1.6 --- src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c:1.5 Wed May 19 22:14:20 2010 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c Wed Nov 10 05:22:55 2010 @@ -55,6 +55,7 @@ const struct sysctlnode *dri, *dri_card, *dri_debug; const struct sysctlnode *dri_rest[DRM_SYSCTL_ENTRIES]; char name[7]; + struct sysctllog *log; #endif }; @@ -112,17 +113,17 @@ CTLFLAG_RW, &drm_debug_flag, sizeof(drm_debug_flag), "Enable debugging output"); #elif defined(__NetBSD__) - sysctl_createv(NULL, 0, NULL, &info->dri, + sysctl_createv(&info->log, 0, NULL, &info->dri, CTLFLAG_READWRITE, CTLTYPE_NODE, "dri", SYSCTL_DESCR("DRI Graphics"), NULL, 0, NULL, 0, CTL_HW, CTL_CREATE); snprintf(info->name, 7, "card%d", minor(dev->kdev)); - sysctl_createv(NULL, 0, NULL, &info->dri_card, + sysctl_createv(&info->log, 0, NULL, &info->dri_card, CTLFLAG_READWRITE, CTLTYPE_NODE, info->name, NULL, NULL, 0, NULL, 0, CTL_HW, info->dri->sysctl_num, CTL_CREATE); for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) - sysctl_createv(NULL, 0, NULL, &(info->dri_rest[i]), + sysctl_createv(&info->log, 0, NULL, &(info->dri_rest[i]), CTLFLAG_READONLY, CTLTYPE_STRING, drm_sysctl_list[i].name, NULL, drm_sysctl_list[i].f, 0, dev, @@ -130,7 +131,7 @@ CTL_HW, info->dri->sysctl_num, info->dri_card->sysctl_num, CTL_CREATE); - sysctl_createv(NULL, 0, NULL, &info->dri_debug, + sysctl_createv(&info->log, 0, NULL, &info->dri_debug, CTLFLAG_READWRITE, CTLTYPE_INT, "debug", SYSCTL_DESCR("Enable debugging output"), NULL, 0, @@ -152,20 +153,7 @@ return error; #elif defined(__NetBSD__) - int i; - - sysctl_destroyv(NULL, CTL_HW, dev->sysctl->dri->sysctl_num, - dev->sysctl->dri_debug->sysctl_num, - CTL_DESTROY); - for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) - sysctl_destroyv(NULL, CTL_HW, dev->sysctl->dri->sysctl_num, - dev->sysctl->dri_card->sysctl_num, - dev->sysctl->dri_rest[i]->sysctl_num, - CTL_DESTROY); - sysctl_destroyv(NULL, CTL_HW, dev->sysctl->dri->sysctl_num, - dev->sysctl->dri_card->sysctl_num, - CTL_DESTROY); - sysctl_destroyv(NULL, CTL_HW, dev->sysctl->dri->sysctl_num, CTL_DESTROY); + sysctl_teardown(&dev->sysctl->log); free(dev->sysctl, DRM_MEM_DRIVER); dev->sysctl = NULL;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Sat Jun 26 23:00:19 UTC 2010 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_pciids.h Log Message: add the latest generation of radeon cards. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.3 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.4 --- src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.3 Fri Jun 19 03:52:20 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Sat Jun 26 23:00:19 2010 @@ -140,6 +140,41 @@ {0x1002, 0x5e4c, CHIP_RV410|RADEON_NEW_MEMMAP, "ATI Radeon RV410 X700 SE"}, \ {0x1002, 0x5e4d, CHIP_RV410|RADEON_NEW_MEMMAP, "ATI Radeon RV410 X700"}, \ {0x1002, 0x5e4f, CHIP_RV410|RADEON_NEW_MEMMAP, "ATI Radeon RV410 X700 SE"}, \ + {0x1002, 0x6880, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Cypress"}, \ + {0x1002, 0x6888, CHIP_CYPRESS|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x6889, CHIP_CYPRESS|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x688A, CHIP_CYPRESS|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x6898, CHIP_CYPRESS|RADEON_NEW_MEMMAP, "ATI Radeon HD 5800"}, \ + {0x1002, 0x6899, CHIP_CYPRESS|RADEON_NEW_MEMMAP, "ATI Radeon HD 5800"}, \ + {0x1002, 0x689c, CHIP_HEMLOCK|RADEON_NEW_MEMMAP, "ATI Radeon HD 5900"}, \ + {0x1002, 0x689d, CHIP_HEMLOCK|RADEON_NEW_MEMMAP, "ATI Radeon HD 5900"}, \ + {0x1002, 0x689e, CHIP_CYPRESS|RADEON_NEW_MEMMAP, "ATI Radeon HD 5800"}, \ + {0x1002, 0x68a0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 5800"}, \ + {0x1002, 0x68a1, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 5800"}, \ + {0x1002, 0x68a8, CHIP_JUNIPER|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x68a9, CHIP_JUNIPER|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x68b0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 5800"}, \ + {0x1002, 0x68b8, CHIP_JUNIPER|RADEON_NEW_MEMMAP, "ATI Radeon HD 5700"}, \ + {0x1002, 0x68b9, CHIP_JUNIPER|RADEON_NEW_MEMMAP, "ATI Radeon HD 5700"}, \ + {0x1002, 0x68be, CHIP_JUNIPER|RADEON_NEW_MEMMAP, "ATI Radeon HD 5700"}, \ + {0x1002, 0x68c0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 5000"}, \ + {0x1002, 0x68c1, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 5000"}, \ + {0x1002, 0x68c8, CHIP_REDWOOD|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x68c9, CHIP_REDWOOD|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x68d8, CHIP_REDWOOD|RADEON_NEW_MEMMAP, "ATI Radeon HD 5670"}, \ + {0x1002, 0x68d9, CHIP_REDWOOD|RADEON_NEW_MEMMAP, "ATI Radeon HD 5570"}, \ + {0x1002, 0x68da, CHIP_REDWOOD|RADEON_NEW_MEMMAP, "ATI Radeon HD 5500"}, \ + {0x1002, 0x68de, CHIP_REDWOOD|RADEON_NEW_MEMMAP, "ATI Redwood"}, \ + {0x1002, 0x68e0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 5000"}, \ + {0x1002, 0x68e1, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 5000"}, \ + {0x1002, 0x68e4, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Cedar"}, \ + {0x1002, 0x68e5, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Cedar"}, \ + {0x1002, 0x68e8, CHIP_CEDAR|RADEON_NEW_MEMMAP, "ATI Cedar"}, \ + {0x1002, 0x68e9, CHIP_CEDAR|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x68f1, CHIP_CEDAR|RADEON_NEW_MEMMAP, "ATI FirePro (FireGL)"}, \ + {0x1002, 0x68f8, CHIP_CEDAR|RADEON_NEW_MEMMAP, "ATI Cedar"}, \ + {0x1002, 0x68f9, CHIP_CEDAR|RADEON_NEW_MEMMAP, "ATI Radeon HD 5450"}, \ + {0x1002, 0x68fe, CHIP_CEDAR|RADEON_NEW_MEMMAP, "ATI Cedar"}, \ {0x1002, 0x7100, CHIP_R520|RADEON_NEW_MEMMAP, "ATI Radeon X1800"}, \ {0x1002, 0x7101, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon X1800 XT"}, \ {0x1002, 0x7102, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon X1800"}, \
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Mon May 24 08:51:53 UTC 2010 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h Log Message: use round_page() for PAGE_ALIGN(). from Onno van der Linden in PR#38700, though apparently i didn't commit it way back when i closed that bug. oops? To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/external/bsd/drm/dist/bsd-core/drmP.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.18 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.19 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.18 Mon May 24 01:39:06 2010 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Mon May 24 08:51:53 2010 @@ -294,7 +294,7 @@ #elif defined(__NetBSD__) -#define PAGE_ALIGN(addr)ALIGN(addr) +#define PAGE_ALIGN(addr) round_page(addr) #define DRM_SUSER(p)(kauth_cred_getsvuid((p)->p_cred) == 0) #define DRM_AGP_FIND_DEVICE() agp_find_device(0) #ifdef MTRR_TYPE_WC
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Wed May 19 22:14:20 UTC 2010 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h drm_sysctl.c Log Message: only use bus_space*() on drm_local_map_t's that have been mapped into some bus space somewhere. otherwise, just use normal accesses since it is normal memory. this fixes radeondrm on x86 since bus_space_tag_t became a pointer. add the "GEM" and "TTM" mapping types to sysctl support (though right now we will never have them in our list of maps.) To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm/dist/bsd-core/drmP.h cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.16 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.17 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.16 Tue Jan 26 08:01:26 2010 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Wed May 19 22:14:20 2010 @@ -357,53 +357,6 @@ "lock; addl $0,0(%%rsp)" : : : "memory"); #endif -#if defined(__FreeBSD__) - -#define DRM_READ8(map, offset) \ - *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \ - (vm_offset_t)(offset)) -#define DRM_READ16(map, offset) \ - *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \ - (vm_offset_t)(offset)) -#define DRM_READ32(map, offset) \ - *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \ - (vm_offset_t)(offset)) -#define DRM_WRITE8(map, offset, val) \ - *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \ - (vm_offset_t)(offset)) = val -#define DRM_WRITE16(map, offset, val) \ - *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \ - (vm_offset_t)(offset)) = val -#define DRM_WRITE32(map, offset, val) \ - *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \ - (vm_offset_t)(offset)) = val - -#define DRM_VERIFYAREA_READ( uaddr, size ) \ - (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ)) - -#elif defined(__NetBSD__) - -typedef vaddr_t vm_offset_t; - -#define DRM_READ8(map, offset) \ - bus_space_read_1( (map)->bst, (map)->bsh, (offset)) -#define DRM_READ16(map, offset) \ - bus_space_read_2( (map)->bst, (map)->bsh, (offset)) -#define DRM_READ32(map, offset) \ - bus_space_read_4( (map)->bst, (map)->bsh, (offset)) -#define DRM_WRITE8(map, offset, val) \ - bus_space_write_1((map)->bst, (map)->bsh, (offset), (val)) -#define DRM_WRITE16(map, offset, val) \ - bus_space_write_2((map)->bst, (map)->bsh, (offset), (val)) -#define DRM_WRITE32(map, offset, val) \ - bus_space_write_4((map)->bst, (map)->bsh, (offset), (val)) - -#define DRM_VERIFYAREA_READ( uaddr, size ) \ - (!uvm_map_checkprot(&(curproc->p_vmspace->vm_map), \ - (vaddr_t)uaddr, (vaddr_t)uaddr+size, UVM_PROT_READ)) - -#endif - #define DRM_COPY_TO_USER(user, kern, size) \ copyout(kern, user, size) #define DRM_COPY_FROM_USER(kern, user, size) \ @@ -929,6 +882,97 @@ #define drm_core_has_AGP(dev) (0) #endif +#if defined(__FreeBSD__) + +#define DRM_READ8(map, offset) \ + *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \ + (vm_offset_t)(offset)) +#define DRM_READ16(map, offset) \ + *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \ + (vm_offset_t)(offset)) +#define DRM_READ32(map, offset) \ + *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \ + (vm_offset_t)(offset)) +#define DRM_WRITE8(map, offset, val) \ + *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \ + (vm_offset_t)(offset)) = val +#define DRM_WRITE16(map, offset, val) \ + *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \ + (vm_offset_t)(offset)) = val +#define DRM_WRITE32(map, offset, val) \ + *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \ + (vm_offset_t)(offset)) = val + +#define DRM_VERIFYAREA_READ( uaddr, size ) \ + (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ)) + +#elif defined(__NetBSD__) + +typedef vaddr_t vm_offset_t; + +#define DRM_IS_BUS_SPACE(map) ((map)->type == _DRM_REGISTERS || \ + (map)->type == _DRM_CONSISTENT) + +static __inline__ u_int8_t +DRM_READ8(drm_local_map_t *map, bus_size_t offset) +{ + if (DRM_IS_BUS_SPACE(map)) + return bus_space_read_1(map->bst, map->bsh, offset); + else + return *(volatile u_int8_t *)((vaddr_t)map->handle + offset); +} + +static __inline__ u_int16_t +DRM_READ16(drm_local_map_t *map, bus_size_t offset) +{ + if (DRM_IS_BUS_SPACE(map)) + return bus_space_read_2(map->bst, map->bsh, offset); + else + return *(volatile u_int16_t *)((vaddr_t)map->handle + offset); +} + +static __inline__ u_int32_t +DRM_READ32(drm_local_map_t *map, bus_size_t offset) +{ + if (DRM_IS_BUS_SPACE(map)) + return bus_space_read_4(map->bst, map->bsh, offset); + else + return *(volat
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Sat Mar 20 02:53:35 UTC 2010 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_pci.c Log Message: don't pass "maxaddr" as a boundary in bus_dmamap_create() like rev 1.8 did for _alloc(). To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.8 src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.9 --- src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.8 Sat Sep 12 17:16:41 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c Sat Mar 20 02:53:35 2010 @@ -137,7 +137,7 @@ free(dmah, DRM_MEM_DMA); return NULL; } - if ((ret = bus_dmamap_create(dmah->tag, size, 1, size, maxaddr, + if ((ret = bus_dmamap_create(dmah->tag, size, 1, size, 0, BUS_DMA_NOWAIT, &dmah->map)) != 0) { printf("drm: Unable to create DMA map, error %d\n", ret); bus_dmamem_unmap(dmah->tag, dmah->vaddr, size);
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmorse Date: Tue Jan 26 08:01:27 UTC 2010 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h drm_bufs.c drm_memory.c Log Message: PR/42262: Support drm drivers (intel G33/G45) submapping pci resources To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm/dist/bsd-core/drmP.h cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c \ src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.15 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.16 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.15 Sun Dec 6 22:51:25 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Tue Jan 26 08:01:26 2010 @@ -658,6 +658,18 @@ typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t; +#if defined(__NetBSD__) +typedef struct { + int mapped; + int maptype; + bus_addr_t base; + bus_size_t size; + bus_space_handle_t bsh; + int flags; + void * vaddr; +} pci_map_data_t; +#endif + typedef struct drm_local_map { unsigned long offset; /* Physical address (0 for SAREA)*/ unsigned long size; /* Physical size (bytes) */ @@ -675,7 +687,7 @@ bus_space_handle_t bsh; drm_dma_handle_t *dmah; #if defined(__NetBSD__) - int *cnt; + pci_map_data_t *fullmap; bus_size_t mapsize; #endif TAILQ_ENTRY(drm_local_map) link; @@ -792,18 +804,6 @@ /* Length for the array of resource pointers for drm_get_resource_*. */ #define DRM_MAX_PCI_RESOURCE 6 -#if defined(__NetBSD__) -typedef struct { - int mapped; - int maptype; - bus_addr_t base; - bus_size_t size; - bus_space_handle_t bsh; - int flags; - void * vaddr; -} pci_map_data_t; -#endif - /** * DRM device functions structure */ Index: src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.6 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.6 Wed Sep 2 01:36:41 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Tue Jan 26 08:01:26 2010 @@ -159,16 +159,25 @@ map->size = size; map->type = type; map->flags = flags; -#ifdef __NetBSD__ - map->cnt = NULL; +#if defined(__NetBSD__) + map->fullmap = NULL; map->mapsize = 0; #endif switch (map->type) { case _DRM_REGISTERS: map->handle = drm_ioremap(dev, map); + if (map->handle == NULL) { + DRM_ERROR("drm_addmap couldn't ioremap registers with " +"base %lX, size %lX\n", +(long) offset, (long) size); + DRM_LOCK(); + return EINVAL; + } + if (!(map->flags & _DRM_WRITE_COMBINING)) break; + /* FALLTHROUGH */ case _DRM_FRAME_BUFFER: if (drm_mtrr_add(map->offset, map->size, DRM_MTRR_WC) == 0) Index: src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.6 src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c:1.6 Wed Sep 2 01:36:41 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Tue Jan 26 08:01:26 2010 @@ -85,29 +85,55 @@ static void * drm_netbsd_ioremap(struct drm_device *dev, drm_local_map_t *map, int wc) { + bus_space_handle_t h; int i, reg, reason; for(i = 0; ipci_map_data[i].maptype == PCI_MAPREG_TYPE_MEM || dev->pci_map_data[i].maptype == (PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT)) && - dev->pci_map_data[i].base == map->offset && - dev->pci_map_data[i].size >= map->size) + map->offset >= dev->pci_map_data[i].base && + map->offset + map->size <= dev->pci_map_data[i].base + + dev->pci_map_data[i].size) { map->bst = dev->pa.pa_memt; - map->cnt = &(dev->pci_map_data[i].mapped); - map->mapsize = dev->pci_map_data[i].size; + map->fullmap = &(dev->pci_map_data[i]); + map->mapsize = map->size; dev->pci_map_data[i].mapped++; + + /* If we've already mapped this resource in, handle + * submapping if needed, give caller a bus_space handle + * and pointer for the offest they asked for */ if (dev->pci_map_data[i].mapped > 1) { -map->bsh = dev->pci_map_data[i].bsh; -return dev->pci_map_data[i].vaddr; +if ((reason = bus_space_subregion( + dev->pa.pa_memt, + dev->pci_map_data[i].bsh, + map->offset - dev->pci_map_data[i].base, + map->size, &h)) != 0) { + DRM_DEBUG("ioremap failed to " + "bus_space_subregion: %d\n", + reason); + return NULL; +} +map->bsh = h; +map->handle = bus_space_vaddr(dev->pa.pa_memt, + h); +return map->handle; } + + /* Map in entirety of resource - full size and handle + * go in pci_map_data, specifi
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: dyoung Date: Fri Jan 8 19:50:27 UTC 2010 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: i915_drv.c radeon_drv.c Log Message: Expand PMF_FN_* macros. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c \ src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.6 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.6 Sun Dec 6 22:51:25 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c Fri Jan 8 19:50:27 2010 @@ -163,7 +163,7 @@ #elif defined(__NetBSD__) static bool -i915drm_suspend(device_t self PMF_FN_ARGS) +i915drm_suspend(device_t self, pmf_qual_t qual) { struct drm_device *dev = device_private(self); @@ -172,7 +172,7 @@ } static bool -i915drm_resume(device_t self PMF_FN_ARGS) +i915drm_resume(device_t self, pmf_qual_t qual) { struct drm_device *dev = device_private(self); Index: src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.6 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.7 --- src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.6 Mon Dec 14 21:01:07 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c Fri Jan 8 19:50:27 2010 @@ -135,7 +135,7 @@ #elif defined(__NetBSD__) static bool -radeondrm_suspend(device_t self PMF_FN_ARGS) +radeondrm_suspend(device_t self, pmf_qual_t qual) { struct drm_device *rad_dev = device_private(self); drm_radeon_cp_stop_t stop_args; @@ -148,7 +148,7 @@ } static bool -radeondrm_resume(device_t self PMF_FN_ARGS) +radeondrm_resume(device_t self, pmf_qual_t qual) { struct drm_device *rad_dev = device_private(self); if (radeon_cp_resume(rad_dev, NULL, NULL) != 0)
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: kefren Date: Mon Dec 14 21:01:07 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: radeon_drv.c Log Message: add suspend/resume hooks for command processor To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.5 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.6 --- src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.5 Sat Dec 12 14:15:25 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c Mon Dec 14 21:01:07 2009 @@ -134,6 +134,29 @@ #elif defined(__NetBSD__) +static bool +radeondrm_suspend(device_t self PMF_FN_ARGS) +{ + struct drm_device *rad_dev = device_private(self); + drm_radeon_cp_stop_t stop_args; + + stop_args.flush = stop_args.idle = 0; + if (radeon_cp_stop(rad_dev, &stop_args, rad_dev->lock.file_priv) != 0) + return false; + + return true; +} + +static bool +radeondrm_resume(device_t self PMF_FN_ARGS) +{ + struct drm_device *rad_dev = device_private(self); + if (radeon_cp_resume(rad_dev, NULL, NULL) != 0) + return false; + + return true; +} + static int radeondrm_probe(device_t parent, cfdata_t match, void *aux) { @@ -152,14 +175,22 @@ radeon_configure(dev); - if (!pmf_device_register(self, NULL, NULL)) + if (!pmf_device_register(self, radeondrm_suspend, radeondrm_resume)) aprint_error_dev(self, "couldn't establish power handler\n"); drm_attach(self, pa, radeon_pciidlist); } +static int +radeondrm_detach(device_t self, int flags) +{ + pmf_device_deregister(self); + + return drm_detach(self, flags); +} + CFATTACH_DECL_NEW(radeondrm, sizeof(struct drm_device), -radeondrm_probe, radeondrm_attach, drm_detach, NULL); +radeondrm_probe, radeondrm_attach, radeondrm_detach, NULL); #ifdef _MODULE
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: kefren Date: Sat Dec 12 14:15:25 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: radeon_drv.c Log Message: add stub pmf hook To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.4 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.4 Sun Dec 6 22:51:25 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c Sat Dec 12 14:15:25 2009 @@ -152,6 +152,9 @@ radeon_configure(dev); + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, "couldn't establish power handler\n"); + drm_attach(self, pa, radeon_pciidlist); }
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: dyoung Date: Sun Dec 6 22:51:25 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h drm_drv.c i915_drv.c mach64_drv.c mga_drv.c r128_drv.c radeon_drv.c savage_drv.c sis_drv.c tdfx_drv.c via_drv.c Log Message: Delete the do-nothing device-activation hook, drm_activate(). To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm/dist/bsd-core/drmP.h cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c \ src/sys/external/bsd/drm/dist/bsd-core/via_drv.c cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c \ src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c \ src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c \ src/sys/external/bsd/drm/dist/bsd-core/sis_drv.c \ src/sys/external/bsd/drm/dist/bsd-core/tdfx_drv.c cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.14 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.15 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.14 Wed Sep 2 01:36:41 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Sun Dec 6 22:51:25 2009 @@ -946,7 +946,6 @@ int drm_probe(struct pci_attach_args *pa, drm_pci_id_list_t *idlist); void drm_attach(device_t kdev, struct pci_attach_args *pa, drm_pci_id_list_t *idlist); int drm_detach(device_t self, int flags); -int drm_activate(device_t self, devact_t act); dev_type_ioctl(drm_ioctl); dev_type_open(drm_open); dev_type_close(drm_close); Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.17 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.18 --- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.17 Wed Sep 2 01:36:41 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Sun Dec 6 22:51:25 2009 @@ -434,21 +434,6 @@ return 0; } -int -drm_activate(device_t self, devact_t act) -{ - switch (act) { - case DVACT_ACTIVATE: - return (EOPNOTSUPP); - break; - - case DVACT_DEACTIVATE: - /* FIXME */ - break; - } - return (0); -} - #endif drm_pci_id_list_t *drm_find_description(int vendor, int device, Index: src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.5 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.6 --- src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.5 Sun Sep 27 12:59:38 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c Sun Dec 6 22:51:25 2009 @@ -212,7 +212,7 @@ } CFATTACH_DECL_NEW(i915drm, sizeof(struct drm_device), i915drm_probe, -i915drm_attach, i915drm_detach, drm_activate); +i915drm_attach, i915drm_detach, NULL); #ifdef _MODULE Index: src/sys/external/bsd/drm/dist/bsd-core/via_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/via_drv.c:1.5 src/sys/external/bsd/drm/dist/bsd-core/via_drv.c:1.6 --- src/sys/external/bsd/drm/dist/bsd-core/via_drv.c:1.5 Sun Sep 27 12:58:51 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/via_drv.c Sun Dec 6 22:51:25 2009 @@ -156,7 +156,7 @@ } CFATTACH_DECL_NEW(viadrm, sizeof(struct drm_device), -viadrm_probe, viadrm_attach, viadrm_detach, drm_activate); +viadrm_probe, viadrm_attach, viadrm_detach, NULL); #ifdef _MODULE Index: src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.4 src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c:1.4 Tue Jun 23 04:42:01 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/mach64_drv.c Sun Dec 6 22:51:25 2009 @@ -161,7 +161,7 @@ } CFATTACH_DECL_NEW(mach64drm, sizeof(struct drm_device), -mach64drm_probe, mach64drm_attach, drm_detach, drm_activate); +mach64drm_probe, mach64drm_attach, drm_detach, NULL); #ifdef _MODULE Index: src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c:1.4 src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c:1.4 Tue Jun 23 04:42:01 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/r128_drv.c Sun Dec 6 22:51:25 2009 @@ -159,7 +159,7 @@ } CFATTACH_DECL_NEW(r128drm, sizeof(struct drm_device), -r128drm_probe, r128drm_attach, drm_detach, drm_activate); +r128drm_probe, r128drm_attach, drm_detach, NULL); #ifdef _MODULE Index: src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c:1.4 src/sys/external/bsd/drm/dist/bsd-core/savage_drv.c:1.5 -
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Sun Sep 27 12:59:38 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: i915_drv.c Log Message: deregister with pmf on detach To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.4 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.4 Fri Jun 19 03:50:03 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c Sun Sep 27 12:59:38 2009 @@ -203,8 +203,16 @@ drm_attach(self, pa, i915_pciidlist); } +static int +i915drm_detach(device_t self, int flags) +{ + pmf_device_deregister(self); + + return drm_detach(self, flags); +} + CFATTACH_DECL_NEW(i915drm, sizeof(struct drm_device), i915drm_probe, -i915drm_attach, drm_detach, drm_activate); +i915drm_attach, i915drm_detach, drm_activate); #ifdef _MODULE
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: jmcneill Date: Sun Sep 27 12:58:51 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: via_drv.c Log Message: register with pmf To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/via_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/via_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/via_drv.c:1.4 src/sys/external/bsd/drm/dist/bsd-core/via_drv.c:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/via_drv.c:1.4 Sun Sep 27 12:39:04 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/via_drv.c Sun Sep 27 12:58:51 2009 @@ -136,6 +136,9 @@ struct pci_attach_args *pa = aux; struct drm_device *dev = device_private(self); + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, "couldn't establish power handler\n"); + dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); @@ -144,8 +147,16 @@ drm_attach(self, pa, via_pciidlist); } +static int +viadrm_detach(device_t self, int flags) +{ + pmf_device_deregister(self); + + return drm_detach(self, flags); +} + CFATTACH_DECL_NEW(viadrm, sizeof(struct drm_device), -viadrm_probe, viadrm_attach, drm_detach, drm_activate); +viadrm_probe, viadrm_attach, viadrm_detach, drm_activate); #ifdef _MODULE
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Sun Sep 27 03:48:07 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_irq.c Log Message: make sure to call pci_intr_*stablish() with the right first argument; it worked by C-luck on x86, but macppc picked it up. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.10 src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.11 --- src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.10 Sat Jun 20 01:07:09 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c Sun Sep 27 03:48:07 2009 @@ -225,7 +225,7 @@ goto err; } istr = pci_intr_string(dev->pa.pa_pc, ih); - dev->irqh = pci_intr_establish(&dev->pa.pa_pc, ih, IPL_TTY, + dev->irqh = pci_intr_establish(dev->pa.pa_pc, ih, IPL_TTY, drm_irq_handler_wrap, dev); if (!dev->irqh) { retcode = ENOENT; @@ -264,7 +264,7 @@ bus_teardown_intr(dev->device, dev->irqr, dev->irqh); DRM_LOCK(); #elif defined(__NetBSD__) - pci_intr_disestablish(&dev->pa.pa_pc, dev->irqh); + pci_intr_disestablish(dev->pa.pa_pc, dev->irqh); #endif return 0;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Wed Sep 2 01:34:34 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: ati_pcigart.c Log Message: remove a memset() that isn't necessary. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/ati_pcigart.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/ati_pcigart.c diff -u src/sys/external/bsd/drm/dist/bsd-core/ati_pcigart.c:1.4 src/sys/external/bsd/drm/dist/bsd-core/ati_pcigart.c:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/ati_pcigart.c:1.4 Sat Jun 20 01:07:09 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/ati_pcigart.c Wed Sep 2 01:34:34 2009 @@ -167,13 +167,15 @@ dmah->busaddr = dmah->map->dm_segs[0].ds_addr; dmah->size = gart_info->table_size; dmah->nsegs = 1; +#if 0 /* - * Mirror here FreeBSD doing BUS_DMA_ZERO. - * But I see this same memset() is done in drm_ati_pcigart_init(), - * so maybe this is not needed. - */ + * Mirror here FreeBSD doing BUS_DMA_ZERO. + * But I see this same memset() is done in drm_ati_pcigart_init(), + * so maybe this is not needed. + */ memset(dmah->vaddr, 0, gart_info->table_size); #endif +#endif dev->sg->dmah = dmah;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Wed Aug 26 01:37:10 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_drv.c Log Message: introduce an ugly but simple hack to work around external software requirements: set the drm pci "domain" to the pci bus unit number. this matches what libpciaccess does for netbsd and now drm is much happier again. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.15 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.16 --- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.15 Sun Aug 23 08:55:16 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Wed Aug 26 01:37:10 2009 @@ -334,14 +334,27 @@ void drm_attach(device_t kdev, struct pci_attach_args *pa, drm_pci_id_list_t *idlist) { + device_t parent_dev; struct drm_device *dev; - int unit; + int unit, parent_unit; unit = device_unit(kdev); if (unit < 0 || unit >= DRM_MAXUNITS) - panic("drm_attach: device unit %d invalid", unit); + panic("drm_attach: device unit %d invalid", unit); if (drm_units[unit] != NULL) - panic("drm_attach: unit %d already attached", unit); + panic("drm_attach: unit %d already attached", unit); + + /* + * this is kind of ugly but we fake up the pci "domain" by using + * our pci unit number, so, find our parent pci device's unit... + */ + parent_dev = kdev; + do { + parent_dev = device_parent(parent_dev); + } while (parent_dev && !device_is_a(parent_dev, "pci")); + parent_unit = device_unit(parent_dev); + if (parent_unit < 0) + panic("drm_attach: device parent_unit %d invalid", parent_unit); dev = device_private(kdev); dev->device = kdev; @@ -389,8 +402,7 @@ memcpy(&dev->pa, pa, sizeof(dev->pa)); dev->irq = pa->pa_intrline; - /* XXX this needs to be deal with for other platforms, e.g. alpha */ - dev->pci_domain = 0; + dev->pci_domain = parent_unit; dev->pci_bus = pa->pa_bus; dev->pci_slot = pa->pa_device; dev->pci_func = pa->pa_function;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Sun Aug 23 08:55:16 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_drv.c Log Message: on netbsd with the single final close() action, make sure we clean up all the files attached to dev->files. we check for one per "open_count" that is above 1. could perhaps assert() that we are empty afterwards. this fixes restarting X + drm after actually using drm. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.14 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.15 --- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.14 Wed Jun 24 08:09:26 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Sun Aug 23 08:55:16 2009 @@ -932,7 +932,17 @@ #if defined(__NetBSD__) /* On NetBSD, close will only be called once */ DRM_DEBUG("setting open_count %d to 1\n", (int)dev->open_count); - dev->open_count = 1; + while (dev->open_count != 1) { + /* + * XXXMRG probably should assert that we are freeing + * one of these each time. i think. + */ + if (!TAILQ_EMPTY(&dev->files)) { + file_priv = TAILQ_FIRST(&dev->files); + TAILQ_REMOVE(&dev->files, file_priv, link); + } + dev->open_count--; + } #endif if (--dev->open_count == 0) { retcode = drm_lastclose(dev);
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Fri Aug 7 22:51:05 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h drm_fops.c Log Message: remove some netbsd specific code that does nothing. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm/dist/bsd-core/drmP.h cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.12 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.13 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.12 Sat Jun 20 01:07:09 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Fri Aug 7 22:51:04 2009 @@ -582,9 +582,6 @@ int minor; pid_t pid; uid_t uid; -#if defined(__NetBSD__) - int refs; -#endif drm_magic_t magic; unsigned long ioctl_count; void *driver_priv; Index: src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c:1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c:1.6 --- src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c:1.5 Sat Jun 20 01:07:09 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c Fri Aug 7 22:51:04 2009 @@ -70,9 +70,7 @@ DRM_LOCK(); priv = drm_find_file_by_proc(dev, p); - if (priv) { - priv->refs++; - } else { + if (!priv) { priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO); if (priv == NULL) { DRM_UNLOCK(); @@ -81,7 +79,6 @@ priv->uid = kauth_cred_getsvuid(p->p_cred); priv->pid = p->p_pid; - priv->refs = 1; priv->minor = m; priv->ioctl_count = 0;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Wed Jun 24 19:47:15 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: mga_drv.c Log Message: don't include pcidevs_data.h. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c:1.5 src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c:1.6 --- src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c:1.5 Tue Jun 23 04:42:01 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/mga_drv.c Wed Jun 24 19:47:15 2009 @@ -40,7 +40,6 @@ #ifdef __NetBSD__ #include #include -#include #endif /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Wed Jun 24 08:09:27 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_drv.c Log Message: convert a DRM_ERROR() to DRM_DEBUG(). its failure is not fatal and it tends to trigger on almost all cards. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.13 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.14 --- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.13 Sat Jun 20 01:07:09 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Wed Jun 24 08:09:26 2009 @@ -360,7 +360,7 @@ &(dev->pci_map_data[unit].size), &(dev->pci_map_data[unit].flags))) { - DRM_ERROR("pci_mapreg info for %d failed\n", + DRM_DEBUG("pci_mapreg info for %d failed\n", PCI_MAPREG_START + unit*4); dev->pci_map_data[unit].base = 0; dev->pci_map_data[unit].size = 0;
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Fri Jun 19 03:52:20 UTC 2009 Added Files: src/sys/external/bsd/drm/dist/bsd-core: drm_pciids.h Log Message: add a freshly generated drm_pciids.h To generate a diff of this commit: cvs rdiff -u -r0 -r1.3 src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h diff -u /dev/null src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h:1.3 --- /dev/null Fri Jun 19 03:52:20 2009 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_pciids.h Fri Jun 19 03:52:20 2009 @@ -0,0 +1,729 @@ +/* + This file is auto-generated from the drm_pciids.txt in the DRM CVS + Please contact dri-de...@lists.sf.net to add new cards to this list +*/ +#define radeon_PCI_IDS \ + {0x1002, 0x3150, CHIP_RV380|RADEON_IS_MOBILITY, "ATI Radeon Mobility X600 M24"}, \ + {0x1002, 0x3152, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Radeon Mobility X300 M24"}, \ + {0x1002, 0x3154, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FireGL M24 GL"}, \ + {0x1002, 0x3E50, CHIP_RV380|RADEON_NEW_MEMMAP, "ATI Radeon RV380 X600"}, \ + {0x1002, 0x3E54, CHIP_RV380|RADEON_NEW_MEMMAP, "ATI FireGL V3200 RV380"}, \ + {0x1002, 0x4136, CHIP_RS100|RADEON_IS_IGP, "ATI Radeon RS100 IGP 320"}, \ + {0x1002, 0x4137, CHIP_RS200|RADEON_IS_IGP, "ATI Radeon RS200 IGP 340"}, \ + {0x1002, 0x4144, CHIP_R300, "ATI Radeon AD 9500"}, \ + {0x1002, 0x4145, CHIP_R300, "ATI Radeon AE 9700 Pro"}, \ + {0x1002, 0x4146, CHIP_R300, "ATI Radeon AF R300 9600TX"}, \ + {0x1002, 0x4147, CHIP_R300, "ATI FireGL AG Z1"}, \ + {0x1002, 0x4148, CHIP_R350, "ATI Radeon AH 9800 SE"}, \ + {0x1002, 0x4149, CHIP_R350, "ATI Radeon AI 9800"}, \ + {0x1002, 0x414A, CHIP_R350, "ATI Radeon AJ 9800"}, \ + {0x1002, 0x414B, CHIP_R350, "ATI FireGL AK X2"}, \ + {0x1002, 0x4150, CHIP_RV350, "ATI Radeon AP 9600"}, \ + {0x1002, 0x4151, CHIP_RV350, "ATI Radeon AQ 9600 SE"}, \ + {0x1002, 0x4152, CHIP_RV350, "ATI Radeon AR 9600 XT"}, \ + {0x1002, 0x4153, CHIP_RV350, "ATI Radeon AS 9550"}, \ + {0x1002, 0x4154, CHIP_RV350, "ATI FireGL AT T2"}, \ + {0x1002, 0x4155, CHIP_RV350, "ATI Radeon 9650"}, \ + {0x1002, 0x4156, CHIP_RV350, "ATI FireGL AV RV360 T2"}, \ + {0x1002, 0x4237, CHIP_RS200|RADEON_IS_IGP, "ATI Radeon RS250 IGP"}, \ + {0x1002, 0x4242, CHIP_R200, "ATI Radeon BB R200 AIW 8500DV"}, \ + {0x1002, 0x4243, CHIP_R200, "ATI Radeon BC R200"}, \ + {0x1002, 0x4336, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY, "ATI Radeon RS100 Mobility U1"}, \ + {0x1002, 0x4337, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY, "ATI Radeon RS200 Mobility IGP 340M"}, \ + {0x1002, 0x4437, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY, "ATI Radeon RS250 Mobility IGP"}, \ + {0x1002, 0x4966, CHIP_RV250, "ATI Radeon If RV250 9000"}, \ + {0x1002, 0x4967, CHIP_RV250, "ATI Radeon Ig RV250 9000"}, \ + {0x1002, 0x4A48, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon JH R420 X800"}, \ + {0x1002, 0x4A49, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon JI R420 X800 Pro"}, \ + {0x1002, 0x4A4A, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon JJ R420 X800 SE"}, \ + {0x1002, 0x4A4B, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon JK R420 X800 XT"}, \ + {0x1002, 0x4A4C, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon JL R420 X800"}, \ + {0x1002, 0x4A4D, CHIP_R420|RADEON_NEW_MEMMAP, "ATI FireGL JM X3-256"}, \ + {0x1002, 0x4A4E, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Radeon JN R420 Mobility M18"}, \ + {0x1002, 0x4A4F, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon JO R420 X800 SE"}, \ + {0x1002, 0x4A50, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon JP R420 X800 XT PE"}, \ + {0x1002, 0x4A54, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon JT R420 AIW X800 VE"}, \ + {0x1002, 0x4B49, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R481 X850 XT"}, \ + {0x1002, 0x4B4A, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R481 X850 SE"}, \ + {0x1002, 0x4B4B, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R481 X850 Pro"}, \ + {0x1002, 0x4B4C, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R481 X850 XT PE"}, \ + {0x1002, 0x4C57, CHIP_RV200|RADEON_IS_MOBILITY, "ATI Radeon LW RV200 Mobility 7500 M7"}, \ + {0x1002, 0x4C58, CHIP_RV200|RADEON_IS_MOBILITY, "ATI Radeon LX RV200 Mobility FireGL 7800 M7"}, \ + {0x1002, 0x4C59, CHIP_RV100|RADEON_IS_MOBILITY, "ATI Radeon LY RV100 Mobility M6"}, \ + {0x1002, 0x4C5A, CHIP_RV100|RADEON_IS_MOBILITY, "ATI Radeon LZ RV100 Mobility M6"}, \ + {0x1002, 0x4C64, CHIP_RV250|RADEON_IS_MOBILITY, "ATI Radeon Ld RV250 Mobility 9000 M9"}, \ + {0x1002, 0x4C66, CHIP_RV250, "ATI Radeon Lf RV250 Mobility 9000 M9 / FireMV 2400 PCI"}, \ + {0x1002, 0x4C67, CHIP_RV250|RADEON_IS_MOBILITY, "ATI Radeon Lg RV250 Mobility 9000 M9"}, \ + {0x1002, 0x4E44, CHIP_R300, "ATI Radeon ND R300 9700 Pro"}, \ + {0x1002, 0x4E45, CHIP_R300, "ATI Radeon NE R300 9500 Pro / 9700"}, \ + {0x1002, 0x4E46, CHIP_R300, "ATI Radeon NF R300 9600TX"}, \ + {0x1002, 0x4E47, CHIP_R300, "ATI Radeon NG R300 FireGL
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: joerg Date: Sat May 9 01:29:01 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: i915_drv.c Log Message: softc split as needed by the rest of the drm code. Add basic suspend/resume hooks. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.2 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.3 --- src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c:1.2 Sat Jul 19 06:18:23 2008 +++ src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c Sat May 9 01:29:01 2009 @@ -154,6 +154,24 @@ #elif defined(__OpenBSD__) CFDRIVER_DECL(i915, DV_TTY, NULL); #elif defined(__NetBSD__) +static bool +i915drm_suspend(device_t self PMF_FN_ARGS) +{ + drm_device_t *dev = device_private(self); + + i915_save_state(dev); + return true; +} + +static bool +i915drm_resume(device_t self PMF_FN_ARGS) +{ + drm_device_t *dev = device_private(self); + + i915_restore_state(dev); + return true; +} + static int i915drm_probe(struct device *parent, struct cfdata *match, void *aux) { @@ -165,16 +183,16 @@ i915drm_attach(struct device *parent, struct device *self, void *aux) { struct pci_attach_args *pa = aux; - drm_device_t *dev = (drm_device_t *)self; + drm_device_t *dev = device_private(self); i915_configure(dev); - pmf_device_register(self, NULL, NULL); + pmf_device_register(self, i915drm_suspend, i915drm_resume); drm_attach(self, pa, i915_pciidlist); } -CFATTACH_DECL(i915drm, sizeof(drm_device_t), i915drm_probe, i915drm_attach, +CFATTACH_DECL_NEW(i915drm, sizeof(drm_device_t), i915drm_probe, i915drm_attach, drm_detach, drm_activate); #ifdef _MODULE
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Mon Mar 30 01:51:40 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_vm.c Log Message: apply from sys/dev: revision 1.17 date: 2009/03/29 19:50:17; author: mrg; state: Exp; lines: +7 -7 drm_addmap(): - for _DRM_CONSISTENT mappings, keep the handle. - use DRM_HANDLE_NEEDS_MASK() drm_mapbufs(): - use DRM_HANDLE_NEEDS_MASK() drm_mmap(): - use DRM_HANDLE_NEEDS_MASK() - for _DRM_SCATTER_GATHER and _DRM_SHM, use vtophys() on the adjusted offset. XXX this is gets radeon working on amd64 with an older PCI 9250 card. XXX: need to excise vtophys() usage. XXX: need to finish porting these fixes to external. yay! this takes care of one of the XXX's. still not quite working. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c:1.2 src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c:1.3 --- src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c:1.2 Sat Jul 19 06:18:23 2008 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_vm.c Mon Mar 30 01:51:40 2009 @@ -45,9 +45,10 @@ vm_paddr_t phys; #else paddr_t phys; - uintptr_t roffset; + off_t roffset; #endif + /*DRM_DEBUG("dev %llx offset %llx prot %d\n", (long long)kdev, (long long)offset, prot);*/ DRM_LOCK(); priv = drm_find_file_by_proc(dev, DRM_CURPROC); DRM_UNLOCK(); @@ -101,7 +102,7 @@ if (roffset >= map->offset && roffset < map->offset + map->size) break; #elif defined(__NetBSD__) - if (map->type == _DRM_SHM) { + if (DRM_HANDLE_NEEDS_MASK(map->type)) { if (roffset >= (uintptr_t)map->handle && roffset < (uintptr_t)map->handle + map->size) break; } else { @@ -134,12 +135,16 @@ phys = vtophys((vaddr_t)((char *)map->handle + (offset - map->offset))); break; case _DRM_SHM: -#ifdef __NetBSD__ - phys = vtophys(DRM_NETBSD_HANDLE2ADDR(offset)); +#ifndef __NetBSD__ + phys = vtophys(offset); break; #endif case _DRM_SCATTER_GATHER: +#ifndef __NetBSD__ phys = vtophys(offset); +#else + phys = vtophys(roffset); +#endif break; default: DRM_ERROR("bad map type %d\n", type); @@ -149,8 +154,9 @@ #if defined(__FreeBSD__) && __FreeBSD_version >= 500102 *paddr = phys; return 0; -#else -#if defined(__NetBSD__) && defined(macppc) +#elif defined(__NetBSD__) + /*DRM_DEBUG("going to return phys %lx\n", phys);*/ +#if defined(macppc) return phys; #else return atop(phys);
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Mon Mar 30 01:48:31 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_fops.c Log Message: XXX: drm_close_pid() went away, and the hack i tried to avoid it XXX: ended up looping forever. replace it with a hack that doesn't XXX: hang the system. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c:1.2 src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c:1.3 --- src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c:1.2 Sat Jul 19 06:18:23 2008 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_fops.c Mon Mar 30 01:48:31 2009 @@ -54,12 +54,14 @@ * NetBSD only calls drm_close once, so this frees * resources earlier. */ +#if 0 /* drm_close_pid() went away. argh */ if (pfind(priv->pid) == NULL) { -/*drm_close_pid(dev, priv, priv->pid);*/ +drm_close_pid(dev, priv, priv->pid); restart = 1; break; } else +#endif if (priv->pid == pid && priv->uid == uid) return priv; }
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Mon Mar 30 01:47:36 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_drv.c Log Message: - set dev->device to the device_t - fix a DEBUG message - apply from sys/dev: revision 1.20 date: 2009/01/18 10:04:35; author: mrg; state: Exp; lines: +6 -2 Don't attempt to unload a DRM device that's in use. (Note: Unloading doesn't work right in any case -- it doesn't clean up the sysctl tree, among other things. This code needs Work, but at least this prevents it crashing randomly due to autounload while X is running.) Also, fix the dependency list for radeondrm. contributed anonymously. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.10 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.11 --- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.10 Mon Jul 21 07:18:11 2008 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Mon Mar 30 01:47:36 2009 @@ -395,6 +395,7 @@ return; dev = drm_units[unit] = device_private(kdev); + dev->device = kdev; dev->unit = unit; for (unit = 0; unit < DRM_MAX_PCI_RESOURCE; unit++) { @@ -434,9 +435,13 @@ int drm_detach(struct device *self, int flags) { - drm_device_t *dev = (drm_device_t*)self; + drm_device_t *dev = device_private(self); - drm_unload((struct drm_device *)self); + /* XXX locking */ + if (dev->open_count) + return EBUSY; + + drm_unload(dev); drm_units[dev->unit] = NULL; return 0; } @@ -903,7 +908,10 @@ #ifdef __FreeBSD__ DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", DRM_CURRENTPID, (long)dev->device, dev->open_count ); -#elif defined(__NetBSD__) || defined(__OpenBSD__) +#elif defined(__NetBSD__) + DRM_DEBUG( "pid = %d, device = 0x%p, open_count = %d\n", + DRM_CURRENTPID, dev->device, dev->open_count); +#elif defined(__OpenBSD__) DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", DRM_CURRENTPID, (long)&dev->device, dev->open_count); #endif
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Mon Mar 30 01:45:42 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_bufs.c Log Message: apply from sys/dev: revision 1.11 date: 2009/03/29 19:50:17; author: mrg; state: Exp; lines: +9 -6 drm_addmap(): - for _DRM_CONSISTENT mappings, keep the handle. - use DRM_HANDLE_NEEDS_MASK() drm_mapbufs(): - use DRM_HANDLE_NEEDS_MASK() drm_mmap(): - use DRM_HANDLE_NEEDS_MASK() - for _DRM_SCATTER_GATHER and _DRM_SHM, use vtophys() on the adjusted offset. XXX this is gets radeon working on amd64 with an older PCI 9250 card. XXX: need to excise vtophys() usage. XXX: need to finish porting these fixes to external. however, this doesn't get radeon working on amd64 here :( To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.2 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.3 --- src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.2 Sat Jul 19 06:18:23 2008 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Mon Mar 30 01:45:41 2009 @@ -249,6 +249,7 @@ return EINVAL; } map->offset = map->offset + dev->sg->handle; + map->handle = (void *)(uintptr_t)map->offset; break; case _DRM_CONSISTENT: /* Unfortunately, we don't get any alignment specification from @@ -317,12 +318,13 @@ request->mtrr = map->mtrr; request->handle = map->handle; - if (request->type != _DRM_SHM) { - request->handle = (void *)request->offset; #ifdef __NetBSD__ - } else { + if (DRM_HANDLE_NEEDS_MASK(request->type)) { request->handle = (void *)DRM_NETBSD_ADDR2HANDLE((uintptr_t)map->handle); + } else #endif + { + request->handle = (void *)request->offset; } return 0; @@ -1109,6 +,10 @@ } size = round_page(map->size); foff = map->offset; +#ifdef __NetBSD__ + if (DRM_HANDLE_NEEDS_MASK(map->type)) + foff = DRM_NETBSD_ADDR2HANDLE(foff); +#endif } else { size = round_page(dma->byte_count), foff = 0; @@ -1129,7 +1135,7 @@ vaddr = curlwp->l_proc->p_emul->e_vm_default_addr(curlwp->l_proc, (vaddr_t)vms->vm_daddr, size); rsize = round_page(size); - DRM_DEBUG("mmap %lx/%ld\n", vaddr, rsize); + DRM_DEBUG("mmap %#lx/%#lx foff %#llx\n", vaddr, rsize, (long long)foff); retcode = uvm_mmap(&vms->vm_map, &vaddr, rsize, UVM_PROT_READ | UVM_PROT_WRITE, UVM_PROT_ALL, MAP_SHARED, &vn->v_uobj, foff, curproc->p_rlimit[RLIMIT_MEMLOCK].rlim_cur);
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Mon Mar 30 01:44:41 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_pci.c Log Message: - apply from sys/dev: revision 1.14 date: 2009/03/29 19:39:10; author: mrg; state: Exp; lines: +4 -3 include the size in a falled allocation message. - use BUS_DMA_ALLOCNOW in bus_dmamap_create() call - remove a redundant check for NULL To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.4 src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.5 --- src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c:1.4 Fri Jul 25 06:54:33 2008 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c Mon Mar 30 01:44:41 2009 @@ -111,7 +111,8 @@ if ((ret = bus_dmamem_alloc(dmah->tag, size, align, maxaddr, dmah->segs, 1, &nsegs, BUS_DMA_NOWAIT)) != 0) { - printf("drm: Unable to allocate DMA, error %d\n", ret); + printf("drm: Unable to allocate %ld bytes of DMA, error %d\n", + (long)size, ret); goto fail; } /* XXX is there a better way to deal with this? */ @@ -125,7 +126,7 @@ goto free; } if ((ret = bus_dmamap_create(dmah->tag, size, 1, size, maxaddr, - BUS_DMA_NOWAIT, &dmah->map)) != 0) { + BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &dmah->map)) != 0) { printf("drm: Unable to create DMA map, error %d\n", ret); goto unmap; } @@ -166,8 +167,6 @@ bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); #elif defined(__NetBSD__) - if (dmah == NULL) - return; bus_dmamap_unload(dmah->tag, dmah->map); bus_dmamap_destroy(dmah->tag, dmah->map); bus_dmamem_unmap(dmah->tag, dmah->vaddr, dmah->size);
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Mon Mar 30 01:42:20 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drmP.h Log Message: - apply from sys/dev: revision 1.33 date: 2009/03/29 17:00:50; author: mrg; state: Exp; lines: +12 -4 add a comment explaining DRM_NETBSD_ADDR2HANDLE/DRM_NETBSD_HANDLE2ADDR: * This hack strips the top bit from amd64 addresses, which avoid * udv_attach() returning NULL for "negative" offset. * A better hack would be to encode the offset of some kernel data * structure.. add a new DRM_HANDLE_NEEDS_MASK macro to check whether the above need to be applied for various mapping types (_DRM_SHM and _DRM_SCATTER_GATHER.) also: - use IPL_VM for now - use a lot of bus_space - struct drm_device now has a pointer to the device_t To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm/dist/bsd-core/drmP.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drmP.h diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.9 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.10 --- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.9 Fri Jul 25 06:54:33 2008 +++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h Mon Mar 30 01:42:20 2009 @@ -108,7 +108,6 @@ #include #include #include -#include #include #include #include @@ -246,7 +245,7 @@ #define DRM_CDEVPROC_REAL(l) (l)->l_proc #define DRM_IOCTL_DATA void * #define DRM_SPINTYPE kmutex_t -#define DRM_SPININIT(l,name) mutex_init(l, MUTEX_DEFAULT, IPL_NONE) +#define DRM_SPININIT(l,name) mutex_init(l, MUTEX_DEFAULT, /*IPL_NONE*/ IPL_VM) #define DRM_SPINUNINIT(l) mutex_destroy(l) #define DRM_SPINLOCK(l) mutex_enter(l) #define DRM_SPINUNLOCK(u) mutex_exit(u) @@ -329,11 +328,13 @@ #define DRM_MTRR_WC MTRR_TYPE_WC #define jiffies hardclock_ticks #ifdef __x86_64__ -#define DRM_NETBSD_ADDR2HANDLE(v) ((vaddr_t)(v) - vm_map_min(kernel_map)) -#define DRM_NETBSD_HANDLE2ADDR(u) ((vaddr_t)(u) + vm_map_min(kernel_map)) +#define DRM_NETBSD_ADDR2HANDLE(addr) ((addr) & 0x7fff) +#define DRM_NETBSD_HANDLE2ADDR(handle) ((handle) | 0x8000) +#define DRM_HANDLE_NEEDS_MASK(type) ((type) == _DRM_SHM || (type) == _DRM_SCATTER_GATHER) #else #define DRM_NETBSD_ADDR2HANDLE(addr) (addr) #define DRM_NETBSD_HANDLE2ADDR(handle) (handle) +#define DRM_HANDLE_NEEDS_MASK(type) 0 #endif #elif defined(__OpenBSD__) #define DRM_SUSER(p) (suser(p->p_ucred, &p->p_acflag) == 0) @@ -402,6 +403,7 @@ "lock; addl $0,0(%%rsp)" : : : "memory"); #endif +#ifdef __FreeBSD__ #define DRM_READ8(map, offset) \ *(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset)) #define DRM_READ16(map, offset) \ @@ -415,15 +417,30 @@ #define DRM_WRITE32(map, offset, val) \ *(volatile u_int32_t *)(((unsigned long)(map)->handle) + (offset)) = val -#ifdef __FreeBSD__ #define DRM_VERIFYAREA_READ( uaddr, size ) \ (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ)) -#else + +#else /* __FreeBSD__ */ + typedef vaddr_t vm_offset_t; + +#define DRM_READ8(map, offset) \ + bus_space_read_1( (map)->bst, (map)->bsh, (offset)) +#define DRM_READ16(map, offset) \ + bus_space_read_2( (map)->bst, (map)->bsh, (offset)) +#define DRM_READ32(map, offset) \ + bus_space_read_4( (map)->bst, (map)->bsh, (offset)) +#define DRM_WRITE8(map, offset, val) \ + bus_space_write_1((map)->bst, (map)->bsh, (offset), (val)) +#define DRM_WRITE16(map, offset, val) \ + bus_space_write_2((map)->bst, (map)->bsh, (offset), (val)) +#define DRM_WRITE32(map, offset, val) \ + bus_space_write_4((map)->bst, (map)->bsh, (offset), (val)) + #define DRM_VERIFYAREA_READ( uaddr, size ) \ (!uvm_map_checkprot(&(curproc->p_vmspace->vm_map), \ (vaddr_t)uaddr, (vaddr_t)uaddr+size, UVM_PROT_READ)) -#endif +#endif /* !__FreeBSD__ */ #define DRM_COPY_TO_USER(user, kern, size) \ copyout(kern, user, size) @@ -826,7 +843,9 @@ * DRM device functions structure */ struct drm_device { -#if defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) + struct device *device; +#elif defined(__OpenBSD__) struct device device; /* softc is an extension of struct device */ #endif
CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Module Name:src Committed By: mrg Date: Sun Mar 29 23:46:34 UTC 2009 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_irq.c Log Message: fix a device_t-ification. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.7 src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.8 --- src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.7 Tue Jul 29 23:44:42 2008 +++ src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c Sun Mar 29 23:46:34 2009 @@ -279,7 +279,7 @@ } #endif #ifdef __NetBSD__ - aprint_normal_dev(&dev->device, "interrupting at %s\n", istr); + aprint_normal_dev(dev->device, "interrupting at %s\n", istr); #endif /* After installing handler */