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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:01:38 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add pci_kludgey_find_dev to . This is not a Linux KPI, but the Linux KPI (pci_get_bus_and_slot) doesn't pass along the original pci device or bus, so this is what we'll use to replace uses of it (or, the one use of it) without changing much code. 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/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.4 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.5 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.4 Wed Jul 24 03:01:09 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:01:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.4 2013/07/24 03:01:09 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.5 2013/07/24 03:01:38 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -46,6 +47,7 @@ struct pci_device_id; struct pci_dev { struct pci_bus *bus; struct pci_attach_args pd_pa; + bool pd_kludged; /* XXX pci_kludgey_find_dev hack */ }; #define PCI_CAP_ID_AGP PCI_CAP_AGP @@ -112,4 +114,44 @@ pci_bus_alloc_resource(struct pci_bus *b return 0; } +/* + * XXX Mega-kludgerific! + * + * XXX Doesn't check whether any such device actually exists. + */ + +static inline struct pci_dev * +pci_kludgey_find_dev(struct pci_dev *pdev, int bus, int dev, int func) +{ + struct pci_dev *const otherdev = kmem_zalloc(sizeof(*otherdev), + KM_SLEEP); + +#ifdef DIAGNOSTIC + { + int obus, odev, ofunc; + + pci_decompose_tag(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, &obus, + &odev, &ofunc); + KASSERT(obus == bus); + } +#endif + + otherdev->bus = NULL; /* XXX struct pci_dev::bus */ + otherdev->device = dev; + otherdev->pd_pa = pdev->pd_pa; + otherdev->pd_pa.pa_tag = pci_make_tag(otherdev->pd_pa.pa_pc, + bus, dev, func); + otherdev->pd_kludged = true; + + return otherdev; +} + +static inline void +pci_dev_put(struct pci_dev *pdev) +{ + + KASSERT(pdev->pd_kludged); + kmem_free(pdev, sizeof(*pdev)); +} + #endif /* _LINUX_PCI_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:02:07 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add stubs for pci_enable_msi and pci_disable_msi to . 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/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.6 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.6 Wed Jul 24 03:01:54 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:02:07 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.6 2013/07/24 03:01:54 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.7 2013/07/24 03:02:07 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -49,6 +49,7 @@ struct pci_dev { unsigned int device; struct pci_attach_args pd_pa; bool pd_kludged; /* XXX pci_kludgey_find_dev hack */ + bool msi_enabled; }; #define PCI_CAP_ID_AGP PCI_CAP_AGP @@ -72,6 +73,23 @@ pci_write_config_dword(struct pci_dev *p pci_conf_write(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg, value); } +/* + * XXX pci msi + */ +static inline void +pci_enable_msi(struct pci_dev *pdev) +{ + KASSERT(!pdev->msi_enabled); + pdev->msi_enabled = true; +} + +static inline void +pci_disable_msi(struct pci_dev *pdev) +{ + KASSERT(pdev->msi_enabled); + pdev->msi_enabled = false; +} + #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:01:54 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add field to struct pci_dev for the PCI device number. 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/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.5 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.6 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.5 Wed Jul 24 03:01:38 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:01:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.5 2013/07/24 03:01:38 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.6 2013/07/24 03:01:54 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -46,6 +46,7 @@ struct pci_device_id; 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 */ };
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:01:09 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add pci_bus_alloc_resource 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/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.3 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.4 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.3 Wed Jul 24 03:00:34 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:01:09 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.3 2013/07/24 03:00:34 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.4 2013/07/24 03:01:09 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,11 +32,19 @@ #ifndef _LINUX_PCI_H_ #define _LINUX_PCI_H_ +#include +#include +#include + #include +#include + +struct pci_bus; struct pci_device_id; struct pci_dev { + struct pci_bus *bus; struct pci_attach_args pd_pa; }; @@ -50,15 +58,58 @@ pci_find_capability(struct pci_dev *pdev } static inline void -pci_config_read_dword(struct pci_dev *pdev, int reg, uint32_t *valuep) +pci_read_config_dword(struct pci_dev *pdev, int reg, uint32_t *valuep) { *valuep = pci_conf_read(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg); } static inline void -pci_config_write_dword(struct pci_dev *pdev, int reg, uint32_t value) +pci_write_config_dword(struct pci_dev *pdev, int reg, uint32_t value) { pci_conf_write(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg, value); } +#define PCIBIOS_MIN_MEM 0 /* XXX bogus x86 kludge bollocks */ + +static inline bus_addr_t +pcibios_align_resource(void *p, const struct resource *resource, +bus_addr_t addr, bus_size_t size) +{ + panic("pcibios_align_resource has accessed unaligned neurons!"); +} + +static inline int +pci_bus_alloc_resource(struct pci_bus *bus, struct resource *resource, +bus_size_t size, bus_size_t align, bus_addr_t start, int type __unused, +bus_addr_t (*align_fn)(void *, const struct resource *, bus_addr_t, + bus_size_t) __unused, +struct pci_dev *pdev) +{ + const struct pci_attach_args *const pa = &pdev->pd_pa; + bus_space_tag_t bst; + int error; + + switch (resource->flags) { + case IORESOURCE_MEM: + bst = pa->pa_memt; + break; + + case IORESOURCE_IO: + bst = pa->pa_iot; + break; + + default: + panic("I don't know what kind of resource you want!"); + } + + resource->r_bst = bst; + error = bus_space_alloc(bst, start, 0xULL /* XXX */, + size, align, 0, 0, &resource->start, &resource->r_bsh); + if (error) + return error; + + resource->size = size; + return 0; +} + #endif /* _LINUX_PCI_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:00:34 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: pci.h Log Message: Add pci_config_{read,write}_dword 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/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.2 src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.1.2.2 Wed Jul 24 01:59:37 2013 +++ src/sys/external/bsd/drm2/include/linux/pci.h Wed Jul 24 03:00:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.1.2.2 2013/07/24 01:59:37 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.1.2.3 2013/07/24 03:00:34 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -49,4 +49,16 @@ pci_find_capability(struct pci_dev *pdev NULL, NULL); } +static inline void +pci_config_read_dword(struct pci_dev *pdev, int reg, uint32_t *valuep) +{ + *valuep = pci_conf_read(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg); +} + +static inline void +pci_config_write_dword(struct pci_dev *pdev, int reg, uint32_t value) +{ + pci_conf_write(pdev->pd_pa.pa_pc, pdev->pd_pa.pa_tag, reg, value); +} + #endif /* _LINUX_PCI_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:01:24 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Add __always_unused and round_up to . To generate a diff of this commit: cvs rdiff -u -r1.1.2.15 -r1.1.2.16 \ 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.15 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.15 Wed Jul 24 02:56:17 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 03:01:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.15 2013/07/24 02:56:17 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.16 2013/07/24 03:01:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,16 +34,20 @@ #include #include +#include #define __printf __printflike #define __user #define __must_check /* __attribute__((warn_unused_result)), if GCC */ +#define __always_unused __unused #define barrier() __insn_barrier() #define unlikely(X) __predict_false(X) #define uninitialized_var(x) x +#define round_up(X, Y) roundup2(X, Y) + #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:00:55 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: ioport.h Log Message: Add with struct resource: keeps bus_space_alloc books. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/linux/ioport.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/ioport.h diff -u /dev/null src/sys/external/bsd/drm2/include/linux/ioport.h:1.1.2.1 --- /dev/null Wed Jul 24 03:00:55 2013 +++ src/sys/external/bsd/drm2/include/linux/ioport.h Wed Jul 24 03:00:55 2013 @@ -0,0 +1,56 @@ +/* $NetBSD: ioport.h,v 1.1.2.1 2013/07/24 03:00:55 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_IOPORT_H_ +#define _LINUX_IOPORT_H_ + +#include +#include + +#define IORESOURCE_IO 0 +#define IORESOURCE_MEM 1 + +struct resource { + bus_addr_t start; + bus_size_t size; + const char *name; + unsigned int flags; + bus_space_tag_t r_bst; /* This milk is not organic. */ + bus_space_handle_t r_bsh; +}; + +static inline void +release_resource(struct resource *resource) +{ + bus_space_free(resource->r_bst, resource->r_bsh, resource->size); +} + +#endif /* _LINUX_IOPORT_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 03:00:03 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: acpi_io.h Log Message: Fill in with acpi_os_ioremap (= AcpiOsMapMemory). Define __acpi_iomem as an empty frotz to replace the Linux __iomem attribute selectively and greppably. AcpiOsMapMemory returns usable kernel virtual addresses, so we don't need to use bus_space_mumble or anything to dereference them. 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/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.1 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.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/acpi_io.h Wed Jul 24 03:00:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_io.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: acpi_io.h,v 1.1.2.2 2013/07/24 03:00:03 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,9 @@ #ifndef _LINUX_ACPI_IO_H_ #define _LINUX_ACPI_IO_H_ +#include + +#define acpi_os_ioremap AcpiOsMapMemory +#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 02:57:38 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: device.h Log Message: Add dev_warn (= device_printf, for now) 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/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.1 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.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/device.h Wed Jul 24 02:57:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: device.h,v 1.1.2.2 2013/07/24 02:57:38 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,9 @@ #ifndef _LINUX_DEVICE_H_ #define _LINUX_DEVICE_H_ +#include +#include + +#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 02:56:17 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Define uninitialized_var in . 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/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.14 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.15 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.14 Wed Jul 24 02:54:23 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 02:56:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.14 2013/07/24 02:54:23 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.15 2013/07/24 02:56:17 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -42,6 +42,8 @@ #define barrier() __insn_barrier() #define unlikely(X) __predict_false(X) +#define uninitialized_var(x) x + #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 02:54:38 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: fb.h Log Message: Define PICOS2KHZ and KHZ2PICOS 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/fb.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/fb.h diff -u src/sys/external/bsd/drm2/include/linux/fb.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/fb.h:1.1.2.2 --- src/sys/external/bsd/drm2/include/linux/fb.h:1.1.2.1 Wed Jul 24 00:33:12 2013 +++ src/sys/external/bsd/drm2/include/linux/fb.h Wed Jul 24 02:54:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: fb.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */ +/* $NetBSD: fb.h,v 1.1.2.2 2013/07/24 02:54:38 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,7 @@ #ifndef _LINUX_FB_H_ #define _LINUX_FB_H_ +#define PICOS2KHZ(PICOS) (10ul / (PICOS)) +#define KHZ2PICOS(KHZ) (10ul / (KHZ)) + #endif /* _LINUX_FB_H_ */
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:54:23 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Include just , not , in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.13 -r1.1.2.14 \ 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.13 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.14 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.13 Wed Jul 24 02:50:22 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 02:54:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.13 2013/07/24 02:50:22 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.14 2013/07/24 02:54:23 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #define _LINUX_KERNEL_H_ #include -#include +#include #define __printf __printflike #define __user
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:51:06 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: mm.h Log Message: Use e_vm_default_addr to choose a default address in Linux vm_mmap. 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/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.2 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.2 Wed Jul 24 02:04:31 2013 +++ src/sys/external/bsd/drm2/include/linux/mm.h Wed Jul 24 02:51:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mm.h,v 1.1.2.2 2013/07/24 02:04:31 riastradh Exp $ */ +/* $NetBSD: mm.h,v 1.1.2.3 2013/07/24 02:51:06 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ vm_mmap(struct file *file, unsigned long unsigned long prot, unsigned long flags, unsigned long token) { struct vnode *vnode; - vaddr_t addr = 0; + vaddr_t addr; int error; /* @@ -94,6 +94,8 @@ vm_mmap(struct file *file, unsigned long /* XXX pax_mprotect? pax_aslr? */ + addr = (*curproc->p_emul->e_vm_default_addr)(curproc, + (vaddr_t)curproc->p_vmspace->vm_daddr, size); error = uvm_mmap(&curproc->p_vmspace->vm_map, &addr, size, (VM_PROT_READ | VM_PROT_WRITE), (VM_PROT_READ | VM_PROT_WRITE), MAP_SHARED, vnode, base,
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:50:51 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: types.h Log Message: Use bus_addr_t, not bus_size_t, for resource_size_t; add phys_addr_t. 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/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/types.h diff -u src/sys/external/bsd/drm2/include/linux/types.h:1.1.2.6 src/sys/external/bsd/drm2/include/linux/types.h:1.1.2.7 --- src/sys/external/bsd/drm2/include/linux/types.h:1.1.2.6 Wed Jul 24 02:12:29 2013 +++ src/sys/external/bsd/drm2/include/linux/types.h Wed Jul 24 02:50:51 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.1.2.6 2013/07/24 02:12:29 riastradh Exp $ */ +/* $NetBSD: types.h,v 1.1.2.7 2013/07/24 02:50:51 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -49,7 +49,13 @@ typedef uint16_t __le16; typedef uint32_t __le32; typedef uint64_t __le64; -typedef bus_size_t resource_size_t; +/* + * This is used for absolute bus addresses, so it has to be bus_addr_t + * and not bus_size_t; bus_addr_t is sometimes wider than bus_size_t. + */ +typedef bus_addr_t resource_size_t; + +typedef paddr_t phys_addr_t; /* XXX Is this the right type? */ typedef unsigned long long cycles_t;
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:50:36 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: spinlock.h Log Message: Tag the spinlock struct in . 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/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.5 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.5 Wed Jul 24 02:24:58 2013 +++ src/sys/external/bsd/drm2/include/linux/spinlock.h Wed Jul 24 02:50:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: spinlock.h,v 1.1.2.5 2013/07/24 02:24:58 riastradh Exp $ */ +/* $NetBSD: spinlock.h,v 1.1.2.6 2013/07/24 02:50:36 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #include -typedef struct { +typedef struct spinlock { kmutex_t sl_lock; } spinlock_t;
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:50:22 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Define barrier() as __insn_barrier() in . To generate a diff of this commit: cvs rdiff -u -r1.1.2.12 -r1.1.2.13 \ 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.12 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.13 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.12 Wed Jul 24 02:50:07 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 02:50:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.12 2013/07/24 02:50:07 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.13 2013/07/24 02:50:22 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -39,6 +39,7 @@ #define __user #define __must_check /* __attribute__((warn_unused_result)), if GCC */ +#define barrier() __insn_barrier() #define unlikely(X) __predict_false(X) #define container_of(PTR, TYPE, FIELD) \
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:50:07 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Add stub definition of __must_check 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/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.11 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.12 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.11 Wed Jul 24 02:49:52 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 02:50:07 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.11 2013/07/24 02:49:52 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.12 2013/07/24 02:50:07 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -37,6 +37,7 @@ #define __printf __printflike #define __user +#define __must_check /* __attribute__((warn_unused_result)), if GCC */ #define unlikely(X) __predict_false(X)
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:49:52 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kernel.h Log Message: Make container_of type-safe with the help of a judicious sizeof. Still avoids multiple evaluation of the pointer operand expression. 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/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.10 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.11 --- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.10 Wed Jul 24 02:28:07 2013 +++ src/sys/external/bsd/drm2/include/linux/kernel.h Wed Jul 24 02:49:52 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kernel.h,v 1.1.2.10 2013/07/24 02:28:07 riastradh Exp $ */ +/* $NetBSD: kernel.h,v 1.1.2.11 2013/07/24 02:49:52 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -41,7 +41,10 @@ #define unlikely(X) __predict_false(X) #define container_of(PTR, TYPE, FIELD) \ - ((TYPE *)(((char *)(PTR)) - offsetof(TYPE, FIELD))) + ((void)sizeof((PTR) - \ + &((TYPE *)(((char *)(PTR)) -\ + offsetof(TYPE, FIELD)))->FIELD), \ + ((TYPE *)(((char *)(PTR)) - offsetof(TYPE, FIELD #define ARRAY_SIZE(ARRAY) __arraycount(ARRAY)
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:37:36 UTC 2013 Added Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: printk.h Log Message: Add . To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 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. Added files: Index: src/sys/external/bsd/drm2/include/linux/printk.h diff -u /dev/null src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.1 --- /dev/null Wed Jul 24 02:37:36 2013 +++ src/sys/external/bsd/drm2/include/linux/printk.h Wed Jul 24 02:37:36 2013 @@ -0,0 +1,43 @@ +/* $NetBSD: printk.h,v 1.1.2.1 2013/07/24 02:37:36 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_PRINTK_H_ +#define _LINUX_PRINTK_H_ + +#include + +#define printk printf +#define vprintk vprintf +#define KERN_DEBUG "drm kern debug: " +#define KERN_WARNING "drm kern warning: " +#define KERN_ERR "drm kern error: " + +#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 02:37:49 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: list.h Log Message: Rename fields of struct list_head to match Linux. Linux code uses the fields by name, not by list_next and list_prev accessors, so we'd better match. hlist may need this too. 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/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.10 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.10 Wed Jul 24 02:36:18 2013 +++ src/sys/external/bsd/drm2/include/linux/list.h Wed Jul 24 02:37:49 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: list.h,v 1.1.2.10 2013/07/24 02:36:18 riastradh Exp $ */ +/* $NetBSD: list.h,v 1.1.2.11 2013/07/24 02:37:49 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -42,98 +42,98 @@ */ struct list_head { - struct list_head *lh_prev; - struct list_head *lh_next; + struct list_head *prev; + struct list_head *next; }; -#define LIST_HEAD_INIT(name) { .lh_prev = &(name), .lh_next = &(name) } +#define LIST_HEAD_INIT(name) { .prev = &(name), .next = &(name) } static inline void INIT_LIST_HEAD(struct list_head *head) { - head->lh_prev = head; - head->lh_next = head; + head->prev = head; + head->next = head; } static inline struct list_head * list_first(const struct list_head *head) { - return head->lh_next; + return head->next; } static inline struct list_head * list_next(const struct list_head *node) { - return node->lh_next; + return node->next; } static inline struct list_head * list_prev(const struct list_head *node) { - return node->lh_prev; + return node->prev; } static inline int list_empty(const struct list_head *head) { - return (head->lh_next == head); + return (head->next == head); } static inline void __list_add_between(struct list_head *prev, struct list_head *node, struct list_head *next) { - prev->lh_next = node; - node->lh_prev = prev; - node->lh_next = next; - next->lh_prev = node; + prev->next = node; + node->prev = prev; + node->next = next; + next->prev = node; } static inline void list_add(struct list_head *node, struct list_head *head) { - __list_add_between(head, node, head->lh_next); + __list_add_between(head, node, head->next); } static inline void list_add_tail(struct list_head *node, struct list_head *head) { - __list_add_between(head->lh_prev, node, head); + __list_add_between(head->prev, node, head); } static inline void list_del(struct list_head *entry) { - entry->lh_prev->lh_next = entry->lh_next; - entry->lh_next->lh_prev = entry->lh_prev; + entry->prev->next = entry->next; + entry->next->prev = entry->prev; } static inline void __list_splice_between(struct list_head *prev, const struct list_head *list, struct list_head *next) { - struct list_head *first = list->lh_next; - struct list_head *last = list->lh_prev; + struct list_head *first = list->next; + struct list_head *last = list->prev; - first->lh_prev = prev; - prev->lh_next = first; + first->prev = prev; + prev->next = first; - last->lh_next = next; - next->lh_prev = last; + last->next = next; + next->prev = last; } static inline void list_splice(const struct list_head *list, struct list_head *head) { if (!list_empty(list)) - __list_splice_between(head, list, head->lh_next); + __list_splice_between(head, list, head->next); } static inline void list_splice_tail(const struct list_head *list, struct list_head *head) { if (!list_empty(list)) - __list_splice_between(head->lh_prev, list, head); + __list_splice_between(head->prev, list, head); } static inline void @@ -153,10 +153,10 @@ list_move_tail(struct list_head *node, s static inline void list_replace(struct list_head *old, struct list_head *new) { - new->lh_prev = old->lh_prev; - old->lh_prev->lh_next = new; - new->lh_next = old->lh_next; - old->lh_next->lh_prev = new; + new->prev = old->prev; + old->prev->next = new; + new->next = old->next; + old->next->prev = new; } #define list_entry(PTR, TYPE, FIELD) container_of(PTR, TYPE, FIELD)
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:36:46 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: module.h Log Message: Add some Linuxy MODULE_* stubs 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/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.2 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.2 Wed Jul 24 02:10:45 2013 +++ src/sys/external/bsd/drm2/include/linux/module.h Wed Jul 24 02:36:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.1.2.2 2013/07/24 02:10:45 riastradh Exp $ */ +/* $NetBSD: module.h,v 1.1.2.3 2013/07/24 02:36:46 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,4 +35,9 @@ #define module_init(INIT) #define module_exit(EXIT) +#define MODULE_AUTHOR(AUTHOR) +#define MODULE_DESCRIPTION(DESCRIPTION) +#define MODULE_LICENSE(LICENSE) +#define MODULE_PARM_DESC(PARAMETER, DESCRIPTION) + #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 02:37:13 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: slab.h Log Message: Add GFP_ATOMIC, meaning M_NOWAIT, 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/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.4 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.4 Wed Jul 24 02:24:44 2013 +++ src/sys/external/bsd/drm2/include/linux/slab.h Wed Jul 24 02:37:13 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: slab.h,v 1.1.2.4 2013/07/24 02:24:44 riastradh Exp $ */ +/* $NetBSD: slab.h,v 1.1.2.5 2013/07/24 02:37:13 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -41,6 +41,7 @@ /* XXX Should use kmem, but Linux kfree doesn't take the size. */ #define GFP_KERNEL M_WAITOK +#define GFP_ATOMIC M_NOWAIT static inline void * kmalloc(size_t size, int flags)
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:37:00 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: mutex.h Log Message: Add linux_mutex_destroy 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/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.4 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.4 Wed Jul 24 02:10:15 2013 +++ src/sys/external/bsd/drm2/include/linux/mutex.h Wed Jul 24 02:37:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mutex.h,v 1.1.2.4 2013/07/24 02:10:15 riastradh Exp $ */ +/* $NetBSD: mutex.h,v 1.1.2.5 2013/07/24 02:37:00 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -45,6 +45,13 @@ linux_mutex_init(struct mutex *mutex) mutex_init(&mutex->mtx_lock, MUTEX_DEFAULT, IPL_NONE); } +/* Another name collision. */ +static inline void +linux_mutex_destroy(struct mutex *mutex) +{ + mutex_destroy(&mutex->mtx_lock); +} + static inline void mutex_lock(struct mutex *mutex) {
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:36:18 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: list.h Log Message: Add list_prev to . 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/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.9 src/sys/external/bsd/drm2/include/linux/list.h:1.1.2.10 --- src/sys/external/bsd/drm2/include/linux/list.h:1.1.2.9 Wed Jul 24 02:36:04 2013 +++ src/sys/external/bsd/drm2/include/linux/list.h Wed Jul 24 02:36:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: list.h,v 1.1.2.9 2013/07/24 02:36:04 riastradh Exp $ */ +/* $NetBSD: list.h,v 1.1.2.10 2013/07/24 02:36:18 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -67,6 +67,12 @@ list_next(const struct list_head *node) return node->lh_next; } +static inline struct list_head * +list_prev(const struct list_head *node) +{ + return node->lh_prev; +} + static inline int list_empty(const struct list_head *head) {
CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Wed Jul 24 02:35:49 UTC 2013 Modified Files: src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: i2c.h Log Message: Include before 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/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.2 src/sys/external/bsd/drm2/include/linux/i2c.h:1.1.2.3 --- src/sys/external/bsd/drm2/include/linux/i2c.h:1.1.2.2 Wed Jul 24 01:52:39 2013 +++ src/sys/external/bsd/drm2/include/linux/i2c.h Wed Jul 24 02:35:49 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.h,v 1.1.2.2 2013/07/24 01:52:39 riastradh Exp $ */ +/* $NetBSD: i2c.h,v 1.1.2.3 2013/07/24 02:35:49 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,6 +32,7 @@ #ifndef _LINUX_I2C_H_ #define _LINUX_I2C_H_ +#include #include struct i2c_adapter {