consistency.
This commit is contained in:
parent
5cb7877e0f
commit
5c596bb3a7
2 changed files with 45 additions and 42 deletions
10
ioapic.c
10
ioapic.c
|
@ -37,7 +37,9 @@ ioapic_init(void)
|
||||||
uchar id;
|
uchar id;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ismp) {
|
if (!ismp)
|
||||||
|
return;
|
||||||
|
|
||||||
io = (struct ioapic*) IO_APIC_BASE;
|
io = (struct ioapic*) IO_APIC_BASE;
|
||||||
l = ioapic_read(io, IOAPIC_VER);
|
l = ioapic_read(io, IOAPIC_VER);
|
||||||
nintr = ((l & IOART_VER_MAXREDIR) >> MAXREDIRSHIFT) + 1;
|
nintr = ((l & IOART_VER_MAXREDIR) >> MAXREDIRSHIFT) + 1;
|
||||||
|
@ -62,7 +64,6 @@ ioapic_init(void)
|
||||||
ioapic_write(io, IOAPIC_REDTBL_HI(i), h);
|
ioapic_write(io, IOAPIC_REDTBL_HI(i), h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ioapic_enable (int irq, int cpunum)
|
ioapic_enable (int irq, int cpunum)
|
||||||
|
@ -70,7 +71,9 @@ ioapic_enable (int irq, int cpunum)
|
||||||
uint l, h;
|
uint l, h;
|
||||||
struct ioapic *io;
|
struct ioapic *io;
|
||||||
|
|
||||||
if (ismp) {
|
if (!ismp)
|
||||||
|
return;
|
||||||
|
|
||||||
io = (struct ioapic*) IO_APIC_BASE;
|
io = (struct ioapic*) IO_APIC_BASE;
|
||||||
l = ioapic_read(io, IOAPIC_REDTBL_LO(irq));
|
l = ioapic_read(io, IOAPIC_REDTBL_LO(irq));
|
||||||
l = l & ~IOART_INTMASK; // allow INTs
|
l = l & ~IOART_INTMASK; // allow INTs
|
||||||
|
@ -80,4 +83,3 @@ ioapic_enable (int irq, int cpunum)
|
||||||
h |= (cpunum << APIC_ID_SHIFT);
|
h |= (cpunum << APIC_ID_SHIFT);
|
||||||
ioapic_write(io, IOAPIC_REDTBL_HI(irq), h);
|
ioapic_write(io, IOAPIC_REDTBL_HI(irq), h);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
7
lapic.c
7
lapic.c
|
@ -105,14 +105,15 @@ lapic_write(int r, int data)
|
||||||
void
|
void
|
||||||
lapic_timerinit(void)
|
lapic_timerinit(void)
|
||||||
{
|
{
|
||||||
if (lapicaddr) {
|
if (!lapicaddr)
|
||||||
|
return;
|
||||||
|
|
||||||
lapic_write(LAPIC_TDCR, LAPIC_X1);
|
lapic_write(LAPIC_TDCR, LAPIC_X1);
|
||||||
lapic_write(LAPIC_TIMER, LAPIC_CLKIN | LAPIC_PERIODIC |
|
lapic_write(LAPIC_TIMER, LAPIC_CLKIN | LAPIC_PERIODIC |
|
||||||
(IRQ_OFFSET + IRQ_TIMER));
|
(IRQ_OFFSET + IRQ_TIMER));
|
||||||
lapic_write(LAPIC_TCCR, 10000000);
|
lapic_write(LAPIC_TCCR, 10000000);
|
||||||
lapic_write(LAPIC_TICR, 10000000);
|
lapic_write(LAPIC_TICR, 10000000);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
lapic_timerintr(void)
|
lapic_timerintr(void)
|
||||||
|
@ -126,7 +127,7 @@ lapic_init(int c)
|
||||||
{
|
{
|
||||||
uint r, lvt;
|
uint r, lvt;
|
||||||
|
|
||||||
if (lapicaddr == 0)
|
if (!lapicaddr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lapic_write(LAPIC_DFR, 0xFFFFFFFF); // Set dst format register
|
lapic_write(LAPIC_DFR, 0xFFFFFFFF); // Set dst format register
|
||||||
|
|
Loading…
Reference in a new issue