1/* 2 * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. 3 * 4 * Licensed under the Apache License 2.0 (the "License"). You may not use 5 * this file except in compliance with the License. You can obtain a copy 6 * in the file LICENSE in the source distribution or at 7 * https://www.openssl.org/source/license.html 8 */ 9 10/* X Macro Definitions for Specification of RISC-V Arch Capabilities */ 11 12/* 13 * Each RISC-V capability ends up encoded as a single set bit in an array of 14 * words. When specifying a new capability, write a new RISCV_DEFINE_CAP 15 * statement, with an argument as the extension name in all-caps, 16 * second argument as the index in the array where the capability will be stored 17 * and third argument as the index of the bit to be used to encode the 18 * capability. 19 * 20 * The fourth and the fifth arguments are copied from linux header asm/hwprobe.h. 21 * Directly coping values instead of macro names comes from the fact 22 * that an old version may lack definition of some macro. 23 * When there is no hwprobe key/value pair for a capability, the key is set to -1 24 * and the value is set to 0, as when the hwprobe syscall returns a key of -1, 25 * the value is set to 0 and the corresponding capability would not be enabled. 26 * 27 * RISCV_DEFINE_CAP(EXTENSION NAME, array index, bit index, hwprobe key, hwprobe value) */ 28 29RISCV_DEFINE_CAP(ZBA, 0, 0, 4, (1 << 3)) 30RISCV_DEFINE_CAP(ZBB, 0, 1, 4, (1 << 4)) 31RISCV_DEFINE_CAP(ZBC, 0, 2, 4, (1 << 7)) 32RISCV_DEFINE_CAP(ZBS, 0, 3, 4, (1 << 5)) 33RISCV_DEFINE_CAP(ZBKB, 0, 4, 4, (1 << 8)) 34RISCV_DEFINE_CAP(ZBKC, 0, 5, 4, (1 << 9)) 35RISCV_DEFINE_CAP(ZBKX, 0, 6, 4, (1 << 10)) 36RISCV_DEFINE_CAP(ZKND, 0, 7, 4, (1 << 11)) 37RISCV_DEFINE_CAP(ZKNE, 0, 8, 4, (1 << 12)) 38RISCV_DEFINE_CAP(ZKNH, 0, 9, 4, (1 << 13)) 39RISCV_DEFINE_CAP(ZKSED, 0, 10, 4, (1 << 14)) 40RISCV_DEFINE_CAP(ZKSH, 0, 11, 4, (1 << 15)) 41RISCV_DEFINE_CAP(ZKR, 0, 12, -1, 0) 42RISCV_DEFINE_CAP(ZKT, 0, 13, 4, (1 << 16)) 43RISCV_DEFINE_CAP(V, 0, 14, 4, (1 << 2)) 44RISCV_DEFINE_CAP(ZVBB, 0, 15, 4, (1 << 17)) 45RISCV_DEFINE_CAP(ZVBC, 0, 16, 4, (1 << 18)) 46RISCV_DEFINE_CAP(ZVKB, 0, 17, 4, (1 << 19)) 47RISCV_DEFINE_CAP(ZVKG, 0, 18, 4, (1 << 20)) 48RISCV_DEFINE_CAP(ZVKNED, 0, 19, 4, (1 << 21)) 49RISCV_DEFINE_CAP(ZVKNHA, 0, 20, 4, (1 << 22)) 50RISCV_DEFINE_CAP(ZVKNHB, 0, 21, 4, (1 << 23)) 51RISCV_DEFINE_CAP(ZVKSED, 0, 22, 4, (1 << 24)) 52RISCV_DEFINE_CAP(ZVKSH, 0, 23, 4, (1 << 25)) 53 54/* 55 * In the future ... 56 * RISCV_DEFINE_CAP(ZFOO, 0, 31, ..., ...) 57 * RISCV_DEFINE_CAP(ZBAR, 1, 0, ..., ...) 58 * ... and so on. 59 */ 60 61#undef RISCV_DEFINE_CAP 62