1 /* Copyright © 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 abreviated content */
21 #define _SUPERVISOR_COMMONTYPES_H_
24 #include <linux/types.h>
25 #include <linux/version.h>
54 #elif __WORDSIZE == 64
57 #error Unsupported __WORDSIZE
67 } __attribute__ ((__packed__)) GUID;
70 #define GUID0 {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} }
72 typedef U64 GUEST_PHYSICAL_ADDRESS;
74 #define MEMSET(ptr, val, len) memset(ptr, val, len)
75 #define MEMCMP(m1, m2, len) memcmp(m1, m2, len)
76 #define MEMCMP_IO(m1, m2, len) memcmp((void __force *)m1, m2, len)
77 #define STRLEN(s) ((UINTN)strlen((const char *)s))
78 #define STRCPY(d, s) (strcpy((char *)d, (const char *)s))
81 #define OFFSETOF offsetof
84 #define MEMORYBARRIER mb()
85 #define MEMCPY(dest, src, len) memcpy(dest, src, len)
86 #define MEMCPY_TOIO(dest, src, len) memcpy_toio(dest, src, len)
87 #define MEMCPY_FROMIO(dest, src, len) memcpy_fromio(dest, src, len)
89 #define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \
92 char s1[50], s2[50], s3[50]; \
93 pr_err("Channel mismatch on channel=%s(%s) field=%s expected=%s actual=%s @%s:%d\n", \
94 chName, GUID_format2(&chType, s1), field, \
95 GUID_format2(&expected, s2), GUID_format2(&actual, s3), \
98 #define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \
102 pr_err("Channel mismatch on channel=%s(%s) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d\n", \
103 chName, GUID_format2(&chType, s1), field, \
104 (unsigned long)expected, (unsigned long)actual, \
108 #define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \
112 pr_err("Channel mismatch on channel=%s(%s) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d\n", \
113 chName, GUID_format2(&chType, s1), field, \
114 (unsigned long long)expected, \
115 (unsigned long long)actual, \
119 #define UltraLogEvent(logCtx, EventId, Severity, SubsystemMask, pFunctionName, \
120 LineNumber, Str, args...) \
121 pr_info(Str, ## args)
124 #define MEMCPY(dest, src, len) memcpy(dest, src, len)
126 #define MEMORYBARRIER mb()
128 #define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \
131 char s1[50], s2[50], s3[50]; \
132 syslog(LOG_USER | LOG_ERR, \
133 "Channel mismatch on channel=%s(%s) field=%s expected=%s actual=%s @%s:%d", \
134 chName, GUID_format2(&chType, s1), field, \
135 GUID_format2(&expected, s2), GUID_format2(&actual, s3), \
139 #define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \
143 syslog(LOG_USER | LOG_ERR, \
144 "Channel mismatch on channel=%s(%s) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d", \
145 chName, GUID_format2(&chType, s1), field, \
146 (unsigned long)expected, (unsigned long)actual, \
150 #define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \
154 syslog(LOG_USER | LOG_ERR, \
155 "Channel mismatch on channel=%s(%s) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d", \
156 chName, GUID_format2(&chType, s1), field, \
157 (unsigned long long)expected, \
158 (unsigned long long)actual, \
162 #define UltraLogEvent(logCtx, EventId, Severity, SubsystemMask, pFunctionName, \
163 LineNumber, Str, args...) \
164 syslog(LOG_USER | LOG_INFO, Str, ## args)
167 #define VolatileBarrier() MEMORYBARRIER
170 #include "guidutils.h"