summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/include
diff options
context:
space:
mode:
authorMichael Brown2017-06-15 15:50:20 +0200
committerMichael Brown2017-06-16 02:17:48 +0200
commita6a5825f8d658834610de31b7b9be2e7d0a8804e (patch)
treef51a8b343176bbf7c31483006060e93dc0161924 /src/arch/x86/include
parent[ecm] Display invalid MAC address strings in debug messages (diff)
downloadipxe-a6a5825f8d658834610de31b7b9be2e7d0a8804e.tar.gz
ipxe-a6a5825f8d658834610de31b7b9be2e7d0a8804e.tar.xz
ipxe-a6a5825f8d658834610de31b7b9be2e7d0a8804e.zip
[cpuid] Allow input %ecx value to be specified
For some CPUID leaves (e.g. %eax=0x00000004), the result depends on the input value of %ecx. Allow this subfunction number to be specified as a parameter to the cpuid() wrapper. The subfunction number is exposed via the ${cpuid/...} settings mechanism using the syntax ${cpuid/<subfunction>.0x40.<register>.<function>} e.g. ${cpuid/0.0x40.0.0x0000000b} ${cpuid/1.0x40.0.0x0000000b} to retrieve the CPU topology information. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/include')
-rw-r--r--src/arch/x86/include/ipxe/cpuid.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/arch/x86/include/ipxe/cpuid.h b/src/arch/x86/include/ipxe/cpuid.h
index a9df9f0de..0ae572da4 100644
--- a/src/arch/x86/include/ipxe/cpuid.h
+++ b/src/arch/x86/include/ipxe/cpuid.h
@@ -66,19 +66,20 @@ struct x86_features {
/**
* Issue CPUID instruction
*
- * @v function CPUID function
+ * @v function CPUID function (input via %eax)
+ * @v subfunction CPUID subfunction (input via %ecx)
* @v eax Output via %eax
* @v ebx Output via %ebx
* @v ecx Output via %ecx
* @v edx Output via %edx
*/
static inline __attribute__ (( always_inline )) void
-cpuid ( uint32_t function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx,
- uint32_t *edx ) {
+cpuid ( uint32_t function, uint32_t subfunction, uint32_t *eax, uint32_t *ebx,
+ uint32_t *ecx, uint32_t *edx ) {
__asm__ ( "cpuid"
: "=a" ( *eax ), "=b" ( *ebx ), "=c" ( *ecx ), "=d" ( *edx )
- : "0" ( function ) );
+ : "0" ( function ), "2" ( subfunction ) );
}
extern int cpuid_supported ( uint32_t function );