1 #pragma once 2 3 #include <stdint.h> 4 5 #include <cpuinfo.h> 6 #include <cpuinfo/common.h> 7 8 /* RISC-V Vendor IDs. */ 9 enum cpuinfo_riscv_chipset_vendor { 10 cpuinfo_riscv_chipset_vendor_unknown = 0, 11 cpuinfo_riscv_chipset_vendor_sifive = 0x489, 12 cpuinfo_riscv_chipset_vendor_max, 13 }; 14 15 /* RISC-V Architecture IDs. */ 16 enum cpuinfo_riscv_chipset_arch { 17 cpuinfo_riscv_chipset_arch_unknown = 0, 18 cpuinfo_riscv_chipset_arch_max, 19 }; 20 21 /* RISC-V Implementation IDs. */ 22 enum cpuinfo_riscv_chipset_impl { 23 cpuinfo_riscv_chipset_impl_unknown = 0, 24 cpuinfo_riscv_chipset_impl_max, 25 }; 26 27 /** 28 * Decodes the vendor and micro-architecture based on the provided input 29 * parameters, regardless of underlying operating system. 30 * 31 * @param[vendor_id]: The 'mvendorid' as described by the RISC-V Manual. 32 * @param[arch_id]: The 'marchid' as described by the RISC-V Manual. 33 * @param[imp_id]: The 'mimplid' as described by the RISC-V Manual. 34 * @param[vendor] - Reference to the cpuinfo_vendor to populate. 35 * @param[uarch] - Reference to the cpuinfo_uarch to populate. 36 */ 37 CPUINFO_INTERNAL void cpuinfo_riscv_decode_vendor_uarch( 38 uint32_t vendor_id, 39 uint32_t arch_id, 40 uint32_t imp_id, 41 enum cpuinfo_vendor vendor[restrict static 1], 42 enum cpuinfo_uarch uarch[restrict static 1]); 43