Re: [coreboot] Feedback On Coreboot: the Solution to the Secure Boot Fiasco

2013-01-07 Thread Peter Stuge
gary sheppard wrote:
 I have been watching the Intel Haswell cpu's. The Intel GPU
 initiative in linux seems pretty strong lately.

You will unfortunately have to change your mindset if you want to
make coreboot a priority. :\


//Peter

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [SPAM] Re: Feedback On Coreboot: the Solution to the SecureBoot Fiasco

2013-01-07 Thread Peter Stuge
Xavi Drudis Ferran wrote:
 My impression is that we're headed to a world were there'll be open
 hardware plataforms, running free software and accessing more or
 less free content, and mainstream closed hardware running nonfre
 software and accessing DRMized content. With little or no bidges
 between these worlds.

We are already living in this future. Take a look at smartphones.


//Peter

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [SPAM] Re: Feedback On Coreboot: the Solution to the SecureBoot Fiasco

2013-01-07 Thread Xavi Drudis Ferran
I've read the whole thread and I agree with Ron and Gary. 

Devices that won't boot the software that the user chooses are traps and should
never be bought. Even devices that let the user control the keys they trust are 
regrettable. The only solution would be a massive rejection of the whole 
scheme. 

On one hand I doubt the security of rejecting unsigned code is worth turning a 
gerneral purpose  
computer in a machine that will only run a finite set of software or will run 
untrusted software
with restrictions. It's like havign less of the general machine you meant to 
buy.

