console/flashsconsole: Add spi flash console for debugging
If CONSOLE_SPI_FLASH config is enabled, we write the cbmem messages to the 'CONSOLE' area in FMAP which allows us to grab the log when we read the flash. This is useful when you don't have usb debugging, and UART lines are hard to find. Since a failure to boot would require a hardware flasher anyways, we can get the log at the same time. This feature should only be used when no alternative is found and only when we can't boot the system, because excessive writes to the flash is not recommended. This has been tested on purism/librem13 v2 and librem 15 v3 which run Intel Skylake hardware. It has not been tested on other archs or with a driver other than the fast_spi. Change-Id: I74a297b94f6881d8c27cbe5168f161d8331c3df3 Signed-off-by: Youness Alaoui <youness.alaoui@puri.sm> Reviewed-on: https://review.coreboot.org/19849 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
This commit is contained in:
committed by
Martin Roth
parent
cadd7c7ed3
commit
c4b4ff3b1f
45
src/include/console/flash.h
Normal file
45
src/include/console/flash.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CONSOLE_FLASH_H
|
||||
#define CONSOLE_FLASH_H 1
|
||||
|
||||
#include <rules.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void flashconsole_init(void);
|
||||
void flashconsole_tx_byte(unsigned char c);
|
||||
void flashconsole_tx_flush(void);
|
||||
|
||||
#define __CONSOLE_FLASH_ENABLE__ IS_ENABLED(CONFIG_CONSOLE_SPI_FLASH)
|
||||
|
||||
#if __CONSOLE_FLASH_ENABLE__
|
||||
static inline void __flashconsole_init(void) { flashconsole_init(); }
|
||||
static inline void __flashconsole_tx_byte(u8 data)
|
||||
{
|
||||
flashconsole_tx_byte(data);
|
||||
}
|
||||
static inline void __flashconsole_tx_flush(void)
|
||||
{
|
||||
flashconsole_tx_flush();
|
||||
}
|
||||
#else
|
||||
static inline void __flashconsole_init(void) {}
|
||||
static inline void __flashconsole_tx_byte(u8 data) {}
|
||||
static inline void __flashconsole_tx_flush(void) {}
|
||||
#endif /* __CONSOLE_FLASH_ENABLE__ */
|
||||
|
||||
|
||||
#endif /* CONSOLE_FLASH_H */
|
Reference in New Issue
Block a user