ACPI / LPSS: Make acpi_lpss_find_device() also find PCI devices
[linux/fpc-iii.git] / arch / x86 / include / asm / intel_pconfig.h
blob3cb002b1d0f930b3751d9a34b9e6720db5780415
1 #ifndef _ASM_X86_INTEL_PCONFIG_H
2 #define _ASM_X86_INTEL_PCONFIG_H
4 #include <asm/asm.h>
5 #include <asm/processor.h>
7 enum pconfig_target {
8 INVALID_TARGET = 0,
9 MKTME_TARGET = 1,
10 PCONFIG_TARGET_NR
13 int pconfig_target_supported(enum pconfig_target target);
15 enum pconfig_leaf {
16 MKTME_KEY_PROGRAM = 0,
17 PCONFIG_LEAF_INVALID,
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 {
43 u16 keyid;
44 u32 keyid_ctrl;
45 u8 __rsvd[58];
46 u8 key_field_1[64];
47 u8 key_field_2[64];
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))
55 return -ENXIO;
57 asm volatile(PCONFIG
58 : "=a" (rax), "=b" (key_program)
59 : "0" (rax), "1" (key_program)
60 : "memory", "cc");
62 return rax;
65 #endif /* _ASM_X86_INTEL_PCONFIG_H */