diff options
78 files changed, 451 insertions, 417 deletions
diff --git a/board/big/battery.c b/board/big/battery.c index aa6191f2c0..4979085e96 100644 --- a/board/big/battery.c +++ b/board/big/battery.c @@ -13,7 +13,7 @@ #include "console.h" /* Console output macros */ -#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args) /* These 2 defines are for cut_off command for 3S battery */ #define SB_SHIP_MODE_ADDR 0x3a @@ -274,16 +274,16 @@ const struct battery_info *battery_get_info(void) int design_mv; if (battery_manufacturer_name(manuf, sizeof(manuf))) { - CPRINTF("[%T Failed to get MANUF name]\n"); + CPRINTS("Failed to get MANUF name"); return &info_precharge; } if (battery_device_name(device, sizeof(device))) { - CPRINTF("[%T Failed to get DEVICE name]\n"); + CPRINTS("Failed to get DEVICE name"); return &info_precharge; } if (battery_design_voltage((int *)&design_mv)) { - CPRINTF("[%T Failed to get DESIGN_VOLTAGE]\n"); + CPRINTS("Failed to get DESIGN_VOLTAGE"); return &info_precharge; } @@ -291,7 +291,7 @@ const struct battery_info *battery_get_info(void) if ((strcasecmp(support_batteries[i].manuf, manuf) == 0) && (strcasecmp(support_batteries[i].device, device) == 0) && (support_batteries[i].design_mv == design_mv)) { - CPRINTF("[%T battery Manuf:%s, Device=%s, design=%u]\n", + CPRINTS("battery Manuf:%s, Device=%s, design=%u", manuf, device, design_mv); support_cut_off = support_batteries[i].support_cut_off; battery_info = support_batteries[i].battery_info; @@ -299,7 +299,7 @@ const struct battery_info *battery_get_info(void) } } - CPRINTF("[%T un-recognized battery Manuf:%s, Device:%s]\n", + CPRINTS("un-recognized battery Manuf:%s, Device:%s", manuf, device); return &info_precharge; } diff --git a/board/firefly/usb_pd_policy.c b/board/firefly/usb_pd_policy.c index d00ac47916..0a57d34192 100644 --- a/board/firefly/usb_pd_policy.c +++ b/board/firefly/usb_pd_policy.c @@ -15,7 +15,7 @@ #include "util.h" #include "usb_pd.h" -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) /* Acceptable margin between requested VBUS and measured value */ #define MARGIN_MV 400 /* mV */ diff --git a/board/fruitpie/usb_pd_policy.c b/board/fruitpie/usb_pd_policy.c index 001dafd28f..8f1cde1c6e 100644 --- a/board/fruitpie/usb_pd_policy.c +++ b/board/fruitpie/usb_pd_policy.c @@ -13,7 +13,7 @@ #include "util.h" #include "usb_pd.h" -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) const uint32_t pd_src_pdo[] = { PDO_FIXED(5000, 500, PDO_FIXED_EXTERNAL), diff --git a/board/nyan/battery.c b/board/nyan/battery.c index 381ff09290..027062940e 100644 --- a/board/nyan/battery.c +++ b/board/nyan/battery.c @@ -13,7 +13,7 @@ #include "console.h" /* Console output macros */ -#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args) /* These 2 defines are for cut_off command for 3S battery */ #define SB_SHIP_MODE_ADDR 0x3a @@ -236,16 +236,16 @@ const struct battery_info *battery_get_info(void) int design_mv; if (battery_manufacturer_name(manuf, sizeof(manuf))) { - CPRINTF("[%T Failed to get MANUF name]\n"); + CPRINTS("Failed to get MANUF name"); return &info_precharge; } if (battery_device_name(device, sizeof(device))) { - CPRINTF("[%T Failed to get DEVICE name]\n"); + CPRINTS("Failed to get DEVICE name"); return &info_precharge; } if (battery_design_voltage((int *)&design_mv)) { - CPRINTF("[%T Failed to get DESIGN_VOLTAGE]\n"); + CPRINTS("Failed to get DESIGN_VOLTAGE"); return &info_precharge; } @@ -253,7 +253,7 @@ const struct battery_info *battery_get_info(void) if ((strcasecmp(support_batteries[i].manuf, manuf) == 0) && (strcasecmp(support_batteries[i].device, device) == 0) && (support_batteries[i].design_mv == design_mv)) { - CPRINTF("[%T battery Manuf:%s, Device=%s, design=%u]\n", + CPRINTS("battery Manuf:%s, Device=%s, design=%u", manuf, device, design_mv); support_cut_off = support_batteries[i].support_cut_off; battery_info = support_batteries[i].battery_info; @@ -261,7 +261,7 @@ const struct battery_info *battery_get_info(void) } } - CPRINTF("[%T un-recognized battery Manuf:%s, Device=%s]\n", + CPRINTS("un-recognized battery Manuf:%s, Device=%s", manuf, device); return &info_precharge; } diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c index bc06ed6222..914bd5268c 100644 --- a/board/samus/power_sequence.c +++ b/board/samus/power_sequence.c @@ -22,7 +22,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) /* Input state flags */ #define IN_PGOOD_PP1050 POWER_SIGNAL_MASK(X86_PGOOD_PP1050) @@ -63,7 +63,7 @@ static int pause_in_s5; /* Pause in S5 when shutting down? */ void chipset_force_shutdown(void) { - CPRINTF("[%T %s()]\n", __func__); + CPRINTS("%s()", __func__); /* * Force off. This condition will reset once the state machine @@ -74,7 +74,7 @@ void chipset_force_shutdown(void) void chipset_reset(int cold_reset) { - CPRINTF("[%T %s(%d)]\n", __func__, cold_reset); + CPRINTS("%s(%d)", __func__, cold_reset); if (cold_reset) { /* * Drop and restore PWROK. This causes the PCH to reboot, @@ -126,11 +126,11 @@ enum power_state power_chipset_init(void) if ((power_get_signals() & IN_ALL_S0) == IN_ALL_S0) { /* Disable idle task deep sleep when in S0. */ disable_sleep(SLEEP_MASK_AP_RUN); - CPRINTF("[%T already in S0]\n"); + CPRINTS("already in S0"); return POWER_S0; } else { /* Force all signals to their G3 states */ - CPRINTF("[%T forcing G3]\n"); + CPRINTS("forcing G3"); gpio_set_level(GPIO_PCH_PWROK, 0); gpio_set_level(GPIO_SYS_PWROK, 0); gpio_set_level(GPIO_PP1050_EN, 0); @@ -216,7 +216,7 @@ enum power_state power_handle_state(enum power_state state) * indicate that PP5000 is stable */ while ((power_get_signals() & IN_PGOOD_PP5000) != 0) { if (task_wait_event(SECOND) == TASK_EVENT_TIMER) { - CPRINTF("[%T timeout waiting for PP5000\n"); + CPRINTS("timeout waiting for PP5000"); gpio_set_level(GPIO_PP5000_EN, 0); chipset_force_shutdown(); return POWER_G3; diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c index c4c75fe63a..3d6b30250c 100644 --- a/board/samus_pd/usb_pd_policy.c +++ b/board/samus_pd/usb_pd_policy.c @@ -13,7 +13,7 @@ #include "util.h" #include "usb_pd.h" -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) /* TODO(crossbug.com/p/28869): update source and sink tables to spec. */ const uint32_t pd_src_pdo[] = { diff --git a/chip/it83xx/clock.c b/chip/it83xx/clock.c index 437cb3b4b7..4fe72245da 100644 --- a/chip/it83xx/clock.c +++ b/chip/it83xx/clock.c @@ -15,7 +15,7 @@ /* Console output macros. */ #define CPUTS(outstr) cputs(CC_CLOCK, outstr) -#define CPRINTF(format, args...) cprintf(CC_CLOCK, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CLOCK, format, ## args) static int freq; diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c index 04b86fae92..05027e0d95 100644 --- a/chip/lm4/clock.c +++ b/chip/lm4/clock.c @@ -22,7 +22,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_CLOCK, outstr) -#define CPRINTF(format, args...) cprintf(CC_CLOCK, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CLOCK, format, ## args) #define PLL_CLOCK 66666667 /* System clock = 200MHz PLL/3 = 66.667MHz */ @@ -250,7 +250,7 @@ void __idle(void) * so this only starts once all other tasks have gotten a chance to do * their task inits and have gone to sleep. */ - CPRINTF("[%T low power idle task started]\n"); + CPRINTS("low power idle task started"); while (1) { /* @@ -286,8 +286,8 @@ void __idle(void) clock_wait_cycles(1); if (LOW_SPEED_DEEP_SLEEP_ALLOWED) - CPRINTF("[%T Disabling console in " - "deep sleep]\n"); + CPRINTS("Disabling console in " + "deep sleep"); } /* @@ -361,7 +361,7 @@ void __idle(void) /* Calculate how close we were to missing deadline */ margin_us = next_delay - (int)(rtc_t1.val - rtc_t0.val); if (margin_us < 0) - CPRINTF("[%T overslept by %dus]\n", -margin_us); + CPRINTS("overslept by %dus", -margin_us); /* Record the closest to missing a deadline. */ if (margin_us < dsleep_recovery_margin_us) diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c index 57359646dc..457236cc93 100644 --- a/chip/lm4/i2c.c +++ b/chip/lm4/i2c.c @@ -17,7 +17,7 @@ #include "util.h" #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) /* Flags for writes to MCS */ #define LM4_I2C_MCS_RUN (1 << 0) @@ -186,7 +186,7 @@ int i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size, (i2c_get_line_levels(port) != I2C_LINE_IDLE))) { uint32_t tpr = LM4_I2C_MTPR(port); - CPRINTF("[%T I2C%d bad status 0x%02x, SCL=%d, SDA=%d]\n", port, + CPRINTS("I2C%d bad status 0x%02x, SCL=%d, SDA=%d", port, reg_mcs, i2c_get_line_levels(port) & I2C_LINE_SCL_HIGH, i2c_get_line_levels(port) & I2C_LINE_SDA_HIGH); @@ -352,7 +352,7 @@ static void i2c_freq_changed(void) #ifdef PRINT_I2C_SPEEDS const int f = freq / (2 * (1 + tpr) * (6 + 4)); - CPRINTF("[%T I2C%d clk=%d tpr=%d freq=%d]\n", + CPRINTS("I2C%d clk=%d tpr=%d freq=%d", i2c_ports[i].port, freq, tpr, f); #endif diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c index ef273be8b8..8f8c5434a4 100644 --- a/chip/lm4/lpc.c +++ b/chip/lm4/lpc.c @@ -52,7 +52,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) #define LPC_SYSJUMP_TAG 0x4c50 /* "LP" */ @@ -158,7 +158,7 @@ static void lpc_generate_smi(void) gpio_set_level(GPIO_PCH_SMI_L, 1); if (host_events & event_mask[LPC_HOST_EVENT_SMI]) - CPRINTF("[%T smi 0x%08x]\n", + CPRINTS("smi 0x%08x", host_events & event_mask[LPC_HOST_EVENT_SMI]); } @@ -181,7 +181,7 @@ static void lpc_generate_sci(void) #endif if (host_events & event_mask[LPC_HOST_EVENT_SCI]) - CPRINTF("[%T sci 0x%08x]\n", + CPRINTS("sci 0x%08x", host_events & event_mask[LPC_HOST_EVENT_SCI]); } @@ -622,7 +622,7 @@ void lpc_interrupt(void) LM4_LPC_ST(i) &= ~LM4_LPC_ST_FRMH; } - CPRINTF("[%T LPC RESET# %sasserted]\n", + CPRINTS("LPC RESET# %sasserted", lpc_get_pltrst_asserted() ? "" : "de"); } } diff --git a/chip/lm4/spi.c b/chip/lm4/spi.c index aa8785ed0e..f6afd7cbd8 100644 --- a/chip/lm4/spi.c +++ b/chip/lm4/spi.c @@ -16,7 +16,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_SPI, outstr) -#define CPRINTF(format, args...) cprintf(CC_SPI, format, ## args) +#define CPRINTS(format, args...) cprints(CC_SPI, format, ## args) int spi_enable(int enable) diff --git a/chip/mec1322/clock.c b/chip/mec1322/clock.c index 6111b7de86..512627b184 100644 --- a/chip/mec1322/clock.c +++ b/chip/mec1322/clock.c @@ -13,7 +13,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_CLOCK, outstr) -#define CPRINTF(format, args...) cprintf(CC_CLOCK, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CLOCK, format, ## args) static int freq = 48000000; diff --git a/chip/mec1322/i2c.c b/chip/mec1322/i2c.c index 8eaf861382..2ed2cbaedb 100644 --- a/chip/mec1322/i2c.c +++ b/chip/mec1322/i2c.c @@ -16,7 +16,7 @@ #include "util.h" #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) #define I2C_CLOCK 16000000 /* 16 MHz */ @@ -199,7 +199,7 @@ int i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size, if (!started && (((reg_sts & (STS_BER | STS_LAB)) || !(reg_sts & STS_NBB)) || (i2c_get_line_levels(port) != I2C_LINE_IDLE))) { - CPRINTF("[%T I2C%d bad status 0x%02x, SCL=%d, SDA=%d]\n", port, + CPRINTS("I2C%d bad status 0x%02x, SCL=%d, SDA=%d", port, reg_sts, i2c_get_line_levels(port) & I2C_LINE_SCL_HIGH, i2c_get_line_levels(port) & I2C_LINE_SDA_HIGH); diff --git a/chip/stm32/clock-stm32l.c b/chip/stm32/clock-stm32l.c index 2f1b0f655a..502a8187c3 100644 --- a/chip/stm32/clock-stm32l.c +++ b/chip/stm32/clock-stm32l.c @@ -228,7 +228,7 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds) for (i = GPIO_KB_OUT00; i < GPIO_KB_OUT00 + KEYBOARD_COLS; i++) gpio_set_flags(i, GPIO_INPUT); - ccprintf("[%T fake hibernate. waits for power button/lid/RTC/AC]\n"); + ccprints("fake hibernate. waits for power button/lid/RTC/AC"); cflush(); if (seconds || microseconds) { @@ -241,7 +241,7 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds) task_wait_event(-1); } - ccprintf("[%T fake RTC alarm fires. resets EC]\n"); + ccprints("fake RTC alarm fires. resets EC"); cflush(); system_reset(SYSTEM_RESET_HARD); } @@ -249,7 +249,7 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds) static void fake_hibernate_power_button_hook(void) { if (fake_hibernate && lid_is_open() && !power_button_is_pressed()) { - ccprintf("[%T %s() resets EC]\n", __func__); + ccprints("%s() resets EC", __func__); cflush(); system_reset(SYSTEM_RESET_HARD); } @@ -260,7 +260,7 @@ DECLARE_HOOK(HOOK_POWER_BUTTON_CHANGE, fake_hibernate_power_button_hook, static void fake_hibernate_lid_hook(void) { if (fake_hibernate && lid_is_open()) { - ccprintf("[%T %s() resets EC]\n", __func__); + ccprints("%s() resets EC", __func__); cflush(); system_reset(SYSTEM_RESET_HARD); } @@ -270,7 +270,7 @@ DECLARE_HOOK(HOOK_LID_CHANGE, fake_hibernate_lid_hook, HOOK_PRIO_DEFAULT); static void fake_hibernate_ac_hook(void) { if (fake_hibernate && extpower_is_present()) { - ccprintf("[%T %s() resets EC]\n", __func__); + ccprints("%s() resets EC", __func__); cflush(); system_reset(SYSTEM_RESET_HARD); } diff --git a/chip/stm32/dma.c b/chip/stm32/dma.c index e648b7418e..735ffbd326 100644 --- a/chip/stm32/dma.c +++ b/chip/stm32/dma.c @@ -14,7 +14,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_DMA, outstr) -#define CPRINTF(format, args...) cprintf(CC_DMA, format, ## args) +#define CPRINTS(format, args...) cprints(CC_DMA, format, ## args) /* Task IDs for the interrupt handlers to wake up */ static task_id_t id[STM32_DMAC_COUNT]; diff --git a/chip/stm32/gpio-stm32f.c b/chip/stm32/gpio-stm32f.c index 564ffbb56f..8b6344fdad 100644 --- a/chip/stm32/gpio-stm32f.c +++ b/chip/stm32/gpio-stm32f.c @@ -15,7 +15,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_GPIO, outstr) -#define CPRINTF(format, args...) cprintf(CC_GPIO, format, ## args) +#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args) /* * Special precautions must be taken in order to avoid accidentally rebooting @@ -209,7 +209,7 @@ int gpio_enable_interrupt(enum gpio_signal signal) bit = 31 - __builtin_clz(g->mask); if (exti_events[bit]) { - CPRINTF("[%T Overriding %s with %s on EXTI%d]\n", + CPRINTS("Overriding %s with %s on EXTI%d", exti_events[bit]->name, g->name, bit); } exti_events[bit] = g; diff --git a/chip/stm32/gpio-stm32f0.c b/chip/stm32/gpio-stm32f0.c index 0f11a65c15..5cbb61993e 100644 --- a/chip/stm32/gpio-stm32f0.c +++ b/chip/stm32/gpio-stm32f0.c @@ -15,7 +15,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_GPIO, outstr) -#define CPRINTF(format, args...) cprintf(CC_GPIO, format, ## args) +#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args) /* For each EXTI bit, record which GPIO entry is using it */ static const struct gpio_info *exti_events[16]; @@ -210,7 +210,7 @@ int gpio_enable_interrupt(enum gpio_signal signal) bit = 31 - __builtin_clz(g->mask); if (exti_events[bit]) { - CPRINTF("[%T Overriding %s with %s on EXTI%d]\n", + CPRINTS("Overriding %s with %s on EXTI%d", exti_events[bit]->name, g->name, bit); } exti_events[bit] = g; diff --git a/chip/stm32/gpio-stm32l.c b/chip/stm32/gpio-stm32l.c index d3aae2e31f..b6cb2bf71f 100644 --- a/chip/stm32/gpio-stm32l.c +++ b/chip/stm32/gpio-stm32l.c @@ -15,7 +15,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_GPIO, outstr) -#define CPRINTF(format, args...) cprintf(CC_GPIO, format, ## args) +#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args) /* For each EXTI bit, record which GPIO entry is using it */ static const struct gpio_info *exti_events[16]; @@ -214,7 +214,7 @@ int gpio_enable_interrupt(enum gpio_signal signal) bit = 31 - __builtin_clz(g->mask); if (exti_events[bit]) { - CPRINTF("[%T Overriding %s with %s on EXTI%d]\n", + CPRINTS("Overriding %s with %s on EXTI%d", exti_events[bit]->name, g->name, bit); } exti_events[bit] = g; diff --git a/chip/stm32/i2c-stm32f.c b/chip/stm32/i2c-stm32f.c index b2d775d992..8e1ab99d57 100644 --- a/chip/stm32/i2c-stm32f.c +++ b/chip/stm32/i2c-stm32f.c @@ -21,6 +21,7 @@ /* Console output macros */ #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) /* Maximum transfer of a SMBUS block transfer */ #define SMBUS_MAX_BLOCK 32 @@ -163,7 +164,7 @@ static int i2c_write_raw_slave(int port, void *buf, int len) dma_disable_tc_interrupt(DMAC_SLAVE_TX); if (!(rv & TASK_EVENT_WAKE)) { - CPRINTF("[%T Slave timeout, resetting i2c]\n"); + CPRINTS("Slave timeout, resetting i2c"); i2c_init_port(port); } } @@ -256,9 +257,7 @@ static void i2c_event_handler(int port) /* Confirm that you are not in master mode */ if (STM32_I2C_SR2(port) & (1 << 0)) { - CPRINTF( - "[%T I2C slave ISR triggered in " - "master mode, ignoring]\n"); + CPRINTS("slave ISR triggered in master mode, ignoring"); return; } @@ -316,9 +315,9 @@ static void i2c_error_handler(int port) /* ACK failed (NACK); expected when AP reads final byte. * Software must clear AF bit. */ } else { - CPRINTF("[%T %s: I2C_SR1(%d): 0x%04x]\n", + CPRINTS("%s: I2C_SR1(%d): 0x%04x", __func__, port, i2c_sr1[port]); - CPRINTF("[%T %s: I2C_SR2(%d): 0x%04x]\n", + CPRINTS("%s: I2C_SR2(%d): 0x%04x", __func__, port, STM32_I2C_SR2(port)); } @@ -552,7 +551,7 @@ static void handle_i2c_error(int port, int rv) /* EC_ERROR_TIMEOUT may have a code specifying where the timeout was */ if ((rv & 0xff) == EC_ERROR_TIMEOUT) { #ifdef CONFIG_I2C_DEBUG - CPRINTF("[%T Wait_status() timeout type: %d]\n", (rv >> 8)); + CPRINTS("Wait_status() timeout type: %d", (rv >> 8)); #endif rv = EC_ERROR_TIMEOUT; } @@ -574,7 +573,7 @@ static void handle_i2c_error(int port, int rv) * (Probably a stray pulse on the line got it out of sync with * the actual bytes) so reset it. */ - CPRINTF("[%T Unable to send START, resetting i2c]\n"); + CPRINTS("Unable to send START, resetting i2c"); i2c_init_port(port); goto cr_cleanup; } else if (rv == EC_ERROR_TIMEOUT && !(r & 2)) { @@ -583,7 +582,7 @@ static void handle_i2c_error(int port, int rv) * It seems that this can be happen very briefly while sending * a 1. We've not actually seen this, but just to be safe. */ - CPRINTF("[%T Bad BUSY bit detected]\n"); + CPRINTS("Bad BUSY bit detected"); master_stop(port); } diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c index 3bb5419cf3..cd93965503 100644 --- a/chip/stm32/i2c-stm32f0.c +++ b/chip/stm32/i2c-stm32f0.c @@ -17,7 +17,7 @@ /* Console output macros */ #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) /* Maximum transfer of a SMBUS block transfer */ #define SMBUS_MAX_BLOCK 32 @@ -72,7 +72,7 @@ static void i2c_set_freq_port(const struct i2c_port_t *p) STM32_I2C_TIMINGR(port) = 0xB0420F13; break; default: /* unknown speed, defaults to 100kBps */ - CPRINTF("[%T I2C bad speed %d kBps]\n", p->kbps); + CPRINTS("I2C bad speed %d kBps", p->kbps); STM32_I2C_TIMINGR(port) = 0xB0420F13; } /* Enable port */ diff --git a/chip/stm32/i2c-stm32l.c b/chip/stm32/i2c-stm32l.c index b2f528aa4f..34a80c2b3e 100644 --- a/chip/stm32/i2c-stm32l.c +++ b/chip/stm32/i2c-stm32l.c @@ -20,7 +20,7 @@ /* Console output macros */ #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) /* Maximum transfer of a SMBUS block transfer */ #define SMBUS_MAX_BLOCK 32 @@ -50,7 +50,7 @@ #ifdef CONFIG_I2C_DEBUG static void dump_i2c_reg(int port, const char *what) { - CPRINTF("[%T i2c CR1=%04x CR2=%04x SR1=%04x SR2=%04x %s]\n", + CPRINTS("i2c CR1=%04x CR2=%04x SR1=%04x SR2=%04x %s", STM32_I2C_CR1(port), STM32_I2C_CR2(port), STM32_I2C_SR1(port), @@ -305,8 +305,8 @@ int i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_bytes, */ if (rv == I2C_ERROR_FAILED_START) { const struct i2c_port_t *p = i2c_ports; - CPRINTF("[%T i2c_xfer start error; " - "unwedging and resetting i2c %d.\n", port); + CPRINTS("i2c_xfer start error; " + "unwedging and resetting i2c %d", port); i2c_unwedge(port); diff --git a/chip/stm32/spi.c b/chip/stm32/spi.c index c9e57cd5b2..960067f955 100644 --- a/chip/stm32/spi.c +++ b/chip/stm32/spi.c @@ -21,7 +21,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_SPI, outstr) -#define CPRINTF(format, args...) cprintf(CC_SPI, format, ## args) +#define CPRINTS(format, args...) cprints(CC_SPI, format, ## args) /* DMA channel option */ static const struct dma_option dma_tx_option = { @@ -346,7 +346,7 @@ void spi_event(enum gpio_signal signal) * AP started a transaction but we weren't ready for it. * Tell AP we weren't ready, and ignore the received data. */ - CPRINTF("[%T SPI not ready]\n"); + CPRINTS("SPI not ready"); spi->dr = EC_SPI_NOT_READY; state = SPI_STATE_RX_BAD; return; @@ -452,7 +452,7 @@ void spi_event(enum gpio_signal signal) /* Error, timeout, or protocol we can't handle. Ignore data. */ spi->dr = EC_SPI_RX_BAD_DATA; state = SPI_STATE_RX_BAD; - CPRINTF("[%T SPI rx bad data\n]"); + CPRINTS("SPI rx bad data"); } static void spi_chipset_startup(void) diff --git a/chip/stm32/system.c b/chip/stm32/system.c index 8b4ddea4f9..27ed7398e9 100644 --- a/chip/stm32/system.c +++ b/chip/stm32/system.c @@ -64,7 +64,7 @@ void __no_hibernate(uint32_t seconds, uint32_t microseconds) * * Until then, treat this as a request to hard-reboot. */ - cprintf(CC_SYSTEM, "[%T hibernate not supported, so rebooting]\n"); + cprints(CC_SYSTEM, "hibernate not supported, so rebooting"); cflush(); system_reset(SYSTEM_RESET_HARD); } diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c index bb402ee703..39f898d84c 100644 --- a/chip/stm32/usb_pd_phy.c +++ b/chip/stm32/usb_pd_phy.c @@ -20,8 +20,10 @@ #ifdef CONFIG_COMMON_RUNTIME #define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) #else #define CPRINTF(format, args...) +#define CPRINTS(format, args...) #endif #define PD_DATARATE 300000 /* Hz */ @@ -84,7 +86,7 @@ static int wait_bits(int nb) && !(STM32_TIM_SR(TIM_RX) & 4)) ; /* optimized for latency, not CPU usage ... */ if (dma_bytes_done(rx, PD_MAX_RAW_SIZE) < nb) { - CPRINTF("[%T PD TMOUT RX %d/%d]\n", + CPRINTS("PD TMOUT RX %d/%d", dma_bytes_done(rx, PD_MAX_RAW_SIZE), nb); return -1; } @@ -131,7 +133,7 @@ int pd_dequeue_bits(void *ctxt, int off, int len, uint32_t *val) return -1; } stream_err: - CPRINTF("[%T PD Invalid %d @%d]\n", cnt, off); + CPRINTS("PD Invalid %d @%d", cnt, off); return -1; } @@ -155,7 +157,7 @@ int pd_find_preamble(void *ctxt) !(STM32_TIM_SR(TIM_RX) & 4)) ; if (STM32_TIM_SR(TIM_RX) & 4) { - CPRINTF("[%T PD TMOUT RX %d/%d]\n", + CPRINTS("PD TMOUT RX %d/%d", PD_MAX_RAW_SIZE - rx->cndtr, bit); return -1; } @@ -524,7 +526,7 @@ void *pd_hw_init(void) STM32_EXTI_IMR |= EXTI_COMP_MASK; task_enable_irq(IRQ_COMP); - CPRINTF("[%T USB PD initialized]\n"); + CPRINTS("USB PD initialized"); return raw_samples; } 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; diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index 980c4b38c5..e031d58c04 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -77,7 +77,7 @@ void __idle(void) static void task_exit_trap(void) { int i = task_get_current(); - cprintf(CC_TASK, "[%T Task %d (%s) exited!]\n", i, task_names[i]); + cprints(CC_TASK, "Task %d (%s) exited!", i, task_names[i]); /* Exited tasks simply sleep forever */ while (1) task_wait_event(-1); diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c index 95b758abb8..830d6a520c 100644 --- a/core/cortex-m0/task.c +++ b/core/cortex-m0/task.c @@ -77,7 +77,7 @@ void __idle(void) static void task_exit_trap(void) { int i = task_get_current(); - cprintf(CC_TASK, "[%T Task %d (%s) exited!]\n", i, task_names[i]); + cprints(CC_TASK, "Task %d (%s) exited!", i, task_names[i]); /* Exited tasks simply sleep forever */ while (1) task_wait_event(-1); diff --git a/core/host/main.c b/core/host/main.c index fa5077b33d..80c2f33bf5 100644 --- a/core/host/main.c +++ b/core/host/main.c @@ -18,7 +18,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) const char *__prog_name; @@ -49,7 +49,7 @@ int main(int argc, char **argv) uart_init(); if (system_jumped_to_this_image()) { - CPRINTF("[%T Emulator initialized after sysjump]\n"); + CPRINTS("Emulator initialized after sysjump"); } else { CPUTS("\n\n--- Emulator initialized after reboot ---\n"); CPUTS("[Reset cause: "); diff --git a/core/nds32/task.c b/core/nds32/task.c index 9fe371e716..fc167da878 100644 --- a/core/nds32/task.c +++ b/core/nds32/task.c @@ -59,7 +59,7 @@ void __idle(void) * so this only starts once all other tasks have gotten a chance to do * their task inits and have gone to sleep. */ - cprintf(CC_TASK, "[%T idle task started]\n"); + cprints(CC_TASK, "idle task started"); while (1) { /* @@ -74,7 +74,7 @@ void __idle(void) static void task_exit_trap(void) { int i = task_get_current(); - cprintf(CC_TASK, "[%T Task %d (%s) exited!]\n", i, task_names[i]); + cprints(CC_TASK, "Task %d (%s) exited!", i, task_names[i]); /* Exited tasks simply sleep forever */ while (1) task_wait_event(-1); diff --git a/driver/accel_kxcj9.c b/driver/accel_kxcj9.c index ff65e50b94..f11339c5b4 100644 --- a/driver/accel_kxcj9.c +++ b/driver/accel_kxcj9.c @@ -16,7 +16,7 @@ #include "util.h" #define CPUTS(outstr) cputs(CC_ACCEL, outstr) -#define CPRINTF(format, args...) cprintf(CC_ACCEL, format, ## args) +#define CPRINTS(format, args...) cprints(CC_ACCEL, format, ## args) /* Number of times to attempt to enable sensor before giving up. */ #define SENSOR_ENABLE_ATTEMPTS 3 @@ -191,7 +191,7 @@ static int enable_sensor(const enum accel_id id, const int ctrl1) mutex_unlock(&accel_mutex[id]); /* Cannot enable accel, print warning and return an error. */ - CPRINTF("[%T Error trying to enable accelerometer %d]\n", id); + CPRINTF("Error trying to enable accelerometer %d", id); return ret; } diff --git a/driver/battery/smart.c b/driver/battery/smart.c index 4f6c2f349d..52e61a8699 100644 --- a/driver/battery/smart.c +++ b/driver/battery/smart.c @@ -15,7 +15,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 BATTERY_WAIT_TIMEOUT (2800*MSEC) #define BATTERY_NO_RESPONSE_TIMEOUT (1000*MSEC) @@ -322,7 +322,7 @@ int battery_wait_for_stable(void) got_response = 0; - CPRINTF("[%T Wait for battery stabilized during %d]\n", + CPRINTS("Wait for battery stabilized during %d", BATTERY_WAIT_TIMEOUT); while (get_time().val < wait_timeout) { /* Starting pinging battery */ @@ -330,19 +330,19 @@ int battery_wait_for_stable(void) got_response = 1; /* Battery is stable */ if (status & STATUS_INITIALIZED) { - CPRINTF("[%T battery initialized]\n"); + CPRINTS("battery initialized"); return EC_SUCCESS; } } /* Assume no battery connected if no response for a while */ else if (!got_response && get_time().val > no_response_timeout) { - CPRINTF("[%T battery not responding]\n"); + CPRINTS("battery not responding"); return EC_ERROR_NOT_POWERED; } msleep(25); /* clock stretching could hold 25ms */ } - CPRINTF("[%T battery wait stable timeout]\n"); + CPRINTS("battery wait stable timeout"); return EC_ERROR_TIMEOUT; } diff --git a/driver/charger/bq24192.c b/driver/charger/bq24192.c index c58bb0b006..099a44c815 100644 --- a/driver/charger/bq24192.c +++ b/driver/charger/bq24192.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) /* Charger information */ static const struct charger_info bq24192_charger_info = { @@ -217,7 +217,7 @@ static void bq24192_init(void) int val; if (charger_device_id(&val) || val != BQ24192_DEVICE_ID) { - CPRINTF("[%T BQ24192 incorrent ID: 0x%02x]\n", val); + CPRINTF("BQ24192 incorrent ID: 0x%02x", val); return; } @@ -241,7 +241,7 @@ static void bq24192_init(void) if (bq24192_watchdog_reset()) return; - CPRINTF("[%T BQ24192 initialized]\n"); + CPRINTF("BQ24192 initialized"); } DECLARE_HOOK(HOOK_INIT, bq24192_init, HOOK_PRIO_LAST); diff --git a/driver/regulator_ir357x.c b/driver/regulator_ir357x.c index c6966b7e31..89b1f9f2ee 100644 --- a/driver/regulator_ir357x.c +++ b/driver/regulator_ir357x.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) /* 8-bit I2C address */ #define IR357x_I2C_ADDR (0x8 << 1) @@ -113,7 +113,7 @@ static void ir357x_write(uint8_t reg, uint8_t val) res = i2c_write8(I2C_PORT_REGULATOR, IR357x_I2C_ADDR, reg, val); if (res) - CPRINTF("[%T IR I2C write failed]\n"); + CPRINTF("IR I2C write failed"); } static int ir357x_get_version(void) @@ -151,12 +151,12 @@ static void ir357x_prog(void) for (; settings->reg; settings++) ir357x_write(settings->reg, settings->value); } else { - CPRINTF("[%T IR%d chip unsupported. Skip writing settings!\n", + CPRINTF("IR%d chip unsupported. Skip writing settings!", ir357x_get_version()); return; } - CPRINTF("[%T IR%d registers UPDATED]\n", ir357x_get_version()); + CPRINTF("IR%d registers UPDATED", ir357x_get_version()); } static void ir357x_dump(void) diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c index 1299d5192b..6bd30f70bf 100644 --- a/driver/temp_sensor/tmp006.c +++ b/driver/temp_sensor/tmp006.c @@ -19,7 +19,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) /* Constants for calculating target object temperatures */ static const float A1 = 1.75e-3f; diff --git a/driver/usb_switch_tsu6721.c b/driver/usb_switch_tsu6721.c index 2335df6051..6f21fc7cb3 100644 --- a/driver/usb_switch_tsu6721.c +++ b/driver/usb_switch_tsu6721.c @@ -18,7 +18,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) /* 8-bit I2C address */ #define TSU6721_I2C_ADDR (0x25 << 1) @@ -49,7 +49,7 @@ int tsu6721_write(uint8_t reg, uint8_t val) res = i2c_write8(I2C_PORT_MASTER, TSU6721_I2C_ADDR, reg, val); if (res) - CPRINTF("[%T TSU6721 I2C write failed]\n"); + CPRINTS("TSU6721 I2C write failed"); return res; } @@ -102,7 +102,7 @@ void tsu6721_reset(void) for (i = 0; i < TSU6721_SW_RESET_RETRY; ++i) { if (i != 0) { - CPRINTF("[%T TSU6721 init failed. Retrying]\n"); + CPRINTS("TSU6721 init failed. Retrying"); msleep(500); } if (tsu6721_write(TSU6721_REG_RESET, 0x1)) @@ -127,7 +127,7 @@ int tsu6721_mux(enum tsu6721_mux sel) * something known on the ID pin */ if (sel != TSU6721_MUX_AUTO && (id == 0x1f) && !vbus1 && !vbus3) { - CPRINTF("[%T TSU6721 cannot use manual mode: no VBUS or ID]\n"); + CPRINTS("TSU6721 cannot use manual mode: no VBUS or ID"); return EC_ERROR_INVAL; } @@ -148,7 +148,7 @@ int tsu6721_init(void) int res = 0; if ((dev_id != 0x0a) && (dev_id != 0x12)) { - CPRINTF("[%T TSU6721 invalid device ID 0x%02x]\n", dev_id); + CPRINTS("TSU6721 invalid device ID 0x%02x", dev_id); return EC_ERROR_UNKNOWN; } diff --git a/include/console.h b/include/console.h index 5cd02bb5c8..f2113cda00 100644 --- a/include/console.h +++ b/include/console.h @@ -85,6 +85,17 @@ int cputs(enum console_channel channel, const char *outstr); int cprintf(enum console_channel channel, const char *format, ...); /** + * Print formatted output with timestamp. This is like: + * cprintf(channel, "[%T " + format + "]\n", ...) + * + * @param channel Output channel + * @param format Format string; see printf.h for valid formatting codes + * + * @return non-zero if output was truncated. + */ +int cprints(enum console_channel channel, const char *format, ...); + +/** * Flush the console output for all channels. */ void cflush(void); @@ -97,6 +108,7 @@ void cflush(void); /* gcc allows variable arg lists in macros; see * http://gcc.gnu.org/onlinedocs/gcc/Variadic-Macros.html */ #define ccprintf(format, args...) cprintf(CC_COMMAND, format, ## args) +#define ccprints(format, args...) cprints(CC_COMMAND, format, ## args) /** * Called by UART when a line of input is pending. diff --git a/power/baytrail.c b/power/baytrail.c index d0289aabc2..c84e74130a 100644 --- a/power/baytrail.c +++ b/power/baytrail.c @@ -24,7 +24,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) /* Input state flags */ #define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000) @@ -58,7 +58,7 @@ static int fake_pltrst_timeout; /* Fake PLTRST# timeout at next power-on */ void chipset_force_shutdown(void) { - CPRINTF("[%T %s()]\n", __func__); + CPRINTS("%s()", __func__); /* * Force power off. This condition will reset once the state machine @@ -70,7 +70,7 @@ void chipset_force_shutdown(void) void chipset_reset(int cold_reset) { - CPRINTF("[%T %s(%d)]\n", __func__, cold_reset); + CPRINTS("%s(%d)", __func__, cold_reset); if (cold_reset) { /* * Drop and restore PWROK. This causes the PCH to reboot, @@ -120,11 +120,11 @@ enum power_state power_chipset_init(void) /* Disable idle task deep sleep when in S0. */ disable_sleep(SLEEP_MASK_AP_RUN); - CPRINTF("[%T already in S0]\n"); + CPRINTS("already in S0"); return POWER_S0; } else { /* Force all signals to their G3 states */ - CPRINTF("[%T forcing G3]\n"); + CPRINTS("forcing G3"); gpio_set_level(GPIO_PCH_CORE_PWROK, 0); gpio_set_level(GPIO_VCORE_EN, 0); gpio_set_level(GPIO_SUSP_VR_EN, 0); @@ -299,10 +299,10 @@ enum power_state power_handle_state(enum power_state state) if (i < 50 && !fake_pltrst_timeout) { /* Deasserted in time */ - CPRINTF("[%T power PLTRST# deasserted]\n"); + CPRINTS("power PLTRST# deasserted"); } else { /* Force a reset. See crosbug.com/p/28422 */ - CPRINTF("[%T power PLTRST# timeout]\n"); + CPRINTS("power PLTRST# timeout"); power_button_pch_release(); chipset_force_shutdown(); restart_from_s5 = 1; @@ -381,7 +381,7 @@ enum power_state power_handle_state(enum power_state state) * See crosbug.com/p/28422. */ if (restart_from_s5) { - CPRINTF("[%T power restart from S5]\n"); + CPRINTS("power restart from S5"); restart_from_s5 = 0; diff --git a/power/common.c b/power/common.c index 1a4a906a88..1dffd64163 100644 --- a/power/common.c +++ b/power/common.c @@ -19,7 +19,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) /* * Default timeout in us; if we've been waiting this long for an input @@ -69,7 +69,7 @@ static void power_update_signals(void) } if ((in_signals & in_debug) != (inew & in_debug)) - CPRINTF("[%T power in 0x%04x]\n", inew); + CPRINTS("power in 0x%04x", inew); in_signals = inew; } @@ -84,7 +84,7 @@ int power_has_signals(uint32_t want) if ((in_signals & want) == want) return 1; - CPRINTF("[%T power lost input; wanted 0x%04x, got 0x%04x]\n", + CPRINTS("power lost input; wanted 0x%04x, got 0x%04x", want, in_signals & want); return 0; @@ -99,8 +99,8 @@ int power_wait_signals(uint32_t want) while ((in_signals & in_want) != in_want) { if (task_wait_event(DEFAULT_TIMEOUT) == TASK_EVENT_TIMER) { power_update_signals(); - CPRINTF("[%T power timeout on input; " - "wanted 0x%04x, got 0x%04x]\n", + CPRINTS("power timeout on input; " + "wanted 0x%04x, got 0x%04x", in_want, in_signals & in_want); return EC_ERROR_TIMEOUT; } @@ -150,7 +150,7 @@ static enum power_state power_common_state(enum power_state state) * Time's up. Hibernate until wake pin * asserted. */ - CPRINTF("[%T hibernating]\n"); + CPRINTS("hibernating"); system_hibernate(0, 0); } else { uint64_t wait = target_time - time_now; @@ -262,7 +262,7 @@ void chipset_task(void) enum power_state new_state; while (1) { - CPRINTF("[%T power state %d = %s, in 0x%04x]\n", + CPRINTS("power state %d = %s, in 0x%04x", state, state_names[state], in_signals); /* Always let the specific chipset handle the state first */ @@ -317,9 +317,9 @@ DECLARE_HOOK(HOOK_LID_CHANGE, power_lid_change, HOOK_PRIO_DEFAULT); static void power_ac_change(void) { if (extpower_is_present()) { - CPRINTF("[%T AC on]\n"); + CPRINTS("AC on"); } else { - CPRINTF("[%T AC off]\n"); + CPRINTS("AC off"); if (state == POWER_G3) { last_shutdown_time = get_time().val; @@ -350,7 +350,7 @@ static int command_powerinfo(int argc, char **argv) * Print power state in same format as state machine. This is * used by FAFT tests, so must match exactly. */ - ccprintf("[%T power state %d = %s, in 0x%04x]\n", + ccprints("power state %d = %s, in 0x%04x", state, state_names[state], in_signals); return EC_SUCCESS; diff --git a/power/gaia.c b/power/gaia.c index d115e2d52c..553b01bfcc 100644 --- a/power/gaia.c +++ b/power/gaia.c @@ -41,7 +41,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) /* Time necessary for the 5V and 3.3V regulator outputs to stabilize */ #ifdef BOARD_PIT @@ -152,7 +152,7 @@ static int wait_in_signal(enum gpio_signal signal, int value, int timeout) } else if (timestamp_expired(deadline, &now) || (task_wait_event(deadline.val - now.val) == TASK_EVENT_TIMER)) { - CPRINTF("[%T power timeout waiting for GPIO %d/%s]\n", + CPRINTS("power timeout waiting for GPIO %d/%s", signal, gpio_get_name(signal)); return EC_ERROR_TIMEOUT; } @@ -212,16 +212,16 @@ static int check_for_power_off_event(void) if (!power_button_was_pressed) { power_off_deadline.val = now.val + DELAY_FORCE_SHUTDOWN; - CPRINTF("[%T power waiting for long press %u]\n", + CPRINTS("power waiting for long press %u", power_off_deadline.le.lo); } else if (timestamp_expired(power_off_deadline, &now)) { power_off_deadline.val = 0; - CPRINTF("[%T power off after long press now=%u, %u]\n", + CPRINTS("power off after long press now=%u, %u", now.le.lo, power_off_deadline.le.lo); return 2; } } else if (power_button_was_pressed) { - CPRINTF("[%T power off cancel]\n"); + CPRINTS("power off cancel"); set_pmic_pwrok(0); } @@ -316,7 +316,7 @@ static int gaia_power_init(void) /* Leave power off only if requested by reset flags */ if (!(system_get_reset_flags() & RESET_FLAG_AP_OFF)) { - CPRINTF("[%T auto_power_on is set due to reset_flag 0x%x]\n", + CPRINTS("auto_power_on is set due to reset_flag 0x%x", system_get_reset_flags()); auto_power_on = 1; } @@ -329,7 +329,7 @@ static int gaia_power_init(void) * See crosbug.com/p/22233. */ if (!(system_get_reset_flags() & RESET_FLAG_SYSJUMP)) { - CPRINTF("[%T not sysjump; forcing AP reset]\n"); + CPRINTS("not sysjump; forcing AP reset"); gpio_set_level(GPIO_AP_RESET_L, 0); udelay(1000); gpio_set_level(GPIO_AP_RESET_L, 1); @@ -375,7 +375,7 @@ void chipset_reset(int is_cold) * TODO(crosbug.com/p/23822): Implement cold reset. For now, all * resets are warm resets. */ - CPRINTF("[%T EC triggered warm reboot]\n"); + CPRINTS("EC triggered warm reboot"); /* * This is a hack to do an AP warm reboot while still preserving RAM @@ -434,7 +434,7 @@ static int check_for_power_on_event(void) { /* Check if we've already powered the system on */ if (gpio_get_level(GPIO_EN_PP3300)) { - CPRINTF("[%T system is on, thus clear auto_power_on]\n"); + CPRINTS("system is on, thus clear auto_power_on"); auto_power_on = 0; /* no need to arrange another power on */ return 1; } @@ -510,7 +510,7 @@ static int power_on(void) gpio_set_level(GPIO_EN_PP5000, 0); gpio_set_level(GPIO_EN_PP3300, 0); usleep(DELAY_5V_SETUP); - CPRINTF("[%T power error: PMIC failed to enable]\n"); + CPRINTS("power error: PMIC failed to enable"); return -1; } @@ -529,7 +529,7 @@ static int power_on(void) /* Call hooks now that AP is running */ hook_notify(HOOK_CHIPSET_STARTUP); - CPRINTF("[%T AP running ...]\n"); + CPRINTS("AP running ..."); return 0; } @@ -545,10 +545,10 @@ static int wait_for_power_button_release(unsigned int timeout_us) udelay(KB_PWR_ON_DEBOUNCE); if (gpio_get_level(GPIO_KB_PWR_ON_L) == 0) { - CPRINTF("[%T power button not released in time]\n"); + CPRINTS("power button not released in time"); return -1; } - CPRINTF("[%T power button released]\n"); + CPRINTS("power button released"); return 0; } @@ -564,10 +564,10 @@ static int react_to_xpshold(unsigned int timeout_us) wait_in_signal(GPIO_SOC1V8_XPSHOLD, 1, timeout_us); if (gpio_get_level(GPIO_SOC1V8_XPSHOLD) == 0) { - CPRINTF("[%T XPSHOLD not seen in time]\n"); + CPRINTS("XPSHOLD not seen in time"); return -1; } - CPRINTF("[%T XPSHOLD seen]\n"); + CPRINTS("XPSHOLD seen"); set_pmic_pwrok(0); return 0; } @@ -589,7 +589,7 @@ static void power_off(void) #ifdef CONFIG_PMU_TPS65090 pmu_shutdown(); #endif - CPRINTF("[%T power shutdown complete]\n"); + CPRINTS("power shutdown complete"); } @@ -627,12 +627,12 @@ static int wait_for_power_on(void) * shutdown the system from EC. */ if (value != 1 && charge_keep_power_off()) { - CPRINTF("[%T power on ignored due to low battery]\n"); + CPRINTS("power on ignored due to low battery"); continue; } #endif - CPRINTF("[%T power on %d]\n", value); + CPRINTS("power on %d", value); return value; } } @@ -668,7 +668,7 @@ void chipset_task(void) power_button_was_pressed = 0; while (!(value = check_for_power_off_event())) task_wait_event(next_pwr_event()); - CPRINTF("[%T power ending loop %d]\n", value); + CPRINTS("power ending loop %d", value); } } power_off(); diff --git a/power/haswell.c b/power/haswell.c index b5250379ad..ae7cf7a14a 100644 --- a/power/haswell.c +++ b/power/haswell.c @@ -21,7 +21,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) /* Input state flags */ #define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000) @@ -56,7 +56,7 @@ static int pause_in_s5; /* Pause in S5 when shutting down? */ void chipset_force_shutdown(void) { - CPRINTF("[%T %s()]\n", __func__); + CPRINTS("%s()", __func__); /* * Force power off. This condition will reset once the state machine @@ -68,7 +68,7 @@ void chipset_force_shutdown(void) void chipset_reset(int cold_reset) { - CPRINTF("[%T %s(%d)]\n", __func__, cold_reset); + CPRINTS("%s(%d)", __func__, cold_reset); if (cold_reset) { /* * Drop and restore PWROK. This causes the PCH to reboot, @@ -131,11 +131,11 @@ enum power_state power_chipset_init(void) if ((power_get_signals() & IN_ALL_S0) == IN_ALL_S0) { /* Disable idle task deep sleep when in S0. */ disable_sleep(SLEEP_MASK_AP_RUN); - CPRINTF("[%T already in S0]\n"); + CPRINTS("already in S0"); return POWER_S0; } else { /* Force all signals to their G3 states */ - CPRINTF("[%T forcing G3]\n"); + CPRINTS("forcing G3"); gpio_set_level(GPIO_PCH_PWROK, 0); gpio_set_level(GPIO_VCORE_EN, 0); gpio_set_level(GPIO_SUSP_VR_EN, 0); diff --git a/power/ivybridge.c b/power/ivybridge.c index 10086a862a..163afb330b 100644 --- a/power/ivybridge.c +++ b/power/ivybridge.c @@ -19,7 +19,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) /* Input state flags */ #define IN_PGOOD_5VALW POWER_SIGNAL_MASK(X86_PGOOD_5VALW) @@ -62,7 +62,7 @@ static int throttle_cpu; /* Throttle CPU? */ void chipset_force_shutdown(void) { - CPRINTF("[%T chipset force shutdown]\n"); + CPRINTS("chipset force shutdown"); /* * Force power off. This condition will reset once the state machine @@ -124,11 +124,11 @@ enum power_state power_chipset_init(void) */ if (system_jumped_to_this_image()) { if ((power_get_signals() & IN_ALL_S0) == IN_ALL_S0) { - CPRINTF("[%T already in S0]\n"); + CPRINTS("already in S0"); return POWER_S0; } else { /* Force all signals to their G3 states */ - CPRINTF("[%T forcing G3]\n"); + CPRINTS("forcing G3"); gpio_set_level(GPIO_PCH_PWROK, 0); gpio_set_level(GPIO_ENABLE_VCORE, 0); gpio_set_level(GPIO_ENABLE_VS, 0); diff --git a/power/tegra.c b/power/tegra.c index dac1d2f475..41c1e83b16 100644 --- a/power/tegra.c +++ b/power/tegra.c @@ -45,7 +45,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) /* masks for power signals */ #define IN_XPSHOLD POWER_SIGNAL_MASK(TEGRA_XPSHOLD) @@ -196,16 +196,16 @@ static int check_for_power_off_event(void) if (!power_button_was_pressed) { power_off_deadline.val = now.val + DELAY_FORCE_SHUTDOWN; - CPRINTF("[%T power waiting for long press %u]\n", + CPRINTS("power waiting for long press %u", power_off_deadline.le.lo); } else if (timestamp_expired(power_off_deadline, &now)) { power_off_deadline.val = 0; - CPRINTF("[%T power off after long press now=%u, %u]\n", + CPRINTS("power off after long press now=%u, %u", now.le.lo, power_off_deadline.le.lo); return 2; } } else if (power_button_was_pressed) { - CPRINTF("[%T power off cancel]\n"); + CPRINTS("power off cancel"); set_pmic_pwron(0); } @@ -240,7 +240,7 @@ enum power_state power_chipset_init(void) * the AP could stay in strange state. */ if (!(reset_flags & RESET_FLAG_SYSJUMP)) { - CPRINTF("[%T not sysjump; forcing AP shutdown]\n"); + CPRINTS("not sysjump; forcing AP shutdown"); chipset_turn_off_power_rails(); /* @@ -261,7 +261,7 @@ enum power_state power_chipset_init(void) /* Leave power off only if requested by reset flags */ if (!(reset_flags & RESET_FLAG_AP_OFF) && !(reset_flags & RESET_FLAG_SYSJUMP)) { - CPRINTF("[%T auto_power_on is set due to reset_flag 0x%x]\n", + CPRINTS("auto_power_on set due to reset_flag 0x%x", system_get_reset_flags()); auto_power_on = 1; } @@ -319,14 +319,14 @@ static int check_for_power_on_event(void) /* check if system is already ON */ if (power_get_signals() & IN_XPSHOLD) { if (ap_off_flag) { - CPRINTF( - "[%T system is on, but " - "RESET_FLAG_AP_OFF is on]\n"); + CPRINTS( + "system is on, but " + "RESET_FLAG_AP_OFF is on"); return 0; } else { - CPRINTF( - "[%T system is on, thus clear " - "auto_power_on]\n"); + CPRINTS( + "system is on, thus clear " + "auto_power_on"); /* no need to arrange another power on */ auto_power_on = 0; return 1; @@ -379,7 +379,7 @@ static void power_on(void) t = get_time().val; if (t < PMIC_RTC_STARTUP) { uint32_t wait = PMIC_RTC_STARTUP - t; - CPRINTF("[%T wait for %dms for PMIC RTC start-up]\n", + CPRINTS("wait for %dms for PMIC RTC start-up", wait / MSEC); usleep(wait); } @@ -398,7 +398,7 @@ static void power_on(void) /* Call hooks now that AP is running */ hook_notify(HOOK_CHIPSET_STARTUP); - CPRINTF("[%T AP running ...]\n"); + CPRINTS("AP running ..."); } /** @@ -422,12 +422,12 @@ static int wait_for_power_button_release(unsigned int timeout_us) } else if (timestamp_expired(deadline, &now) || (task_wait_event(deadline.val - now.val) == TASK_EVENT_TIMER)) { - CPRINTF("[%T power button not released in time]\n"); + CPRINTS("power button not released in time"); return EC_ERROR_TIMEOUT; } } - CPRINTF("[%T power button released]\n"); + CPRINTS("power button released"); power_button_was_pressed = 0; return EC_SUCCESS; } @@ -448,19 +448,19 @@ static void power_off(void) lid_opened = 0; enable_sleep(SLEEP_MASK_AP_RUN); powerled_set_state(POWERLED_STATE_OFF); - CPRINTF("[%T power shutdown complete]\n"); + CPRINTS("power shutdown complete"); } void chipset_reset(int is_cold) { if (is_cold) { - CPRINTF("[%T EC triggered cold reboot]\n"); + CPRINTS("EC triggered cold reboot"); power_off(); /* After XPSHOLD is dropped off, the system will be on again */ power_request = POWER_REQ_ON; } else { - CPRINTF("[%T EC triggered warm reboot]\n"); - CPRINTF("[%T assert GPIO_PMIC_WARM_RESET_L for %d ms]\n", + CPRINTS("EC triggered warm reboot"); + CPRINTS("assert GPIO_PMIC_WARM_RESET_L for %d ms", PMIC_WARM_RESET_L_HOLD_TIME / MSEC); gpio_set_level(GPIO_PMIC_WARM_RESET_L, 0); usleep(PMIC_WARM_RESET_L_HOLD_TIME); @@ -492,7 +492,7 @@ enum power_state power_handle_state(enum power_state state) } if (value) { - CPRINTF("[%T power on %d]\n", value); + CPRINTS("power on %d", value); return POWER_S5S3; } return state; @@ -500,14 +500,14 @@ enum power_state power_handle_state(enum power_state state) case POWER_S5S3: power_on(); if (power_wait_signals(IN_XPSHOLD) == EC_SUCCESS) { - CPRINTF("[%T XPSHOLD seen]\n"); + CPRINTS("XPSHOLD seen"); if (wait_for_power_button_release( DELAY_SHUTDOWN_ON_POWER_HOLD) == EC_SUCCESS) { set_pmic_pwron(0); return POWER_S3; } else { - CPRINTF("[%T long-press button, shutdown]\n"); + CPRINTS("long-press button, shutdown"); power_off(); /* * Since the AP may be up already, return S0S3 @@ -516,7 +516,7 @@ enum power_state power_handle_state(enum power_state state) return POWER_S0S3; } } else { - CPRINTF("[%T XPSHOLD not seen in time]\n"); + CPRINTS("XPSHOLD not seen in time"); } set_pmic_pwron(0); return POWER_S5; @@ -536,7 +536,7 @@ enum power_state power_handle_state(enum power_state state) case POWER_S0: value = check_for_power_off_event(); if (value) { - CPRINTF("[%T power off %d]\n", value); + CPRINTS("power off %d", value); power_off(); return POWER_S0S3; } else if (power_get_signals() & IN_SUSPEND) |