New upstream version 17.11-rc3
[deb_dpdk.git] / drivers / bus / fslmc / qbman / qbman_sys_decl.h
1 /*-
2  *   BSD LICENSE
3  *
4  * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *     * Redistributions of source code must retain the above copyright
9  *       notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above copyright
11  *       notice, this list of conditions and the following disclaimer in the
12  *       documentation and/or other materials provided with the distribution.
13  *     * Neither the name of Freescale Semiconductor nor the
14  *       names of its contributors may be used to endorse or promote products
15  *       derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 #include <compat.h>
29 #include <fsl_qbman_base.h>
30
31 /* Sanity check */
32 #if (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__) && \
33         (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
34 #error "Unknown endianness!"
35 #endif
36
37         /****************/
38         /* arch assists */
39         /****************/
40 #define dcbz(p) { asm volatile("dc zva, %0" : : "r" (p) : "memory"); }
41 #define lwsync() { asm volatile("dmb st" : : : "memory"); }
42 #define dcbf(p) { asm volatile("dc cvac, %0" : : "r"(p) : "memory"); }
43 #define dccivac(p) { asm volatile("dc civac, %0" : : "r"(p) : "memory"); }
44 static inline void prefetch_for_load(void *p)
45 {
46         asm volatile("prfm pldl1keep, [%0, #0]" : : "r" (p));
47 }
48
49 static inline void prefetch_for_store(void *p)
50 {
51         asm volatile("prfm pstl1keep, [%0, #0]" : : "r" (p));
52 }