src/console: Reformat code
Most of these changes are suggested by clang-format(13.0-54) tool on Debian testing. Change-Id: I68a288b3f7e911331e7324bf13cf9bde259a29de Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64781 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
@@ -64,6 +64,5 @@ void console_init(void)
|
|||||||
cbmem_dump_console();
|
cbmem_dump_console();
|
||||||
|
|
||||||
printk(BIOS_NOTICE, "\n\ncoreboot-%s%s %s " ENV_STRING " starting (log level: %i)...\n",
|
printk(BIOS_NOTICE, "\n\ncoreboot-%s%s %s " ENV_STRING " starting (log level: %i)...\n",
|
||||||
coreboot_version, coreboot_extra_version, coreboot_build,
|
coreboot_version, coreboot_extra_version, coreboot_build, get_log_level());
|
||||||
get_log_level());
|
|
||||||
}
|
}
|
||||||
|
@@ -19,9 +19,8 @@
|
|||||||
#define SPECIAL 32 /* 0x */
|
#define SPECIAL 32 /* 0x */
|
||||||
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
||||||
|
|
||||||
static int number(void (*tx_byte)(unsigned char byte, void *data),
|
static int number(void (*tx_byte)(unsigned char byte, void *data), unsigned long long inum,
|
||||||
unsigned long long inum, int base, int size, int precision, int type,
|
int base, int size, int precision, int type, void *data)
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
char c, sign, tmp[66];
|
char c, sign, tmp[66];
|
||||||
const char *digits = "0123456789abcdef";
|
const char *digits = "0123456789abcdef";
|
||||||
@@ -68,7 +67,7 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
|
|||||||
precision = i;
|
precision = i;
|
||||||
}
|
}
|
||||||
size -= precision;
|
size -= precision;
|
||||||
if (!(type&(ZEROPAD+LEFT))) {
|
if (!(type & (ZEROPAD + LEFT))) {
|
||||||
while (size-- > 0)
|
while (size-- > 0)
|
||||||
call_tx(' '), count++;
|
call_tx(' '), count++;
|
||||||
}
|
}
|
||||||
@@ -99,8 +98,8 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vtxprintf(void (*tx_byte)(unsigned char byte, void *data),
|
int vtxprintf(void (*tx_byte)(unsigned char byte, void *data), const char *fmt, va_list args,
|
||||||
const char *fmt, va_list args, void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
unsigned long long num;
|
unsigned long long num;
|
||||||
@@ -116,7 +115,7 @@ int vtxprintf(void (*tx_byte)(unsigned char byte, void *data),
|
|||||||
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
for (count = 0; *fmt ; ++fmt) {
|
for (count = 0; *fmt; ++fmt) {
|
||||||
if (*fmt != '%') {
|
if (*fmt != '%') {
|
||||||
call_tx(*fmt), count++;
|
call_tx(*fmt), count++;
|
||||||
continue;
|
continue;
|
||||||
@@ -125,14 +124,14 @@ int vtxprintf(void (*tx_byte)(unsigned char byte, void *data),
|
|||||||
/* process flags */
|
/* process flags */
|
||||||
flags = 0;
|
flags = 0;
|
||||||
repeat:
|
repeat:
|
||||||
++fmt; /* this also skips first '%' */
|
++fmt; /* this also skips first '%' */
|
||||||
switch (*fmt) {
|
switch (*fmt) {
|
||||||
case '-': flags |= LEFT; goto repeat;
|
case '-': flags |= LEFT; goto repeat;
|
||||||
case '+': flags |= PLUS; goto repeat;
|
case '+': flags |= PLUS; goto repeat;
|
||||||
case ' ': flags |= SPACE; goto repeat;
|
case ' ': flags |= SPACE; goto repeat;
|
||||||
case '#': flags |= SPECIAL; goto repeat;
|
case '#': flags |= SPECIAL; goto repeat;
|
||||||
case '0': flags |= ZEROPAD; goto repeat;
|
case '0': flags |= ZEROPAD; goto repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get field width */
|
/* get field width */
|
||||||
field_width = -1;
|
field_width = -1;
|
||||||
@@ -187,7 +186,7 @@ repeat:
|
|||||||
if (!(flags & LEFT))
|
if (!(flags & LEFT))
|
||||||
while (--field_width > 0)
|
while (--field_width > 0)
|
||||||
call_tx(' '), count++;
|
call_tx(' '), count++;
|
||||||
call_tx((unsigned char) va_arg(args, int)), count++;
|
call_tx((unsigned char)va_arg(args, int)), count++;
|
||||||
while (--field_width > 0)
|
while (--field_width > 0)
|
||||||
call_tx(' '), count++;
|
call_tx(' '), count++;
|
||||||
continue;
|
continue;
|
||||||
@@ -213,11 +212,10 @@ repeat:
|
|||||||
/* even on 64-bit systems, coreboot only resides in the
|
/* even on 64-bit systems, coreboot only resides in the
|
||||||
low 4GB so pad pointers to 32-bit for readability. */
|
low 4GB so pad pointers to 32-bit for readability. */
|
||||||
if (field_width == -1 && precision == -1)
|
if (field_width == -1 && precision == -1)
|
||||||
precision = 2*sizeof(uint32_t);
|
precision = 2 * sizeof(uint32_t);
|
||||||
flags |= SPECIAL;
|
flags |= SPECIAL;
|
||||||
count += number(tx_byte,
|
count += number(tx_byte, (unsigned long)va_arg(args, void *), 16,
|
||||||
(unsigned long) va_arg(args, void *), 16,
|
field_width, precision, flags, data);
|
||||||
field_width, precision, flags, data);
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
@@ -273,13 +271,13 @@ repeat:
|
|||||||
} else if (qualifier == 'j') {
|
} else if (qualifier == 'j') {
|
||||||
num = va_arg(args, uintmax_t);
|
num = va_arg(args, uintmax_t);
|
||||||
} else if (qualifier == 'h') {
|
} else if (qualifier == 'h') {
|
||||||
num = (unsigned short) va_arg(args, int);
|
num = (unsigned short)va_arg(args, int);
|
||||||
if (flags & SIGN)
|
if (flags & SIGN)
|
||||||
num = (short) num;
|
num = (short)num;
|
||||||
} else if (qualifier == 'H') {
|
} else if (qualifier == 'H') {
|
||||||
num = (unsigned char) va_arg(args, int);
|
num = (unsigned char)va_arg(args, int);
|
||||||
if (flags & SIGN)
|
if (flags & SIGN)
|
||||||
num = (signed char) num;
|
num = (signed char)num;
|
||||||
} else if (flags & SIGN) {
|
} else if (flags & SIGN) {
|
||||||
num = va_arg(args, int);
|
num = va_arg(args, int);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user