CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Fri Mar 7 15:39:18 UTC 2014 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: completion.h Log Message: Fix return value of wait_for_completion_interruptible_timeout. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \ src/sys/external/bsd/drm2/include/linux/completion.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/drm2/include/linux/completion.h diff -u src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.5 src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.5 Sun Sep 8 16:01:49 2013 +++ src/sys/external/bsd/drm2/include/linux/completion.h Fri Mar 7 15:39:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: completion.h,v 1.1.2.5 2013/09/08 16:01:49 riastradh Exp $ */ +/* $NetBSD: completion.h,v 1.1.2.6 2014/03/07 15:39:18 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,6 +38,8 @@ #include +#include + struct completion { kmutex_t c_lock; kcondvar_t c_cv; @@ -152,17 +154,25 @@ static inline int wait_for_completion_interruptible_timeout(struct completion *completion, unsigned long ticks) { + /* XXX Arithmetic overflow...? */ + unsigned int start = hardclock_ticks, now; int error; mutex_enter(&completion->c_lock); /* Wait until c_done is nonzero. */ while (completion->c_done == 0) { - /* XXX errno NetBSD->Linux */ - error = -cv_timedwait_sig(&completion->c_cv, + error = cv_timedwait_sig(&completion->c_cv, &completion->c_lock, ticks); if (error) goto out; + now = hardclock_ticks; + if (ticks < (now - start)) { + error = EWOULDBLOCK; + goto out; + } + ticks -= (now - start); + start = now; } /* Claim a completion if it's not open season. */ @@ -175,7 +185,14 @@ wait_for_completion_interruptible_timeou error = 0; out: mutex_exit(&completion->c_lock); - return error; + if (error == EWOULDBLOCK) { + return 0; + } else if ((error == EINTR) || (error == ERESTART)) { + return -ERESTARTSYS; + } else { + KASSERTMSG((error == 0), "error = %d", error); + return ticks; + } } #endif /* _LINUX_COMPLETION_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Wed Mar 5 15:08:00 UTC 2014 Modified Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: intel-gtt.h Log Message: Oops -- define struct intel_gtt::do_idle_maps. Missed this in last commit. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/drm/intel-gtt.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/drm2/include/drm/intel-gtt.h diff -u src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.2 src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.2 Sun Sep 8 15:40:17 2013 +++ src/sys/external/bsd/drm2/include/drm/intel-gtt.h Wed Mar 5 15:08:00 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: intel-gtt.h,v 1.1.2.2 2013/09/08 15:40:17 riastradh Exp $ */ +/* $NetBSD: intel-gtt.h,v 1.1.2.3 2014/03/05 15:08:00 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -48,6 +48,7 @@ struct intel_gtt { bus_dma_segment_t gtt_scratch_seg; bus_dmamap_t gtt_scratch_map; bus_space_handle_t gtt_bsh; + bool do_idle_maps; }; struct intel_gtt *
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Tue Jan 21 20:49:20 UTC 2014 Modified Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: drm_copy_netbsd.h Log Message: Fix order of arguments in DRM_COPY_TO_USER. ... To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/drm/drm_copy_netbsd.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/drm2/include/drm/drm_copy_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_copy_netbsd.h:1.1.2.3 src/sys/external/bsd/drm2/include/drm/drm_copy_netbsd.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/drm/drm_copy_netbsd.h:1.1.2.3 Wed Jul 24 02:04:16 2013 +++ src/sys/external/bsd/drm2/include/drm/drm_copy_netbsd.h Tue Jan 21 20:49:20 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_copy_netbsd.h,v 1.1.2.3 2013/07/24 02:04:16 riastradh Exp $ */ +/* $NetBSD: drm_copy_netbsd.h,v 1.1.2.4 2014/01/21 20:49:20 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ DRM_COPY_FROM_USER(void *kernel_addr, co } static inline int -DRM_COPY_TO_USER(const void *kernel_addr, void *user_addr, size_t len) +DRM_COPY_TO_USER(void *user_addr, const void *kernel_addr, size_t len) { /* XXX errno NetBSD->Linux */ return -copyout(kernel_addr, user_addr, len);
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Tue Jan 21 20:49:29 UTC 2014 Modified Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: drm_mem_util.h Log Message: Just use kcalloc in drm_malloc_ab. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/drm/drm_mem_util.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/drm2/include/drm/drm_mem_util.h diff -u src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.2 src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.2 Sun Sep 8 15:47:17 2013 +++ src/sys/external/bsd/drm2/include/drm/drm_mem_util.h Tue Jan 21 20:49:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_mem_util.h,v 1.1.2.2 2013/09/08 15:47:17 riastradh Exp $ */ +/* $NetBSD: drm_mem_util.h,v 1.1.2.3 2014/01/21 20:49:29 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -43,10 +43,7 @@ drm_calloc_large(size_t n, size_t size) static inline void * drm_malloc_ab(size_t n, size_t size) { - if (size > (SIZE_MAX / n)) - return NULL; - - return kmalloc((n * size), GFP_KERNEL); + return kcalloc(n, size, GFP_KERNEL); } static inline void
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Jan 21 20:49:10 UTC 2014 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: slab.h Log Message: Make Linux kmalloc handle a few more gfp flags. To generate a diff of this commit: cvs rdiff -u -r1.1.2.9 -r1.1.2.10 \ src/sys/external/bsd/drm2/include/linux/slab.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/drm2/include/linux/slab.h diff -u src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.9 src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.10 --- src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.9 Mon Dec 30 04:51:24 2013 +++ src/sys/external/bsd/drm2/include/linux/slab.h Tue Jan 21 20:49:10 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: slab.h,v 1.1.2.9 2013/12/30 04:51:24 riastradh Exp $ */ +/* $NetBSD: slab.h,v 1.1.2.10 2014/01/21 20:49:10 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -47,16 +47,34 @@ linux_gfp_to_malloc(gfp_t gfp) { int flags = 0; - /* XXX Handle other cases as they arise. */ - KASSERT((gfp == GFP_ATOMIC) || (gfp == GFP_KERNEL)); + /* This has no meaning to us. */ + gfp &= ~__GFP_NOWARN; - if (ISSET(gfp, __GFP_WAIT)) - flags |= M_WAITOK; - else - flags |= M_NOWAIT; + /* Pretend this was the same as not passing __GFP_WAIT. */ + if (ISSET(gfp, __GFP_NORETRY)) { + gfp &= ~__GFP_NORETRY; + gfp &= ~__GFP_WAIT; + } - if (ISSET(gfp, __GFP_ZERO)) + if (ISSET(gfp, __GFP_ZERO)) { flags |= M_ZERO; + gfp &= ~__GFP_ZERO; + } + + /* + * XXX Handle other cases as they arise -- prefer to fail early + * rather than allocate memory without respecting parameters we + * don't understand. + */ + KASSERT((gfp == GFP_ATOMIC) || + ((gfp & ~__GFP_WAIT) == (GFP_KERNEL & ~__GFP_WAIT))); + + if (ISSET(gfp, __GFP_WAIT)) { + flags |= M_WAITOK; + gfp &= ~__GFP_WAIT; + } else { + flags |= M_NOWAIT; + } return flags; }
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jan 15 21:25:49 UTC 2014 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: ktime.h Log Message: Initialize the nsec correctly in ktime_get. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/linux/ktime.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/drm2/include/linux/ktime.h diff -u src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.3 Wed Jan 15 21:25:39 2014 +++ src/sys/external/bsd/drm2/include/linux/ktime.h Wed Jan 15 21:25:49 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ktime.h,v 1.1.2.3 2014/01/15 21:25:39 riastradh Exp $ */ +/* $NetBSD: ktime.h,v 1.1.2.4 2014/01/15 21:25:49 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -137,7 +137,7 @@ ktime_get(void) /* XXX Silently truncate? */ kt.kt_sec_nsec.ktsn_sec = ts.tv_sec & 0xUL; - kt.kt_sec_nsec.ktsn_sec = ts.tv_nsec; + kt.kt_sec_nsec.ktsn_nsec = ts.tv_nsec; return kt; }
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jan 15 21:25:39 UTC 2014 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: ktime.h Log Message: Use nanouptime, not nanotime, for ktime_get. As far as I can tell, ktime_get is supposed to provide monotonic time, not a clock synchronized to TAI. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/ktime.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/drm2/include/linux/ktime.h diff -u src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.2 Wed Jul 24 02:31:08 2013 +++ src/sys/external/bsd/drm2/include/linux/ktime.h Wed Jan 15 21:25:39 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ktime.h,v 1.1.2.2 2013/07/24 02:31:08 riastradh Exp $ */ +/* $NetBSD: ktime.h,v 1.1.2.3 2014/01/15 21:25:39 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ ktime_get(void) ktime_t kt; /* XXX nanotime or nanouptime? */ - nanotime(&ts); + nanouptime(&ts); /* XXX Silently truncate? */ kt.kt_sec_nsec.ktsn_sec = ts.tv_sec & 0xUL;
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Dec 30 04:51:24 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: slab.h Log Message: Avoid dividing by zero when allocating empty array in kcalloc. To generate a diff of this commit: cvs rdiff -u -r1.1.2.8 -r1.1.2.9 \ src/sys/external/bsd/drm2/include/linux/slab.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/drm2/include/linux/slab.h diff -u src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.8 src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.9 --- src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.8 Wed Jul 24 04:01:51 2013 +++ src/sys/external/bsd/drm2/include/linux/slab.h Mon Dec 30 04:51:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: slab.h,v 1.1.2.8 2013/07/24 04:01:51 riastradh Exp $ */ +/* $NetBSD: slab.h,v 1.1.2.9 2013/12/30 04:51:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -76,7 +76,8 @@ kzalloc(size_t size, gfp_t gfp) static inline void * kcalloc(size_t n, size_t size, gfp_t gfp) { - KASSERT(size <= (SIZE_MAX / n)); + KASSERT(size != 0); + KASSERT(n <= (SIZE_MAX / size)); return malloc((n * size), M_TEMP, (linux_gfp_to_malloc(gfp) | M_ZERO)); }
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:40:36 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h Log Message: Rework Linux `work' to use NetBSD workqueues, not callouts. Callers expect to be able to allocate in the workers, which callouts don't allow. Delayed work uses callouts only to delay enqueueing work. Linux `workqueues' are still stubs. To generate a diff of this commit: cvs rdiff -u -r1.1.2.9 -r1.1.2.10 \ src/sys/external/bsd/drm2/include/linux/workqueue.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/drm2/include/linux/workqueue.h diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.9 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.10 --- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.9 Sun Sep 8 15:58:24 2013 +++ src/sys/external/bsd/drm2/include/linux/workqueue.h Sun Sep 8 16:40:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: workqueue.h,v 1.1.2.9 2013/09/08 15:58:24 riastradh Exp $ */ +/* $NetBSD: workqueue.h,v 1.1.2.10 2013/09/08 16:40:36 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -33,81 +33,220 @@ #define _LINUX_WORKQUEUE_H_ #include +#include +#include +#include #include #include /* - * XXX This implementation is a load of bollocks -- callouts are - * expedient, but wrong, if for no reason other than that we never call - * callout_destroy. + * XXX This implementation is a load of bollocks -- callouts and + * workqueues are expedient, but wrong, if for no reason other than + * that there is no destroy operation. + * + * XXX The amount of code in here is absurd; it should be given a + * proper source file. */ struct work_struct { - struct callout ws_callout; + void (*w_fn)(struct work_struct *); + struct workqueue *w_wq; + struct work w_wk; + kmutex_t w_lock; + kcondvar_t w_cv; + enum { + WORK_IDLE, + WORK_QUEUED, + WORK_CANCELLED, + WORK_INFLIGHT, + WORK_REQUEUED, + } w_state; }; -struct delayed_work { - struct work_struct work; -}; +static void __unused +linux_work_fn(struct work *wk __unused, void *arg) +{ + struct work_struct *const work = arg; + + mutex_spin_enter(&work->w_lock); + switch (work->w_state) { + case WORK_IDLE: + panic("work ran while idle: %p", work); + break; + + case WORK_QUEUED: + work->w_state = WORK_INFLIGHT; + mutex_spin_exit(&work->w_lock); + (*work->w_fn)(work); + mutex_spin_enter(&work->w_lock); + switch (work->w_state) { + case WORK_IDLE: + case WORK_QUEUED: + panic("work hosed while in flight: %p", work); + break; + + case WORK_INFLIGHT: + case WORK_CANCELLED: + work->w_state = WORK_IDLE; + cv_broadcast(&work->w_cv); + break; + + case WORK_REQUEUED: + workqueue_enqueue(work->w_wq, &work->w_wk, NULL); + work->w_state = WORK_QUEUED; + break; + + default: + panic("work %p in bad state: %d", work, + (int)work->w_state); + break; + } + break; + + case WORK_CANCELLED: + work->w_state = WORK_IDLE; + cv_broadcast(&work->w_cv); + break; + + case WORK_INFLIGHT: + panic("work already in flight: %p", work); + break; + + case WORK_REQUEUED: + panic("work requeued while not in flight: %p", work); + break; + + default: + panic("work %p in bad state: %d", work, (int)work->w_state); + break; + } + mutex_spin_exit(&work->w_lock); +} static inline void INIT_WORK(struct work_struct *work, void (*fn)(struct work_struct *)) { + int error; - callout_init(&work->ws_callout, 0); - - /* XXX This cast business is sketchy. */ - callout_setfunc(&work->ws_callout, (void (*)(void *))fn, work); + work->w_fn = fn; + error = workqueue_create(&work->w_wq, "lnxworkq", &linux_work_fn, + work, PRI_NONE, IPL_VM, WQ_MPSAFE); + if (error) + panic("workqueue creation failed: %d", error); /* XXX */ + + mutex_init(&work->w_lock, MUTEX_DEFAULT, IPL_VM); + cv_init(&work->w_cv, "linxwork"); + work->w_state = WORK_IDLE; } static inline void -INIT_DELAYED_WORK(struct delayed_work *dw, void (*fn)(struct work_struct *)) +schedule_work(struct work_struct *work) { - INIT_WORK(&dw->work, fn); + + mutex_spin_enter(&work->w_lock); + switch (work->w_state) { + case WORK_IDLE: + workqueue_enqueue(work->w_wq, &work->w_wk, NULL); + work->w_state = WORK_QUEUED; + break; + + case WORK_CANCELLED: + break; + + case WORK_INFLIGHT: + work->w_state = WORK_REQUEUED; + break; + + case WORK_QUEUED: + case WORK_REQUEUED: + break; + + default: + panic("work %p in bad state: %d", work, (int)work->w_state); + break; + } + mutex_spin_exit(&work->w_lock); } -static inline struct delayed_work * -to_delayed_work(struct work_struct *work) +/* + * XXX This API can't possibly be right because there is no interlock. + */ +static inline bool +cancel_work_sync(struct work_struct *work) { - return container_of(work, struct delayed_work, work); + bool was_pending
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:35:20 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: drm_wait_netbsd.h Log Message: Fix DRM_WAIT_UNTIL to initialize (RET) on every exit. To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.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/drm2/include/drm/drm_wait_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.7 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.8 --- src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.7 Sun Sep 8 16:02:50 2013 +++ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h Sun Sep 8 16:35:20 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_wait_netbsd.h,v 1.1.2.7 2013/09/08 16:02:50 riastradh Exp $ */ +/* $NetBSD: drm_wait_netbsd.h,v 1.1.2.8 2013/09/08 16:35:20 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -102,7 +102,11 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, #define DRM_WAIT_UNTIL(RET, Q, INTERLOCK, CONDITION) do \ { \ KASSERT(mutex_is_locked((INTERLOCK)));\ - while (!(CONDITION)) { \ + for (;;) { \ + if (CONDITION) { \ + (RET) = 0; \ + break; \ + } \ /* XXX errno NetBSD->Linux */\ (RET) = -cv_wait_sig((Q), &(INTERLOCK)->mtx_lock); \ if (RET) \
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:32:37 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: device.h kernel.h notifier.h printk.h sysrq.h Log Message: Miscellaneous Linux header file crud. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/linux/device.h cvs rdiff -u -r1.1.2.21 -r1.1.2.22 \ src/sys/external/bsd/drm2/include/linux/kernel.h cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/notifier.h \ src/sys/external/bsd/drm2/include/linux/sysrq.h cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \ src/sys/external/bsd/drm2/include/linux/printk.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/drm2/include/linux/device.h diff -u src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.4 Wed Jul 24 03:26:18 2013 +++ src/sys/external/bsd/drm2/include/linux/device.h Sun Sep 8 16:32:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.1.2.4 2013/07/24 03:26:18 riastradh Exp $ */ +/* $NetBSD: device.h,v 1.1.2.5 2013/09/08 16:32:37 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,6 +38,9 @@ #define dev_err(DEV, FMT, ...) \ device_printf((DEV), "error: " FMT, ##__VA_ARGS__) +#define dev_info(DEV, FMT, ...) \ + device_printf((DEV), "info: " FMT, ##__VA_ARGS__) + #define dev_warn(DEV, FMT, ...) \ device_printf((DEV), "warning: " FMT, ##__VA_ARGS__) Index: src/sys/external/bsd/drm2/include/linux/kernel.h diff -u src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.21 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.22 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.21 Sun Sep 8 15:58:24 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Sun Sep 8 16:32:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.21 2013/09/08 15:58:24 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.22 2013/09/08 16:32:37 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -109,4 +109,6 @@ abs64(int64_t x) return (x < 0? (-x) : x); } +static int panic_timeout __unused = 0; + #endif /* _LINUX_KERNEL_H_ */ Index: src/sys/external/bsd/drm2/include/linux/notifier.h diff -u src/sys/external/bsd/drm2/include/linux/notifier.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/notifier.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/notifier.h:1.1.2.1 Wed Jul 24 03:49:42 2013 +++ src/sys/external/bsd/drm2/include/linux/notifier.h Sun Sep 8 16:32:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: notifier.h,v 1.1.2.1 2013/07/24 03:49:42 riastradh Exp $ */ +/* $NetBSD: notifier.h,v 1.1.2.2 2013/09/08 16:32:37 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,11 +32,31 @@ #ifndef _LINUX_NOTIFIER_H_ #define _LINUX_NOTIFIER_H_ +#include + +#define NOTIFY_OK 0 + struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); }; -#define NOTIFY_OK 0 +struct atomic_notifier_head { + char anh_blahdittyblahblah; +}; + +static struct atomic_notifier_head panic_notifier_list __unused; + +static inline void +atomic_notifier_chain_register(struct atomic_notifier_head *head __unused, +struct notifier_block *block __unused) +{ +} + +static inline void +atomic_notifier_chain_unregister(struct atomic_notifier_head *head __unused, +struct notifier_block *block __unused) +{ +} #endif /* _LINUX_NOTIFIER_H_ */ Index: src/sys/external/bsd/drm2/include/linux/sysrq.h diff -u src/sys/external/bsd/drm2/include/linux/sysrq.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/sysrq.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/sysrq.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/sysrq.h Sun Sep 8 16:32:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sysrq.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: sysrq.h,v 1.1.2.2 2013/09/08 16:32:37 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,18 @@ #ifndef _LINUX_SYSRQ_H_ #define _LINUX_SYSRQ_H_ +struct sysrq_key_op { + char sko_blahdittyblahblah; +}; + +static inline void +register_sysrq_key(char key __unused, struct sysrq_key_op *op __unused) +{ +} + +static inline void +unregister_sysrq_key(char key __unused, struct sysrq_key_op *op __unused) +{ +} + #endif /* _LINUX_SYSRQ_H_ */ Index: src/sys/external/bsd/drm2/include/linux/printk.h diff -u src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.5 src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.5 Wed Jul 24 03:50:45 2013 +++ src/sys/external/bsd/drm2/include/linux/printk.h Sun Sep 8 16:32:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD:
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:31:14 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: spinlock.h Log Message: Create Linux spin locks at IPL_VM for now. To generate a diff of this commit: cvs rdiff -u -r1.1.2.8 -r1.1.2.9 \ src/sys/external/bsd/drm2/include/linux/spinlock.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/drm2/include/linux/spinlock.h diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.8 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.9 --- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.8 Wed Jul 24 04:01:05 2013 +++ src/sys/external/bsd/drm2/include/linux/spinlock.h Sun Sep 8 16:31:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: spinlock.h,v 1.1.2.8 2013/07/24 04:01:05 riastradh Exp $ */ +/* $NetBSD: spinlock.h,v 1.1.2.9 2013/09/08 16:31:14 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -85,8 +85,8 @@ spin_unlock_irqrestore(spinlock_t *spinl static inline void spin_lock_init(spinlock_t *spinlock) { - /* XXX Need to identify which need to block intrs. */ - mutex_init(&spinlock->sl_lock, MUTEX_DEFAULT, IPL_NONE); + /* XXX What's the right IPL? IPL_DRM...? */ + mutex_init(&spinlock->sl_lock, MUTEX_DEFAULT, IPL_VM); } /*
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:19:15 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: io-mapping.h Log Message: Just use bus_space_map for io-mapping, and limit to one at a time. Reserving the whole region interferes with other parts of the driver which want to map it in different ways. It also horrifically wastes space when actually mapped, because there's no way to map a subregion of a reservation. And the bus_space_reservation API is x86-only at the moment. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/io-mapping.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/drm2/include/linux/io-mapping.h diff -u src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.2 Wed Jul 24 03:17:48 2013 +++ src/sys/external/bsd/drm2/include/linux/io-mapping.h Sun Sep 8 16:19:15 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: io-mapping.h,v 1.1.2.2 2013/07/24 03:17:48 riastradh Exp $ */ +/* $NetBSD: io-mapping.h,v 1.1.2.3 2013/09/08 16:19:15 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,19 +36,13 @@ #include #include -/* - * XXX This uses NetBSD bus space reservations, which are currently - * implemented only for x86. - */ - struct io_mapping { bus_space_tag_t diom_bst; bus_addr_t diom_addr; - bus_addr_t diom_size; + bus_size_t diom_size; int diom_flags; - bus_space_reservation_t diom_bsr; - bool diom_mapped; bus_space_handle_t diom_bsh; + void *diom_vaddr; }; static inline struct io_mapping * @@ -63,13 +57,15 @@ bus_space_io_mapping_create_wc(bus_space mapping->diom_flags = 0; mapping->diom_flags |= BUS_SPACE_MAP_LINEAR; mapping->diom_flags |= BUS_SPACE_MAP_PREFETCHABLE; - mapping->diom_mapped = false; + mapping->diom_vaddr = NULL; - if (bus_space_reserve(mapping->diom_bst, addr, size, - mapping->diom_flags, &mapping->diom_bsr)) { + bus_space_handle_t bsh; + if (bus_space_map(mapping->diom_bst, addr, PAGE_SIZE, + mapping->diom_flags, &bsh)) { kmem_free(mapping, sizeof(*mapping)); return NULL; } + bus_space_unmap(mapping->diom_bst, bsh, PAGE_SIZE); return mapping; } @@ -78,8 +74,7 @@ static inline void io_mapping_free(struct io_mapping *mapping) { - KASSERT(!mapping->diom_mapped); - bus_space_release(mapping->diom_bst, &mapping->diom_bsr); + KASSERT(mapping->diom_vaddr == NULL); kmem_free(mapping, sizeof(*mapping)); } @@ -87,25 +82,24 @@ static inline void * io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) { - KASSERT(!mapping->diom_mapped); + KASSERT(mapping->diom_vaddr == NULL); KASSERT(ISSET(mapping->diom_flags, BUS_SPACE_MAP_LINEAR)); - if (bus_space_reservation_map(mapping->diom_bst, &mapping->diom_bsr, - mapping->diom_flags, &mapping->diom_bsh)) + if (bus_space_map(mapping->diom_bst, (mapping->diom_addr + offset), + PAGE_SIZE, mapping->diom_flags, &mapping->diom_bsh)) panic("Unable to make I/O mapping!"); /* XXX */ - mapping->diom_mapped = true; + mapping->diom_vaddr = bus_space_vaddr(mapping->diom_bst, + mapping->diom_bsh); - return (char *)bus_space_vaddr(mapping->diom_bst, mapping->diom_bsh) - + offset; /* XXX arithmetic overflow */ + return mapping->diom_vaddr; } static inline void io_mapping_unmap(struct io_mapping *mapping, void *vaddr __unused) { - KASSERT(mapping->diom_mapped); - bus_space_reservation_unmap(mapping->diom_bst, mapping->diom_bsh, - mapping->diom_size); - mapping->diom_mapped = false; + KASSERT(mapping->diom_vaddr == vaddr); + bus_space_unmap(mapping->diom_bst, mapping->diom_bsh, PAGE_SIZE); + mapping->diom_vaddr = NULL; } static inline void *
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:17:58 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: highmem.h Log Message: linux_ namespace for kmap and kunmap. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/linux/highmem.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/drm2/include/linux/highmem.h diff -u src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.4 Sun Sep 8 16:16:37 2013 +++ src/sys/external/bsd/drm2/include/linux/highmem.h Sun Sep 8 16:17:58 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: highmem.h,v 1.1.2.4 2013/09/08 16:16:37 riastradh Exp $ */ +/* $NetBSD: highmem.h,v 1.1.2.5 2013/09/08 16:17:58 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ /* XXX Make the nm output a little more greppable... */ #define kmap_atomic linux_kmap_atomic #define kunmap_atomic linux_kunmap_atomic +#define kmap linux_kmap +#define kunmap linux_kunmap int linux_kmap_init(void); void linux_kmap_fini(void);
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:07:29 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: atomic.h Log Message: Add Linux ATOMIC_INIT, atomic_inc_return, and atomic_dec_return. To generate a diff of this commit: cvs rdiff -u -r1.1.2.10 -r1.1.2.11 \ src/sys/external/bsd/drm2/include/linux/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/drm2/include/linux/atomic.h diff -u src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.10 src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.11 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.10 Sun Sep 8 15:37:04 2013 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Sun Sep 8 16:07:29 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.1.2.10 2013/09/08 15:37:04 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.1.2.11 2013/09/08 16:07:29 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ struct atomic { } a_u; }; +#define ATOMIC_INIT(i) { .a_u = { .au_int = (i) } } + typedef struct atomic atomic_t; static inline int @@ -88,6 +90,18 @@ atomic_dec(atomic_t *atomic) } static inline int +atomic_inc_return(atomic_t *atomic) +{ + return (int)atomic_inc_uint_nv(&atomic->a_u.au_uint); +} + +static inline int +atomic_dec_return(atomic_t *atomic) +{ + return (int)atomic_dec_uint_nv(&atomic->a_u.au_uint); +} + +static inline int atomic_dec_and_test(atomic_t *atomic) { return (-1 == (int)atomic_dec_uint_nv(&atomic->a_u.au_uint));
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:00:50 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: completion.h Log Message: Implement destroy_completion in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/linux/completion.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/drm2/include/linux/completion.h diff -u src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.3 Wed Jul 24 03:29:43 2013 +++ src/sys/external/bsd/drm2/include/linux/completion.h Sun Sep 8 16:00:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: completion.h,v 1.1.2.3 2013/07/24 03:29:43 riastradh Exp $ */ +/* $NetBSD: completion.h,v 1.1.2.4 2013/09/08 16:00:50 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -71,6 +71,16 @@ init_completion(struct completion *compl } /* + * Destroy a completion object. + */ +static inline void +destroy_completion(struct completion *completion) +{ + KASSERT(!cv_has_waiters(&completion->c_cv)); + cv_destroy(&completion->c_cv); +} + +/* * Notify one waiter of completion, but not any future ones. */ static inline void
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:02:51 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: drm_wait_netbsd.h Log Message: Fix result of DRM_TIMED_WAIT_UNTIL. This has to return a positive number of ticks left if we haven't timed out in order to match the semantics of Linux waitqueues. This also fixes the amount of time for timeout if we ever wait for more than one iteration. Now we can actually wait for results from the ring buffers! To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 \ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.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/drm2/include/drm/drm_wait_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.6 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.7 --- src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.6 Wed Jul 24 03:08:03 2013 +++ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h Sun Sep 8 16:02:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_wait_netbsd.h,v 1.1.2.6 2013/07/24 03:08:03 riastradh Exp $ */ +/* $NetBSD: drm_wait_netbsd.h,v 1.1.2.7 2013/09/08 16:02:50 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -112,13 +112,28 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, #define DRM_TIMED_WAIT_UNTIL(RET, Q, INTERLOCK, TICKS, CONDITION) do \ { \ + extern int hardclock_ticks; \ + const int _dtwu_start = hardclock_ticks; \ + int _dtwu_ticks = (TICKS); \ KASSERT(mutex_is_locked((INTERLOCK)));\ - while (!(CONDITION)) { \ + for (;;) { \ + if (CONDITION) { \ + (RET) = _dtwu_ticks;\ + break; \ + } \ /* XXX errno NetBSD->Linux */\ (RET) = -cv_timedwait_sig((Q), &(INTERLOCK)->mtx_lock, \ - (TICKS)); \ + _dtwu_ticks); \ if (RET) \ break; \ + const int _dtwu_now = hardclock_ticks; \ + KASSERT(_dtwu_start <= _dtwu_now); \ + if ((_dtwu_now - _dtwu_start) < _dtwu_ticks) { \ + _dtwu_ticks -= (_dtwu_now - _dtwu_start); \ + } else { \ + (RET) = 0; \ + break; \ + } \ }\ } while (0) @@ -136,13 +151,28 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, #define DRM_SPIN_TIMED_WAIT_UNTIL(RET, Q, INTERLOCK, TICKS, CONDITION) \ do\ { \ + extern int hardclock_ticks; \ + const int _dstwu_start = hardclock_ticks; \ + int _dstwu_ticks = (TICKS); \ KASSERT(spin_is_locked((INTERLOCK)));\ - while (!(CONDITION)) { \ + for (;;) { \ + if (CONDITION) { \ + (RET) = _dstwu_ticks;\ + break; \ + } \ /* XXX errno NetBSD->Linux */\ (RET) = -cv_timedwait_sig((Q), &(INTERLOCK)->sl_lock, \ - (TICKS)); \ + _dstwu_ticks); \ if (RET) \ break; \ + const int _dstwu_now = hardclock_ticks; \ + KASSERT(_dstwu_start <= _dstwu_now); \ + if ((_dstwu_now - _dstwu_start) < _dstwu_ticks) { \ + _dstwu_ticks -= (_dstwu_now - _dstwu_start); \ + } else { \ + (RET) = 0; \ + break; \ + } \ }\ } while (0)
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 16:01:49 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: completion.h Log Message: Destroy the mutex too in destroy_completion. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/linux/completion.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/drm2/include/linux/completion.h diff -u src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.4 Sun Sep 8 16:00:50 2013 +++ src/sys/external/bsd/drm2/include/linux/completion.h Sun Sep 8 16:01:49 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: completion.h,v 1.1.2.4 2013/09/08 16:00:50 riastradh Exp $ */ +/* $NetBSD: completion.h,v 1.1.2.5 2013/09/08 16:01:49 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -78,6 +78,7 @@ destroy_completion(struct completion *co { KASSERT(!cv_has_waiters(&completion->c_cv)); cv_destroy(&completion->c_cv); + mutex_destroy(&completion->c_lock); } /*
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:58:24 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: jiffies.h kernel.h kgdb.h workqueue.h Log Message: Buncha new cruft for . To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/linux/jiffies.h cvs rdiff -u -r1.1.2.20 -r1.1.2.21 \ src/sys/external/bsd/drm2/include/linux/kernel.h cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/kgdb.h cvs rdiff -u -r1.1.2.8 -r1.1.2.9 \ src/sys/external/bsd/drm2/include/linux/workqueue.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/drm2/include/linux/jiffies.h diff -u src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.4 Sun Sep 8 15:38:04 2013 +++ src/sys/external/bsd/drm2/include/linux/jiffies.h Sun Sep 8 15:58:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: jiffies.h,v 1.1.2.4 2013/09/08 15:38:04 riastradh Exp $ */ +/* $NetBSD: jiffies.h,v 1.1.2.5 2013/09/08 15:58:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -44,6 +44,12 @@ msecs_to_jiffies(unsigned int msec) } static inline unsigned int +jiffies_to_msecs(unsigned int j) +{ + return hztoms(j); +} + +static inline unsigned int usecs_to_jiffies(unsigned int usec) { return mstohz((usec + (1000 / hz) - 1) / (1000 / hz)); Index: src/sys/external/bsd/drm2/include/linux/kernel.h diff -u src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.20 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.21 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.20 Wed Jul 24 03:45:24 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Sun Sep 8 15:58:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.20 2013/07/24 03:45:24 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.21 2013/09/08 15:58:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -51,6 +51,13 @@ #define min_t(T, X, Y) MIN(X, Y) /* + * Rounding to nearest. + */ +#define DIV_ROUND_CLOSEST(N, D) \ + ((0 < (N)) ? (((N) + ((D) / 2)) / (D))\ + : (((N) - ((D) / 2)) / (D))) + +/* * Rounding to what may or may not be powers of two. */ #define DIV_ROUND_UP(X, N) (((X) + (N) - 1) / (N)) Index: src/sys/external/bsd/drm2/include/linux/kgdb.h diff -u src/sys/external/bsd/drm2/include/linux/kgdb.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/kgdb.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/kgdb.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/kgdb.h Sun Sep 8 15:58:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kgdb.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: kgdb.h,v 1.1.2.2 2013/09/08 15:58:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,26 @@ #ifndef _LINUX_KGDB_H_ #define _LINUX_KGDB_H_ +#if 0/* XXX */ +#include "opt_ddb.h" +#else +#define DDB +#endif + +#ifdef DDB +extern int db_active; + +static inline bool +in_dbg_master(void) +{ + return db_active; +} +#else +static inline bool +in_dbg_master(void) +{ + return false; +} +#endif + #endif /* _LINUX_KGDB_H_ */ Index: src/sys/external/bsd/drm2/include/linux/workqueue.h diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.8 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.9 --- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.8 Sun Sep 8 15:39:05 2013 +++ src/sys/external/bsd/drm2/include/linux/workqueue.h Sun Sep 8 15:58:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: workqueue.h,v 1.1.2.8 2013/09/08 15:39:05 riastradh Exp $ */ +/* $NetBSD: workqueue.h,v 1.1.2.9 2013/09/08 15:58:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -86,16 +86,28 @@ schedule_delayed_work(struct delayed_wor callout_schedule(&dw->work.ws_callout, (int)ticks); } -static inline void +static inline bool +cancel_work(struct work_struct *work) +{ + return !callout_stop(&work->ws_callout); +} + +static inline bool cancel_work_sync(struct work_struct *work) { - callout_halt(&work->ws_callout, NULL); + return !callout_halt(&work->ws_callout, NULL); } -static inline void +static inline bool +cancel_delayed_work(struct delayed_work *dw) +{ + return cancel_work(&dw->work); +} + +static inline bool cancel_delayed_work_sync(struct delayed_work *dw) { - cancel_work_sync(&dw->work); + return cancel_work_sync(&dw->work); } /*
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:47:17 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: drm_mem_util.h Log Message: Simplify drm_mem_util.h; fix source compatibility for drm_free_large. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/drm/drm_mem_util.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/drm2/include/drm/drm_mem_util.h diff -u src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.1 src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.1 Wed Jul 24 01:56:19 2013 +++ src/sys/external/bsd/drm2/include/drm/drm_mem_util.h Sun Sep 8 15:47:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_mem_util.h,v 1.1.2.1 2013/07/24 01:56:19 riastradh Exp $ */ +/* $NetBSD: drm_mem_util.h,v 1.1.2.2 2013/09/08 15:47:17 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,53 +32,27 @@ #ifndef _DRM_MEM_UTIL_H_ #define _DRM_MEM_UTIL_H_ -#include -#include -#include +#include static inline void * drm_calloc_large(size_t n, size_t size) { - -#if 1 - KASSERT(size != 0); /* XXX Let's see whether this ever happens. */ -#else - if (size == 0) - return NULL; /* XXX OK? */ -#endif - - if (n > (SIZE_MAX / size)) - return NULL; - - return kmem_zalloc((n * size), KM_SLEEP); + return kcalloc(n, size, GFP_KERNEL); } static inline void * drm_malloc_ab(size_t n, size_t size) { + if (size > (SIZE_MAX / n)) + return NULL; -#if 1 - KASSERT(size != 0); /* XXX Let's see whether this ever happens. */ -#else - if (size == 0) - return NULL; /* XXX OK? */ -#endif - - return kmem_alloc((n * size), KM_SLEEP); + return kmalloc((n * size), GFP_KERNEL); } static inline void -drm_free_large(void *ptr, size_t n, size_t size) +drm_free_large(void *ptr) { - -#if 0/* XXX */ - if (ptr != NULL) -#endif - { - KASSERT(size != 0); - KASSERT(n <= (SIZE_MAX / size)); - kmem_free(ptr, (n * size)); - } + kfree(ptr); } #endif /* _DRM_MEM_UTIL_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:39:48 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: bus_dma_hacks.h Log Message: Implement a bus_dmamem_wire_uvm_object hack. This is fit only for x86 at the moment -- it parrots the x86 bus_dmamem_alloc code but with uvm_obj_wirepages instead of uvm_pglistalloc. XXX THIS IS A MEGA-KLUDGE THAT NEEDS TO BE DONE PROPERLY. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 \ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.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/drm2/include/drm/bus_dma_hacks.h diff -u /dev/null src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.1.2.1 --- /dev/null Sun Sep 8 15:39:48 2013 +++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Sun Sep 8 15:39:48 2013 @@ -0,0 +1,110 @@ +/* $NetBSD: bus_dma_hacks.h,v 1.1.2.1 2013/09/08 15:39:48 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _DRM_BUS_DMA_HACKS_H_ +#define _DRM_BUS_DMA_HACKS_H_ + +#include +#include + +#include +#include + +/* XXX This is x86-specific bollocks. */ + +static inline int +bus_dmamem_wire_uvm_object(bus_dma_tag_t tag, struct uvm_object *uobj, +off_t start, bus_size_t size, struct pglist *pages, bus_size_t alignment, +bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, +int flags) +{ + struct pglist pageq; + struct vm_page *page; + bus_addr_t prev_addr, addr; + unsigned int i; + int error; + + KASSERT(size <= __type_max(off_t)); + KASSERT(start <= (__type_max(off_t) - size)); + KASSERT(alignment == PAGE_SIZE); /* XXX */ + KASSERT(0 < nsegs); + + if (pages == NULL) { + TAILQ_INIT(&pageq); + pages = &pageq; + } + + error = uvm_obj_wirepages(uobj, start, (start + size), pages); + if (error) + goto fail0; + + page = TAILQ_FIRST(pages); + KASSERT(page != NULL); + + addr = VM_PAGE_TO_PHYS(page); + segs[0].ds_addr = addr; + segs[0].ds_len = PAGE_SIZE; + + i = 0; + while ((page = TAILQ_NEXT(page, pageq.queue)) != NULL) { + prev_addr = addr; + addr = VM_PAGE_TO_PHYS(page); + if ((addr == (prev_addr + PAGE_SIZE)) && + ((addr & boundary) == (prev_addr & boundary))) { + segs[i].ds_len += PAGE_SIZE; + } else { + i += 1; + if (i >= nsegs) { +error = EFBIG; +goto fail1; + } + segs[i].ds_addr = addr; + segs[i].ds_len = PAGE_SIZE; + } + } + + /* Success! */ + *rsegs = (i + 1); + return 0; + +fail1: uvm_obj_unwirepages(uobj, start, (start + size)); +fail0: return error; +} + +static inline void +bus_dmamem_unwire_uvm_object(bus_dma_tag_t tag __unused, +struct uvm_object *uobj, off_t start, bus_size_t size, +bus_dma_segment_t *segs __unused, int nsegs __unused) +{ + uvm_obj_unwirepages(uobj, start, (start + size)); +} + +#endif /* _DRM_BUS_DMA_HACKS_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:40:17 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: intel-gtt.h Log Message: Rework Intel GTT abstraction to use bus_dma. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/drm/intel-gtt.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/drm2/include/drm/intel-gtt.h diff -u src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.1 src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.1 Wed Jul 24 03:49:20 2013 +++ src/sys/external/bsd/drm2/include/drm/intel-gtt.h Sun Sep 8 15:40:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: intel-gtt.h,v 1.1.2.1 2013/07/24 03:49:20 riastradh Exp $ */ +/* $NetBSD: intel-gtt.h,v 1.1.2.2 2013/09/08 15:40:17 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,16 +32,22 @@ #ifndef _DRM_INTEL_GTT_H_ #define _DRM_INTEL_GTT_H_ +#include + +#include "drm/bus_dma_hacks.h" + +#include + +#include + struct intel_gtt { - unsigned int stolen_size; - unsigned int gtt_total_entries; - unsigned int gtt_mappable_entries; - bool needs_dmar; - bool do_idle_maps; - bus_addr_t scratch_page_dma; - struct vm_page *scratch_page; /* XXX Sensible? */ - bus_size_t gtt; - paddr_t gma_bus_addr; + paddr_t gma_bus_addr; + unsigned int stolen_size; + unsigned int gtt_total_entries; + unsigned int gtt_mappable_entries; + bus_dma_segment_t gtt_scratch_seg; + bus_dmamap_t gtt_scratch_map; + bus_space_handle_t gtt_bsh; }; struct intel_gtt *
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:38:35 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: mm.h Log Message: Fix definition of Linux PAGE_ALIGN in . Can't use uvm round_page because that depends on PAGE_MASK, whose sense we have to invert for Linux! Plurgh. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/external/bsd/drm2/include/linux/mm.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/drm2/include/linux/mm.h diff -u src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.4 Wed Jul 24 03:58:04 2013 +++ src/sys/external/bsd/drm2/include/linux/mm.h Sun Sep 8 15:38:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mm.h,v 1.1.2.4 2013/07/24 03:58:04 riastradh Exp $ */ +/* $NetBSD: mm.h,v 1.1.2.5 2013/09/08 15:38:35 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -40,12 +40,13 @@ #include -#define PAGE_ALIGN(x) round_page(x) - /* XXX Ugh bletch! Whattakludge! Linux's sense is reversed... */ #undef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE-1)) +#define PAGE_ALIGN(x) (((x) + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1)) +#define offset_in_page(x) ((x) & (PAGE_SIZE-1)) + /* * ### * ### XXX THIS NEEDS SERIOUS SCRUTINY XXX ###
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:39:05 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h Log Message: Rename delayed_work::dw_work to delayed_work::work for Linux source. To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \ src/sys/external/bsd/drm2/include/linux/workqueue.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/drm2/include/linux/workqueue.h diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.7 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.8 --- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.7 Wed Jul 24 03:59:06 2013 +++ src/sys/external/bsd/drm2/include/linux/workqueue.h Sun Sep 8 15:39:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: workqueue.h,v 1.1.2.7 2013/07/24 03:59:06 riastradh Exp $ */ +/* $NetBSD: workqueue.h,v 1.1.2.8 2013/09/08 15:39:05 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ struct work_struct { }; struct delayed_work { - struct work_struct dw_work; + struct work_struct work; }; static inline void @@ -64,13 +64,13 @@ INIT_WORK(struct work_struct *work, void static inline void INIT_DELAYED_WORK(struct delayed_work *dw, void (*fn)(struct work_struct *)) { - INIT_WORK(&dw->dw_work, fn); + INIT_WORK(&dw->work, fn); } static inline struct delayed_work * to_delayed_work(struct work_struct *work) { - return container_of(work, struct delayed_work, dw_work); + return container_of(work, struct delayed_work, work); } static inline void @@ -83,7 +83,7 @@ static inline void schedule_delayed_work(struct delayed_work *dw, unsigned long ticks) { KASSERT(ticks < INT_MAX); - callout_schedule(&dw->dw_work.ws_callout, (int)ticks); + callout_schedule(&dw->work.ws_callout, (int)ticks); } static inline void @@ -95,7 +95,7 @@ cancel_work_sync(struct work_struct *wor static inline void cancel_delayed_work_sync(struct delayed_work *dw) { - cancel_work_sync(&dw->dw_work); + cancel_work_sync(&dw->work); } /*
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:38:05 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: jiffies.h log2.h pagemap.h time.h timer.h types.h Log Message: More miscellaneous Linux header cruft. See patch for details. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/linux/jiffies.h \ src/sys/external/bsd/drm2/include/linux/timer.h cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/log2.h cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/pagemap.h \ src/sys/external/bsd/drm2/include/linux/time.h cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \ src/sys/external/bsd/drm2/include/linux/types.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/drm2/include/linux/jiffies.h diff -u src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.3 Wed Jul 24 03:03:23 2013 +++ src/sys/external/bsd/drm2/include/linux/jiffies.h Sun Sep 8 15:38:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: jiffies.h,v 1.1.2.3 2013/07/24 03:03:23 riastradh Exp $ */ +/* $NetBSD: jiffies.h,v 1.1.2.4 2013/09/08 15:38:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -49,6 +49,12 @@ usecs_to_jiffies(unsigned int usec) return mstohz((usec + (1000 / hz) - 1) / (1000 / hz)); } +static inline unsigned int +timespec_to_jiffies(const struct timespec *ts) +{ + return tstohz(ts); +} + /* XXX long is the wrong type here times... */ #define __linux_time_compare(A, OP, B) (((long)(A) - (long)(B)) OP 0) Index: src/sys/external/bsd/drm2/include/linux/timer.h diff -u src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.3 Wed Jul 24 03:50:16 2013 +++ src/sys/external/bsd/drm2/include/linux/timer.h Sun Sep 8 15:38:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.h,v 1.1.2.3 2013/07/24 03:50:16 riastradh Exp $ */ +/* $NetBSD: timer.h,v 1.1.2.4 2013/09/08 15:38:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -78,4 +78,10 @@ round_jiffies_up(unsigned long j) return roundup(j, hz); } +static inline unsigned long +round_jiffies_up_relative(unsigned long j) +{ + return roundup(j, hz); +} + #endif /* _LINUX_TIMER_H_ */ Index: src/sys/external/bsd/drm2/include/linux/log2.h diff -u src/sys/external/bsd/drm2/include/linux/log2.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/log2.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/log2.h:1.1.2.2 Wed Jul 24 02:03:00 2013 +++ src/sys/external/bsd/drm2/include/linux/log2.h Sun Sep 8 15:38:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: log2.h,v 1.1.2.2 2013/07/24 02:03:00 riastradh Exp $ */ +/* $NetBSD: log2.h,v 1.1.2.3 2013/09/08 15:38:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,4 +34,10 @@ #include +static inline bool +is_power_of_2(unsigned long x) +{ + return ((x != 0) && (((x - 1) & x) == 0)); +} + #endif /* _LINUX_LOG2_H_ */ Index: src/sys/external/bsd/drm2/include/linux/pagemap.h diff -u src/sys/external/bsd/drm2/include/linux/pagemap.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/pagemap.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/pagemap.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/pagemap.h Sun Sep 8 15:38:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pagemap.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: pagemap.h,v 1.1.2.2 2013/09/08 15:38:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,16 @@ #ifndef _LINUX_PAGEMAP_H_ #define _LINUX_PAGEMAP_H_ +static inline int +fault_in_multipages_readable(const char *uaddr __unused, size_t len __unused) +{ + return 0; +} + +static inline int +fault_in_multipages_writeable(char *uaddr __unused, size_t len __unused) +{ + return 0; +} + #endif /* _LINUX_PAGEMAP_H_ */ Index: src/sys/external/bsd/drm2/include/linux/time.h diff -u src/sys/external/bsd/drm2/include/linux/time.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/time.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/time.h:1.1.2.1 Wed Jul 24 03:18:46 2013 +++ src/sys/external/bsd/drm2/include/linux/time.h Sun Sep 8 15:38:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: time.h,v 1.1.2.1 2013/07/24 03:18:46 riastradh Exp $ */ +/* $NetBSD: time.h,v 1.1.2.2 2013/09/08 15:38:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -48,4 +48,66 @@ get_seconds(void) return time_second; } +static inline void +getrawmonotonic(struct timespec *ts) +{ + getnanouptime(ts); +} + +static inline bool +timespec_valid(const struct timespec *ts) +{ +
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:37:34 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: bitops.h Log Message: Add Linuxoid non-atomic __set/clear_bit to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/bitops.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/drm2/include/linux/bitops.h diff -u src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.2 Wed Jul 24 03:44:39 2013 +++ src/sys/external/bsd/drm2/include/linux/bitops.h Sun Sep 8 15:37:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bitops.h,v 1.1.2.2 2013/07/24 03:44:39 riastradh Exp $ */ +/* $NetBSD: bitops.h,v 1.1.2.3 2013/09/08 15:37:34 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,6 +32,13 @@ #ifndef _LINUX_BITOPS_H_ #define _LINUX_BITOPS_H_ +#include +#include +#include +#include + +#include + #include static inline unsigned int @@ -40,4 +47,45 @@ hweight16(uint16_t n) return popcount32(n); } +/* + * XXX Don't define BITS_PER_LONG as sizeof(unsigned long)*CHAR_BIT + * because that won't work in preprocessor conditionals, where it often + * turns up. + */ + +#define BITS_TO_LONGS(n) \ + roundup2((n), (sizeof(unsigned long) * CHAR_BIT)) + +static inline int +test_bit(unsigned int n, const volatile unsigned long *p) +{ + const unsigned units = (sizeof(unsigned long) * CHAR_BIT); + + return ((p[n / units] & (1UL << (n % units))) != 0); +} + +static inline void +__set_bit(unsigned int n, volatile unsigned long *p) +{ + const unsigned units = (sizeof(unsigned long) * CHAR_BIT); + + p[n / units] |= (1UL << (n % units)); +} + +static inline void +__clear_bit(unsigned int n, volatile unsigned long *p) +{ + const unsigned units = (sizeof(unsigned long) * CHAR_BIT); + + p[n / units] &= ~(1UL << (n % units)); +} + +static inline void +__change_bit(unsigned int n, volatile unsigned long *p) +{ + const unsigned units = (sizeof(unsigned long) * CHAR_BIT); + + p[n / units] ^= (1UL << (n % units)); +} + #endif /* _LINUX_BITOPS_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:37:04 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: atomic.h Log Message: Fix Linux atomic set/clear/change_bit to work on arrays. To generate a diff of this commit: cvs rdiff -u -r1.1.2.9 -r1.1.2.10 \ src/sys/external/bsd/drm2/include/linux/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/drm2/include/linux/atomic.h diff -u src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.9 src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.10 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.9 Wed Jul 24 03:35:50 2013 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Sun Sep 8 15:37:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.1.2.9 2013/07/24 03:35:50 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.1.2.10 2013/09/08 15:37:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,6 +34,8 @@ #include +#include + struct atomic { union { int au_int; @@ -125,53 +127,69 @@ atomic_inc_not_zero(atomic_t *atomic) } static inline void -set_bit(unsigned long bit, volatile unsigned long *ptr) +set_bit(unsigned int bit, volatile unsigned long *ptr) { - atomic_or_ulong(ptr, (1 << bit)); + const unsigned int units = (sizeof(*ptr) * CHAR_BIT); + + atomic_or_ulong(&ptr[bit / units], (1UL << (bit % units))); } static inline void -clear_bit(unsigned long bit, volatile unsigned long *ptr) +clear_bit(unsigned int bit, volatile unsigned long *ptr) { - atomic_and_ulong(ptr, ~(1 << bit)); + const unsigned int units = (sizeof(*ptr) * CHAR_BIT); + + atomic_and_ulong(&ptr[bit / units], ~(1UL << (bit % units))); } static inline void -change_bit(unsigned long bit, volatile unsigned long *ptr) +change_bit(unsigned int bit, volatile unsigned long *ptr) { + const unsigned int units = (sizeof(*ptr) * CHAR_BIT); + volatile unsigned long *const p = &ptr[bit / units]; + const unsigned long mask = (1UL << (bit % units)); unsigned long v; - do v = *ptr; while (atomic_cas_ulong(ptr, v, v ^ (1 << bit)) != v); + do v = *p; while (atomic_cas_ulong(p, v, (v ^ mask)) != v); } static inline unsigned long -test_and_set_bit(unsigned long bit, volatile unsigned long *ptr) +test_and_set_bit(unsigned int bit, volatile unsigned long *ptr) { + const unsigned int units = (sizeof(*ptr) * CHAR_BIT); + volatile unsigned long *const p = &ptr[bit / units]; + const unsigned long mask = (1UL << (bit % units)); unsigned long v; - do v = *ptr; while (atomic_cas_ulong(ptr, v, v | (1 << bit)) != v); + do v = *p; while (atomic_cas_ulong(p, v, (v | mask)) != v); - return (v & (1 << bit)); + return (v & mask); } static inline unsigned long -test_and_clear_bit(unsigned long bit, volatile unsigned long *ptr) +test_and_clear_bit(unsigned int bit, volatile unsigned long *ptr) { + const unsigned int units = (sizeof(*ptr) * CHAR_BIT); + volatile unsigned long *const p = &ptr[bit / units]; + const unsigned long mask = (1UL << (bit % units)); unsigned long v; - do v = *ptr; while (atomic_cas_ulong(ptr, v, v &~ (1 << bit)) != v); + do v = *p; while (atomic_cas_ulong(p, v, (v & ~mask)) != v); - return (v & (1 << bit)); + return (v & mask); } static inline unsigned long -test_and_change_bit(unsigned long bit, volatile unsigned long *ptr) +test_and_change_bit(unsigned int bit, volatile unsigned long *ptr) { + const unsigned int units = (sizeof(*ptr) * CHAR_BIT); + volatile unsigned long *const p = &ptr[bit / units]; + const unsigned long mask = (1UL << (bit % units)); unsigned long v; - do v = *ptr; while (atomic_cas_ulong(ptr, v, v ^ (1 << bit)) != v); + do v = *p; while (atomic_cas_ulong(p, v, (v ^ mask)) != v); - return (v & (1 << bit)); + return (v & mask); } #if defined(MULTIPROCESSOR) && !defined(__HAVE_ATOMIC_AS_MEMBAR)
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:36:35 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: errno.h Log Message: Add ERESTARTSYS as a Linuxoid alias for ERESTART. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/errno.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/drm2/include/linux/errno.h diff -u src/sys/external/bsd/drm2/include/linux/errno.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/errno.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/errno.h:1.1.2.2 Wed Jul 24 01:57:50 2013 +++ src/sys/external/bsd/drm2/include/linux/errno.h Sun Sep 8 15:36:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: errno.h,v 1.1.2.2 2013/07/24 01:57:50 riastradh Exp $ */ +/* $NetBSD: errno.h,v 1.1.2.3 2013/09/08 15:36:35 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,4 +34,6 @@ #include +#define ERESTARTSYS ERESTART + #endif /* _LINUX_ERRNO_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:36:05 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include [riastradh-drm2]: i915_trace.h Log Message: Add trace_i915_gem_object_unbind. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/i915_trace.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/drm2/include/i915_trace.h diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.4 src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.4 Wed Jul 24 03:29:14 2013 +++ src/sys/external/bsd/drm2/include/i915_trace.h Sun Sep 8 15:36:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_trace.h,v 1.1.2.4 2013/07/24 03:29:14 riastradh Exp $ */ +/* $NetBSD: i915_trace.h,v 1.1.2.5 2013/09/08 15:36:05 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -105,6 +105,11 @@ trace_i915_gem_object_pwrite(struct drm_ } static inline void +trace_i915_gem_object_unbind(struct drm_i915_gem_object *obj __unused) +{ +} + +static inline void trace_i915_gem_request_add(struct intel_ring_buffer *ring __unused, uint32_t seqno __unused) {
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:35:36 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: uaccess.h Log Message: Add some copy_to/from_user variants to Linux . To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/asm/uaccess.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/drm2/include/asm/uaccess.h diff -u src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.4 src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.4 Wed Jul 24 02:12:14 2013 +++ src/sys/external/bsd/drm2/include/asm/uaccess.h Sun Sep 8 15:35:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: uaccess.h,v 1.1.2.4 2013/07/24 02:12:14 riastradh Exp $ */ +/* $NetBSD: uaccess.h,v 1.1.2.5 2013/09/08 15:35:36 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,6 +35,19 @@ #include #include +/* XXX This is a cop-out. */ +#define VERIFY_READ 0 +#define VERIFY_WRITE 1 +static inline bool +access_ok(int verify_op __unused, const void *uaddr __unused, +size_t nbytes __unused) +{ + return true; +} + +#define __copy_from_user copy_from_user +#define __copy_to_user copy_to_user + static inline int copy_from_user(void *kernel_addr, const void *user_addr, size_t len) { @@ -55,4 +68,33 @@ copy_to_user(void *user_addr, const void #define put_user(KERNEL_LOC, USER_ADDR) \ copy_to_user((USER_ADDR), &(KERNEL_LOC), sizeof(KERNEL_LOC)) +#if 0 +/* + * XXX These `inatomic' versions are a cop out, but they should do for + * now -- they are used only in fast paths which can't fault but which + * can fall back to slower paths that arrange things so faulting is OK. + */ + +static inline int +__copy_from_user_inatomic(void *kernel_addr __unused, +const void *user_addr __unused, size_t len __unused) +{ + return -EFAULT; +} + +static inline int +__copy_to_user_inatomic(void *user_addr __unused, +const void *kernel_addr __unused, size_t len __unused) +{ + return -EFAULT; +} +#endif /* 0 */ + +static inline int +__copy_from_user_inatomic_nocache(void *kernel_addr __unused, +const void *user_addr __unused, size_t len __unused) +{ + return -EFAULT; +} + #endif /* _ASM_UACCESS_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:35:06 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: io.h Log Message: Define page_to_phys in Linux . To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/include/asm/io.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/drm2/include/asm/io.h diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.3 src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.3 Wed Jul 24 03:44:10 2013 +++ src/sys/external/bsd/drm2/include/asm/io.h Sun Sep 8 15:35:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: io.h,v 1.1.2.3 2013/07/24 03:44:10 riastradh Exp $ */ +/* $NetBSD: io.h,v 1.1.2.4 2013/09/08 15:35:06 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,6 +32,12 @@ #ifndef _ASM_IO_H_ #define _ASM_IO_H_ +#include + +#include + +#include + /* * XXX This is bollocks, and is wrong on various architectures (should * work for x86; who knows what else), but bus_space_barrier won't work @@ -43,4 +49,16 @@ #define memcpy_toio memcpy #define memset_io memset +/* + * XXX Not sure why this is here, but so it is in Linux... Also, not + * sure what the right type is: Linux uses dma_addr_t, but I don't + * think bus_addr_t is right here -- paddr_t sounds more appropriate. + */ + +static inline bus_addr_t +page_to_phys(struct page *page) +{ + return VM_PAGE_TO_PHYS(&page->p_vmp); +} + #endif /* _ASM_IO_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Sep 8 15:33:35 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kref.h Log Message: Fix sense of atomic_cas loop condition and use kassertmsg for krefs. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/kref.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/drm2/include/linux/kref.h diff -u src/sys/external/bsd/drm2/include/linux/kref.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/kref.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/kref.h:1.1.2.2 Wed Jul 24 01:51:36 2013 +++ src/sys/external/bsd/drm2/include/linux/kref.h Sun Sep 8 15:33:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kref.h,v 1.1.2.2 2013/07/24 01:51:36 riastradh Exp $ */ +/* $NetBSD: kref.h,v 1.1.2.3 2013/09/08 15:33:35 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ kref_get(struct kref *kref) const unsigned int count __unused = atomic_inc_uint_nv(&kref->kr_count); - KASSERT(count > 1); + KASSERTMSG((count > 1), "getting released kref"); } static inline int @@ -64,9 +64,10 @@ kref_sub(struct kref *kref, unsigned int do { old = kref->kr_count; - KASSERT(count <= old); + KASSERTMSG((count <= old), "overreleasing kref: %u - %u", + old, count); new = (old - count); - } while (atomic_cas_uint(&kref->kr_count, old, new) == old); + } while (atomic_cas_uint(&kref->kr_count, old, new) != old); if (new == 0) { (*release)(kref);
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 04:04:30 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: delay.h Log Message: Use mdelay for msleep of less than one tick. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \ src/sys/external/bsd/drm2/include/linux/delay.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/drm2/include/linux/delay.h diff -u src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.5 src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.5 Wed Jul 24 03:44:54 2013 +++ src/sys/external/bsd/drm2/include/linux/delay.h Wed Jul 24 04:04:30 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: delay.h,v 1.1.2.5 2013/07/24 03:44:54 riastradh Exp $ */ +/* $NetBSD: delay.h,v 1.1.2.6 2013/07/24 04:04:30 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -47,12 +47,6 @@ udelay(unsigned int usec) } static inline void -msleep(unsigned int msec) -{ - (void)kpause("lnxmslep", false, mstohz(msec), NULL); -} - -static inline void mdelay(unsigned int msec) { @@ -63,4 +57,13 @@ mdelay(unsigned int msec) udelay(1000); } +static inline void +msleep(unsigned int msec) +{ + if ((hz < 1000) && (msec < (1000/hz))) + mdelay(msec); + else + (void)kpause("lnxmslep", false, mstohz(msec), NULL); +} + #endif /* _LINUX_DELAY_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 04:01:51 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: slab.h Log Message: Allow kfree(NULL). To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \ src/sys/external/bsd/drm2/include/linux/slab.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/drm2/include/linux/slab.h diff -u src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.7 src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.8 --- src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.7 Wed Jul 24 04:00:19 2013 +++ src/sys/external/bsd/drm2/include/linux/slab.h Wed Jul 24 04:01:51 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: slab.h,v 1.1.2.7 2013/07/24 04:00:19 riastradh Exp $ */ +/* $NetBSD: slab.h,v 1.1.2.8 2013/07/24 04:01:51 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -89,7 +89,8 @@ krealloc(void *ptr, size_t size, gfp_t g static inline void kfree(void *ptr) { - free(ptr, M_TEMP); + if (ptr != NULL) + free(ptr, M_TEMP); } #endif /* _LINUX_SLAB_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 04:01:05 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: spinlock.h Log Message: Add assert_spin_locked to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \ src/sys/external/bsd/drm2/include/linux/spinlock.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/drm2/include/linux/spinlock.h diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.7 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.8 --- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.7 Wed Jul 24 03:50:30 2013 +++ src/sys/external/bsd/drm2/include/linux/spinlock.h Wed Jul 24 04:01:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: spinlock.h,v 1.1.2.7 2013/07/24 03:50:30 riastradh Exp $ */ +/* $NetBSD: spinlock.h,v 1.1.2.8 2013/07/24 04:01:05 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -100,4 +100,8 @@ spin_lock_destroy(spinlock_t *spinlock) mutex_destroy(&spinlock->sl_lock); } +/* This is a macro to make the panic message clearer. */ +#define assert_spin_locked(spinlock) \ + KASSERT(mutex_owned(&(spinlock)->sl_lock)) + #endif /* _LINUX_SPINLOCK_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 04:00:19 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: slab.h Log Message: Fix sense of kassert in kcalloc. To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 \ src/sys/external/bsd/drm2/include/linux/slab.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/drm2/include/linux/slab.h diff -u src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.6 src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.7 --- src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.6 Wed Jul 24 03:30:42 2013 +++ src/sys/external/bsd/drm2/include/linux/slab.h Wed Jul 24 04:00:19 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: slab.h,v 1.1.2.6 2013/07/24 03:30:42 riastradh Exp $ */ +/* $NetBSD: slab.h,v 1.1.2.7 2013/07/24 04:00:19 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ kzalloc(size_t size, gfp_t gfp) static inline void * kcalloc(size_t n, size_t size, gfp_t gfp) { - KASSERT((SIZE_MAX / n) <= size); + KASSERT(size <= (SIZE_MAX / n)); return malloc((n * size), M_TEMP, (linux_gfp_to_malloc(gfp) | M_ZERO)); }
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:59:06 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h Log Message: Use a non-NULL value for bogus stubs. To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 \ src/sys/external/bsd/drm2/include/linux/workqueue.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/drm2/include/linux/workqueue.h diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.6 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.7 --- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.6 Wed Jul 24 03:37:04 2013 +++ src/sys/external/bsd/drm2/include/linux/workqueue.h Wed Jul 24 03:59:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: workqueue.h,v 1.1.2.6 2013/07/24 03:37:04 riastradh Exp $ */ +/* $NetBSD: workqueue.h,v 1.1.2.7 2013/07/24 03:59:06 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -107,12 +107,13 @@ struct workqueue_struct; static inline struct workqueue_struct * alloc_ordered_workqueue(const char *name __unused, int flags __unused) { - return NULL; + return (void *)(uintptr_t)0xdeadbeef; } static inline void destroy_workqueue(struct workqueue_struct *wq __unused) { + KASSERT(wq == (void *)(uintptr_t)0xdeadbeef); } #define flush_workqueue(wq) WARN(true, "Can't flush workqueues!"); @@ -121,6 +122,7 @@ destroy_workqueue(struct workqueue_struc static inline void queue_work(struct workqueue_struct *wq __unused, struct work_struct *work) { + KASSERT(wq == (void *)(uintptr_t)0xdeadbeef); schedule_work(work); } @@ -129,6 +131,7 @@ queue_delayed_work(struct workqueue_stru struct delayed_work *dw, unsigned int ticks) { + KASSERT(wq == (void *)(uintptr_t)0xdeadbeef); schedule_delayed_work(dw, ticks); }
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:58:04 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: mm.h Log Message: Mega-kludge: reverse sense of PAGE_MASK in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/include/linux/mm.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/drm2/include/linux/mm.h diff -u src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.3 Wed Jul 24 02:51:06 2013 +++ src/sys/external/bsd/drm2/include/linux/mm.h Wed Jul 24 03:58:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mm.h,v 1.1.2.3 2013/07/24 02:51:06 riastradh Exp $ */ +/* $NetBSD: mm.h,v 1.1.2.4 2013/07/24 03:58:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -42,6 +42,10 @@ #define PAGE_ALIGN(x) round_page(x) +/* XXX Ugh bletch! Whattakludge! Linux's sense is reversed... */ +#undef PAGE_MASK +#define PAGE_MASK (~(PAGE_SIZE-1)) + /* * ### * ### XXX THIS NEEDS SERIOUS SCRUTINY XXX ###
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:50:16 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: timer.h Log Message: Bogus definition of round_jiffies_up in drm2 . To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/timer.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/drm2/include/linux/timer.h diff -u src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.2 Wed Jul 24 02:28:50 2013 +++ src/sys/external/bsd/drm2/include/linux/timer.h Wed Jul 24 03:50:16 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.h,v 1.1.2.2 2013/07/24 02:28:50 riastradh Exp $ */ +/* $NetBSD: timer.h,v 1.1.2.3 2013/07/24 03:50:16 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -67,4 +67,15 @@ del_timer_sync(struct timer_list *timer) callout_destroy(&timer->tl_callout); } +/* + * XXX This is bogus -- the Linux version does various machinations to + * give some jitter so that stuff doesn't wake up all at once. + */ + +static inline unsigned long +round_jiffies_up(unsigned long j) +{ + return roundup(j, hz); +} + #endif /* _LINUX_TIMER_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:50:46 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: printk.h Log Message: Add pr_err as an alias for printf to drm2 . To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/linux/printk.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/drm2/include/linux/printk.h diff -u src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.4 Wed Jul 24 03:46:07 2013 +++ src/sys/external/bsd/drm2/include/linux/printk.h Wed Jul 24 03:50:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: printk.h,v 1.1.2.4 2013/07/24 03:46:07 riastradh Exp $ */ +/* $NetBSD: printk.h,v 1.1.2.5 2013/07/24 03:50:45 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -37,6 +37,7 @@ #define printk printf #define vprintk vprintf +#define pr_err printf /* XXX */ #define pr_warn_once printf /* XXX */ #define KERN_DEBUG "drm kern debug: " #define KERN_WARNING "drm kern warning: "
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:50:30 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: spinlock.h Log Message: spin_(un)lock_irq in drm2 . To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 \ src/sys/external/bsd/drm2/include/linux/spinlock.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/drm2/include/linux/spinlock.h diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.6 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.7 --- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.6 Wed Jul 24 02:50:36 2013 +++ src/sys/external/bsd/drm2/include/linux/spinlock.h Wed Jul 24 03:50:30 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: spinlock.h,v 1.1.2.6 2013/07/24 02:50:36 riastradh Exp $ */ +/* $NetBSD: spinlock.h,v 1.1.2.7 2013/07/24 03:50:30 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -57,6 +57,18 @@ spin_unlock(spinlock_t *spinlock) mutex_exit(&spinlock->sl_lock); } +static inline void +spin_lock_irq(spinlock_t *spinlock) +{ + spin_lock(spinlock); +} + +static inline void +spin_unlock_irq(spinlock_t *spinlock) +{ + spin_unlock(spinlock); +} + /* Must be a macro because the second argument is to be assigned. */ #define spin_lock_irqsave(SPINLOCK, FLAGS)\ do {\
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:49:42 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: notifier.h Log Message: Add forgotten . To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/linux/notifier.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/drm2/include/linux/notifier.h diff -u /dev/null src/sys/external/bsd/drm2/include/linux/notifier.h:1.1.2.1 --- /dev/null Wed Jul 24 03:49:42 2013 +++ src/sys/external/bsd/drm2/include/linux/notifier.h Wed Jul 24 03:49:42 2013 @@ -0,0 +1,42 @@ +/* $NetBSD: notifier.h,v 1.1.2.1 2013/07/24 03:49:42 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_NOTIFIER_H_ +#define _LINUX_NOTIFIER_H_ + +struct notifier_block { + int (*notifier_call)(struct notifier_block *, unsigned long, + void *); +}; + +#define NOTIFY_OK 0 + +#endif /* _LINUX_NOTIFIER_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:49:20 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: intel-gtt.h Log Message: Add stub , forgotten a while ago. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/drm/intel-gtt.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/drm2/include/drm/intel-gtt.h diff -u /dev/null src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.1 --- /dev/null Wed Jul 24 03:49:20 2013 +++ src/sys/external/bsd/drm2/include/drm/intel-gtt.h Wed Jul 24 03:49:20 2013 @@ -0,0 +1,67 @@ +/* $NetBSD: intel-gtt.h,v 1.1.2.1 2013/07/24 03:49:20 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _DRM_INTEL_GTT_H_ +#define _DRM_INTEL_GTT_H_ + +struct intel_gtt { + unsigned int stolen_size; + unsigned int gtt_total_entries; + unsigned int gtt_mappable_entries; + bool needs_dmar; + bool do_idle_maps; + bus_addr_t scratch_page_dma; + struct vm_page *scratch_page; /* XXX Sensible? */ + bus_size_t gtt; + paddr_t gma_bus_addr; +}; + +struct intel_gtt * + intel_gtt_get(void); +int intel_gmch_probe(struct pci_dev *, struct pci_dev *, + struct agp_bridge_data *); +void intel_gmch_remove(void); +bool intel_enable_gtt(void); +void intel_gtt_chipset_flush(void); +#ifndef __NetBSD__ +void intel_gtt_insert_sg_entries(struct sg_table *, unsigned int, + unsigned int); +#endif +void intel_gtt_clear_range(unsigned int, unsigned int); + +#define AGP_DCACHE_MEMORY 1 +#define AGP_PHYS_MEMORY 2 + +#define AGP_USER_CACHED_MEMORY_GFDT __BIT(3) + +extern int intel_iommu_gfx_mapped; + +#endif /* _DRM_INTEL_GTT_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:46:07 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: printk.h Log Message: Add pr_warn_once as a bogus alias for printf in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/linux/printk.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/drm2/include/linux/printk.h diff -u src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.3 Wed Jul 24 03:34:04 2013 +++ src/sys/external/bsd/drm2/include/linux/printk.h Wed Jul 24 03:46:07 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: printk.h,v 1.1.2.3 2013/07/24 03:34:04 riastradh Exp $ */ +/* $NetBSD: printk.h,v 1.1.2.4 2013/07/24 03:46:07 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -37,6 +37,7 @@ #define printk printf #define vprintk vprintf +#define pr_warn_once printf /* XXX */ #define KERN_DEBUG "drm kern debug: " #define KERN_WARNING "drm kern warning: " #define KERN_ERR "drm kern error: "
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:45:38 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: math64.h Log Message: Add div_u64 to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/math64.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/drm2/include/linux/math64.h diff -u src/sys/external/bsd/drm2/include/linux/math64.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/math64.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/math64.h:1.1.2.1 Wed Jul 24 02:29:48 2013 +++ src/sys/external/bsd/drm2/include/linux/math64.h Wed Jul 24 03:45:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: math64.h,v 1.1.2.1 2013/07/24 02:29:48 riastradh Exp $ */ +/* $NetBSD: math64.h,v 1.1.2.2 2013/07/24 03:45:38 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -40,4 +40,10 @@ div64_u64(int64_t divisor, uint64_t divi return divisor / dividend; } +static inline int64_t +div_u64(int64_t divisor, uint32_t dividend) +{ + return divisor / dividend; +} + #endif /* _LINUX_MATH64_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:45:53 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add bogus struct device dev member to struct pci_dev. To generate a diff of this commit: cvs rdiff -u -r1.1.2.14 -r1.1.2.15 \ src/sys/external/bsd/drm2/include/linux/pci.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/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.14 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.15 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.14 Wed Jul 24 03:32:19 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:45:53 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.14 2013/07/24 03:32:19 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.15 2013/07/24 03:45:53 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -82,6 +82,7 @@ struct pci_dev { bus_size_t pd_rom_size; void *pd_rom_vaddr; device_t pd_dev; + struct device dev; /* XXX Don't believe me! */ struct pci_bus *bus; uint32_t devfn; uint16_t vendor;
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:45:24 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Implement bogus max_t in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.19 -r1.1.2.20 \ src/sys/external/bsd/drm2/include/linux/kernel.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/drm2/include/linux/kernel.h diff -u src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.19 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.20 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.19 Wed Jul 24 03:36:31 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 03:45:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.19 2013/07/24 03:36:31 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.20 2013/07/24 03:45:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -46,7 +46,8 @@ #define uninitialized_var(x) x -/* XXX This will multiply evaluate its arguments. */ +/* XXX These will multiply evaluate their arguments. */ +#define max_t(T, X, Y) MAX(X, Y) #define min_t(T, X, Y) MIN(X, Y) /*
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:45:09 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: err.h Log Message: Add ENOTSUPP as an alias for ENOTSUP (XXX huh?) in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/linux/err.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/drm2/include/linux/err.h diff -u src/sys/external/bsd/drm2/include/linux/err.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/err.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/err.h:1.1.2.3 Wed Jul 24 03:36:48 2013 +++ src/sys/external/bsd/drm2/include/linux/err.h Wed Jul 24 03:45:09 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: err.h,v 1.1.2.3 2013/07/24 03:36:48 riastradh Exp $ */ +/* $NetBSD: err.h,v 1.1.2.4 2013/07/24 03:45:09 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,6 +38,7 @@ #include #include +#define ENOTSUPP ENOTSUP /* XXX ??? */ #define EREMOTEIO EIO /* XXX Urk... */ #define MAX_ERRNO ELAST
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:44:39 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: bitops.h Log Message: Implement hweight16 in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/bitops.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/drm2/include/linux/bitops.h diff -u src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/bitops.h Wed Jul 24 03:44:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bitops.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: bitops.h,v 1.1.2.2 2013/07/24 03:44:39 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,12 @@ #ifndef _LINUX_BITOPS_H_ #define _LINUX_BITOPS_H_ +#include + +static inline unsigned int +hweight16(uint16_t n) +{ + return popcount32(n); +} + #endif /* _LINUX_BITOPS_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:44:10 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: io.h Log Message: Define memcpy_*io as memcpy in drm2 Linux . These work only for memory-mapped I/O anyway. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/include/asm/io.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/drm2/include/asm/io.h diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.2 src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.2 Wed Jul 24 03:39:52 2013 +++ src/sys/external/bsd/drm2/include/asm/io.h Wed Jul 24 03:44:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: io.h,v 1.1.2.2 2013/07/24 03:39:52 riastradh Exp $ */ +/* $NetBSD: io.h,v 1.1.2.3 2013/07/24 03:44:10 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -39,4 +39,8 @@ */ #define mmiowb() __insn_barrier() +#define memcpy_fromio memcpy +#define memcpy_toio memcpy +#define memset_io memset + #endif /* _ASM_IO_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:44:24 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: acpi_io.h Log Message: Define acpi_os_iounmap as AcpiOsUnmapMemory in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/acpi_io.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/drm2/include/linux/acpi_io.h diff -u src/sys/external/bsd/drm2/include/linux/acpi_io.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/acpi_io.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/acpi_io.h:1.1.2.2 Wed Jul 24 03:00:03 2013 +++ src/sys/external/bsd/drm2/include/linux/acpi_io.h Wed Jul 24 03:44:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_io.h,v 1.1.2.2 2013/07/24 03:00:03 riastradh Exp $ */ +/* $NetBSD: acpi_io.h,v 1.1.2.3 2013/07/24 03:44:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,6 +35,7 @@ #include #define acpi_os_ioremap AcpiOsMapMemory +#define acpi_os_iounmap AcpiOsUnmapMemory #define __acpi_iomem #endif /* _LINUX_ACPI_IO_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:44:54 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: delay.h Log Message: Make udelay a static inline in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/linux/delay.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/drm2/include/linux/delay.h diff -u src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.4 Wed Jul 24 03:36:10 2013 +++ src/sys/external/bsd/drm2/include/linux/delay.h Wed Jul 24 03:44:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: delay.h,v 1.1.2.4 2013/07/24 03:36:10 riastradh Exp $ */ +/* $NetBSD: delay.h,v 1.1.2.5 2013/07/24 03:44:54 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,11 +38,15 @@ #include -#define udelay DELAY - #define MAX_UDELAY_MS 5 static inline void +udelay(unsigned int usec) +{ + DELAY(usec); +} + +static inline void msleep(unsigned int msec) { (void)kpause("lnxmslep", false, mstohz(msec), NULL);
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/acpi
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:43:41 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/acpi [riastradh-drm2]: button.h Log Message: Shim acpi_lid_notifier implementation in drm2 Linux . To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/acpi/button.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/drm2/include/acpi/button.h diff -u src/sys/external/bsd/drm2/include/acpi/button.h:1.1.2.1 src/sys/external/bsd/drm2/include/acpi/button.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/acpi/button.h:1.1.2.1 Wed Jul 24 03:12:15 2013 +++ src/sys/external/bsd/drm2/include/acpi/button.h Wed Jul 24 03:43:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: button.h,v 1.1.2.1 2013/07/24 03:12:15 riastradh Exp $ */ +/* $NetBSD: button.h,v 1.1.2.2 2013/07/24 03:43:41 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,26 @@ #ifndef _DRM2_COMPAT_ACPI_BUTTON_H_ #define _DRM2_COMPAT_ACPI_BUTTON_H_ +struct notifier_block; + +/* XXX This obviously needs a real implementation... */ + +static inline int +acpi_lid_notifier_register(struct notifier_block *notifier) +{ + return 0; +} + +static inline int +acpi_lid_notifier_unregister(struct notifier_block *notifier) +{ + return 0; +} + +static inline int +acpi_lid_open(void) +{ + return 1; +} + #endif /* _DRM2_COMPAT_ACPI_BUTTON_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:43:55 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h Log Message: Implement BUILD_BUG_ON via CTASSERT in drm2 Linux . To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/external/bsd/drm2/include/asm/bug.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/drm2/include/asm/bug.h diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.7 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.8 --- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.7 Wed Jul 24 03:35:34 2013 +++ src/sys/external/bsd/drm2/include/asm/bug.h Wed Jul 24 03:43:55 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bug.h,v 1.1.2.7 2013/07/24 03:35:34 riastradh Exp $ */ +/* $NetBSD: bug.h,v 1.1.2.8 2013/07/24 03:43:55 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,6 +38,8 @@ #define BUG() panic("%s:%d: BUG!", __FILE__, __LINE__) #define BUG_ON(CONDITION) KASSERT(!(CONDITION)) +#define BUILD_BUG_ON(CONDITION) CTASSERT(!(CONDITION)) + /* XXX Rate limit? */ #define WARN(CONDITION, FMT, ...) \ linux_warning((CONDITION)? \
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:39:52 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: io.h Log Message: Add bogus x86-specific mmiowb to Linux . To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/include/asm/io.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/drm2/include/asm/io.h diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.1 src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.1 Wed Jul 24 00:33:11 2013 +++ src/sys/external/bsd/drm2/include/asm/io.h Wed Jul 24 03:39:52 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: io.h,v 1.1.2.1 2013/07/24 00:33:11 riastradh Exp $ */ +/* $NetBSD: io.h,v 1.1.2.2 2013/07/24 03:39:52 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,11 @@ #ifndef _ASM_IO_H_ #define _ASM_IO_H_ +/* + * XXX This is bollocks, and is wrong on various architectures (should + * work for x86; who knows what else), but bus_space_barrier won't work + * because we have no bus space tag or handle or offset or anything. + */ +#define mmiowb() __insn_barrier() + #endif /* _ASM_IO_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:37:24 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: i2c.h Log Message: Add kludgey dev field to struct i2c_adapter for intel_dp. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/linux/i2c.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/drm2/include/linux/i2c.h diff -u src/sys/external/bsd/drm2/include/linux/i2c.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/i2c.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/i2c.h:1.1.2.4 Wed Jul 24 03:11:44 2013 +++ src/sys/external/bsd/drm2/include/linux/i2c.h Wed Jul 24 03:37:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.h,v 1.1.2.4 2013/07/24 03:11:44 riastradh Exp $ */ +/* $NetBSD: i2c.h,v 1.1.2.5 2013/07/24 03:37:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -53,6 +53,9 @@ struct i2c_adapter { intretries; struct module *owner; unsigned int class; + struct { + device_t parent; + }dev; /* XXX Kludge for intel_dp. */ }; static inline int
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:36:10 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: delay.h Log Message: Add mdelay to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/linux/delay.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/drm2/include/linux/delay.h diff -u src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.3 Wed Jul 24 03:31:29 2013 +++ src/sys/external/bsd/drm2/include/linux/delay.h Wed Jul 24 03:36:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: delay.h,v 1.1.2.3 2013/07/24 03:31:29 riastradh Exp $ */ +/* $NetBSD: delay.h,v 1.1.2.4 2013/07/24 03:36:10 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -40,10 +40,23 @@ #define udelay DELAY +#define MAX_UDELAY_MS 5 + static inline void msleep(unsigned int msec) { (void)kpause("lnxmslep", false, mstohz(msec), NULL); } +static inline void +mdelay(unsigned int msec) +{ + + if (msec < MAX_UDELAY_MS) + udelay(msec * 1000); + else + while (msec--) + udelay(1000); +} + #endif /* _LINUX_DELAY_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:37:04 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h Log Message: Add stubs for flush_workqueue and flush_scheduled_work that warn. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \ src/sys/external/bsd/drm2/include/linux/workqueue.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/drm2/include/linux/workqueue.h diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.5 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.5 Wed Jul 24 03:04:04 2013 +++ src/sys/external/bsd/drm2/include/linux/workqueue.h Wed Jul 24 03:37:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: workqueue.h,v 1.1.2.5 2013/07/24 03:04:04 riastradh Exp $ */ +/* $NetBSD: workqueue.h,v 1.1.2.6 2013/07/24 03:37:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,6 +34,7 @@ #include +#include #include /* @@ -114,6 +115,9 @@ destroy_workqueue(struct workqueue_struc { } +#define flush_workqueue(wq) WARN(true, "Can't flush workqueues!"); +#define flush_scheduled_work(wq) WARN(true, "Can't flush workqueues!"); + static inline void queue_work(struct workqueue_struct *wq __unused, struct work_struct *work) {
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:36:48 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: err.h Log Message: Add EREMOTEIO as an alias for EIO to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/err.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/drm2/include/linux/err.h diff -u src/sys/external/bsd/drm2/include/linux/err.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/err.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/err.h:1.1.2.2 Wed Jul 24 02:23:48 2013 +++ src/sys/external/bsd/drm2/include/linux/err.h Wed Jul 24 03:36:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: err.h,v 1.1.2.2 2013/07/24 02:23:48 riastradh Exp $ */ +/* $NetBSD: err.h,v 1.1.2.3 2013/07/24 03:36:48 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,6 +38,8 @@ #include #include +#define EREMOTEIO EIO /* XXX Urk... */ + #define MAX_ERRNO ELAST static inline bool
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:35:50 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: atomic.h Log Message: Add several operations to . atomic_add_unless atomic_clear_mask atomic_inc_not_zero atomic_set_mask atomic_sub To generate a diff of this commit: cvs rdiff -u -r1.1.2.8 -r1.1.2.9 \ src/sys/external/bsd/drm2/include/linux/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/drm2/include/linux/atomic.h diff -u src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.8 src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.9 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.8 Wed Jul 24 02:28:36 2013 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Wed Jul 24 03:35:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.1.2.8 2013/07/24 02:28:36 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.1.2.9 2013/07/24 03:35:50 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -61,6 +61,12 @@ atomic_add(int addend, atomic_t *atomic) atomic_add_int(&atomic->a_u.au_uint, addend); } +static inline void +atomic_sub(int subtrahend, atomic_t *atomic) +{ + atomic_add_int(&atomic->a_u.au_uint, -subtrahend); +} + static inline int atomic_add_return(int addend, atomic_t *atomic) { @@ -86,6 +92,39 @@ atomic_dec_and_test(atomic_t *atomic) } static inline void +atomic_set_mask(unsigned long mask, atomic_t *atomic) +{ + atomic_or_uint(&atomic->a_u.au_uint, mask); +} + +static inline void +atomic_clear_mask(unsigned long mask, atomic_t *atomic) +{ + atomic_and_uint(&atomic->a_u.au_uint, ~mask); +} + +static inline int +atomic_add_unless(atomic_t *atomic, int addend, int zero) +{ + int value; + + do { + value = atomic->a_u.au_int; + if (value == zero) + return 0; + } while (atomic_cas_uint(&atomic->a_u.au_uint, value, (value + addend)) + != value); + + return 1; +} + +static inline int +atomic_inc_not_zero(atomic_t *atomic) +{ + return atomic_add_unless(atomic, 1, 0); +} + +static inline void set_bit(unsigned long bit, volatile unsigned long *ptr) { atomic_or_ulong(ptr, (1 << bit));
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:35:34 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h Log Message: Define WARN_ONCE in Linux . To generate a diff of this commit: cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/external/bsd/drm2/include/asm/bug.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/drm2/include/asm/bug.h diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.6 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.7 --- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.6 Wed Jul 24 03:25:28 2013 +++ src/sys/external/bsd/drm2/include/asm/bug.h Wed Jul 24 03:35:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bug.h,v 1.1.2.6 2013/07/24 03:25:28 riastradh Exp $ */ +/* $NetBSD: bug.h,v 1.1.2.7 2013/07/24 03:35:34 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -45,6 +45,9 @@ ##__VA_ARGS__), 1) \ : 0) +#define WARN_ONCE(CONDITION, FMT, ...) \ + WARN(CONDITION, FMT, ##__VA_ARGS__) /* XXX */ + #define WARN_ON(CONDITION) WARN(CONDITION, "%s\n", #CONDITION) #define WARN_ON_SMP(CONDITION) WARN_ON(CONDITION) /* XXX */ #define WARN_ON_ONCE(CONDITION) WARN_ON(CONDITION) /* XXX */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:33:48 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: printk.h Log Message: Add hex dumping utilities to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/printk.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/drm2/include/linux/printk.h diff -u src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.1 Wed Jul 24 02:37:36 2013 +++ src/sys/external/bsd/drm2/include/linux/printk.h Wed Jul 24 03:33:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: printk.h,v 1.1.2.1 2013/07/24 02:37:36 riastradh Exp $ */ +/* $NetBSD: printk.h,v 1.1.2.2 2013/07/24 03:33:48 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,6 +32,7 @@ #ifndef _LINUX_PRINTK_H_ #define _LINUX_PRINTK_H_ +#include #include #define printk printf @@ -40,4 +41,81 @@ #define KERN_WARNING "drm kern warning: " #define KERN_ERR "drm kern error: " +#define DUMP_PREFIX_NONE 0 +#define DUMP_PREFIX_OFFSET 1 +#define DUMP_PREFIX_ADDRESS 2 + +static inline void +hex_dump_to_buffer(const void *buf, size_t buf_size, int bytes_per_line, +int bytes_per_group, char *output, size_t output_size, bool ascii __unused) +{ + const uint8_t *bytes = buf; + size_t i = 0, n; + + KASSERT(output_size >= 1); + KASSERT((bytes_per_line == 16) || (bytes_per_line == 32)); + KASSERT(powerof2(bytes_per_group)); + KASSERT(0 < bytes_per_group); + KASSERT(bytes_per_group <= 8); + + output[output_size - 1] = '\0'; + while (i < buf_size) { + n = snprintf(output, output_size, "%02x", bytes[i++]); + if (n >= output_size) + break; + output += n; output_size -= n; + if ((i == buf_size) || (0 == (i % bytes_per_line))) + n = snprintf(output, output_size, "\n"); + else if ((0 < i) && (0 == (i % bytes_per_group))) + n = snprintf(output, output_size, " "); + else + n = 0; + if (n >= output_size) + break; + output += n; output_size -= n; + } +} + +static inline void +print_hex_dump(const char *level, const char *prefix, int prefix_type, +int bytes_per_line, int bytes_per_group, const void *buf, size_t buf_size, +bool ascii) +{ + const uint8_t *bytes = buf; + /* Two digits and one space/newline per byte, plus a null. */ + char line[32*3 + 1]; + + KASSERT((bytes_per_line == 16) || (bytes_per_line == 32)); + KASSERT(powerof2(bytes_per_group)); + KASSERT(0 < bytes_per_group); + KASSERT(bytes_per_group <= 8); + + while (0 < buf_size) { + const size_t n = MIN(buf_size, 32); + + switch (prefix_type) { + case DUMP_PREFIX_OFFSET: + printf("%08zu: ", (bytes - (const uint8_t *)buf)); + break; + + case DUMP_PREFIX_ADDRESS: + printf("%p: ", bytes); + break; + + case DUMP_PREFIX_NONE: + default: + break; + } + + hex_dump_to_buffer(bytes, n, bytes_per_line, bytes_per_group, + line, sizeof(line), ascii); + KASSERT(0 < strnlen(line, sizeof(line))); + KASSERT(line[strnlen(line, sizeof(line)) - 1] == '\n'); + printf("%s", line); + + bytes += n; + buf_size -= n; + } +} + #endif /* _LINUX_LIST_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:34:04 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: printk.h Log Message: Fix #endif include-protection comment in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/printk.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/drm2/include/linux/printk.h diff -u src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.2 Wed Jul 24 03:33:48 2013 +++ src/sys/external/bsd/drm2/include/linux/printk.h Wed Jul 24 03:34:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: printk.h,v 1.1.2.2 2013/07/24 03:33:48 riastradh Exp $ */ +/* $NetBSD: printk.h,v 1.1.2.3 2013/07/24 03:34:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -118,4 +118,4 @@ print_hex_dump(const char *level, const } } -#endif /* _LINUX_LIST_H_ */ +#endif /* _LINUX_PRINTK_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:31:29 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: delay.h Log Message: needs for hz (in mstohz). To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/delay.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/drm2/include/linux/delay.h diff -u src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.2 Wed Jul 24 03:03:06 2013 +++ src/sys/external/bsd/drm2/include/linux/delay.h Wed Jul 24 03:31:29 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: delay.h,v 1.1.2.2 2013/07/24 03:03:06 riastradh Exp $ */ +/* $NetBSD: delay.h,v 1.1.2.3 2013/07/24 03:31:29 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -33,6 +33,7 @@ #define _LINUX_DELAY_H_ #include +#include #include #include
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:30:19 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: mm_types.h Log Message: Add struct page to as a struct vm_page wrapper. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/mm_types.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/drm2/include/linux/mm_types.h diff -u src/sys/external/bsd/drm2/include/linux/mm_types.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/mm_types.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/mm_types.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/mm_types.h Wed Jul 24 03:30:19 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mm_types.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: mm_types.h,v 1.1.2.2 2013/07/24 03:30:19 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,10 @@ #ifndef _LINUX_MM_TYPES_H_ #define _LINUX_MM_TYPES_H_ +#include /* XXX don't expose this */ + +struct page { + struct vm_page p_vmp; +}; + #endif /* _LINUX_MM_TYPES_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:30:42 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: slab.h Added Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: gfp.h Log Message: Move GFP (`get free page') constants to . Declare alloc_page and __free_page there too, to be implemented soon. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/linux/gfp.h cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \ src/sys/external/bsd/drm2/include/linux/slab.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/drm2/include/linux/slab.h diff -u src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.5 src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.5 Wed Jul 24 02:37:13 2013 +++ src/sys/external/bsd/drm2/include/linux/slab.h Wed Jul 24 03:30:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: slab.h,v 1.1.2.5 2013/07/24 02:37:13 riastradh Exp $ */ +/* $NetBSD: slab.h,v 1.1.2.6 2013/07/24 03:30:42 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,34 +38,52 @@ #include /* For PAGE_SIZE. */ +#include + /* XXX Should use kmem, but Linux kfree doesn't take the size. */ -#define GFP_KERNEL M_WAITOK -#define GFP_ATOMIC M_NOWAIT +static inline int +linux_gfp_to_malloc(gfp_t gfp) +{ + int flags = 0; + + /* XXX Handle other cases as they arise. */ + KASSERT((gfp == GFP_ATOMIC) || (gfp == GFP_KERNEL)); + + if (ISSET(gfp, __GFP_WAIT)) + flags |= M_WAITOK; + else + flags |= M_NOWAIT; + + if (ISSET(gfp, __GFP_ZERO)) + flags |= M_ZERO; + + return flags; +} static inline void * -kmalloc(size_t size, int flags) +kmalloc(size_t size, gfp_t gfp) { - return malloc(size, M_TEMP, flags); + return malloc(size, M_TEMP, linux_gfp_to_malloc(gfp)); } static inline void * -kzalloc(size_t size, int flags) +kzalloc(size_t size, gfp_t gfp) { - return malloc(size, M_TEMP, (flags | M_ZERO)); + return malloc(size, M_TEMP, (linux_gfp_to_malloc(gfp) | M_ZERO)); } static inline void * -kcalloc(size_t n, size_t size, int flags) +kcalloc(size_t n, size_t size, gfp_t gfp) { KASSERT((SIZE_MAX / n) <= size); - return malloc((n * size), M_TEMP, (flags | M_ZERO)); + return malloc((n * size), M_TEMP, (linux_gfp_to_malloc(gfp) | M_ZERO)); } static inline void * -krealloc(void *ptr, size_t size, int flags) +krealloc(void *ptr, size_t size, gfp_t gfp) { - return realloc(ptr, size, M_TEMP, flags); + return realloc(ptr, size, M_TEMP, linux_gfp_to_malloc(gfp)); } static inline void Added files: Index: src/sys/external/bsd/drm2/include/linux/gfp.h diff -u /dev/null src/sys/external/bsd/drm2/include/linux/gfp.h:1.1.2.1 --- /dev/null Wed Jul 24 03:30:42 2013 +++ src/sys/external/bsd/drm2/include/linux/gfp.h Wed Jul 24 03:30:42 2013 @@ -0,0 +1,71 @@ +/* $NetBSD: gfp.h,v 1.1.2.1 2013/07/24 03:30:42 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_GFP_H_ +#define _LINUX_GFP_H_ + +/* GFP: `Get Free Page' */ + +#include +#include + +typedef int gfp_t; + +#define GFP_KERNEL (__GFP_FS | __GFP_IO | __GFP_WAIT) +#define GFP_ATOMIC (__GFP_HIGH) +#define GFP_DMA32 (__GFP_DMA32) +#define GFP_HIGHUSER (__GFP_FS | __GFP_HARDWALL | __GFP_HIGHMEM | \ + __GFP_IO | __GFP_WAIT) +#define GFP_USER (__GFP_FS | __GFP_HARDWALL | __GFP_IO | __GFP_
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:29:29 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: list.h Log Message: Add list_del_init to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.11 -r1.1.2.12 \ src/sys/external/bsd/drm2/include/linux/list.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/drm2/include/linux/list.h diff -u src/sys/external/bsd/drm2/include/linux/list.h:1.1.2.11 src/sys/external/bsd/drm2/include/linux/list.h:1.1.2.12 --- src/sys/external/bsd/drm2/include/linux/list.h:1.1.2.11 Wed Jul 24 02:37:49 2013 +++ src/sys/external/bsd/drm2/include/linux/list.h Wed Jul 24 03:29:29 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: list.h,v 1.1.2.11 2013/07/24 02:37:49 riastradh Exp $ */ +/* $NetBSD: list.h,v 1.1.2.12 2013/07/24 03:29:29 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -159,6 +159,13 @@ list_replace(struct list_head *old, stru old->next->prev = new; } +static inline void +list_del_init(struct list_head *node) +{ + list_del(node); + INIT_LIST_HEAD(node); +} + #define list_entry(PTR, TYPE, FIELD) container_of(PTR, TYPE, FIELD) #define list_first_entry(PTR, TYPE, FIELD)\ list_entry(list_first((PTR)), TYPE, FIELD)
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:30:02 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: shrinker.h Log Message: Fill struct shrink_control with nr_to_scan in . i915_gem wants to use it. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/shrinker.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/drm2/include/linux/shrinker.h diff -u src/sys/external/bsd/drm2/include/linux/shrinker.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/shrinker.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/shrinker.h:1.1.2.1 Wed Jul 24 03:07:48 2013 +++ src/sys/external/bsd/drm2/include/linux/shrinker.h Wed Jul 24 03:30:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: shrinker.h,v 1.1.2.1 2013/07/24 03:07:48 riastradh Exp $ */ +/* $NetBSD: shrinker.h,v 1.1.2.2 2013/07/24 03:30:02 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,7 +32,9 @@ #ifndef _LINUX_SHRINKER_H_ #define _LINUX_SHRINKER_H_ -struct shrink_control; +struct shrink_control { + unsigned long nr_to_scan; +}; struct shrinker { int (*shrink)(struct shrinker *, struct shrink_control *);
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:29:14 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include [riastradh-drm2]: i915_trace.h Log Message: Add a bunch of i915 trace stubs to i915_trace.h. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/i915_trace.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/drm2/include/i915_trace.h diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.3 src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.3 Wed Jul 24 03:25:47 2013 +++ src/sys/external/bsd/drm2/include/i915_trace.h Wed Jul 24 03:29:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_trace.h,v 1.1.2.3 2013/07/24 03:25:47 riastradh Exp $ */ +/* $NetBSD: i915_trace.h,v 1.1.2.4 2013/07/24 03:29:14 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,6 +34,118 @@ #include +#include "intel_drv.h" + +static inline void +trace_i915_flip_complete(enum plane plane __unused, +struct drm_i915_gem_object *obj __unused) +{ +} + +static inline void +trace_i915_flip_request(enum plane plane __unused, +struct drm_i915_gem_object *obj __unused) +{ +} + +static inline void +trace_i915_gem_evict(struct drm_device *dev __unused, int min_size __unused, +unsigned int alignment __unused, bool mappable __unused) +{ +} + +static inline void +trace_i915_gem_evict_everything(struct drm_device *dev __unused) +{ +} + +static inline void +trace_i915_gem_object_bind(struct drm_i915_gem_object *obj __unused, +bool map_and_fenceable __unused) +{ +} + +static inline void +trace_i915_gem_object_change_domain(struct drm_i915_gem_object *obj __unused, +uint32_t read_domains __unused, uint32_t old_write_domain __unused) +{ +} + +static inline void +trace_i915_gem_object_clflush(struct drm_i915_gem_object *obj __unused) +{ +} + +static inline void +trace_i915_gem_object_create(struct drm_i915_gem_object *obj __unused) +{ +} + +static inline void +trace_i915_gem_object_destroy(struct drm_i915_gem_object *obj __unused) +{ +} + +static inline void +trace_i915_gem_object_fault(struct drm_i915_gem_object *obj __unused, +pgoff_t page_offset __unused, bool gtt __unused, bool write __unused) +{ +} + +static inline void +trace_i915_gem_object_pread(struct drm_i915_gem_object *obj __unused, +uint32_t offset __unused, uint32_t size __unused) +{ +} + +static inline void +trace_i915_gem_object_pwrite(struct drm_i915_gem_object *obj __unused, +uint32_t offset __unused, uint32_t size __unused) +{ +} + +static inline void +trace_i915_gem_request_add(struct intel_ring_buffer *ring __unused, +uint32_t seqno __unused) +{ +} + +static inline void +trace_i915_gem_request_complete(struct intel_ring_buffer *ring __unused, +uint32_t seqno __unused) +{ +} + +static inline void +trace_i915_gem_request_retire(struct intel_ring_buffer *ring __unused, +uint32_t seqno __unused) +{ +} + +static inline void +trace_i915_gem_request_wait_begin(struct intel_ring_buffer *ring __unused, +uint32_t seqno __unused) +{ +} + +static inline void +trace_i915_gem_request_wait_end(struct intel_ring_buffer *ring __unused, +uint32_t seqno __unused) +{ +} + +static inline void +trace_i915_gem_ring_dispatch(struct intel_ring_buffer *ring __unused, +uint32_t seqno __unused, uint32_t flags __unused) +{ +} + +static inline void +trace_i915_gem_ring_flush(struct intel_ring_buffer *ring __unused, +uint32_t invalidate __unused, uint32_t flags __unused) +{ +} + static inline void trace_i915_reg_rw(bool write __unused, uint32_t reg __unused, uint64_t value __unused, size_t len __unused) @@ -41,7 +153,17 @@ trace_i915_reg_rw(bool write __unused, u } static inline void -trace_i915_gem_object_create(struct drm_i915_gem_object *obj __unused) +trace_i915_ring_wait_begin(struct intel_ring_buffer *ring __unused) +{ +} + +static inline void +trace_i915_ring_wait_end(struct intel_ring_buffer *ring __unused) +{ +} + +static inline void +trace_intel_gpu_freq_change(unsigned int freq __unused) { }
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:29:43 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: completion.h Log Message: Fix pointer nature of INIT_COMPLETION in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/completion.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/drm2/include/linux/completion.h diff -u src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.2 Wed Jul 24 03:15:59 2013 +++ src/sys/external/bsd/drm2/include/linux/completion.h Wed Jul 24 03:29:43 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: completion.h,v 1.1.2.2 2013/07/24 03:15:59 riastradh Exp $ */ +/* $NetBSD: completion.h,v 1.1.2.3 2013/07/24 03:29:43 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -117,9 +117,14 @@ complete_all(struct completion *completi * until someone calls complete or complete_all. * * This operation is very different from its lowercase counterpart. + * + * For some reason this works on the completion object itself, not on a + * pointer thereto, so it must be a macro. */ +#define INIT_COMPLETION(COMPLETION) INIT_COMPLETION_blorp(&(COMPLETION)) + static inline void -INIT_COMPLETION(struct completion *completion) +INIT_COMPLETION_blorp(struct completion *completion) { mutex_enter(&completion->c_lock);
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:28:25 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: string.h Log Message: needs for NULL. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/string.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/drm2/include/linux/string.h diff -u src/sys/external/bsd/drm2/include/linux/string.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/string.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/string.h:1.1.2.2 Wed Jul 24 03:13:03 2013 +++ src/sys/external/bsd/drm2/include/linux/string.h Wed Jul 24 03:28:25 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.1.2.2 2013/07/24 03:13:03 riastradh Exp $ */ +/* $NetBSD: string.h,v 1.1.2.3 2013/07/24 03:28:25 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,6 +34,7 @@ #include #include +#include static inline void * memchr_inv(const void *buffer, int c, size_t len)
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:28:09 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Fix up some bit-hacking and pointer-futzing in . - Avoid C arithmetic pitfalls and multiple evaluatoin in round_up. - Add round_down. - Explain why upper_32_bits and lower_32_bits exist. - Explain what container_of does. To generate a diff of this commit: cvs rdiff -u -r1.1.2.17 -r1.1.2.18 \ src/sys/external/bsd/drm2/include/linux/kernel.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/drm2/include/linux/kernel.h diff -u src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.17 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.18 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.17 Wed Jul 24 03:03:37 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 03:28:09 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.17 2013/07/24 03:03:37 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.18 2013/07/24 03:28:09 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -46,11 +46,26 @@ #define uninitialized_var(x) x -#define round_up(X, Y) roundup2(X, Y) +/* + * Rounding to powers of two -- carefully avoiding multiple evaluation + * of arguments and pitfalls with C integer arithmetic rules. + */ +#define round_up(X, N) X) - 1) | ((N) - 1)) + 1) +#define round_down(X, N) ((X) & ~(uintmax_t)((N) - 1)) +/* + * These select 32-bit halves of what may be 32- or 64-bit quantities, + * for which straight 32-bit shifts may be undefined behaviour (and do + * the wrong thing on most machines: return the input unshifted by + * ignoring the upper bits of the shift count). + */ #define upper_32_bits(X) ((uint32_t) (((X) >> 16) >> 16)) #define lower_32_bits(X) ((uint32_t) ((X) & 0xUL)) +/* + * Given x = &c->f, container_of(x, T, f) gives us back c, where T is + * the type of c. + */ #define container_of(PTR, TYPE, FIELD) \ ((void)sizeof((PTR) - \ &((TYPE *)(((char *)(PTR)) -\
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:26:18 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: device.h Log Message: Prefix `error: '/`warning: ' to Linux dev_err/dev_warn output. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/linux/device.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/drm2/include/linux/device.h diff -u src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.3 Wed Jul 24 03:17:32 2013 +++ src/sys/external/bsd/drm2/include/linux/device.h Wed Jul 24 03:26:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.1.2.3 2013/07/24 03:17:32 riastradh Exp $ */ +/* $NetBSD: device.h,v 1.1.2.4 2013/07/24 03:26:18 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,7 +35,10 @@ #include #include -#define dev_err device_printf -#define dev_warn device_printf +#define dev_err(DEV, FMT, ...) \ + device_printf((DEV), "error: " FMT, ##__VA_ARGS__) + +#define dev_warn(DEV, FMT, ...) \ + device_printf((DEV), "warning: " FMT, ##__VA_ARGS__) #endif /* _LINUX_DEVICE_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:25:28 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h Log Message: Use an intermediate call in WARN* to avoid GCC compiler warnings. For some reason this shuts it up about statements without effect. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/external/bsd/drm2/include/asm/bug.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/drm2/include/asm/bug.h diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.5 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.5 Wed Jul 24 03:02:51 2013 +++ src/sys/external/bsd/drm2/include/asm/bug.h Wed Jul 24 03:25:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bug.h,v 1.1.2.5 2013/07/24 03:02:51 riastradh Exp $ */ +/* $NetBSD: bug.h,v 1.1.2.6 2013/07/24 03:25:28 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ /* XXX Rate limit? */ #define WARN(CONDITION, FMT, ...) \ - ((CONDITION)? \ + linux_warning((CONDITION)? \ (printf("warning: %s:%d: " FMT, __FILE__, __LINE__, \ ##__VA_ARGS__), 1) \ : 0) @@ -49,4 +49,11 @@ #define WARN_ON_SMP(CONDITION) WARN_ON(CONDITION) /* XXX */ #define WARN_ON_ONCE(CONDITION) WARN_ON(CONDITION) /* XXX */ +/* XXX Kludge to avoid GCC warning about statements without effect. */ +static inline int +linux_warning(int x) +{ + return x; +} + #endif /* _ASM_BUG_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:25:48 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include [riastradh-drm2]: i915_trace.h Log Message: Add trace_i915_gem_object_create to i915_trace.h. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/i915_trace.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/drm2/include/i915_trace.h diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.2 src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.2 Wed Jul 24 03:23:15 2013 +++ src/sys/external/bsd/drm2/include/i915_trace.h Wed Jul 24 03:25:47 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_trace.h,v 1.1.2.2 2013/07/24 03:23:15 riastradh Exp $ */ +/* $NetBSD: i915_trace.h,v 1.1.2.3 2013/07/24 03:25:47 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -40,4 +40,9 @@ trace_i915_reg_rw(bool write __unused, u { } +static inline void +trace_i915_gem_object_create(struct drm_i915_gem_object *obj __unused) +{ +} + #endif /* _I915_TRACE_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:25:10 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: mutex.h Log Message: Fix Linux mutex_lock_interruptible to return an error. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \ src/sys/external/bsd/drm2/include/linux/mutex.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/drm2/include/linux/mutex.h diff -u src/sys/external/bsd/drm2/include/linux/mutex.h:1.1.2.5 src/sys/external/bsd/drm2/include/linux/mutex.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/linux/mutex.h:1.1.2.5 Wed Jul 24 02:37:00 2013 +++ src/sys/external/bsd/drm2/include/linux/mutex.h Wed Jul 24 03:25:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mutex.h,v 1.1.2.5 2013/07/24 02:37:00 riastradh Exp $ */ +/* $NetBSD: mutex.h,v 1.1.2.6 2013/07/24 03:25:10 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -58,10 +58,11 @@ mutex_lock(struct mutex *mutex) mutex_enter(&mutex->mtx_lock); } -static inline void +static inline int mutex_lock_interruptible(struct mutex *mutex) { mutex_enter(&mutex->mtx_lock); /* XXX */ + return 0; } static inline int
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:23:15 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include [riastradh-drm2]: i915_trace.h Log Message: Add trace_i915_reg_rw to i915_trace.h. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/i915_trace.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/drm2/include/i915_trace.h diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.1 src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.1 Wed Jul 24 03:15:12 2013 +++ src/sys/external/bsd/drm2/include/i915_trace.h Wed Jul 24 03:23:15 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_trace.h,v 1.1.2.1 2013/07/24 03:15:12 riastradh Exp $ */ +/* $NetBSD: i915_trace.h,v 1.1.2.2 2013/07/24 03:23:15 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,12 @@ #ifndef _I915_TRACE_H_ #define _I915_TRACE_H_ +#include + +static inline void +trace_i915_reg_rw(bool write __unused, uint32_t reg __unused, +uint64_t value __unused, size_t len __unused) +{ +} + #endif /* _I915_TRACE_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:20:05 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add pci_{read,write}_config_byte to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.11 -r1.1.2.12 \ src/sys/external/bsd/drm2/include/linux/pci.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/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.11 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.12 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.11 Wed Jul 24 03:18:24 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:20:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.11 2013/07/24 03:18:24 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.12 2013/07/24 03:20:05 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -106,34 +106,57 @@ pci_read_config_dword(struct pci_dev *pd } static inline void -pci_write_config_dword(struct pci_dev *pdev, int reg, uint32_t value) +pci_read_config_word(struct pci_dev *pdev, int reg, uint16_t *valuep) { - KASSERT(!ISSET(reg, 3)); - pci_conf_write(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg, value); + KASSERT(!ISSET(reg, 1)); + *valuep = pci_conf_read(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, + (reg &~ 3)) >> (8 * (reg & 3)); } static inline void -pci_read_config_word(struct pci_dev *pdev, int reg, uint16_t *valuep) +pci_read_config_byte(struct pci_dev *pdev, int reg, uint8_t *valuep) { - KASSERT(!ISSET(reg, 1)); *valuep = pci_conf_read(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, - (reg &~ 3)) >> (ISSET(reg, 3)? 16 : 0); + (reg &~ 1)) >> (8 * (reg & 1)); } static inline void -pci_write_config_word(struct pci_dev *pdev, int reg, uint16_t value) +pci_write_config_dword(struct pci_dev *pdev, int reg, uint32_t value) { + KASSERT(!ISSET(reg, 3)); + pci_conf_write(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg, value); +} + +static inline void +pci_rmw_config(struct pci_dev *pdev, int reg, unsigned int bytes, +uint32_t value) +{ + const uint32_t mask = ~((~0UL) << (8 * bytes)); const int reg32 = (reg &~ 3); - const unsigned int shift = (ISSET(reg, 3)? 16 : 0); + const unsigned int shift = (8 * (reg & 3)); uint32_t value32; - KASSERT(!ISSET(reg, 1)); + KASSERT(bytes <= 4); + KASSERT(!ISSET(value, ~mask)); pci_read_config_dword(pdev, reg32, &value32); - value32 &=~ (0xUL << shift); + value32 &=~ (mask << shift); value32 |= (value << shift); pci_write_config_dword(pdev, reg32, value32); } +static inline void +pci_write_config_word(struct pci_dev *pdev, int reg, uint16_t value) +{ + KASSERT(!ISSET(reg, 1)); + pci_rmw_config(pdev, reg, 2, value); +} + +static inline void +pci_write_config_byte(struct pci_dev *pdev, int reg, uint8_t value) +{ + pci_rmw_config(pdev, reg, 1, value); +} + /* * XXX pci msi */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:18:46 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: time.h Log Message: Add with get_seconds, hacked to return time_t. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/linux/time.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/drm2/include/linux/time.h diff -u /dev/null src/sys/external/bsd/drm2/include/linux/time.h:1.1.2.1 --- /dev/null Wed Jul 24 03:18:46 2013 +++ src/sys/external/bsd/drm2/include/linux/time.h Wed Jul 24 03:18:46 2013 @@ -0,0 +1,51 @@ +/* $NetBSD: time.h,v 1.1.2.1 2013/07/24 03:18:46 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_TIME_H_ +#define _LINUX_TIME_H_ + +#include + +/* + * XXX get_seconds as implemented by Linux is a Y2038 bug waiting to + * happen on 32-bit systems because it returns unsigned long. Some + * callers in Linux (implicitly) convert the result to time_t, though. + * We'll pretend get_seconds returns time_t and make sure all our + * callers treat it as if it did. + */ + +static inline time_t +get_seconds(void) +{ + return time_second; +} + +#endif /* _LINUX_TIME_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:18:24 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Fix struct pci_dev::dev in . Linux code expects it to be a struct device and takes its address, but we can't arrange for the actual struct device to go there. To generate a diff of this commit: cvs rdiff -u -r1.1.2.10 -r1.1.2.11 \ src/sys/external/bsd/drm2/include/linux/pci.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/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.10 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.11 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.10 Wed Jul 24 03:16:47 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:18:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.10 2013/07/24 03:16:47 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.11 2013/07/24 03:18:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ struct pci_device_id { struct pci_dev { struct pci_attach_args pd_pa; bool pd_kludged; /* XXX pci_kludgey_find_dev */ - device_t dev; + device_t pd_dev; struct pci_bus *bus; uint32_t devfn; uint16_t vendor; @@ -78,6 +78,12 @@ struct pci_dev { bool msi_enabled; }; +static inline device_t +pci_dev_dev(struct pci_dev *pdev) +{ + return pdev->pd_dev; +} + #define PCI_DEVFN(DEV, FN) \ (__SHIFTIN((DEV), __BITS(3, 7)) | __SHIFTIN((FN), __BITS(0, 2))) #define PCI_SLOT(DEVFN) __SHIFTOUT((DEVFN), __BITS(3, 7))
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:17:48 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: io-mapping.h Log Message: Fill with an io_mapping abstraction. Mapped to bus space reservations. This might not be appropriate -- non-x86 platforms don't have them yet, and I'm not 100% confident that Linux uses io_mappings for regions exclusively like bus space reservations will require, but if that requirement is violated then at least it will fail noisily, whether because of a bug or because Linux io_mappings work differently. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/io-mapping.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/drm2/include/linux/io-mapping.h diff -u src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/io-mapping.h Wed Jul 24 03:17:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: io-mapping.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: io-mapping.h,v 1.1.2.2 2013/07/24 03:17:48 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,92 @@ #ifndef _LINUX_IO_MAPPING_H_ #define _LINUX_IO_MAPPING_H_ +#include +#include +#include + +/* + * XXX This uses NetBSD bus space reservations, which are currently + * implemented only for x86. + */ + +struct io_mapping { + bus_space_tag_t diom_bst; + bus_addr_t diom_addr; + bus_addr_t diom_size; + int diom_flags; + bus_space_reservation_t diom_bsr; + bool diom_mapped; + bus_space_handle_t diom_bsh; +}; + +static inline struct io_mapping * +bus_space_io_mapping_create_wc(bus_space_tag_t bst, bus_addr_t addr, +bus_size_t size) +{ + struct io_mapping *const mapping = kmem_alloc(sizeof(*mapping), + KM_SLEEP); + mapping->diom_bst = bst; + mapping->diom_addr = addr; + mapping->diom_size = size; + mapping->diom_flags = 0; + mapping->diom_flags |= BUS_SPACE_MAP_LINEAR; + mapping->diom_flags |= BUS_SPACE_MAP_PREFETCHABLE; + mapping->diom_mapped = false; + + if (bus_space_reserve(mapping->diom_bst, addr, size, + mapping->diom_flags, &mapping->diom_bsr)) { + kmem_free(mapping, sizeof(*mapping)); + return NULL; + } + + return mapping; +} + +static inline void +io_mapping_free(struct io_mapping *mapping) +{ + + KASSERT(!mapping->diom_mapped); + bus_space_release(mapping->diom_bst, &mapping->diom_bsr); + kmem_free(mapping, sizeof(*mapping)); +} + +static inline void * +io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) +{ + + KASSERT(!mapping->diom_mapped); + KASSERT(ISSET(mapping->diom_flags, BUS_SPACE_MAP_LINEAR)); + if (bus_space_reservation_map(mapping->diom_bst, &mapping->diom_bsr, + mapping->diom_flags, &mapping->diom_bsh)) + panic("Unable to make I/O mapping!"); /* XXX */ + mapping->diom_mapped = true; + + return (char *)bus_space_vaddr(mapping->diom_bst, mapping->diom_bsh) + + offset; /* XXX arithmetic overflow */ +} + +static inline void +io_mapping_unmap(struct io_mapping *mapping, void *vaddr __unused) +{ + + KASSERT(mapping->diom_mapped); + bus_space_reservation_unmap(mapping->diom_bst, mapping->diom_bsh, + mapping->diom_size); + mapping->diom_mapped = false; +} + +static inline void * +io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) +{ + return io_mapping_map_wc(mapping, offset); +} + +static inline void +io_mapping_unmap_atomic(struct io_mapping *mapping, void *vaddr __unused) +{ + return io_mapping_unmap(mapping, vaddr); +} + #endif /* _LINUX_IO_MAPPING_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:17:32 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: device.h Log Message: Add dev_err to as another device_printf alias. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/device.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/drm2/include/linux/device.h diff -u src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.2 Wed Jul 24 02:57:38 2013 +++ src/sys/external/bsd/drm2/include/linux/device.h Wed Jul 24 03:17:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.1.2.2 2013/07/24 02:57:38 riastradh Exp $ */ +/* $NetBSD: device.h,v 1.1.2.3 2013/07/24 03:17:32 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,6 +35,7 @@ #include #include +#define dev_err device_printf #define dev_warn device_printf #endif /* _LINUX_DEVICE_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:16:47 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Fill in a bit. To generate a diff of this commit: cvs rdiff -u -r1.1.2.9 -r1.1.2.10 \ src/sys/external/bsd/drm2/include/linux/pci.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/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.9 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.10 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.9 Wed Jul 24 03:10:37 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:16:47 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.9 2013/07/24 03:10:37 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.10 2013/07/24 03:16:47 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -37,21 +37,52 @@ #include #include +#include +#include #include #include struct pci_bus; -struct pci_device_id; + +struct pci_device_id { + uint32_t vendor; + uint32_t device; + uint32_t subvendor; + uint32_t subdevice; + uint32_t class; + uint32_t class_mask; + unsigned long driver_data; +}; + +#define PCI_ANY_ID ((pcireg_t)-1) + +#define PCI_BASE_CLASS_DISPLAY PCI_CLASS_DISPLAY + +#define PCI_CLASS_BRIDGE_ISA PCI_SUBCLASS_BRIDGE_ISA + +#define PCI_VENDOR_ID_INTEL PCI_VENDOR_INTEL struct pci_dev { - struct pci_bus *bus; - unsigned int device; - struct pci_attach_args pd_pa; - bool pd_kludged; /* XXX pci_kludgey_find_dev hack */ - bool msi_enabled; + struct pci_attach_args pd_pa; + bool pd_kludged; /* XXX pci_kludgey_find_dev */ + device_t dev; + struct pci_bus *bus; + uint32_t devfn; + uint16_t vendor; + uint16_t device; + uint16_t subsystem_vendor; + uint16_t subsystem_device; + uint8_t revision; + uint32_t class; + bool msi_enabled; }; +#define PCI_DEVFN(DEV, FN) \ + (__SHIFTIN((DEV), __BITS(3, 7)) | __SHIFTIN((FN), __BITS(0, 2))) +#define PCI_SLOT(DEVFN) __SHIFTOUT((DEVFN), __BITS(3, 7)) +#define PCI_FUNC(DEVFN) __SHIFTOUT((DEVFN), __BITS(0, 2)) + #define PCI_CAP_ID_AGP PCI_CAP_AGP static inline int
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:15:59 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: completion.h Log Message: Rework to match Linux semantics. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/completion.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/drm2/include/linux/completion.h diff -u src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.1 Wed Jul 24 03:07:28 2013 +++ src/sys/external/bsd/drm2/include/linux/completion.h Wed Jul 24 03:15:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: completion.h,v 1.1.2.1 2013/07/24 03:07:28 riastradh Exp $ */ +/* $NetBSD: completion.h,v 1.1.2.2 2013/07/24 03:15:59 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,55 +36,129 @@ #include #include +#include + struct completion { - kmutex_t c_lock; - kcondvar_t c_cv; - bool c_done; + kmutex_t c_lock; + kcondvar_t c_cv; + + /* + * c_done is either + * + * . -1, meaning it's open season and we're done for good and + * nobody need wait any more; + * + * . 0, meaning nothing is done, so waiters must block; or + * + * . a positive integer, meaning that many waiters can + * proceed before further waiters must block. + * + * Negative values other than -1 are not allowed. + */ + int c_done; }; +/* + * Initialize a new completion object. + */ static inline void -INIT_COMPLETION(struct completion *completion) +init_completion(struct completion *completion) +{ + + mutex_init(&completion->c_lock, MUTEX_DEFAULT, IPL_NONE); + cv_init(&completion->c_cv, "lnxcmplt"); + completion->c_done = 0; +} + +/* + * Notify one waiter of completion, but not any future ones. + */ +static inline void +complete(struct completion *completion) { mutex_enter(&completion->c_lock); - completion->c_done = false; + + /* If it's not open season, wake one waiter. */ + if (completion->c_done >= 0) { + KASSERT(completion->c_done < INT_MAX); /* XXX check */ + completion->c_done++; + cv_signal(&completion->c_cv); + } else { + KASSERT(completion->c_done == -1); + } + mutex_exit(&completion->c_lock); } +/* + * Notify all waiters, present and future (until INIT_COMPLETION), of + * completion. + */ static inline void -init_completion(struct completion *completion) +complete_all(struct completion *completion) { - mutex_init(&completion->c_lock, MUTEX_DEFAULT, IPL_NONE); - cv_init(&completion->c_cv, "lnxcmplt"); - completion->c_done = false; + mutex_enter(&completion->c_lock); + + /* If it's not open season, make it open season and wake everyone. */ + if (completion->c_done >= 0) { + completion->c_done = -1; + cv_broadcast(&completion->c_cv); + } else { + KASSERT(completion->c_done == -1); + } + + mutex_exit(&completion->c_lock); } +/* + * Reverse the effect of complete_all so that subsequent waiters block + * until someone calls complete or complete_all. + * + * This operation is very different from its lowercase counterpart. + */ static inline void -complete_all(struct completion *completion) +INIT_COMPLETION(struct completion *completion) { mutex_enter(&completion->c_lock); - completion->c_done = true; - cv_broadcast(&completion->c_cv); + completion->c_done = 0; + /* No notify -- waiters are interested only in nonzero values. */ mutex_exit(&completion->c_lock); } +/* + * Wait interruptibly with a timeout for someone to call complete or + * complete_all. + */ static inline int wait_for_completion_interruptible_timeout(struct completion *completion, unsigned long ticks) { - int error = 0; + int error; mutex_enter(&completion->c_lock); - while (!completion->c_done) { - error = cv_timedwait_sig(&completion->c_cv, + + /* Wait until c_done is nonzero. */ + while (completion->c_done == 0) { + /* XXX errno NetBSD->Linux */ + error = -cv_timedwait_sig(&completion->c_cv, &completion->c_lock, ticks); if (error) - break; + goto out; } - mutex_exit(&completion->c_lock); + /* Claim a completion if it's not open season. */ + if (completion->c_done > 0) + completion->c_done--; + else + KASSERT(completion->c_done == -1); + + /* Success! */ + error = 0; + +out: mutex_exit(&completion->c_lock); return error; }
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:15:12 UTC 2013 Added Files: src/sys/external/bsd/drm2/include [riastradh-drm2]: i915_trace.h Log Message: Add currently empty i915_trace.h to appease i915 code. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/i915_trace.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/drm2/include/i915_trace.h diff -u /dev/null src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.1 --- /dev/null Wed Jul 24 03:15:12 2013 +++ src/sys/external/bsd/drm2/include/i915_trace.h Wed Jul 24 03:15:12 2013 @@ -0,0 +1,35 @@ +/* $NetBSD: i915_trace.h,v 1.1.2.1 2013/07/24 03:15:12 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _I915_TRACE_H_ +#define _I915_TRACE_H_ + +#endif /* _I915_TRACE_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:13:59 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: idr.h Log Message: Use cpp to prefix linux_ to all the idr names. Now all global symbols drm2.kmod defines begin with linux_ or drm_, making it easier to check whether I've missed anything by running nm --undefined-only drm2.kmod | awk '$3 ~ /^(drm|linux)_/' To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \ src/sys/external/bsd/drm2/include/linux/idr.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/drm2/include/linux/idr.h diff -u src/sys/external/bsd/drm2/include/linux/idr.h:1.1.2.5 src/sys/external/bsd/drm2/include/linux/idr.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/linux/idr.h:1.1.2.5 Wed Jul 24 02:51:35 2013 +++ src/sys/external/bsd/drm2/include/linux/idr.h Wed Jul 24 03:13:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: idr.h,v 1.1.2.5 2013/07/24 02:51:35 riastradh Exp $ */ +/* $NetBSD: idr.h,v 1.1.2.6 2013/07/24 03:13:59 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -44,6 +44,17 @@ struct idr { struct idr_node *idr_temp; }; +/* XXX Make the nm output a little more greppable... */ +#define idr_init linux_idr_init +#define idr_destroy linux_idr_destroy +#define idr_find linux_idr_find +#define idr_replace linux_idr_replace +#define idr_remove linux_idr_remove +#define idr_remove_all linux_idr_remove_all +#define idr_pre_get linux_idr_pre_get +#define idr_get_new_above linux_idr_get_new_above +#define idr_for_each linux_idr_for_each + void idr_init(struct idr *); void idr_destroy(struct idr *); void *idr_find(struct idr *, int);
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:13:03 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: string.h Log Message: Add memchr_inv to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/string.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/drm2/include/linux/string.h diff -u src/sys/external/bsd/drm2/include/linux/string.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/string.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/string.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/string.h Wed Jul 24 03:13:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: string.h,v 1.1.2.2 2013/07/24 03:13:03 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,20 @@ #ifndef _LINUX_STRING_H_ #define _LINUX_STRING_H_ +#include +#include + +static inline void * +memchr_inv(const void *buffer, int c, size_t len) +{ + const uint8_t byte = c; /* XXX lose */ + const char *p; + + for (p = buffer; len-- > 0; p++) + if (*p != byte) + return __UNCONST(p); + + return NULL; +} + #endif /* _LINUX_STRING_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:13:44 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: list_sort.h Log Message: `#define list_sort linux_list_sort' so `nm | grep linux' finds it. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/list_sort.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/drm2/include/linux/list_sort.h diff -u src/sys/external/bsd/drm2/include/linux/list_sort.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/list_sort.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/list_sort.h:1.1.2.2 Wed Jul 24 02:55:48 2013 +++ src/sys/external/bsd/drm2/include/linux/list_sort.h Wed Jul 24 03:13:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: list_sort.h,v 1.1.2.2 2013/07/24 02:55:48 riastradh Exp $ */ +/* $NetBSD: list_sort.h,v 1.1.2.3 2013/07/24 03:13:44 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,6 +34,9 @@ struct list_head; +/* XXX Make the nm output a little more greppable... */ +#define list_sort linux_list_sort + void list_sort(void *, struct list_head *, int (*)(void *, struct list_head *, struct list_head *));
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/acpi
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:12:15 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/acpi [riastradh-drm2]: button.h video.h Log Message: Add Linux and , empty for now. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/acpi/button.h \ src/sys/external/bsd/drm2/include/acpi/video.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/drm2/include/acpi/button.h diff -u /dev/null src/sys/external/bsd/drm2/include/acpi/button.h:1.1.2.1 --- /dev/null Wed Jul 24 03:12:15 2013 +++ src/sys/external/bsd/drm2/include/acpi/button.h Wed Jul 24 03:12:15 2013 @@ -0,0 +1,35 @@ +/* $NetBSD: button.h,v 1.1.2.1 2013/07/24 03:12:15 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _DRM2_COMPAT_ACPI_BUTTON_H_ +#define _DRM2_COMPAT_ACPI_BUTTON_H_ + +#endif /* _DRM2_COMPAT_ACPI_BUTTON_H_ */ Index: src/sys/external/bsd/drm2/include/acpi/video.h diff -u /dev/null src/sys/external/bsd/drm2/include/acpi/video.h:1.1.2.1 --- /dev/null Wed Jul 24 03:12:15 2013 +++ src/sys/external/bsd/drm2/include/acpi/video.h Wed Jul 24 03:12:15 2013 @@ -0,0 +1,45 @@ +/* $NetBSD: video.h,v 1.1.2.1 2013/07/24 03:12:15 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _DRM2_COMPAT_ACPI_VIDEO_H_ +#define _DRM2_COMPAT_ACPI_VIDEO_H_ + +static inline void +acpi_video_register(void) +{ +} + +static inline void +acpi_video_unregister(void) +{ +} + +#endif /* _DRM2_COMPAT_ACPI_VIDEO_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:10:37 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add 16-bit (RMW) pci_{read,write}_config_word to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.8 -r1.1.2.9 \ src/sys/external/bsd/drm2/include/linux/pci.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/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.8 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.9 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.8 Wed Jul 24 03:04:18 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:10:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.8 2013/07/24 03:04:18 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.9 2013/07/24 03:10:37 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -64,15 +64,39 @@ pci_find_capability(struct pci_dev *pdev static inline void pci_read_config_dword(struct pci_dev *pdev, int reg, uint32_t *valuep) { + KASSERT(!ISSET(reg, 3)); *valuep = pci_conf_read(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg); } static inline void pci_write_config_dword(struct pci_dev *pdev, int reg, uint32_t value) { + KASSERT(!ISSET(reg, 3)); pci_conf_write(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg, value); } +static inline void +pci_read_config_word(struct pci_dev *pdev, int reg, uint16_t *valuep) +{ + KASSERT(!ISSET(reg, 1)); + *valuep = pci_conf_read(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, + (reg &~ 3)) >> (ISSET(reg, 3)? 16 : 0); +} + +static inline void +pci_write_config_word(struct pci_dev *pdev, int reg, uint16_t value) +{ + const int reg32 = (reg &~ 3); + const unsigned int shift = (ISSET(reg, 3)? 16 : 0); + uint32_t value32; + + KASSERT(!ISSET(reg, 1)); + pci_read_config_dword(pdev, reg32, &value32); + value32 &=~ (0xUL << shift); + value32 |= (value << shift); + pci_write_config_dword(pdev, reg32, value32); +} + /* * XXX pci msi */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:10:21 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: processor.h Log Message: Add Linux with cpu_relax() (= DELAY(1), for now). To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/asm/processor.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/drm2/include/asm/processor.h diff -u /dev/null src/sys/external/bsd/drm2/include/asm/processor.h:1.1.2.1 --- /dev/null Wed Jul 24 03:10:21 2013 +++ src/sys/external/bsd/drm2/include/asm/processor.h Wed Jul 24 03:10:21 2013 @@ -0,0 +1,39 @@ +/* $NetBSD: processor.h,v 1.1.2.1 2013/07/24 03:10:21 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ASM_PROCESSOR_H_ +#define _ASM_CURRENT_H_ + +#include + +#define cpu_relax() DELAY(1) /* XXX */ + +#endif /* _ASM_PROCESSOR_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:07:48 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: shrinker.h Log Message: Add stub . Abstraction for the system to request that caches be shrunk. Currently does nothing. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/linux/shrinker.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/drm2/include/linux/shrinker.h diff -u /dev/null src/sys/external/bsd/drm2/include/linux/shrinker.h:1.1.2.1 --- /dev/null Wed Jul 24 03:07:48 2013 +++ src/sys/external/bsd/drm2/include/linux/shrinker.h Wed Jul 24 03:07:48 2013 @@ -0,0 +1,54 @@ +/* $NetBSD: shrinker.h,v 1.1.2.1 2013/07/24 03:07:48 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_SHRINKER_H_ +#define _LINUX_SHRINKER_H_ + +struct shrink_control; + +struct shrinker { + int (*shrink)(struct shrinker *, struct shrink_control *); + int seeks; +}; + +#define DEFAULT_SEEKS 2 /* XXX cargo-culted from Linux */ + +static inline void +register_shrinker(struct shrinker *shrinker __unused) +{ +} + +static inline void +unregister_shrinker(struct shrinker *shrinker __unused) +{ +} + +#endif /* _LINUX_SHRINKER_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:08:03 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: drm_wait_netbsd.h Log Message: Add DRM_WAITERS_P and DRM_SPIN_WAITERS_P to drm_wait_netbsd.h. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.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/drm2/include/drm/drm_wait_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.5 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.5 Wed Jul 24 02:36:31 2013 +++ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h Wed Jul 24 03:08:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_wait_netbsd.h,v 1.1.2.5 2013/07/24 02:36:31 riastradh Exp $ */ +/* $NetBSD: drm_wait_netbsd.h,v 1.1.2.6 2013/07/24 03:08:03 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -57,6 +57,13 @@ DRM_DESTROY_WAITQUEUE(drm_waitqueue_t *q cv_destroy(q); } +static inline bool +DRM_WAITERS_P(drm_waitqueue_t *q, struct mutex *interlock) +{ + KASSERT(mutex_is_locked(interlock)); + return cv_has_waiters(q); +} + static inline void DRM_WAKEUP_ONE(drm_waitqueue_t *q, struct mutex *interlock) { @@ -71,6 +78,13 @@ DRM_WAKEUP_ALL(drm_waitqueue_t *q, struc cv_broadcast(q); } +static inline bool +DRM_SPIN_WAITERS_P(drm_waitqueue_t *q, spinlock_t *interlock) +{ + KASSERT(spin_is_locked(interlock)); + return cv_has_waiters(q); +} + static inline void DRM_SPIN_WAKEUP_ONE(drm_waitqueue_t *q, spinlock_t *interlock) {
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:07:28 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: completion.h Log Message: Add . A completion is a synchronized waitable `done' flag. Trivial condvar/mutex/bool. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 \ src/sys/external/bsd/drm2/include/linux/completion.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/drm2/include/linux/completion.h diff -u /dev/null src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.1 --- /dev/null Wed Jul 24 03:07:28 2013 +++ src/sys/external/bsd/drm2/include/linux/completion.h Wed Jul 24 03:07:28 2013 @@ -0,0 +1,91 @@ +/* $NetBSD: completion.h,v 1.1.2.1 2013/07/24 03:07:28 riastradh Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_COMPLETION_H_ +#define _LINUX_COMPLETION_H_ + +#include +#include +#include + +struct completion { + kmutex_t c_lock; + kcondvar_t c_cv; + bool c_done; +}; + +static inline void +INIT_COMPLETION(struct completion *completion) +{ + + mutex_enter(&completion->c_lock); + completion->c_done = false; + mutex_exit(&completion->c_lock); +} + +static inline void +init_completion(struct completion *completion) +{ + + mutex_init(&completion->c_lock, MUTEX_DEFAULT, IPL_NONE); + cv_init(&completion->c_cv, "lnxcmplt"); + completion->c_done = false; +} + +static inline void +complete_all(struct completion *completion) +{ + + mutex_enter(&completion->c_lock); + completion->c_done = true; + cv_broadcast(&completion->c_cv); + mutex_exit(&completion->c_lock); +} + +static inline int +wait_for_completion_interruptible_timeout(struct completion *completion, +unsigned long ticks) +{ + int error = 0; + + mutex_enter(&completion->c_lock); + while (!completion->c_done) { + error = cv_timedwait_sig(&completion->c_cv, + &completion->c_lock, ticks); + if (error) + break; + } + mutex_exit(&completion->c_lock); + + return error; +} + +#endif /* _LINUX_COMPLETION_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:04:18 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add pci_set_master to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \ src/sys/external/bsd/drm2/include/linux/pci.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/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.7 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.8 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.7 Wed Jul 24 03:02:07 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:04:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.7 2013/07/24 03:02:07 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.8 2013/07/24 03:04:18 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -90,6 +90,18 @@ pci_disable_msi(struct pci_dev *pdev) pdev->msi_enabled = false; } +static inline void +pci_set_master(struct pci_dev *pdev) +{ + pcireg_t csr; + + csr = pci_conf_read(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, + PCI_COMMAND_STATUS_REG); + csr |= PCI_COMMAND_MASTER_ENABLE; + pci_conf_write(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, + PCI_COMMAND_STATUS_REG, csr); +} + #define PCIBIOS_MIN_MEM 0 /* XXX bogus x86 kludge bollocks */ static inline bus_addr_t
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:04:04 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h Log Message: Add kludgey non-delayed work to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/external/bsd/drm2/include/linux/workqueue.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/drm2/include/linux/workqueue.h diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.4 Wed Jul 24 02:09:43 2013 +++ src/sys/external/bsd/drm2/include/linux/workqueue.h Wed Jul 24 03:04:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: workqueue.h,v 1.1.2.4 2013/07/24 02:09:43 riastradh Exp $ */ +/* $NetBSD: workqueue.h,v 1.1.2.5 2013/07/24 03:04:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -51,14 +51,19 @@ struct delayed_work { }; static inline void -INIT_DELAYED_WORK(struct delayed_work *dw, void (*fn)(struct work_struct *)) +INIT_WORK(struct work_struct *work, void (*fn)(struct work_struct *)) { - callout_init(&dw->dw_work.ws_callout, 0); + callout_init(&work->ws_callout, 0); /* XXX This cast business is sketchy. */ - callout_setfunc(&dw->dw_work.ws_callout, (void (*)(void *))fn, - &dw->dw_work); + callout_setfunc(&work->ws_callout, (void (*)(void *))fn, work); +} + +static inline void +INIT_DELAYED_WORK(struct delayed_work *dw, void (*fn)(struct work_struct *)) +{ + INIT_WORK(&dw->dw_work, fn); } static inline struct delayed_work * @@ -68,6 +73,12 @@ to_delayed_work(struct work_struct *work } static inline void +schedule_work(struct work_struct *work) +{ + callout_schedule(&work->ws_callout, 0); +} + +static inline void schedule_delayed_work(struct delayed_work *dw, unsigned long ticks) { KASSERT(ticks < INT_MAX); @@ -75,9 +86,46 @@ schedule_delayed_work(struct delayed_wor } static inline void +cancel_work_sync(struct work_struct *work) +{ + callout_halt(&work->ws_callout, NULL); +} + +static inline void cancel_delayed_work_sync(struct delayed_work *dw) { - callout_halt(&dw->dw_work.ws_callout, NULL); + cancel_work_sync(&dw->dw_work); +} + +/* + * XXX Bogus stubs for Linux work queues. + */ + +struct workqueue_struct; + +static inline struct workqueue_struct * +alloc_ordered_workqueue(const char *name __unused, int flags __unused) +{ + return NULL; +} + +static inline void +destroy_workqueue(struct workqueue_struct *wq __unused) +{ +} + +static inline void +queue_work(struct workqueue_struct *wq __unused, struct work_struct *work) +{ + schedule_work(work); +} + +static inline void +queue_delayed_work(struct workqueue_struct *wq __unused, +struct delayed_work *dw, +unsigned int ticks) +{ + schedule_delayed_work(dw, ticks); } #endif /* _LINUX_WORKQUEUE_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:03:37 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Add upper_32_bits and lower_32_bits to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.16 -r1.1.2.17 \ src/sys/external/bsd/drm2/include/linux/kernel.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/drm2/include/linux/kernel.h diff -u src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.16 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.17 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.16 Wed Jul 24 03:01:24 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 03:03:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.16 2013/07/24 03:01:24 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.17 2013/07/24 03:03:37 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -48,6 +48,9 @@ #define round_up(X, Y) roundup2(X, Y) +#define upper_32_bits(X) ((uint32_t) (((X) >> 16) >> 16)) +#define lower_32_bits(X) ((uint32_t) ((X) & 0xUL)) + #define container_of(PTR, TYPE, FIELD) \ ((void)sizeof((PTR) - \ &((TYPE *)(((char *)(PTR)) -\
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:03:50 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: module.h Log Message: Add THIS_MODULE (expanding to 0) to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \ src/sys/external/bsd/drm2/include/linux/module.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/drm2/include/linux/module.h diff -u src/sys/external/bsd/drm2/include/linux/module.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/module.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/module.h:1.1.2.3 Wed Jul 24 02:36:46 2013 +++ src/sys/external/bsd/drm2/include/linux/module.h Wed Jul 24 03:03:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.1.2.3 2013/07/24 02:36:46 riastradh Exp $ */ +/* $NetBSD: module.h,v 1.1.2.4 2013/07/24 03:03:50 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -40,4 +40,6 @@ #define MODULE_LICENSE(LICENSE) #define MODULE_PARM_DESC(PARAMETER, DESCRIPTION) +#define THIS_MODULE 0 + #endif /* _LINUX_MODULE_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:03:23 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: jiffies.h Log Message: Add some conversion and comparison stuff to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \ src/sys/external/bsd/drm2/include/linux/jiffies.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/drm2/include/linux/jiffies.h diff -u src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.2 Wed Jul 24 02:28:22 2013 +++ src/sys/external/bsd/drm2/include/linux/jiffies.h Wed Jul 24 03:03:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: jiffies.h,v 1.1.2.2 2013/07/24 02:28:22 riastradh Exp $ */ +/* $NetBSD: jiffies.h,v 1.1.2.3 2013/07/24 03:03:23 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -37,4 +37,44 @@ #define jiffies hardclock_ticks +static inline unsigned int +msecs_to_jiffies(unsigned int msec) +{ + return mstohz(msec); +} + +static inline unsigned int +usecs_to_jiffies(unsigned int usec) +{ + return mstohz((usec + (1000 / hz) - 1) / (1000 / hz)); +} + +/* XXX long is the wrong type here times... */ + +#define __linux_time_compare(A, OP, B) (((long)(A) - (long)(B)) OP 0) + +static inline bool +time_after(unsigned long a, unsigned long b) +{ + return __linux_time_compare(a, >, b); +} + +static inline bool +time_after_eq(unsigned long a, unsigned long b) +{ + return __linux_time_compare(a, >=, b); +} + +static inline bool +time_before(unsigned long a, unsigned long b) +{ + return __linux_time_compare(a, <, b); +} + +static inline bool +time_before_eq(unsigned long a, unsigned long b) +{ + return __linux_time_compare(a, <=, b); +} + #endif /* _LINUX_JIFFIES_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:03:06 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: delay.h Log Message: Implement udelay (DELAY) and msleep (kpause) in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \ src/sys/external/bsd/drm2/include/linux/delay.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/drm2/include/linux/delay.h diff -u src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/delay.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/delay.h Wed Jul 24 03:03:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: delay.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: delay.h,v 1.1.2.2 2013/07/24 03:03:06 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,17 @@ #ifndef _LINUX_DELAY_H_ #define _LINUX_DELAY_H_ +#include +#include + +#include + +#define udelay DELAY + +static inline void +msleep(unsigned int msec) +{ + (void)kpause("lnxmslep", false, mstohz(msec), NULL); +} + #endif /* _LINUX_DELAY_H_ */