^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * This program is used to generate definitions needed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * assembly language modules.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * We use the technique used in the OSF Mach kernel code:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * generate asm statements containing #defines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * compile this file to assembler, and then extract the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * #defines from the assembly-language output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/stddef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/kbuild.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/suspend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/thread_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/suspend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int main(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /* offsets into the thread_info struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) DEFINE(TI_TASK, offsetof(struct thread_info, task));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) DEFINE(TI_SIZE, sizeof(struct thread_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #ifdef CONFIG_HIBERNATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) DEFINE(PBE_ADDRESS, offsetof(struct pbe, address));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) DEFINE(PBE_ORIG_ADDRESS, offsetof(struct pbe, orig_address));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) DEFINE(PBE_NEXT, offsetof(struct pbe, next));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) DEFINE(SWSUSP_ARCH_REGS_SIZE, sizeof(struct swsusp_arch_regs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) DEFINE(SH_SLEEP_MODE, offsetof(struct sh_sleep_data, mode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) DEFINE(SH_SLEEP_SF_PRE, offsetof(struct sh_sleep_data, sf_pre));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) DEFINE(SH_SLEEP_SF_POST, offsetof(struct sh_sleep_data, sf_post));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) DEFINE(SH_SLEEP_RESUME, offsetof(struct sh_sleep_data, resume));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) DEFINE(SH_SLEEP_VBR, offsetof(struct sh_sleep_data, vbr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) DEFINE(SH_SLEEP_SPC, offsetof(struct sh_sleep_data, spc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) DEFINE(SH_SLEEP_SR, offsetof(struct sh_sleep_data, sr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) DEFINE(SH_SLEEP_SP, offsetof(struct sh_sleep_data, sp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) DEFINE(SH_SLEEP_BASE_ADDR, offsetof(struct sh_sleep_data, addr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) DEFINE(SH_SLEEP_BASE_DATA, offsetof(struct sh_sleep_data, data));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) DEFINE(SH_SLEEP_REG_STBCR, offsetof(struct sh_sleep_regs, stbcr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) DEFINE(SH_SLEEP_REG_BAR, offsetof(struct sh_sleep_regs, bar));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) DEFINE(SH_SLEEP_REG_PTEH, offsetof(struct sh_sleep_regs, pteh));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) DEFINE(SH_SLEEP_REG_PTEL, offsetof(struct sh_sleep_regs, ptel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) DEFINE(SH_SLEEP_REG_TTB, offsetof(struct sh_sleep_regs, ttb));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) DEFINE(SH_SLEEP_REG_TEA, offsetof(struct sh_sleep_regs, tea));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) DEFINE(SH_SLEEP_REG_MMUCR, offsetof(struct sh_sleep_regs, mmucr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) DEFINE(SH_SLEEP_REG_PTEA, offsetof(struct sh_sleep_regs, ptea));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) DEFINE(SH_SLEEP_REG_PASCR, offsetof(struct sh_sleep_regs, pascr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) DEFINE(SH_SLEEP_REG_IRMCR, offsetof(struct sh_sleep_regs, irmcr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) DEFINE(SH_SLEEP_REG_CCR, offsetof(struct sh_sleep_regs, ccr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) DEFINE(SH_SLEEP_REG_RAMCR, offsetof(struct sh_sleep_regs, ramcr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) }