On the other even if we keep our freedom to run what we want we have already 
lost
the freedom of running what we want without others being able to know what we 
run
(in fact being able to tell we don't run what they trust).
For now secure boot only restricts what we boot (and the booted OS restricts 
the rest
of what we run). But in the end the purpuse is to stablish a DRM scheme so that 
if a server can't prove that we're running software trusted by them (not us) 
then we won't 
be able to access content or even we'll be refused connection to the internet 
or whatever
has to do with equipment controlled by someone else.  

So yes, the only solution is, as Ron suggested to plainly reject the scheme, to 
avoid 
buying, running, working around these sort of restrictions. And still this is 
only useful 
if the majority of people does it. Then the providers of internet access, 
connectivity or
whatever we want of others won't find interesting to restrict their business to 
the few
secure booters. I'm not so optimistic about how feasible this is now
and how feasible it gets each day. 

Intel CPUs are sold in equipment with intel GPUs. Intel GPUS have free software
drivers, but Intel did not provide code or documentation to boot their CPUs 
(does it now ? at least Google paid for some free code so it's better than it 
was, right?).
Modern Intel CPUs need to run signed, propietary code before they can even 
access RAM. 

AMD contributes code to coreboot and documents their processors well. But then 
their GPUs (wih computing power and acces to main memory, etc.) 
run some form of propietary code (even with the free software drivers). And I 
heard their lates GPUs don't even have good support in this kind of free drivers
with propietary AtomBIOS. And the tools to implement secure boot are there too, 
so once everybody runs
secure booted platforms people may be able to tell we're not. 

Likiwise new ARM processors are getting TrustZone and similar technology (and 
often
require propietary drivers for GPUs). 

I haven't heard so much for MIPS, but I haven't heard of similarly powerful 
MIPS 
processors either. 

So our choices are not very nice, even if some choices are nicer than others. 

My impression is that we're headed to a world were there'll be open hardware 
plataforms, 
running free software and accessing more or less free content, and mainstream 
closed hardware running nonfre software and accessing DRMized content. With 
little 
or no bidges between these worlds.  And 
hardware does not have the same economics of software, so being a niche market
can be harder than when free software and propietary software could run on the 
same hardware. 

It's a pity, but people aren't protesting enough. 

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [SPAM] Re: Feedback On Coreboot: the Solution to the SecureBoot Fiasco

2013-01-07 Thread Ward Vandewege
On Mon, Jan 07, 2013 at 03:29:01PM +0100, Xavi Drudis Ferran wrote:
 For now secure boot only restricts what we boot (and the booted OS restricts 
 the rest
 of what we run). But in the end the purpuse is to stablish a DRM scheme so 
 that 
 if a server can't prove that we're running software trusted by them (not us) 
 then we won't 
 be able to access content or even we'll be refused connection to the internet 
 or whatever
 has to do with equipment controlled by someone else.  

This. It's called 'remote attestation'
(https://en.wikipedia.org/wiki/Trusted_Computing#Remote_attestation). An
obvious (first?) application will be your bank, which will refuse you access
to their online banking system unless you run a 'trusted' software stack. And
you can be sure that their idea of a 'trusted' stack will be proprietary
software, only.

Because we all know that Windows is the most secure operating system out
there (/sarcasm).

Thanks,
Ward.



-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] New patch to review for coreboot: 6236709 qemu-x86: Implement more features

2013-01-07 Thread stefan.reina...@coreboot.org
Stefan Reinauer (stefan.reina...@coreboot.org) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2113

-gerrit

commit 62367091b42a97eb70cef062d5bbbf85ede6abc0
Author: Stefan Reinauer reina...@chromium.org
Date:   Mon Jan 7 13:21:22 2013 -0800

qemu-x86: Implement more features

This patch switches the Qemu target to use (pseudo) Cache As RAM
and enables some ACPI code. This allows to use the CBMEM console
and timestamp code with coreboot in Qemu. Right now, the ACPI code
is commented out because leaving it in breaks IDE.

Change-Id: Ie20f3ecc194004f354ae3437b9cf9175382cadf8
Signed-off-by: Stefan Reinauer reina...@google.com
---
 src/mainboard/emulation/qemu-x86/Kconfig  |  13 +-
 src/mainboard/emulation/qemu-x86/Makefile.inc |   1 +
 src/mainboard/emulation/qemu-x86/acpi_tables.c| 193 +
 src/mainboard/emulation/qemu-x86/cache_as_ram.inc | 100 +++
 src/mainboard/emulation/qemu-x86/devicetree.cb|   2 +-
 src/mainboard/emulation/qemu-x86/dsdt.asl | 958 ++
 src/mainboard/emulation/qemu-x86/mainboard.c  |  24 +-
 src/mainboard/emulation/qemu-x86/memory.c |  47 ++
 src/mainboard/emulation/qemu-x86/northbridge.c|  16 +-
 src/mainboard/emulation/qemu-x86/romstage.c   |  46 +-
 10 files changed, 1380 insertions(+), 20 deletions(-)

diff --git a/src/mainboard/emulation/qemu-x86/Kconfig 
b/src/mainboard/emulation/qemu-x86/Kconfig
index db1a027..c171309 100644
--- a/src/mainboard/emulation/qemu-x86/Kconfig
+++ b/src/mainboard/emulation/qemu-x86/Kconfig
@@ -4,9 +4,11 @@ config BOARD_SPECIFIC_OPTIONS # dummy
def_bool y
select ARCH_X86
select SOUTHBRIDGE_INTEL_I82371EB
-   select ROMCC
+   select CACHE_AS_RAM
select HAVE_OPTION_TABLE
select HAVE_PIRQ_TABLE
+   select HAVE_ACPI_TABLES
+   select HAVE_ACPI_RESUME
select BOARD_ROMSIZE_KB_256
 
 config MAINBOARD_DIR
@@ -21,4 +23,13 @@ config IRQ_SLOT_COUNT
int
default 6
 
+config DCACHE_RAM_BASE
+   hex
+   default 0xd
+
+config DCACHE_RAM_SIZE
+   hex
+   default 0x1
+
+
 endif # BOARD_EMULATION_QEMU_X86
diff --git a/src/mainboard/emulation/qemu-x86/Makefile.inc 
b/src/mainboard/emulation/qemu-x86/Makefile.inc
index 5ba0d14..93f9cc2 100644
--- a/src/mainboard/emulation/qemu-x86/Makefile.inc
+++ b/src/mainboard/emulation/qemu-x86/Makefile.inc
@@ -1,3 +1,4 @@
 ROMCCFLAGS := -mcpu=i386 -O
 
+cpu_incs += $(src)/mainboard/emulation/qemu-x86/cache_as_ram.inc
 ramstage-y += northbridge.c
diff --git a/src/mainboard/emulation/qemu-x86/acpi_tables.c 
b/src/mainboard/emulation/qemu-x86/acpi_tables.c
new file mode 100644
index 000..de8d7f1
--- /dev/null
+++ b/src/mainboard/emulation/qemu-x86/acpi_tables.c
@@ -0,0 +1,193 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ *
+ * 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.
+ *
+ * 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
+ */
+
+#include types.h
+#include string.h
+#include console/console.h
+#include arch/acpi.h
+#include arch/ioapic.h
+#include arch/acpigen.h
+#include arch/smp/mpspec.h
+#include device/device.h
+#include device/pci.h
+#include device/pci_ids.h
+#include cpu/x86/msr.h
+
+extern const unsigned char AmlCode[];
+#if CONFIG_HAVE_ACPI_SLIC
+unsigned long acpi_create_slic(unsigned long current);
+#endif
+
+unsigned long acpi_fill_madt(unsigned long current)
+{
+   /* Local APICs */
+   current = acpi_create_madt_lapics(current);
+
+   /* IOAPIC */
+   current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
+   2, IO_APIC_ADDR, 0);
+
+   /* INT_SRC_OVR */
+   current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
+current, 0, 0, 2, 0);
+   current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
+current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH);
+
+   return current;
+}
+
+unsigned long acpi_fill_ssdt_generator(unsigned long current, const char 
*oem_table_id)
+{
+   generate_cpu_entries();
+   return (unsigned long) (acpigen_get_current());
+}
+
+unsigned long acpi_fill_slit(unsigned long current)
+{
+   // Not implemented
+   return current;
+}
+
+unsigned long acpi_fill_srat(unsigned long current)

Re: [coreboot] [SPAM] Re: Feedback On Coreboot: the Solution to the SecureBoot Fiasco

2013-01-07 Thread Peter Stuge
Ward Vandewege wrote:
 This. It's called 'remote attestation'
 (https://en.wikipedia.org/wiki/Trusted_Computing#Remote_attestation).
 An obvious (first?) application will be your bank, which will refuse
 you access to their online banking system unless you run a 'trusted'
 software stack.

Yes and no - software is not the core business of banks, so they
most likely prefer *not* to have to deal with these things, including
customer support.

They simply buy solutions, such as Vasco DigiPass, and/or crypto chip
cards. A progressive bank might have an IT department that actually
develops an iOS app, but I think that will be about it.

There are some highlights however;

In Sweden, banks accept government-issued eIDs for login, as long as
they follow the BankID coalition spec. There is an open source and
free software implementation of this, which does allow to use any
token or chip card supported by OpenSC.

In Germany, banks support a public API for home banking, for which it
also exists at least one open source and free software implementation
that works fine with the chip card issued by the bank again via
OpenSC.


//Peter

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] New patch to review for coreboot: 1560718 cbmem utility: Add option to dump cbmem console

