timer: Change timer util functions to 64-bit
Since mono_time is now 64-bit, the utility functions interfacing with mono_time should also be 64-bit so precision isn't lost. Fixed build errors related to printing the now int64_t result of stopwatch_duration_[m|u]secs in various places. BUG=b:237082996 BRANCH=All TEST=Boot dewatt Change-Id: I169588f5e14285557f2d03270f58f4c07c0154d5 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66170 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
parent
51249d6bed
commit
d522f38c7b
|
@ -525,7 +525,7 @@ static enum cb_err bsp_do_flight_plan(struct mp_params *mp_params)
|
|||
release_barrier(&rec->barrier);
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "%s done after %ld msecs.\n", __func__,
|
||||
printk(BIOS_INFO, "%s done after %lld msecs.\n", __func__,
|
||||
stopwatch_duration_msecs(&sw));
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ static int process_reset(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "TPM ready after %ld ms\n",
|
||||
printk(BIOS_INFO, "TPM ready after %lld ms\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
|
||||
return 0;
|
||||
|
@ -183,7 +183,7 @@ static int process_reset(void)
|
|||
printk(BIOS_ERR, "Failed to read TPM\n");
|
||||
else
|
||||
printk(BIOS_ERR,
|
||||
"TPM failed to reset after %ld ms, status: %#x\n",
|
||||
"TPM failed to reset after %lld ms, status: %#x\n",
|
||||
stopwatch_duration_msecs(&sw), access);
|
||||
|
||||
return -1;
|
||||
|
|
|
@ -212,7 +212,7 @@ int spi_flash_cmd_poll_bit(const struct spi_flash *flash, unsigned long timeout,
|
|||
return 0;
|
||||
} while (!stopwatch_expired(&sw));
|
||||
|
||||
printk(BIOS_WARNING, "SF: timeout at %ld msec after %d attempts\n",
|
||||
printk(BIOS_WARNING, "SF: timeout at %lld msec after %d attempts\n",
|
||||
stopwatch_duration_msecs(&sw), attempt);
|
||||
|
||||
return -1;
|
||||
|
|
|
@ -390,14 +390,14 @@ static enum cb_err tpm2_claim_locality(void)
|
|||
break;
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "TPM ready after %ld ms\n",
|
||||
printk(BIOS_INFO, "TPM ready after %lld ms\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
|
||||
return CB_SUCCESS;
|
||||
} while (!stopwatch_expired(&sw));
|
||||
|
||||
printk(BIOS_ERR,
|
||||
"Failed to claim locality 0 after %ld ms, status: %#x\n",
|
||||
"Failed to claim locality 0 after %lld ms, status: %#x\n",
|
||||
stopwatch_duration_msecs(&sw), access);
|
||||
|
||||
return CB_ERR;
|
||||
|
|
|
@ -1651,7 +1651,7 @@ int google_chromeec_wait_for_displayport(long timeout_ms)
|
|||
}
|
||||
mdelay(200);
|
||||
}
|
||||
printk(BIOS_INFO, "DisplayPort ready after %lu ms\n",
|
||||
printk(BIOS_INFO, "DisplayPort ready after %lld ms\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
|
||||
return ret;
|
||||
|
@ -1671,7 +1671,7 @@ int google_chromeec_wait_for_dp_hpd(int port, long timeout_ms)
|
|||
}
|
||||
mdelay(100);
|
||||
} while (!(mux_flags & USB_PD_MUX_HPD_LVL) || !(mux_flags & USB_PD_MUX_DP_ENABLED));
|
||||
printk(BIOS_INFO, "HPD ready after %lu ms\n", stopwatch_duration_msecs(&sw));
|
||||
printk(BIOS_INFO, "HPD ready after %lld ms\n", stopwatch_duration_msecs(&sw));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -47,28 +47,28 @@ int timers_run(void);
|
|||
|
||||
/* Schedule a callback to be ran microseconds from time of invocation.
|
||||
* 0 returned on success, < 0 on error. */
|
||||
int timer_sched_callback(struct timeout_callback *tocb, unsigned long us);
|
||||
int timer_sched_callback(struct timeout_callback *tocb, uint64_t us);
|
||||
|
||||
/* Set an absolute time to a number of microseconds. */
|
||||
static inline void mono_time_set_usecs(struct mono_time *mt, long us)
|
||||
static inline void mono_time_set_usecs(struct mono_time *mt, uint64_t us)
|
||||
{
|
||||
mt->microseconds = us;
|
||||
}
|
||||
|
||||
/* Set an absolute time to a number of milliseconds. */
|
||||
static inline void mono_time_set_msecs(struct mono_time *mt, long ms)
|
||||
static inline void mono_time_set_msecs(struct mono_time *mt, uint64_t ms)
|
||||
{
|
||||
mt->microseconds = ms * USECS_PER_MSEC;
|
||||
}
|
||||
|
||||
/* Add microseconds to an absolute time. */
|
||||
static inline void mono_time_add_usecs(struct mono_time *mt, long us)
|
||||
static inline void mono_time_add_usecs(struct mono_time *mt, int64_t us)
|
||||
{
|
||||
mt->microseconds += us;
|
||||
}
|
||||
|
||||
/* Add milliseconds to an absolute time. */
|
||||
static inline void mono_time_add_msecs(struct mono_time *mt, long ms)
|
||||
static inline void mono_time_add_msecs(struct mono_time *mt, int64_t ms)
|
||||
{
|
||||
mono_time_add_usecs(mt, ms * USECS_PER_MSEC);
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ static inline int mono_time_before(const struct mono_time *t1,
|
|||
}
|
||||
|
||||
/* Return time difference between t1 and t2. i.e. t2 - t1. */
|
||||
static inline long mono_time_diff_microseconds(const struct mono_time *t1,
|
||||
const struct mono_time *t2)
|
||||
static inline int64_t mono_time_diff_microseconds(const struct mono_time *t1,
|
||||
const struct mono_time *t2)
|
||||
{
|
||||
return t2->microseconds - t1->microseconds;
|
||||
}
|
||||
|
@ -124,13 +124,13 @@ static inline void stopwatch_init(struct stopwatch *sw)
|
|||
sw->current = sw->expires = sw->start;
|
||||
}
|
||||
|
||||
static inline void stopwatch_init_usecs_expire(struct stopwatch *sw, long us)
|
||||
static inline void stopwatch_init_usecs_expire(struct stopwatch *sw, uint64_t us)
|
||||
{
|
||||
stopwatch_init(sw);
|
||||
mono_time_add_usecs(&sw->expires, us);
|
||||
}
|
||||
|
||||
static inline void stopwatch_init_msecs_expire(struct stopwatch *sw, long ms)
|
||||
static inline void stopwatch_init_msecs_expire(struct stopwatch *sw, uint64_t ms)
|
||||
{
|
||||
stopwatch_init_usecs_expire(sw, USECS_PER_MSEC * ms);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ static inline void stopwatch_wait_until_expired(struct stopwatch *sw)
|
|||
/*
|
||||
* Return number of microseconds since starting the stopwatch.
|
||||
*/
|
||||
static inline long stopwatch_duration_usecs(struct stopwatch *sw)
|
||||
static inline int64_t stopwatch_duration_usecs(struct stopwatch *sw)
|
||||
{
|
||||
/*
|
||||
* If the stopwatch hasn't been ticked (current == start) tick
|
||||
|
@ -179,7 +179,7 @@ static inline long stopwatch_duration_usecs(struct stopwatch *sw)
|
|||
return mono_time_diff_microseconds(&sw->start, &sw->current);
|
||||
}
|
||||
|
||||
static inline long stopwatch_duration_msecs(struct stopwatch *sw)
|
||||
static inline int64_t stopwatch_duration_msecs(struct stopwatch *sw)
|
||||
{
|
||||
return stopwatch_duration_usecs(sw) / USECS_PER_MSEC;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ static inline long stopwatch_duration_msecs(struct stopwatch *sw)
|
|||
*/
|
||||
#define wait_us(timeout_us, condition) \
|
||||
({ \
|
||||
long __ret = 0; \
|
||||
int64_t __ret = 0; \
|
||||
struct stopwatch __sw; \
|
||||
stopwatch_init_usecs_expire(&__sw, timeout_us); \
|
||||
do { \
|
||||
|
|
|
@ -283,7 +283,7 @@ static void bs_call_callbacks(struct boot_state *state,
|
|||
bscb->callback(bscb->arg);
|
||||
if (CONFIG(DEBUG_BOOT_STATE)) {
|
||||
timer_monotonic_get(&mt_stop);
|
||||
printk(BIOS_DEBUG, "BS: callback (%p) @ %s (%ld ms).\n", bscb,
|
||||
printk(BIOS_DEBUG, "BS: callback (%p) @ %s (%lld ms).\n", bscb,
|
||||
bscb_location(bscb),
|
||||
mono_time_diff_microseconds(&mt_start, &mt_stop)
|
||||
/ USECS_PER_MSEC);
|
||||
|
|
|
@ -400,7 +400,7 @@ enum cb_err thread_join(struct thread_handle *handle)
|
|||
while (handle->state != THREAD_DONE)
|
||||
assert(thread_yield() == 0);
|
||||
|
||||
printk(BIOS_SPEW, "took %lu us\n", stopwatch_duration_usecs(&sw));
|
||||
printk(BIOS_SPEW, "took %lld us\n", stopwatch_duration_usecs(&sw));
|
||||
|
||||
return handle->error;
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ void thread_mutex_lock(struct thread_mutex *mutex)
|
|||
assert(thread_yield() == 0);
|
||||
mutex->locked = true;
|
||||
|
||||
printk(BIOS_SPEW, "took %lu us to acquire mutex\n", stopwatch_duration_usecs(&sw));
|
||||
printk(BIOS_SPEW, "took %lld us to acquire mutex\n", stopwatch_duration_usecs(&sw));
|
||||
}
|
||||
|
||||
void thread_mutex_unlock(struct thread_mutex *mutex)
|
||||
|
|
|
@ -245,7 +245,7 @@ static void wait_for_hpd(gpio_t gpio, long timeout)
|
|||
}
|
||||
mdelay(200);
|
||||
}
|
||||
printk(BIOS_INFO, "HPD ready after %lu ms\n",
|
||||
printk(BIOS_INFO, "HPD ready after %lld ms\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ static void wait_for_hpd(gpio_t gpio, long timeout)
|
|||
}
|
||||
mdelay(200);
|
||||
}
|
||||
printk(BIOS_INFO, "HPD ready after %lu ms\n",
|
||||
printk(BIOS_INFO, "HPD ready after %lld ms\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ static vb2_error_t ec_hash_image(enum vb2_firmware_selection select,
|
|||
return VB2_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "EC took %luus to calculate image hash\n",
|
||||
printk(BIOS_INFO, "EC took %lldus to calculate image hash\n",
|
||||
stopwatch_duration_usecs(&sw));
|
||||
|
||||
*hash = resp.hash_digest;
|
||||
|
@ -460,7 +460,7 @@ vb2_error_t vb2ex_ec_vboot_done(struct vb2_context *ctx)
|
|||
"EC requests limited power usage. Request shutdown.\n");
|
||||
return VB2_REQUEST_SHUTDOWN;
|
||||
} else {
|
||||
printk(BIOS_INFO, "Waited %luus to clear limit power flag.\n",
|
||||
printk(BIOS_INFO, "Waited %lldus to clear limit power flag.\n",
|
||||
stopwatch_duration_usecs(&sw));
|
||||
}
|
||||
|
||||
|
@ -541,7 +541,7 @@ vb2_error_t vb2ex_ec_jump_to_rw(void)
|
|||
mdelay(50);
|
||||
while (google_chromeec_hello()) {
|
||||
if (stopwatch_expired(&sw)) {
|
||||
printk(BIOS_ERR, "EC did not return from reboot after %luus\n",
|
||||
printk(BIOS_ERR, "EC did not return from reboot after %lldus\n",
|
||||
stopwatch_duration_usecs(&sw));
|
||||
return VB2_ERROR_UNKNOWN;
|
||||
}
|
||||
|
@ -549,7 +549,7 @@ vb2_error_t vb2ex_ec_jump_to_rw(void)
|
|||
mdelay(5);
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "\nEC returned from reboot after %luus\n",
|
||||
printk(BIOS_INFO, "\nEC returned from reboot after %lldus\n",
|
||||
stopwatch_duration_usecs(&sw));
|
||||
|
||||
return VB2_SUCCESS;
|
||||
|
|
|
@ -23,7 +23,7 @@ static int32_t smu_poll_response(bool print_command_duration)
|
|||
result = smn_read32(SMN_SMU_MESG_RESP);
|
||||
if (result) {
|
||||
if (print_command_duration)
|
||||
printk(BIOS_SPEW, "SMU command consumed %ld usecs\n",
|
||||
printk(BIOS_SPEW, "SMU command consumed %lld usecs\n",
|
||||
stopwatch_duration_usecs(&sw));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -800,7 +800,7 @@ static void configure_xhci_host_mode_port0(void)
|
|||
}
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "xHCI port 0 host switch over took %lu ms\n",
|
||||
printk(BIOS_INFO, "xHCI port 0 host switch over took %lld ms\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
|
||||
|
|
|
@ -44,5 +44,5 @@ void cf9_reset_prepare(void)
|
|||
}
|
||||
mdelay(1);
|
||||
}
|
||||
printk(BIOS_SPEW, "CSE took %lu ms\n", stopwatch_duration_msecs(&sw));
|
||||
printk(BIOS_SPEW, "CSE took %lld ms\n", stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ static void configure_host_mode_port0(struct device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "XDCI port 0 host switch over took %lu ms\n",
|
||||
printk(BIOS_INFO, "XDCI port 0 host switch over took %lld ms\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ uint8_t cse_wait_sec_override_mode(void)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
printk(BIOS_DEBUG, "HECI: CSE took %lu ms to enter security override mode\n",
|
||||
printk(BIOS_DEBUG, "HECI: CSE took %lld ms to enter security override mode\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
return 1;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ uint8_t cse_wait_com_soft_temp_disable(void)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
printk(BIOS_SPEW, "HECI: CSE took %lu ms to boot from RO\n",
|
||||
printk(BIOS_SPEW, "HECI: CSE took %lld ms to boot from RO\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ enum cb_err phy_gmii_ready(void *base)
|
|||
|
||||
} while (!stopwatch_expired(&sw));
|
||||
|
||||
printk(BIOS_ERR, "%s Timeout after %ld msec\n", __func__,
|
||||
printk(BIOS_ERR, "%s Timeout after %lld msec\n", __func__,
|
||||
stopwatch_duration_msecs(&sw));
|
||||
return CB_ERR;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ int mtk_init_mcu(struct mtk_mcu *mcu)
|
|||
if (mcu->reset)
|
||||
mcu->reset(mcu);
|
||||
|
||||
printk(BIOS_DEBUG, "%s: Loaded (and reset) %s in %ld msecs (%zd bytes)\n",
|
||||
printk(BIOS_DEBUG, "%s: Loaded (and reset) %s in %lld msecs (%zd bytes)\n",
|
||||
__func__, mcu->firmware_name, stopwatch_duration_msecs(&sw), mcu->run_size);
|
||||
|
||||
return CB_SUCCESS;
|
||||
|
|
|
@ -265,7 +265,7 @@ static void mt_mem_init_run(struct dramc_param *dparam,
|
|||
ret = dram_run_fast_calibration(dparam);
|
||||
if (ret != 0) {
|
||||
printk(BIOS_ERR, "DRAM-K: Failed to run fast calibration "
|
||||
"in %ld msecs, error: %d\n",
|
||||
"in %lld msecs, error: %d\n",
|
||||
stopwatch_duration_msecs(&sw), ret);
|
||||
|
||||
/* Erase flash data after fast calibration failed */
|
||||
|
@ -274,7 +274,7 @@ static void mt_mem_init_run(struct dramc_param *dparam,
|
|||
DRAMC_PARAM_HEADER_VERSION,
|
||||
dparam, mrc_cache_size);
|
||||
} else {
|
||||
printk(BIOS_INFO, "DRAM-K: Fast calibration passed in %ld msecs\n",
|
||||
printk(BIOS_INFO, "DRAM-K: Fast calibration passed in %lld msecs\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
return;
|
||||
}
|
||||
|
@ -290,13 +290,13 @@ static void mt_mem_init_run(struct dramc_param *dparam,
|
|||
stopwatch_init(&sw);
|
||||
int err = dram_run_full_calibration(dparam);
|
||||
if (err == 0) {
|
||||
printk(BIOS_INFO, "DRAM-K: Full calibration passed in %ld msecs\n",
|
||||
printk(BIOS_INFO, "DRAM-K: Full calibration passed in %lld msecs\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
mrc_cache_stash_data(MRC_TRAINING_DATA,
|
||||
DRAMC_PARAM_HEADER_VERSION,
|
||||
dparam, mrc_cache_size);
|
||||
} else {
|
||||
printk(BIOS_ERR, "DRAM-K: Full calibration failed in %ld msecs\n",
|
||||
printk(BIOS_ERR, "DRAM-K: Full calibration failed in %lld msecs\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ static void pmic_efuse_setting(void)
|
|||
mt6359p_write(PMIC_BUCK_VPA_DLC_CON1, 0x800);
|
||||
}
|
||||
|
||||
printk(BIOS_DEBUG, "%s: Set efuses in %ld msecs\n",
|
||||
printk(BIOS_DEBUG, "%s: Set efuses in %lld msecs\n",
|
||||
__func__, stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ int spm_init(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "SPM: %s done in %ld msecs, spm pc = %#x\n",
|
||||
printk(BIOS_INFO, "SPM: %s done in %lld msecs, spm pc = %#x\n",
|
||||
__func__, stopwatch_duration_msecs(&sw),
|
||||
read32(&mtk_spm->md32pcm_pc));
|
||||
|
||||
|
|
|
@ -264,7 +264,7 @@ static int spm_load_firmware(enum dyna_load_pcm_index index,
|
|||
assert(offset < file_size);
|
||||
printk(BIOS_DEBUG, "SPM: version = %s\n", spm_bin + offset);
|
||||
|
||||
printk(BIOS_INFO, "SPM binary loaded in %ld msecs\n",
|
||||
printk(BIOS_INFO, "SPM binary loaded in %lld msecs\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
|
||||
return 0;
|
||||
|
@ -330,7 +330,7 @@ int spm_init(void)
|
|||
spm_init_event_vector(pcmdesc);
|
||||
spm_kick_pcm_to_run();
|
||||
|
||||
printk(BIOS_INFO, "SPM: %s done in %ld msecs\n", __func__,
|
||||
printk(BIOS_INFO, "SPM: %s done in %lld msecs\n", __func__,
|
||||
stopwatch_duration_msecs(&sw));
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -64,7 +64,7 @@ static void request_ram_repair(void)
|
|||
while ((read32(&flow->ram_repair) & sts) != sts)
|
||||
;
|
||||
|
||||
printk(BIOS_DEBUG, "RAM repair complete in %ld usecs.\n",
|
||||
printk(BIOS_DEBUG, "RAM repair complete in %lld usecs.\n",
|
||||
stopwatch_duration_usecs(&sw));
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ static int s5p_dp_config_video(struct s5p_dp_device *dp,
|
|||
} while (!stopwatch_expired(&sw));
|
||||
|
||||
if (!timeout) {
|
||||
printk(BIOS_ERR, "Video Clock Not ok after %ldus.\n",
|
||||
printk(BIOS_ERR, "Video Clock Not ok after %lldus.\n",
|
||||
stopwatch_duration_usecs(&sw));
|
||||
return -ERR_VIDEO_CLOCK_BAD;
|
||||
}
|
||||
|
|
|
@ -478,7 +478,7 @@ void exit_soft_temp_disable_wait(struct device *dev)
|
|||
if (!hfs.fw_init_complete)
|
||||
printk(BIOS_ERR, "ME: giving up on waiting for fw_init_complete\n");
|
||||
else
|
||||
printk(BIOS_NOTICE, "ME: took %lums to complete initialization\n",
|
||||
printk(BIOS_NOTICE, "ME: took %lldms to complete initialization\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue