18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * OS info memory interface
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2012
68c2ecf20Sopenharmony_ci * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef _ASM_S390_OS_INFO_H
98c2ecf20Sopenharmony_ci#define _ASM_S390_OS_INFO_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define OS_INFO_VERSION_MAJOR	1
128c2ecf20Sopenharmony_ci#define OS_INFO_VERSION_MINOR	1
138c2ecf20Sopenharmony_ci#define OS_INFO_MAGIC		0x4f53494e464f535aULL /* OSINFOSZ */
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define OS_INFO_VMCOREINFO	0
168c2ecf20Sopenharmony_ci#define OS_INFO_REIPL_BLOCK	1
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct os_info_entry {
198c2ecf20Sopenharmony_ci	u64	addr;
208c2ecf20Sopenharmony_ci	u64	size;
218c2ecf20Sopenharmony_ci	u32	csum;
228c2ecf20Sopenharmony_ci} __packed;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct os_info {
258c2ecf20Sopenharmony_ci	u64	magic;
268c2ecf20Sopenharmony_ci	u32	csum;
278c2ecf20Sopenharmony_ci	u16	version_major;
288c2ecf20Sopenharmony_ci	u16	version_minor;
298c2ecf20Sopenharmony_ci	u64	crashkernel_addr;
308c2ecf20Sopenharmony_ci	u64	crashkernel_size;
318c2ecf20Sopenharmony_ci	struct os_info_entry entry[2];
328c2ecf20Sopenharmony_ci	u8	reserved[4024];
338c2ecf20Sopenharmony_ci} __packed;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_civoid os_info_init(void);
368c2ecf20Sopenharmony_civoid os_info_entry_add(int nr, void *ptr, u64 len);
378c2ecf20Sopenharmony_civoid os_info_crashkernel_add(unsigned long base, unsigned long size);
388c2ecf20Sopenharmony_ciu32 os_info_csum(struct os_info *os_info);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#ifdef CONFIG_CRASH_DUMP
418c2ecf20Sopenharmony_civoid *os_info_old_entry(int nr, unsigned long *size);
428c2ecf20Sopenharmony_ciint copy_oldmem_kernel(void *dst, void *src, size_t count);
438c2ecf20Sopenharmony_ci#else
448c2ecf20Sopenharmony_cistatic inline void *os_info_old_entry(int nr, unsigned long *size)
458c2ecf20Sopenharmony_ci{
468c2ecf20Sopenharmony_ci	return NULL;
478c2ecf20Sopenharmony_ci}
488c2ecf20Sopenharmony_ci#endif
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#endif /* _ASM_S390_OS_INFO_H */
51