2013-01-07 Thread stefan.reina...@coreboot.org
Stefan Reinauer (stefan.reina...@coreboot.org) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2114

-gerrit

commit 1560718f8d10dd0394e3df6f7bdc4fee54034ce5
Author: Stefan Reinauer stefan.reina...@coreboot.org
Date:   Mon Jan 7 13:37:12 2013 -0800

cbmem utility: Add option to dump cbmem console

This adds an option to the cbmem utility to dump the cbmem console.
To keep the utility backwards compatible, specifying -c disables
printing of time stamps. To print both console and time stamps, run
the utility with -ct

Change-Id: Idd2dbf32c3c44f857c2f41e6c817c5ab13155d6f
Signed-off-by: Stefan Reinauer reina...@google.com
---
 util/cbmem/cbmem.c | 47 ---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index df00684..cc98e56 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -283,6 +283,29 @@ static void dump_timestamps(void)
unmap_memory();
 }
 
+/* dump the cbmem console */
+static void dump_console(void)
+{
+   void *console_p;
+
+   if (console.tag != LB_TAG_CBMEM_CONSOLE) {
+   fprintf(stderr, No console found in coreboot table.\n);
+   return;
+   }
+
+   console_p = map_memory((unsigned long)console.cbmem_addr);
+   /* The in-memory format of the console area is:
+*  u32  size
+*  u32  cursor
+*  char console[size]
+* Hence we have to add 8 to get to the actual console string.
+*/
+   printf(%s, (char *)console_p + 8);
+
+   unmap_memory();
+}
+
+
 void print_version(void)
 {
printf(cbmem v%s -- , CBMEM_VERSION);
@@ -303,6 +326,9 @@ void print_usage(const char *name)
 {
printf(usage: %s [-vh?]\n, name);
printf(\n
+   -c | --console:   verbose (debugging) output\n
+   -t | --timestamps:verbose (debugging) output\n
+   -V | --verbose:   verbose (debugging) output\n
-v | --version:   print the version\n
-h | --help:  print this help\n
 \n);
@@ -314,18 +340,30 @@ int main(int argc, char** argv)
int j;
static const int possible_base_addresses[] = { 0, 0xf };
 
-   int print_timestamps = 1;
+   int print_defaults = 1;
+   int print_console = 0;
+   int print_timestamps = 0;
 
int opt, option_index = 0;
static struct option long_options[] = {
+   {console, 0, 0, 'c'},
+   {timestamps, 0, 0, 't'},
{verbose, 0, 0, 'V'},
{version, 0, 0, 'v'},
{help, 0, 0, 'h'},
{0, 0, 0, 0}
};
-   while ((opt = getopt_long(argc, argv, Vvh?,
+   while ((opt = getopt_long(argc, argv, ctVvh?,
  long_options, option_index)) != EOF) {
switch (opt) {
+   case 'c':
+   print_console = 1;
+   print_defaults = 0;
+   break;
+   case 't':
+   print_timestamps = 1;
+   print_defaults = 0;
+   break;
case 'V':
verbose = 1;
break;
@@ -355,7 +393,10 @@ int main(int argc, char** argv)
break;
}
 
-   if (print_timestamps)
+   if (print_console)
+   dump_console();
+
+   if (print_defaults || print_timestamps)
dump_timestamps();
 
close(fd);

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] New patch to review for coreboot: 1d064f3 cbmem utility: drop obsolete python version

2013-01-07 Thread stefan.reina...@coreboot.org
Stefan Reinauer (stefan.reina...@coreboot.org) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2115

-gerrit

commit 1d064f3d704f43df3f03b580076f17ce96275f42
Author: Stefan Reinauer stefan.reina...@coreboot.org
Date:   Mon Jan 7 13:39:43 2013 -0800

cbmem utility: drop obsolete python version

The first version of the cbmem utility was written in python,
but it had issues with 64bit systems and other little hick ups.
Since the C version has much fewer dependencies (no python needed
on target system), and it works in all corner cases, drop the
python version.

Change-Id: Ida3d6c9bb46f6d826f45538e4ceaa4fc1e771ff5
Signed-off-by: Stefan Reinauer reina...@google.com
---
 util/cbmem/cbmem.py | 259 
 1 file changed, 259 deletions(-)

diff --git a/util/cbmem/cbmem.py b/util/cbmem/cbmem.py
deleted file mode 100755
index 70ccc00..000
--- a/util/cbmem/cbmem.py
+++ /dev/null
@@ -1,259 +0,0 @@
-#!/usr/bin/python
-#
-# cbmem.py - Linux space CBMEM contents parser
-#
-# Copyright (C) 2011 The ChromiumOS Authors.  All rights reserved.
-#
-# 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
-#
-# 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
-#
-'''
-Parse and display CBMEM contents.
-
-This module is meant to run on systems with coreboot based firmware.
-
-When started, it determines the amount of DRAM installed on the system, and
-then scans the top area of DRAM (right above the available memory size)
-looking for the CBMEM base signature at locations aligned at 0x2
-boundaries.
-
-Once it finds the CBMEM signature, the utility parses the contents, reporting
-the section IDs/sizes and also reporting the contents of the tiemstamp and
-console sections.
-'''
-
-import mmap
-import struct
-import sys
-
-def get_phys_mem(addr, size):
-'''Read size bytes from address addr by mmaping /dev/mem'''
-
-mf = open(/dev/mem)
-delta = addr % 4096
-mm = mmap.mmap(mf.fileno(), size + delta,
-   mmap.MAP_PRIVATE, offset=(addr - delta))
-buf = mm.read(size + delta)
-mf.close()
-return buf[delta:]
-
-# This class and metaclass make it easier to define and access structures
-# which live in physical memory. To use them, inherit from CStruct and define
-# a class member called struct_members which is a tuple of pairs. The first
-# item in the pair is the type format specifier that should be used with
-# struct.unpack to read that member from memory. The second item is the name
-# that member should have in the resulting object.
-
-class MetaCStruct(type):
-def __init__(cls, name, bases, dct):
-struct_members = dct[struct_members]
-cls.struct_fmt = 
-for char, name in struct_members:
-cls.struct_fmt += char
-cls.struct_len = struct.calcsize(cls.struct_fmt)
-super(MetaCStruct, cls).__init__(name, bases, dct)
-
-class CStruct(object):
-__metaclass__ = MetaCStruct
-struct_members = ()
-
-def __init__(self, addr):
-self.raw_memory = get_phys_mem(addr, self.struct_len)
-values = struct.unpack(self.struct_fmt, self.raw_memory)
-names = (name for char, name in self.struct_members)
-for name, value in zip(names, values):
-setattr(self, name, value)
-
-def normalize_timer(value, freq):
-'''Convert timer reading into microseconds.
-
-Get the free running clock counter value, divide it by the clock frequency
-and multiply by 1 million to get reading in microseconds.
-
-Then convert the value into an ASCII string with groups of three digits
-separated by commas.
-
-Inputs:
-  value: int, the clock reading
-  freq: float, the clock frequency
-
-Returns:
-  A string presenting 'value' in microseconds.
-'''
-
-result = []
-value = int(value * 100.0 / freq)
-svalue = '%d' % value
-vlength = len(svalue)
-remainder = vlength % 3
-if remainder:
-result.append(svalue[0:remainder])
-while remainder  vlength:
-result.append(svalue[remainder:remainder+3])
-remainder = remainder + 3
-return ','.join(result)
-
-def get_cpu_freq():
-'''Retrieve CPU frequency from sysfs.
-
-Use /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq as the source.
-'''
-freq_str = 

[coreboot] Patch set updated for coreboot: d64a48e cbmem utility: drop obsolete python based implementation

2013-01-07 Thread stefan.reina...@coreboot.org
Stefan Reinauer (stefan.reina...@coreboot.org) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2115

-gerrit

commit d64a48e7cb188200d124b11f53d47681489f91b8
Author: Stefan Reinauer stefan.reina...@coreboot.org
Date:   Mon Jan 7 13:39:43 2013 -0800

cbmem utility: drop obsolete python based implementation

The first version of the cbmem utility was written in python,
but it had issues with 64bit systems and other little hick ups.
Since the C version has much fewer dependencies (no python needed
on target system), and it works in all corner cases, drop the
python version.

Change-Id: Ida3d6c9bb46f6d826f45538e4ceaa4fc1e771ff5
Signed-off-by: Stefan Reinauer reina...@google.com
---
 util/cbmem/cbmem.py | 259 
 1 file changed, 259 deletions(-)

diff --git a/util/cbmem/cbmem.py b/util/cbmem/cbmem.py
deleted file mode 100755
index 70ccc00..000
--- a/util/cbmem/cbmem.py
+++ /dev/null
@@ -1,259 +0,0 @@
-#!/usr/bin/python
-#
-# cbmem.py - Linux space CBMEM contents parser
-#
-# Copyright (C) 2011 The ChromiumOS Authors.  All rights reserved.
-#
-# 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
-#
-# 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
-#
-'''
-Parse and display CBMEM contents.
-
-This module is meant to run on systems with coreboot based firmware.
-
-When started, it determines the amount of DRAM installed on the system, and
-then scans the top area of DRAM (right above the available memory size)
-looking for the CBMEM base signature at locations aligned at 0x2
-boundaries.
-
-Once it finds the CBMEM signature, the utility parses the contents, reporting
-the section IDs/sizes and also reporting the contents of the tiemstamp and
-console sections.
-'''
-
-import mmap
-import struct
-import sys
-
-def get_phys_mem(addr, size):
-'''Read size bytes from address addr by mmaping /dev/mem'''
-
-mf = open(/dev/mem)
-delta = addr % 4096
-mm = mmap.mmap(mf.fileno(), size + delta,
-   mmap.MAP_PRIVATE, offset=(addr - delta))
-buf = mm.read(size + delta)
-mf.close()
-return buf[delta:]
-
-# This class and metaclass make it easier to define and access structures
-# which live in physical memory. To use them, inherit from CStruct and define
-# a class member called struct_members which is a tuple of pairs. The first
-# item in the pair is the type format specifier that should be used with
-# struct.unpack to read that member from memory. The second item is the name
-# that member should have in the resulting object.
-
-class MetaCStruct(type):
-def __init__(cls, name, bases, dct):
-struct_members = dct[struct_members]
-cls.struct_fmt = 
-for char, name in struct_members:
-cls.struct_fmt += char
-cls.struct_len = struct.calcsize(cls.struct_fmt)
-super(MetaCStruct, cls).__init__(name, bases, dct)
-
-class CStruct(object):
-__metaclass__ = MetaCStruct
-struct_members = ()
-
-def __init__(self, addr):
-self.raw_memory = get_phys_mem(addr, self.struct_len)
-values = struct.unpack(self.struct_fmt, self.raw_memory)
-names = (name for char, name in self.struct_members)
-for name, value in zip(names, values):
-setattr(self, name, value)
-
-def normalize_timer(value, freq):
-'''Convert timer reading into microseconds.
-
-Get the free running clock counter value, divide it by the clock frequency
-and multiply by 1 million to get reading in microseconds.
-
-Then convert the value into an ASCII string with groups of three digits
-separated by commas.
-
-Inputs:
-  value: int, the clock reading
-  freq: float, the clock frequency
-
-Returns:
-  A string presenting 'value' in microseconds.
-'''
-
-result = []
-value = int(value * 100.0 / freq)
-svalue = '%d' % value
-vlength = len(svalue)
-remainder = vlength % 3
-if remainder:
-result.append(svalue[0:remainder])
-while remainder  vlength:
-result.append(svalue[remainder:remainder+3])
-remainder = remainder + 3
-return ','.join(result)
-
-def get_cpu_freq():
-'''Retrieve CPU frequency from sysfs.
-
-Use /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq as the source.
-'''
-freq_str = 

[coreboot] Patch merged into coreboot/master: 1665bb3 cbmem utility: drop obsolete python based implementation

2013-01-07 Thread gerrit
the following patch was just integrated into master:
commit 1665bb3896e49f84a28e24176734f447f3a0899b
Author: Stefan Reinauer stefan.reina...@coreboot.org
Date:   Mon Jan 7 13:39:43 2013 -0800

cbmem utility: drop obsolete python based implementation

The first version of the cbmem utility was written in python,
but it had issues with 64bit systems and other little hick ups.
Since the C version has much fewer dependencies (no python needed
on target system), and it works in all corner cases, drop the
python version.

Change-Id: Ida3d6c9bb46f6d826f45538e4ceaa4fc1e771ff5
Signed-off-by: Stefan Reinauer reina...@google.com
Reviewed-on: http://review.coreboot.org/2115
Reviewed-by: Vadim Bendebury vben...@chromium.org
Tested-by: build bot (Jenkins)

Build-Tested: build bot (Jenkins) at Mon Jan  7 23:53:31 2013, giving +1
See http://review.coreboot.org/2115 for details.

-gerrit

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] Patch set updated for coreboot: 8112407 cbmem utility: Add option to dump cbmem console

2013-01-07 Thread stefan.reina...@coreboot.org
Stefan Reinauer (stefan.reina...@coreboot.org) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2114

-gerrit

commit 81124070b8cac3a33411e4f0809976fa7f213f57
Author: Stefan Reinauer stefan.reina...@coreboot.org
Date:   Mon Jan 7 13:37:12 2013 -0800

cbmem utility: Add option to dump cbmem console

This adds an option to the cbmem utility to dump the cbmem console.
To keep the utility backwards compatible, specifying -c disables
printing of time stamps. To print both console and time stamps, run
the utility with -ct

Change-Id: Idd2dbf32c3c44f857c2f41e6c817c5ab13155d6f
Signed-off-by: Stefan Reinauer reina...@google.com
---
 util/cbmem/cbmem.c | 59 +++---
 1 file changed, 56 insertions(+), 3 deletions(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index df00684..bcbc9ce 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -283,6 +283,41 @@ static void dump_timestamps(void)
unmap_memory();
 }
 
+/* dump the cbmem console */
+static void dump_console(void)
+{
+   void *console_p;
+   char *console_c;
+   uint32_t size;
+
+   if (console.tag != LB_TAG_CBMEM_CONSOLE) {
+   fprintf(stderr, No console found in coreboot table.\n);
+   return;
+   }
+
+   console_p = map_memory((unsigned long)console.cbmem_addr);
+   /* The in-memory format of the console area is:
+*  u32  size
+*  u32  cursor
+*  char console[size]
+* Hence we have to add 8 to get to the actual console string.
+*/
+   size = *(uint32_t *)console_p;
+   console_c = malloc(size + 1);
+   if (!console_c) {
+   fprintf(stderr, Not enough memory for console.\n);
+   exit(1);
+   }
+
+   memcpy(console_c, console_p + 8, size);
+   console_c[size] = 0;
+
+   printf(%s, console_c);
+
+   unmap_memory();
+}
+
+
 void print_version(void)
 {
printf(cbmem v%s -- , CBMEM_VERSION);
@@ -303,6 +338,9 @@ void print_usage(const char *name)
 {
printf(usage: %s [-vh?]\n, name);
printf(\n
+   -c | --console:   print cbmem console\n
+   -t | --timestamps:print timestamp 
information\n
+   -V | --verbose:   verbose (debugging) output\n
-v | --version:   print the version\n
-h | --help:  print this help\n
 \n);
@@ -314,18 +352,30 @@ int main(int argc, char** argv)
int j;
static const int possible_base_addresses[] = { 0, 0xf };
 
-   int print_timestamps = 1;
+   int print_defaults = 1;
+   int print_console = 0;
+   int print_timestamps = 0;
 
int opt, option_index = 0;
static struct option long_options[] = {
+   {console, 0, 0, 'c'},
+   {timestamps, 0, 0, 't'},
{verbose, 0, 0, 'V'},
{version, 0, 0, 'v'},
{help, 0, 0, 'h'},
{0, 0, 0, 0}
};
-   while ((opt = getopt_long(argc, argv, Vvh?,
+   while ((opt = getopt_long(argc, argv, ctVvh?,
  long_options, option_index)) != EOF) {
switch (opt) {
+   case 'c':
+   print_console = 1;
+   print_defaults = 0;
+   break;
+   case 't':
+   print_timestamps = 1;
+   print_defaults = 0;
+   break;
case 'V':
verbose = 1;
break;
@@ -355,7 +405,10 @@ int main(int argc, char** argv)
break;
}
 
-   if (print_timestamps)
+   if (print_console)
+   dump_console();
+
+   if (print_defaults || print_timestamps)
dump_timestamps();
 
close(fd);

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] Patch set updated for coreboot: bd7fa41 cbmem utility: Add option to dump cbmem console

2013-01-07 Thread stefan.reina...@coreboot.org
Stefan Reinauer (stefan.reina...@coreboot.org) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2114

-gerrit

commit bd7fa41828941d78e4edfacb13a4132d731552ce
Author: Stefan Reinauer stefan.reina...@coreboot.org
Date:   Mon Jan 7 13:37:12 2013 -0800

cbmem utility: Add option to dump cbmem console

This adds an option to the cbmem utility to dump the cbmem console.
To keep the utility backwards compatible, specifying -c disables
printing of time stamps. To print both console and time stamps, run
the utility with -ct

Change-Id: Idd2dbf32c3c44f857c2f41e6c817c5ab13155d6f
Signed-off-by: Stefan Reinauer reina...@google.com
---
 util/cbmem/cbmem.c | 61 +++---
 1 file changed, 58 insertions(+), 3 deletions(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index df00684..4c0bd68 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -283,6 +283,43 @@ static void dump_timestamps(void)
unmap_memory();
 }
 
+/* dump the cbmem console */
+static void dump_console(void)
+{
+   void *console_p;
+   char *console_c;
+   uint32_t size;
+
+   if (console.tag != LB_TAG_CBMEM_CONSOLE) {
+   fprintf(stderr, No console found in coreboot table.\n);
+   return;
+   }
+
+   console_p = map_memory((unsigned long)console.cbmem_addr);
+   /* The in-memory format of the console area is:
+*  u32  size
+*  u32  cursor
+*  char console[size]
+* Hence we have to add 8 to get to the actual console string.
+*/
+   size = *(uint32_t *)console_p;
+   console_c = malloc(size + 1);
+   if (!console_c) {
+   fprintf(stderr, Not enough memory for console.\n);
+   exit(1);
+   }
+
+   memcpy(console_c, console_p + 8, size);
+   console_c[size] = 0;
+
+   printf(%s, console_c);
+
+   free(console_c);
+
+   unmap_memory();
+}
+
+
 void print_version(void)
 {
printf(cbmem v%s -- , CBMEM_VERSION);
@@ -303,6 +340,9 @@ void print_usage(const char *name)
 {
printf(usage: %s [-vh?]\n, name);
printf(\n
+   -c | --console:   print cbmem console\n
+   -t | --timestamps:print timestamp 
information\n
+   -V | --verbose:   verbose (debugging) output\n
-v | --version:   print the version\n
-h | --help:  print this help\n
 \n);
@@ -314,18 +354,30 @@ int main(int argc, char** argv)
int j;
static const int possible_base_addresses[] = { 0, 0xf };
 
-   int print_timestamps = 1;
+   int print_defaults = 1;
+   int print_console = 0;
+   int print_timestamps = 0;
 
int opt, option_index = 0;
static struct option long_options[] = {
+   {console, 0, 0, 'c'},
+   {timestamps, 0, 0, 't'},
{verbose, 0, 0, 'V'},
{version, 0, 0, 'v'},
{help, 0, 0, 'h'},
{0, 0, 0, 0}
};
-   while ((opt = getopt_long(argc, argv, Vvh?,
+   while ((opt = getopt_long(argc, argv, ctVvh?,
  long_options, option_index)) != EOF) {
switch (opt) {
+   case 'c':
+   print_console = 1;
+   print_defaults = 0;
+   break;
+   case 't':
+   print_timestamps = 1;
+   print_defaults = 0;
+   break;
case 'V':
verbose = 1;
break;
@@ -355,7 +407,10 @@ int main(int argc, char** argv)
break;
}
 
-   if (print_timestamps)
+   if (print_console)
+   dump_console();
+
+   if (print_defaults || print_timestamps)
dump_timestamps();
 
close(fd);

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] New patch to review for coreboot: d027fbc cbmem utility: unify debug output

2013-01-07 Thread stefan.reina...@coreboot.org
Stefan Reinauer (stefan.reina...@coreboot.org) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2116

-gerrit

commit d027fbc3cbf4c32d8e1dd13ab22632dd5b7dbab8
Author: Stefan Reinauer reina...@chromium.org
Date:   Mon Jan 7 15:25:37 2013 -0800

cbmem utility: unify debug output

... and indent it to make output more comprehensible.

Change-Id: If321f3233b31be14b2723175b781e5dd60dd72b6
Signed-off-by: Stefan Reinauer reina...@google.com
---
 util/cbmem/cbmem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 4c0bd68..59d0540 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -158,12 +158,12 @@ static int parse_cbtable(u64 address)
debug(  coreboot table entry 0x%02x\n, lbr_p-tag);
switch (lbr_p-tag) {
case LB_TAG_TIMESTAMPS: {
-   debug(Found timestamp table\n);
+   debug(Found timestamp table.\n);
timestamps = *(struct lb_cbmem_ref *) lbr_p;
continue;
}
case LB_TAG_CBMEM_CONSOLE: {
-   debug(Found cbmem console\n);
+   debug(Found cbmem console.\n);
console = *(struct lb_cbmem_ref *) lbr_p;
continue;
}
@@ -174,6 +174,7 @@ static int parse_cbtable(u64 address)
 */
struct lb_forward lbf_p =
*(struct lb_forward *) lbr_p;
+   debug(Found forwarding entry.\n);
unmap_memory();
return parse_cbtable(lbf_p.forward);
}

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] Patch merged into coreboot/master: 19f8756 cbmem utility: Add option to dump cbmem console

2013-01-07 Thread gerrit
the following patch was just integrated into master:
commit 19f8756f0008cf74a472177642cc44f00c05934f
Author: Stefan Reinauer stefan.reina...@coreboot.org
Date:   Mon Jan 7 13:37:12 2013 -0800

cbmem utility: Add option to dump cbmem console

This adds an option to the cbmem utility to dump the cbmem console.
To keep the utility backwards compatible, specifying -c disables
printing of time stamps. To print both console and time stamps, run
the utility with -ct

Change-Id: Idd2dbf32c3c44f857c2f41e6c817c5ab13155d6f
Signed-off-by: Stefan Reinauer reina...@google.com
Reviewed-on: http://review.coreboot.org/2114
Tested-by: build bot (Jenkins)
Reviewed-by: Vadim Bendebury vben...@chromium.org

Build-Tested: build bot (Jenkins) at Tue Jan  8 00:35:41 2013, giving +1
See http://review.coreboot.org/2114 for details.

-gerrit

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] New patch to review for coreboot: da023a4 cbmem utility: Find actual CBMEM area

2013-01-07 Thread stefan.reina...@coreboot.org
Stefan Reinauer (stefan.reina...@coreboot.org) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2117

-gerrit

commit da023a4f3c6a5bc89b1b0590fb8a28c4c67c0dbc
Author: Stefan Reinauer stefan.reina...@coreboot.org
Date:   Mon Jan 7 16:26:10 2013 -0800

cbmem utility: Find actual CBMEM area

without the need for a coreboot table entry for each of them.

WIP. This will be used to extract code coverage data

Change-Id: I2917710fb9d00c4533d81331a362bf0c40a30353
Signed-off-by: Stefan Reinauer reina...@google.com
---
 util/cbmem/cbmem.c | 62 +-
 1 file changed, 61 insertions(+), 1 deletion(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 4c0bd68..269a29c 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -118,6 +118,7 @@ static void unmap_memory(void)
 
 static struct lb_cbmem_ref timestamps;
 static struct lb_cbmem_ref console;
+static struct lb_memory_range cbmem;
 
 static int parse_cbtable(u64 address)
 {
@@ -157,6 +158,22 @@ static int parse_cbtable(u64 address)
lbr_p = (struct lb_record*) ((char *)lbtable + j);
debug(  coreboot table entry 0x%02x\n, lbr_p-tag);
switch (lbr_p-tag) {
+   case LB_TAG_MEMORY: {
+   int i = 0;
+   debug(Found memory map.\n);
+   struct lb_memory *memory =
+   (struct lb_memory *)lbr_p;
+   while ((char *)memory-map[i]  ((char 
*)lbtable
+   + lbr_p-size)) {
+   if (memory-map[i].type == 
LB_MEM_TABLE) {
+   debug(  LB_MEM_TABLE 
found.\n);
+   /* The last one found is CBMEM 
*/
+   cbmem = memory-map[i];
+   }
+   i++;
+   }
+   continue;
+   }
case LB_TAG_TIMESTAMPS: {
debug(Found timestamp table\n);
timestamps = *(struct lb_cbmem_ref *) lbr_p;
@@ -319,6 +336,39 @@ static void dump_console(void)
unmap_memory();
 }
 
+#define CBMEM_MAGIC 0x434f5245
+#define MAX_CBMEM_ENTRIES 16
+
+struct cbmem_entry {
+   uint32_t magic;
+   uint32_t id;
+   uint64_t base;
+   uint64_t size;
+};
+
+void dump_cbmem_toc(void)
+{
+   int i;
+   uint64_t start;
+   struct cbmem_entry *entries;
+
+   if (cbmem.type != LB_MEM_TABLE) {
+   fprintf(stderr, No coreboot table area found!\n);
+   return;
+   }
+
+   start = unpack_lb64(cbmem.start);
+
+   entries = (struct cbmem_entry *)map_memory(start);
+
+   for (i=0; iMAX_CBMEM_ENTRIES; i++) {
+   if (entries[i].magic != CBMEM_MAGIC)
+   break;
+   printf(CBMEM entry %d %08x\n,
+   i, entries[i].id);
+   }
+   unmap_memory();
+}
 
 void print_version(void)
 {
@@ -341,6 +391,7 @@ void print_usage(const char *name)
printf(usage: %s [-vh?]\n, name);
printf(\n
-c | --console:   print cbmem console\n
+   -l | --list:  print cbmem table of 
contents\n
-t | --timestamps:print timestamp 
information\n
-V | --verbose:   verbose (debugging) output\n
-v | --version:   print the version\n
@@ -356,24 +407,30 @@ int main(int argc, char** argv)
 
int print_defaults = 1;
int print_console = 0;
+   int print_list = 0;
int print_timestamps = 0;
 
int opt, option_index = 0;
static struct option long_options[] = {
{console, 0, 0, 'c'},
+   {list, 0, 0, 'l'},
{timestamps, 0, 0, 't'},
{verbose, 0, 0, 'V'},
{version, 0, 0, 'v'},
{help, 0, 0, 'h'},
{0, 0, 0, 0}
};
-   while ((opt = getopt_long(argc, argv, ctVvh?,
+   while ((opt = getopt_long(argc, argv, cltVvh?,
  long_options, option_index)) != EOF) {
switch (opt) {
case 'c':
print_console = 1;
print_defaults = 0;
break;
+   case 'l':
+   print_list = 1;
+   print_defaults = 0;
+   break;
case 't':
print_timestamps = 1;

[coreboot] Patch set updated for coreboot: 8fa685b cbfstool: index is replaced by strchr.

2013-01-07 Thread zheng....@amd.com
Zheng Bao (zheng@amd.com) just uploaded a new patch set to gerrit, which 
you can find at http://review.coreboot.org/2112

-gerrit

commit 8fa685b1b18b12c6c672488a76f42dfda1604917
Author: zbao fishba...@gmail.com
Date:   Tue Jan 8 10:10:16 2013 +0800

cbfstool: index is replaced by strchr.

From index(3):
CONFORMING TO 4.3BSD; marked as LEGACY in POSIX.1-2001. POSIX.1-2008
removes the specifications of index() and rindex(), recommending
strchr(3) and strrchr(3) instead.

Change-Id: I3899b9ca9196dbbf2d147a38dacd7e742a3873fe
Signed-off-by: Zheng Bao zheng@amd.com
Signed-off-by: zbao fishba...@gmail.com
---
 util/cbfstool/cbfstool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 6b52062..4202801 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -563,7 +563,7 @@ int main(int argc, char **argv)
break;
 
/* filter out illegal long options */
-   if (index(commands[i].optstring, c) == NULL) {
+   if (strchr(commands[i].optstring, c) == NULL) {
/* TODO maybe print actual long option instead 
*/
printf(%s: invalid option -- '%c'\n,
argv[0], c);

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] Patch set updated for coreboot: 887f3b9 cbfstool: index is replaced by strchr.

2013-01-07 Thread zheng....@amd.com
Zheng Bao (zheng@amd.com) just uploaded a new patch set to gerrit, which 
you can find at http://review.coreboot.org/2112

-gerrit

commit 887f3b9899c9bfb4ab8dd3ca1d5bf06815e2c212
Author: zbao fishba...@gmail.com
Date:   Tue Jan 8 10:10:16 2013 +0800

cbfstool: index is replaced by strchr.

From index(3):
CONFORMING TO 4.3BSD; marked as LEGACY in POSIX.1-2001. POSIX.1-2008
removes the specifications of index() and rindex(), recommending
strchr(3) and strrchr(3) instead.

Change-Id: I3899b9ca9196dbbf2d147a38dacd7e742a3873fe
Signed-off-by: Zheng Bao zheng@amd.com
Signed-off-by: zbao fishba...@gmail.com
---
 util/cbfstool/cbfstool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 6b52062..4202801 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -563,7 +563,7 @@ int main(int argc, char **argv)
break;
 
/* filter out illegal long options */
-   if (index(commands[i].optstring, c) == NULL) {
+   if (strchr(commands[i].optstring, c) == NULL) {
/* TODO maybe print actual long option instead 
*/
printf(%s: invalid option -- '%c'\n,
argv[0], c);

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] Patch merged into coreboot/master: 062730d cbfstool: index is replaced by strchr.

2013-01-07 Thread gerrit
the following patch was just integrated into master:
commit 062730d7cb35c8cc2cc07e15695eb62f2b647f4a
Author: zbao fishba...@gmail.com
Date:   Tue Jan 8 10:10:16 2013 +0800

cbfstool: index is replaced by strchr.

From index(3):
CONFORMING TO 4.3BSD; marked as LEGACY in POSIX.1-2001. POSIX.1-2008
removes the specifications of index() and rindex(), recommending
strchr(3) and strrchr(3) instead.

Change-Id: I3899b9ca9196dbbf2d147a38dacd7e742a3873fe
Signed-off-by: Zheng Bao zheng@amd.com
Signed-off-by: zbao fishba...@gmail.com
Reviewed-on: http://review.coreboot.org/2112
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer stefan.reina...@coreboot.org

Build-Tested: build bot (Jenkins) at Tue Jan  8 03:23:37 2013, giving +1
Reviewed-By: Stefan Reinauer stefan.reina...@coreboot.org at Tue Jan  8 
04:00:30 2013, giving +2
See http://review.coreboot.org/2112 for details.

-gerrit

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


[coreboot] Adding support for Kobian 815ep FSX mobo (82815 + 82801BA + IT8712F) - is it a good first time coreboot project?

2013-01-07 Thread Maciej Grela
Hi,

I've been watching the developments of LinuxBIOS and coreboot projects
for some time now and I wanted to get involved in coreboot because I
think it's a
cool project.

I think, that trying to make my old simple mobo to work with coreboot
would be a good first time task. All of the chips are supported as
far as I can see on the webpage but looking at the status of 82815 I
would have to port it to from v1 to v4, right? I have some embedded
experience
(microcontrollers) but no knowledge of coreboot code. Is porting
northbridge support hard?

Thanks for your answers.

-- 
Maciej Grela

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] Adding support for Kobian 815ep FSX mobo (82815 + 82801BA + IT8712F) - is it a good first time coreboot project?

2013-01-07 Thread ron minnich
The best first-time project is to take a board that is known to work
and do all the work of making it work. Sounds simple, never is.

Then move on to a new board!

thanks

ron

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot