Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/80332?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Verified+1 by build bot (Jenkins)
Change subject: device/azalia: Cleanup codec initialization code
......................................................................
device/azalia: Cleanup codec initialization code
azalia_codec_init() was doing too much in one function.
This also changes how debug messages will be printed. I focused on
reducing clutter on the screen and made the style of the messages
consistent.
Before:
azalia_audio: Initializing codec #5
codec not ready.
azalia_audio: Initializing codec #4
codec not valid.
azalia_audio: Initializing codec #3
azalia_audio: viddid: ffffffff
azalia_audio: verb_size: 4
azalia_audio: verb loaded.
After:
azalia_audio: codec #5 not ready
azalia_audio: codec #4 not valid
azalia_audio: initializing codec #3...
azalia_audio: - vendor/device id: 0xffffffff
azalia_audio: - verb size: 4
azalia_audio: - verb loaded
Change-Id: I92b6d184abccdbe0e1bfce98a2c959a97a618a29
Signed-off-by: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
---
M src/device/azalia_device.c
M src/include/device/azalia_device.h
2 files changed, 57 insertions(+), 38 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/80332/3
--
To view, visit https://review.coreboot.org/c/coreboot/+/80332?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I92b6d184abccdbe0e1bfce98a2c959a97a618a29
Gerrit-Change-Number: 80332
Gerrit-PatchSet: 3
Gerrit-Owner: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Nico Huber <nico.h(a)gmx.de>
Gerrit-MessageType: newpatchset
Keith Short has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80308?usp=email )
Change subject: util/cbfstool: Fallback to linear search
......................................................................
util/cbfstool: Fallback to linear search
When the image size is a power of 2, cbfstool attempts to find the FMAP
region using a binary search. However, if the FMAP location isn't
aligned on a 16 byte boundary the binary search fails.
Fall back to linear search if binary search fails.
TEST=cbfstool ec.bin layout
Change-Id: Ifa9f6f57d1c59114fd1d4ace2d82b62e953cf6a8
Signed-off-by: Keith Short <keithshort(a)chromium.org>
---
M util/cbfstool/flashmap/fmap.c
1 file changed, 6 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/08/80308/1
diff --git a/util/cbfstool/flashmap/fmap.c b/util/cbfstool/flashmap/fmap.c
index 46c31bb..cf36bbb 100644
--- a/util/cbfstool/flashmap/fmap.c
+++ b/util/cbfstool/flashmap/fmap.c
@@ -149,10 +149,13 @@
if ((image == NULL) || (image_len == 0))
return -1;
- if (popcnt(image_len) == 1)
+ if (popcnt(image_len) == 1) {
ret = fmap_bsearch(image, image_len);
- else
- ret = fmap_lsearch(image, image_len);
+ if (ret >= 0)
+ return ret;
+ }
+
+ ret = fmap_lsearch(image, image_len);
return ret;
}
--
To view, visit https://review.coreboot.org/c/coreboot/+/80308?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Ifa9f6f57d1c59114fd1d4ace2d82b62e953cf6a8
Gerrit-Change-Number: 80308
Gerrit-PatchSet: 1
Gerrit-Owner: Keith Short <keithshort(a)chromium.org>
Gerrit-MessageType: newchange
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/80333?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Verified-1 by build bot (Jenkins)
Change subject: device/azalia: Rework the verb table
......................................................................
device/azalia: Rework the verb table
This is a very experimental change and I would appreciate anyone's opinion on
this. :)
My intentions are to make verb tables cleaner on the both the configuration
and implementation side.
On the configuration side (i.e. hda_verbs.c) this method removes most
superfluous comments (e.g. /* Subsystem ID */) and makes it more "structured".
On the implementation side I tried to make it easier to read (and hopefully
maintain). For example, compare azalia_find_verb() and azalia_find_verb_table().
I also got rid of global variables (but introduced including c source files
directly instead...).
Change-Id: If8b672e4fd800b34e5ba39fad174fcf1154b0a54
Signed-off-by: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
---
M src/device/azalia_device.c
M src/include/device/azalia_device.h
A src/include/device/azalia_table_exporter.c
M src/mainboard/hp/snb_ivb_laptops/variants/2560p/hda_verb.c
4 files changed, 114 insertions(+), 103 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/80333/3
--
To view, visit https://review.coreboot.org/c/coreboot/+/80333?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: If8b672e4fd800b34e5ba39fad174fcf1154b0a54
Gerrit-Change-Number: 80333
Gerrit-PatchSet: 3
Gerrit-Owner: Nicholas Sudsgaard <devel+coreboot(a)nsudsgaard.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: newpatchset
Julius Werner has submitted this change. ( https://review.coreboot.org/c/coreboot/+/80256?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: util/cbmem: Use commonlib ipchksum() algorithm
......................................................................
util/cbmem: Use commonlib ipchksum() algorithm
This patch switches the cbmem utility from its own IP checksum
implementation to the commonlib version (which is good because the old
one had a couple of bugs: doesn't work on odd sizes and may overflow
its carry accumulator with input larger than 64K).
Change-Id: I0bef2c85c37ddd3438b7ac6389e9daa3e4955b31
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80256
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-by: Yidi Lin <yidilin(a)google.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M util/cbmem/Makefile
M util/cbmem/cbmem.c
2 files changed, 6 insertions(+), 23 deletions(-)
Approvals:
build bot (Jenkins): Verified
Arthur Heymans: Looks good to me, approved
Yidi Lin: Looks good to me, approved
diff --git a/util/cbmem/Makefile b/util/cbmem/Makefile
index 9219a08..0c88aeb 100644
--- a/util/cbmem/Makefile
+++ b/util/cbmem/Makefile
@@ -4,6 +4,7 @@
PROGRAM = cbmem
TOP ?= $(abspath ../..)
ROOT = $(TOP)/src
+COMMONLIB = $(ROOT)/commonlib
CC ?= $(CROSS_COMPILE)gcc
INSTALL ?= /usr/bin/env install
PREFIX ?= /usr/local
@@ -13,14 +14,14 @@
CPPFLAGS += -I . -I $(ROOT)/commonlib/include -I $(ROOT)/commonlib/bsd/include
CPPFLAGS += -include $(ROOT)/commonlib/bsd/include/commonlib/bsd/compiler.h
-OBJS = $(PROGRAM).o
+OBJS = $(PROGRAM).o $(COMMONLIB)/bsd/ipchksum.o
all: $(PROGRAM)
$(PROGRAM): $(OBJS)
clean:
- rm -f $(PROGRAM) *.o .dependencies *~ junit.xml
+ rm -f $(PROGRAM) $(OBJS:.c=.o) .dependencies *~ junit.xml
install: $(PROGRAM)
$(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin/
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index d33b714..15b6770 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -19,6 +19,7 @@
#include <assert.h>
#include <regex.h>
#include <commonlib/bsd/cbmem_id.h>
+#include <commonlib/bsd/ipchksum.h>
#include <commonlib/bsd/tpm_log_defs.h>
#include <commonlib/loglevel.h>
#include <commonlib/timestamp_serialized.h>
@@ -199,25 +200,6 @@
return dest;
}
-/*
- * calculate ip checksum (16 bit quantities) on a passed in buffer. In case
- * the buffer length is odd last byte is excluded from the calculation
- */
-static u16 ipchcksum(const void *addr, unsigned size)
-{
- const u16 *p = addr;
- unsigned i, n = size / 2; /* don't expect odd sized blocks */
- u32 sum = 0;
-
- for (i = 0; i < n; i++)
- sum += p[i];
-
- sum = (sum >> 16) + (sum & 0xffff);
- sum += (sum >> 16);
- sum = ~sum & 0xffff;
- return (u16) sum;
-}
-
/* Find the first cbmem entry filling in the details. */
static int find_cbmem_entry(uint32_t id, uint64_t *addr, size_t *size)
{
@@ -400,7 +382,7 @@
lbh = buf + i;
if (memcmp(lbh->signature, "LBIO", sizeof(lbh->signature)) ||
!lbh->header_bytes ||
- ipchcksum(lbh, sizeof(*lbh))) {
+ ipchksum(lbh, sizeof(*lbh))) {
continue;
}
@@ -411,7 +393,7 @@
continue;
}
- if (ipchcksum(mapping_virt(&table_mapping), lbh->table_bytes) !=
+ if (ipchksum(mapping_virt(&table_mapping), lbh->table_bytes) !=
lbh->table_checksum) {
debug("Signature found, but wrong checksum.\n");
unmap_memory(&table_mapping);
--
To view, visit https://review.coreboot.org/c/coreboot/+/80256?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I0bef2c85c37ddd3438b7ac6389e9daa3e4955b31
Gerrit-Change-Number: 80256
Gerrit-PatchSet: 3
Gerrit-Owner: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Yidi Lin <yidilin(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Julius Werner has submitted this change. ( https://review.coreboot.org/c/coreboot/+/80255?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: commonlib: Add assembly optimization for ipchksum() on x86
......................................................................
commonlib: Add assembly optimization for ipchksum() on x86
This patch adds a bit of optimized assembly code to the ipchksum()
algorithm for x86 targets in order to take advantage of larger load
sizes and the add-with-carry instruction. The same assembly (with one
minor manual tweak) works for both 32 and 64 bit mode (with most of the
work being done by GCC which automatically inserts `rax` or `eax` in the
inline assembly depending on the build target).
Change-Id: I484620dc14679ff5ca02b2ced2f84650730a6efc
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80255
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M src/commonlib/bsd/ipchksum.c
1 file changed, 24 insertions(+), 1 deletion(-)
Approvals:
Arthur Heymans: Looks good to me, approved
build bot (Jenkins): Verified
diff --git a/src/commonlib/bsd/ipchksum.c b/src/commonlib/bsd/ipchksum.c
index 89d261f..b7434e5 100644
--- a/src/commonlib/bsd/ipchksum.c
+++ b/src/commonlib/bsd/ipchksum.c
@@ -34,7 +34,30 @@
:: "cc"
);
}
-#endif
+#elif defined(__i386__) || defined(__x86_64__)
+ size_t size8 = size / 8;
+ const uint64_t *p8 = data;
+ i = size8 * 8;
+ asm (
+ "clc\n\t"
+ "1:\n\t"
+ "jecxz 2f\n\t" /* technically RCX on 64, but not gonna be that big */
+ "adc (%[p8]), %[wsum]\n\t"
+#if defined(__i386__)
+ "adc 4(%[p8]), %[wsum]\n\t"
+#endif /* __i386__ */
+ "lea -1(%[size8]), %[size8]\n\t" /* Use LEA as a makeshift ADD that */
+ "lea 8(%[p8]), %[p8]\n\t" /* doesn't modify the carry flag. */
+ "jmp 1b\n\t"
+ "2:\n\t"
+ "setc %b[size8]\n\t" /* reuse size register to save last carry */
+ "add %[size8], %[wsum]\n\t"
+ : [wsum] "+r" (wide_sum),
+ [p8] "+r" (p8),
+ [size8] "+c" (size8) /* put size in ECX so we can JECXZ */
+ :: "cc"
+ );
+#endif /* __i386__ || __x86_64__ */
while (wide_sum) {
sum += wide_sum & 0xFFFF;
--
To view, visit https://review.coreboot.org/c/coreboot/+/80255?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I484620dc14679ff5ca02b2ced2f84650730a6efc
Gerrit-Change-Number: 80255
Gerrit-PatchSet: 4
Gerrit-Owner: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Julius Werner has submitted this change. ( https://review.coreboot.org/c/coreboot/+/80254?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: commonlib: Add assembly optimization for ipchksum() on arm64
......................................................................
commonlib: Add assembly optimization for ipchksum() on arm64
This patch adds a bit of optimized assembly code to the ipchksum()
algorithm for arm64 targets in order to take advantage of larger load
sizes and the add-with-carry instruction. This improves execution speed
on a Cortex-A75 by more than 20x.
Change-Id: I9c7bbc9d7a1cd083ced62fe9222592243a796077
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80254
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-by: Yidi Lin <yidilin(a)google.com>
---
M src/commonlib/bsd/ipchksum.c
1 file changed, 25 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Arthur Heymans: Looks good to me, approved
Yidi Lin: Looks good to me, approved
diff --git a/src/commonlib/bsd/ipchksum.c b/src/commonlib/bsd/ipchksum.c
index a40b86c..89d261f 100644
--- a/src/commonlib/bsd/ipchksum.c
+++ b/src/commonlib/bsd/ipchksum.c
@@ -11,6 +11,31 @@
uint32_t sum = 0;
size_t i = 0;
+#if defined(__aarch64__)
+ size_t size16 = size / 16;
+ const uint64_t *p8 = data;
+ if (size16) {
+ unsigned long tmp1, tmp2;
+ i = size16 * 16;
+ asm (
+ "adds xzr, xzr, xzr\n\t" /* init carry flag for addition */
+ "1:\n\t"
+ "ldp %[v1], %[v2], [%[p8]], #16\n\t"
+ "adcs %[wsum], %[wsum], %[v1]\n\t"
+ "adcs %[wsum], %[wsum], %[v2]\n\t"
+ "sub %[size16], %[size16], #1\n\t"
+ "cbnz %[size16], 1b\n\t"
+ "adcs %[wsum], %[wsum], xzr\n\t" /* use up last carry */
+ : [v1] "=r" (tmp1),
+ [v2] "=r" (tmp2),
+ [wsum] "+r" (wide_sum),
+ [p8] "+r" (p8),
+ [size16] "+r" (size16)
+ :: "cc"
+ );
+ }
+#endif
+
while (wide_sum) {
sum += wide_sum & 0xFFFF;
wide_sum >>= 16;
--
To view, visit https://review.coreboot.org/c/coreboot/+/80254?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I9c7bbc9d7a1cd083ced62fe9222592243a796077
Gerrit-Change-Number: 80254
Gerrit-PatchSet: 4
Gerrit-Owner: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Yidi Lin <yidilin(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged
Julius Werner has submitted this change. ( https://review.coreboot.org/c/coreboot/+/80253?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: libpayload: Switch to commonlib ipchksum() algorithm
......................................................................
libpayload: Switch to commonlib ipchksum() algorithm
This patch moves libpayload over to the commonlib implementation for
calculating the IP checksum.
Change-Id: Ie8d323ce9f8d946758619761b4b22d54bce222b6
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80253
Reviewed-by: Jakub Czapiga <czapiga(a)google.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-by: Yidi Lin <yidilin(a)google.com>
---
M payloads/libpayload/include/coreboot_tables.h
D payloads/libpayload/include/ipchksum.h
M payloads/libpayload/include/libpayload.h
M payloads/libpayload/libc/Makefile.mk
D payloads/libpayload/libc/ipchecksum.c
5 files changed, 4 insertions(+), 94 deletions(-)
Approvals:
Yidi Lin: Looks good to me, approved
Arthur Heymans: Looks good to me, approved
Jakub Czapiga: Looks good to me, approved
build bot (Jenkins): Verified
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index 5c3f0c4..5b19ca8 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -30,7 +30,7 @@
#define _COREBOOT_TABLES_H
#include <arch/types.h>
-#include <ipchksum.h>
+#include <commonlib/bsd/ipchksum.h>
#include <stdint.h>
enum {
diff --git a/payloads/libpayload/include/ipchksum.h b/payloads/libpayload/include/ipchksum.h
deleted file mode 100644
index 391fefb..0000000
--- a/payloads/libpayload/include/ipchksum.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Copyright (c) 2012 The ChromiumOS Authors.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __IPCHKSUM_H__
-#define __IPCHKSUM_H__
-
-/**
- * @defgroup ipchecksum IP checksum functions
- * @{
- */
-unsigned short ipchksum(const void *ptr, unsigned long nbytes);
-/** @} */
-
-#endif
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 06c6de4..6da4564 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -48,12 +48,12 @@
#include <commonlib/bsd/elog.h>
#include <commonlib/bsd/fmap_serialized.h>
#include <commonlib/bsd/helpers.h>
+#include <commonlib/bsd/ipchksum.h>
#include <commonlib/bsd/mem_chip_info.h>
#include <ctype.h>
#include <die.h>
#include <endian.h>
#include <fmap.h>
-#include <ipchksum.h>
#include <kconfig.h>
#include <stddef.h>
#include <stdio.h>
diff --git a/payloads/libpayload/libc/Makefile.mk b/payloads/libpayload/libc/Makefile.mk
index 2d277da..306bebf 100644
--- a/payloads/libpayload/libc/Makefile.mk
+++ b/payloads/libpayload/libc/Makefile.mk
@@ -28,7 +28,7 @@
##
libc-$(CONFIG_LP_LIBC) += malloc.c printf.c console.c string.c
-libc-$(CONFIG_LP_LIBC) += memory.c ctype.c ipchecksum.c lib.c libgcc.c
+libc-$(CONFIG_LP_LIBC) += memory.c ctype.c lib.c libgcc.c
libc-$(CONFIG_LP_LIBC) += rand.c time.c exec.c
libc-$(CONFIG_LP_LIBC) += readline.c getopt_long.c sysinfo.c
libc-$(CONFIG_LP_LIBC) += args.c
@@ -47,4 +47,5 @@
ifeq ($(CONFIG_LP_LIBC),y)
libc-srcs += $(coreboottop)/src/commonlib/bsd/elog.c
libc-srcs += $(coreboottop)/src/commonlib/bsd/gcd.c
+libc-srcs += $(coreboottop)/src/commonlib/bsd/ipchksum.c
endif
diff --git a/payloads/libpayload/libc/ipchecksum.c b/payloads/libpayload/libc/ipchecksum.c
deleted file mode 100644
index 118a694..0000000
--- a/payloads/libpayload/libc/ipchecksum.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * It has originally been taken from the FreeBSD project.
- *
- * Copyright (c) 2001 Charles Mott <cm(a)linktel.net>
- * Copyright (c) 2008 coresystems GmbH
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <libpayload.h>
-
-unsigned short ipchksum(const void *vptr, unsigned long nbytes)
-{
- int sum, oddbyte;
- const unsigned short *ptr = vptr;
-
- sum = 0;
- while (nbytes > 1) {
- sum += *ptr++;
- nbytes -= 2;
- }
- if (nbytes == 1) {
- oddbyte = 0;
- ((u8 *) & oddbyte)[0] = *(u8 *) ptr;
- ((u8 *) & oddbyte)[1] = 0;
- sum += oddbyte;
- }
- sum = (sum >> 16) + (sum & 0xffff);
- sum += (sum >> 16);
- return (~sum);
-}
--
To view, visit https://review.coreboot.org/c/coreboot/+/80253?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Ie8d323ce9f8d946758619761b4b22d54bce222b6
Gerrit-Change-Number: 80253
Gerrit-PatchSet: 4
Gerrit-Owner: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Jakub Czapiga <czapiga(a)google.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Yidi Lin <yidilin(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Julius Werner has submitted this change. ( https://review.coreboot.org/c/coreboot/+/80252?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: tests: Add some more ipchksum() test cases
......................................................................
tests: Add some more ipchksum() test cases
This patch adds a few more test cases for the IP checksum algorithm to
catch more possible corner cases (large data with more than 64K carries,
unaligned data, checksum addition with offset, etc.).
Change-Id: I39b4d3f1bb833894985649872329eec88a02a22c
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80252
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-by: Jakub Czapiga <czapiga(a)google.com>
---
M tests/commonlib/bsd/ipchksum-test.c
1 file changed, 30 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Arthur Heymans: Looks good to me, approved
Jakub Czapiga: Looks good to me, approved
diff --git a/tests/commonlib/bsd/ipchksum-test.c b/tests/commonlib/bsd/ipchksum-test.c
index 2aed94c..3231e21 100644
--- a/tests/commonlib/bsd/ipchksum-test.c
+++ b/tests/commonlib/bsd/ipchksum-test.c
@@ -63,6 +63,23 @@
free(helper_buffer);
}
+static void test_ipchksum_80kff(void **state)
+{
+ /* 64K is an important boundary since naive 32-bit sum implementations that accumulate
+ carries may run over after that point. */
+ size_t buffer_sz = 80 * 1024;
+ char *buffer = malloc(buffer_sz);
+
+ memset(buffer, 0xff, buffer_sz);
+ assert_int_equal(ipchksum(buffer, buffer_sz), 0);
+
+ /* Make things a bit more interesting... */
+ memcpy(buffer + 0x6789, test_data_simple, test_data_simple_sz);
+ assert_int_equal(ipchksum(buffer, buffer_sz), 0x6742);
+
+ free(buffer);
+}
+
static void test_ipchksum_add_empty_values(void **state)
{
uint16_t res;
@@ -81,7 +98,19 @@
test_data_simple_sz / 2);
uint16_t res_sum = ipchksum_add(test_data_simple_sz / 2, res_1, res_2);
+ assert_int_equal(0xb62e, res_1);
+ assert_int_equal(0x8c38, res_2);
assert_int_equal(test_data_simple_checksum, res_sum);
+
+ /* Test some unaligned sums */
+ res_1 = ipchksum(test_data_simple, 17);
+ res_2 = ipchksum(test_data_simple + 17, test_data_simple_sz - 17);
+ res_sum = ipchksum_add(17, res_1, res_2);
+
+ assert_int_equal(0x2198, res_1);
+ assert_int_equal(0xcf20, res_2);
+ assert_int_equal(test_data_simple_checksum, res_sum);
+
}
int main(void)
@@ -90,6 +119,7 @@
cmocka_unit_test(test_ipchksum_zero_length),
cmocka_unit_test(test_ipchksum_zero_buffer),
cmocka_unit_test(test_ipchksum_simple_data),
+ cmocka_unit_test(test_ipchksum_80kff),
cmocka_unit_test(test_ipchksum_add_empty_values),
cmocka_unit_test(test_ipchksum_add),
--
To view, visit https://review.coreboot.org/c/coreboot/+/80252?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I39b4d3f1bb833894985649872329eec88a02a22c
Gerrit-Change-Number: 80252
Gerrit-PatchSet: 4
Gerrit-Owner: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Jakub Czapiga <czapiga(a)google.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Jakub Czapiga, Michał Żygowski, Subrata Banik.
Hello Jakub Czapiga, Subrata Banik, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/79909?usp=email
to look at the new patch set (#14).
The following approvals got outdated and were removed:
Verified+1 by build bot (Jenkins)
Change subject: soc/intel/common/block: Add support for watchdog
......................................................................
soc/intel/common/block: Add support for watchdog
Implement watchdog for intel based platform by filling ACPI Watchdog
Action Table (WDAT) table.
The WDAT ACPI table encompasses essential watchdog functions, including:
- Setting and retrieving countdown/timeout values
- Starting and stopping the watchdog
- Pinging the watchdog
- Retrieving the cause of the last reboot, whether it was triggered by
the watchdog or another reason
The general purpose register TCO_MESSAGE1 stores the reason for the most
recent reboot rather than the original register TCO2_STS. This is
because the firmware must clear TCO2_STS, and it can't be reused for
storing this information for the operating system.
The watchdog is designed for use by the OS through certain defined
actions in the WDAT table. It relies on the ACPI Power Management Timer,
which may result in an increase in power consumption.
BUG=b:314260167
TEST=Enable CONFIG_ACPI_WDAT_WDT and CONFIG_USE_PM_ACPI_TIMER in the
config. Enable CONFIG_WDAT_WDT in the kernel config. Build and deploy
both firmware and kernel to the device. Trigger the watchdog by
performing the command: “cat > /dev/watchdog”. Wait approximately 30
seconds for the watchdog to reset the device.
Change-Id: Iaf7971f8407920a553fd91d2ed04193c882e08f1
Signed-off-by: Marek Maslanka <mmaslanka(a)google.com>
---
M src/soc/intel/common/block/acpi/acpi.c
M src/soc/intel/common/block/include/intelblocks/tco.h
M src/soc/intel/common/block/smbus/tco.c
3 files changed, 169 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/79909/14
--
To view, visit https://review.coreboot.org/c/coreboot/+/79909?usp=email
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Iaf7971f8407920a553fd91d2ed04193c882e08f1
Gerrit-Change-Number: 79909
Gerrit-PatchSet: 14
Gerrit-Owner: Marek Maślanka <mmaslanka(a)google.com>
Gerrit-Reviewer: Jakub Czapiga <czapiga(a)google.com>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Gerrit-Attention: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Gerrit-Attention: Subrata Banik <subratabanik(a)google.com>
Gerrit-Attention: Jakub Czapiga <czapiga(a)google.com>
Gerrit-MessageType: newpatchset