Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3026
-gerrit
commit 091e71f569c07e03180e3e8c9caf00c1fa562a30
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Fri Apr 5 00:12:21 2013 +0200
inteltool: cpu.c: Use conversion specifier `u` for unsigned integers
Cppcheck [1], a static code analysis tool, warns about the
following.
$ cppcheck --version
Cppcheck 1.59
$ cppcheck --enable=all .
[…]
Checking cpu.c...
[cpu.c:951]: (warning) %d in format string (no. 1) requires a signed integer given in the argument list.
[cpu.c:962]: (warning) %d in format string (no. 1) requires a signed integer given in the argument list.
[…]
And indeed, `core` is an unsigned integer and `man 3 printf` tells
the following about conversion specifiers.
d, i The int argument is converted to signed decimal notation. […]
o, u, x, X
The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal (x and X)
notation.
So use `u` and Cppcheck does not complain anymore.
[1] http://cppcheck.sourceforge.net/
Change-Id: If8dd8d0efe75fcb4af2502ae5100e3f2062649e4
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
util/inteltool/cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util/inteltool/cpu.c b/util/inteltool/cpu.c
index e73f096..80e1ed6 100644
--- a/util/inteltool/cpu.c
+++ b/util/inteltool/cpu.c
@@ -948,7 +948,7 @@ int print_intel_core_msrs(void)
#ifndef __DARWIN__
char msrfilename[64];
memset(msrfilename, 0, 64);
- sprintf(msrfilename, "/dev/cpu/%d/msr", core);
+ sprintf(msrfilename, "/dev/cpu/%u/msr", core);
fd_msr = open(msrfilename, O_RDWR);
@@ -959,7 +959,7 @@ int print_intel_core_msrs(void)
break;
#endif
if (cpu->num_per_core_msrs)
- printf("\n====================== UNIQUE MSRs (core %d) ======================\n", core);
+ printf("\n====================== UNIQUE MSRs (core %u) ======================\n", core);
for (i = 0; i < cpu->num_per_core_msrs; i++) {
msr = rdmsr(cpu->per_core_msrs[i].number);
Stefan Tauner (stefan.tauner(a)gmx.at) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3025
-gerrit
commit 73a20080249239a7b3fd3e04d910335f780b5040
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Fri Apr 5 01:23:32 2013 +0200
inteltool: clean up file descriptors a bit
Paul Menzel reported that Cppcheck 1.59 reported an unused variable io_fd.
While that is true, the underlying issue is that the file descriptors are not
closed properly at the end. "a bit" refers to the numerous exit calls all
around that of course circumvent the cleanup.
Arguably one could live without cleaning up because it is done automatically
anyway.
Change-Id: Ifd46314672ca431d820fb3842bfbf12decc90f9b
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
---
util/inteltool/inteltool.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/util/inteltool/inteltool.c b/util/inteltool/inteltool.c
index 2396eb0..6c073ce 100644
--- a/util/inteltool/inteltool.c
+++ b/util/inteltool/inteltool.c
@@ -26,9 +26,7 @@
#include <fcntl.h>
#include <sys/mman.h>
#include "inteltool.h"
-#if defined(__FreeBSD__)
#include <unistd.h>
-#endif
/*
* http://pci-ids.ucw.cz/read/PC/8086
@@ -307,9 +305,6 @@ int main(int argc, char *argv[])
#if defined(__FreeBSD__)
int io_fd;
-#endif
-
-#if defined(__FreeBSD__)
if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
perror("/dev/io");
#else
@@ -450,5 +445,12 @@ int main(int argc, char *argv[])
// pci_free_dev(sb); // TODO: glibc detected "double free or corruption"
pci_cleanup(pacc);
+#if defined(__FreeBSD__)
+ close(io_fd);
+#endif
+
+#ifndef __DARWIN__
+ close(fd_mem);
+#endif
return 0;
}
Stefan Tauner (stefan.tauner(a)gmx.at) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3025
-gerrit
commit bad39f9d389d17a30d8460c26e7fd4018b169a5c
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Fri Apr 5 01:23:32 2013 +0200
inteltool: clean up file descriptors a bit
Paul Menzel reported that Cppcheck 1.59 reported an unused variable io_fd.
While that is true, the underlying issue is that the file descriptors are not
closed properly at the end. "a bit" referes to the numerous exit calls all
around that of course circumvent the cleanup.
Arguably one could live without cleaning up because it is done automatically
anyway.
Change-Id: Ifd46314672ca431d820fb3842bfbf12decc90f9b
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
---
util/inteltool/inteltool.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/util/inteltool/inteltool.c b/util/inteltool/inteltool.c
index 2396eb0..6c073ce 100644
--- a/util/inteltool/inteltool.c
+++ b/util/inteltool/inteltool.c
@@ -26,9 +26,7 @@
#include <fcntl.h>
#include <sys/mman.h>
#include "inteltool.h"
-#if defined(__FreeBSD__)
#include <unistd.h>
-#endif
/*
* http://pci-ids.ucw.cz/read/PC/8086
@@ -307,9 +305,6 @@ int main(int argc, char *argv[])
#if defined(__FreeBSD__)
int io_fd;
-#endif
-
-#if defined(__FreeBSD__)
if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
perror("/dev/io");
#else
@@ -450,5 +445,12 @@ int main(int argc, char *argv[])
// pci_free_dev(sb); // TODO: glibc detected "double free or corruption"
pci_cleanup(pacc);
+#if defined(__FreeBSD__)
+ close(io_fd);
+#endif
+
+#ifndef __DARWIN__
+ close(fd_mem);
+#endif
return 0;
}
Stefan Tauner (stefan.tauner(a)gmx.at) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3024
-gerrit
commit 2c52d6afacf60278f3f3952178adbe49fa536191
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Fri Apr 5 01:15:04 2013 +0200
inteltool: use inttypes for prints in memory.c
This fixes at least one warning on my machine where "llx" is replaced by PRIx64.
Change-Id: Iee3e5027d327d4d5f8e6d8b2d53d051f74bfc354
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
---
util/inteltool/memory.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/util/inteltool/memory.c b/util/inteltool/memory.c
index 6847e5c..506620d 100644
--- a/util/inteltool/memory.c
+++ b/util/inteltool/memory.c
@@ -197,25 +197,25 @@ int print_mchbar(struct pci_dev *nb, struct pci_access *pacc)
for (i = 0; i < size; i++) {
switch (mch_registers[i].size) {
case 8:
- printf("mchbase+0x%04x: 0x%016llx (%s)\n",
+ printf("mchbase+0x%04x: 0x%016"PRIx64" (%s)\n",
mch_registers[i].addr,
*(uint64_t *)(mchbar+mch_registers[i].addr),
mch_registers[i].name);
break;
case 4:
- printf("mchbase+0x%04x: 0x%08x (%s)\n",
+ printf("mchbase+0x%04x: 0x%08"PRIx32" (%s)\n",
mch_registers[i].addr,
*(uint32_t *)(mchbar+mch_registers[i].addr),
mch_registers[i].name);
break;
case 2:
- printf("mchbase+0x%04x: 0x%04x (%s)\n",
+ printf("mchbase+0x%04x: 0x%04"PRIx16" (%s)\n",
mch_registers[i].addr,
*(uint16_t *)(mchbar+mch_registers[i].addr),
mch_registers[i].name);
break;
case 1:
- printf("mchbase+0x%04x: 0x%02x (%s)\n",
+ printf("mchbase+0x%04x: 0x%02"PRIx8" (%s)\n",
mch_registers[i].addr,
*(uint8_t *)(mchbar+mch_registers[i].addr),
mch_registers[i].name);
@@ -225,7 +225,7 @@ int print_mchbar(struct pci_dev *nb, struct pci_access *pacc)
} else {
for (i = 0; i < size; i += 4) {
if (*(uint32_t *)(mchbar + i))
- printf("0x%04x: 0x%08x\n", i, *(uint32_t *)(mchbar+i));
+ printf("0x%04x: 0x%08"PRIx32"\n", i, *(uint32_t *)(mchbar+i));
}
}
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3022
-gerrit
commit a51859c1a4816692c66b880e2b533f3812ddccce
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Thu Apr 4 16:50:03 2013 +0200
Lenovo X60: Make it compile with CONFIG_DYNAMIC_CBMEM=y
This change was inspired by the google/link device
romstage.c code.
Change-Id: I8c6fbce07b86cb8ca112d5c10cf892ef05955bbc
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/mainboard/lenovo/x60/romstage.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c
index 8d5f922..cca44cf 100644
--- a/src/mainboard/lenovo/x60/romstage.c
+++ b/src/mainboard/lenovo/x60/romstage.c
@@ -216,6 +216,7 @@ void main(unsigned long bist)
{
u32 reg32;
int boot_mode = 0;
+ int cbmem_was_initted;
const u8 spd_addrmap[2 * DIMM_SOCKETS] = { 0x50, 0x52, 0x51, 0x53 };
if (bist == 0)
@@ -313,15 +314,13 @@ void main(unsigned long bist)
#endif
MCHBAR16(SSKPD) = 0xCAFE;
+ cbmem_was_initted = !cbmem_initialize();
#if CONFIG_HAVE_ACPI_RESUME
- /* Start address of high memory tables */
- unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
-
/* If there is no high memory area, we didn't boot before, so
* this is not a resume. In that case we just create the cbmem toc.
*/
- if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
+ if ((boot_mode == 2) && cbmem_was_initted) {
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3022
-gerrit
commit 4c687964c29ae60c971b85744834664c361b6c36
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Thu Apr 4 16:50:03 2013 +0200
Lenovo X60: Make it compile with CONFIG_DYNAMIC_CBMEM=y
Note that while the code in src/mainboard/lenovo/x60
compiles, it still doesn't fix the i945/raminit.c code
which fails like that:
i945/raminit.c:31:21: error: no previous prototype for 'get_cbmem_toc' [-Werror=missing-prototypes]
and may have more failures(since I cound't compile coreboot fully).
Change-Id: I8c6fbce07b86cb8ca112d5c10cf892ef05955bbc
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
src/mainboard/lenovo/x60/romstage.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c
index 8d5f922..cca44cf 100644
--- a/src/mainboard/lenovo/x60/romstage.c
+++ b/src/mainboard/lenovo/x60/romstage.c
@@ -216,6 +216,7 @@ void main(unsigned long bist)
{
u32 reg32;
int boot_mode = 0;
+ int cbmem_was_initted;
const u8 spd_addrmap[2 * DIMM_SOCKETS] = { 0x50, 0x52, 0x51, 0x53 };
if (bist == 0)
@@ -313,15 +314,13 @@ void main(unsigned long bist)
#endif
MCHBAR16(SSKPD) = 0xCAFE;
+ cbmem_was_initted = !cbmem_initialize();
#if CONFIG_HAVE_ACPI_RESUME
- /* Start address of high memory tables */
- unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
-
/* If there is no high memory area, we didn't boot before, so
* this is not a resume. In that case we just create the cbmem toc.
*/
- if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
+ if ((boot_mode == 2) && cbmem_was_initted) {
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
the following patch was just integrated into master:
commit 72ef8881a319de48464e640ccd37e8e282320284
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Thu Apr 4 14:12:26 2013 +0200
libpayload, superiotool: README: Prepend `coreboot/` to path of change directory line
Nico Huber spotted [1], that commit (4d6ab4e2) [1] updating
superiotools’s `README` with the Git command line
superiotool: Update README with Git repository URL and directory location
missed, that after `git clone` one sitll has to change into
the cloned directory.
So prepend the path with `coreboot/` to fix that. The same error
happened in the commit (e1ea5151) for libpayload [2]
libpayload: Update README with Git repository URL and directory location
and is fixed in this patch too.
[1] http://review.coreboot.org/#/c/3019/
[2] http://review.coreboot.org/2228
Change-Id: Ib6e8b678af6276556a40ccfd52ae35ca7e674455
Reported-by: Nico Huber <nico.h(a)gmx.de>
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/3021
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.huber(a)secunet.com>
Build-Tested: build bot (Jenkins) at Thu Apr 4 15:07:20 2013, giving +1
Reviewed-By: Nico Huber <nico.huber(a)secunet.com> at Thu Apr 4 17:22:14 2013, giving +2
See http://review.coreboot.org/3021 for details.
-gerrit