summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-05-19 15:03:27 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-21 20:32:17 +0000
commitffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (patch)
tree362dd0ba205731aa07be97dd35b44b237799b23b /common
parent478361de694b1fb45abf3c38dafbbf7fd1aa5f71 (diff)
downloadchrome-ec-ffac23c0ea1bd4ff4568f5bd709a98f912b833a7.tar.gz
Add cprints() and ccprints()
Our code base contains a lot of debug messages in this pattern: CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n") The strings are taking up spaces in the EC binaries, so let's refactor this by adding cprints() and ccprints(). cprints() is just like cprintf(), except that it adds the brackets and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...) This saves us hundreds of bytes in EC binaries. BUG=chromium:374575 TEST=Build and check flash size BRANCH=None Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200490 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/acpi.c7
-rw-r--r--common/ap_hang_detect.c16
-rw-r--r--common/button.c6
-rw-r--r--common/capsense.c3
-rw-r--r--common/charge_state_v1.c36
-rw-r--r--common/charge_state_v2.c28
-rw-r--r--common/charger.c2
-rw-r--r--common/chipset.c2
-rw-r--r--common/console_output.c19
-rw-r--r--common/extpower_falco.c10
-rw-r--r--common/extpower_spring.c11
-rw-r--r--common/fan.c2
-rw-r--r--common/hooks.c10
-rw-r--r--common/host_command.c16
-rw-r--r--common/host_event_commands.c8
-rw-r--r--common/i2c.c36
-rw-r--r--common/keyboard_8042.c54
-rw-r--r--common/keyboard_mkbp.c6
-rw-r--r--common/keyboard_scan.c13
-rw-r--r--common/lb_common.c10
-rw-r--r--common/lid_angle.c2
-rw-r--r--common/lid_switch.c10
-rw-r--r--common/lightbar.c36
-rw-r--r--common/main.c5
-rw-r--r--common/motion_sense.c19
-rw-r--r--common/pmu_tps65090.c8
-rw-r--r--common/pmu_tps65090_charger.c32
-rw-r--r--common/power_button.c4
-rw-r--r--common/power_button_x86.c32
-rw-r--r--common/switch.c4
-rw-r--r--common/system.c20
-rw-r--r--common/thermal.c22
-rw-r--r--common/throttle_ap.c4
-rw-r--r--common/usb_pd_protocol.c2
-rw-r--r--common/usb_port_power_dumb.c4
-rw-r--r--common/usb_port_power_smart.c4
-rw-r--r--common/vboot_hash.c12
37 files changed, 268 insertions, 247 deletions
diff --git a/common/acpi.c b/common/acpi.c
index eed20fdbe0..88c0a8351e 100644
--- a/common/acpi.c
+++ b/common/acpi.c
@@ -14,6 +14,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LPC, outstr)
#define CPRINTF(format, args...) cprintf(CC_LPC, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_LPC, format, ## args)
static uint8_t acpi_cmd; /* Last received ACPI command */
static uint8_t acpi_addr; /* First byte of data after ACPI command */
@@ -86,7 +87,7 @@ int acpi_ap_to_ec(int is_cmd, uint8_t value, uint8_t *resultptr)
break;
#endif
default:
- CPRINTF("[%T ACPI read 0x%02x (ignored)]\n", acpi_addr);
+ CPRINTS("ACPI read 0x%02x (ignored)", acpi_addr);
break;
}
@@ -144,7 +145,7 @@ int acpi_ap_to_ec(int is_cmd, uint8_t value, uint8_t *resultptr)
break;
#endif
default:
- CPRINTF("[%T ACPI write 0x%02x = 0x%02x (ignored)]\n",
+ CPRINTS("ACPI write 0x%02x = 0x%02x (ignored)",
acpi_addr, data);
break;
}
@@ -154,7 +155,7 @@ int acpi_ap_to_ec(int is_cmd, uint8_t value, uint8_t *resultptr)
} else if (acpi_cmd == EC_CMD_ACPI_QUERY_EVENT && !acpi_data_count) {
/* Clear and return the lowest host event */
int evt_index = lpc_query_host_event_state();
- CPRINTF("[%T ACPI query = %d]\n", evt_index);
+ CPRINTS("ACPI query = %d", evt_index);
*resultptr = evt_index;
retval = 1;
#endif
diff --git a/common/ap_hang_detect.c b/common/ap_hang_detect.c
index 502dbd620c..2957365211 100644
--- a/common/ap_hang_detect.c
+++ b/common/ap_hang_detect.c
@@ -18,7 +18,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHIPSET, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
static struct ec_params_hang_detect hdparams;
@@ -36,7 +36,7 @@ static void hang_detect_deferred(void)
/* If we're rebooting the AP, stop hang detection */
if (timeout_will_reboot) {
- CPRINTF("[%T hang detect triggering warm reboot]\n");
+ CPRINTS("hang detect triggering warm reboot");
host_set_single_event(EC_HOST_EVENT_HANG_REBOOT);
chipset_reset(0);
active = 0;
@@ -44,12 +44,12 @@ static void hang_detect_deferred(void)
}
/* Otherwise, we're starting with the host event */
- CPRINTF("[%T hang detect sending host event]\n");
+ CPRINTS("hang detect sending host event");
host_set_single_event(EC_HOST_EVENT_HANG_DETECT);
/* If we're also rebooting, defer for the remaining delay */
if (hdparams.warm_reboot_timeout_msec) {
- CPRINTF("[%T hang detect continuing (for reboot)]\n");
+ CPRINTS("hang detect continuing (for reboot)");
timeout_will_reboot = 1;
hook_call_deferred(hang_detect_deferred,
(hdparams.warm_reboot_timeout_msec -
@@ -71,13 +71,13 @@ static void hang_detect_start(const char *why)
return;
if (hdparams.host_event_timeout_msec) {
- CPRINTF("[%T hang detect started on %s (for event)]\n", why);
+ CPRINTS("hang detect started on %s (for event)", why);
timeout_will_reboot = 0;
active = 1;
hook_call_deferred(hang_detect_deferred,
hdparams.host_event_timeout_msec * MSEC);
} else if (hdparams.warm_reboot_timeout_msec) {
- CPRINTF("[%T hang detect started on %s (for reboot)]\n", why);
+ CPRINTS("hang detect started on %s (for reboot)", why);
timeout_will_reboot = 1;
active = 1;
hook_call_deferred(hang_detect_deferred,
@@ -91,7 +91,7 @@ static void hang_detect_start(const char *why)
static void hang_detect_stop(const char *why)
{
if (active)
- CPRINTF("[%T hang detect stopped on %s]\n", why);
+ CPRINTS("hang detect stopped on %s", why);
active = 0;
}
@@ -183,7 +183,7 @@ static int hang_detect_host_command(struct host_cmd_handler_args *args)
/* Save new params */
hdparams = *p;
- CPRINTF("[%T hang detect flags=0x%x, event=%d ms, reboot=%d ms]\n",
+ CPRINTS("hang detect flags=0x%x, event=%d ms, reboot=%d ms",
hdparams.flags, hdparams.host_event_timeout_msec,
hdparams.warm_reboot_timeout_msec);
diff --git a/common/button.c b/common/button.c
index ea17cea88f..b3e4d2e0ef 100644
--- a/common/button.c
+++ b/common/button.c
@@ -15,7 +15,7 @@
#include "util.h"
/* Console output macro */
-#define CPRINTF(format, args...) cprintf(CC_SWITCH, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ## args)
struct button_state_t {
uint64_t debounce_time;
@@ -44,7 +44,7 @@ static void button_init(void)
{
int i;
- CPRINTF("[%T (re)initializing buttons and interrupts]\n");
+ CPRINTS("(re)initializing buttons and interrupts");
next_deferred_time = 0;
for (i = 0; i < CONFIG_BUTTON_COUNT; i++) {
state[i].debounced_pressed = raw_button_pressed(&buttons[i]);
@@ -74,7 +74,7 @@ static void button_change_deferred(void)
new_pressed = raw_button_pressed(&buttons[i]);
if (state[i].debounced_pressed != new_pressed) {
state[i].debounced_pressed = new_pressed;
- CPRINTF("[%T Button '%s' was %s]\n",
+ CPRINTS("Button '%s' was %s",
buttons[i].name, new_pressed ?
"pressed" : "released");
#ifdef HAS_TASK_KEYPROTO
diff --git a/common/capsense.c b/common/capsense.c
index e0df749933..95703931bd 100644
--- a/common/capsense.c
+++ b/common/capsense.c
@@ -13,6 +13,7 @@
/* Console output macro */
#define CPRINTF(format, args...) cprintf(CC_KEYBOARD, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_KEYBOARD, format, ## args)
#define CAPSENSE_I2C_ADDR 0x08
#define CAPSENSE_MASK_BITS 8
@@ -29,7 +30,7 @@ static int capsense_read_bitmask(void)
i2c_lock(I2C_PORT_CAPSENSE, 0);
if (rv)
- CPRINTF("[%T %s failed: error %d]\n", __func__, rv);
+ CPRINTS("%s failed: error %d", __func__, rv);
return val;
}
diff --git a/common/charge_state_v1.c b/common/charge_state_v1.c
index 3ddb513996..0bf0080de2 100644
--- a/common/charge_state_v1.c
+++ b/common/charge_state_v1.c
@@ -23,7 +23,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
/* Voltage debounce time */
#define DEBOUNCE_TIME (10 * SECOND)
@@ -109,17 +109,17 @@ static void low_battery_shutdown(struct charge_state_context *ctx)
{
if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
/* AP is off, so shut down the EC now */
- CPRINTF("[%T charge force EC hibernate due to low battery]\n");
+ CPRINTS("charge force EC hibernate due to low battery");
system_hibernate(0, 0);
} else if (!ctx->shutdown_warning_time.val) {
/* Warn AP battery level is so low we'll shut down */
- CPRINTF("[%T charge warn shutdown due to low battery]\n");
+ CPRINTS("charge warn shutdown due to low battery");
ctx->shutdown_warning_time = get_time();
host_set_single_event(EC_HOST_EVENT_BATTERY_SHUTDOWN);
} else if (get_time().val > ctx->shutdown_warning_time.val +
LOW_BATTERY_SHUTDOWN_TIMEOUT_US) {
/* Timeout waiting for AP to shut down, so kill it */
- CPRINTF("[%T charge force shutdown due to low battery]\n");
+ CPRINTS("charge force shutdown due to low battery");
chipset_force_shutdown();
}
}
@@ -443,7 +443,7 @@ static enum charge_state state_idle(struct charge_state_context *ctx)
int want_current =
charger_closest_current(batt->desired_current);
- CPRINTF("[%T Charge start %dmV %dmA]\n",
+ CPRINTS("Charge start %dmV %dmA",
batt->desired_voltage, want_current);
if (charge_request(batt->desired_voltage, want_current))
@@ -506,7 +506,7 @@ static enum charge_state state_charge(struct charge_state_context *ctx)
want_voltage = charger_closest_voltage(batt->desired_voltage);
if (want_voltage != curr->charging_voltage) {
- CPRINTF("[%T Charge voltage %dmV]\n", want_voltage);
+ CPRINTS("Charge voltage %dmV", want_voltage);
if (charge_request(want_voltage, -1))
return PWR_STATE_ERROR;
update_charger_time(ctx, now);
@@ -531,7 +531,7 @@ static enum charge_state state_charge(struct charge_state_context *ctx)
}
if (want_current != curr->charging_current) {
- CPRINTF("[%T Charge current %dmA @ %dmV]\n",
+ CPRINTS("Charge current %dmA @ %dmV",
want_current, batt->desired_voltage);
}
@@ -566,7 +566,7 @@ static enum charge_state state_discharge(struct charge_state_context *ctx)
if ((bat_temp_c >= ctx->battery->discharging_max_c ||
bat_temp_c < ctx->battery->discharging_min_c) &&
chipset_in_state(CHIPSET_STATE_ON)) {
- CPRINTF("[%T charge force shutdown due to battery temp]\n");
+ CPRINTS("charge force shutdown due to battery temp");
chipset_force_shutdown();
host_set_single_event(EC_HOST_EVENT_BATTERY_SHUTDOWN);
}
@@ -593,8 +593,8 @@ static enum charge_state state_error(struct charge_state_context *ctx)
/* Debug output */
if (ctx->curr.error != logged_error) {
- CPRINTF("[%T Charge error: flag[%08b -> %08b], ac %d, "
- " charger %s, battery %s\n",
+ CPRINTS("Charge error: flag[%08b -> %08b], ac %d, "
+ " charger %s, battery %s",
logged_error, ctx->curr.error, ctx->curr.ac,
(ctx->curr.error & F_CHARGER_MASK) ? "(err)" : "ok",
(ctx->curr.error & F_BATTERY_MASK) ? "(err)" : "ok");
@@ -618,7 +618,7 @@ static void charging_progress(struct charge_state_context *ctx)
else
battery_time_to_empty(&minutes);
- CPRINTF("[%T Battery %3d%% / %dh:%d]\n",
+ CPRINTS("Battery %3d%% / %dh:%d",
ctx->curr.batt.state_of_charge,
minutes / 60, minutes % 60);
return;
@@ -634,8 +634,8 @@ static void charging_progress(struct charge_state_context *ctx)
seconds = (int)(get_time().val -
ctx->trickle_charging_time.val) / (int)SECOND;
minutes = seconds / 60;
- CPRINTF("[%T Precharge CHG(%dmV) BATT(%dmV %dmA) "
- "%dh:%d]\n", ctx->curr.charging_voltage,
+ CPRINTS("Precharge CHG(%dmV) BATT(%dmV %dmA) "
+ "%dh:%d", ctx->curr.charging_voltage,
ctx->curr.batt.voltage, ctx->curr.batt.current,
minutes / 60, minutes % 60);
}
@@ -718,7 +718,7 @@ void charger_task(void)
if (ctx->curr.state == PWR_STATE_CHARGE &&
ctx->charge_state_updated_time.val +
CONFIG_CHARGER_TIMEOUT_HOURS * HOUR < ctx->curr.ts.val) {
- CPRINTF("[%T Charge timed out after %d hours]\n",
+ CPRINTS("Charge timed out after %d hours",
CONFIG_CHARGER_TIMEOUT_HOURS);
charge_force_idle(1);
}
@@ -764,7 +764,7 @@ void charger_task(void)
new_state = state_error(ctx);
break;
default:
- CPRINTF("[%T Charge state %d undefined]\n",
+ CPRINTS("Charge state %d undefined",
ctx->curr.state);
ctx->curr.state = PWR_STATE_ERROR;
new_state = PWR_STATE_ERROR;
@@ -779,7 +779,7 @@ void charger_task(void)
if (new_state) {
ctx->curr.state = new_state;
- CPRINTF("[%T Charge state %s -> %s after %.6ld sec]\n",
+ CPRINTS("Charge state %s -> %s after %.6ld sec",
state_name[ctx->prev.state],
state_name[new_state],
ctx->curr.ts.val -
@@ -942,8 +942,8 @@ static void charge_shutdown(void)
{
/* Hibernate immediately if battery level is too low */
if (charge_want_shutdown()) {
- CPRINTF("[%T charge force EC hibernate after"
- " shutdown due to low battery]\n");
+ CPRINTS("charge force EC hibernate after "
+ "shutdown due to low battery");
system_hibernate(0, 0);
}
}
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 57a05af672..4a58aae54f 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -24,7 +24,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
#define LOW_BATTERY_SHUTDOWN_TIMEOUT_US (LOW_BATTERY_SHUTDOWN_TIMEOUT * SECOND)
#define PRECHARGE_TIMEOUT_US (PRECHARGE_TIMEOUT * SECOND)
@@ -81,7 +81,7 @@ static void problem(enum problem_type p, int v)
if (last_prob_val[p] != v) {
t_now = get_time();
t_diff.val = t_now.val - last_prob_time[p].val;
- ccprintf("[%T charge problem: %s, 0x%x -> 0x%x after %.6lds]\n",
+ CPRINTS("charge problem: %s, 0x%x -> 0x%x after %.6lds",
prob_text[p], last_prob_val[p], v, t_diff.val);
last_prob_val[p] = v;
last_prob_time[p] = t_now;
@@ -268,11 +268,11 @@ static void show_charging_progress(void)
}
if (rv)
- CPRINTF("[%T Battery %d%% / ??h:?? %s]\n",
+ CPRINTS("Battery %d%% / ??h:?? %s",
curr.batt.state_of_charge,
to_full ? "to full" : "to empty");
else
- CPRINTF("[%T Battery %d%% / %dh:%d %s]\n",
+ CPRINTS("Battery %d%% / %dh:%d %s",
curr.batt.state_of_charge,
minutes / 60, minutes % 60,
to_full ? "to full" : "to empty");
@@ -301,7 +301,7 @@ static int charge_request(int voltage, int current)
voltage = current = 0;
if (prev_volt != voltage || prev_curr != current)
- CPRINTF("[%T %s(%dmV, %dmA)]\n", __func__, voltage, current);
+ CPRINTS("%s(%dmV, %dmA)", __func__, voltage, current);
if (voltage >= 0)
r1 = charger_set_voltage(voltage);
@@ -371,7 +371,7 @@ static void prevent_hot_discharge(void)
batt_temp_c = DECI_KELVIN_TO_CELSIUS(curr.batt.temperature);
if (batt_temp_c > batt_info->discharging_max_c ||
batt_temp_c < batt_info->discharging_min_c) {
- CPRINTF("[%T charge force shutdown due to battery temp %dC]\n",
+ CPRINTS("charge force shutdown due to battery temp %dC",
batt_temp_c);
chipset_force_shutdown();
host_set_single_event(EC_HOST_EVENT_BATTERY_SHUTDOWN);
@@ -395,17 +395,17 @@ static void prevent_deep_discharge(void)
if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
/* AP is off, so shut down the EC now */
- CPRINTF("[%T charge force EC hibernate due to low battery]\n");
+ CPRINTS("charge force EC hibernate due to low battery");
system_hibernate(0, 0);
} else if (!shutdown_warning_time.val) {
/* Warn AP battery level is so low we'll shut down */
- CPRINTF("[%T charge warn shutdown due to low battery]\n");
+ CPRINTS("charge warn shutdown due to low battery");
shutdown_warning_time = get_time();
host_set_single_event(EC_HOST_EVENT_BATTERY_SHUTDOWN);
} else if (get_time().val > shutdown_warning_time.val +
LOW_BATTERY_SHUTDOWN_TIMEOUT_US) {
/* Timeout waiting for AP to shut down, so kill it */
- CPRINTF("[%T charge force shutdown due to low battery]\n");
+ CPRINTS("charge force shutdown due to low battery");
chipset_force_shutdown();
}
}
@@ -490,7 +490,7 @@ void charger_task(void)
* have more urgent problems.
*/
if (curr.batt.temperature > CELSIUS_TO_DECI_KELVIN(5660)) {
- ccprintf("[%T ignoring ridiculous batt.temp of %dC]\n",
+ CPRINTS("ignoring ridiculous batt.temp of %dC",
DECI_KELVIN_TO_CELSIUS(curr.batt.temperature));
curr.batt.flags |= BATT_FLAG_BAD_TEMPERATURE;
}
@@ -549,7 +549,7 @@ void charger_task(void)
(get_time().val > precharge_start_time.val +
PRECHARGE_TIMEOUT_US)) {
/* We've tried long enough, give up */
- ccprintf("[%T battery seems to be dead]\n");
+ CPRINTS("battery seems to be dead");
battery_seems_to_be_dead = 1;
curr.state = ST_IDLE;
curr.requested_voltage = 0;
@@ -557,7 +557,7 @@ void charger_task(void)
} else {
/* See if we can wake it up */
if (curr.state != ST_PRECHARGE) {
- ccprintf("[%T try to wake battery]\n");
+ CPRINTS("try to wake battery");
precharge_start_time = get_time();
need_static = 1;
}
@@ -572,7 +572,7 @@ void charger_task(void)
/* The battery is responding. Yay. Try to use it. */
if (curr.state == ST_PRECHARGE ||
battery_seems_to_be_dead) {
- ccprintf("[%T battery woke up]\n");
+ CPRINTS("battery woke up");
/* Update the battery-specific values */
batt_info = battery_get_info();
@@ -905,7 +905,7 @@ static int charge_command_charge_state(struct host_cmd_handler_args *args)
break;
default:
- CPRINTF("[%T EC_CMD_CHARGE_STATE: bad cmd 0x%x]\n", in->cmd);
+ CPRINTS("EC_CMD_CHARGE_STATE: bad cmd 0x%x", in->cmd);
rv = EC_RES_INVALID_PARAM;
}
diff --git a/common/charger.c b/common/charger.c
index 36d81fd3d0..df66ea3b59 100644
--- a/common/charger.c
+++ b/common/charger.c
@@ -17,7 +17,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
/* DPTF current limit, -1 = none */
static int dptf_limit_ma = -1;
diff --git a/common/chipset.c b/common/chipset.c
index 708c6b226a..6c98945aad 100644
--- a/common/chipset.c
+++ b/common/chipset.c
@@ -12,7 +12,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHIPSET, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
/*****************************************************************************/
/* Console commands */
diff --git a/common/console_output.c b/common/console_output.c
index 4ff5a9c478..9722adbcb1 100644
--- a/common/console_output.c
+++ b/common/console_output.c
@@ -88,6 +88,25 @@ int cprintf(enum console_channel channel, const char *format, ...)
return rv;
}
+int cprints(enum console_channel channel, const char *format, ...)
+{
+ int r, rv;
+ va_list args;
+
+ /* Filter out inactive channels */
+ if (!(CC_MASK(channel) & channel_mask))
+ return EC_SUCCESS;
+
+ va_start(args, format);
+ rv = uart_printf("[%T ");
+ r = uart_vprintf(format, args);
+ if (r)
+ rv = r;
+ r = uart_puts("]\n");
+ va_end(args);
+ return r ? r : rv;
+}
+
void cflush(void)
{
uart_flush_output();
diff --git a/common/extpower_falco.c b/common/extpower_falco.c
index 664f2abe12..f7e0516e70 100644
--- a/common/extpower_falco.c
+++ b/common/extpower_falco.c
@@ -31,7 +31,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
/* Values for our supported adapters */
static const char * const ad_name[] = {
@@ -156,11 +156,11 @@ static void ac_change_callback(void)
{
if (extpower_is_present()) {
ac_adapter = identify_adapter();
- CPRINTF("[%T AC Adapter is %s (%dmv)]\n",
+ CPRINTS("AC Adapter is %s (%dmv)",
ad_name[ac_adapter], last_mv);
} else {
ac_adapter = ADAPTER_UNKNOWN;
- CPRINTF("[%T AC Adapter is not present]\n");
+ CPRINTS("AC Adapter is not present");
/* Charger unavailable. Clear local flags */
}
}
@@ -172,7 +172,7 @@ static void set_turbo(int on)
int tmp, r;
if (ac_turbo != on)
- CPRINTF("[%T turbo mode => %d]\n", on);
+ CPRINTS("turbo mode => %d", on);
/* Set/clear turbo mode in charger */
r = charger_get_option(&tmp);
@@ -198,7 +198,7 @@ static void set_turbo(int on)
ac_turbo = on;
return;
bad:
- CPRINTF("[%T ERROR: can't talk to charger: %d]\n", r);
+ CPRINTS("ERROR: can't talk to charger: %d", r);
}
diff --git a/common/extpower_spring.c b/common/extpower_spring.c
index 0acaca4256..63735deab5 100644
--- a/common/extpower_spring.c
+++ b/common/extpower_spring.c
@@ -35,6 +35,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_USBCHARGE, outstr)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
/* ILIM pin control */
enum ilim_config {
@@ -463,14 +464,14 @@ static void usb_detect_overcurrent(int dev_type)
}
if (power_removed_type[idx] == dev_type) {
if (oc_detect_retry[idx] > 0) {
- CPRINTF("[%T USB overcurrent: Retry (%d)]\n",
+ CPRINTS("USB overcurrent: Retry (%d)",
oc_detect_retry[idx]);
oc_detect_retry[idx]--;
return;
}
over_current_pwm_duty = power_removed_pwm_duty[idx] +
PWM_CTRL_OC_BACK_OFF;
- CPRINTF("[%T USB overcurrent: Limited to %d%%]\n",
+ CPRINTS("USB overcurrent: Limited to %d%%",
over_current_pwm_duty);
}
}
@@ -784,12 +785,12 @@ static void pwm_tweak(void)
*/
if (pwm_check_vbus_low(vbus, current)) {
set_pwm_duty_cycle(current_pwm_duty + PWM_CTRL_STEP_UP);
- CPRINTF("[%T PWM duty up %d%%]\n", current_pwm_duty);
+ CPRINTS("PWM duty up %d%%", current_pwm_duty);
} else if (pwm_check_vbus_high(vbus)) {
next = pwm_get_next_lower();
if (next >= 0) {
set_pwm_duty_cycle(next);
- CPRINTF("[%T PWM duty down %d%%]\n", current_pwm_duty);
+ CPRINTS("PWM duty down %d%%", current_pwm_duty);
}
}
}
@@ -850,7 +851,7 @@ static void usb_charger_redetect(void)
return;
if (timestamp_expired(charger_redetection_time, NULL)) {
- CPRINTF("[%T USB Redetecting]\n");
+ CPRINTS("USB Redetecting");
/*
* TSU6721 doesn't update device type if power or ID pin
* is present. Therefore, if the device type is the same,
diff --git a/common/fan.c b/common/fan.c
index a51450bbfd..faff668752 100644
--- a/common/fan.c
+++ b/common/fan.c
@@ -422,7 +422,7 @@ static void pwm_fan_second(void)
if (fan_is_stalled(fans[fan].ch)) {
mapped[fan] = EC_FAN_SPEED_STALLED;
stalled = 1;
- cprintf(CC_PWM, "[%T Fan %d stalled!]\n", fan);
+ cprints(CC_PWM, "Fan %d stalled!", fan);
} else {
mapped[fan] = fan_get_rpm_actual(fans[fan].ch);
}
diff --git a/common/hooks.c b/common/hooks.c
index b7086a866b..f95d531947 100644
--- a/common/hooks.c
+++ b/common/hooks.c
@@ -14,10 +14,10 @@
#ifdef CONFIG_HOOK_DEBUG
#define CPUTS(outstr) cputs(CC_HOOK, outstr)
-#define CPRINTF(format, args...) cprintf(CC_HOOK, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_HOOK, format, ## args)
#else
#define CPUTS(outstr)
-#define CPRINTF(format, args...)
+#define CPRINTS(format, args...)
#endif
#define DEFERRED_FUNCS_COUNT (__deferred_funcs_end - __deferred_funcs)
@@ -83,7 +83,7 @@ static void record_hook_delay(uint64_t now, uint64_t last, uint64_t interval,
/* Warn if delayed by more than 10% */
if (delayed * 10 > interval)
- CPRINTF("[%T Hook at interval %d us delayed by %d us]\n",
+ CPRINTS("Hook at interval %d us delayed by %d us",
(uint32_t)interval, (uint32_t)delayed);
}
#endif
@@ -98,7 +98,7 @@ void hook_notify(enum hook_type type)
uint64_t run_time;
#endif
- CPRINTF("[%T hook notify %d]\n", type);
+ CPRINTS("hook notify %d", type);
start = hook_list[type].start;
end = hook_list[type].end;
@@ -187,7 +187,7 @@ void hook_task(void)
/* Handle deferred routines */
for (i = 0; i < DEFERRED_FUNCS_COUNT; i++) {
if (defer_until[i] && defer_until[i] < t) {
- CPRINTF("[%T hook call deferred 0x%p]\n",
+ CPRINTS("hook call deferred 0x%p",
__deferred_funcs[i].routine);
/*
* Call deferred function. Clear timer first,
diff --git a/common/host_command.c b/common/host_command.c
index 05a1c199a6..36344ac7ec 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -19,7 +19,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_HOSTCMD, outstr)
-#define CPRINTF(format, args...) cprintf(CC_HOSTCMD, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_HOSTCMD, format, ## args)
#define TASK_EVENT_CMD_PENDING TASK_EVENT_CUSTOM(1)
@@ -99,7 +99,7 @@ test_mockable void host_send_response(struct host_cmd_handler_args *args)
* the completion of that command, so stash the result
* code.
*/
- CPRINTF("[%T HC pending done, size=%d, result=%d]\n",
+ CPRINTS("HC pending done, size=%d, result=%d",
args->response_size, args->result);
/*
@@ -121,7 +121,7 @@ test_mockable void host_send_response(struct host_cmd_handler_args *args)
} else if (args->result == EC_RES_IN_PROGRESS) {
command_pending = 1;
- CPRINTF("[HC pending]\n");
+ CPRINTS("HC pending");
}
}
#endif
@@ -362,7 +362,7 @@ static void host_command_init(void)
*host_get_memmap(EC_MEMMAP_EVENTS_VERSION) = 1;
host_set_single_event(EC_HOST_EVENT_INTERFACE_READY);
- CPRINTF("[%T hostcmd init 0x%x]\n", host_get_events());
+ CPRINTS("hostcmd init 0x%x", host_get_events());
}
void host_command_task(void)
@@ -512,10 +512,10 @@ static void host_command_debug_request(struct host_cmd_handler_args *args)
}
if (hcdebug >= HCDEBUG_PARAMS && args->params_size)
- CPRINTF("[%T HC 0x%02x.%d:%.*h]\n", args->command,
+ CPRINTS("HC 0x%02x.%d:%.*h", args->command,
args->version, args->params_size, args->params);
else
- CPRINTF("[%T HC 0x%02x]\n", args->command);
+ CPRINTS("HC 0x%02x", args->command);
}
enum ec_status host_command_process(struct host_cmd_handler_args *args)
@@ -534,10 +534,10 @@ enum ec_status host_command_process(struct host_cmd_handler_args *args)
rv = cmd->handler(args);
if (rv != EC_RES_SUCCESS)
- CPRINTF("[%T HC err %d]\n", rv);
+ CPRINTS("HC err %d", rv);
if (hcdebug >= HCDEBUG_PARAMS && args->response_size)
- CPRINTF("[%T HC resp:%.*h]\n", args->response_size,
+ CPRINTS("HC resp:%.*h", args->response_size,
args->response);
return rv;
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index 1d085b71cc..7d369b60db 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -14,7 +14,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_EVENTS, outstr)
-#define CPRINTF(format, args...) cprintf(CC_EVENTS, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_EVENTS, format, ## args)
/*
* Maintain two copies of the events that are set.
@@ -41,7 +41,7 @@ void host_set_events(uint32_t mask)
{
/* Only print if something's about to change */
if ((events & mask) != mask || (events_copy_b & mask) != mask)
- CPRINTF("[%T event set 0x%08x]\n", mask);
+ CPRINTS("event set 0x%08x", mask);
atomic_or(&events, mask);
atomic_or(&events_copy_b, mask);
@@ -57,7 +57,7 @@ void host_clear_events(uint32_t mask)
{
/* Only print if something's about to change */
if (events & mask)
- CPRINTF("[%T event clear 0x%08x]\n", mask);
+ CPRINTS("event clear 0x%08x", mask);
atomic_clear(&events, mask);
@@ -78,7 +78,7 @@ static void host_clear_events_b(uint32_t mask)
{
/* Only print if something's about to change */
if (events_copy_b & mask)
- CPRINTF("[%T event clear B 0x%08x]\n", mask);
+ CPRINTS("event clear B 0x%08x", mask);
atomic_clear(&events_copy_b, mask);
}
diff --git a/common/i2c.c b/common/i2c.c
index e90644e51a..fab2aefc67 100644
--- a/common/i2c.c
+++ b/common/i2c.c
@@ -24,7 +24,7 @@
#define UNWEDGE_SDA_ATTEMPTS 3
#define CPUTS(outstr) cputs(CC_I2C, outstr)
-#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
static struct mutex port_mutex[I2C_PORT_COUNT];
@@ -269,7 +269,7 @@ int i2c_unwedge(int port)
* If we get here, a slave is holding the clock low and there
* is nothing we can do.
*/
- CPRINTF("[%T I2C unwedge failed, SCL is being held low]\n");
+ CPRINTS("I2C unwedge failed, SCL is being held low");
ret = EC_ERROR_UNKNOWN;
goto unwedge_done;
}
@@ -277,7 +277,7 @@ int i2c_unwedge(int port)
if (i2c_raw_get_sda(port))
goto unwedge_done;
- CPRINTF("[%T I2C unwedge called with SDA held low]\n");
+ CPRINTS("I2C unwedge called with SDA held low");
/* Keep trying to unwedge the SDA line until we run out of attempts. */
for (i = 0; i < UNWEDGE_SDA_ATTEMPTS; i++) {
@@ -312,11 +312,11 @@ int i2c_unwedge(int port)
}
if (!i2c_raw_get_sda(port)) {
- CPRINTF("[%T I2C unwedge failed, SDA still low]\n");
+ CPRINTS("I2C unwedge failed, SDA still low");
ret = EC_ERROR_UNKNOWN;
}
if (!i2c_raw_get_scl(port)) {
- CPRINTF("[%T I2C unwedge failed, SCL still low]\n");
+ CPRINTS("I2C unwedge failed, SCL still low");
ret = EC_ERROR_UNKNOWN;
}
@@ -399,7 +399,7 @@ static int i2c_command_write(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_I2C_WRITE, i2c_command_write, EC_VER_MASK(0));
#ifdef CONFIG_I2C_DEBUG_PASSTHRU
-#define PTHRUPRINTF(format, args...) CPRINTF(format, ## args)
+#define PTHRUPRINTF(format, args...) CPRINTS(format, ## args)
#else
#define PTHRUPRINTF(format, args...)
#endif
@@ -419,21 +419,21 @@ static int check_i2c_params(const struct host_cmd_handler_args *args)
int msgnum;
if (args->params_size < sizeof(*params)) {
- PTHRUPRINTF("[%T i2c passthru no params, params_size=%d, "
- "need at least %d]\n",
+ PTHRUPRINTF("i2c passthru no params, params_size=%d, "
+ "need at least %d",
args->params_size, sizeof(*params));
return EC_RES_INVALID_PARAM;
}
size = sizeof(*params) + params->num_msgs * sizeof(*msg);
if (args->params_size < size) {
- PTHRUPRINTF("[%T i2c passthru params_size=%d, "
- "need at least %d]\n",
+ PTHRUPRINTF("i2c passthru params_size=%d, "
+ "need at least %d",
args->params_size, size);
return EC_RES_INVALID_PARAM;
}
if (!port_is_valid(params->port)) {
- PTHRUPRINTF("[%T i2c passthru invalid port %d]\n",
+ PTHRUPRINTF("i2c passthru invalid port %d",
params->port);
return EC_RES_INVALID_PARAM;
}
@@ -446,12 +446,12 @@ static int check_i2c_params(const struct host_cmd_handler_args *args)
/* Parse slave address if necessary */
if (addr_flags & EC_I2C_FLAG_10BIT) {
/* 10-bit addressing not supported yet */
- PTHRUPRINTF("[%T i2c passthru no 10-bit addressing]\n");
+ PTHRUPRINTF("i2c passthru no 10-bit addressing");
return EC_RES_INVALID_PARAM;
}
- PTHRUPRINTF("[%T i2c passthru port=%d, %s, addr=0x%02x, "
- "len=0x%02x]\n",
+ PTHRUPRINTF("i2c passthru port=%d, %s, addr=0x%02x, "
+ "len=0x%02x",
params->port,
addr_flags & EC_I2C_FLAG_READ ? "read" : "write",
addr_flags & EC_I2C_ADDR_MASK,
@@ -466,13 +466,13 @@ static int check_i2c_params(const struct host_cmd_handler_args *args)
/* Check there is room for the data */
if (args->response_max <
sizeof(struct ec_response_i2c_passthru) + read_len) {
- PTHRUPRINTF("[%T i2c passthru overflow1]\n");
+ PTHRUPRINTF("i2c passthru overflow1");
return EC_RES_INVALID_PARAM;
}
/* Must have bytes to write */
if (args->params_size < size + write_len) {
- PTHRUPRINTF("[%T i2c passthru overflow2]\n");
+ PTHRUPRINTF("i2c passthru overflow2");
return EC_RES_INVALID_PARAM;
}
@@ -531,8 +531,8 @@ static int i2c_command_passthru(struct host_cmd_handler_args *args)
xferflags |= I2C_XFER_STOP;
/* Transfer next message */
- PTHRUPRINTF("[%T i2c passthru xfer port=%x, addr=%x, out=%p, "
- "write_len=%x, data=%p, read_len=%x, flags=%x]\n",
+ PTHRUPRINTF("i2c passthru xfer port=%x, addr=%x, out=%p, "
+ "write_len=%x, data=%p, read_len=%x, flags=%x",
params->port, addr, out, write_len,
&resp->data[in_len], read_len, xferflags);
rv = i2c_xfer(params->port, addr, out, write_len,
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index 5460991c22..9a87f5257f 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -26,14 +26,14 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_KEYBOARD, outstr)
-#define CPRINTF(format, args...) cprintf(CC_KEYBOARD, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_KEYBOARD, format, ## args)
#ifdef CONFIG_KEYBOARD_DEBUG
#define CPUTS5(outstr) cputs(CC_KEYBOARD, outstr)
-#define CPRINTF5(format, args...) cprintf(CC_KEYBOARD, format, ## args)
+#define CPRINTS5(format, args...) cprints(CC_KEYBOARD, format, ## args)
#else
#define CPUTS5(outstr)
-#define CPRINTF5(format, args...)
+#define CPRINTS5(format, args...)
#endif
static enum {
@@ -274,7 +274,7 @@ void keyboard_host_write(int data, int is_cmd)
*/
static void keyboard_enable_irq(int enable)
{
- CPRINTF("[%T KB IRQ %s]\n", enable ? "enable" : "disable");
+ CPRINTS("KB IRQ %s", enable ? "enable" : "disable");
i8042_irq_enabled = enable;
if (enable)
@@ -399,12 +399,12 @@ static enum ec_error_list matrix_callback(int8_t row, int8_t col,
break;
default:
- CPRINTF("[%T KB scancode set %d unsupported]\n", code_set);
+ CPRINTS("KB scancode set %d unsupported", code_set);
return EC_ERROR_UNIMPLEMENTED;
}
if (!make_code) {
- CPRINTF("[%T KB scancode %d:%d missing]\n", row, col);
+ CPRINTS("KB scancode %d:%d missing", row, col);
return EC_ERROR_UNIMPLEMENTED;
}
@@ -461,7 +461,7 @@ void keyboard_state_changed(int row, int col, int is_pressed)
int32_t len;
enum ec_error_list ret;
- CPRINTF5("[%T KB (%d,%d)=%d]\n", row, col, is_pressed);
+ CPRINTS5("KB (%d,%d)=%d", row, col, is_pressed);
ret = matrix_callback(row, col, is_pressed, scancode_set, scan_code,
&len);
@@ -483,9 +483,9 @@ void keyboard_state_changed(int row, int col, int is_pressed)
static void keystroke_enable(int enable)
{
if (!keystroke_enabled && enable)
- CPRINTF("[%T KS enable]\n");
+ CPRINTS("KS enable");
else if (keystroke_enabled && !enable)
- CPRINTF("[%T KS disable]\n");
+ CPRINTS("KS disable");
keystroke_enabled = enable;
}
@@ -493,9 +493,9 @@ static void keystroke_enable(int enable)
static void keyboard_enable(int enable)
{
if (!keyboard_enabled && enable) {
- CPRINTF("[%T KB enable]\n");
+ CPRINTS("KB enable");
} else if (keyboard_enabled && !enable) {
- CPRINTF("[%T KB disable]\n");
+ CPRINTS("KB disable");
reset_rate_and_delay();
typematic_len = 0; /* stop typematic */
@@ -533,7 +533,7 @@ static void update_ctl_ram(uint8_t addr, uint8_t data)
orig = controller_ram[addr];
controller_ram[addr] = data;
- CPRINTF5("[%T KB set CTR_RAM(0x%02x)=0x%02x (old:0x%02x)]\n",
+ CPRINTS5("KB set CTR_RAM(0x%02x)=0x%02x (old:0x%02x)",
addr, data, orig);
if (addr == 0x00) {
@@ -566,63 +566,63 @@ static int handle_keyboard_data(uint8_t data, uint8_t *output)
int save_for_resend = 1;
int i;
- CPRINTF5("[%T KB recv data: 0x%02x]\n", data);
+ CPRINTS5("KB recv data: 0x%02x", data);
kblog_put('d', data);
switch (data_port_state) {
case STATE_SCANCODE:
- CPRINTF5("[%T KB eaten by STATE_SCANCODE: 0x%02x]\n", data);
+ CPRINTS5("KB eaten by STATE_SCANCODE: 0x%02x", data);
if (data == SCANCODE_GET_SET) {
output[out_len++] = I8042_RET_ACK;
output[out_len++] = scancode_set;
} else {
scancode_set = data;
- CPRINTF("[%T KB scancode set to %d]\n", scancode_set);
+ CPRINTS("KB scancode set to %d", scancode_set);
output[out_len++] = I8042_RET_ACK;
}
data_port_state = STATE_NORMAL;
break;
case STATE_SETLEDS:
- CPUTS5("[%T KB eaten by STATE_SETLEDS]\n");
+ CPRINTS5("KB eaten by STATE_SETLEDS");
output[out_len++] = I8042_RET_ACK;
data_port_state = STATE_NORMAL;
break;
case STATE_EX_SETLEDS_1:
- CPUTS5("[%T KB eaten by STATE_EX_SETLEDS_1]\n");
+ CPRINTS5("KB eaten by STATE_EX_SETLEDS_1");
output[out_len++] = I8042_RET_ACK;
data_port_state = STATE_EX_SETLEDS_2;
break;
case STATE_EX_SETLEDS_2:
- CPUTS5("[%T KB eaten by STATE_EX_SETLEDS_2]\n");
+ CPRINTS5("KB eaten by STATE_EX_SETLEDS_2");
output[out_len++] = I8042_RET_ACK;
data_port_state = STATE_NORMAL;
break;
case STATE_WRITE_CMD_BYTE:
- CPRINTF5("[%T KB eaten by STATE_WRITE_CMD_BYTE: 0x%02x]\n",
+ CPRINTS5("KB eaten by STATE_WRITE_CMD_BYTE: 0x%02x",
data);
update_ctl_ram(controller_ram_address, data);
data_port_state = STATE_NORMAL;
break;
case STATE_WRITE_OUTPUT_PORT:
- CPRINTF5("[%T KB eaten by STATE_WRITE_OUTPUT_PORT: 0x%02x]\n",
+ CPRINTS5("KB eaten by STATE_WRITE_OUTPUT_PORT: 0x%02x",
data);
A20_status = (data & (1 << 1)) ? 1 : 0;
data_port_state = STATE_NORMAL;
break;
case STATE_ECHO_MOUSE:
- CPRINTF5("[%T KB eaten by STATE_ECHO_MOUSE: 0x%02x]\n", data);
+ CPRINTS5("KB eaten by STATE_ECHO_MOUSE: 0x%02x", data);
output[out_len++] = data;
data_port_state = STATE_NORMAL;
break;
case STATE_SETREP:
- CPRINTF5("[%T KB eaten by STATE_SETREP: 0x%02x]\n", data);
+ CPRINTS5("KB eaten by STATE_SETREP: 0x%02x", data);
set_typematic_delays(data);
output[out_len++] = I8042_RET_ACK;
@@ -630,7 +630,7 @@ static int handle_keyboard_data(uint8_t data, uint8_t *output)
break;
case STATE_SEND_TO_MOUSE:
- CPRINTF5("[%T KB eaten by STATE_SEND_TO_MOUSE: 0x%02x]\n",
+ CPRINTS5("KB eaten by STATE_SEND_TO_MOUSE: 0x%02x",
data);
data_port_state = STATE_NORMAL;
break;
@@ -713,7 +713,7 @@ static int handle_keyboard_data(uint8_t data, uint8_t *output)
case I8042_CMD_EX_ENABLE:
default:
output[out_len++] = I8042_RET_NAK;
- CPRINTF("[%T KB Unsupported i8042 data 0x%02x]\n",
+ CPRINTS("KB Unsupported i8042 data 0x%02x",
data);
break;
}
@@ -741,7 +741,7 @@ static int handle_keyboard_command(uint8_t command, uint8_t *output)
{
int out_len = 0;
- CPRINTF5("[%T KB recv cmd: 0x%02x]\n", command);
+ CPRINTS5("KB recv cmd: 0x%02x", command);
kblog_put('c', command);
switch (command) {
@@ -826,7 +826,7 @@ static int handle_keyboard_command(uint8_t command, uint8_t *output)
*/
A20_status = command & (1 << 1) ? 1 : 0;
} else {
- CPRINTF("[%T KB unsupported cmd: 0x%02x]\n", command);
+ CPRINTS("KB unsupported cmd: 0x%02x", command);
reset_rate_and_delay();
keyboard_clear_buffer();
output[out_len++] = I8042_RET_NAK;
@@ -955,7 +955,7 @@ void keyboard_protocol_task(void)
* data? Send it another interrupt in case it
* somehow missed the first one.
*/
- CPRINTF("[%T KB extra IRQ]\n");
+ CPRINTS("KB extra IRQ");
lpc_keyboard_resume_irq();
retries = 0;
break;
diff --git a/common/keyboard_mkbp.c b/common/keyboard_mkbp.c
index 4b1f479d5f..7e9f6f5c45 100644
--- a/common/keyboard_mkbp.c
+++ b/common/keyboard_mkbp.c
@@ -22,7 +22,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_KEYBOARD, outstr)
-#define CPRINTF(format, args...) cprintf(CC_KEYBOARD, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_KEYBOARD, format, ## args)
/*
* Keyboard FIFO depth. This needs to be big enough not to overflow if a
@@ -111,7 +111,7 @@ void keyboard_clear_buffer(void)
{
int i;
- CPRINTF("[clearing keyboard fifo]\n");
+ CPRINTS("clearing keyboard fifo");
kb_fifo_start = 0;
kb_fifo_end = 0;
@@ -132,7 +132,7 @@ test_mockable int keyboard_fifo_add(const uint8_t *buffp)
return EC_SUCCESS;
if (kb_fifo_entries >= config.fifo_max_depth) {
- CPRINTF("[%T KB FIFO depth %d reached]\n",
+ CPRINTS("KB FIFO depth %d reached",
config.fifo_max_depth);
ret = EC_ERROR_OVERFLOW;
goto kb_fifo_push_done;
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index 9007f4dff6..4bc2391722 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -25,6 +25,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_KEYSCAN, outstr)
#define CPRINTF(format, args...) cprintf(CC_KEYSCAN, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_KEYSCAN, format, ## args)
#define SCAN_TIME_COUNT 32 /* Number of last scan times to track */
@@ -106,7 +107,7 @@ void keyboard_scan_enable(int enable, enum kb_scan_disable_masks mask)
(disable_scanning_mask | mask);
if (disable_scanning_mask != old_disable_scanning)
- CPRINTF("[%T KB disable_scanning_mask changed: 0x%08x]\n",
+ CPRINTS("KB disable_scanning_mask changed: 0x%08x",
disable_scanning_mask);
if (old_disable_scanning && !disable_scanning_mask) {
@@ -296,13 +297,13 @@ static int check_runtime_keys(const uint8_t *state)
/* Check individual keys */
if (state[KEYBOARD_COL_KEY_R] == KEYBOARD_MASK_KEY_R) {
/* R = reboot */
- CPRINTF("[%T KB warm reboot]\n");
+ CPRINTS("KB warm reboot");
keyboard_clear_buffer();
chipset_reset(0);
return 1;
} else if (state[KEYBOARD_COL_KEY_H] == KEYBOARD_MASK_KEY_H) {
/* H = hibernate */
- CPRINTF("[%T KB hibernate]\n");
+ CPRINTS("KB hibernate");
system_hibernate(0, 0);
return 1;
}
@@ -516,7 +517,7 @@ static enum boot_key check_boot_key(const uint8_t *state)
/* Check what single key is down */
for (i = 0; i < ARRAY_SIZE(boot_key_list); i++, k++) {
if (check_key(state, k->mask_index, k->mask_value)) {
- CPRINTF("[%T KB boot key %d]\n", i);
+ CPRINTS("KB boot key %d", i);
return i;
}
}
@@ -583,7 +584,7 @@ void keyboard_scan_task(void)
while (1) {
/* Enable all outputs */
- CPRINTF("[%T KB wait]\n");
+ CPRINTS("KB wait");
if (keyboard_scan_is_enabled())
keyboard_raw_drive_column(KEYBOARD_COLUMN_ALL);
keyboard_raw_enable_interrupt(1);
@@ -602,7 +603,7 @@ void keyboard_scan_task(void)
} while (!keyboard_scan_is_enabled());
/* Enter polling mode */
- CPRINTF("[%T KB poll]\n");
+ CPRINTS("KB poll");
keyboard_raw_enable_interrupt(0);
keyboard_raw_drive_column(KEYBOARD_COLUMN_NONE);
diff --git a/common/lb_common.c b/common/lb_common.c
index 1cb49cd096..289421d3bd 100644
--- a/common/lb_common.c
+++ b/common/lb_common.c
@@ -14,7 +14,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LIGHTBAR, outstr)
-#define CPRINTF(format, args...) cprintf(CC_LIGHTBAR, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_LIGHTBAR, format, ## args)
/******************************************************************************/
/* How to talk to the controller */
@@ -177,7 +177,7 @@ int lb_get_rgb(unsigned int led, uint8_t *red, uint8_t *green, uint8_t *blue)
void lb_set_brightness(unsigned int newval)
{
int i;
- CPRINTF("[%T LB_bright 0x%02x]\n", newval);
+ CPRINTS("LB_bright 0x%02x", newval);
brightness = newval;
for (i = 0; i < NUM_LEDS; i++)
setrgb(i, current[i][0], current[i][1], current[i][2]);
@@ -192,7 +192,7 @@ uint8_t lb_get_brightness(void)
/* Initialize the controller ICs after reset */
void lb_init(void)
{
- CPRINTF("[%T LB_init_vals]\n");
+ CPRINTS("LB_init_vals");
set_from_array(init_vals, ARRAY_SIZE(init_vals));
memset(current, 0, sizeof(current));
}
@@ -200,7 +200,7 @@ void lb_init(void)
/* Just go into standby mode. No register values should change. */
void lb_off(void)
{
- CPRINTF("[%T LB_off]\n");
+ CPRINTS("LB_off");
controller_write(0, 0x01, 0x00);
controller_write(1, 0x01, 0x00);
}
@@ -208,7 +208,7 @@ void lb_off(void)
/* Come out of standby mode. */
void lb_on(void)
{
- CPRINTF("[%T LB_on]\n");
+ CPRINTS("LB_on");
controller_write(0, 0x01, 0x20);
controller_write(1, 0x01, 0x20);
}
diff --git a/common/lid_angle.c b/common/lid_angle.c
index 2bee31d8c9..a55cd5d291 100644
--- a/common/lid_angle.c
+++ b/common/lid_angle.c
@@ -16,7 +16,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LIDANGLE, outstr)
-#define CPRINTF(format, args...) cprintf(CC_LIDANGLE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_LIDANGLE, format, ## args)
/*
* Define the number of previous lid angle measurements to keep for determining
diff --git a/common/lid_switch.c b/common/lid_switch.c
index 80e3dbfbaa..a676524b81 100644
--- a/common/lid_switch.c
+++ b/common/lid_switch.c
@@ -16,7 +16,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SWITCH, outstr)
-#define CPRINTF(format, args...) cprintf(CC_SWITCH, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ## args)
#define LID_DEBOUNCE_US (30 * MSEC) /* Debounce time for lid switch */
@@ -38,11 +38,11 @@ static int raw_lid_open(void)
static void lid_switch_open(void)
{
if (debounced_lid_open) {
- CPRINTF("[%T lid already open]\n");
+ CPRINTS("lid already open");
return;
}
- CPRINTF("[%T lid open]\n");
+ CPRINTS("lid open");
debounced_lid_open = 1;
hook_notify(HOOK_LID_CHANGE);
host_set_single_event(EC_HOST_EVENT_LID_OPEN);
@@ -54,11 +54,11 @@ static void lid_switch_open(void)
static void lid_switch_close(void)
{
if (!debounced_lid_open) {
- CPRINTF("[%T lid already closed]\n");
+ CPRINTS("lid already closed");
return;
}
- CPRINTF("[%T lid close]\n");
+ CPRINTS("lid close");
debounced_lid_open = 0;
hook_notify(HOOK_LID_CHANGE);
host_set_single_event(EC_HOST_EVENT_LID_CLOSED);
diff --git a/common/lightbar.c b/common/lightbar.c
index 82cc723555..8ddf76bd3e 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -35,7 +35,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LIGHTBAR, outstr)
-#define CPRINTF(format, args...) cprintf(CC_LIGHTBAR, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_LIGHTBAR, format, ## args)
/******************************************************************************/
/* Here's some state that we might want to maintain across sysjumps, just to
@@ -119,7 +119,7 @@ static void lightbar_restore_state(void)
old_state = system_get_jump_tag(LB_SYSJUMP_TAG, 0, &size);
if (old_state && size == sizeof(st)) {
memcpy(&st, old_state, size);
- CPRINTF("[%T LB state restored: %d %d - %d/%d]\n",
+ CPRINTS("LB state restored: %d %d - %d/%d",
st.cur_seq, st.prev_seq,
st.battery_is_charging, st.battery_level);
} else {
@@ -128,7 +128,7 @@ static void lightbar_restore_state(void)
st.w0 = 0;
st.ramp = 0;
memcpy(&st.p, &default_params, sizeof(st.p));
- CPRINTF("[%T LB state initialized]\n");
+ CPRINTS("LB state initialized");
}
}
@@ -214,7 +214,7 @@ void demo_battery_level(int inc)
else if (st.battery_level < 0)
st.battery_level = 0;
- CPRINTF("[%T LB demo: battery_level=%d]\n", st.battery_level);
+ CPRINTS("LB demo: battery_level=%d", st.battery_level);
}
/* Left/Right keys */
@@ -224,7 +224,7 @@ void demo_is_charging(int ischarge)
return;
st.battery_is_charging = ischarge;
- CPRINTF("[%T LB demo: battery_is_charging=%d]\n",
+ CPRINTS("LB demo: battery_is_charging=%d",
st.battery_is_charging);
}
@@ -640,13 +640,13 @@ static uint32_t sequence_STOP(void)
do {
msg = TASK_EVENT_CUSTOM(task_wait_event(-1));
- CPRINTF("[%T LB_stop got pending_msg %d]\n", pending_msg);
+ CPRINTS("LB_stop got pending_msg %d", pending_msg);
} while (msg != PENDING_MSG || pending_msg != LIGHTBAR_RUN);
/* Q: What should we do if the host shuts down? */
/* A: Nothing. We could be driving from the EC console. */
- CPRINTF("[%T LB_stop->running]\n");
+ CPRINTS("LB_stop->running");
return 0;
}
@@ -790,21 +790,21 @@ void lightbar_task(void)
{
uint32_t msg;
- CPRINTF("[%T LB task starting]\n");
+ CPRINTS("LB task starting");
lightbar_restore_state();
while (1) {
- CPRINTF("[%T LB task %d = %s]\n",
+ CPRINTS("LB task %d = %s",
st.cur_seq, lightbar_cmds[st.cur_seq].string);
msg = lightbar_cmds[st.cur_seq].sequence();
if (TASK_EVENT_CUSTOM(msg) == PENDING_MSG) {
- CPRINTF("[%T LB msg %d = %s]\n", pending_msg,
+ CPRINTS("LB msg %d = %s", pending_msg,
lightbar_cmds[pending_msg].string);
st.prev_seq = st.cur_seq;
st.cur_seq = pending_msg;
} else {
- CPRINTF("[%T LB msg 0x%x]\n", msg);
+ CPRINTS("LB msg 0x%x", msg);
switch (st.cur_seq) {
case LIGHTBAR_S5S3:
st.cur_seq = LIGHTBAR_S3;
@@ -835,14 +835,14 @@ void lightbar_task(void)
void lightbar_sequence(enum lightbar_sequence num)
{
if (num > 0 && num < LIGHTBAR_NUM_SEQUENCES) {
- CPRINTF("[%T LB_seq %d = %s]\n", num,
+ CPRINTS("LB_seq %d = %s", num,
lightbar_cmds[num].string);
pending_msg = num;
task_set_event(TASK_ID_LIGHTBAR,
TASK_EVENT_WAKE | TASK_EVENT_CUSTOM(PENDING_MSG),
0);
} else
- CPRINTF("[%T LB_seq %d - ignored]\n", num);
+ CPRINTS("LB_seq %d - ignored", num);
}
/****************************************************************************/
@@ -929,29 +929,29 @@ static int lpc_cmd_lightbar(struct host_cmd_handler_args *args)
break;
case LIGHTBAR_CMD_DEMO:
demo_mode = in->demo.num ? 1 : 0;
- CPRINTF("[%T LB_demo %d]\n", demo_mode);
+ CPRINTS("LB_demo %d", demo_mode);
break;
case LIGHTBAR_CMD_GET_DEMO:
out->get_demo.num = demo_mode;
args->response_size = sizeof(out->get_demo);
break;
case LIGHTBAR_CMD_GET_PARAMS:
- CPRINTF("[%T LB_get_params]\n");
+ CPRINTS("LB_get_params");
memcpy(&out->get_params, &st.p, sizeof(st.p));
args->response_size = sizeof(out->get_params);
break;
case LIGHTBAR_CMD_SET_PARAMS:
- CPRINTF("[%T LB_set_params]\n");
+ CPRINTS("LB_set_params");
memcpy(&st.p, &in->set_params, sizeof(st.p));
break;
case LIGHTBAR_CMD_VERSION:
- CPRINTF("[%T LB_version]\n");
+ CPRINTS("LB_version");
out->version.num = LIGHTBAR_IMPLEMENTATION_VERSION;
out->version.flags = LIGHTBAR_IMPLEMENTATION_FLAGS;
args->response_size = sizeof(out->version);
break;
default:
- CPRINTF("[%T LB bad cmd 0x%x]\n", in->cmd);
+ CPRINTS("LB bad cmd 0x%x", in->cmd);
return EC_RES_INVALID_PARAM;
}
diff --git a/common/main.c b/common/main.c
index 12d9f9ec5b..e60a57f6bc 100644
--- a/common/main.c
+++ b/common/main.c
@@ -30,6 +30,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
test_mockable int main(void)
{
@@ -100,7 +101,7 @@ test_mockable int main(void)
uart_init();
if (system_jumped_to_this_image()) {
- CPRINTF("[%T UART initialized after sysjump]\n");
+ CPRINTS("UART initialized after sysjump");
} else {
CPUTS("\n\n--- UART initialized after reboot ---\n");
CPUTS("[Reset cause: ");
@@ -144,7 +145,7 @@ test_mockable int main(void)
* into account the time before timer_init(), but it'll at least catch
* the majority of the time.
*/
- CPRINTF("[%T Inits done]\n");
+ CPRINTS("Inits done");
/* Launch task scheduling (never returns) */
return task_start();
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 90ed1ecd6d..3564c06d4e 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -19,7 +19,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_MOTION_SENSE, outstr)
-#define CPRINTF(format, args...) cprintf(CC_MOTION_SENSE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ## args)
/* Minimum time in between running motion sense task loop. */
#define MIN_MOTION_SENSE_WAIT_TIME (1 * MSEC)
@@ -204,8 +204,7 @@ void motion_sense_task(void)
/* If accelerometers do not initialize, then end task. */
if (ret != EC_SUCCESS) {
- CPRINTF("[%T, Accelerometers failed to initialize. Stopping "
- "motion sense task.\n");
+ CPRINTS("Accel init failed; stopping MS");
return;
}
@@ -289,8 +288,8 @@ void motion_sense_task(void)
#ifdef CONFIG_CMD_LID_ANGLE
if (accel_disp) {
- CPRINTF("[%T ACC base=%-5d, %-5d, %-5d lid=%-5d, "
- "%-5d, %-5d a=%-6.1d r=%d]\n",
+ CPRINTS("ACC base=%-5d, %-5d, %-5d lid=%-5d, "
+ "%-5d, %-5d a=%-6.1d r=%d",
acc_base[X], acc_base[Y], acc_base[Z],
acc_lid[X], acc_lid[Y], acc_lid[Z],
(int)(10*lid_angle_deg),
@@ -319,7 +318,7 @@ void accel_int_lid(enum gpio_signal signal)
* Print statement is here for testing with console accelint command.
* Remove print statement when interrupt is used for real.
*/
- CPRINTF("[%T Accelerometer wake-up interrupt occurred on lid]\n");
+ CPRINTS("Accelerometer wake-up interrupt occurred on lid");
}
void accel_int_base(enum gpio_signal signal)
@@ -328,7 +327,7 @@ void accel_int_base(enum gpio_signal signal)
* Print statement is here for testing with console accelint command.
* Remove print statement when interrupt is used for real.
*/
- CPRINTF("[%T Accelerometer wake-up interrupt occurred on base]\n");
+ CPRINTS("Accelerometer wake-up interrupt occurred on base");
}
/*****************************************************************************/
@@ -445,7 +444,7 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args)
if (in->sensor_odr.data != EC_MOTION_SENSE_NO_VALUE) {
if (accel_set_datarate(id, in->sensor_odr.data,
in->sensor_odr.roundup) != EC_SUCCESS) {
- CPRINTF("[%T MS bad sensor rate %d]\n",
+ CPRINTS("MS bad sensor rate %d",
in->sensor_odr.data);
return EC_RES_INVALID_PARAM;
}
@@ -467,7 +466,7 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args)
if (in->sensor_range.data != EC_MOTION_SENSE_NO_VALUE) {
if (accel_set_range(id, in->sensor_range.data,
in->sensor_range.roundup) != EC_SUCCESS) {
- CPRINTF("[%T MS bad sensor range %d]\n",
+ CPRINTS("MS bad sensor range %d",
in->sensor_range.data);
return EC_RES_INVALID_PARAM;
}
@@ -494,7 +493,7 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args)
break;
default:
- CPRINTF("[%T MS bad cmd 0x%x]\n", in->cmd);
+ CPRINTS("MS bad cmd 0x%x", in->cmd);
return EC_RES_INVALID_PARAM;
}
diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c
index 05b446eb4c..ba3407c81d 100644
--- a/common/pmu_tps65090.c
+++ b/common/pmu_tps65090.c
@@ -18,7 +18,7 @@
#include "util.h"
#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
#define TPS65090_I2C_ADDR 0x90
@@ -153,7 +153,7 @@ static int pmu_get_event(int *event)
*event = irq1 | (irq2 << 8);
if (prev_event != *event) {
- CPRINTF("[%T pmu event: %016b]\n", *event);
+ CPRINTS("pmu event: %016b", *event);
prev_event = *event;
}
@@ -684,8 +684,8 @@ static int command_pmu(int argc, char **argv)
rv = pmu_read(IRQ1_REG, &value);
if (rv)
return rv;
- CPRINTF("pmu events b%08b\n", value);
- CPRINTF("ac gpio %d\n", extpower_is_present());
+ CPRINTS("pmu events b%08b", value);
+ CPRINTS("ac gpio %d", extpower_is_present());
if (rv)
ccprintf("Failed - error %d\n", rv);
diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c
index 374371a109..d03c9d05c5 100644
--- a/common/pmu_tps65090_charger.c
+++ b/common/pmu_tps65090_charger.c
@@ -20,8 +20,7 @@
#include "timer.h"
#include "util.h"
-#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
/* Charging and discharging alarms */
#define ALARM_DISCHARGING (ALARM_TERMINATE_DISCHARGE | ALARM_OVER_TEMP)
@@ -111,7 +110,7 @@ static int battery_discharging_range(int deci_k)
static int system_off(void)
{
if (chipset_in_state(CHIPSET_STATE_ON)) {
- CPUTS("[pmu] turn system off\n");
+ CPRINTS("pmu turning system off");
chipset_force_shutdown();
}
@@ -129,7 +128,7 @@ static int notify_battery_low(void)
if (chipset_in_state(CHIPSET_STATE_ON)) {
now = get_time();
if (now.val - last_notify_time.val > MINUTE) {
- CPUTS("[pmu] notify battery low (< 4%)\n");
+ CPRINTS("pmu notify battery low (< 4%)");
last_notify_time = now;
/* TODO(crosbug.com/p/23814): Actually notify AP */
}
@@ -273,12 +272,12 @@ static int calc_next_state(int state)
* temperature out of range.
*/
if (!(batt.flags & BATT_FLAG_RESPONSIVE)) {
- CPUTS("[pmu] charging: unable to get battery "
- "temperature\n");
+ CPRINTS("pmu charging: unable to get battery "
+ "temperature");
return ST_IDLE0;
} else if (!battery_charging_range(batt.temperature)) {
- CPRINTF("[pmu] charging: temperature out of range "
- "%dC\n",
+ CPRINTS("pmu charging: temperature out of range "
+ "%dC",
DECI_KELVIN_TO_CELSIUS(batt.temperature));
return ST_CHARGING_ERROR;
}
@@ -292,7 +291,7 @@ static int calc_next_state(int state)
return ST_IDLE0;
if (alarm & ALARM_OVER_TEMP) {
- CPUTS("[pmu] charging: battery over temp\n");
+ CPRINTS("pmu charging: battery over temp");
return ST_CHARGING_ERROR;
}
@@ -306,14 +305,14 @@ static int calc_next_state(int state)
* - charger over temperature
*/
if (pmu_is_charger_alarm()) {
- CPUTS("[pmu] charging: charger alarm\n");
+ CPRINTS("pmu charging: charger alarm");
return ST_IDLE0;
}
#ifdef CONFIG_EXTPOWER_SPRING
/* Re-init on charger timeout. */
if (pmu_is_charge_timeout()) {
- CPUTS("[pmu] charging: timeout\n");
+ CPRINTS("[pmu] charging: timeout");
return ST_IDLE0;
}
#endif
@@ -359,8 +358,8 @@ static int calc_next_state(int state)
/* Check battery discharging temperature range */
if (batt.flags & BATT_FLAG_RESPONSIVE) {
if (!battery_discharging_range(batt.temperature)) {
- CPRINTF("[pmu] discharging: temperature out of"
- "range %dC\n",
+ CPRINTS("pmu discharging: temperature out of "
+ "range %dC",
DECI_KELVIN_TO_CELSIUS(
batt.temperature));
return system_off();
@@ -368,8 +367,7 @@ static int calc_next_state(int state)
}
/* Check discharging alarm */
if (!battery_status(&alarm) && (alarm & ALARM_DISCHARGING)) {
- CPRINTF("[pmu] discharging: battery alarm %016b\n",
- alarm);
+ CPRINTS("pmu discharging: battery alarm %016b", alarm);
return system_off();
}
/* Check remaining charge % */
@@ -462,7 +460,7 @@ void charger_task(void)
/* Reset state of charge moving average window */
rsoc_moving_average(-1);
- CPRINTF("[batt] state %s -> %s\n",
+ CPRINTS("batt state %s -> %s",
state_list[current_state],
state_list[next_state]);
@@ -573,6 +571,6 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, pmu_chipset_events, HOOK_PRIO_DEFAULT);
void pmu_irq_handler(enum gpio_signal signal)
{
pmu_task_throttled_wake();
- CPRINTF("[%T Charger IRQ received]\n");
+ CPRINTS("Charger IRQ received");
}
diff --git a/common/power_button.c b/common/power_button.c
index f4b2af41b1..a87fadc2ff 100644
--- a/common/power_button.c
+++ b/common/power_button.c
@@ -18,7 +18,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SWITCH, outstr)
-#define CPRINTF(format, args...) cprintf(CC_SWITCH, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ## args)
#define PWRBTN_DEBOUNCE_US (30 * MSEC) /* Debounce time for power button */
@@ -83,7 +83,7 @@ static void power_button_change_deferred(void)
debounced_power_pressed = new_pressed;
- CPRINTF("[%T power button %s]\n", new_pressed ? "pressed" : "released");
+ CPRINTS("power button %s", new_pressed ? "pressed" : "released");
/* Call hooks */
hook_notify(HOOK_POWER_BUTTON_CHANGE);
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index 954427aa5e..dc035fbb5b 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -23,7 +23,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SWITCH, outstr)
-#define CPRINTF(format, args...) cprintf(CC_SWITCH, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ## args)
/*
* x86 chipsets have a hardware timer on the power button input which causes
@@ -119,17 +119,17 @@ static void set_pwrbtn_to_pch(int high)
* system, don't press the power button.
*/
if (!high && charge_want_shutdown()) {
- CPRINTF("[%T PB PCH pwrbtn ignored due to battery level\n");
+ CPRINTS("PB PCH pwrbtn ignored due to battery level");
high = 1;
}
- CPRINTF("[%T PB PCH pwrbtn=%s]\n", high ? "HIGH" : "LOW");
+ CPRINTS("PB PCH pwrbtn=%s", high ? "HIGH" : "LOW");
gpio_set_level(GPIO_PCH_PWRBTN_L, high);
}
void power_button_pch_release(void)
{
- CPRINTF("[%T PB PCH force release]\n");
+ CPRINTS("PB PCH force release");
/* Deassert power button signal to PCH */
set_pwrbtn_to_pch(1);
@@ -146,7 +146,7 @@ void power_button_pch_release(void)
void power_button_pch_pulse(void)
{
- CPRINTF("[%T PB PCH pulse]\n");
+ CPRINTS("PB PCH pulse");
chipset_exit_hard_off();
set_pwrbtn_to_pch(0);
@@ -160,7 +160,7 @@ void power_button_pch_pulse(void)
*/
static void power_button_pressed(uint64_t tnow)
{
- CPRINTF("[%T PB pressed]\n");
+ CPRINTS("PB pressed");
pwrbtn_state = PWRBTN_STATE_PRESSED;
tnext_state = tnow;
}
@@ -170,7 +170,7 @@ static void power_button_pressed(uint64_t tnow)
*/
static void power_button_released(uint64_t tnow)
{
- CPRINTF("[%T PB released]\n");
+ CPRINTS("PB released");
pwrbtn_state = PWRBTN_STATE_RELEASED;
tnext_state = tnow;
}
@@ -189,10 +189,10 @@ static void set_initial_pwrbtn_state(void)
* simply reflect the actual power button state.
*/
if (power_button_is_pressed()) {
- CPRINTF("[%T PB init-jumped-held]\n");
+ CPRINTS("PB init-jumped-held");
set_pwrbtn_to_pch(0);
} else {
- CPRINTF("[%T PB init-jumped]\n");
+ CPRINTS("PB init-jumped");
}
} else if ((reset_flags & RESET_FLAG_AP_OFF) ||
(keyboard_scan_get_boot_key() == BOOT_KEY_DOWN_ARROW)) {
@@ -207,14 +207,14 @@ static void set_initial_pwrbtn_state(void)
* Don't let the PCH see that the power button was pressed.
* Otherwise, it might power on.
*/
- CPRINTF("[%T PB init-off]\n");
+ CPRINTS("PB init-off");
power_button_pch_release();
} else {
/*
* All other EC reset conditions power on the main processor so
* it can verify the EC.
*/
- CPRINTF("[%T PB init-on]\n");
+ CPRINTS("PB init-on");
pwrbtn_state = PWRBTN_STATE_INIT_ON;
}
}
@@ -266,7 +266,7 @@ static void state_machine(uint64_t tnow)
* again.
*/
if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
- CPRINTF("[%T PB chipset already off]\n");
+ CPRINTS("PB chipset already off");
else
set_pwrbtn_to_pch(0);
pwrbtn_state = PWRBTN_STATE_HELD;
@@ -345,7 +345,7 @@ void power_button_task(void)
t = get_time().val;
/* Update state machine */
- CPRINTF("[%T PB task %d = %s]\n", pwrbtn_state,
+ CPRINTS("PB task %d = %s", pwrbtn_state,
state_names[pwrbtn_state]);
state_machine(t);
@@ -365,7 +365,7 @@ void power_button_task(void)
* back to sleep after deciding that we woke up too
* early.)
*/
- CPRINTF("[%T PB task %d = %s, wait %d]\n", pwrbtn_state,
+ CPRINTS("PB task %d = %s, wait %d", pwrbtn_state,
state_names[pwrbtn_state], d);
task_wait_event(d);
}
@@ -402,7 +402,7 @@ static void powerbtn_x86_changed(void)
pwrbtn_state == PWRBTN_STATE_LID_OPEN ||
pwrbtn_state == PWRBTN_STATE_WAS_OFF) {
/* Ignore all power button changes during an initial pulse */
- CPRINTF("[%T PB ignoring change]\n");
+ CPRINTS("PB ignoring change");
return;
}
@@ -416,7 +416,7 @@ static void powerbtn_x86_changed(void)
* Ignore the first power button release if we already
* told the PCH the power button was released.
*/
- CPRINTF("[%T PB ignoring release]\n");
+ CPRINTS("PB ignoring release");
pwrbtn_state = PWRBTN_STATE_IDLE;
return;
}
diff --git a/common/switch.c b/common/switch.c
index 7a15fb144f..fb854f63e9 100644
--- a/common/switch.c
+++ b/common/switch.c
@@ -18,7 +18,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SWITCH, outstr)
-#define CPRINTF(format, args...) cprintf(CC_SWITCH, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ## args)
static uint8_t *memmap_switches;
@@ -61,7 +61,7 @@ static void switch_update(void)
#endif
if (prev != *memmap_switches)
- CPRINTF("[%T SW 0x%02x]\n", *memmap_switches);
+ CPRINTS("SW 0x%02x", *memmap_switches);
}
DECLARE_DEFERRED(switch_update);
DECLARE_HOOK(HOOK_LID_CHANGE, switch_update, HOOK_PRIO_DEFAULT);
diff --git a/common/system.c b/common/system.c
index 346496c087..dc761eb490 100644
--- a/common/system.c
+++ b/common/system.c
@@ -25,7 +25,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
/* Round up to a multiple of 4 */
#define ROUNDUP4(x) (((x) + 3) & ~3)
@@ -230,17 +230,17 @@ void system_disable_jump(void)
int enable_mpu = 0;
enum system_image_copy_t copy;
- CPRINTF("[%T MPU type: %08x]\n", mpu_get_type());
+ CPRINTS("MPU type: %08x", mpu_get_type());
/*
* Protect RAM from code execution
*/
ret = mpu_protect_ram();
if (ret == EC_SUCCESS) {
enable_mpu = 1;
- CPRINTF("[%T RAM locked. Exclusion %08x-%08x]\n",
+ CPRINTS("RAM locked. Exclusion %08x-%08x",
&__iram_text_start, &__iram_text_end);
} else {
- CPRINTF("[%T Failed to lock RAM (%d)]\n", ret);
+ CPRINTS("Failed to lock RAM (%d)", ret);
}
/*
@@ -262,16 +262,16 @@ void system_disable_jump(void)
}
if (ret == EC_SUCCESS) {
enable_mpu = 1;
- CPRINTF("[%T %s image locked]\n", image_names[copy]);
+ CPRINTS("%s image locked", image_names[copy]);
} else {
- CPRINTF("[%T Failed to lock %s image (%d)]\n",
+ CPRINTS("Failed to lock %s image (%d)",
image_names[copy], ret);
}
if (enable_mpu)
mpu_enable();
} else {
- CPRINTF("[%T System is unlocked. Skip MPU configuration\n");
+ CPRINTS("System is unlocked. Skip MPU configuration");
}
#endif
}
@@ -466,7 +466,7 @@ int system_run_image_copy(enum system_image_copy_t copy)
return EC_ERROR_UNKNOWN;
#endif
- CPRINTF("[%T Jumping to image %s]\n", image_names[copy]);
+ CPRINTS("Jumping to image %s", image_names[copy]);
jump_to_image(init_addr);
@@ -614,7 +614,7 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
system_disable_jump();
return EC_SUCCESS;
case EC_REBOOT_HIBERNATE:
- CPRINTF("[%T system hibernating]\n");
+ CPRINTS("system hibernating");
system_hibernate(0, 0);
/* That shouldn't return... */
return EC_ERROR_UNKNOWN;
@@ -1013,7 +1013,7 @@ int host_command_reboot(struct host_cmd_handler_args *args)
}
#endif
- CPRINTF("[%T Executing host reboot command %d]\n", p.cmd);
+ CPRINTS("Executing host reboot command %d", p.cmd);
switch (handle_pending_reboot(p.cmd)) {
case EC_SUCCESS:
return EC_RES_SUCCESS;
diff --git a/common/thermal.c b/common/thermal.c
index bbb90a5229..742430e6bb 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -23,7 +23,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTF(format, args...) cprintf(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
/*****************************************************************************/
/* DPTF temperature thresholds */
@@ -80,13 +80,13 @@ static int dpft_check_temp_threshold(int sensor_id, int temp)
cond_set_false(&dptf_threshold[sensor_id][i].over);
if (cond_went_true(&dptf_threshold[sensor_id][i].over)) {
- CPRINTF("[%T DPTF over threshold [%d][%d]\n",
+ CPRINTS("DPTF over threshold [%d][%d",
sensor_id, i);
atomic_or(&dptf_seen, (1 << sensor_id));
tripped = 1;
}
if (cond_went_false(&dptf_threshold[sensor_id][i].over)) {
- CPRINTF("[%T DPTF under threshold [%d][%d]\n",
+ CPRINTS("DPTF under threshold [%d][%d",
sensor_id, i);
atomic_or(&dptf_seen, (1 << sensor_id));
tripped = 1;
@@ -98,7 +98,7 @@ static int dpft_check_temp_threshold(int sensor_id, int temp)
void dptf_set_temp_threshold(int sensor_id, int temp, int idx, int enable)
{
- CPRINTF("[%T DPTF sensor %d, threshold %d C, index %d, %sabled]\n",
+ CPRINTS("DPTF sensor %d, threshold %d C, index %d, %sabled",
sensor_id, K_TO_C(temp), idx, enable ? "en" : "dis");
if (enable) {
@@ -117,7 +117,7 @@ void dptf_set_temp_threshold(int sensor_id, int temp, int idx, int enable)
test_mockable_static void smi_sensor_failure_warning(void)
{
- CPRINTF("[%T can't read any temp sensors!]\n");
+ CPRINTS("can't read any temp sensors!");
host_set_single_event(EC_HOST_EVENT_THERMAL);
}
@@ -224,7 +224,7 @@ static void thermal_control(void)
/* What do we do about it? (note hard-coded logic). */
if (cond_went_true(&cond_hot[EC_TEMP_THRESH_HALT])) {
- CPRINTF("[%T thermal SHUTDOWN]\n");
+ CPRINTS("thermal SHUTDOWN");
chipset_force_shutdown();
} else if (cond_went_false(&cond_hot[EC_TEMP_THRESH_HALT])) {
/* We don't reboot automatically - the user has to push
@@ -232,22 +232,22 @@ static void thermal_control(void)
* detect this sensor transition until then, but we
* do have to check in order to clear the cond_t.
*/
- CPRINTF("[%T thermal no longer shutdown]\n");
+ CPRINTS("thermal no longer shutdown");
}
if (cond_went_true(&cond_hot[EC_TEMP_THRESH_HIGH])) {
- CPRINTF("[%T thermal HIGH]\n");
+ CPRINTS("thermal HIGH");
throttle_ap(THROTTLE_ON, THROTTLE_HARD, THROTTLE_SRC_THERMAL);
} else if (cond_went_false(&cond_hot[EC_TEMP_THRESH_HIGH])) {
- CPRINTF("[%T thermal no longer high]\n");
+ CPRINTS("thermal no longer high");
throttle_ap(THROTTLE_OFF, THROTTLE_HARD, THROTTLE_SRC_THERMAL);
}
if (cond_went_true(&cond_hot[EC_TEMP_THRESH_WARN])) {
- CPRINTF("[%T thermal WARN]\n");
+ CPRINTS("thermal WARN");
throttle_ap(THROTTLE_ON, THROTTLE_SOFT, THROTTLE_SRC_THERMAL);
} else if (cond_went_false(&cond_hot[EC_TEMP_THRESH_WARN])) {
- CPRINTF("[%T thermal no longer warn]\n");
+ CPRINTS("thermal no longer warn");
throttle_ap(THROTTLE_OFF, THROTTLE_SOFT, THROTTLE_SRC_THERMAL);
}
diff --git a/common/throttle_ap.c b/common/throttle_ap.c
index 0c671842db..d794970267 100644
--- a/common/throttle_ap.c
+++ b/common/throttle_ap.c
@@ -15,7 +15,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHIPSET, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
/*****************************************************************************/
/* This enforces the virtual OR of all throttling sources. */
@@ -65,7 +65,7 @@ void throttle_ap(enum throttle_level level,
mutex_unlock(&throttle_mutex);
/* print outside the mutex */
- CPRINTF("[%T set AP throttling type %d to %s (0x%08x)]\n",
+ CPRINTS("set AP throttling type %d to %s (0x%08x)",
type, tmpval ? "on" : "off", tmpval);
}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 8addf680d2..d15f9bcc0e 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -531,7 +531,7 @@ static inline int decode_short(void *ctxt, int off, uint16_t *val16)
end = pd_dequeue_bits(ctxt, off, 20, &w);
#if 0 /* DEBUG */
- CPRINTF("%d-%d: %05x %x:%x:%x:%x\n",
+ CPRINTS("%d-%d: %05x %x:%x:%x:%x\n",
off, end, w,
dec4b5b[(w >> 15) & 0x1f], dec4b5b[(w >> 10) & 0x1f],
dec4b5b[(w >> 5) & 0x1f], dec4b5b[(w >> 0) & 0x1f]);
diff --git a/common/usb_port_power_dumb.c b/common/usb_port_power_dumb.c
index 8c4081dd6d..feea23ed0a 100644
--- a/common/usb_port_power_dumb.c
+++ b/common/usb_port_power_dumb.c
@@ -16,7 +16,7 @@
#include "util.h"
#define CPUTS(outstr) cputs(CC_USBCHARGE, outstr)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define USB_SYSJUMP_TAG 0x5550 /* "UP" - Usb Port */
#define USB_HOOK_VERSION 1
@@ -54,7 +54,7 @@ static void usb_port_all_ports_off(void)
int usb_port_set_mode(int port_id, enum usb_charge_mode mode)
{
- CPRINTF("[%T USB port p%d %d]\n", port_id, mode);
+ CPRINTS("USB port p%d %d", port_id, mode);
if (port_id < 0 || port_id >= USB_PORT_COUNT)
return EC_ERROR_INVAL;
diff --git a/common/usb_port_power_smart.c b/common/usb_port_power_smart.c
index 89f72c7339..7e6fdeee80 100644
--- a/common/usb_port_power_smart.c
+++ b/common/usb_port_power_smart.c
@@ -16,7 +16,7 @@
#include "util.h"
#define CPUTS(outstr) cputs(CC_USBCHARGE, outstr)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define USB_SYSJUMP_TAG 0x5550 /* "UP" - Usb Port */
#define USB_HOOK_VERSION 1
@@ -100,7 +100,7 @@ int usb_charge_ports_enabled(void)
int usb_charge_set_mode(int port_id, enum usb_charge_mode mode)
{
- CPRINTF("[%T USB charge p%d m%d]\n", port_id, mode);
+ CPRINTS("USB charge p%d m%d", port_id, mode);
if (port_id >= USB_CHARGE_PORT_COUNT)
return EC_ERROR_INVAL;
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index bd80fbde2d..9d51d7517d 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -18,7 +18,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_VBOOT, outstr)
-#define CPRINTF(format, args...) cprintf(CC_VBOOT, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_VBOOT, format, ## args)
struct vboot_hash_tag {
uint8_t hash[SHA256_DIGEST_SIZE];
@@ -49,7 +49,7 @@ static void vboot_hash_abort(void)
if (in_progress) {
want_abort = 1;
} else {
- CPRINTF("[%T hash abort]\n");
+ CPRINTS("hash abort");
want_abort = 0;
data_size = 0;
hash = NULL;
@@ -79,7 +79,7 @@ static void vboot_hash_next_chunk(void)
if (curr_pos >= data_size) {
/* Store the final hash */
hash = SHA256_final(&ctx);
- CPRINTF("[%T hash done %.*h]\n", SHA256_DIGEST_SIZE, hash);
+ CPRINTS("hash done %.*h", SHA256_DIGEST_SIZE, hash);
in_progress = 0;
@@ -126,7 +126,7 @@ static int vboot_hash_start(uint32_t offset, uint32_t size,
in_progress = 1;
/* Restart the hash computation */
- CPRINTF("[%T hash start 0x%08x 0x%08x]\n", offset, size);
+ CPRINTS("hash start 0x%08x 0x%08x", offset, size);
SHA256_init(&ctx);
if (nonce_size)
SHA256_update(&ctx, nonce, nonce_size);
@@ -151,7 +151,7 @@ int vboot_hash_invalidate(int offset, int size)
return 0;
/* Invalidate the hash */
- CPRINTF("[%T hash invalidated 0x%08x 0x%08x]\n", offset, size);
+ CPRINTS("hash invalidated 0x%08x 0x%08x", offset, size);
vboot_hash_abort();
return 1;
}
@@ -170,7 +170,7 @@ static void vboot_hash_init(void)
if (tag && version == VBOOT_HASH_SYSJUMP_VERSION &&
size == sizeof(*tag)) {
/* Already computed a hash, so don't recompute */
- CPRINTF("[%T hash precomputed]\n");
+ CPRINTS("hash precomputed");
hash = tag->hash;
data_offset = tag->offset;
data_size = tag->size;