Bruce Griffith (Bruce.Griffith(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6676
-gerrit
commit dc72b47331ec88bef85f8f4245b08896628d9796
Author: Bruce Griffith <Bruce.Griffith(a)se-eng.com>
Date: Wed Jul 16 11:25:21 2014 -0600
MullinsPI: Fletcher's Checksum computation routine
The AMD Platform Security Processor (PSP) requires a Fletcher's
Checksum at the end of the PSP directory. This code implements
a Fletcer's checksum by reading bytes from stdin and writes the
bytes back to stdout with an embedded checksum.
This utility is used on PSP binaries during coreboot build.
Change-Id: I506a479d8204ca4f8267d53aa152ac4b473dbc75
Signed-off-by: Bruce Griffith <Bruce.Griffith(a)se-eng.com>
---
util/fletcher/Makefile.inc | 4 ++
util/fletcher/fletcher.c | 122 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 126 insertions(+)
diff --git a/util/fletcher/Makefile.inc b/util/fletcher/Makefile.inc
new file mode 100644
index 0000000..2798b7c
--- /dev/null
+++ b/util/fletcher/Makefile.inc
@@ -0,0 +1,4 @@
+fletcher_exe : fletcher.c
+ gcc fletcher.c -o fletcher
+
+fletcher : fletcher_exe
diff --git a/util/fletcher/fletcher.c b/util/fletcher/fletcher.c
new file mode 100644
index 0000000..dabe4b0
--- /dev/null
+++ b/util/fletcher/fletcher.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1998-2006 The TCPDUMP project
+ * 2014 Sage Electronic Engineering, LLC
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
+ * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * Original code by Hannes Gredler <hannes(a)juniper.net>
+ * Rewritten for Fletcher32 by Bruce Griffith <Bruce.Griffith(a)se-eng.com>
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#define MAX_PSP_DIRECTORY_SIZE 512
+
+typedef unsigned int uint32_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+
+/*
+ * Creates the OSI Fletcher checksum. See 8473-1, Appendix C, section C.3.
+ * The checksum field of the passed PDU does not need to be reset to zero.
+ *
+ * The "Fletcher Checksum" was proposed in a paper by John G. Fletcher of
+ * Lawrence Livermore Labs. The Fletcher Checksum was proposed as an
+ * alternative to cyclical redundancy checks because it provides error-
+ * detection properties similar to cyclical redundancy checks but at the
+ * cost of a simple summation technique. Its characteristics were first
+ * published in IEEE Transactions on Communications in January 1982. One
+ * version has been adopted by ISO for use in the class-4 transport layer
+ * of the network protocol.
+ *
+ * This program expects:
+ * stdin: The input file to compute a checksum for. The input file
+ * not be longer than 256 bytes.
+ * stdout: Copied from the input file with the Fletcher's Checksum
+ * inserted 8 bytes after the beginning of the file.
+ * stderr: Used to print out error messages.
+ */
+
+uint32_t fletcher32 (const uint16_t *pptr, int length)
+{
+
+ uint32_t c0;
+ uint32_t c1;
+ uint32_t checksum;
+ int index;
+
+ c0 = 0xFFFF;
+ c1 = 0xFFFF;
+
+ for (index = 0; index < length; index++) {
+ /*
+ * Ignore the contents of the checksum field.
+ */
+ c0 += *(pptr++);
+ c1 += c0;
+ if ((index % 360) == 0) {
+ c0 = (c0 & 0xFFFF) + (c0 >> 16); // Sum0 modulo 65535 + the overflow
+ c1 = (c1 & 0xFFFF) + (c1 >> 16); // Sum1 modulo 65535 + the overflow
+ }
+
+ }
+
+ c0 = (c0 & 0xFFFF) + (c0 >> 16); // Sum0 modulo 65535 + the overflow
+ c1 = (c1 & 0xFFFF) + (c1 >> 16); // Sum1 modulo 65535 + the overflow
+ checksum = (c1 << 16) | c0;
+
+ return checksum;
+}
+
+int main(int argc, char **argv)
+{
+ uint32_t checksum = 0xFFFFFFFF;
+ struct stat filestat = {};
+ int retcode = EINVAL;
+ size_t filesize = 0;
+
+ uint16_t buffer[MAX_PSP_DIRECTORY_SIZE / sizeof(uint16_t)];
+
+ retcode = fstat(fileno(stdin), &filestat);
+ filesize = filestat.st_size;
+ if (retcode < 0) {
+ perror("FLETCHER32");
+ return errno;
+ } else if (!((12 < filesize) && (filesize <= sizeof(buffer)))) {
+ fprintf(stderr, "FLETCHER32: input file is not valid for this program.\n");
+ return EINVAL;
+ }
+ retcode = read(fileno(stdin), (void *)buffer, filesize);
+ if (retcode < 0) {
+ perror("FLETCHER32");
+ return errno;
+ }
+
+ checksum = fletcher32(&buffer[2], filesize/2 - 2);
+ *((uint32_t *)& buffer[2]) = checksum;
+#ifdef DEBUG
+ fprintf(stderr, "Fletcher's Checksum: %x\n", checksum);
+#endif
+
+ retcode = write(fileno(stdout), buffer, filesize);
+ if (retcode < 0) {
+ perror("FLETCHER32");
+ return errno;
+ }
+
+ return 0;
+}
Bruce Griffith (Bruce.Griffith(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6675
-gerrit
commit 62eed819bfe4dad9cb184d12d6af197084ef40dc
Author: Bruce Griffith <Bruce.Griffith(a)se-eng.com>
Date: Fri Aug 15 11:54:54 2014 -0600
AMD Family 14: Fix permissions on one northbridge file
fam14_callouts.h should not have the execute bit set.
Change-Id: Iab44d04f2c9669e28d2d5028b0a11e565cc7bb07
Signed-off-by: Bruce Griffith <Bruce.Griffith(a)se-eng.com>
---
src/northbridge/amd/agesa/family14/fam14_callouts.h | 0
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/src/northbridge/amd/agesa/family14/fam14_callouts.h b/src/northbridge/amd/agesa/family14/fam14_callouts.h
old mode 100755
new mode 100644
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6670
-gerrit
commit 2e947f2eaefa6303c6b2ec47b9ea7bacf01b9ab4
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Fri Aug 15 02:06:00 2014 +0200
lint-stable: Check that modified boards contain meaningful board_info.txt.
Change-Id: Idd3ff029e16b4b963f13d341dabdc1949c4e9275
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
util/lint/lint-stable-005-board-status | 45 ++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/util/lint/lint-stable-005-board-status b/util/lint/lint-stable-005-board-status
new file mode 100755
index 0000000..2ef2e3b
--- /dev/null
+++ b/util/lint/lint-stable-005-board-status
@@ -0,0 +1,45 @@
+#!/bin/sh
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2014 Vladimir Serbinenko <phcoder(a)gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# DESCR: Check that every board has a meaningful board_info.txt
+
+LC_ALL=C export LC_ALL
+for mobodir in $(git diff --name-status |grep -v "^D" |cut -c3- | sed -n 's,^\(src/mainboard/[^/]*/[^/]*\).*$,\1,p'|sort|uniq); do
+ board_info="$mobodir/board_info.txt"
+ if ! [ -f "$board_info" ]; then
+ echo "No $board_info found" >&2
+ exit 1
+ fi
+ category="$(sed -n 's#^Category: \(.*\)$#\1#p' < "$board_info")"
+ case "$category" in
+ desktop|server|laptop|half|mini|settop|"eval"|sbc|emulation|misc)
+ ;;
+ "")
+ echo "$board_info doesn't contain 'Category' tag" >&2
+ exit 1
+ ;;
+ *)
+ echo "$board_info specifies unknown category '$category'" >&2
+ exit 1
+ ;;
+ esac
+done
+
+exit 0
+
Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6674
-gerrit
commit 4efea9464e1a7c7e1b74497dd73d1fd9827f44d7
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Fri Aug 15 15:58:36 2014 +0200
ec/lenovo/h8/acpi/systemstatus.asl: Fix typo in o*n* in comment
Change-Id: I655536f64faaa7e1600d4fec62ba80730e2cc45a
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
src/ec/lenovo/h8/acpi/systemstatus.asl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ec/lenovo/h8/acpi/systemstatus.asl b/src/ec/lenovo/h8/acpi/systemstatus.asl
index 17e8ba7..d914e8b 100644
--- a/src/ec/lenovo/h8/acpi/systemstatus.asl
+++ b/src/ec/lenovo/h8/acpi/systemstatus.asl
@@ -45,7 +45,7 @@ Scope (\_SI)
If (LEqual (Arg0, 2)) {
/* waking state */
- /* power LED om */
+ /* power LED on */
\_SB.PCI0.LPCB.EC.LED(0x80)
/* suspend LED blinking */
\_SB.PCI0.LPCB.EC.LED(0xc7)
Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6673
-gerrit
commit 1b6f7c679aec6531de238f651c58850ca3dc745f
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Fri Aug 15 10:32:50 2014 +0200
lenovo/x60/i915.c: Define `BSM` to fix build error
Commit 8aeab56b (lenovo/x60/i915.c: Use define for `BSM`) [1] breaks the
build of the Lenovo X60 with native graphics initialization [2].
CC mainboard/lenovo/x60/i915.ramstage.o
src/mainboard/lenovo/x60/i915.c: In function ‘gtt_setup’:
src/mainboard/lenovo/x60/i915.c:141:69: error: ‘BSM’ undeclared (first use in this function)
src/mainboard/lenovo/x60/i915.c:141:69: note: each undeclared identifier is reported only once for each function it appears in
To fix the error, add the define for `BSM` in the file directly as
including the header `src/northbridge/intel/i945/i945.h` does not work.
[1] http://review.coreboot.org/5932
[2] This was not caught as only the commit on top was build tested,
which removes that line where `BSM` is used.
Change-Id: Ic24c66b0175a67ad95064a9840daa615ab88c1ee
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
src/mainboard/lenovo/x60/i915.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mainboard/lenovo/x60/i915.c b/src/mainboard/lenovo/x60/i915.c
index 8fbd2a1..529b262 100644
--- a/src/mainboard/lenovo/x60/i915.c
+++ b/src/mainboard/lenovo/x60/i915.c
@@ -48,6 +48,7 @@ enum {
vmsg = 1, vio = 2, vspin = 4,
};
+#define BSM 0x5c
#define PGETLB_CTL 0x2020
static int verbose = 0;
Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6672
-gerrit
commit 3fc82e0bf658da9098b249ac5f4993f64b4f69cb
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Fri Aug 15 10:27:58 2014 +0200
google/link, lenovo/x60: Include `stdlib.h` for macro `ARRAY_SIZE`
Fix up commit 4c960d4e (google/link, lenovo/x60: i915io.c: Use define
`ARRAY_SIZE`) [1] breaking the build with native graphics
initialization. The error for the Lenovo X60 is as follows.
CC mainboard/lenovo/x60/i915io.ramstage.o
src/mainboard/lenovo/x60/i915io.c:2273:1: error: implicit declaration of function ‘ARRAY_SIZE’ [-Werror=implicit-function-declaration]
src/mainboard/lenovo/x60/i915io.c:2273:1: error: initializer element is not constant
cc1: all warnings being treated as errors
make: *** [build/mainboard/lenovo/x60/i915io.ramstage.o] Fehler 1
Including the header `stdlib.h` with the define for the macro
`ARRAY_SIZE` fixes the build issue.
[1] http://review.coreboot.org/5936
Change-Id: I6b74df8e19c1492927c1fb023367d9d8b4afdd29
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
src/mainboard/google/link/i915io.c | 1 +
src/mainboard/lenovo/x60/i915io.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/mainboard/google/link/i915io.c b/src/mainboard/google/link/i915io.c
index abceb05..94adcba 100644
--- a/src/mainboard/google/link/i915io.c
+++ b/src/mainboard/google/link/i915io.c
@@ -18,6 +18,7 @@
*/
#include <stdint.h>
+#include <stdlib.h>
#include "i915io.h"
struct iodef iodefs[] = {
diff --git a/src/mainboard/lenovo/x60/i915io.c b/src/mainboard/lenovo/x60/i915io.c
index b3c47b7..3b59040 100644
--- a/src/mainboard/lenovo/x60/i915io.c
+++ b/src/mainboard/lenovo/x60/i915io.c
@@ -18,6 +18,7 @@
*/
#include <stdint.h>
+#include <stdlib.h>
#include "i915io.h"
struct iodef iodefs[] = {