8bad6d2f90
Fix the following errors and warning detected by checkpatch.pl: ERROR: spaces required around that '=' (ctx:VxV) ERROR: space prohibited after that open parenthesis '(' ERROR: need consistent spacing around '|' (ctx:WxV) ERROR: need consistent spacing around '|' (ctx:VxW) ERROR: spaces required around that '=' (ctx:VxV) ERROR: spaces required around that '==' (ctx:VxV) ERROR: spaces required around that ':' (ctx:ExV) WARNING: space prohibited between function name and open parenthesis '(' TEST=Build and run on Galileo Gen2 Change-Id: I61d08055b207c607d5b7d72b0094ad8e24fbd106 Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com> Reviewed-on: https://review.coreboot.org/18840 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
85 lines
2.5 KiB
C
85 lines
2.5 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <cpu/x86/lapic.h>
|
|
#include <console/console.h>
|
|
#include <cpu/x86/msr.h>
|
|
#include <cpu/x86/mtrr.h>
|
|
|
|
void setup_lapic(void)
|
|
{
|
|
/* this is so interrupts work. This is very limited scope --
|
|
* linux will do better later, we hope ...
|
|
*/
|
|
/* this is the first way we learned to do it. It fails on real SMP
|
|
* stuff. So we have to do things differently ...
|
|
* see the Intel mp1.4 spec, page A-3
|
|
*/
|
|
|
|
#if NEED_LAPIC == 1
|
|
/* Only Pentium Pro and later have those MSR stuff */
|
|
msr_t msr;
|
|
|
|
printk(BIOS_INFO, "Setting up local APIC...");
|
|
|
|
/* Enable the local APIC */
|
|
msr = rdmsr(LAPIC_BASE_MSR);
|
|
msr.lo |= LAPIC_BASE_MSR_ENABLE;
|
|
msr.lo &= ~LAPIC_BASE_MSR_ADDR_MASK;
|
|
msr.lo |= LAPIC_DEFAULT_BASE;
|
|
wrmsr(LAPIC_BASE_MSR, msr);
|
|
|
|
/*
|
|
* Set Task Priority to 'accept all'.
|
|
*/
|
|
lapic_write_around(LAPIC_TASKPRI,
|
|
lapic_read_around(LAPIC_TASKPRI) & ~LAPIC_TPRI_MASK);
|
|
|
|
/* Put the local APIC in virtual wire mode */
|
|
lapic_write_around(LAPIC_SPIV,
|
|
(lapic_read_around(LAPIC_SPIV) & ~(LAPIC_VECTOR_MASK))
|
|
| LAPIC_SPIV_ENABLE);
|
|
lapic_write_around(LAPIC_LVT0,
|
|
(lapic_read_around(LAPIC_LVT0) &
|
|
~(LAPIC_LVT_MASKED | LAPIC_LVT_LEVEL_TRIGGER |
|
|
LAPIC_LVT_REMOTE_IRR | LAPIC_INPUT_POLARITY |
|
|
LAPIC_SEND_PENDING | LAPIC_LVT_RESERVED_1 |
|
|
LAPIC_DELIVERY_MODE_MASK))
|
|
| (LAPIC_LVT_REMOTE_IRR | LAPIC_SEND_PENDING |
|
|
LAPIC_DELIVERY_MODE_EXTINT)
|
|
);
|
|
lapic_write_around(LAPIC_LVT1,
|
|
(lapic_read_around(LAPIC_LVT1) &
|
|
~(LAPIC_LVT_MASKED | LAPIC_LVT_LEVEL_TRIGGER |
|
|
LAPIC_LVT_REMOTE_IRR | LAPIC_INPUT_POLARITY |
|
|
LAPIC_SEND_PENDING | LAPIC_LVT_RESERVED_1 |
|
|
LAPIC_DELIVERY_MODE_MASK))
|
|
| (LAPIC_LVT_REMOTE_IRR | LAPIC_SEND_PENDING |
|
|
LAPIC_DELIVERY_MODE_NMI)
|
|
);
|
|
|
|
printk(BIOS_DEBUG, " apic_id: 0x%02lx ", lapicid());
|
|
|
|
#else /* !NEED_LAPIC */
|
|
/* Only Pentium Pro and later have those MSR stuff */
|
|
msr_t msr;
|
|
|
|
printk(BIOS_INFO, "Disabling local APIC...");
|
|
|
|
msr = rdmsr(LAPIC_BASE_MSR);
|
|
msr.lo &= ~LAPIC_BASE_MSR_ENABLE;
|
|
wrmsr(LAPIC_BASE_MSR, msr);
|
|
#endif /* !NEED_LAPIC */
|
|
printk(BIOS_INFO, "done.\n");
|
|
post_code(0x9b);
|
|
}
|