File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -166,15 +166,19 @@ struct lapic_info {
166
166
167
167
static struct lapic_info lapic_info ;
168
168
169
- static uint32_t read_lapic_reg32 (uint32_t offset )
169
+ static inline uint32_t read_lapic_reg32 (uint32_t offset )
170
170
{
171
- ASSERT ((offset >= 0x020 ) && (offset <= 0x3FF ), "" );
171
+ if (offset < 0x20 || offset > 0x3ff )
172
+ return 0 ;
173
+
172
174
return mmio_read_long (lapic_info .xapic .vaddr + offset );
173
175
}
174
176
175
- static void write_lapic_reg32 (uint32_t offset , uint32_t value )
177
+ inline void write_lapic_reg32 (uint32_t offset , uint32_t value )
176
178
{
177
- ASSERT ((offset >= 0x020 ) && (offset <= 0x3FF ), "" );
179
+ if (offset < 0x20 || offset > 0x3ff )
180
+ return ;
181
+
178
182
mmio_write_long (value , lapic_info .xapic .vaddr + offset );
179
183
}
180
184
Original file line number Diff line number Diff line change @@ -174,16 +174,17 @@ _search_nearest_timer(struct per_cpu_timers *cpu_timer)
174
174
static struct timer *
175
175
_search_timer_by_handle (struct per_cpu_timers * cpu_timer , long handle )
176
176
{
177
- struct timer * timer ;
177
+ struct timer * timer = NULL , * tmp ;
178
178
struct list_head * pos ;
179
179
180
180
list_for_each (pos , & cpu_timer -> timer_list ) {
181
- timer = list_entry (pos , struct timer , node );
182
- if (timer -> handle == handle )
183
- goto FOUND ;
181
+ tmp = list_entry (pos , struct timer , node );
182
+ if (tmp -> handle == handle ) {
183
+ timer = tmp ;
184
+ break ;
185
+ }
184
186
}
185
- timer = NULL ;
186
- FOUND :
187
+
187
188
return timer ;
188
189
}
189
190
@@ -296,9 +297,10 @@ static void init_tsc_deadline_timer(void)
296
297
uint32_t val ;
297
298
298
299
val = VECTOR_TIMER ;
299
- val |= 0x40000 ; /* TSC deadline and unmask */
300
- mmio_write_long ( val , LAPIC_BASE + LAPIC_LVT_TIMER_REGISTER );
300
+ val |= APIC_LVTT_TM_TSCDLT ; /* TSC deadline and unmask */
301
+ write_lapic_reg32 ( LAPIC_LVT_TIMER_REGISTER , val );
301
302
asm volatile ("mfence" : : : "memory" );
303
+
302
304
/* disarm timer */
303
305
msr_write (MSR_IA32_TSC_DEADLINE , 0UL );
304
306
}
Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ struct lapic_regs {
179
179
uint32_t tdcr ;
180
180
};
181
181
182
+ void write_lapic_reg32 (uint32_t offset , uint32_t value );
182
183
void save_lapic (struct lapic_regs * regs );
183
184
int early_init_lapic (void );
184
185
int init_lapic (uint32_t cpu_id );
You can’t perform that action at this time.
0 commit comments