summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-01-22 11:29:40 +0800
committerSimon Glass <sjg@chromium.org>2015-01-23 17:24:55 -0700
commit49491669065c1c718d8dc0b0ebc151b3d010c17b (patch)
treea9bfa987044f9d6deb606f787855a9f77ad5e871 /arch/x86
parent566d1754d3a84819d9e2829421898d115ef2c116 (diff)
downloadu-boot-imx-49491669065c1c718d8dc0b0ebc151b3d010c17b.zip
u-boot-imx-49491669065c1c718d8dc0b0ebc151b3d010c17b.tar.gz
u-boot-imx-49491669065c1c718d8dc0b0ebc151b3d010c17b.tar.bz2
x86: Save mtrr support flag in global data
CPUID (EAX 01H) returns MTRR support flag in EDX bit 12. Probe this flag in x86_cpu_init_f() and save it in global data. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/cpu/cpu.c7
-rw-r--r--arch/x86/include/asm/global_data.h13
2 files changed, 14 insertions, 6 deletions
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 30e5069..ed7905c 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -223,6 +223,11 @@ static bool has_cpuid(void)
return flag_is_changeable_p(X86_EFLAGS_ID);
}
+static bool has_mtrr(void)
+{
+ return cpuid_edx(0x00000001) & (1 << 12) ? true : false;
+}
+
static int build_vendor_name(char *vendor_name)
{
struct cpuid_result result;
@@ -318,6 +323,8 @@ int x86_cpu_init_f(void)
gd->arch.x86_model = c.x86_model;
gd->arch.x86_mask = c.x86_mask;
gd->arch.x86_device = cpu.device;
+
+ gd->arch.has_mtrr = has_mtrr();
}
return 0;
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 24e3052..243ed5c 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -44,11 +44,11 @@ struct mtrr_request {
/* Architecture-specific global data */
struct arch_global_data {
- struct global_data *gd_addr; /* Location of Global Data */
- uint8_t x86; /* CPU family */
- uint8_t x86_vendor; /* CPU vendor */
- uint8_t x86_model;
- uint8_t x86_mask;
+ struct global_data *gd_addr; /* Location of Global Data */
+ uint8_t x86; /* CPU family */
+ uint8_t x86_vendor; /* CPU vendor */
+ uint8_t x86_model;
+ uint8_t x86_mask;
uint32_t x86_device;
uint64_t tsc_base; /* Initial value returned by rdtsc() */
uint32_t tsc_base_kclocks; /* Initial tsc as a kclocks value */
@@ -60,10 +60,11 @@ struct arch_global_data {
const struct pch_gpio_map *gpio_map; /* board GPIO map */
struct memory_info meminfo; /* Memory information */
#ifdef CONFIG_HAVE_FSP
- void *hob_list; /* FSP HOB list */
+ void *hob_list; /* FSP HOB list */
#endif
struct mtrr_request mtrr_req[MAX_MTRR_REQUESTS];
int mtrr_req_count;
+ int has_mtrr;
};
#endif