Commit ad5acbd6 authored by Thomas Schäfer's avatar Thomas Schäfer
Browse files

kontron: common: convert messages to CONFIG_LOG



- convert messages and warnings to appropriate log calls
Signed-off-by: Thomas Schäfer's avatarThomas Schaefer <thomas.schaefer@kontron.com>
parent 29256869
......@@ -378,14 +378,15 @@ static char *emb_eep_find_mac_in_dmi_164 (emb_eep_info *vpdi, int eth_num)
return ptr;
}
#ifndef CONFIG_SPL_BUILD
static void emb_eep_default_ethaddr (void)
{
char *e_ethaddr;
e_ethaddr = env_get("ethaddr");
if (e_ethaddr == NULL) {
printf ("WARNING: ethaddr not found in environment, using default value\n");
log_warning ("WARNING: ethaddr not found in environment,"
" using default value\n");
env_set ("ethaddr", D_ETHADDR);
}
}
......@@ -400,29 +401,30 @@ static void emb_eep_import_ethaddr (emb_eep_info *vpdi, const char *eth_x_addr,
if ((v_ethaddr[2] != ':') || (v_ethaddr[5] != ':') ||
(v_ethaddr[8] != ':') || (v_ethaddr[11] != ':') ||
(v_ethaddr[14] != ':') ) {
printf ("Error in MAC Address, no import possible\n");
log_err ("Error in MAC Address, no import possible\n");
return;
}
e_ethaddr = env_get((char*)eth_x_addr);
if (v_ethaddr == NULL) {
printf ("WARNING: %s not found in embedded EEPROM\n", eth_x_addr);
log_warning ("WARNING: %s not found in embedded EEPROM\n",
eth_x_addr);
return;
}
/* Check if ethaddr already exists in Environment */
if (e_ethaddr) {
if (!strcmp(d_ethaddr, e_ethaddr)) {
printf ("Embedded EEPROM: Overwrite default %s to %s\n",
log_info ("Embedded EEPROM: Overwrite default %s to %s\n",
eth_x_addr, v_ethaddr);
env_set((char*)eth_x_addr, v_ethaddr);
return;
}
else {
if (strcmp (e_ethaddr, v_ethaddr)) {
printf ("Embedded EEPROM: Not overwriting existing %s\n",
eth_x_addr);
log_info ("Embedded EEPROM: Not overwriting"
" existing %s\n", eth_x_addr);
}
return;
}
......@@ -431,17 +433,17 @@ static void emb_eep_import_ethaddr (emb_eep_info *vpdi, const char *eth_x_addr,
debug ("Setenv %s\n", eth_x_addr);
env_set((char*)eth_x_addr, v_ethaddr);
}
#endif /* CONFIG_SPL_BUILD */
static int emb_eep_check_header (emb_eep_info *vpdi)
{
if (*(vpdi->header + 1) != '3'){
printf ("emb_eep_check_header: 0x%x instead of 3\n",
log_err ("Embedded EEPROM header: 0x%x instead of 3\n",
*(vpdi->header + 1));
return 0;
}
if (*(vpdi->header + 2) != 'P'){
printf ("emb_eep_check_header: 0x%x instead of P\n",
log_err ("Embedded EEPROM header: 0x%x instead of P\n",
*(vpdi->header + 2));
return 0;
}
......@@ -476,7 +478,7 @@ static int emb_eep_init (emb_eep_info *vpdi)
#endif
default:
printf ("Warning: EEPROM number %d not supported\n",
log_warning ("Warning: EEPROM number %d not supported\n",
vpdi->eeprom_num);
return -1;
}
......@@ -489,7 +491,7 @@ static int emb_eep_init (emb_eep_info *vpdi)
vpdi->eeprom_addrlen,
&(vpdi->i2c_dev));
if (ret) {
printf("EEPROM 0x%02x not foundon bus %d\n",
log_err("EEPROM 0x%02x not found on bus %d\n",
vpdi->eeprom_addr, vpdi->eeprom_busnum);
return -1;
}
......@@ -500,13 +502,14 @@ static int emb_eep_init (emb_eep_info *vpdi)
i2c_read_emb(vpdi, 0, (unsigned char *)&vpdi->header[0], 6);
if (!emb_eep_check_header(vpdi)) {
printf ("WARNING: Embedded EEPROM header not valid, abort\n");
log_warning ("WARNING: Embedded EEPROM header not valid,"
" abort\n");
return -1;
}
vpdi->max_size = 256 << (vpdi->header[5] & 0x7);
if ( vpdi->max_size > CONFIG_EMB_EEP_I2C_EEPROM_SIZE) {
printf ("Embedded EEPROM contents too large\n");
log_warning ("Embedded EEPROM contents too large\n");
return -1;
}
......@@ -518,7 +521,6 @@ static int emb_eep_init (emb_eep_info *vpdi)
*/
void emb_eep_init_r(int eeprom_num_serial, int eeprom_num_eth, int num_of_macs)
{
char *val;
emb_eep_info *vpdi;
vpdi = &vpdinfo;
......@@ -526,6 +528,12 @@ void emb_eep_init_r(int eeprom_num_serial, int eeprom_num_eth, int num_of_macs)
vpdi->header = &vpd_header[0];
vpdi->eeprom_num = eeprom_num_serial;
/* leave here when num_of_macs is -1 */
if (num_of_macs == -1) {
return;
}
#ifndef CONFIG_SPL_BUILD
char *val;
if (emb_eep_init (vpdi) == 0) {
/*
* Import serial number to environment
......@@ -570,6 +578,7 @@ void emb_eep_init_r(int eeprom_num_serial, int eeprom_num_eth, int num_of_macs)
emb_eep_import_ethaddr (vpdi, "eth4addr", 5, D_ETH1ADDR);
#endif
#endif
return;
}
......@@ -585,14 +594,14 @@ int emb_eep_update_bootcounter(int eeprom_num)
0,
sizeof(emb_rt_block), 0);
if (ret < 0) {
printf("Could not read SMBIOS block 161\n");
log_warning("Could not read SMBIOS block 161\n");
return ret;
}
memcpy(&bc, emb_rt_block.boot_counter, sizeof(uint64_t));
bc = be64_to_cpu(bc);
if ((bc & SIGN_64BIT) && (bc ^ -1ULL)) {
printf("WARNING: Invalid boot counter\n");
log_warning("WARNING: Invalid boot counter\n");
return 0;
}
......@@ -605,7 +614,7 @@ int emb_eep_update_bootcounter(int eeprom_num)
BLOCK_161_BOOTCOUNTER,
sizeof(uint64_t), 1);
if (ret < 0) {
printf("WARNING: Could not update boot counter\n");
log_warning("WARNING: Could not update boot counter\n");
return ret;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment