xref: /dflybsd-src/sys/dev/drm/include/linux/io.h (revision 8b1a6a38d3a8baa72c2e45eee5db430da1a6a75c)
1dd453158SFrançois Tigeot /*
247ad44e8SFrançois Tigeot  * Copyright (c) 2014-2015 François Tigeot
3dd453158SFrançois Tigeot  * All rights reserved.
4dd453158SFrançois Tigeot  *
5dd453158SFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
6dd453158SFrançois Tigeot  * modification, are permitted provided that the following conditions
7dd453158SFrançois Tigeot  * are met:
8dd453158SFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
9dd453158SFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
10dd453158SFrançois Tigeot  *    disclaimer.
11dd453158SFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
12dd453158SFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
13dd453158SFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
14dd453158SFrançois Tigeot  *
15dd453158SFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16dd453158SFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17dd453158SFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18dd453158SFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19dd453158SFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20dd453158SFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21dd453158SFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22dd453158SFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23dd453158SFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24dd453158SFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25dd453158SFrançois Tigeot  */
26dd453158SFrançois Tigeot 
27dd453158SFrançois Tigeot #ifndef _LINUX_IO_H_
28dd453158SFrançois Tigeot #define _LINUX_IO_H_
29dd453158SFrançois Tigeot 
3047ad44e8SFrançois Tigeot #include <linux/kernel.h>
31*8b1a6a38SFrançois Tigeot #include <asm/io.h>
32*8b1a6a38SFrançois Tigeot #include <asm/page.h>
33dd453158SFrançois Tigeot 
34dd453158SFrançois Tigeot #if defined(writel)
35dd453158SFrançois Tigeot #undef writel
36dd453158SFrançois Tigeot #endif
37dd453158SFrançois Tigeot 
38dd453158SFrançois Tigeot static inline void
39dd453158SFrançois Tigeot writel(uint32_t value, void *addr)
40dd453158SFrançois Tigeot {
41dd453158SFrançois Tigeot 	*(volatile uint32_t *)addr = value;
42dd453158SFrançois Tigeot }
43dd453158SFrançois Tigeot 
4447ad44e8SFrançois Tigeot static inline int
4547ad44e8SFrançois Tigeot arch_phys_wc_add(unsigned long base, unsigned long size)
4647ad44e8SFrançois Tigeot {
4747ad44e8SFrançois Tigeot 	/* The DragonFly kernel is PAT-enabled, do nothing */
4847ad44e8SFrançois Tigeot 	return 0;
4947ad44e8SFrançois Tigeot }
5047ad44e8SFrançois Tigeot 
5147ad44e8SFrançois Tigeot static inline void
5247ad44e8SFrançois Tigeot arch_phys_wc_del(int handle)
5347ad44e8SFrançois Tigeot {
5447ad44e8SFrançois Tigeot 	BUG_ON(handle != 0);
5547ad44e8SFrançois Tigeot }
5647ad44e8SFrançois Tigeot 
57dd453158SFrançois Tigeot #endif	/* _LINUX_IO_H_ */
58