1 #ifndef _ASM_X86_INTEL_PCONFIG_H
2 #define _ASM_X86_INTEL_PCONFIG_H
5 #include <asm/processor.h>
13 int pconfig_target_supported(enum pconfig_target target
);
16 MKTME_KEY_PROGRAM
= 0,
20 #define PCONFIG ".byte 0x0f, 0x01, 0xc5"
22 /* Defines and structure for MKTME_KEY_PROGRAM of PCONFIG instruction */
24 /* mktme_key_program::keyid_ctrl COMMAND, bits [7:0] */
25 #define MKTME_KEYID_SET_KEY_DIRECT 0
26 #define MKTME_KEYID_SET_KEY_RANDOM 1
27 #define MKTME_KEYID_CLEAR_KEY 2
28 #define MKTME_KEYID_NO_ENCRYPT 3
30 /* mktme_key_program::keyid_ctrl ENC_ALG, bits [23:8] */
31 #define MKTME_AES_XTS_128 (1 << 8)
33 /* Return codes from the PCONFIG MKTME_KEY_PROGRAM */
34 #define MKTME_PROG_SUCCESS 0
35 #define MKTME_INVALID_PROG_CMD 1
36 #define MKTME_ENTROPY_ERROR 2
37 #define MKTME_INVALID_KEYID 3
38 #define MKTME_INVALID_ENC_ALG 4
39 #define MKTME_DEVICE_BUSY 5
41 /* Hardware requires the structure to be 256 byte alinged. Otherwise #GP(0). */
42 struct mktme_key_program
{
48 } __packed
__aligned(256);
50 static inline int mktme_key_program(struct mktme_key_program
*key_program
)
52 unsigned long rax
= MKTME_KEY_PROGRAM
;
54 if (!pconfig_target_supported(MKTME_TARGET
))
58 : "=a" (rax
), "=b" (key_program
)
59 : "0" (rax
), "1" (key_program
)
65 #endif /* _ASM_X86_INTEL_PCONFIG_H */