Martin Roth | 6add44b | 2017-02-09 17:51:20 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; version 2 of the License. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
Kyösti Mälkki | 5a5c886 | 2014-01-26 14:41:54 +0200 | [diff] [blame] | 14 | #include <smp/node.h> |
Eric Biederman | fcd5ace | 2004-10-14 19:29:29 +0000 | [diff] [blame] | 15 | #include <cpu/x86/msr.h> |
Elyes HAOUAS | a9473ec | 2018-10-24 15:55:53 +0200 | [diff] [blame] | 16 | #include <cpu/x86/lapic_def.h> |
Eric Biederman | fcd5ace | 2004-10-14 19:29:29 +0000 | [diff] [blame] | 17 | |
Martin Roth | 0fa92b3 | 2017-06-24 13:53:20 -0600 | [diff] [blame] | 18 | #if IS_ENABLED(CONFIG_SMP) |
Stefan Reinauer | 00093a8 | 2011-11-02 16:12:34 -0700 | [diff] [blame] | 19 | int boot_cpu(void) |
Eric Biederman | fcd5ace | 2004-10-14 19:29:29 +0000 | [diff] [blame] | 20 | { |
| 21 | int bsp; |
| 22 | msr_t msr; |
Elyes HAOUAS | a9473ec | 2018-10-24 15:55:53 +0200 | [diff] [blame] | 23 | msr = rdmsr(LAPIC_BASE_MSR); |
Eric Biederman | fcd5ace | 2004-10-14 19:29:29 +0000 | [diff] [blame] | 24 | bsp = !!(msr.lo & (1 << 8)); |
| 25 | return bsp; |
| 26 | } |
Kyösti Mälkki | eafb18b | 2011-11-22 19:44:45 +0200 | [diff] [blame] | 27 | #endif |