]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
cpuid: Collect and expose max_{,extd_}leaf with other cpuid information
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Apr 2017 17:33:25 +0000 (18:33 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Apr 2017 17:33:25 +0000 (18:33 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/include/arch/cpuid.h
arch/x86/setup.c

index 2d5bce1281e64b9d89e3ebf5ec973712053c3088..bff55d46be35c3e04d3d87e4f7b02da1f92d2162 100644 (file)
@@ -21,6 +21,7 @@ enum x86_vendor
 };
 
 extern enum x86_vendor x86_vendor;
+extern unsigned int max_leaf, max_extd_leaf;
 extern unsigned int x86_family, x86_model, x86_stepping;
 extern unsigned int maxphysaddr, maxvirtaddr;
 
index 45fef99dc9276f94d5858d0734b37865d62a0d8c..f057aee0360d0cbff2efaefb7a94b4fbf49f4985 100644 (file)
@@ -20,6 +20,7 @@ uint8_t boot_stack[3 * PAGE_SIZE] __aligned(PAGE_SIZE);
 uint8_t user_stack[PAGE_SIZE] __aligned(PAGE_SIZE);
 uint32_t x86_features[FSCAPINTS];
 enum x86_vendor x86_vendor;
+unsigned int max_leaf, max_extd_leaf;
 unsigned int x86_family, x86_model, x86_stepping;
 unsigned int maxphysaddr, maxvirtaddr;
 
@@ -32,9 +33,9 @@ start_info_t *start_info = NULL;
 
 static void collect_cpuid(cpuid_count_fn_t cpuid_fn)
 {
-    unsigned int max, tmp, eax, ebx, ecx, edx, addr = 0;
+    unsigned int tmp, eax, ebx, ecx, edx, addr = 0;
 
-    cpuid_fn(0, 0, &max, &ebx, &ecx, &edx);
+    cpuid_fn(0, 0, &max_leaf, &ebx, &ecx, &edx);
 
     if ( ebx == 0x756e6547u &&      /* "GenuineIntel" */
          ecx == 0x6c65746eu &&
@@ -49,7 +50,7 @@ static void collect_cpuid(cpuid_count_fn_t cpuid_fn)
     else
         x86_vendor = X86_VENDOR_UNKNOWN;
 
-    if ( max >= 1 )
+    if ( max_leaf >= 1 )
     {
         cpuid_fn(1, 0, &eax, &tmp,
                  &x86_features[FEATURESET_1c],
@@ -66,28 +67,28 @@ static void collect_cpuid(cpuid_count_fn_t cpuid_fn)
         if ( x86_family == 0xf )
             x86_family += (eax >> 20) & 0xff;
     }
-    if ( max >= 7 )
+    if ( max_leaf >= 7 )
         cpuid_fn(7, 0, &tmp,
                  &x86_features[FEATURESET_7b0],
                  &x86_features[FEATURESET_7c0],
                  &tmp);
-    if ( max >= 0xd )
+    if ( max_leaf >= 0xd )
         cpuid_fn(0xd, 0,
                  &x86_features[FEATURESET_Da1],
                  &tmp, &tmp, &tmp);
 
-    cpuid_fn(0x80000000, 0, &max, &tmp, &tmp, &tmp);
+    cpuid_fn(0x80000000, 0, &max_extd_leaf, &tmp, &tmp, &tmp);
 
-    if ( (max >> 16) == 0x8000 )
+    if ( (max_extd_leaf >> 16) == 0x8000 )
     {
-        if ( max >= 0x80000001 )
+        if ( max_extd_leaf >= 0x80000001 )
             cpuid_fn(0x80000001, 0, &tmp, &tmp,
                      &x86_features[FEATURESET_e1c],
                      &x86_features[FEATURESET_e1d]);
-        if ( max >= 0x80000007 )
+        if ( max_extd_leaf >= 0x80000007 )
             cpuid_fn(0x80000007, 0, &tmp, &tmp, &tmp,
                      &x86_features[FEATURESET_e7d]);
-        if ( max >= 0x80000008 )
+        if ( max_extd_leaf >= 0x80000008 )
             cpuid_fn(0x80000008, 0, &addr,
                      &x86_features[FEATURESET_e8b],
                      &tmp, &tmp);