diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2011-09-29 17:27:15 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-03-29 20:14:25 +0200 |
commit | 32da8bed197c5c7efc226dd9cfc3b75bad496f05 (patch) | |
tree | 054390e68ca9f95ef166dc3965de8d247e783271 /src/include | |
parent | c34b4631282e03aba5b2c4b247ecc9a783924d0f (diff) | |
download | coreboot-32da8bed197c5c7efc226dd9cfc3b75bad496f05.tar.xz |
CBMEM CONSOLE: Add CBMEM console driver implementation.
The CBMEM console driver saves console output in a CBMEM area, which
then is made available to Linux applications for perusing.
There are some system limitations which need to be worked around
to achieve this goal:
- some console traffic is generated before DRAM is initialized,
leave alone CBMEM initialized.
- after the RAM based stage starts, a lot of traffic is generated
before CBMEM is initialized.
As a result, the console log lives in three different places -
the bottom of the cache as RAM space, the CBMEM buffer (where it
is expected to be) and a static buffer used early in the RAM
stage.
When execution starts (in the cache as RAM mode), the console
buffer is allocated at the bottom of the cache as RAM memory
address range. Once DRAM is initialized, the CBMEM structure is
initialized, and then the console buffer contents are copied from
the bottom of the cache as RAM space into the CBMEM area right
before the cache as RAM mode is disabled. The
src/lib/cbmem_console.c:cbmemc_reinit() takes care of the
copying.
At this point the cache as RAM memory is about to be disabled,
but the ROM stage is still going generating console output. To
make sure this output is not lost, cbmemc_reinit() saves the new
buffer address at a fixed location (0x600 was chosen for this),
and the actual "printing" function checks to see if the RAM is
already initialized (the stack is in RAM), and if so, gets the
console buffer pointer from this location instead of using the
cache as RAM address.
When the RAM stage starts, a static buffer is used to store the
console output, as the CBMEM buffer location is not known. Then,
when CBMEM is reinitialized, cbmemc_reinit() again takes care of
the copying.
In case the allocated buffers are not large enough, the excessive
data is dropped, and the copying routine adds some text to the
output buffer to indicate that there has been data lost and how
many characters were dropped.
Change-Id: I8c126e31db6cb2141f7f4f97c5047f39a8db44fc
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://review.coreboot.org/719
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/console/cbmem_console.h | 26 | ||||
-rw-r--r-- | src/include/console/console.h | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/include/console/cbmem_console.h b/src/include/console/cbmem_console.h new file mode 100644 index 0000000000..37ea4d8e89 --- /dev/null +++ b/src/include/console/cbmem_console.h @@ -0,0 +1,26 @@ +/* + * This file is part of the coreboot project. + * + * 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 + */ +#ifndef _CONSOLE_CBMEM_CONSOLE_H_ +#define _CONSOLE_CBMEM_CONSOLE_H_ + +void cbmemc_init(void); +void cbmemc_reinit(void); +void cbmemc_tx_byte(unsigned char data); + +#endif diff --git a/src/include/console/console.h b/src/include/console/console.h index 54c825cdac..56e202d99b 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -33,6 +33,9 @@ #if CONFIG_CONSOLE_NE2K #include <console/ne2k.h> #endif +#if CONFIG_CONSOLE_CBMEM +#include <console/cbmem_console.h> +#endif #ifndef __PRE_RAM__ void console_tx_byte(unsigned char byte); |