Provide MRC with a console printing callback function

Let memory initialization code use the coreboot romstage console. This
simplifies the code and makes sure that all output is available in
/sys/firmware/log.

The pei_data structure is modified to allow passing the console output
function pointer. Romstage console_tx_byte() is used for this purpose.

Change-Id: I722cfcb9ff0cf527c12cb6cac09d77ef17b588e0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://review.coreboot.org/1823
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin@se-eng.com>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Vadim Bendebury 2012-06-07 18:47:13 -07:00 committed by Ronald G. Minnich
parent a42e2f4daa
commit 48a4a7f244
4 changed files with 8 additions and 3 deletions

View File

@ -29,7 +29,7 @@
#include <console/ne2k.h> #include <console/ne2k.h>
#endif #endif
static void console_tx_byte(unsigned char byte) void console_tx_byte(unsigned char byte)
{ {
if (byte == '\n') if (byte == '\n')
console_tx_byte('\r'); console_tx_byte('\r');

View File

@ -38,7 +38,6 @@
#endif #endif
#ifndef __PRE_RAM__ #ifndef __PRE_RAM__
void console_tx_byte(unsigned char byte);
void console_tx_flush(void); void console_tx_flush(void);
unsigned char console_rx_byte(void); unsigned char console_rx_byte(void);
int console_tst_byte(void); int console_tst_byte(void);
@ -68,6 +67,7 @@ extern int console_loglevel;
#ifndef __ROMCC__ #ifndef __ROMCC__
void console_init(void); void console_init(void);
void console_tx_byte(unsigned char byte);
void post_code(u8 value); void post_code(u8 value);
/* this function is weak and can be overridden by a mainboard function. */ /* this function is weak and can be overridden by a mainboard function. */
void mainboard_post(u8 value); void mainboard_post(u8 value);

View File

@ -30,7 +30,8 @@
#ifndef PEI_DATA_H #ifndef PEI_DATA_H
#define PEI_DATA_H #define PEI_DATA_H
#define PEI_VERSION 1 typedef void (*tx_byte_func)(unsigned char byte);
#define PEI_VERSION 2
struct pei_data struct pei_data
{ {
uint32_t pei_version; uint32_t pei_version;
@ -93,6 +94,7 @@ struct pei_data
* spd_address for a given "DIMM". * spd_address for a given "DIMM".
*/ */
uint8_t spd_data[4][256]; uint8_t spd_data[4][256];
tx_byte_func tx_byte;
} __attribute__((packed)); } __attribute__((packed));
#endif #endif

View File

@ -241,6 +241,9 @@ void sdram_initialize(struct pei_data *pei_data)
hlt(); hlt();
} }
/* Pass console handler in pei_data */
pei_data->tx_byte = console_tx_byte;
/* Locate and call UEFI System Agent binary. */ /* Locate and call UEFI System Agent binary. */
entry = (unsigned long)cbfs_find_file("mrc.bin", 0xab); entry = (unsigned long)cbfs_find_file("mrc.bin", 0xab);
if (entry) { if (entry) {