hv/mod_timer: separate delay functions from the timer module

Modules that use udelay() should include "delay.h" explicitly.

Tracked-On: #5920
Signed-off-by: Rong Liu <rong2.liu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Liang Yi
2021-04-12 12:07:59 +08:00
committed by wenlingz
parent 5a2b89b0a4
commit 51204a8d11
10 changed files with 48 additions and 15 deletions

View File

@@ -33,6 +33,7 @@
#include <asm/rtcm.h>
#include <reloc.h>
#include <ticks.h>
#include <delay.h>
#define CPU_UP_TIMEOUT 100U /* millisecond */
#define CPU_DOWN_TIMEOUT 100U /* millisecond */

View File

@@ -12,6 +12,7 @@
#include <asm/cpu_caps.h>
#include <asm/lapic.h>
#include <asm/apicreg.h>
#include <delay.h>
/* intr_lapic_icr_delivery_mode */
#define INTR_LAPIC_ICR_FIXED 0x0U

View File

@@ -17,6 +17,7 @@
#include <asm/ioapic.h>
#include <asm/vtd.h>
#include <asm/lapic.h>
#include <delay.h>
struct cpu_context cpu_ctx;

View File

@@ -200,16 +200,3 @@ void timer_init(void)
init_tsc_deadline_timer();
}
}
void udelay(uint32_t us)
{
uint64_t dest_tsc, delta_tsc;
/* Calculate number of ticks to wait */
delta_tsc = us_to_ticks(us);
dest_tsc = rdtsc() + delta_tsc;
/* Loop until time expired */
while (rdtsc() < dest_tsc) {
}
}