summaryrefslogtreecommitdiff
path: root/bsd-core/drm_vm.c
AgeCommit message (Expand)Author
2007-08-15BSD: Replace brief description in each file's first line with doxygen later on.Eric Anholt
2007-07-20Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.Eric Anholt
2007-07-20Remove DRM_ERR OS macro.Eric Anholt
2005-11-15Fix Savage DRI without ShadowStatus NO by allowing the shadow area to beEric Anholt
2005-08-26[1] Fix BSD DRM for the nonroot changes. [2] Don't attempt to acquire theEric Anholt
2005-04-16Use /*- to begin license blocks in BSD code to reduce diffs against FreeBSDEric Anholt
2005-02-13Fix bad copy'n'pastage of copyrights -- don't disclaim anything for VAEric Anholt
2005-02-07Remove some annoying trailing whitespace.Eric Anholt
2005-02-05- Implement drm_initmap, and extend it with the resource number to helpEric Anholt
2004-11-07Refine the locking of the DRM. Most significant is covering the driverEric Anholt
2004-11-06Commit first pieces of port to OpenBSD, done by Martin Lexa (martin atEric Anholt
2004-11-06Commit WIP of BSD conversion to core model. Compiles for r128, radeon, butEric Anholt
2004-07-06MFC as of 20040705: dev_t -> struct cdev * change.Eric Anholt
2004-05-11Merge from FreeBSD-current. Mostly 64-bit cleanliness fixes, but a fewEric Anholt
2003-10-22- Add DRM_GET_PRIV_WITH_RETURN macro. This can be used in shared code toEric Anholt
2003-10-19- SMPng lock the DRM. This is only partial -- there are a few code pathsEric Anholt
2003-10-02Add an MIT-style copyright, assigned to myself, to these files. I thinkEric Anholt
2003-08-19- Remove $FreeBSD$ tags as they weren't too useful and merges are now beingEric Anholt
2003-04-25Merge from FreeBSD-current.Eric Anholt
2003-04-01Whitespace and remove a dead commented line.Eric Anholt
2003-03-11Merge back from FreeBSD-current, adding FreeBSD ID tags to aid futureEric Anholt
2003-03-05Update mmap handling for FreeBSD-current (Based on r1.3 of FreeBSD CVS).Eric Anholt
2003-02-21Merge from bsd-4-0-0-branch.Eric Anholt
2002-07-05merged bsd-3-0-0-branchAlan Hourihane
2002-01-27Import of XFree86 4.2.0David Dawes
tomic_add_int(p, 1) #define atomic_dec(p) atomic_subtract_int(p, 1) #define atomic_add(n, p) atomic_add_int(p, n) #define atomic_sub(n, p) atomic_subtract_int(p, n) #else /* __FreeBSD__ */ /* FIXME */ #define atomic_set(p, v) (*(p) = (v)) #define atomic_read(p) (*(p)) #define atomic_inc(p) (*(p) += 1) #define atomic_dec(p) (*(p) -= 1) #define atomic_add(n, p) (*(p) += (n)) #define atomic_sub(n, p) (*(p) -= (n)) /* FIXME */ #define atomic_add_int(p, v) *(p) += v #define atomic_subtract_int(p, v) *(p) -= v #define atomic_set_int(p, bits) *(p) |= (bits) #define atomic_clear_int(p, bits) *(p) &= ~(bits) #endif /* !__FreeBSD__ */ #if !defined(__FreeBSD_version) || (__FreeBSD_version < 500000) #if defined(__i386__) /* The extra atomic functions from 5.0 haven't been merged to 4.x */ static __inline int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) { int res = exp; __asm __volatile ( " lock ; " " cmpxchgl %1,%2 ; " " setz %%al ; " " movzbl %%al,%0 ; " "1: " "# atomic_cmpset_int" : "+a" (res) /* 0 (result) */ : "r" (src), /* 1 */ "m" (*(dst)) /* 2 */ : "memory"); return (res); } #else /* __i386__ */ static __inline int atomic_cmpset_int(__volatile__ int *dst, int old, int new) { int s = splhigh(); if (*dst==old) { *dst = new; splx(s); return 1; } splx(s); return 0; } #endif /* !__i386__ */ #endif /* !__FreeBSD_version || __FreeBSD_version < 500000 */ static __inline atomic_t test_and_set_bit(int b, volatile void *p) { int s = splhigh(); unsigned int m = 1<<b; unsigned int r = *(volatile int *)p & m; *(volatile int *)p |= m; splx(s); return r; } static __inline void clear_bit(int b, volatile void *p) { atomic_clear_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f)); } static __inline void set_bit(int b, volatile void *p) { atomic_set_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f)); } static __inline int test_bit(int b, volatile void *p) { return ((volatile int *)p)[b >> 5] & (1 << (b & 0x1f)); } static __inline int find_first_zero_bit(volatile void *p, int max) { int b; volatile int *ptr = (volatile int *)p; for (b = 0; b < max; b += 32) { if (ptr[b >> 5] != ~0) { for (;;) { if ((ptr[b >> 5] & (1 << (b & 0x1f))) == 0) return b; b++; } } } return max; }