Author: hailfinger
Date: 2008-01-05 00:12:22 +0100 (Sat, 05 Jan 2008)
New Revision: 544
Modified:
LinuxBIOSv3/include/console.h
LinuxBIOSv3/lib/console.c
LinuxBIOSv3/northbridge/amd/geodelx/raminit.c
Log:
Add a banner function to lib/console.c that is SHARED so all code can
use it.
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Modified: LinuxBIOSv3/include/console.h
===================================================================
--- LinuxBIOSv3/include/console.h 2008-01-04 12:53:09 UTC (rev 543)
+++ LinuxBIOSv3/include/console.h 2008-01-04 23:12:22 UTC (rev 544)
@@ -48,5 +48,6 @@
SHARED_WITH_ATTRIBUTES(printk, int, __attribute__((format (printf, 2, 3))),
int msg_level, const char *fmt, ...);
+SHARED(banner, void, int msg_level, const char *msg);
#endif /* CONSOLE_H */
Modified: LinuxBIOSv3/lib/console.c
===================================================================
--- LinuxBIOSv3/lib/console.c 2008-01-04 12:53:09 UTC (rev 543)
+++ LinuxBIOSv3/lib/console.c 2008-01-04 23:12:22 UTC (rev 544)
@@ -46,6 +46,29 @@
return i;
}
+/**
+ * Print a nice banner so we know what step we died on.
+ *
+ * @param level The printk level (e.g. BIOS_EMERG)
+ * @param s String to put in the middle of the banner
+ */
+
+void banner(int level, const char *s)
+{
+ int i;
+ /* 10 = signs and a space. */
+ printk(level, "========== ");
+ for(i = 11; *s; i++, s++)
+ printk(level, "%c", *s);
+ /* trailing space */
+ printk(level, " ");
+ i++;
+ /* fill it up to 80 columns */
+ for(; i < 80; i++)
+ printk(level, "=");
+ printk(level, "\n");
+}
+
void console_init(void)
{
static const char console_test[] =
Modified: LinuxBIOSv3/northbridge/amd/geodelx/raminit.c
===================================================================
--- LinuxBIOSv3/northbridge/amd/geodelx/raminit.c 2008-01-04 12:53:09 UTC (rev 543)
+++ LinuxBIOSv3/northbridge/amd/geodelx/raminit.c 2008-01-04 23:12:22 UTC (rev 544)
@@ -36,19 +36,6 @@
u8 spd_read_byte(u16 device, u8 address);
/**
- * Print a nice banner so we know what step we died on.
- *
- * @param s String to put in the middle of the banner
- */
-
-void banner(char *s)
-{
- printk(BIOS_DEBUG, "===========================");
- printk(BIOS_DEBUG, s);
- printk(BIOS_DEBUG, "======================================\n");
-}
-
-/**
* Halt and Catch Fire. Print an error, then loop, sending NULLs on serial port,
* to ensure the message is visible.
*
@@ -83,14 +70,14 @@
dimm_setting = 0;
- banner("Check present");
+ banner(BIOS_DEBUG, "Check present");
/* Check that we have a DIMM. */
if (spd_read_byte(dimm, SPD_MEMORY_TYPE) == 0xFF)
return;
/* Field: Module Banks per DIMM */
/* EEPROM byte usage: (5) Number of DIMM Banks */
- banner("MODBANKS");
+ banner(BIOS_DEBUG, "MODBANKS");
spd_byte = spd_read_byte(dimm, SPD_NUM_DIMM_BANKS);
if ((MIN_MOD_BANKS > spd_byte) && (spd_byte > MAX_MOD_BANKS)) {
printk(BIOS_EMERG, "Number of module banks not compatible\n");
@@ -101,7 +88,7 @@
/* Field: Banks per SDRAM device */
/* EEPROM byte usage: (17) Number of Banks on SDRAM Device */
- banner("FIELDBANKS");
+ banner(BIOS_DEBUG, "FIELDBANKS");
spd_byte = spd_read_byte(dimm, SPD_NUM_BANKS_PER_SDRAM);
if ((MIN_DEV_BANKS > spd_byte) && (spd_byte > MAX_DEV_BANKS)) {
printk(BIOS_EMERG, "Number of device banks not compatible\n");
@@ -117,7 +104,7 @@
*; (31) Module Bank Density
*; Size = Module Density * Module Banks
*/
- banner("SPDNUMROWS");
+ banner(BIOS_DEBUG, "SPDNUMROWS");
if ((spd_read_byte(dimm, SPD_NUM_ROWS) & 0xF0)
|| (spd_read_byte(dimm, SPD_NUM_COLUMNS) & 0xF0)) {
@@ -127,7 +114,7 @@
}
/* Size = Module Density * Module Banks */
- banner("SPDBANKDENSITY");
+ banner(BIOS_DEBUG, "SPDBANKDENSITY");
dimm_size = spd_read_byte(dimm, SPD_BANK_DENSITY);
/* Align so 1 GB (bit 0) is bit 8. This is a little weird to get gcc
@@ -143,9 +130,9 @@
/* Module Density * Module Banks */
/* Shift to multiply by the number of DIMM banks. */
dimm_size <<= (dimm_setting >> CF07_UPPER_D0_MB_SHIFT) & 1;
- banner("BEFORT CTZ");
+ banner(BIOS_DEBUG, "BEFORT CTZ");
dimm_size = __builtin_ctz(dimm_size);
- banner("TEST DIMM SIZE>8");
+ banner(BIOS_DEBUG, "TEST DIMM SIZE>8");
if (dimm_size > 8) { /* 8 is 1 GB only support 1 GB per DIMM */
printk(BIOS_EMERG, "Only support up to 1 GB per DIMM\n");
post_code(ERROR_DENSITY_DIMM);
@@ -177,9 +164,9 @@
* example, #col_addr_bits = 7 (06h), it adds 3 to get 10, then does
* 2^10=1K. Get it?
*/
- banner("PAGESIZE");
+ banner(BIOS_DEBUG, "PAGESIZE");
spd_byte = num_col_addr[spd_read_byte(dimm, SPD_NUM_COLUMNS) & 0xF];
- banner("MAXCOLADDR");
+ banner(BIOS_DEBUG, "MAXCOLADDR");
if (spd_byte > MAX_COL_ADDR) {
printk(BIOS_EMERG, "DIMM page size not compatible\n");
post_code(ERROR_SET_PAGE);
@@ -193,9 +180,9 @@
/* 0 = 1k, 1 = 2k, 2 = 4k, etc. */
dimm_setting |= spd_byte << CF07_UPPER_D0_PSZ_SHIFT;
- banner("RDMSR CF07");
+ banner(BIOS_DEBUG, "RDMSR CF07");
msr = rdmsr(MC_CF07_DATA);
- banner("WRMSR CF07");
+ banner(BIOS_DEBUG, "WRMSR CF07");
if (dimm == dimm0) {
msr.hi &= 0xFFFF0000;
msr.hi |= dimm_setting;
@@ -203,7 +190,7 @@
msr.hi &= 0x0000FFFF;
msr.hi |= dimm_setting << 16;
}
- banner("ALL DONE");
+ banner(BIOS_DEBUG, "ALL DONE");
wrmsr(MC_CF07_DATA, msr);
}