Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67753
b: refs/heads/master
c: 8017409
h: refs/heads/master
i:
  67751: 76c97dd
v: v3
  • Loading branch information
Thomas Gleixner authored and Thomas Gleixner committed Oct 12, 2007
1 parent c510056 commit 9e33cf2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ffeeb1e03c4fc1c7e8434c5496018dd035f8924
refs/heads/master: 801740971af7c6256b7ad2472706d43ed008fd3d
23 changes: 15 additions & 8 deletions trunk/arch/x86/kernel/apic_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,14 +759,14 @@ void __init init_apic_mappings(void)

#define APIC_DIVISOR 16

static void __setup_APIC_LVTT(unsigned int clocks)
static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
{
unsigned int lvtt_value, tmp_value;
int cpu = smp_processor_id();

lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR;

if (cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask))
lvtt_value = LOCAL_TIMER_VECTOR;
if (!oneshot)
lvtt_value |= APIC_LVT_TIMER_PERIODIC;
if (!irqen)
lvtt_value |= APIC_LVT_MASKED;

apic_write(APIC_LVTT, lvtt_value);
Expand All @@ -779,12 +779,14 @@ static void __setup_APIC_LVTT(unsigned int clocks)
& ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE))
| APIC_TDR_DIV_16);

apic_write(APIC_TMICT, clocks/APIC_DIVISOR);
if (!oneshot)
apic_write(APIC_TMICT, clocks/APIC_DIVISOR);
}

static void setup_APIC_timer(unsigned int clocks)
{
unsigned long flags;
int irqen;

local_irq_save(flags);

Expand All @@ -805,7 +807,10 @@ static void setup_APIC_timer(unsigned int clocks)
c2 |= inb_p(0x40) << 8;
} while (c2 - c1 < 300);
}
__setup_APIC_LVTT(clocks);

irqen = ! cpu_isset(smp_processor_id(),
timer_interrupt_broadcast_ipi_mask);
__setup_APIC_LVTT(clocks, 0, irqen);
/* Turn off PIT interrupt if we use APIC timer as main timer.
Only works with the PM timer right now
TBD fix it for HPET too. */
Expand Down Expand Up @@ -843,8 +848,10 @@ static int __init calibrate_APIC_clock(void)
* Put whatever arbitrary (but long enough) timeout
* value into the APIC clock, we just want to get the
* counter running for calibration.
*
* No interrupt enable !
*/
__setup_APIC_LVTT(4000000000);
__setup_APIC_LVTT(4000000000, 0, 0);

apic_start = apic_read(APIC_TMCCT);
#ifdef CONFIG_X86_PM_TIMER
Expand Down

0 comments on commit 9e33cf2

Please sign in to comment.