X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fcpuid%2Fcpuid.h;h=7bf903a6db397af69c454cd20eab3a061d1b084a;hb=efd79fad55845cf71f822cda6b334a2b9eb27baf;hp=305d69aa3a801e694d1ccff8cfda6b262b4015c9;hpb=659efe73b8aa2cf479a8e13f81752b47d1154afc;p=ccan diff --git a/ccan/cpuid/cpuid.h b/ccan/cpuid/cpuid.h index 305d69aa..7bf903a6 100644 --- a/ccan/cpuid/cpuid.h +++ b/ccan/cpuid/cpuid.h @@ -26,7 +26,7 @@ #include /** - * enum cpuid - stuff to get information on from the CPU. + * enum cpuid - stuff to get information about from the CPU. * * This is used as a parameter in cpuid(). * @@ -69,7 +69,7 @@ typedef enum cpuid { CPU_HIGHEST_EXTENDED_FUNCTION_SUPPORTED = 0x80000000, CPU_EXTENDED_PROC_INFO_FEATURE_BITS = 0x80000001, - CPU_PROC_BRAND_STRING = 0x80000002, + CPU_PROC_BRAND_STRING = 0x80000002, CPU_L1_CACHE_AND_TLB_IDS = 0x80000005, CPU_EXTENDED_L2_CACHE_FEATURES = 0x80000006, CPU_ADV_POWER_MGT_INFO = 0x80000007, @@ -124,14 +124,17 @@ typedef enum cputype { * * See also: cpuid_get_cpu_type_string() */ +#define is_intel_cpu() cpuid_get_cpu_type() == CT_INTEL +#define is_amd_cpu() cpuid_get_cpu_type() == CT_AMDK5 || cpuid_get_cpu_type() == CT_AMD cputype_t cpuid_get_cpu_type(void); /** - * cpuid_get_cpu_type_string - Get CPU Type string + * cpuid_sprintf_cputype - Get CPU Type string + * @cputype: a char of atleast 12 bytes in it. * - * Returns the CPU type string based off cputype_t. + * Returns true on success, false on failure */ -const char *cpuid_get_cpu_type_string(const cputype_t cputype); +bool cpuid_sprintf_cputype(const cputype_t cputype, char *buf); /** * cpuid_is_supported - test if the CPUID instruction is supported @@ -205,8 +208,14 @@ uint32_t cpuid_highest_ext_func_supported(void); * For CPU_EXTENDED_PROC_INFO_FEATURE_BITS: * Returns them in buf[0] and buf[1]. * + * For CPU_EXTENDED_L2_CACHE_FEATURES: + * buf[0]: Line size + * buf[1]: Associativity + * buf[2]: Cache size. + * * For CPU_VIRT_PHYS_ADDR_SIZES: - * Returns it as an integer in *buf. + * buf[0]: Physical + * buf[1]: Virtual * * For CPU_PROC_BRAND_STRING: * Have a char array with at least 48 bytes assigned to it. @@ -269,4 +278,3 @@ bool cpuid_has_feature(int feature, bool extended); #endif #endif -