summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2015-06-29 13:33:34 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-07-06 09:41:38 +0200
commite0a8a88912031feba7f69fe1a7bdfe4c9bda1867 (patch)
tree39442b1684d9341cd1a71009a5548c265e739471
parent5bcf8d637becc29aaaf2ed1797e6fe89bf1c07f8 (diff)
update common base header files
IS_ENABLED is defined in kconfig.h, thus, should be included in libpayload.h. BUG=none BRANCH=tot TEST=built coreboot/libpayload for veyron_jerry Change-Id: I9c5879b6125ac66a75a507ab07a6816ab54ed0ba Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 51dcd58a841009081fdefcadf9aa74286152dde6 Original-Change-Id: I30e6d87c9de827a214a6100449cd716e773c2ba3 Original-Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/282587 Original-Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: http://review.coreboot.org/10781 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r--payloads/libpayload/include/libpayload.h1
-rw-r--r--payloads/libpayload/include/stddef.h8
2 files changed, 9 insertions, 0 deletions
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 3e240710e7..c09fc172ef 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -48,6 +48,7 @@
#include <die.h>
#include <endian.h>
#include <ipchksum.h>
+#include <kconfig.h>
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
diff --git a/payloads/libpayload/include/stddef.h b/payloads/libpayload/include/stddef.h
index bb2971dd3a..fe455b8a23 100644
--- a/payloads/libpayload/include/stddef.h
+++ b/payloads/libpayload/include/stddef.h
@@ -16,7 +16,15 @@ typedef __SIZE_TYPE__ ssize_t;
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
#define member_size(TYPE, MEMBER) (sizeof(((TYPE *) 0)->MEMBER))
+#define check_member(structure, member, offset) _Static_assert( \
+ offsetof(struct structure, member) == offset, \
+ "`struct " #structure "` offset for `" #member "` is not " #offset)
+
/* Standard units. */
#define KiB (1<<10)
#define MiB (1<<20)
#define GiB (1<<30)
+
+#define KHz (1000)
+#define MHz (1000*KHz)
+#define GHz (1000*MHz)