1 /* Copyright (C) 2010 - 2013 UNISYS CORPORATION
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or (at
7 * your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 * NON INFRINGEMENT. See the GNU General Public License for more
16 #ifndef _COMMONTYPES_H_
17 #define _COMMONTYPES_H_
19 /* define the following to prevent include nesting in kernel header files of
20 * similar abbreviated content */
21 #define _SUPERVISOR_COMMONTYPES_H_
24 #include <linux/types.h>
25 #include <linux/version.h>
27 #include <linux/uuid.h>
50 #elif __WORDSIZE == 64
53 #error Unsupported __WORDSIZE
58 typedef u64 GUEST_PHYSICAL_ADDRESS;
60 #define MEMSET(ptr, val, len) memset(ptr, val, len)
61 #define MEMCMP(m1, m2, len) memcmp(m1, m2, len)
62 #define MEMCMP_IO(m1, m2, len) memcmp((void __force *)m1, m2, len)
63 #define STRLEN(s) ((UINTN)strlen((const char *)s))
64 #define STRCPY(d, s) (strcpy((char *)d, (const char *)s))
67 #define OFFSETOF offsetof
70 #define MEMORYBARRIER mb()
71 #define MEMCPY(dest, src, len) memcpy(dest, src, len)
72 #define MEMCPY_TOIO(dest, src, len) memcpy_toio(dest, src, len)
73 #define MEMCPY_FROMIO(dest, src, len) memcpy_fromio(dest, src, len)
75 #define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \
78 pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=%pUL actual=%pUL @%s:%d\n", \
79 chName, &chType, field, \
83 #define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \
86 pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d\n", \
87 chName, &chType, field, \
88 (unsigned long)expected, (unsigned long)actual, \
92 #define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \
95 pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d\n", \
96 chName, &chType, field, \
97 (unsigned long long)expected, \
98 (unsigned long long)actual, \
102 #define UltraLogEvent(logCtx, EventId, Severity, SubsystemMask, pFunctionName, \
103 LineNumber, Str, args...) \
104 pr_info(Str, ## args)
107 #define MEMCPY(dest, src, len) memcpy(dest, src, len)
109 #define MEMORYBARRIER mb()
111 #define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \
114 syslog(LOG_USER | LOG_ERR, \
115 "Channel mismatch on channel=%s(%pUL) field=%s expected=%pUL actual=%pUL @%s:%d", \
116 chName, &chType, field, \
117 &expected, &actual, \
121 #define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \
124 syslog(LOG_USER | LOG_ERR, \
125 "Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d", \
126 chName, chType, field, \
127 (unsigned long)expected, (unsigned long)actual, \
131 #define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \
134 syslog(LOG_USER | LOG_ERR, \
135 "Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d", \
136 chName, chType, field, \
137 (unsigned long long)expected, \
138 (unsigned long long)actual, \
142 #define UltraLogEvent(logCtx, EventId, Severity, SubsystemMask, pFunctionName, \
143 LineNumber, Str, args...) \
144 syslog(LOG_USER | LOG_INFO, Str, ## args)
147 #define VolatileBarrier() MEMORYBARRIER