12adcba79SJarkko Sakkinen /* SPDX-License-Identifier: GPL-2.0 */ 22adcba79SJarkko Sakkinen /* 32adcba79SJarkko Sakkinen * Copyright(c) 2016-20 Intel Corporation. 42adcba79SJarkko Sakkinen */ 52adcba79SJarkko Sakkinen 62adcba79SJarkko Sakkinen #ifndef DEFINES_H 72adcba79SJarkko Sakkinen #define DEFINES_H 82adcba79SJarkko Sakkinen 92adcba79SJarkko Sakkinen #include <stdint.h> 102adcba79SJarkko Sakkinen 112adcba79SJarkko Sakkinen #define PAGE_SIZE 4096 122adcba79SJarkko Sakkinen #define PAGE_MASK (~(PAGE_SIZE - 1)) 132adcba79SJarkko Sakkinen 142adcba79SJarkko Sakkinen #define __aligned(x) __attribute__((__aligned__(x))) 152adcba79SJarkko Sakkinen #define __packed __attribute__((packed)) 162adcba79SJarkko Sakkinen 178ca52cc3SSean Christopherson #include "../../../../arch/x86/include/asm/sgx.h" 182adcba79SJarkko Sakkinen #include "../../../../arch/x86/include/asm/enclu.h" 192adcba79SJarkko Sakkinen #include "../../../../arch/x86/include/uapi/asm/sgx.h" 202adcba79SJarkko Sakkinen 2122118ce1SJarkko Sakkinen enum encl_op_type { 22c085dfc7SReinette Chatre ENCL_OP_PUT_TO_BUFFER, 23c085dfc7SReinette Chatre ENCL_OP_GET_FROM_BUFFER, 24abc5cec4SReinette Chatre ENCL_OP_PUT_TO_ADDRESS, 25abc5cec4SReinette Chatre ENCL_OP_GET_FROM_ADDRESS, 26688542e2SReinette Chatre ENCL_OP_NOP, 27*20404a80SReinette Chatre ENCL_OP_EACCEPT, 28*20404a80SReinette Chatre ENCL_OP_EMODPE, 2941493a09SJarkko Sakkinen ENCL_OP_MAX, 3022118ce1SJarkko Sakkinen }; 3122118ce1SJarkko Sakkinen 3241493a09SJarkko Sakkinen struct encl_op_header { 3322118ce1SJarkko Sakkinen uint64_t type; 3441493a09SJarkko Sakkinen }; 3541493a09SJarkko Sakkinen 36c085dfc7SReinette Chatre struct encl_op_put_to_buf { 3741493a09SJarkko Sakkinen struct encl_op_header header; 3841493a09SJarkko Sakkinen uint64_t value; 3941493a09SJarkko Sakkinen }; 4041493a09SJarkko Sakkinen 41c085dfc7SReinette Chatre struct encl_op_get_from_buf { 4241493a09SJarkko Sakkinen struct encl_op_header header; 4341493a09SJarkko Sakkinen uint64_t value; 4422118ce1SJarkko Sakkinen }; 4522118ce1SJarkko Sakkinen 46abc5cec4SReinette Chatre struct encl_op_put_to_addr { 47abc5cec4SReinette Chatre struct encl_op_header header; 48abc5cec4SReinette Chatre uint64_t value; 49abc5cec4SReinette Chatre uint64_t addr; 50abc5cec4SReinette Chatre }; 51abc5cec4SReinette Chatre 52abc5cec4SReinette Chatre struct encl_op_get_from_addr { 53abc5cec4SReinette Chatre struct encl_op_header header; 54abc5cec4SReinette Chatre uint64_t value; 55abc5cec4SReinette Chatre uint64_t addr; 56abc5cec4SReinette Chatre }; 57abc5cec4SReinette Chatre 58*20404a80SReinette Chatre struct encl_op_eaccept { 59*20404a80SReinette Chatre struct encl_op_header header; 60*20404a80SReinette Chatre uint64_t epc_addr; 61*20404a80SReinette Chatre uint64_t flags; 62*20404a80SReinette Chatre uint64_t ret; 63*20404a80SReinette Chatre }; 64*20404a80SReinette Chatre 65*20404a80SReinette Chatre struct encl_op_emodpe { 66*20404a80SReinette Chatre struct encl_op_header header; 67*20404a80SReinette Chatre uint64_t epc_addr; 68*20404a80SReinette Chatre uint64_t flags; 69*20404a80SReinette Chatre }; 70*20404a80SReinette Chatre 712adcba79SJarkko Sakkinen #endif /* DEFINES_H */ 72