X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vppinfra%2Fvppinfra%2Fcpu.c;h=70b39214817e3e1a8daed121e045f2902232fa73;hb=ed1c1835043a1d266a5928c40f41b340f6c968d7;hp=852f9869c737b796b917aa6d4e97ba8f08eef4bb;hpb=522e4864b9b8b6751a9cb35ad8f1926f5d162837;p=vpp.git diff --git a/vppinfra/vppinfra/cpu.c b/vppinfra/vppinfra/cpu.c index 852f9869c73..70b39214817 100644 --- a/vppinfra/vppinfra/cpu.c +++ b/vppinfra/vppinfra/cpu.c @@ -16,11 +16,8 @@ #include #include -#if __x86_64__ -#include -#endif - #define foreach_x86_cpu_uarch \ + _(0x06, 0x4f, "Broadwell", "Broadwell-EP/EX") \ _(0x06, 0x3d, "Broadwell", "Broadwell") \ _(0x06, 0x3f, "Haswell", "Haswell-E") \ _(0x06, 0x3c, "Haswell", "Haswell") \ @@ -45,7 +42,7 @@ u8 * format_cpu_uarch (u8 * s, va_list * args) { #if __x86_64__ - u32 __attribute__((unused)) eax, ebx, ecx, edx; + u32 __attribute__ ((unused)) eax, ebx, ecx, edx; u8 model, family; if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0) @@ -57,7 +54,7 @@ format_cpu_uarch (u8 * s, va_list * args) #define _(f,m,a,c) if ((model == m) && (family == f)) return format(s, "%s (%s)", a, c); foreach_x86_cpu_uarch #undef _ - return format (s, "unknown (family 0x%02x model 0x%02x)", family, model); + return format (s, "unknown (family 0x%02x model 0x%02x)", family, model); #else /* ! __x86_64__ */ return format (s, "unknown"); @@ -68,9 +65,9 @@ u8 * format_cpu_model_name (u8 * s, va_list * args) { #if __x86_64__ - u32 __attribute__((unused)) eax, ebx, ecx, edx; - u8 * name = 0; - u32 * name_u32; + u32 __attribute__ ((unused)) eax, ebx, ecx, edx; + u8 *name = 0; + u32 *name_u32; if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0) return format (s, "unknown (missing cpuid)"); @@ -79,7 +76,7 @@ format_cpu_model_name (u8 * s, va_list * args) if (eax < 0x80000004) return format (s, "unknown (missing ext feature)"); - vec_validate(name, 48); + vec_validate (name, 48); name_u32 = (u32 *) name; __get_cpuid (0x80000002, &eax, &ebx, &ecx, &edx); @@ -101,10 +98,34 @@ format_cpu_model_name (u8 * s, va_list * args) name_u32[11] = edx; s = format (s, "%s", name); - vec_free(name); + vec_free (name); return s; #else /* ! __x86_64__ */ return format (s, "unknown"); #endif -} \ No newline at end of file +} + +u8 * +format_cpu_flags (u8 * s, va_list * args) +{ +#if __x86_64__ +#define _(flag, func, reg, bit) \ + if (clib_cpu_supports_ ## flag()) \ + s = format (s, #flag " "); + foreach_x86_64_flags return s; +#undef _ +#else /* ! __x86_64__ */ + return format (s, "unknown"); +#endif +} + + + +/* + * fd.io coding-style-patch-verification: ON + * + * Local Variables: + * eval: (c-set-style "gnu") + * End: + */