Add support to run SMM handler in TSEG instead of ASEG
[coreboot.git] / src / cpu / x86 / name / name.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2009 coresystems GmbH
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19
20 #include <string.h>
21 #include <device/device.h>
22 #include <cpu/cpu.h>
23 #include <cpu/x86/name.h>
24
25 void fill_processor_name(char *processor_name)
26 {
27         struct cpuid_result regs;
28         char temp_processor_name[49];
29         char *processor_name_start;
30         unsigned int *name_as_ints = (unsigned int *)temp_processor_name;
31         int i;
32
33         for (i = 0; i < 3; i++) {
34                 regs = cpuid(0x80000002 + i);
35                 name_as_ints[i * 4 + 0] = regs.eax;
36                 name_as_ints[i * 4 + 1] = regs.ebx;
37                 name_as_ints[i * 4 + 2] = regs.ecx;
38                 name_as_ints[i * 4 + 3] = regs.edx;
39         }
40
41         temp_processor_name[48] = 0;
42
43         /* Skip leading spaces. */
44         processor_name_start = temp_processor_name;
45         while (*processor_name_start == ' ')
46                 processor_name_start++;
47
48         memset(processor_name, 0, 49);
49         strcpy(processor_name, processor_name_start);
50 }