18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org) 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Modifications for ppc64: 68c2ecf20Sopenharmony_ci * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#ifndef __ASM_POWERPC_FIRMWARE_H 98c2ecf20Sopenharmony_ci#define __ASM_POWERPC_FIRMWARE_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifdef __KERNEL__ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <asm/asm-const.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* firmware feature bitmask values */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define FW_FEATURE_PFT ASM_CONST(0x0000000000000001) 188c2ecf20Sopenharmony_ci#define FW_FEATURE_TCE ASM_CONST(0x0000000000000002) 198c2ecf20Sopenharmony_ci#define FW_FEATURE_SPRG0 ASM_CONST(0x0000000000000004) 208c2ecf20Sopenharmony_ci#define FW_FEATURE_DABR ASM_CONST(0x0000000000000008) 218c2ecf20Sopenharmony_ci#define FW_FEATURE_COPY ASM_CONST(0x0000000000000010) 228c2ecf20Sopenharmony_ci#define FW_FEATURE_ASR ASM_CONST(0x0000000000000020) 238c2ecf20Sopenharmony_ci#define FW_FEATURE_DEBUG ASM_CONST(0x0000000000000040) 248c2ecf20Sopenharmony_ci#define FW_FEATURE_TERM ASM_CONST(0x0000000000000080) 258c2ecf20Sopenharmony_ci#define FW_FEATURE_PERF ASM_CONST(0x0000000000000100) 268c2ecf20Sopenharmony_ci#define FW_FEATURE_DUMP ASM_CONST(0x0000000000000200) 278c2ecf20Sopenharmony_ci#define FW_FEATURE_INTERRUPT ASM_CONST(0x0000000000000400) 288c2ecf20Sopenharmony_ci#define FW_FEATURE_MIGRATE ASM_CONST(0x0000000000000800) 298c2ecf20Sopenharmony_ci#define FW_FEATURE_PERFMON ASM_CONST(0x0000000000001000) 308c2ecf20Sopenharmony_ci#define FW_FEATURE_CRQ ASM_CONST(0x0000000000002000) 318c2ecf20Sopenharmony_ci#define FW_FEATURE_VIO ASM_CONST(0x0000000000004000) 328c2ecf20Sopenharmony_ci#define FW_FEATURE_RDMA ASM_CONST(0x0000000000008000) 338c2ecf20Sopenharmony_ci#define FW_FEATURE_LLAN ASM_CONST(0x0000000000010000) 348c2ecf20Sopenharmony_ci#define FW_FEATURE_BULK_REMOVE ASM_CONST(0x0000000000020000) 358c2ecf20Sopenharmony_ci#define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000) 368c2ecf20Sopenharmony_ci#define FW_FEATURE_PUT_TCE_IND ASM_CONST(0x0000000000080000) 378c2ecf20Sopenharmony_ci#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000) 388c2ecf20Sopenharmony_ci#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000) 398c2ecf20Sopenharmony_ci#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000) 408c2ecf20Sopenharmony_ci#define FW_FEATURE_HPT_RESIZE ASM_CONST(0x0000000001000000) 418c2ecf20Sopenharmony_ci#define FW_FEATURE_CMO ASM_CONST(0x0000000002000000) 428c2ecf20Sopenharmony_ci#define FW_FEATURE_VPHN ASM_CONST(0x0000000004000000) 438c2ecf20Sopenharmony_ci#define FW_FEATURE_XCMO ASM_CONST(0x0000000008000000) 448c2ecf20Sopenharmony_ci#define FW_FEATURE_OPAL ASM_CONST(0x0000000010000000) 458c2ecf20Sopenharmony_ci#define FW_FEATURE_SET_MODE ASM_CONST(0x0000000040000000) 468c2ecf20Sopenharmony_ci#define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000) 478c2ecf20Sopenharmony_ci#define FW_FEATURE_FORM1_AFFINITY ASM_CONST(0x0000000100000000) 488c2ecf20Sopenharmony_ci#define FW_FEATURE_PRRN ASM_CONST(0x0000000200000000) 498c2ecf20Sopenharmony_ci#define FW_FEATURE_DRMEM_V2 ASM_CONST(0x0000000400000000) 508c2ecf20Sopenharmony_ci#define FW_FEATURE_DRC_INFO ASM_CONST(0x0000000800000000) 518c2ecf20Sopenharmony_ci#define FW_FEATURE_BLOCK_REMOVE ASM_CONST(0x0000001000000000) 528c2ecf20Sopenharmony_ci#define FW_FEATURE_PAPR_SCM ASM_CONST(0x0000002000000000) 538c2ecf20Sopenharmony_ci#define FW_FEATURE_ULTRAVISOR ASM_CONST(0x0000004000000000) 548c2ecf20Sopenharmony_ci#define FW_FEATURE_STUFF_TCE ASM_CONST(0x0000008000000000) 558c2ecf20Sopenharmony_ci#define FW_FEATURE_RPT_INVALIDATE ASM_CONST(0x0000010000000000) 568c2ecf20Sopenharmony_ci#define FW_FEATURE_FORM2_AFFINITY ASM_CONST(0x0000020000000000) 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_cienum { 618c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC64 628c2ecf20Sopenharmony_ci FW_FEATURE_PSERIES_POSSIBLE = FW_FEATURE_PFT | FW_FEATURE_TCE | 638c2ecf20Sopenharmony_ci FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY | 648c2ecf20Sopenharmony_ci FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM | 658c2ecf20Sopenharmony_ci FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT | 668c2ecf20Sopenharmony_ci FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | 678c2ecf20Sopenharmony_ci FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | 688c2ecf20Sopenharmony_ci FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR | 698c2ecf20Sopenharmony_ci FW_FEATURE_PUT_TCE_IND | FW_FEATURE_STUFF_TCE | 708c2ecf20Sopenharmony_ci FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | 718c2ecf20Sopenharmony_ci FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO | 728c2ecf20Sopenharmony_ci FW_FEATURE_SET_MODE | FW_FEATURE_BEST_ENERGY | 738c2ecf20Sopenharmony_ci FW_FEATURE_FORM1_AFFINITY | FW_FEATURE_PRRN | 748c2ecf20Sopenharmony_ci FW_FEATURE_HPT_RESIZE | FW_FEATURE_DRMEM_V2 | 758c2ecf20Sopenharmony_ci FW_FEATURE_DRC_INFO | FW_FEATURE_BLOCK_REMOVE | 768c2ecf20Sopenharmony_ci FW_FEATURE_PAPR_SCM | FW_FEATURE_ULTRAVISOR | 778c2ecf20Sopenharmony_ci FW_FEATURE_RPT_INVALIDATE | FW_FEATURE_FORM2_AFFINITY, 788c2ecf20Sopenharmony_ci FW_FEATURE_PSERIES_ALWAYS = 0, 798c2ecf20Sopenharmony_ci FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_ULTRAVISOR, 808c2ecf20Sopenharmony_ci FW_FEATURE_POWERNV_ALWAYS = 0, 818c2ecf20Sopenharmony_ci FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, 828c2ecf20Sopenharmony_ci FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, 838c2ecf20Sopenharmony_ci FW_FEATURE_NATIVE_POSSIBLE = 0, 848c2ecf20Sopenharmony_ci FW_FEATURE_NATIVE_ALWAYS = 0, 858c2ecf20Sopenharmony_ci FW_FEATURE_POSSIBLE = 868c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_PSERIES 878c2ecf20Sopenharmony_ci FW_FEATURE_PSERIES_POSSIBLE | 888c2ecf20Sopenharmony_ci#endif 898c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_POWERNV 908c2ecf20Sopenharmony_ci FW_FEATURE_POWERNV_POSSIBLE | 918c2ecf20Sopenharmony_ci#endif 928c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_PS3 938c2ecf20Sopenharmony_ci FW_FEATURE_PS3_POSSIBLE | 948c2ecf20Sopenharmony_ci#endif 958c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_NATIVE 968c2ecf20Sopenharmony_ci FW_FEATURE_NATIVE_ALWAYS | 978c2ecf20Sopenharmony_ci#endif 988c2ecf20Sopenharmony_ci 0, 998c2ecf20Sopenharmony_ci FW_FEATURE_ALWAYS = 1008c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_PSERIES 1018c2ecf20Sopenharmony_ci FW_FEATURE_PSERIES_ALWAYS & 1028c2ecf20Sopenharmony_ci#endif 1038c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_POWERNV 1048c2ecf20Sopenharmony_ci FW_FEATURE_POWERNV_ALWAYS & 1058c2ecf20Sopenharmony_ci#endif 1068c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_PS3 1078c2ecf20Sopenharmony_ci FW_FEATURE_PS3_ALWAYS & 1088c2ecf20Sopenharmony_ci#endif 1098c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_NATIVE 1108c2ecf20Sopenharmony_ci FW_FEATURE_NATIVE_ALWAYS & 1118c2ecf20Sopenharmony_ci#endif 1128c2ecf20Sopenharmony_ci FW_FEATURE_POSSIBLE, 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#else /* CONFIG_PPC64 */ 1158c2ecf20Sopenharmony_ci FW_FEATURE_POSSIBLE = 0, 1168c2ecf20Sopenharmony_ci FW_FEATURE_ALWAYS = 0, 1178c2ecf20Sopenharmony_ci#endif 1188c2ecf20Sopenharmony_ci}; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci/* This is used to identify firmware features which are available 1218c2ecf20Sopenharmony_ci * to the kernel. 1228c2ecf20Sopenharmony_ci */ 1238c2ecf20Sopenharmony_ciextern unsigned long powerpc_firmware_features; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci#define firmware_has_feature(feature) \ 1268c2ecf20Sopenharmony_ci ((FW_FEATURE_ALWAYS & (feature)) || \ 1278c2ecf20Sopenharmony_ci (FW_FEATURE_POSSIBLE & powerpc_firmware_features & (feature))) 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ciextern void system_reset_fwnmi(void); 1308c2ecf20Sopenharmony_ciextern void machine_check_fwnmi(void); 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci/* This is true if we are using the firmware NMI handler (typically LPAR) */ 1338c2ecf20Sopenharmony_ciextern int fwnmi_active; 1348c2ecf20Sopenharmony_ciextern int ibm_nmi_interlock_token; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ciextern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_PSERIES 1398c2ecf20Sopenharmony_civoid pseries_probe_fw_features(void); 1408c2ecf20Sopenharmony_ci#else 1418c2ecf20Sopenharmony_cistatic inline void pseries_probe_fw_features(void) { }; 1428c2ecf20Sopenharmony_ci#endif 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 1458c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */ 1468c2ecf20Sopenharmony_ci#endif /* __ASM_POWERPC_FIRMWARE_H */ 147