summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--payloads/coreinfo/coreboot_module.c6
-rw-r--r--payloads/libpayload/include/coreboot_tables.h5
2 files changed, 8 insertions, 3 deletions
diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c
index 5d13128e32..7289366f8b 100644
--- a/payloads/coreinfo/coreboot_module.c
+++ b/payloads/coreinfo/coreboot_module.c
@@ -17,8 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <coreboot_tables.h>
#include "coreinfo.h"
+#include <coreboot_tables.h>
#ifdef CONFIG_MODULE_COREBOOT
@@ -189,10 +189,10 @@ static int parse_header(void *addr, int len)
/* FIXME: Check the checksum. */
- if (ipchksum((uint16_t *) header, sizeof(*header)))
+ if (cb_checksum(header, sizeof(*header)))
return -1;
- if (ipchksum((uint16_t *) (ptr + sizeof(*header)), header->table_bytes)
+ if (cb_checksum((ptr + sizeof(*header)), header->table_bytes)
!= header->table_checksum)
return -1;
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index 3b3b7d2299..574469a6ed 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -223,6 +223,11 @@ static inline u64 cb_unpack64(struct cbuint64 val)
return (((u64) val.hi) << 32) | val.lo;
}
+static inline u16 cb_checksum(const void *ptr, unsigned len)
+{
+ return ipchksum(ptr, len);
+}
+
/* Helpful macros */
#define MEM_RANGE_COUNT(_rec) \