diff options
| author | Michael Brown | 2012-06-06 17:08:24 +0200 |
|---|---|---|
| committer | Michael Brown | 2012-06-07 01:37:04 +0200 |
| commit | 591541af667dbf3617b81d89f92abf01e9e1a16d (patch) | |
| tree | 5f1a4e31c91b9d3533e9167b6252d0ba0724860d /src/arch/x86/include | |
| parent | [contrib] Update bochsrc.txt to latest version of bochs (diff) | |
| download | ipxe-591541af667dbf3617b81d89f92abf01e9e1a16d.tar.gz ipxe-591541af667dbf3617b81d89f92abf01e9e1a16d.tar.xz ipxe-591541af667dbf3617b81d89f92abf01e9e1a16d.zip | |
[cmdline] Add "cpuid" command
Allow x86 CPU feature flags (such as support for 64-bit mode) to be
checked using the "cpuid" command.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/include')
| -rw-r--r-- | src/arch/x86/include/bits/errfile.h | 6 | ||||
| -rw-r--r-- | src/arch/x86/include/ipxe/cpuid.h | 53 |
2 files changed, 57 insertions, 2 deletions
diff --git a/src/arch/x86/include/bits/errfile.h b/src/arch/x86/include/bits/errfile.h index ccf00b86b..f66cbaa1a 100644 --- a/src/arch/x86/include/bits/errfile.h +++ b/src/arch/x86/include/bits/errfile.h @@ -38,8 +38,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define ERRFILE_undionly ( ERRFILE_ARCH | ERRFILE_NET | 0x00030000 ) #define ERRFILE_undirom ( ERRFILE_ARCH | ERRFILE_NET | 0x00040000 ) -#define ERRFILE_timer_rdtsc ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00000000 ) -#define ERRFILE_timer_bios ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00010000 ) +#define ERRFILE_timer_rdtsc ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00000000 ) +#define ERRFILE_timer_bios ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00010000 ) + +#define ERRFILE_cpuid_cmd ( ERRFILE_ARCH | ERRFILE_OTHER | 0x00000000 ) /** @} */ diff --git a/src/arch/x86/include/ipxe/cpuid.h b/src/arch/x86/include/ipxe/cpuid.h new file mode 100644 index 000000000..9705137c6 --- /dev/null +++ b/src/arch/x86/include/ipxe/cpuid.h @@ -0,0 +1,53 @@ +#ifndef _IPXE_CPUID_H +#define _IPXE_CPUID_H + +/** @file + * + * x86 CPU feature detection + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include <stdint.h> + +/** An x86 CPU feature register set */ +struct x86_feature_registers { + /** Features returned via %ecx */ + uint32_t ecx; + /** Features returned via %edx */ + uint32_t edx; +}; + +/** x86 CPU features */ +struct x86_features { + /** Intel-defined features (%eax=0x00000001) */ + struct x86_feature_registers intel; + /** AMD-defined features (%eax=0x80000001) */ + struct x86_feature_registers amd; +}; + +/** CPUID support flag */ +#define CPUID_FLAG 0x00200000UL + +/** Get vendor ID and largest standard function */ +#define CPUID_VENDOR_ID 0x00000000UL + +/** Get standard features */ +#define CPUID_FEATURES 0x00000001UL + +/** Get largest extended function */ +#define CPUID_AMD_MAX_FN 0x80000000UL + +/** Extended function existence check */ +#define CPUID_AMD_CHECK 0x80000000UL + +/** Extended function existence check mask */ +#define CPUID_AMD_CHECK_MASK 0xffff0000UL + +/** Get extended features */ +#define CPUID_AMD_FEATURES 0x80000001UL + +extern void x86_features ( struct x86_features *features ); + +#endif /* _IPXE_CPUID_H */ |
