18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_OLPC_OFW_H 38c2ecf20Sopenharmony_ci#define _ASM_X86_OLPC_OFW_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* index into the page table containing the entry OFW occupies */ 68c2ecf20Sopenharmony_ci#define OLPC_OFW_PDE_NR 1022 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#define OLPC_OFW_SIG 0x2057464F /* aka "OFW " */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifdef CONFIG_OLPC 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciextern bool olpc_ofw_is_installed(void); 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* run an OFW command by calling into the firmware */ 158c2ecf20Sopenharmony_ci#define olpc_ofw(name, args, res) \ 168c2ecf20Sopenharmony_ci __olpc_ofw((name), ARRAY_SIZE(args), args, ARRAY_SIZE(res), res) 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciextern int __olpc_ofw(const char *name, int nr_args, const void **args, int nr_res, 198c2ecf20Sopenharmony_ci void **res); 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* determine whether OFW is available and lives in the proper memory */ 228c2ecf20Sopenharmony_ciextern void olpc_ofw_detect(void); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* install OFW's pde permanently into the kernel's pgtable */ 258c2ecf20Sopenharmony_ciextern void setup_olpc_ofw_pgd(void); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* check if OFW was detected during boot */ 288c2ecf20Sopenharmony_ciextern bool olpc_ofw_present(void); 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciextern void olpc_dt_build_devicetree(void); 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#else /* !CONFIG_OLPC */ 338c2ecf20Sopenharmony_cistatic inline void olpc_ofw_detect(void) { } 348c2ecf20Sopenharmony_cistatic inline void setup_olpc_ofw_pgd(void) { } 358c2ecf20Sopenharmony_cistatic inline void olpc_dt_build_devicetree(void) { } 368c2ecf20Sopenharmony_ci#endif /* !CONFIG_OLPC */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#endif /* _ASM_X86_OLPC_OFW_H */ 39