CVS commit: src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Mon May 31 10:33:04 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/asm: processor.h src/sys/external/bsd/drm2/include/linux: delay.h Log Message: drm: sys/param.h, not machine/param.h, for DELAY. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/asm/processor.h cvs rdiff -u -r1.6 -r1.7 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/asm/processor.h diff -u src/sys/external/bsd/drm2/include/asm/processor.h:1.3 src/sys/external/bsd/drm2/include/asm/processor.h:1.4 --- src/sys/external/bsd/drm2/include/asm/processor.h:1.3 Wed Sep 17 15:46:57 2014 +++ src/sys/external/bsd/drm2/include/asm/processor.h Mon May 31 10:33:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: processor.h,v 1.3 2014/09/17 15:46:57 riastradh Exp $ */ +/* $NetBSD: processor.h,v 1.4 2021/05/31 10:33:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #ifndef _ASM_PROCESSOR_H_ #define _ASM_PROCESSOR_H_ -#include +#include #define cpu_relax() DELAY(1) /* XXX */ Index: src/sys/external/bsd/drm2/include/linux/delay.h diff -u src/sys/external/bsd/drm2/include/linux/delay.h:1.6 src/sys/external/bsd/drm2/include/linux/delay.h:1.7 --- src/sys/external/bsd/drm2/include/linux/delay.h:1.6 Fri Feb 14 09:35:40 2020 +++ src/sys/external/bsd/drm2/include/linux/delay.h Mon May 31 10:33:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: delay.h,v 1.6 2020/02/14 09:35:40 riastradh Exp $ */ +/* $NetBSD: delay.h,v 1.7 2021/05/31 10:33:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,8 +36,6 @@ #include #include -#include - #define MAX_UDELAY_MS 5 static inline void
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: mrg Date: Thu Feb 20 09:07:39 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/drm: bus_dma_hacks.h Log Message: in bus_dmamap_load_pglist() try a 32-element array of bus_dma_segment_t's before attempting to allocate. this hopefully avoids hangs i've had in X since updating from netbsd-8 to netbsd-9 that i've tracked down to this function failing with ENOMEM. XXX: maybe can avoid the alloc entirely by batching these calls in 32 segments each. XXX pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 \ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h diff -u src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.19 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.20 --- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.19 Wed Jan 22 07:53:45 2020 +++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Thu Feb 20 09:07:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma_hacks.h,v 1.19 2020/01/22 07:53:45 jmcneill Exp $ */ +/* $NetBSD: bus_dma_hacks.h,v 1.20 2020/02/20 09:07:39 mrg Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -118,12 +118,15 @@ bus_dmatag_bounces_paddr(bus_dma_tag_t d #endif } +#define MAX_STACK_SEGS 32 /* XXXMRG: 512 bytes on 16 byte seg platforms */ + static inline int bus_dmamap_load_pglist(bus_dma_tag_t tag, bus_dmamap_t map, struct pglist *pglist, bus_size_t size, int flags) { km_flag_t kmflags; bus_dma_segment_t *segs; + bus_dma_segment_t stacksegs[MAX_STACK_SEGS]; int nsegs, seg; struct vm_page *page; int error; @@ -136,14 +139,23 @@ bus_dmamap_load_pglist(bus_dma_tag_t tag } KASSERT(nsegs <= (SIZE_MAX / sizeof(segs[0]))); - switch (flags & (BUS_DMA_WAITOK|BUS_DMA_NOWAIT)) { - case BUS_DMA_WAITOK: kmflags = KM_SLEEP; break; - case BUS_DMA_NOWAIT: kmflags = KM_NOSLEEP; break; - default: panic("invalid flags: %d", flags); - } - segs = kmem_alloc((nsegs * sizeof(segs[0])), kmflags); - if (segs == NULL) - return ENOMEM; + if (nsegs > MAX_STACK_SEGS) { + switch (flags & (BUS_DMA_WAITOK|BUS_DMA_NOWAIT)) { + case BUS_DMA_WAITOK: + kmflags = KM_SLEEP; + break; + case BUS_DMA_NOWAIT: + kmflags = KM_NOSLEEP; + break; + default: + panic("invalid flags: %d", flags); + } + segs = kmem_alloc((nsegs * sizeof(segs[0])), kmflags); + if (segs == NULL) + return ENOMEM; + } else { + segs = stacksegs; + } seg = 0; TAILQ_FOREACH(page, pglist, pageq.queue) { @@ -166,7 +178,10 @@ bus_dmamap_load_pglist(bus_dma_tag_t tag fail1: __unused bus_dmamap_unload(tag, map); fail0: KASSERT(error); -out: kmem_free(segs, (nsegs * sizeof(segs[0]))); +out: if (segs != stacksegs) { + KASSERT(nsegs > MAX_STACK_SEGS); + kmem_free(segs, (nsegs * sizeof(segs[0]))); + } return error; }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: tnn Date: Fri Feb 14 18:17:23 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: FENCE_TRACE is __printflike To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.15 src/sys/external/bsd/drm2/include/linux/fence.h:1.16 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.15 Mon Aug 27 14:20:41 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Fri Feb 14 18:17:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.15 2018/08/27 14:20:41 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.16 2020/02/14 18:17:23 tnn Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -127,7 +127,7 @@ long fence_wait(struct fence *, bool); long fence_wait_any_timeout(struct fence **, uint32_t, bool, long); long fence_wait_timeout(struct fence *, bool, long); -static inline void +static inline void __printflike(2, 3) FENCE_TRACE(struct fence *f, const char *fmt, ...) { va_list va;
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: tnn Date: Fri Feb 14 16:02:41 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/linux: capability.h Log Message: fix a typo, caught by -Werror,-Wheader-guard To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/capability.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/capability.h diff -u src/sys/external/bsd/drm2/include/linux/capability.h:1.1 src/sys/external/bsd/drm2/include/linux/capability.h:1.2 --- src/sys/external/bsd/drm2/include/linux/capability.h:1.1 Fri Feb 14 04:36:56 2020 +++ src/sys/external/bsd/drm2/include/linux/capability.h Fri Feb 14 16:02:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: capability.h,v 1.1 2020/02/14 04:36:56 riastradh Exp $ */ +/* $NetBSD: capability.h,v 1.2 2020/02/14 16:02:41 tnn Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #ifndef _LINUX_CAPABILITY_H_ -#define _LINUX_CAPABILITy_H_ +#define _LINUX_CAPABILITY_H_ #include
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Fri Feb 14 09:35:40 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/linux: delay.h Log Message: Placate -Wsign-compare. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.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.5 src/sys/external/bsd/drm2/include/linux/delay.h:1.6 --- src/sys/external/bsd/drm2/include/linux/delay.h:1.5 Mon Aug 6 00:30:24 2018 +++ src/sys/external/bsd/drm2/include/linux/delay.h Fri Feb 14 09:35:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: delay.h,v 1.5 2018/08/06 00:30:24 riastradh Exp $ */ +/* $NetBSD: delay.h,v 1.6 2020/02/14 09:35:40 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ static inline void msleep(unsigned int msec) { if (cold || - ((hz < 1000) && (msec < (1000/hz + ((hz < 1000) && (msec < (1000/(unsigned)hz mdelay(msec); else (void)kpause("lnxmslep", false, mstohz(msec), NULL);
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: jmcneill Date: Wed Jan 22 07:53:45 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/drm: bus_dma_hacks.h Log Message: Fix PHYS_TO_BUS_MEM and BUS_MEM_TO_PHYS on arm and aarch64 To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 \ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h diff -u src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.18 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.19 --- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.18 Tue Nov 5 23:27:23 2019 +++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Wed Jan 22 07:53:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma_hacks.h,v 1.18 2019/11/05 23:27:23 jmcneill Exp $ */ +/* $NetBSD: bus_dma_hacks.h,v 1.19 2020/01/22 07:53:45 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ PHYS_TO_BUS_MEM(bus_dma_tag_t dmat, padd const struct arm32_dma_range *dr = &dmat->_ranges[i]; if (dr->dr_sysbase <= pa && pa - dr->dr_sysbase <= dr->dr_len) - return dr->dr_busbase + (dr->dr_sysbase - pa); + return pa - dr->dr_sysbase + dr->dr_busbase; } panic("paddr has no bus address in dma tag %p: %"PRIxPADDR, dmat, pa); } @@ -74,7 +74,7 @@ BUS_MEM_TO_PHYS(bus_dma_tag_t dmat, bus_ const struct arm32_dma_range *dr = &dmat->_ranges[i]; if (dr->dr_busbase <= ba && ba - dr->dr_busbase <= dr->dr_len) - return dr->dr_sysbase + (dr->dr_busbase - ba); + return ba - dr->dr_busbase + dr->dr_sysbase; } panic("bus addr has no bus address in dma tag %p: %"PRIxPADDR, dmat, ba);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: skrll Date: Sun Jan 19 15:31:56 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/linux: mm.h Log Message: Fix build on aarch64 by including uvm_object.h. OK from Riastradh To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/external/bsd/drm2/include/linux/mm.h:1.12 --- src/sys/external/bsd/drm2/include/linux/mm.h:1.11 Fri Jan 17 20:09:47 2020 +++ src/sys/external/bsd/drm2/include/linux/mm.h Sun Jan 19 15:31:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mm.h,v 1.11 2020/01/17 20:09:47 ad Exp $ */ +/* $NetBSD: mm.h,v 1.12 2020/01/19 15:31:56 skrll Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,6 +35,7 @@ #include #include +#include #include #include
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: jmcneill Date: Sat Jan 18 03:00:04 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/linux: acpi.h pci.h Log Message: Pull in acpica.h on aarch64 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/acpi.h cvs rdiff -u -r1.37 -r1.38 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/acpi.h diff -u src/sys/external/bsd/drm2/include/linux/acpi.h:1.4 src/sys/external/bsd/drm2/include/linux/acpi.h:1.5 --- src/sys/external/bsd/drm2/include/linux/acpi.h:1.4 Sat Oct 17 21:07:23 2015 +++ src/sys/external/bsd/drm2/include/linux/acpi.h Sat Jan 18 03:00:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.h,v 1.4 2015/10/17 21:07:23 jmcneill Exp $ */ +/* $NetBSD: acpi.h,v 1.5 2020/01/18 03:00:04 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #define _LINUX_ACPI_H_ #ifdef _KERNEL_OPT -#if defined(__i386__) || defined(__x86_64__) +#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) #include "acpica.h" #else #define NACPICA 0 Index: src/sys/external/bsd/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.37 src/sys/external/bsd/drm2/include/linux/pci.h:1.38 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.37 Mon Aug 27 14:16:38 2018 +++ src/sys/external/bsd/drm2/include/linux/pci.h Sat Jan 18 03:00:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.37 2018/08/27 14:16:38 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.38 2020/01/18 03:00:04 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #define _LINUX_PCI_H_ #ifdef _KERNEL_OPT -#if defined(i386) || defined(amd64) +#if defined(i386) || defined(amd64) || defined(__aarch64__) #include "acpica.h" #else /* !(i386 || amd64) */ #define NACPICA 0
CVS commit: src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: jmcneill Date: Sat Jan 18 02:42:23 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/asm: io.h Log Message: memset_io works with bytes not dwords, noted by riastradh@ To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/asm/io.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/asm/io.h diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.5 src/sys/external/bsd/drm2/include/asm/io.h:1.6 --- src/sys/external/bsd/drm2/include/asm/io.h:1.5 Fri Jan 17 20:28:59 2020 +++ src/sys/external/bsd/drm2/include/asm/io.h Sat Jan 18 02:42:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: io.h,v 1.5 2020/01/17 20:28:59 jmcneill Exp $ */ +/* $NetBSD: io.h,v 1.6 2020/01/18 02:42:23 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -51,12 +51,13 @@ static inline void * memset_io(void *b, int c, size_t len) { - uint32_t *ptr = b; - while (len >= 4) { + uint8_t *ptr = b; + + while (len > 0) { *ptr++ = c; - len -= 4; + len--; } - KASSERT(len == 0); + return b; } #else
CVS commit: src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: jmcneill Date: Fri Jan 17 20:28:59 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/asm: io.h Log Message: Don't use memset as memset_io on aarch64. With c=0 it uses the "dc zva" cache maintenance instruction as an optimization which does not work on device memory. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/asm/io.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/asm/io.h diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.4 src/sys/external/bsd/drm2/include/asm/io.h:1.5 --- src/sys/external/bsd/drm2/include/asm/io.h:1.4 Wed Feb 25 14:56:17 2015 +++ src/sys/external/bsd/drm2/include/asm/io.h Fri Jan 17 20:28:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: io.h,v 1.4 2015/02/25 14:56:17 riastradh Exp $ */ +/* $NetBSD: io.h,v 1.5 2020/01/17 20:28:59 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -46,7 +46,22 @@ #define memcpy_fromio memcpy #define memcpy_toio memcpy + +#if defined(__NetBSD__) && defined(__aarch64__) +static inline void * +memset_io(void *b, int c, size_t len) +{ + uint32_t *ptr = b; + while (len >= 4) { + *ptr++ = c; + len -= 4; + } + KASSERT(len == 0); + return b; +} +#else #define memset_io memset +#endif /* XXX wrong place */ #define __force
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: ad Date: Fri Jan 17 20:09:47 UTC 2020 Modified Files: src/sys/external/bsd/drm2/include/linux: mm.h Log Message: set_page_dirty: take the vmobjlock if present To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/external/bsd/drm2/include/linux/mm.h:1.11 --- src/sys/external/bsd/drm2/include/linux/mm.h:1.10 Wed Jan 15 17:55:44 2020 +++ src/sys/external/bsd/drm2/include/linux/mm.h Fri Jan 17 20:09:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mm.h,v 1.10 2020/01/15 17:55:44 ad Exp $ */ +/* $NetBSD: mm.h,v 1.11 2020/01/17 20:09:47 ad Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -95,8 +95,16 @@ kvfree(void *ptr) static inline void set_page_dirty(struct page *page) { + struct vm_page *pg = &page->p_vmp; - uvm_pagemarkdirty(&page->p_vmp, UVM_PAGE_STATUS_DIRTY); + /* XXX */ + if (pg->uobject != NULL) { + mutex_enter(pg->uobject->vmobjlock); + uvm_pagemarkdirty(pg, UVM_PAGE_STATUS_DIRTY); + mutex_exit(pg->uobject->vmobjlock); + } else { + uvm_pagemarkdirty(pg, UVM_PAGE_STATUS_DIRTY); + } } #endif /* _LINUX_MM_H_ */
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: maya Date: Sun Apr 7 20:28:41 UTC 2019 Modified Files: src/sys/external/bsd/drm2/include/drm: drm_os_netbsd.h Removed Files: src/sys/external/bsd/drm2/include/drm: drm_copy_netbsd.h Log Message: Remove unused definitions. (These appear to have existed in old-drm) To generate a diff of this commit: cvs rdiff -u -r1.2 -r0 \ src/sys/external/bsd/drm2/include/drm/drm_copy_netbsd.h cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.13 src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.14 --- src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.13 Tue Aug 28 03:41:39 2018 +++ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Sun Apr 7 20:28:41 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_os_netbsd.h,v 1.13 2018/08/28 03:41:39 riastradh Exp $ */ +/* $NetBSD: drm_os_netbsd.h,v 1.14 2019/04/07 20:28:41 maya Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -69,7 +69,6 @@ #include #include -#include #include #include
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: tnn Date: Fri Jan 4 20:22:32 UTC 2019 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree.h Log Message: interval_tree_iter_next: check the node we return, not the prev one. Also assert that the interval is intersecting the requested boundary. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/drm2/include/linux/interval_tree.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/interval_tree.h diff -u src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.7 src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.8 --- src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.7 Tue Aug 28 03:34:53 2018 +++ src/sys/external/bsd/drm2/include/linux/interval_tree.h Fri Jan 4 20:22:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: interval_tree.h,v 1.7 2018/08/28 03:34:53 riastradh Exp $ */ +/* $NetBSD: interval_tree.h,v 1.8 2019/01/04 20:22:32 tnn Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -119,9 +119,9 @@ interval_tree_iter_first(struct rb_root node = rb_tree_find_node_geq(&root->rbr_tree, &start); if (node == NULL) return NULL; - KASSERT(node->start <= start); if (last < node->start) return NULL; + KASSERT(node->start <= last && node->last >= start); return node; } @@ -141,9 +141,9 @@ interval_tree_iter_next(struct rb_root * next = rb_tree_iterate(&root->rbr_tree, node, RB_DIR_RIGHT); if (next == NULL) return NULL; - KASSERT(node->start <= start); - if (last < node->start) + if (last < next->start) return NULL; + KASSERT(next->start <= last && next->last >= start); return next; }
CVS commit: src/sys/external/bsd/drm2/include/linux/regulator
Module Name:src Committed By: maya Date: Mon Nov 19 10:48:59 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux/regulator: consumer.h Log Message: include machine/limits.h for INT_MAX To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/drm2/include/linux/regulator/consumer.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/regulator/consumer.h diff -u src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.4 src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.5 --- src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.4 Mon Aug 27 15:29:54 2018 +++ src/sys/external/bsd/drm2/include/linux/regulator/consumer.h Mon Nov 19 10:48:59 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: consumer.h,v 1.4 2018/08/27 15:29:54 riastradh Exp $ */ +/* $NetBSD: consumer.h,v 1.5 2018/11/19 10:48:59 maya Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -38,6 +38,7 @@ #ifdef FDT +#include #include struct regulator {
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 23 03:56:33 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: DELAY takes microseconds, not ticks. XXX pullup-7 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/include/linux/sched.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/sched.h diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.10 src/sys/external/bsd/drm2/include/linux/sched.h:1.11 --- src/sys/external/bsd/drm2/include/linux/sched.h:1.10 Mon Aug 27 07:47:11 2018 +++ src/sys/external/bsd/drm2/include/linux/sched.h Tue Oct 23 03:56:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sched.h,v 1.10 2018/08/27 07:47:11 riastradh Exp $ */ +/* $NetBSD: sched.h,v 1.11 2018/10/23 03:56:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -60,7 +60,16 @@ schedule_timeout_uninterruptible(long ti int start, end; if (cold) { - DELAY(timeout); + unsigned us; + if (hz <= 1000) { + unsigned ms = hztoms(MIN(timeout, mstohz(INT_MAX))); + us = MIN(ms, INT_MAX/1000)*1000; + } else if (hz <= 100) { + us = MIN(timeout, (INT_MAX/100)/hz)*hz*100; + } else { + us = timeout/(100/hz); + } + DELAY(us); return 0; }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 23 03:56:48 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: Clamp timeout to INT_MAX to avoid the bad kind of integer truncation. XXX pullup-7 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/include/linux/sched.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/sched.h diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.11 src/sys/external/bsd/drm2/include/linux/sched.h:1.12 --- src/sys/external/bsd/drm2/include/linux/sched.h:1.11 Tue Oct 23 03:56:33 2018 +++ src/sys/external/bsd/drm2/include/linux/sched.h Tue Oct 23 03:56:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sched.h,v 1.11 2018/10/23 03:56:33 riastradh Exp $ */ +/* $NetBSD: sched.h,v 1.12 2018/10/23 03:56:47 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -74,8 +74,8 @@ schedule_timeout_uninterruptible(long ti } start = hardclock_ticks; - /* XXX Integer truncation...not likely to matter here. */ - (void)kpause("loonix", false /*!intr*/, timeout, NULL); + /* Caller is expected to loop anyway, so no harm in truncating. */ + (void)kpause("loonix", false /*!intr*/, MIN(timeout, INT_MAX), NULL); end = hardclock_ticks; remain = timeout - (end - start);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Aug 28 03:34:53 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree.h Log Message: Return the node we found. From tnn@. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/sys/external/bsd/drm2/include/linux/interval_tree.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/interval_tree.h diff -u src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.6 src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.7 --- src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.6 Mon Aug 27 07:51:59 2018 +++ src/sys/external/bsd/drm2/include/linux/interval_tree.h Tue Aug 28 03:34:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: interval_tree.h,v 1.6 2018/08/27 07:51:59 riastradh Exp $ */ +/* $NetBSD: interval_tree.h,v 1.7 2018/08/28 03:34:53 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -144,6 +144,8 @@ interval_tree_iter_next(struct rb_root * KASSERT(node->start <= start); if (last < node->start) return NULL; + + return next; } /*
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 16:20:35 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/drm: drm_os_netbsd.h Log Message: Ifdef out pnpbios for now. Presumably needs to use bus_space_alloc. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.11 src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.12 --- src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.11 Mon Aug 27 15:12:09 2018 +++ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Mon Aug 27 16:20:35 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_os_netbsd.h,v 1.11 2018/08/27 15:12:09 riastradh Exp $ */ +/* $NetBSD: drm_os_netbsd.h,v 1.12 2018/08/27 16:20:35 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -49,6 +49,7 @@ #define CONFIG_PCI 1 #endif +#ifdef notyet #if defined(__i386__) #include "pnpbios.h" #endif @@ -56,6 +57,7 @@ #if NPNPBIOS > 0 #define CONFIG_PNP #endif +#endif #if defined(__i386__) || defined(__x86_64__) #if defined(_KERNEL_OPT)
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:32:20 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/drm: bus_dma_hacks.h Log Message: Implement BUS_DMA_TO_PHYS/PHYS_TO_BUS_DMA on arm respecting ranges. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 \ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h diff -u src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.15 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.16 --- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.15 Mon Aug 27 15:29:31 2018 +++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Mon Aug 27 15:32:20 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma_hacks.h,v 1.15 2018/08/27 15:29:31 riastradh Exp $ */ +/* $NetBSD: bus_dma_hacks.h,v 1.16 2018/08/27 15:32:20 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -46,8 +46,33 @@ # define PHYS_TO_BUS_MEM(dmat, paddr) ((bus_addr_t)(paddr)) # define BUS_MEM_TO_PHYS(dmat, baddr) ((paddr_t)(baddr)) #elif defined(__arm__) || defined(__aarch64__) -# define PHYS_TO_BUS_MEM(dmat, paddr) ((bus_addr_t)(paddr)) -# define BUS_MEM_TO_PHYS(dmat, baddr) ((paddr_t)(baddr)) +static inline bus_addr_t +PHYS_TO_BUS_MEM(bus_dma_tag_t dmat, paddr_t pa) +{ + unsigned i; + + for (i = 0; i < dmat->_nranges; i++) { + const struct arm32_dma_range *dr = &dmat->_ranges[i]; + + if (dr->dr_sysbase <= pa && pa - dr->dr_sysbase <= dr->dr_len) + return dr->dr_busbase + (dr->dr_sysbase - pa); + } + panic("paddr has no bus address in dma tag %p: %"PRIxPADDR, dmat, pa); +} +static inline paddr_t +BUS_MEM_TO_PHYS(bus_dma_tag_t dmat, bus_addr_t ba) +{ + unsigned i; + + for (i = 0; i < dmat->_nranges; i++) { + const struct arm32_dma_range *dr = &dmat->_ranges[i]; + + if (dr->dr_busbase <= ba && ba - dr->dr_busbase <= dr->dr_len) + return dr->dr_sysbase + (dr->dr_busbase - ba); + } + panic("bus addr has no bus address in dma tag %p: %"PRIxPADDR, dmat, + ba); +} #elif defined(__sparc__) || defined(__sparc64__) # define PHYS_TO_BUS_MEM(dmat, paddr) ((bus_addr_t)(paddr)) # define BUS_MEM_TO_PHYS(dmat, baddr) ((paddr_t)(baddr))
CVS commit: src/sys/external/bsd/drm2/include/linux/regulator
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:29:54 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux/regulator: consumer.h Log Message: Make this compile. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/linux/regulator/consumer.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/regulator/consumer.h diff -u src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.3 src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.4 --- src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.3 Mon Aug 27 07:49:36 2018 +++ src/sys/external/bsd/drm2/include/linux/regulator/consumer.h Mon Aug 27 15:29:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: consumer.h,v 1.3 2018/08/27 07:49:36 riastradh Exp $ */ +/* $NetBSD: consumer.h,v 1.4 2018/08/27 15:29:54 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -38,6 +38,8 @@ #ifdef FDT +#include + struct regulator { struct fdtbus_regulator regulator; }; @@ -56,13 +58,12 @@ regulator_get_voltage(struct regulator * } KASSERTMSG(uvolt <= INT_MAX, "high voltage: %u uV", uvolt); - return (int)uvol; + return (int)uvolt; } static inline int regulator_set_voltage(struct regulator *reg, int min_uvolt, int max_uvolt) { - unsigned v; if (min_uvolt < 0 || max_uvolt < 0) return -EINVAL;
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:29:08 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/drm: bus_dma_hacks.h Log Message: sparc seems to treat bus/phys addrs in bus dmamem the same. This is just about bus dmamem -- not about bus dmamap, which rightly uses an iommu to remap things and which we don't interfere with. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h diff -u src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.13 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.14 --- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.13 Mon Aug 27 15:27:28 2018 +++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Mon Aug 27 15:29:08 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma_hacks.h,v 1.13 2018/08/27 15:27:28 riastradh Exp $ */ +/* $NetBSD: bus_dma_hacks.h,v 1.14 2018/08/27 15:29:08 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -48,6 +48,9 @@ #elif defined(__arm__) || defined(__aarch64__) # define PHYS_TO_BUS_MEM(dmat, paddr) ((bus_addr_t)(paddr)) # define BUS_MEM_TO_PHYS(dmat, baddr) ((paddr_t)(baddr)) +#elif defined(__sparc__) || defined(__sparc64__) +# define PHYS_TO_BUS_MEM(dmat, paddr) ((bus_addr_t)(paddr)) +# define BUS_MEM_TO_PHYS(dmat, baddr) ((paddr_t)(baddr)) #elif defined(__powerpc__) #else # error DRM GEM/TTM need new MI bus_dma APIs! Halp!
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:27:28 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/drm: bus_dma_hacks.h Log Message: Eliminate now-unused bus_dmamap_load_pgarray. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 \ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h diff -u src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.12 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.13 --- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.12 Mon Aug 27 15:26:50 2018 +++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Mon Aug 27 15:27:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma_hacks.h,v 1.12 2018/08/27 15:26:50 riastradh Exp $ */ +/* $NetBSD: bus_dma_hacks.h,v 1.13 2018/08/27 15:27:28 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -116,48 +116,6 @@ out: kmem_free(segs, (nsegs * sizeof(seg } static inline int -bus_dmamap_load_pgarray(bus_dma_tag_t tag, bus_dmamap_t map, -struct vm_page **pgs, unsigned npgs, bus_size_t size, int flags) -{ - km_flag_t kmflags; - bus_dma_segment_t *segs; - unsigned i; - int error; - - KASSERT((int)npgs <= (SIZE_MAX / sizeof(segs[0]))); - switch (flags & (BUS_DMA_WAITOK|BUS_DMA_NOWAIT)) { - case BUS_DMA_WAITOK: kmflags = KM_SLEEP; break; - case BUS_DMA_NOWAIT: kmflags = KM_NOSLEEP; break; - default: panic("invalid flags: %d", flags); - } - segs = kmem_alloc((npgs * sizeof(segs[0])), kmflags); - if (segs == NULL) - return ENOMEM; - - for (i = 0; i < npgs; i++) { - paddr_t paddr = VM_PAGE_TO_PHYS(pgs[i]); - bus_addr_t baddr = PHYS_TO_BUS_MEM(tag, paddr); - - segs[i].ds_addr = baddr; - segs[i].ds_len = PAGE_SIZE; - } - - error = bus_dmamap_load_raw(tag, map, segs, npgs, size, flags); - if (error) - goto fail0; - - /* Success! */ - error = 0; - goto out; - -fail1: __unused - bus_dmamap_unload(tag, map); -fail0: KASSERT(error); -out: kmem_free(segs, (npgs * sizeof(segs[0]))); - return error; -} - -static inline int bus_dmamem_export_pages(bus_dma_tag_t dmat, const bus_dma_segment_t *segs, int nsegs, struct vm_page **pgs, unsigned npgs) {
CVS commit: src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:25:28 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include: i915_trace.h Log Message: Work around broken SDT_PROBE* in !KDTRACE_HOOKS until we merge HEAD. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/include/i915_trace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/i915_trace.h diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.13 src/sys/external/bsd/drm2/include/i915_trace.h:1.14 --- src/sys/external/bsd/drm2/include/i915_trace.h:1.13 Mon Aug 27 15:09:35 2018 +++ src/sys/external/bsd/drm2/include/i915_trace.h Mon Aug 27 15:25:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_trace.h,v 1.13 2018/08/27 15:09:35 riastradh Exp $ */ +/* $NetBSD: i915_trace.h,v 1.14 2018/08/27 15:25:28 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -259,10 +259,11 @@ trace_i915_reg_rw(bool write, uint32_t r { if (!trace) return; - if (write) + if (write) { TRACE3(i915,, register__read, reg, value, len); - else + } else { TRACE3(i915,, register__write, reg, value, len); + } } DEFINE_TRACE5(i915,, vma__bind,
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:23:40 UTC 2018 Added Files: src/sys/external/bsd/drm2/include/drm: drm_trace_netbsd.h Log Message: Forgot to commit drm_trace_netbsd.h. Too late to force an update... To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 \ src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h diff -u /dev/null src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h:1.1 --- /dev/null Mon Aug 27 15:23:40 2018 +++ src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h Mon Aug 27 15:23:40 2018 @@ -0,0 +1,70 @@ +/* $NetBSD: drm_trace_netbsd.h,v 1.1 2018/08/27 15:23:40 riastradh Exp $ */ + +/*- + * Copyright (c) 2018 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _DRM_DRM_TRACE_NETBSD_H_ +#define _DRM_DRM_TRACE_NETBSD_H_ + +#include + +#ifdef CREATE_TRACE_POINTS +#define DEFINE_TRACE0(m,p,n) SDT_PROBE_DEFINE0(sdt,m,p,n) +#define DEFINE_TRACE1(m,p,n,a) SDT_PROBE_DEFINE1(sdt,m,p,n,a) +#define DEFINE_TRACE2(m,p,n,a,b) SDT_PROBE_DEFINE2(sdt,m,p,n,a,b) +#define DEFINE_TRACE3(m,p,n,a,b,c) SDT_PROBE_DEFINE3(sdt,m,p,n,a,b,c) +#define DEFINE_TRACE4(m,p,n,a,b,c,d) SDT_PROBE_DEFINE4(sdt,m,p,n,a,b,c,d) +#define DEFINE_TRACE5(m,p,n,a,b,c,d,e) SDT_PROBE_DEFINE5(sdt,m,p,n,a,b,c,d,e) +#define DEFINE_TRACE6(m,p,n,a,b,c,d,e,f) \ + SDT_PROBE_DEFINE6(sdt,m,p,n,a,b,c,d,e,f) +#define DEFINE_TRACE7(m,p,n,a,b,c,d,e,f,g) \ + SDT_PROBE_DEFINE7(sdt,m,p,n,a,b,c,d,e,f,g) +#else +#define DEFINE_TRACE0(m,p,n) SDT_PROBE_DECLARE(sdt,m,p,n) +#define DEFINE_TRACE1(m,p,n,a) SDT_PROBE_DECLARE(sdt,m,p,n) +#define DEFINE_TRACE2(m,p,n,a,b) SDT_PROBE_DECLARE(sdt,m,p,n) +#define DEFINE_TRACE3(m,p,n,a,b,c) SDT_PROBE_DECLARE(sdt,m,p,n) +#define DEFINE_TRACE4(m,p,n,a,b,c,d) SDT_PROBE_DECLARE(sdt,m,p,n) +#define DEFINE_TRACE5(m,p,n,a,b,c,d,e) SDT_PROBE_DECLARE(sdt,m,p,n) +#define DEFINE_TRACE6(m,p,n,a,b,c,d,e,f) \ + SDT_PROBE_DECLARE(sdt,m,p,n) +#define DEFINE_TRACE7(m,p,n,a,b,c,d,e,f,g) \ + SDT_PROBE_DECLARE(sdt,m,p,n) +#endif + +#define TRACE0(m,p,n) SDT_PROBE0(sdt,m,p,n) +#define TRACE1(m,p,n,a) SDT_PROBE1(sdt,m,p,n,a) +#define TRACE2(m,p,n,a,b) SDT_PROBE2(sdt,m,p,n,a,b) +#define TRACE3(m,p,n,a,b,c) SDT_PROBE3(sdt,m,p,n,a,b,c) +#define TRACE4(m,p,n,a,b,c,d) SDT_PROBE4(sdt,m,p,n,a,b,c,d) +#define TRACE5(m,p,n,a,b,c,d,e) SDT_PROBE5(sdt,m,p,n,a,b,c,d,e) +#define TRACE6(m,p,n,a,b,c,d,e,f) SDT_PROBE6(sdt,m,p,n,a,b,c,d,e,f) +#define TRACE7(m,p,n,a,b,c,d,e,f,g) SDT_PROBE7(sdt,m,p,n,a,b,c,d,e,f,g) + +#endif /* _LINUX_TRACEPOINT_H_ */
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:12:09 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/drm: drm_os_netbsd.h Log Message: opt_mtrr.h is x86-only. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 \ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.10 src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.11 --- src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.10 Mon Aug 27 13:53:09 2018 +++ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Mon Aug 27 15:12:09 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_os_netbsd.h,v 1.10 2018/08/27 13:53:09 riastradh Exp $ */ +/* $NetBSD: drm_os_netbsd.h,v 1.11 2018/08/27 15:12:09 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -57,9 +57,11 @@ #define CONFIG_PNP #endif +#if defined(__i386__) || defined(__x86_64__) #if defined(_KERNEL_OPT) #include "opt_mtrr.h" #endif +#endif #ifdef MTRR #define CONFIG_MTRR 1
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:11:58 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/drm: bus_dma_hacks.h Log Message: Use PHYS_TO_BUS_MEM in generic bus_dmamap_load_pglist code. For arm and x86, this is a noop. For powerpc, it is defined by some relevant header file. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 \ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h diff -u src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.10 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.11 --- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.10 Mon Aug 27 07:17:47 2018 +++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h Mon Aug 27 15:11:58 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma_hacks.h,v 1.10 2018/08/27 07:17:47 riastradh Exp $ */ +/* $NetBSD: bus_dma_hacks.h,v 1.11 2018/08/27 15:11:58 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -41,11 +41,14 @@ #include #if defined(__i386__) || defined(__x86_64__) -#include -#include +# include +# include +# define PHYS_TO_BUS_MEM(dmat, paddr) (paddr) #elif defined(__arm__) || defined(__aarch64__) +# define PHYS_TO_BUS_MEM(dmat, paddr) (paddr) +#elif defined(__powerpc__) #else -#error DRM GEM/TTM need new MI bus_dma APIs! Halp! +# error DRM GEM/TTM need new MI bus_dma APIs! Halp! #endif static inline int @@ -87,7 +90,10 @@ bus_dmamap_load_pglist(bus_dma_tag_t tag seg = 0; TAILQ_FOREACH(page, pglist, pageq.queue) { - segs[seg].ds_addr = VM_PAGE_TO_PHYS(page); + paddr_t paddr = VM_PAGE_TO_PHYS(page); + bus_addr_t baddr = PHYS_TO_BUS_MEM(tag, paddr); + + segs[seg].ds_addr = baddr; segs[seg].ds_len = PAGE_SIZE; seg++; }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:11:04 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: atomic.h Log Message: Sort. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 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.17 src/sys/external/bsd/drm2/include/linux/atomic.h:1.18 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.17 Mon Aug 27 15:10:52 2018 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Mon Aug 27 15:11:04 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.17 2018/08/27 15:10:52 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.18 2018/08/27 15:11:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -295,12 +295,12 @@ atomic64_cmpxchg(struct atomic64 *atomic #else /* !defined(__HAVE_ATOMIC64_OPS) */ +#define atomic64_add linux_atomic64_add +#define atomic64_cmpxchg linux_atomic64_cmpxchg #define atomic64_read linux_atomic64_read #define atomic64_set linux_atomic64_set -#define atomic64_add linux_atomic64_add #define atomic64_sub linux_atomic64_sub #define atomic64_xchg linux_atomic64_xchg -#define atomic64_cmpxchg linux_atomic64_cmpxchg uint64_t atomic64_read(const struct atomic64 *); void atomic64_set(struct atomic64 *, uint64_t);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 15:10:41 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: atomic.h Log Message: Implement ATOMIC64_INIT. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 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.15 src/sys/external/bsd/drm2/include/linux/atomic.h:1.16 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.15 Mon Aug 27 15:08:54 2018 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Mon Aug 27 15:10:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.15 2018/08/27 15:08:54 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.16 2018/08/27 15:10:41 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -229,6 +229,8 @@ struct atomic64 { typedef struct atomic64 atomic64_t; +#define ATOMIC64_INIT(v) { .a_v = (v) } + int linux_atomic64_init(void); void linux_atomic64_fini(void);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:52:16 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: bitmap.h Log Message: Split bitmap_set/clear into begin/middle/end sections. For clarity and speed. Largely from uwe@ with tweaks from me. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/bitmap.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/bitmap.h diff -u src/sys/external/bsd/drm2/include/linux/bitmap.h:1.7 src/sys/external/bsd/drm2/include/linux/bitmap.h:1.8 --- src/sys/external/bsd/drm2/include/linux/bitmap.h:1.7 Mon Aug 27 14:51:05 2018 +++ src/sys/external/bsd/drm2/include/linux/bitmap.h Mon Aug 27 14:52:16 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bitmap.h,v 1.7 2018/08/27 14:51:05 riastradh Exp $ */ +/* $NetBSD: bitmap.h,v 1.8 2018/08/27 14:52:16 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -105,16 +105,28 @@ bitmap_set(unsigned long *bitmap, size_t { const size_t bpl = NBBY * sizeof(*bitmap); unsigned long *p = bitmap + startbit/bpl; - unsigned long mask; - unsigned sz; + unsigned initial = startbit%bpl; - for (sz = bpl - (startbit%bpl), mask = ~0UL << (startbit%bpl); - nbits >= sz; - nbits -= sz, sz = bpl, mask = ~0UL) - *p++ |= mask; + /* Handle an initial odd word if any. */ + if (initial) { + /* Does the whole thing fit in a single word? */ + if (nbits <= bpl - initial) { + /* Yes: just set nbits starting at initial. */ + *p |= ~(~0ULL << nbits) << initial; + return; + } + /* Nope: set all bits above initial, and advance. */ + *p++ |= ~0ULL << initial; + nbits -= bpl - initial; + } + + /* Set the middle part to all bits 1. */ + for (; nbits >= bpl; nbits -= bpl) + *p++ = ~0UL; + /* Handle a final odd word if any by setting its low nbits. */ if (nbits) - *p |= mask & ~(~0UL << (nbits + bpl - sz)); + *p |= ~(~0ULL << nbits); } /* @@ -128,16 +140,28 @@ bitmap_clear(unsigned long *bitmap, size { const size_t bpl = NBBY * sizeof(*bitmap); unsigned long *p = bitmap + startbit/bpl; - unsigned long mask; - unsigned sz; + unsigned initial = startbit%bpl; - for (sz = bpl - (startbit%bpl), mask = ~(~0UL << (startbit%bpl)); - nbits >= sz; - nbits -= sz, sz = bpl, mask = 0UL) - *p++ &= mask; + /* Handle an initial odd word if any. */ + if (initial) { + /* Does the whole thing fit in a single word? */ + if (nbits <= bpl - initial) { + /* Yes: just clear nbits starting at initial. */ + *p &= ~(~(~0ULL << nbits) << initial); + return; + } + /* Nope: clear all bits above initial, and advance. */ + *p++ &= ~(~0ULL << initial); + nbits -= bpl - initial; + } + + /* Zero the middle part. */ + for (; nbits >= bpl; nbits -= bpl) + *p++ = 0UL; + /* Handle a final odd word if any by clearing its low nbits. */ if (nbits) - *p &= mask | (~0UL << (nbits + bpl - sz)); + *p &= ~0ULL << nbits; } /*
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:50:37 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: bitmap.h Log Message: Name bpl in bitmap_and/or. Fix and clarify comments. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/bitmap.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/bitmap.h diff -u src/sys/external/bsd/drm2/include/linux/bitmap.h:1.4 src/sys/external/bsd/drm2/include/linux/bitmap.h:1.5 --- src/sys/external/bsd/drm2/include/linux/bitmap.h:1.4 Mon Aug 27 14:50:24 2018 +++ src/sys/external/bsd/drm2/include/linux/bitmap.h Mon Aug 27 14:50:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bitmap.h,v 1.4 2018/08/27 14:50:24 riastradh Exp $ */ +/* $NetBSD: bitmap.h,v 1.5 2018/08/27 14:50:37 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -144,30 +144,32 @@ bitmap_clear(unsigned long *bitmap, size * * Set dst to be the bitwise AND of src1 and src2, all bitmaps * allocated to have nbits bits. Yes, this modifies bits past - * nbits. + * nbits. Any pair of {dst, src1, src2} may be aliases. */ static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, size_t nbits) { - size_t n = howmany(nbits, NBBY * sizeof(unsigned long)); + const size_t bpl = NBBY * sizeof(unsigned long); + size_t n = howmany(nbits, bpl); while (n --> 0) *dst++ = *src1++ & *src2++; } /* - * bitmap_and(dst, src1, src2, nbits) + * bitmap_or(dst, src1, src2, nbits) * * Set dst to be the bitwise inclusive-OR of src1 and src2, all * bitmaps allocated to have nbits bits. Yes, this modifies bits - * past nbits. + * past nbits. Any pair of {dst, src1, src2} may be aliases. */ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, size_t nbits) { - size_t n = howmany(nbits, NBBY * sizeof(unsigned long)); + const size_t bpl = NBBY * sizeof(unsigned long); + size_t n = howmany(nbits, bpl); while (n --> 0) *dst++ = *src1++ | *src2++;
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:51:06 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: bitmap.h Log Message: Name the number of words in bitmap_zero too. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/bitmap.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/bitmap.h diff -u src/sys/external/bsd/drm2/include/linux/bitmap.h:1.6 src/sys/external/bsd/drm2/include/linux/bitmap.h:1.7 --- src/sys/external/bsd/drm2/include/linux/bitmap.h:1.6 Mon Aug 27 14:50:52 2018 +++ src/sys/external/bsd/drm2/include/linux/bitmap.h Mon Aug 27 14:51:05 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bitmap.h,v 1.6 2018/08/27 14:50:52 riastradh Exp $ */ +/* $NetBSD: bitmap.h,v 1.7 2018/08/27 14:51:05 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -46,8 +46,9 @@ static inline void bitmap_zero(unsigned long *bitmap, size_t nbits) { const size_t bpl = NBBY * sizeof(*bitmap); + size_t n = howmany(nbits, bpl); - memset(bitmap, 0, howmany(nbits, bpl) * sizeof(*bitmap)); + memset(bitmap, 0, n * sizeof(*bitmap)); } /*
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:50:52 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: bitmap.h Log Message: Be consistent about nbits >= bpl. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/bitmap.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/bitmap.h diff -u src/sys/external/bsd/drm2/include/linux/bitmap.h:1.5 src/sys/external/bsd/drm2/include/linux/bitmap.h:1.6 --- src/sys/external/bsd/drm2/include/linux/bitmap.h:1.5 Mon Aug 27 14:50:37 2018 +++ src/sys/external/bsd/drm2/include/linux/bitmap.h Mon Aug 27 14:50:52 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bitmap.h,v 1.5 2018/08/27 14:50:37 riastradh Exp $ */ +/* $NetBSD: bitmap.h,v 1.6 2018/08/27 14:50:52 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ bitmap_empty(const unsigned long *bitmap { const size_t bpl = NBBY * sizeof(*bitmap); - for (; bpl <= nbits; nbits -= bpl) { + for (; nbits >= bpl; nbits -= bpl) { if (*bitmap++) return false; } @@ -85,7 +85,7 @@ bitmap_weight(const unsigned long *bitma const size_t bpl = NBBY * sizeof(*bitmap); int weight = 0; - for (; bpl <= nbits; nbits -= bpl) + for (; nbits >= bpl; nbits -= bpl) weight += popcountl(*bitmap++); if (nbits) weight += popcountl(*bitmap & ~(~0UL << nbits));
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:50:24 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: bitmap.h Log Message: Try setting and clearing the bits we meant, not other bits. Fix comments to match intent while we're fixing reality too. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/bitmap.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/bitmap.h diff -u src/sys/external/bsd/drm2/include/linux/bitmap.h:1.3 src/sys/external/bsd/drm2/include/linux/bitmap.h:1.4 --- src/sys/external/bsd/drm2/include/linux/bitmap.h:1.3 Mon Aug 27 07:13:45 2018 +++ src/sys/external/bsd/drm2/include/linux/bitmap.h Mon Aug 27 14:50:24 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bitmap.h,v 1.3 2018/08/27 07:13:45 riastradh Exp $ */ +/* $NetBSD: bitmap.h,v 1.4 2018/08/27 14:50:24 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -96,44 +96,47 @@ bitmap_weight(const unsigned long *bitma /* * bitmap_set(bitmap, startbit, nbits) * - * Set bits at startbit, startbit+1, ..., nbits-2, nbits-1 to 1. + * Set bits at startbit, startbit+1, ..., startbit+nbits-2, + * startbit+nbits-1 to 1. */ static inline void bitmap_set(unsigned long *bitmap, size_t startbit, size_t nbits) { const size_t bpl = NBBY * sizeof(*bitmap); - unsigned long *p; + unsigned long *p = bitmap + startbit/bpl; unsigned long mask; + unsigned sz; - for (p = bitmap + startbit/bpl, mask = ~(~0UL << (startbit%bpl)); - nbits >= bpl; - p++, nbits -= bpl, mask = ~0UL) - *p |= mask; + for (sz = bpl - (startbit%bpl), mask = ~0UL << (startbit%bpl); + nbits >= sz; + nbits -= sz, sz = bpl, mask = ~0UL) + *p++ |= mask; if (nbits) - *p |= mask & (~0UL << nbits); + *p |= mask & ~(~0UL << (nbits + bpl - sz)); } /* - * bitmap_set(bitmap, startbit, nbits) + * bitmap_clear(bitmap, startbit, nbits) * - * Clear bits at startbit, startbit+1, ..., nbits-2, nbits-1, - * replacing them by 0. + * Clear bits at startbit, startbit+1, ..., startbit+nbits-2, + * startbit+nbits-1, replacing them by 0. */ static inline void bitmap_clear(unsigned long *bitmap, size_t startbit, size_t nbits) { const size_t bpl = NBBY * sizeof(*bitmap); - unsigned long *p; + unsigned long *p = bitmap + startbit/bpl; unsigned long mask; + unsigned sz; - for (p = bitmap + startbit/bpl, mask = ~0UL << (startbit%bpl); - nbits >= bpl; - p++, nbits -= bpl, mask = 0UL) - *p &= mask; + for (sz = bpl - (startbit%bpl), mask = ~(~0UL << (startbit%bpl)); + nbits >= sz; + nbits -= sz, sz = bpl, mask = 0UL) + *p++ &= mask; if (nbits) - *p &= mask | ~(~0UL << nbits); + *p &= mask | (~0UL << (nbits + bpl - sz)); } /*
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:41:53 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: kfifo.h Log Message: kfifo is used under a spin lock, so its lock must be a spin lock. >From mrg@. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/kfifo.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/kfifo.h diff -u src/sys/external/bsd/drm2/include/linux/kfifo.h:1.2 src/sys/external/bsd/drm2/include/linux/kfifo.h:1.3 --- src/sys/external/bsd/drm2/include/linux/kfifo.h:1.2 Mon Aug 27 14:00:26 2018 +++ src/sys/external/bsd/drm2/include/linux/kfifo.h Mon Aug 27 14:41:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: kfifo.h,v 1.2 2018/08/27 14:00:26 riastradh Exp $ */ +/* $NetBSD: kfifo.h,v 1.3 2018/08/27 14:41:53 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ _kfifo_alloc(struct kfifo_meta *meta, vo /* Type pun! Hope void * == struct whatever *. */ memcpy(bufp, &buf, sizeof(void *)); - mutex_init(&meta->kfm_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(&meta->kfm_lock, MUTEX_DEFAULT, IPL_VM); meta->kfm_head = 0; meta->kfm_tail = 0; meta->kfm_nbytes = nbytes; @@ -120,7 +120,7 @@ _kfifo_out_peek(struct kfifo_meta *meta, char *dst = ptr; size_t copied = 0; - mutex_enter(&meta->kfm_lock); + mutex_spin_enter(&meta->kfm_lock); const size_t head = meta->kfm_head; const size_t tail = meta->kfm_tail; const size_t nbytes = meta->kfm_nbytes; @@ -140,7 +140,7 @@ _kfifo_out_peek(struct kfifo_meta *meta, copied = size; } } - mutex_exit(&meta->kfm_lock); + mutex_spin_exit(&meta->kfm_lock); return copied; } @@ -155,7 +155,7 @@ _kfifo_out(struct kfifo_meta *meta, cons char *dst = ptr; size_t copied = 0; - mutex_enter(&meta->kfm_lock); + mutex_spin_enter(&meta->kfm_lock); const size_t head = meta->kfm_head; const size_t tail = meta->kfm_tail; const size_t nbytes = meta->kfm_nbytes; @@ -178,7 +178,7 @@ _kfifo_out(struct kfifo_meta *meta, cons copied = size; } } - mutex_exit(&meta->kfm_lock); + mutex_spin_exit(&meta->kfm_lock); return copied; } @@ -193,7 +193,7 @@ _kfifo_in(struct kfifo_meta *meta, void char *dst = buf; size_t copied = 0; - mutex_enter(&meta->kfm_lock); + mutex_spin_enter(&meta->kfm_lock); const size_t head = meta->kfm_head; const size_t tail = meta->kfm_tail; const size_t nbytes = meta->kfm_nbytes; @@ -215,7 +215,7 @@ _kfifo_in(struct kfifo_meta *meta, void copied = size; } } - mutex_exit(&meta->kfm_lock); + mutex_spin_exit(&meta->kfm_lock); return copied; }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:40:56 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: vmalloc.h Log Message: Linux vfree accepts NULL as noop. Match semantics. >From mrg@. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/vmalloc.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/vmalloc.h diff -u src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.6 src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.7 --- src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.6 Mon Aug 27 13:44:54 2018 +++ src/sys/external/bsd/drm2/include/linux/vmalloc.h Mon Aug 27 14:40:56 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: vmalloc.h,v 1.6 2018/08/27 13:44:54 riastradh Exp $ */ +/* $NetBSD: vmalloc.h,v 1.7 2018/08/27 14:40:56 riastradh Exp $ */ /*- * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc. @@ -72,6 +72,8 @@ vzalloc(unsigned long size) static inline void vfree(void *ptr) { + if (ptr == NULL) + return; return free(ptr, M_TEMP); }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:19:26 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: device.h Log Message: Paranoia: let dev be null, in match routines. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/external/bsd/drm2/include/linux/device.h:1.6 --- src/sys/external/bsd/drm2/include/linux/device.h:1.5 Mon Aug 27 07:33:35 2018 +++ src/sys/external/bsd/drm2/include/linux/device.h Mon Aug 27 14:19:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.5 2018/08/27 07:33:35 riastradh Exp $ */ +/* $NetBSD: device.h,v 1.6 2018/08/27 14:19:25 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,23 +35,47 @@ #include #include -#define dev_crit(DEV, FMT, ...) \ - aprint_error_dev((DEV), "critical: " FMT, ##__VA_ARGS__) - -#define dev_err(DEV, FMT, ...) \ - aprint_error_dev((DEV), "error: " FMT, ##__VA_ARGS__) - -#define dev_warn(DEV, FMT, ...) \ - aprint_error_dev((DEV), "warning: " FMT, ##__VA_ARGS__) - -#define dev_notice(DEV, FMT, ...) \ - aprint_normal_dev((DEV), "notice: " FMT, ##__VA_ARGS__) - -#define dev_info(DEV, FMT, ...) \ - aprint_normal_dev((DEV), "info: " FMT, ##__VA_ARGS__) - -#define dev_dbg(DEV, FMT, ...) \ - aprint_debug_dev((DEV), "debug: " FMT, ##__VA_ARGS__) +#define dev_crit(DEV, FMT, ...) do { \ + if (DEV) \ + aprint_error_dev((DEV), "critical: " FMT, ##__VA_ARGS__); \ + else \ + aprint_error("critical: " FMT, ##__VA_ARGS__); \ +} while (0) + +#define dev_err(DEV, FMT, ...) do { \ + if (DEV) \ + aprint_error_dev((DEV), "error: " FMT, ##__VA_ARGS__); \ + else \ + aprint_error("error: " FMT, ##__VA_ARGS__); \ +} while (0) + +#define dev_warn(DEV, FMT, ...) do { \ + if (DEV) \ + aprint_error_dev((DEV), "warn: " FMT, ##__VA_ARGS__); \ + else \ + aprint_error("warn: " FMT, ##__VA_ARGS__); \ +} while (0) + +#define dev_notice(DEV, FMT, ...) do { \ + if (DEV) \ + aprint_normal_dev((DEV), "notice: " FMT, ##__VA_ARGS__); \ + else \ + aprint_normal("notice: " FMT, ##__VA_ARGS__); \ +} while (0) + +#define dev_info(DEV, FMT, ...) do { \ + if (DEV) \ + aprint_normal_dev((DEV), "info: " FMT, ##__VA_ARGS__); \ + else \ + aprint_normal("info: " FMT, ##__VA_ARGS__); \ +} while (0) + +#define dev_dbg(DEV, FMT, ...) do { \ + if (DEV) \ + aprint_debug_dev((DEV), "debug: " FMT, ##__VA_ARGS__); \ + else \ + aprint_debug("debug: " FMT, ##__VA_ARGS__); \ +} while (0) #define dev_name device_xname
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:16:04 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: Fix sense of test to make linux_pci_dev_destroy work. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 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.35 src/sys/external/bsd/drm2/include/linux/pci.h:1.36 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.35 Mon Aug 27 14:15:35 2018 +++ src/sys/external/bsd/drm2/include/linux/pci.h Mon Aug 27 14:16:04 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.35 2018/08/27 14:15:35 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.36 2018/08/27 14:16:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -877,7 +877,7 @@ linux_pci_dev_destroy(struct pci_dev *pd pdev->pd_rom_vaddr = 0; } for (i = 0; i < __arraycount(pdev->pd_resources); i++) { - if (pdev->pd_resources[i].mapped) + if (!pdev->pd_resources[i].mapped) continue; bus_space_unmap(pdev->pd_resources[i].bst, pdev->pd_resources[i].bsh, pdev->pd_resources[i].size);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:15:35 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: Initialize more of struct pci_device. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 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.34 src/sys/external/bsd/drm2/include/linux/pci.h:1.35 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.34 Mon Aug 27 14:12:00 2018 +++ src/sys/external/bsd/drm2/include/linux/pci.h Mon Aug 27 14:15:35 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.34 2018/08/27 14:12:00 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.35 2018/08/27 14:15:35 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -203,6 +203,8 @@ linux_pci_dev_init(struct pci_dev *pdev, #else pdev->pd_ad = NULL; #endif + pdev->pd_saved_state = NULL; + pdev->pd_intr_handles = NULL; pdev->bus = kmem_zalloc(sizeof(*pdev->bus), KM_NOSLEEP); pdev->bus->pb_pc = pa->pa_pc; pdev->bus->pb_dev = parent;
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:12:00 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: Implement linux_pci_dev_destroy. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 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.33 src/sys/external/bsd/drm2/include/linux/pci.h:1.34 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.33 Mon Aug 27 14:11:46 2018 +++ src/sys/external/bsd/drm2/include/linux/pci.h Mon Aug 27 14:12:00 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.33 2018/08/27 14:11:46 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.34 2018/08/27 14:12:00 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -152,6 +152,7 @@ struct pci_dev { bus_space_tag_t bst; bus_space_handle_t bsh; void __pci_iomem *kva; + bool mapped; } pd_resources[PCI_NUM_RESOURCES]; struct pci_conf_state *pd_saved_state; struct acpi_devnode *pd_ad; @@ -202,7 +203,7 @@ linux_pci_dev_init(struct pci_dev *pdev, #else pdev->pd_ad = NULL; #endif - pdev->bus = kmem_zalloc(sizeof(struct pci_bus), KM_NOSLEEP); + pdev->bus = kmem_zalloc(sizeof(*pdev->bus), KM_NOSLEEP); pdev->bus->pb_pc = pa->pa_pc; pdev->bus->pb_dev = parent; pdev->bus->number = pa->pa_bus; @@ -737,6 +738,7 @@ pci_iomap(struct pci_dev *pdev, unsigned pdev->pd_resources[i].bst = pdev->pd_pa.pa_memt; pdev->pd_resources[i].kva = bus_space_vaddr(pdev->pd_resources[i].bst, pdev->pd_resources[i].bsh); + pdev->pd_resources[i].mapped = true; return pdev->pd_resources[i].kva; } @@ -859,4 +861,29 @@ linux_pci_disable_device(struct pci_dev splx(s); } +static inline void +linux_pci_dev_destroy(struct pci_dev *pdev) +{ + unsigned i; + + if (pdev->bus != NULL) { + kmem_free(pdev->bus, sizeof(*pdev->bus)); + pdev->bus = NULL; + } + if (ISSET(pdev->pd_kludges, NBPCI_KLUDGE_MAP_ROM)) { + pci_unmap_rom(pdev, pdev->pd_rom_vaddr); + pdev->pd_rom_vaddr = 0; + } + for (i = 0; i < __arraycount(pdev->pd_resources); i++) { + if (pdev->pd_resources[i].mapped) + continue; + bus_space_unmap(pdev->pd_resources[i].bst, + pdev->pd_resources[i].bsh, pdev->pd_resources[i].size); + } + + /* There is no way these should be still in use. */ + KASSERT(pdev->pd_saved_state == NULL); + KASSERT(pdev->pd_intr_handles == NULL); +} + #endif /* _LINUX_PCI_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:01:32 UTC 2018 Added Files: src/sys/external/bsd/drm2/include/linux: irq.h Log Message: Empty stub . Not sure why upstream uses it -- the file in Linux exhorts against its usage in any MI code. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/include/linux/irq.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/irq.h diff -u /dev/null src/sys/external/bsd/drm2/include/linux/irq.h:1.1 --- /dev/null Mon Aug 27 14:01:32 2018 +++ src/sys/external/bsd/drm2/include/linux/irq.h Mon Aug 27 14:01:32 2018 @@ -0,0 +1,35 @@ +/* $NetBSD: irq.h,v 1.1 2018/08/27 14:01:32 riastradh Exp $ */ + +/*- + * Copyright (c) 2018 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_IRQ_H_ +#define _LINUX_IRQ_H_ + +#endif /* _LINUX_IRQ_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 14:00:26 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: kfifo.h Log Message: Rewrite . pcq isn't flexible enough for its needs now. Just use a spinlocked circular buffer. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/kfifo.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/kfifo.h diff -u src/sys/external/bsd/drm2/include/linux/kfifo.h:1.1 src/sys/external/bsd/drm2/include/linux/kfifo.h:1.2 --- src/sys/external/bsd/drm2/include/linux/kfifo.h:1.1 Wed Jul 16 20:56:25 2014 +++ src/sys/external/bsd/drm2/include/linux/kfifo.h Mon Aug 27 14:00:26 2018 @@ -1,7 +1,7 @@ -/* $NetBSD: kfifo.h,v 1.1 2014/07/16 20:56:25 riastradh Exp $ */ +/* $NetBSD: kfifo.h,v 1.2 2018/08/27 14:00:26 riastradh Exp $ */ /*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. + * Copyright (c) 2018 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -32,30 +32,192 @@ #ifndef _LINUX_KFIFO_H_ #define _LINUX_KFIFO_H_ -#include +#include +#include +#include + +#include +#include + +struct kfifo_meta { + kmutex_t kfm_lock; + size_t kfm_head; + size_t kfm_tail; + size_t kfm_nbytes; +}; + +#define _KFIFO_PTR_TYPE(TAG, TYPE) \ + struct TAG { \ + struct kfifo_meta kf_meta; \ + TYPE *kf_buf; \ + } + +#define DECLARE_KFIFO_PTR(FIFO, TYPE) _KFIFO_PTR_TYPE(, TYPE) FIFO + +_KFIFO_PTR_TYPE(kfifo, void); + +#define kfifo_alloc(FIFO, SIZE, GFP) \ + _kfifo_alloc(&(FIFO)->kf_meta, &(FIFO)->kf_buf, (SIZE), (GFP)) + +static inline int +_kfifo_alloc(struct kfifo_meta *meta, void *bufp, size_t nbytes, gfp_t gfp) +{ + void *buf; + + buf = kmalloc(nbytes, gfp); + if (buf == NULL) + return -ENOMEM; + + /* Type pun! Hope void * == struct whatever *. */ + memcpy(bufp, &buf, sizeof(void *)); + + mutex_init(&meta->kfm_lock, MUTEX_DEFAULT, IPL_NONE); + meta->kfm_head = 0; + meta->kfm_tail = 0; + meta->kfm_nbytes = nbytes; + + return 0; +} + +#define kfifo_free(FIFO) \ + _kfifo_free(&(FIFO)->kf_meta, &(FIFO)->kf_buf) + +static inline void +_kfifo_free(struct kfifo_meta *meta, void *bufp) +{ + void *buf; + + mutex_destroy(&meta->kfm_lock); + + memcpy(&buf, bufp, sizeof(void *)); + kfree(buf); + + /* Paranoia. */ + buf = NULL; + memcpy(bufp, &buf, sizeof(void *)); +} + +#define kfifo_is_empty(FIFO) (kfifo_len(FIFO) == 0) +#define kfifo_len(FIFO) _kfifo_len(&(FIFO)->kf_meta) + +static inline size_t +_kfifo_len(struct kfifo_meta *meta) +{ + const size_t head = meta->kfm_head; + const size_t tail = meta->kfm_tail; + const size_t nbytes = meta->kfm_nbytes; + + return (head <= tail ? tail - head : nbytes + tail - head); +} + +#define kfifo_out_peek(FIFO, PTR, SIZE) \ + _kfifo_out_peek(&(FIFO)->kf_meta, (FIFO)->kf_buf, (PTR), (SIZE)) + +static inline size_t +_kfifo_out_peek(struct kfifo_meta *meta, void *buf, void *ptr, size_t size) +{ + const char *src = buf; + char *dst = ptr; + size_t copied = 0; + + mutex_enter(&meta->kfm_lock); + const size_t head = meta->kfm_head; + const size_t tail = meta->kfm_tail; + const size_t nbytes = meta->kfm_nbytes; + if (head <= tail) { + if (size <= tail - head) { + memcpy(dst, src + head, size); + copied = size; + } + } else { + if (size <= nbytes - head) { + memcpy(dst, src + head, size); + copied = size; + } else if (size <= nbytes + tail - head) { + memcpy(dst, src + head, nbytes - head); + memcpy(dst + nbytes - head, src, + size - (nbytes - head)); + copied = size; + } + } + mutex_exit(&meta->kfm_lock); + + return copied; +} + +#define kfifo_out(FIFO, PTR, SIZE) \ + _kfifo_out(&(FIFO)->kf_meta, (FIFO)->kf_buf, (PTR), (SIZE)) + +static inline size_t +_kfifo_out(struct kfifo_meta *meta, const void *buf, void *ptr, size_t size) +{ + const char *src = buf; + char *dst = ptr; + size_t copied = 0; + + mutex_enter(&meta->kfm_lock); + const size_t head = meta->kfm_head; + const size_t tail = meta->kfm_tail; + const size_t nbytes = meta->kfm_nbytes; + if (head <= tail) { + if (size <= tail - head) { + memcpy(dst, src + head, size); + meta->kfm_head = head + size; + copied = size; + } + } else { + if (size <= nbytes - head) { + memcpy(dst, src + head, size); + meta->kfm_head = head + size; + copied = size; + } else if (size <= nbytes + tail - head) { + memcpy(dst, src + head, nbytes - head); + memcpy(dst + nbytes - head, src, + size - (nbytes - head)); + meta->kfm_head = size - (nbytes - head); + copied = size; + } + } + mutex_exit(&meta->kfm_lock); + + return copied; +} + +#define kfifo_in(FIFO, PTR, SIZE) \ + _kfifo_in(&(FIFO)->kf_meta, (FIFO)->kf_buf, (PTR), (SIZE)) + +static inline size_t +_kfifo_in(struct kfifo
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:58:16 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: atomic.h Log Message: Add atomic_long. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/external/bsd/drm2/include/linux/atomic.h:1.14 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.13 Mon Aug 27 13:41:08 2018 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Mon Aug 27 13:58:16 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.13 2018/08/27 13:41:08 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.14 2018/08/27 13:58:16 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -286,6 +286,68 @@ atomic64_cmpxchg(struct atomic64 *atomic return old; } +struct atomic_long { + volatile unsigned long al_v; +}; + +typedef struct atomic_long atomic_long_t; + +static inline long +atomic_long_read(struct atomic_long *a) +{ + /* no membar */ + return (unsigned long)a->al_v; +} + +static inline void +atomic_long_set(struct atomic_long *a, long v) +{ + /* no membar */ + a->al_v = v; +} + +static inline long +atomic_long_add_unless(struct atomic_long *a, long addend, long zero) +{ + long value; + + smp_mb__before_atomic(); + do { + value = (long)a->al_v; + if (value == zero) + break; + } while (atomic_cas_ulong(&a->al_v, (unsigned long)value, + (unsigned long)(value + addend)) != (unsigned long)value); + smp_mb__after_atomic(); + + return value != zero; +} + +static inline long +atomic_long_inc_not_zero(struct atomic_long *a) +{ + /* membar implied by atomic_long_add_unless */ + return atomic_long_add_unless(a, 1, 0); +} + +static inline long +atomic_long_cmpxchg(struct atomic_long *a, long expect, long new) +{ + long old; + + /* + * XXX As an optimization, under Linux's semantics we are + * allowed to skip the memory barrier if the comparison fails, + * but taking advantage of that is not convenient here. + */ + smp_mb__before_atomic(); + old = (long)atomic_cas_ulong(&a->al_v, (unsigned long)expect, + (unsigned long)new); + smp_mb__after_atomic(); + + return old; +} + static inline void set_bit(unsigned int bit, volatile unsigned long *ptr) {
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:57:50 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: jiffies.h Log Message: Define nsecs_to_jiffies. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/external/bsd/drm2/include/linux/jiffies.h:1.12 --- src/sys/external/bsd/drm2/include/linux/jiffies.h:1.11 Mon Aug 27 07:05:13 2018 +++ src/sys/external/bsd/drm2/include/linux/jiffies.h Mon Aug 27 13:57:50 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: jiffies.h,v 1.11 2018/08/27 07:05:13 riastradh Exp $ */ +/* $NetBSD: jiffies.h,v 1.12 2018/08/27 13:57:50 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -59,6 +59,14 @@ nsecs_to_jiffies64(uint64_t nsec) return (nsec*hz)/10; } +static inline uint32_t +nsecs_to_jiffies(uint64_t nsec) +{ + + /* XXX Not sure what else to do but truncate... */ + return (uint32_t)nsecs_to_jiffies64(nsec); +} + static inline unsigned int msecs_to_jiffies(unsigned int msec) {
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:57:38 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: ktime.h Log Message: Need for boottime. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/external/bsd/drm2/include/linux/ktime.h:1.7 --- src/sys/external/bsd/drm2/include/linux/ktime.h:1.6 Mon Aug 27 07:27:27 2018 +++ src/sys/external/bsd/drm2/include/linux/ktime.h Mon Aug 27 13:57:38 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ktime.h,v 1.6 2018/08/27 07:27:27 riastradh Exp $ */ +/* $NetBSD: ktime.h,v 1.7 2018/08/27 13:57:38 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,6 +34,7 @@ #include #include +#include #include #include
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:57:11 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: types.h Log Message: Add a copy of __user (empty) to for expedience. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/external/bsd/drm2/include/linux/types.h:1.9 --- src/sys/external/bsd/drm2/include/linux/types.h:1.8 Mon Aug 27 13:31:36 2018 +++ src/sys/external/bsd/drm2/include/linux/types.h Mon Aug 27 13:57:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.8 2018/08/27 13:31:36 riastradh Exp $ */ +/* $NetBSD: types.h,v 1.9 2018/08/27 13:57:11 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -92,4 +92,7 @@ typedef off_t loff_t; unsigned long NAME[((BITS) + ((NBBY*sizeof(unsigned long)) - 1)) /\ (NBBY*sizeof(unsigned long))] +/* Definition copied in for convenience. */ +#define __user + #endif /* _LINUX_TYPES_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:55:12 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: rcupdate.h Log Message: Reverse backwards namespacing. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/rcupdate.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/rcupdate.h diff -u src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.6 src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.7 --- src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.6 Mon Aug 27 13:45:08 2018 +++ src/sys/external/bsd/drm2/include/linux/rcupdate.h Mon Aug 27 13:55:12 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rcupdate.h,v 1.6 2018/08/27 13:45:08 riastradh Exp $ */ +/* $NetBSD: rcupdate.h,v 1.7 2018/08/27 13:55:12 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -59,8 +59,8 @@ struct rcu_head { struct rcu_head *rcuh_next; }; -#define linux_call_rcu call_rcu -#define linux_synchronize_rcu synchronize_rcu +#define call_rcu linux_call_rcu +#define synchronize_rcu linux_synchronize_rcu int linux_rcu_gc_init(void); void linux_rcu_gc_fini(void);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:54:59 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: Add missing namespacing. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.12 src/sys/external/bsd/drm2/include/linux/fence.h:1.13 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.12 Mon Aug 27 13:36:53 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Mon Aug 27 13:54:59 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.12 2018/08/27 13:36:53 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.13 2018/08/27 13:54:59 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -79,9 +79,12 @@ struct fence_cb { #define fence_add_callback linux_fence_add_callback #define fence_context_alloc linux_fence_context_alloc +#define fence_default_wait linux_fence_default_wait #define fence_destroy linux_fence_destroy #define fence_enable_sw_signaling linux_fence_enable_sw_signaling +#define fence_free linux_fence_free #define fence_get linux_fence_get +#define fence_get_rcu linux_fence_get_rcu #define fence_init linux_fence_init #define fence_is_signaled linux_fence_is_signaled #define fence_is_signaled_locked linux_fence_is_signaled_locked
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:53:09 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/drm: drm_os_netbsd.h Log Message: Guard #include "pci.h" with _KERNEL_OPT. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.9 src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.10 --- src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.9 Mon Aug 27 07:50:08 2018 +++ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Mon Aug 27 13:53:09 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_os_netbsd.h,v 1.9 2018/08/27 07:50:08 riastradh Exp $ */ +/* $NetBSD: drm_os_netbsd.h,v 1.10 2018/08/27 13:53:09 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -41,7 +41,10 @@ #define CONFIG_X86_PAT 1 #endif +#if defined(_KERNEL_OPT) #include "pci.h" +#endif + #if NPCI > 0 #define CONFIG_PCI 1 #endif
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:45:08 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: rcupdate.h Log Message: Nix extraneous whitespace. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/rcupdate.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/rcupdate.h diff -u src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.5 src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.6 --- src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.5 Mon Aug 27 13:31:36 2018 +++ src/sys/external/bsd/drm2/include/linux/rcupdate.h Mon Aug 27 13:45:08 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rcupdate.h,v 1.5 2018/08/27 13:31:36 riastradh Exp $ */ +/* $NetBSD: rcupdate.h,v 1.6 2018/08/27 13:45:08 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -43,7 +43,6 @@ (P) = (V); \ } while (0) - #define rcu_dereference(P) ({ \ typeof(*(P)) *__rcu_dereference_tmp = (P); \ membar_datadep_consumer(); \
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:44:41 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: kref.h Log Message: Insert membars needed for non-x86. XXX We should really define membar_enter_postatomic and membar_exit_preatomic to avoid relying on not typoing __HAVE_ATOMIC_AS_MEMBAR. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/external/bsd/drm2/include/linux/kref.h:1.7 --- src/sys/external/bsd/drm2/include/linux/kref.h:1.6 Mon Aug 27 06:51:52 2018 +++ src/sys/external/bsd/drm2/include/linux/kref.h Mon Aug 27 13:44:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: kref.h,v 1.6 2018/08/27 06:51:52 riastradh Exp $ */ +/* $NetBSD: kref.h,v 1.7 2018/08/27 13:44:41 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,6 +36,7 @@ #include #include +#include #include struct kref { @@ -55,6 +56,10 @@ kref_get(struct kref *kref) atomic_inc_uint_nv(&kref->kr_count); KASSERTMSG((count > 1), "getting released kref"); + +#ifndef __HAVE_ATOMIC_AS_MEMBAR + membar_enter(); +#endif } static inline bool @@ -69,6 +74,10 @@ kref_get_unless_zero(struct kref *kref) } while (atomic_cas_uint(&kref->kr_count, count, (count + 1)) != count); +#ifndef __HAVE_ATOMIC_AS_MEMBAR + membar_enter(); +#endif + return true; } @@ -77,6 +86,10 @@ kref_sub(struct kref *kref, unsigned int { unsigned int old, new; +#ifndef __HAVE_ATOMIC_AS_MEMBAR + membar_exit(); +#endif + do { old = kref->kr_count; KASSERTMSG((count <= old), "overreleasing kref: %u - %u", @@ -105,6 +118,10 @@ kref_put_mutex(struct kref *kref, void ( { unsigned int old, new; +#ifndef __HAVE_ATOMIC_AS_MEMBAR + membar_exit(); +#endif + do { old = kref->kr_count; KASSERT(old > 0);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:44:54 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: mm.h slab.h vmalloc.h Log Message: Implement kvfree by free(9); assume kmalloc/vmalloc use malloc(9). To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/mm.h cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/slab.h \ src/sys/external/bsd/drm2/include/linux/vmalloc.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.8 src/sys/external/bsd/drm2/include/linux/mm.h:1.9 --- src/sys/external/bsd/drm2/include/linux/mm.h:1.8 Mon Aug 27 07:23:22 2018 +++ src/sys/external/bsd/drm2/include/linux/mm.h Mon Aug 27 13:44:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: mm.h,v 1.8 2018/08/27 07:23:22 riastradh Exp $ */ +/* $NetBSD: mm.h,v 1.9 2018/08/27 13:44:54 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,6 +32,8 @@ #ifndef _LINUX_MM_H_ #define _LINUX_MM_H_ +#include + #include #include @@ -77,10 +79,17 @@ get_num_physpages(void) return uvmexp.npages; } +/* + * XXX Requires that kmalloc in and vmalloc in + * both use malloc(9). If you change either of + * those, be sure to update this. + */ static inline void -kvfree(void * ptr) +kvfree(void *ptr) { - panic("Unimplemented"); + + if (ptr != NULL) + free(ptr, M_TEMP); } static inline void Index: src/sys/external/bsd/drm2/include/linux/slab.h diff -u src/sys/external/bsd/drm2/include/linux/slab.h:1.5 src/sys/external/bsd/drm2/include/linux/slab.h:1.6 --- src/sys/external/bsd/drm2/include/linux/slab.h:1.5 Mon Mar 2 02:26:37 2015 +++ src/sys/external/bsd/drm2/include/linux/slab.h Mon Aug 27 13:44:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: slab.h,v 1.5 2015/03/02 02:26:37 riastradh Exp $ */ +/* $NetBSD: slab.h,v 1.6 2018/08/27 13:44:54 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -81,6 +81,12 @@ linux_gfp_to_malloc(gfp_t gfp) return flags; } +/* + * XXX vmalloc and kmalloc both use malloc(9). If you change this, be + * sure to update vmalloc in and kvfree in + * . + */ + static inline void * kmalloc(size_t size, gfp_t gfp) { Index: src/sys/external/bsd/drm2/include/linux/vmalloc.h diff -u src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.5 src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.6 --- src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.5 Mon Aug 6 00:30:07 2018 +++ src/sys/external/bsd/drm2/include/linux/vmalloc.h Mon Aug 27 13:44:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: vmalloc.h,v 1.5 2018/08/06 00:30:07 riastradh Exp $ */ +/* $NetBSD: vmalloc.h,v 1.6 2018/08/27 13:44:54 riastradh Exp $ */ /*- * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc. @@ -40,10 +40,14 @@ #include +/* + * XXX vmalloc and kmalloc both use malloc(9). If you change this, be + * sure to update kmalloc in and kvfree in . + */ + static inline bool is_vmalloc_addr(void *addr) { - /* XXX Assumes vmalloc and kmalloc both use malloc(9). */ return true; }
CVS commit: src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:44:16 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/asm: cpufeature.h Log Message: Define cpu_has_pat for x86. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/asm/cpufeature.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/asm/cpufeature.h diff -u src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.3 src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.4 --- src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.3 Mon Aug 27 13:44:04 2018 +++ src/sys/external/bsd/drm2/include/asm/cpufeature.h Mon Aug 27 13:44:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufeature.h,v 1.3 2018/08/27 13:44:04 riastradh Exp $ */ +/* $NetBSD: cpufeature.h,v 1.4 2018/08/27 13:44:15 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -37,6 +37,7 @@ #if defined(__i386__) || defined(__x86_64__) #define cpu_has_clflush ((cpu_info_primary.ci_feat_val[0] & CPUID_CFLUSH) != 0) +#define cpu_has_pat ((cpu_info_primary.ci_feat_val[0] & CPUID_PAT) != 0) static inline size_t cache_line_size(void)
CVS commit: src/sys/external/bsd/drm2/include/asm
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:44:04 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/asm: cpufeature.h Log Message: Make this a proper boolean. Skip ISSET. Add some spacing. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/asm/cpufeature.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/asm/cpufeature.h diff -u src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.2 src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.3 --- src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.2 Mon Aug 27 07:08:47 2018 +++ src/sys/external/bsd/drm2/include/asm/cpufeature.h Mon Aug 27 13:44:04 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufeature.h,v 1.2 2018/08/27 07:08:47 riastradh Exp $ */ +/* $NetBSD: cpufeature.h,v 1.3 2018/08/27 13:44:04 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -35,12 +35,15 @@ #include #if defined(__i386__) || defined(__x86_64__) -#define cpu_has_clflush ISSET(cpu_info_primary.ci_feat_val[0], CPUID_CFLUSH) + +#define cpu_has_clflush ((cpu_info_primary.ci_feat_val[0] & CPUID_CFLUSH) != 0) + static inline size_t cache_line_size(void) { return cpu_info_primary.ci_cflush_lsize; } -#endif + +#endif /* x86 */ #endif /* _LINUX_ASM_CPUFEATURE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:41:08 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: atomic.h Log Message: Attempt to match Linux semantics for membars implied by atomics. This is kind of moot at the moment because we're mostly x86-only for drmkms, but this might help in the future if we ever went beyond x86. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 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.12 src/sys/external/bsd/drm2/include/linux/atomic.h:1.13 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.12 Mon Aug 27 13:40:53 2018 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Mon Aug 27 13:41:08 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.12 2018/08/27 13:40:53 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.13 2018/08/27 13:41:08 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,6 +36,22 @@ #include +#if defined(MULTIPROCESSOR) && !defined(__HAVE_ATOMIC_AS_MEMBAR) +# define smp_mb__before_atomic() membar_exit() +# define smp_mb__after_atomic() membar_enter() +#else +# define smp_mb__before_atomic() __insn_barrier() +# define smp_mb__after_atomic() __insn_barrier() +#endif + +/* + * atomic (u)int operations + * + * Atomics that return a value, other than atomic_read, imply a + * full memory_sync barrier. Those that do not return a value + * imply no memory barrier. + */ + struct atomic { union { volatile int au_int; @@ -50,78 +66,106 @@ typedef struct atomic atomic_t; static inline int atomic_read(atomic_t *atomic) { + /* no membar */ return atomic->a_u.au_int; } static inline void atomic_set(atomic_t *atomic, int value) { + /* no membar */ atomic->a_u.au_int = value; } static inline void atomic_add(int addend, atomic_t *atomic) { + /* no membar */ atomic_add_int(&atomic->a_u.au_uint, addend); } static inline void atomic_sub(int subtrahend, atomic_t *atomic) { + /* no membar */ atomic_add_int(&atomic->a_u.au_uint, -subtrahend); } static inline int atomic_add_return(int addend, atomic_t *atomic) { - return (int)atomic_add_int_nv(&atomic->a_u.au_uint, addend); + int v; + + smp_mb__before_atomic(); + v = (int)atomic_add_int_nv(&atomic->a_u.au_uint, addend); + smp_mb__after_atomic(); + + return v; } static inline void atomic_inc(atomic_t *atomic) { + /* no membar */ atomic_inc_uint(&atomic->a_u.au_uint); } static inline void atomic_dec(atomic_t *atomic) { + /* no membar */ atomic_dec_uint(&atomic->a_u.au_uint); } static inline int atomic_inc_return(atomic_t *atomic) { - return (int)atomic_inc_uint_nv(&atomic->a_u.au_uint); + int v; + + smp_mb__before_atomic(); + v = (int)atomic_inc_uint_nv(&atomic->a_u.au_uint); + smp_mb__after_atomic(); + + return v; } static inline int atomic_dec_return(atomic_t *atomic) { - return (int)atomic_dec_uint_nv(&atomic->a_u.au_uint); + int v; + + smp_mb__before_atomic(); + v = (int)atomic_dec_uint_nv(&atomic->a_u.au_uint); + smp_mb__after_atomic(); + + return v; } static inline int atomic_dec_and_test(atomic_t *atomic) { - return (0 == (int)atomic_dec_uint_nv(&atomic->a_u.au_uint)); + /* membar implied by atomic_dec_return */ + return atomic_dec_return(atomic) == 0; } static inline void atomic_or(int value, atomic_t *atomic) { + /* no membar */ atomic_or_uint(&atomic->a_u.au_uint, value); } static inline void atomic_set_mask(unsigned long mask, atomic_t *atomic) { + /* no membar */ atomic_or_uint(&atomic->a_u.au_uint, mask); } static inline void atomic_clear_mask(unsigned long mask, atomic_t *atomic) { + /* no membar */ atomic_and_uint(&atomic->a_u.au_uint, ~mask); } @@ -130,33 +174,53 @@ atomic_add_unless(atomic_t *atomic, int { int value; + smp_mb__before_atomic(); do { value = atomic->a_u.au_int; if (value == zero) - return 0; + break; } while (atomic_cas_uint(&atomic->a_u.au_uint, value, (value + addend)) != value); + smp_mb__after_atomic(); - return 1; + return value != zero; } static inline int atomic_inc_not_zero(atomic_t *atomic) { + /* membar implied by atomic_add_unless */ return atomic_add_unless(atomic, 1, 0); } static inline int atomic_xchg(atomic_t *atomic, int new) { - return (int)atomic_swap_uint(&atomic->a_u.au_uint, (unsigned)new); + int old; + + smp_mb__before_atomic(); + old = (int)atomic_swap_uint(&atomic->a_u.au_uint, (unsigned)new); + smp_mb__after_atomic(); + + return old; } static inline int -atomic_cmpxchg(atomic_t *atomic, int old, int new) +atomic_cmpxchg(atomic_t *atomic, int expect, int new) { - return (int)atomic_cas_uint(&atomic->a_u.au_uint, (unsigned)old, + int old; + + /* + * XXX As an optimization, under
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:40:54 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: atomic.h Log Message: Nix memory barriers that were nixed upstream. Add smp_mb__after_atomic. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/external/bsd/drm2/include/linux/atomic.h:1.12 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.11 Mon Aug 27 13:40:41 2018 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Mon Aug 27 13:40:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.11 2018/08/27 13:40:41 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.12 2018/08/27 13:40:53 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -276,16 +276,10 @@ test_and_change_bit(unsigned int bit, vo * before/after memory barriers is not consistent throughout Linux. */ # define smp_mb__before_atomic() membar_sync() -# define smp_mb__before_atomic_inc() membar_sync() -# define smp_mb__after_atomic_inc() membar_sync() -# define smp_mb__before_atomic_dec() membar_sync() -# define smp_mb__after_atomic_dec() membar_sync() +# define smp_mb__after_atomic() membar_sync() #else # define smp_mb__before_atomic() __insn_barrier() -# define smp_mb__before_atomic_inc() __insn_barrier() -# define smp_mb__after_atomic_inc() __insn_barrier() -# define smp_mb__before_atomic_dec() __insn_barrier() -# define smp_mb__after_atomic_dec() __insn_barrier() +# define smp_mb__after_atomic() __insn_barrier() #endif #endif /* _LINUX_ATOMIC_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:40:41 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: atomic.h Log Message: Fix return types of test_and_{set,clear,change}_bit. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.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.10 src/sys/external/bsd/drm2/include/linux/atomic.h:1.11 --- src/sys/external/bsd/drm2/include/linux/atomic.h:1.10 Mon Aug 27 07:14:19 2018 +++ src/sys/external/bsd/drm2/include/linux/atomic.h Mon Aug 27 13:40:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.10 2018/08/27 07:14:19 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.11 2018/08/27 13:40:41 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -228,7 +228,7 @@ change_bit(unsigned int bit, volatile un do v = *p; while (atomic_cas_ulong(p, v, (v ^ mask)) != v); } -static inline unsigned long +static inline int test_and_set_bit(unsigned int bit, volatile unsigned long *ptr) { const unsigned int units = (sizeof(*ptr) * CHAR_BIT); @@ -241,7 +241,7 @@ test_and_set_bit(unsigned int bit, volat return ((v & mask) != 0); } -static inline unsigned long +static inline int test_and_clear_bit(unsigned int bit, volatile unsigned long *ptr) { const unsigned int units = (sizeof(*ptr) * CHAR_BIT); @@ -254,7 +254,7 @@ test_and_clear_bit(unsigned int bit, vol return ((v & mask) != 0); } -static inline unsigned long +static inline int test_and_change_bit(unsigned int bit, volatile unsigned long *ptr) { const unsigned int units = (sizeof(*ptr) * CHAR_BIT);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:40:15 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: firmware.h Log Message: correct typo shows up as null deref in finish_csr_load. Author: coypoop Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/firmware.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/firmware.h diff -u src/sys/external/bsd/drm2/include/linux/firmware.h:1.8 src/sys/external/bsd/drm2/include/linux/firmware.h:1.9 --- src/sys/external/bsd/drm2/include/linux/firmware.h:1.8 Mon Aug 27 07:24:54 2018 +++ src/sys/external/bsd/drm2/include/linux/firmware.h Mon Aug 27 13:40:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: firmware.h,v 1.8 2018/08/27 07:24:54 riastradh Exp $ */ +/* $NetBSD: firmware.h,v 1.9 2018/08/27 13:40:15 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -159,7 +159,7 @@ request_firmware_nowait(struct module *m /* Initialize the work. */ work->flw_name = namedup; work->flw_callback = callback; - work->flw_cookie = callback; + work->flw_cookie = cookie; work->flw_device = device; work->flw_module = module; INIT_WORK(&work->flw_work, request_firmware_work);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:39:33 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: Free the bus crap. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 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.31 src/sys/external/bsd/drm2/include/linux/pci.h:1.32 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.31 Mon Aug 27 13:39:21 2018 +++ src/sys/external/bsd/drm2/include/linux/pci.h Mon Aug 27 13:39:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.31 2018/08/27 13:39:21 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.32 2018/08/27 13:39:33 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -525,6 +525,7 @@ pci_dev_put(struct pci_dev *pdev) return; KASSERT(ISSET(pdev->pd_kludges, NBPCI_KLUDGE_GET_MUMBLE)); + kmem_free(pdev->bus, sizeof(*pdev->bus)); kmem_free(pdev, sizeof(*pdev)); }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:39:21 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: For the kludges we don't have or need a device (parent) pointer. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 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.30 src/sys/external/bsd/drm2/include/linux/pci.h:1.31 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.30 Mon Aug 27 07:47:32 2018 +++ src/sys/external/bsd/drm2/include/linux/pci.h Mon Aug 27 13:39:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.30 2018/08/27 07:47:32 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.31 2018/08/27 13:39:21 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -204,7 +204,7 @@ linux_pci_dev_init(struct pci_dev *pdev, #endif pdev->bus = kmem_zalloc(sizeof(struct pci_bus), KM_NOSLEEP); pdev->bus->pb_pc = pa->pa_pc; - pdev->bus->pb_dev = device_parent(dev); + pdev->bus->pb_dev = dev == NULL ? NULL : device_parent(dev); pdev->bus->number = pa->pa_bus; pdev->devfn = PCI_DEVFN(pa->pa_device, pa->pa_function); pdev->vendor = PCI_VENDOR(pa->pa_id);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 13:37:37 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: hardirq.h Log Message: Can't and needn't xcall while cold. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/hardirq.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/hardirq.h diff -u src/sys/external/bsd/drm2/include/linux/hardirq.h:1.1 src/sys/external/bsd/drm2/include/linux/hardirq.h:1.2 --- src/sys/external/bsd/drm2/include/linux/hardirq.h:1.1 Mon Aug 27 07:14:42 2018 +++ src/sys/external/bsd/drm2/include/linux/hardirq.h Mon Aug 27 13:37:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: hardirq.h,v 1.1 2018/08/27 07:14:42 riastradh Exp $ */ +/* $NetBSD: hardirq.h,v 1.2 2018/08/27 13:37:37 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -33,6 +33,7 @@ #define _LINUX_HARDIRQ_H_ #include +#include #include #include @@ -53,7 +54,8 @@ static inline void synchronize_irq(int irq) { - xc_wait(xc_broadcast(0, synchronize_irq_xc, NULL, NULL)); + if (!cold) + xc_wait(xc_broadcast(0, synchronize_irq_xc, NULL, NULL)); } #endif /* _LINUX_HARDIRQ_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:57:22 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: clk.h Log Message: Stub out clk API if no FBT. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/clk.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/clk.h diff -u src/sys/external/bsd/drm2/include/linux/clk.h:1.2 src/sys/external/bsd/drm2/include/linux/clk.h:1.3 --- src/sys/external/bsd/drm2/include/linux/clk.h:1.2 Mon Aug 27 07:33:27 2018 +++ src/sys/external/bsd/drm2/include/linux/clk.h Mon Aug 27 07:57:22 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: clk.h,v 1.2 2018/08/27 07:33:27 riastradh Exp $ */ +/* $NetBSD: clk.h,v 1.3 2018/08/27 07:57:22 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,6 +32,26 @@ #ifndef _LINUX_CLK_H_ #define _LINUX_CLK_H_ +/* XXX Use FDT as a proxy for clk API until we have a clk flag. */ + +#ifdef _KERNEL_OPT +#include "opt_fdt.h" +#endif + +#ifdef FDT + #include +#else + +struct clk; + +static inline unsigned +clk_get_rate(struct clk *clk) +{ + panic("unreachable"); +} + +#endif + #endif /* _LINUX_CLK_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:55:49 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: async.h Log Message: Implement synchronously. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/async.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/async.h diff -u src/sys/external/bsd/drm2/include/linux/async.h:1.3 src/sys/external/bsd/drm2/include/linux/async.h:1.4 --- src/sys/external/bsd/drm2/include/linux/async.h:1.3 Mon Aug 27 06:19:05 2018 +++ src/sys/external/bsd/drm2/include/linux/async.h Mon Aug 27 07:55:49 2018 @@ -1,16 +1,64 @@ +/* $NetBSD: async.h,v 1.4 2018/08/27 07:55:49 riastradh Exp $ */ + +/*- + * Copyright (c) 2018 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_ASYNC_H_ #define _LINUX_ASYNC_H_ -#include /* panic */ +typedef unsigned long async_cookie_t; -typedef struct async_cookie_t { +/* + * async_schedule(fn, arg) + * + * Schedule the kernel to run fn(arg, cookie) at some point to + * avoid slowing down boot, or call it synchronously if memory is + * short. Returns a cookie that can be used to wait for the + * function to have been called. + */ +static inline async_cookie_t +async_schedule(void (*fn)(void *, async_cookie_t), void *arg) +{ -} async_cookie_t; + (*fn)(arg, 1); + return 1; +} +/* + * async_synchronize_full() + * + * Wait for all outstanding asynchronous actions to have completed + * before returning. + */ static inline void -async_schedule(void (*func)(void *, async_cookie_t), void *cookie) +async_synchronize_full(void) { - panic("XXX defer function"); } #endif /* _LINUX_ASYNC_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:51:59 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree.h Log Message: Fill out interval tree a little bit including wacky linux rb stubs. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/sys/external/bsd/drm2/include/linux/interval_tree.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/interval_tree.h diff -u src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.5 src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.6 --- src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.5 Mon Aug 27 06:42:28 2018 +++ src/sys/external/bsd/drm2/include/linux/interval_tree.h Mon Aug 27 07:51:59 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: interval_tree.h,v 1.5 2018/08/27 06:42:28 riastradh Exp $ */ +/* $NetBSD: interval_tree.h,v 1.6 2018/08/27 07:51:59 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -38,6 +38,13 @@ struct rb_root { struct rb_tree rbr_tree; }; +static inline bool +RB_EMPTY_ROOT(struct rb_root *root) +{ + + return RB_TREE_MIN(&root->rbr_tree) == NULL; +} + struct interval_tree_node { struct rb_node itn_node; unsigned long start; /* inclusive */ @@ -81,6 +88,13 @@ static const rb_tree_ops_t interval_tree }; static inline void +interval_tree_init(struct rb_root *root) +{ + + rb_tree_init(&root->rbr_tree, &interval_tree_ops); +} + +static inline void interval_tree_insert(struct interval_tree_node *node, struct rb_root *root) { struct interval_tree_node *collision __diagused; @@ -132,4 +146,16 @@ interval_tree_iter_next(struct rb_root * return NULL; } +/* + * XXX This is not actually postorder, but I can't fathom why you would + * want postorder for an ordered tree; different insertion orders lead + * to different traversal orders. + */ +#define rbtree_postorder_for_each_entry_safe(NODE, TMP, ROOT, FIELD) \ + for ((NODE) = RB_TREE_MIN(&(ROOT)->rbr_tree); \ + ((NODE) != NULL && \ + ((TMP) = rb_tree_iterate(&(ROOT)->rbr_tree, (NODE), \ + RB_DIR_RIGHT))); \ + (NODE) = (TMP)) + #endif /* _LINUX_INTERVAL_TREE_H_ */
CVS commit: src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:51:38 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include: radeon_trace.h Log Message: Add trace_radeon_vm_flush stub. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/radeon_trace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/radeon_trace.h diff -u src/sys/external/bsd/drm2/include/radeon_trace.h:1.1 src/sys/external/bsd/drm2/include/radeon_trace.h:1.2 --- src/sys/external/bsd/drm2/include/radeon_trace.h:1.1 Wed Jul 16 20:59:58 2014 +++ src/sys/external/bsd/drm2/include/radeon_trace.h Mon Aug 27 07:51:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: radeon_trace.h,v 1.1 2014/07/16 20:59:58 riastradh Exp $ */ +/* $NetBSD: radeon_trace.h,v 1.2 2018/08/27 07:51:37 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -97,4 +97,9 @@ trace_radeon_vm_set_page(uint64_t pe __u { } +static inline void +trace_radeon_vm_flush(uint64_t pd_addr, int ring, unsigned id) +{ +} + #endif /* _RADEON_TRACE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:53:05 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: Add fence_enable_sw_signaling prototype. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.9 src/sys/external/bsd/drm2/include/linux/fence.h:1.10 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.9 Mon Aug 27 07:47:43 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Mon Aug 27 07:53:05 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.9 2018/08/27 07:47:43 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.10 2018/08/27 07:53:05 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -68,6 +68,7 @@ struct fence_cb { #define fence_add_callback linux_fence_add_callback #define fence_context_alloc linux_fence_context_alloc +#define fence_enable_sw_signaling linux_fence_enable_sw_signaling #define fence_get linux_fence_get #define fence_init linux_fence_init #define fence_put linux_fence_put @@ -90,6 +91,7 @@ void fence_put(struct fence *); int fence_add_callback(struct fence *, struct fence_cb *, fence_func_t); bool fence_remove_callback(struct fence *, struct fence_cb *); +void fence_enable_sw_signaling(struct fence *); bool fence_is_signaled(struct fence *); bool fence_is_signaled_locked(struct fence *);
CVS commit: src/sys/external/bsd/drm2/include/drm
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:50:08 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/drm: drm_os_netbsd.h Log Message: Define CONFIG_MTRR and CONFIG_X86_PAT. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 \ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h diff -u src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.8 src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.9 --- src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.8 Mon Aug 27 06:42:54 2018 +++ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h Mon Aug 27 07:50:08 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_os_netbsd.h,v 1.8 2018/08/27 06:42:54 riastradh Exp $ */ +/* $NetBSD: drm_os_netbsd.h,v 1.9 2018/08/27 07:50:08 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,12 +36,9 @@ #include "opt_drmkms.h" #endif -/* - * XXX Better to get rid of CONFIG_X86, but that's not convenient at - * the moment. - */ #if defined(__i386__) || defined(__x86_64__) #define CONFIG_X86 1 +#define CONFIG_X86_PAT 1 #endif #include "pci.h" @@ -57,6 +54,14 @@ #define CONFIG_PNP #endif +#if defined(_KERNEL_OPT) +#include "opt_mtrr.h" +#endif + +#ifdef MTRR +#define CONFIG_MTRR 1 +#endif + #include #include #include
CVS commit: src/sys/external/bsd/drm2/include/linux/regulator
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:49:36 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux/regulator: consumer.h Log Message: Protect #include "opt_*.h" by #ifdef _KERNEL_OPT. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/include/linux/regulator/consumer.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/regulator/consumer.h diff -u src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.2 src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.3 --- src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.2 Mon Aug 27 07:33:18 2018 +++ src/sys/external/bsd/drm2/include/linux/regulator/consumer.h Mon Aug 27 07:49:36 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: consumer.h,v 1.2 2018/08/27 07:33:18 riastradh Exp $ */ +/* $NetBSD: consumer.h,v 1.3 2018/08/27 07:49:36 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,9 @@ #ifndef _LINUX_REGULATOR_CONSUMER_H_ #define _LINUX_REGULATOR_CONSUMER_H_ +#ifdef _KERNEL_OPT #include "opt_fdt.h" +#endif #ifdef FDT
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:47:21 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: Define FENCE_TRACE. Need some way to limit it... To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.7 src/sys/external/bsd/drm2/include/linux/fence.h:1.8 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.7 Mon Aug 27 07:34:32 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Mon Aug 27 07:47:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.7 2018/08/27 07:34:32 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.8 2018/08/27 07:47:21 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -97,4 +97,15 @@ long fence_default_wait(struct fence *, long fence_wait(struct fence *, bool); long fence_wait_timeout(struct fence *, bool, int); +static inline void +FENCE_TRACE(struct fence *f, const char *fmt, ...) +{ + va_list va; + + va_start(va, fmt); + printf("fence %u@%u: ", f->context, f->seqno); + vprintf(fmt, va); + va_end(va); +} + #endif /* _LINUX_FENCE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:47:43 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: Add fence_signal prototype. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.8 src/sys/external/bsd/drm2/include/linux/fence.h:1.9 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.8 Mon Aug 27 07:47:21 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Mon Aug 27 07:47:43 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.8 2018/08/27 07:47:21 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.9 2018/08/27 07:47:43 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -72,6 +72,7 @@ struct fence_cb { #define fence_init linux_fence_init #define fence_put linux_fence_put #define fence_remove_callback linux_fence_remove_callback +#define fence_signal linux_fence_signal #define fence_signal_locked linux_fence_signal_locked #define fence_wait linux_fence_wait #define fence_wait_timeout linux_fence_wait_timeout @@ -92,6 +93,7 @@ bool fence_remove_callback(struct fence bool fence_is_signaled(struct fence *); bool fence_is_signaled_locked(struct fence *); +int fence_signal(struct fence *); int fence_signal_locked(struct fence *); long fence_default_wait(struct fence *, bool, long); long fence_wait(struct fence *, bool);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:47:32 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: Add no_64bit_msi field. (What to do wiht it?) To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 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.29 src/sys/external/bsd/drm2/include/linux/pci.h:1.30 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.29 Mon Aug 27 07:34:13 2018 +++ src/sys/external/bsd/drm2/include/linux/pci.h Mon Aug 27 07:47:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.29 2018/08/27 07:34:13 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.30 2018/08/27 07:47:32 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -168,6 +168,7 @@ struct pci_dev { uint8_t revision; uint32_t class; bool msi_enabled; + bool no_64bit_msi; }; static inline device_t
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:47:11 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: Hazard a guess about a reliable MAX_SCHEDULE_TIMEOUT. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/sched.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/sched.h diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.9 src/sys/external/bsd/drm2/include/linux/sched.h:1.10 --- src/sys/external/bsd/drm2/include/linux/sched.h:1.9 Mon Aug 27 07:29:09 2018 +++ src/sys/external/bsd/drm2/include/linux/sched.h Mon Aug 27 07:47:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sched.h,v 1.9 2018/08/27 07:29:09 riastradh Exp $ */ +/* $NetBSD: sched.h,v 1.10 2018/08/27 07:47:11 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ #define TASK_COMM_LEN MAXCOMLEN +#define MAX_SCHEDULE_TIMEOUT (INT_MAX/2) /* paranoia */ + #define current curproc static inline pid_t
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:47:01 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: rwsem.h Log Message: Add down_read_trylock and downgrade_write. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/rwsem.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/rwsem.h diff -u src/sys/external/bsd/drm2/include/linux/rwsem.h:1.1 src/sys/external/bsd/drm2/include/linux/rwsem.h:1.2 --- src/sys/external/bsd/drm2/include/linux/rwsem.h:1.1 Wed Jul 16 20:59:58 2014 +++ src/sys/external/bsd/drm2/include/linux/rwsem.h Mon Aug 27 07:47:01 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rwsem.h,v 1.1 2014/07/16 20:59:58 riastradh Exp $ */ +/* $NetBSD: rwsem.h,v 1.2 2018/08/27 07:47:01 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -70,6 +70,13 @@ down_read(struct rw_semaphore *rwsem) rw_enter(&rwsem->rws_lock, RW_READER); } +static inline bool +down_read_trylock(struct rw_semaphore *rwsem) +{ + + return rw_tryenter(&rwsem->rws_lock, RW_READER); +} + static inline void down_write(struct rw_semaphore *rwsem) { @@ -91,4 +98,11 @@ up_write(struct rw_semaphore *rwsem) rw_exit(&rwsem->rws_lock); } +static inline void +downgrade_write(struct rw_semaphore *rwsem) +{ + + rw_downgrade(&rwsem->rws_lock); +} + #endif /* _LINUX_RWSEM_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:44:32 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: highmem.h Log Message: Sort. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 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.3 src/sys/external/bsd/drm2/include/linux/highmem.h:1.4 --- src/sys/external/bsd/drm2/include/linux/highmem.h:1.3 Wed Jul 16 20:59:58 2014 +++ src/sys/external/bsd/drm2/include/linux/highmem.h Mon Aug 27 07:44:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: highmem.h,v 1.3 2014/07/16 20:59:58 riastradh Exp $ */ +/* $NetBSD: highmem.h,v 1.4 2018/08/27 07:44:32 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -41,10 +41,10 @@ #include /* 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 +#define kmap linux_kmap +#define kmap_atomic linux_kmap_atomic +#define kunmap linux_kunmap +#define kunmap_atomic linux_kunmap_atomic /* XXX Kludge! */ #define kmap_atomic_prot(page, prot) kmap_atomic(page)
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:34:03 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: mutex.h Log Message: Add lockdep_is_held stub. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/external/bsd/drm2/include/linux/mutex.h:1.11 --- src/sys/external/bsd/drm2/include/linux/mutex.h:1.10 Mon Aug 27 07:24:44 2018 +++ src/sys/external/bsd/drm2/include/linux/mutex.h Mon Aug 27 07:34:03 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: mutex.h,v 1.10 2018/08/27 07:24:44 riastradh Exp $ */ +/* $NetBSD: mutex.h,v 1.11 2018/08/27 07:34:03 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -111,6 +111,7 @@ mutex_lock_nest_lock(struct mutex *mutex #define __lockdep_used __unused #define lockdep_assert_held(m) do {} while (0) +#define lockdep_is_held(m) 1 #define SINGLE_DEPTH_NESTING 0
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:34:41 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: reservation.h Log Message: More stubs. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/linux/reservation.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/reservation.h diff -u src/sys/external/bsd/drm2/include/linux/reservation.h:1.3 src/sys/external/bsd/drm2/include/linux/reservation.h:1.4 --- src/sys/external/bsd/drm2/include/linux/reservation.h:1.3 Mon Aug 27 07:32:22 2018 +++ src/sys/external/bsd/drm2/include/linux/reservation.h Mon Aug 27 07:34:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: reservation.h,v 1.3 2018/08/27 07:32:22 riastradh Exp $ */ +/* $NetBSD: reservation.h,v 1.4 2018/08/27 07:34:41 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,6 +34,7 @@ #include +#include #include struct fence; @@ -41,18 +42,32 @@ struct fence; extern struct ww_class reservation_ww_class; struct reservation_object { - struct ww_mutex lock; + struct ww_mutex lock; - struct fence *robj_fence_excl; + struct reservation_object_list __rcu *robj_objlist; + struct fence __rcu *robj_fence_excl; +}; + +struct reservation_object_list { + uint32_t shared_count; + struct fence __rcu *shared[]; }; #define reservation_object_add_excl_fence linux_reservation_object_add_excl_fence #define reservation_object_add_shared_fence linux_reservation_object_add_shared_fence +#define reservation_object_reserve_shared linux_reservation_object_reserve_shared +#define reservation_object_test_signaled_rcu linux_reservation_object_test_signaled_rcu +#define reservation_object_wait_timeout_rcu linux_reservation_object_wait_timeout_rcu void reservation_object_add_excl_fence(struct reservation_object *, struct fence *); void reservation_object_add_shared_fence(struct reservation_object *, struct fence *); +int reservation_object_reserve_shared(struct reservation_object *); +bool reservation_object_test_signaled_rcu(struct reservation_object *, + bool); +long reservation_object_wait_timeout_rcu(struct reservation_object *, + bool, bool, unsigned long); static inline void reservation_object_init(struct reservation_object *reservation) @@ -68,15 +83,35 @@ reservation_object_fini(struct reservati ww_mutex_destroy(&reservation->lock); } +static inline bool +reservation_object_held(struct reservation_object *reservation) +{ + + return ww_mutex_is_locked(&reservation->lock); +} + static inline struct fence * reservation_object_get_excl(struct reservation_object *reservation) { struct fence *fence; + KASSERT(reservation_object_held(reservation)); fence = reservation->robj_fence_excl; membar_datadep_consumer(); return fence; } +static inline struct reservation_object_list * +reservation_object_get_list(struct reservation_object *reservation) +{ + struct reservation_object_list *objlist; + + KASSERT(reservation_object_held(reservation)); + objlist = reservation->robj_objlist; + membar_datadep_consumer(); + + return objlist; +} + #endif /* _LINUX_RESERVATION_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:33:45 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: io.h Log Message: Rename namespacing for phys_arch_wc_index. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/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/io.h diff -u src/sys/external/bsd/drm2/include/linux/io.h:1.5 src/sys/external/bsd/drm2/include/linux/io.h:1.6 --- src/sys/external/bsd/drm2/include/linux/io.h:1.5 Mon Aug 27 06:49:52 2018 +++ src/sys/external/bsd/drm2/include/linux/io.h Mon Aug 27 07:33:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: io.h,v 1.5 2018/08/27 06:49:52 riastradh Exp $ */ +/* $NetBSD: io.h,v 1.6 2018/08/27 07:33:45 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #define arch_phys_wc_add linux_arch_phys_wc_add #define arch_phys_wc_del linux_arch_phys_wc_del -#define phys_wc_to_mtrr_index linux_phys_wc_to_mtrr_index +#define arch_phys_wc_index linux_arch_phys_wc_index int linux_writecomb_init(void); void linux_writecomb_fini(void);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:34:32 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: Fill out , pending implementing the symbols. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.6 src/sys/external/bsd/drm2/include/linux/fence.h:1.7 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.6 Mon Aug 27 07:32:00 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Mon Aug 27 07:34:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.6 2018/08/27 07:32:00 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.7 2018/08/27 07:34:32 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,22 +32,69 @@ #ifndef _LINUX_FENCE_H_ #define _LINUX_FENCE_H_ +#include + +#include #include -struct fence_ops { -}; +struct fence_cb; struct fence { + struct kref refcount; + spinlock_t *lock; + unsigned long flags; + unsigned context; + unsigned seqno; const struct fence_ops *ops; }; +#define FENCE_FLAG_SIGNALED_BIT __BIT(0) +#define FENCE_FLAG_USER_BITS __BIT(1) + +struct fence_ops { + const char *(*get_driver_name)(struct fence *); + const char *(*get_timeline_name)(struct fence *); + bool (*enable_signaling)(struct fence *); + bool (*signaled)(struct fence *); + long (*wait)(struct fence *, bool, long); + void (*release)(struct fence *); +}; + +typedef void (*fence_func_t)(struct fence *, struct fence_cb *); + +struct fence_cb { + fence_func_t fcb_func; +}; + +#define fence_add_callback linux_fence_add_callback +#define fence_context_alloc linux_fence_context_alloc #define fence_get linux_fence_get +#define fence_init linux_fence_init #define fence_put linux_fence_put +#define fence_remove_callback linux_fence_remove_callback +#define fence_signal_locked linux_fence_signal_locked #define fence_wait linux_fence_wait +#define fence_wait_timeout linux_fence_wait_timeout + +void fence_init(struct fence *, const struct fence_ops *, spinlock_t *, + unsigned, unsigned); +void fence_free(struct fence *); + +unsigned + fence_context_alloc(unsigned); -long fence_wait(struct fence *, bool); struct fence * fence_get(struct fence *); void fence_put(struct fence *); +int fence_add_callback(struct fence *, struct fence_cb *, fence_func_t); +bool fence_remove_callback(struct fence *, struct fence_cb *); + +bool fence_is_signaled(struct fence *); +bool fence_is_signaled_locked(struct fence *); +int fence_signal_locked(struct fence *); +long fence_default_wait(struct fence *, bool, long); +long fence_wait(struct fence *, bool); +long fence_wait_timeout(struct fence *, bool, int); + #endif /* _LINUX_FENCE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:34:23 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: rcupdate.h Log Message: Fill out . The patent is expired, right? To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/rcupdate.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/rcupdate.h diff -u src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.3 src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.4 --- src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.3 Mon Aug 27 07:31:06 2018 +++ src/sys/external/bsd/drm2/include/linux/rcupdate.h Mon Aug 27 07:34:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rcupdate.h,v 1.3 2018/08/27 07:31:06 riastradh Exp $ */ +/* $NetBSD: rcupdate.h,v 1.4 2018/08/27 07:34:23 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,6 +32,52 @@ #ifndef _LINUX_RCUPDATE_H_ #define _LINUX_RCUPDATE_H_ +#include +#include +#include + #define __rcu +#define rcu_assign_pointer(P, V) do { \ + membar_producer(); \ + (P) = (V); \ +} while (0) + + +#define rcu_dereference(P) rcu_dereference_protected((P), 1) + +#define rcu_dereference_protected(P, C) ({ \ + WARN_ON(!(C)); \ + typeof(*(P)) *__rcu_dereference_protected_tmp = (P); \ + membar_datadep_consumer(); \ + __rcu_dereference_protected_tmp; \ +}) + +static inline void +rcu_read_lock(void) +{ + + kpreempt_disable(); + __insn_barrier(); +} + +static inline void +rcu_read_unlock(void) +{ + + __insn_barrier(); + kpreempt_enable(); +} + +static inline void +synchronize_rcu_xc(void *a, void *b) +{ +} + +static inline void +synchronize_rcu(void) +{ + xc_wait(xc_broadcast(0, &synchronize_rcu_xc, NULL, NULL)); +} + #endif /* _LINUX_RCUPDATE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:33:53 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: module.h Log Message: Include first in . If not, later includes of will fail because defines a Linux macro module_init that causes the prototype for our function module_init to evaporate. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/external/bsd/drm2/include/linux/module.h:1.6 --- src/sys/external/bsd/drm2/include/linux/module.h:1.5 Wed Nov 12 02:24:40 2014 +++ src/sys/external/bsd/drm2/include/linux/module.h Mon Aug 27 07:33:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.5 2014/11/12 02:24:40 christos Exp $ */ +/* $NetBSD: module.h,v 1.6 2018/08/27 07:33:53 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,6 +32,9 @@ #ifndef _LINUX_MODULE_H_ #define _LINUX_MODULE_H_ +/* XXX Get this first so we don't nuke the module_init declaration. */ +#include + #include #include
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:34:13 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: Add pci_enable/disable_device, pci_domain_nr, and some vendor ids. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 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.28 src/sys/external/bsd/drm2/include/linux/pci.h:1.29 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.28 Mon Aug 27 07:20:05 2018 +++ src/sys/external/bsd/drm2/include/linux/pci.h Mon Aug 27 07:34:13 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.28 2018/08/27 07:20:05 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.29 2018/08/27 07:34:13 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -68,8 +68,12 @@ struct acpi_devnode; struct pci_driver; struct pci_bus { - u_int number; + /* NetBSD private members */ pci_chipset_tag_t pb_pc; + device_t pb_dev; + + /* Linux API */ + u_int number; }; struct pci_device_id { @@ -82,7 +86,7 @@ struct pci_device_id { unsigned long driver_data; }; -#define PCI_ANY_ID ((pcireg_t)-1) +#define PCI_ANY_ID (~0) #define PCI_BASE_CLASS_DISPLAY PCI_CLASS_DISPLAY @@ -93,6 +97,7 @@ struct pci_device_id { CTASSERT(PCI_CLASS_BRIDGE_ISA == 0x0601); /* XXX This is getting silly... */ +#define PCI_VENDOR_ID_APPLE PCI_VENDOR_APPLE #define PCI_VENDOR_ID_ASUSTEK PCI_VENDOR_ASUSTEK #define PCI_VENDOR_ID_ATI PCI_VENDOR_ATI #define PCI_VENDOR_ID_DELL PCI_VENDOR_DELL @@ -100,6 +105,7 @@ CTASSERT(PCI_CLASS_BRIDGE_ISA == 0x0601) #define PCI_VENDOR_ID_HP PCI_VENDOR_HP #define PCI_VENDOR_ID_INTEL PCI_VENDOR_INTEL #define PCI_VENDOR_ID_NVIDIA PCI_VENDOR_NVIDIA +#define PCI_VENDOR_ID_SI PCI_VENDOR_SIS #define PCI_VENDOR_ID_SONY PCI_VENDOR_SONY #define PCI_VENDOR_ID_VIA PCI_VENDOR_VIATECH @@ -150,6 +156,7 @@ struct pci_dev { struct pci_conf_state *pd_saved_state; struct acpi_devnode *pd_ad; pci_intr_handle_t *pd_intr_handles; + unsigned pd_enablecnt; /* Linx API only below */ struct pci_bus *bus; @@ -195,8 +202,9 @@ linux_pci_dev_init(struct pci_dev *pdev, pdev->pd_ad = NULL; #endif pdev->bus = kmem_zalloc(sizeof(struct pci_bus), KM_NOSLEEP); - pdev->bus->number = pa->pa_bus; pdev->bus->pb_pc = pa->pa_pc; + pdev->bus->pb_dev = device_parent(dev); + pdev->bus->number = pa->pa_bus; pdev->devfn = PCI_DEVFN(pa->pa_device, pa->pa_function); pdev->vendor = PCI_VENDOR(pa->pa_id); pdev->device = PCI_PRODUCT(pa->pa_id); @@ -796,4 +804,57 @@ pci_is_root_bus(struct pci_bus *bus) return false; } +static inline int +pci_domain_nr(struct pci_bus *bus) +{ + + return device_unit(bus->pb_dev); +} + +/* + * We explicitly rename pci_enable/disable_device so that you have to + * review each use of them, since NetBSD's PCI API does _not_ respect + * our local enablecnt here, but there are different parts of NetBSD + * that automatically enable/disable like PMF, so you have to decide + * for each one whether to call it or not. + */ + +static inline int +linux_pci_enable_device(struct pci_dev *pdev) +{ + const struct pci_attach_args *pa = &pdev->pd_pa; + pcireg_t csr; + int s; + + if (pdev->pd_enablecnt++) + return 0; + + s = splhigh(); + csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); + csr |= PCI_COMMAND_IO_ENABLE; + csr |= PCI_COMMAND_MEM_ENABLE; + pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, csr); + splx(s); + + return 0; +} + +static inline void +linux_pci_disable_device(struct pci_dev *pdev) +{ + const struct pci_attach_args *pa = &pdev->pd_pa; + pcireg_t csr; + int s; + + if (--pdev->pd_enablecnt) + return; + + s = splhigh(); + csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); + csr &= ~PCI_COMMAND_IO_ENABLE; + csr &= ~PCI_COMMAND_MEM_ENABLE; + pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, csr); + splx(s); +} + #endif /* _LINUX_PCI_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:33:35 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: device.h Log Message: Add some more device print routines. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/external/bsd/drm2/include/linux/device.h:1.5 --- src/sys/external/bsd/drm2/include/linux/device.h:1.4 Wed Jul 16 20:59:58 2014 +++ src/sys/external/bsd/drm2/include/linux/device.h Mon Aug 27 07:33:35 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.4 2014/07/16 20:59:58 riastradh Exp $ */ +/* $NetBSD: device.h,v 1.5 2018/08/27 07:33:35 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,12 +35,18 @@ #include #include +#define dev_crit(DEV, FMT, ...) \ + aprint_error_dev((DEV), "critical: " FMT, ##__VA_ARGS__) + #define dev_err(DEV, FMT, ...) \ aprint_error_dev((DEV), "error: " FMT, ##__VA_ARGS__) #define dev_warn(DEV, FMT, ...) \ aprint_error_dev((DEV), "warning: " FMT, ##__VA_ARGS__) +#define dev_notice(DEV, FMT, ...) \ + aprint_normal_dev((DEV), "notice: " FMT, ##__VA_ARGS__) + #define dev_info(DEV, FMT, ...) \ aprint_normal_dev((DEV), "info: " FMT, ##__VA_ARGS__)
CVS commit: src/sys/external/bsd/drm2/include/linux/regulator
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:33:18 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux/regulator: consumer.h Log Message: Copy regulator API from fdtbus. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/drm2/include/linux/regulator/consumer.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/regulator/consumer.h diff -u src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.1 src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.2 --- src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.1 Mon Aug 27 06:35:44 2018 +++ src/sys/external/bsd/drm2/include/linux/regulator/consumer.h Mon Aug 27 07:33:18 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: consumer.h,v 1.1 2018/08/27 06:35:44 riastradh Exp $ */ +/* $NetBSD: consumer.h,v 1.2 2018/08/27 07:33:18 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,4 +32,61 @@ #ifndef _LINUX_REGULATOR_CONSUMER_H_ #define _LINUX_REGULATOR_CONSUMER_H_ +#include "opt_fdt.h" + +#ifdef FDT + +struct regulator { + struct fdtbus_regulator regulator; +}; + +static inline int +regulator_get_voltage(struct regulator *reg) +{ + unsigned uvolt; + int error; + + error = fdtbus_regulator_get_voltage(®->regulator, &uvolt); + if (error) { + /* XXX errno NetBSD->Linux */ + KASSERTMSG(error > 0, "negative error: %d", error); + return -error; + } + + KASSERTMSG(uvolt <= INT_MAX, "high voltage: %u uV", uvolt); + return (int)uvol; +} + +static inline int +regulator_set_voltage(struct regulator *reg, int min_uvolt, int max_uvolt) +{ + unsigned v; + + if (min_uvolt < 0 || max_uvolt < 0) + return -EINVAL; + + /* XXX errno NetBSD->Linux */ + return -fdtbus_regulator_set_voltage(®->regulator, min_uvolt, + max_uvolt); +} + +#else + +struct regulator; + +static inline int +regulator_get_voltage(struct regulator *reg) +{ + panic("no voltage regulators here"); +} + +static inline int +regulator_set_voltage(struct regulator *reg, int min_uvolt, int max_uvolt) +{ + panic("no voltage regulators here"); +} + + +#endif + #endif /* _LINUX_REGULATOR_CONSUMER_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:33:27 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: clk.h Log Message: Our clk API already echoes Linux's, it seems. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/clk.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/clk.h diff -u src/sys/external/bsd/drm2/include/linux/clk.h:1.1 src/sys/external/bsd/drm2/include/linux/clk.h:1.2 --- src/sys/external/bsd/drm2/include/linux/clk.h:1.1 Mon Aug 27 06:35:25 2018 +++ src/sys/external/bsd/drm2/include/linux/clk.h Mon Aug 27 07:33:27 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: clk.h,v 1.1 2018/08/27 06:35:25 riastradh Exp $ */ +/* $NetBSD: clk.h,v 1.2 2018/08/27 07:33:27 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,4 +32,6 @@ #ifndef _LINUX_CLK_H_ #define _LINUX_CLK_H_ +#include + #endif /* _LINUX_CLK_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:32:22 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: reservation.h Log Message: Fix include guards. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/include/linux/reservation.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/reservation.h diff -u src/sys/external/bsd/drm2/include/linux/reservation.h:1.2 src/sys/external/bsd/drm2/include/linux/reservation.h:1.3 --- src/sys/external/bsd/drm2/include/linux/reservation.h:1.2 Mon Aug 27 07:32:11 2018 +++ src/sys/external/bsd/drm2/include/linux/reservation.h Mon Aug 27 07:32:22 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: reservation.h,v 1.2 2018/08/27 07:32:11 riastradh Exp $ */ +/* $NetBSD: reservation.h,v 1.3 2018/08/27 07:32:22 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -29,8 +29,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _ASM_RESERVATION_H_ -#define _ASM_RESERVATION_H_ +#ifndef _LINUX_RESERVATION_H_ +#define _LINUX_RESERVATION_H_ #include @@ -79,4 +79,4 @@ reservation_object_get_excl(struct reser return fence; } -#endif /* _ASM_RESERVATION_H_ */ +#endif /* _LINUX_RESERVATION_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:32:01 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: Namespace fence_get. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.5 src/sys/external/bsd/drm2/include/linux/fence.h:1.6 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.5 Mon Aug 27 07:31:40 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Mon Aug 27 07:32:00 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.5 2018/08/27 07:31:40 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.6 2018/08/27 07:32:00 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -41,6 +41,7 @@ struct fence { const struct fence_ops *ops; }; +#define fence_get linux_fence_get #define fence_put linux_fence_put #define fence_wait linux_fence_wait
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:32:11 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: reservation.h Log Message: Add some reservation stubs. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/external/bsd/drm2/include/linux/reservation.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/reservation.h diff -u src/sys/external/bsd/drm2/include/linux/reservation.h:1.1 src/sys/external/bsd/drm2/include/linux/reservation.h:1.2 --- src/sys/external/bsd/drm2/include/linux/reservation.h:1.1 Wed Jul 16 20:59:58 2014 +++ src/sys/external/bsd/drm2/include/linux/reservation.h Mon Aug 27 07:32:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: reservation.h,v 1.1 2014/07/16 20:59:58 riastradh Exp $ */ +/* $NetBSD: reservation.h,v 1.2 2018/08/27 07:32:11 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -32,14 +32,28 @@ #ifndef _ASM_RESERVATION_H_ #define _ASM_RESERVATION_H_ +#include + #include +struct fence; + extern struct ww_class reservation_ww_class; struct reservation_object { struct ww_mutex lock; + + struct fence *robj_fence_excl; }; +#define reservation_object_add_excl_fence linux_reservation_object_add_excl_fence +#define reservation_object_add_shared_fence linux_reservation_object_add_shared_fence + +void reservation_object_add_excl_fence(struct reservation_object *, + struct fence *); +void reservation_object_add_shared_fence(struct reservation_object *, + struct fence *); + static inline void reservation_object_init(struct reservation_object *reservation) { @@ -54,4 +68,15 @@ reservation_object_fini(struct reservati ww_mutex_destroy(&reservation->lock); } +static inline struct fence * +reservation_object_get_excl(struct reservation_object *reservation) +{ + struct fence *fence; + + fence = reservation->robj_fence_excl; + membar_datadep_consumer(); + + return fence; +} + #endif /* _ASM_RESERVATION_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:31:40 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: Add fence_get prototype. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.4 src/sys/external/bsd/drm2/include/linux/fence.h:1.5 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.4 Mon Aug 27 07:31:17 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Mon Aug 27 07:31:40 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.4 2018/08/27 07:31:17 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.5 2018/08/27 07:31:40 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -45,6 +45,8 @@ struct fence { #define fence_wait linux_fence_wait long fence_wait(struct fence *, bool); +struct fence * + fence_get(struct fence *); void fence_put(struct fence *); #endif /* _LINUX_FENCE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:31:18 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: fence.h Log Message: Include in . To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/fence.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/fence.h diff -u src/sys/external/bsd/drm2/include/linux/fence.h:1.3 src/sys/external/bsd/drm2/include/linux/fence.h:1.4 --- src/sys/external/bsd/drm2/include/linux/fence.h:1.3 Mon Aug 27 06:50:20 2018 +++ src/sys/external/bsd/drm2/include/linux/fence.h Mon Aug 27 07:31:17 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fence.h,v 1.3 2018/08/27 06:50:20 riastradh Exp $ */ +/* $NetBSD: fence.h,v 1.4 2018/08/27 07:31:17 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,8 +32,9 @@ #ifndef _LINUX_FENCE_H_ #define _LINUX_FENCE_H_ -struct fence_ops { +#include +struct fence_ops { }; struct fence {
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:31:06 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: rcupdate.h Log Message: Define __rcu. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/rcupdate.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/rcupdate.h diff -u src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.2 src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.3 --- src/sys/external/bsd/drm2/include/linux/rcupdate.h:1.2 Tue Mar 18 18:20:43 2014 +++ src/sys/external/bsd/drm2/include/linux/rcupdate.h Mon Aug 27 07:31:06 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rcupdate.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $ */ +/* $NetBSD: rcupdate.h,v 1.3 2018/08/27 07:31:06 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,6 @@ #ifndef _LINUX_RCUPDATE_H_ #define _LINUX_RCUPDATE_H_ +#define __rcu + #endif /* _LINUX_RCUPDATE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:30:00 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: pm_runtime.h Log Message: Add pm_runtime_get_noresume stub. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/pm_runtime.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/pm_runtime.h diff -u src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.3 src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.4 --- src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.3 Sat Aug 23 08:03:33 2014 +++ src/sys/external/bsd/drm2/include/linux/pm_runtime.h Mon Aug 27 07:30:00 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pm_runtime.h,v 1.3 2014/08/23 08:03:33 riastradh Exp $ */ +/* $NetBSD: pm_runtime.h,v 1.4 2018/08/27 07:30:00 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -45,6 +45,12 @@ pm_runtime_disable(struct device *dev __ } static inline int +pm_runtime_get_noresume(struct device *dev __unused) +{ + return 0; +} + +static inline int pm_runtime_get_sync(struct device *dev __unused) { return 0;
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:30:47 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: reboot.h Log Message: Add missing forward struct declaration. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/reboot.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/reboot.h diff -u src/sys/external/bsd/drm2/include/linux/reboot.h:1.3 src/sys/external/bsd/drm2/include/linux/reboot.h:1.4 --- src/sys/external/bsd/drm2/include/linux/reboot.h:1.3 Mon Aug 27 07:24:36 2018 +++ src/sys/external/bsd/drm2/include/linux/reboot.h Mon Aug 27 07:30:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: reboot.h,v 1.3 2018/08/27 07:24:36 riastradh Exp $ */ +/* $NetBSD: reboot.h,v 1.4 2018/08/27 07:30:47 riastradh Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -35,6 +35,8 @@ #include #include +struct notifier_block; + /* XXX Implement this by posting a CRITICAL-OVER envsys event? */ static inline int orderly_poweroff(bool force __unused)
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:29:10 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: Define cond_resched to preempt if SPCF_SHOULDYIELD. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/sched.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/sched.h diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.8 src/sys/external/bsd/drm2/include/linux/sched.h:1.9 --- src/sys/external/bsd/drm2/include/linux/sched.h:1.8 Mon Aug 27 06:19:05 2018 +++ src/sys/external/bsd/drm2/include/linux/sched.h Mon Aug 27 07:29:09 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sched.h,v 1.8 2018/08/27 06:19:05 riastradh Exp $ */ +/* $NetBSD: sched.h,v 1.9 2018/08/27 07:29:09 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -71,4 +71,12 @@ schedule_timeout_uninterruptible(long ti return remain > 0 ? remain : 0; } +static inline void +cond_resched(void) +{ + + if (curcpu()->ci_schedstate.spc_flags & SPCF_SHOULDYIELD) + preempt(); +} + #endif /* _LINUX_SCHED_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:27:27 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: ktime.h Log Message: Rework Linux ktime. - Remove union crap which has been removed upstream. - Define everything in terms of ns_to_ktime and ktime_to_ns. - Add ktime_to_us. - Add ktime_us_delta. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/external/bsd/drm2/include/linux/ktime.h:1.6 --- src/sys/external/bsd/drm2/include/linux/ktime.h:1.5 Mon Aug 27 07:05:00 2018 +++ src/sys/external/bsd/drm2/include/linux/ktime.h Mon Aug 27 07:27:27 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ktime.h,v 1.5 2018/08/27 07:05:00 riastradh Exp $ */ +/* $NetBSD: ktime.h,v 1.6 2018/08/27 07:27:27 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -40,39 +40,32 @@ union ktime { int64_t kt_nsec; - struct { -#if _BYTE_ORDER == _BIG_ENDIAN - int32_t ktsn_sec; - int32_t ktsn_nsec; -#else - int32_t ktsn_nsec; - int32_t ktsn_sec; -#endif - } kt_sec_nsec; }; typedef union ktime ktime_t; -static inline ktime_t -ktime_add_ns(ktime_t kt, int64_t nsec) +static inline int64_t +ktime_to_ns(ktime_t kt) { - return (ktime_t) { .kt_nsec = (kt.kt_nsec + nsec) }; + return kt.kt_nsec; } static inline int64_t -ktime_to_ns(ktime_t kt) +ktime_to_us(ktime_t kt) { - return kt.kt_nsec; + return ktime_to_ns(kt)/1000; } static inline ktime_t ns_to_ktime(int64_t nsec) { - ktime_t kt; - - kt.kt_nsec = nsec; + return (ktime_t) { .kt_nsec = nsec }; +} - return kt; +static inline ktime_t +ktime_add_ns(ktime_t kt, int64_t nsec) +{ + return ns_to_ktime(ktime_to_ns(kt) + nsec); } static inline ktime_t @@ -102,37 +95,28 @@ ktime_to_timeval(ktime_t kt) static inline ktime_t timespec_to_ktime(struct timespec ts) { - return ns_to_ktime(10*ts.tv_sec + ts.tv_nsec); + /* XXX Silently truncate? */ + return ns_to_ktime(10*(int64_t)ts.tv_sec + ts.tv_nsec); } static inline ktime_t ktime_get(void) { struct timespec ts; - ktime_t kt; nanouptime(&ts); - /* XXX Silently truncate? */ - kt.kt_sec_nsec.ktsn_sec = ts.tv_sec & 0xUL; - kt.kt_sec_nsec.ktsn_nsec = ts.tv_nsec; - - return kt; + return timespec_to_ktime(ts); } static inline ktime_t ktime_get_real(void) { struct timespec ts; - ktime_t kt; nanotime(&ts); - /* XXX Silently truncate? */ - kt.kt_sec_nsec.ktsn_sec = ts.tv_sec & 0xUL; - kt.kt_sec_nsec.ktsn_nsec = ts.tv_nsec; - - return kt; + return timespec_to_ktime(ts); } static inline uint64_t @@ -159,6 +143,12 @@ ktime_mono_to_real(ktime_t kt) return timespec_to_ktime(ts); } +static inline int64_t +ktime_us_delta(ktime_t a, ktime_t b) +{ + return ktime_to_us(ktime_sub(a, b)); +} + static inline bool time_in_range(unsigned long x, unsigned long a, unsigned long b) {
CVS commit: src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:27:38 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include: i915_trace.h Log Message: New trace points. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/include/i915_trace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/i915_trace.h diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.11 src/sys/external/bsd/drm2/include/i915_trace.h:1.12 --- src/sys/external/bsd/drm2/include/i915_trace.h:1.11 Mon Aug 27 07:20:51 2018 +++ src/sys/external/bsd/drm2/include/i915_trace.h Mon Aug 27 07:27:38 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_trace.h,v 1.11 2018/08/27 07:20:51 riastradh Exp $ */ +/* $NetBSD: i915_trace.h,v 1.12 2018/08/27 07:27:38 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -243,6 +243,22 @@ trace_i915_gem_shrink(struct drm_i915_pr } static inline void +trace_i915_pipe_update_start(struct intel_crtc *crtc) +{ +} + +static inline void +trace_i915_pipe_update_vblank_evaded(struct intel_crtc *crtc) +{ +} + +static inline void +trace_i915_pipe_update_end(struct intel_crtc *crtc, uint32_t end_vbl_count, +int scanline_end) +{ +} + +static inline void trace_switch_mm(struct intel_engine_cs *ring __unused, struct intel_context *to __unused) {
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:25:55 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: types.h Log Message: Add S*_C, U*_C. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.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.6 src/sys/external/bsd/drm2/include/linux/types.h:1.7 --- src/sys/external/bsd/drm2/include/linux/types.h:1.6 Mon Aug 27 07:09:07 2018 +++ src/sys/external/bsd/drm2/include/linux/types.h Mon Aug 27 07:25:55 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.6 2018/08/27 07:09:07 riastradh Exp $ */ +/* $NetBSD: types.h,v 1.7 2018/08/27 07:25:55 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,6 +34,7 @@ #include #include +#include typedef uint8_t u8; typedef uint16_t u16; @@ -63,6 +64,16 @@ typedef uint16_t __be16; typedef uint32_t __be32; typedef uint64_t __be64; +#define S8_C INT8_C +#define S16_C INT16_C +#define S32_C INT32_C +#define S64_C INT64_C + +#define U8_C UINT8_C +#define U16_C UINT16_C +#define U32_C UINT32_C +#define U64_C UINT64_C + /* * 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.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:24:44 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: mutex.h Log Message: Define __lockdep_used for variables used only in lockdep assertions. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/external/bsd/drm2/include/linux/mutex.h:1.10 --- src/sys/external/bsd/drm2/include/linux/mutex.h:1.9 Mon Aug 27 06:17:30 2018 +++ src/sys/external/bsd/drm2/include/linux/mutex.h Mon Aug 27 07:24:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: mutex.h,v 1.9 2018/08/27 06:17:30 riastradh Exp $ */ +/* $NetBSD: mutex.h,v 1.10 2018/08/27 07:24:44 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -109,6 +109,7 @@ mutex_lock_nest_lock(struct mutex *mutex mutex_lock(mutex); } +#define __lockdep_used __unused #define lockdep_assert_held(m) do {} while (0) #define SINGLE_DEPTH_NESTING 0
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:24:36 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: reboot.h Log Message: Reboot notifier stubs. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/reboot.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/reboot.h diff -u src/sys/external/bsd/drm2/include/linux/reboot.h:1.2 src/sys/external/bsd/drm2/include/linux/reboot.h:1.3 --- src/sys/external/bsd/drm2/include/linux/reboot.h:1.2 Fri Mar 6 01:43:07 2015 +++ src/sys/external/bsd/drm2/include/linux/reboot.h Mon Aug 27 07:24:36 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: reboot.h,v 1.2 2015/03/06 01:43:07 riastradh Exp $ */ +/* $NetBSD: reboot.h,v 1.3 2018/08/27 07:24:36 riastradh Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -45,5 +45,16 @@ orderly_poweroff(bool force __unused) return 0; } +static inline int +register_reboot_notifier(struct notifier_block *block) +{ + return 0; +} + +static inline int +unregister_reboot_notifier(struct notifier_block *block) +{ + return 0; +} #endif /* _LINUX_REBOOT_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:24:54 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: firmware.h Log Message: Implement Linux asynchronous firmware load API. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/firmware.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/firmware.h diff -u src/sys/external/bsd/drm2/include/linux/firmware.h:1.7 src/sys/external/bsd/drm2/include/linux/firmware.h:1.8 --- src/sys/external/bsd/drm2/include/linux/firmware.h:1.7 Mon Aug 27 06:43:24 2018 +++ src/sys/external/bsd/drm2/include/linux/firmware.h Mon Aug 27 07:24:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: firmware.h,v 1.7 2018/08/27 06:43:24 riastradh Exp $ */ +/* $NetBSD: firmware.h,v 1.8 2018/08/27 07:24:54 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,10 +35,15 @@ #include #include #include +#include #include #include +#include +#include +#include + struct device; struct firmware { @@ -46,6 +51,15 @@ struct firmware { size_t size; }; +struct firmload_work { + char *flw_name; + void (*flw_callback)(const struct firmware *, void *); + void *flw_cookie; + struct device *flw_device; + struct module *flw_module; + struct work_struct flw_work; +}; + static inline int request_firmware(const struct firmware **fwp, const char *image_name, struct device *dev) @@ -92,6 +106,75 @@ fail0: KASSERT(ret); } static inline void +request_firmware_work(struct work_struct *wk) +{ + struct firmload_work *work = container_of(wk, struct firmload_work, + flw_work); + const struct firmware *fw; + int ret; + + /* Reqeust the firmware. If it failed, set it to NULL. */ + ret = request_firmware(&fw, work->flw_name, work->flw_device); + if (ret) + fw = NULL; + + /* Call the callback. */ + (*work->flw_callback)(fw, work->flw_cookie); + + /* + * Release the device and module references now that we're + * done. + * + * XXX Heh. What if the module gets unloaded _during_ + * module_rele because it went to zero? + */ + /* XXX device_release */ + if (work->flw_module) + module_rele(work->flw_module); +} + +static inline int +request_firmware_nowait(struct module *module, bool uevent, const char *name, +struct device *device, gfp_t gfp, void *cookie, +void (*callback)(const struct firmware *, void *)) +{ + char *namedup; + struct firmload_work *work; + + /* Allocate memory for it, or fail if we can't. */ + work = kzalloc(sizeof(*work), gfp); + if (work == NULL) + goto fail0; + + /* Copy the name just in case. */ + namedup = kstrdup(name, gfp); + if (namedup == NULL) + goto fail1; + + /* Hold the module and device so they don't go away before callback. */ + if (module) + module_hold(module); + /* XXX device_acquire(device) */ + + /* Initialize the work. */ + work->flw_name = namedup; + work->flw_callback = callback; + work->flw_cookie = callback; + work->flw_device = device; + work->flw_module = module; + INIT_WORK(&work->flw_work, request_firmware_work); + + /* Kick it off. */ + schedule_work(&work->flw_work); + + /* Success! */ + return 0; + +fail1: kfree(work); +fail0: return -ENOMEM; +} + +static inline void release_firmware(const struct firmware *fw) {
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:20:16 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include/linux: interrupt.h Log Message: Define in_interrupt for debugging assertions. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/interrupt.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/interrupt.h diff -u src/sys/external/bsd/drm2/include/linux/interrupt.h:1.2 src/sys/external/bsd/drm2/include/linux/interrupt.h:1.3 --- src/sys/external/bsd/drm2/include/linux/interrupt.h:1.2 Tue Mar 18 18:20:43 2014 +++ src/sys/external/bsd/drm2/include/linux/interrupt.h Mon Aug 27 07:20:16 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $ */ +/* $NetBSD: interrupt.h,v 1.3 2018/08/27 07:20:16 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,8 @@ #ifndef _LINUX_INTERRUPT_H_ #define _LINUX_INTERRUPT_H_ +#include + +#define in_interrupt() (cpu_intr_p() || cpu_softintr_p()) + #endif /* _LINUX_INTERRUPT_H_ */
CVS commit: src/sys/external/bsd/drm2/include
Module Name:src Committed By: riastradh Date: Mon Aug 27 07:20:51 UTC 2018 Modified Files: src/sys/external/bsd/drm2/include: i915_trace.h Log Message: Add trace_i915_flip_complete. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/include/i915_trace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/i915_trace.h diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.10 src/sys/external/bsd/drm2/include/i915_trace.h:1.11 --- src/sys/external/bsd/drm2/include/i915_trace.h:1.10 Mon Aug 27 07:18:08 2018 +++ src/sys/external/bsd/drm2/include/i915_trace.h Mon Aug 27 07:20:51 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_trace.h,v 1.10 2018/08/27 07:18:08 riastradh Exp $ */ +/* $NetBSD: i915_trace.h,v 1.11 2018/08/27 07:20:51 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -43,6 +43,12 @@ trace_i915_flip_request(enum plane plane } static inline void +trace_i915_flip_complete(enum plane plane __unused, +struct drm_i915_gem_object *obj __unused) +{ +} + +static inline void trace_i915_gem_evict(struct drm_device *dev __unused, int min_size __unused, unsigned int alignment __unused, bool mappable __unused) {