xref: /linux/arch/s390/include/asm/os_info.h (revision 621cde16e49b3ecf7d59a8106a20aaebfb4a59a9)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
24857d4bbSMichael Holzheu /*
34857d4bbSMichael Holzheu  * OS info memory interface
44857d4bbSMichael Holzheu  *
54857d4bbSMichael Holzheu  * Copyright IBM Corp. 2012
64857d4bbSMichael Holzheu  * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
74857d4bbSMichael Holzheu  */
84857d4bbSMichael Holzheu #ifndef _ASM_S390_OS_INFO_H
94857d4bbSMichael Holzheu #define _ASM_S390_OS_INFO_H
104857d4bbSMichael Holzheu 
11ebbc9570SAlexander Gordeev #include <linux/uio.h>
12ebbc9570SAlexander Gordeev 
134857d4bbSMichael Holzheu #define OS_INFO_VERSION_MAJOR	1
144857d4bbSMichael Holzheu #define OS_INFO_VERSION_MINOR	1
154857d4bbSMichael Holzheu #define OS_INFO_MAGIC		0x4f53494e464f535aULL /* OSINFOSZ */
164857d4bbSMichael Holzheu 
174857d4bbSMichael Holzheu #define OS_INFO_VMCOREINFO	0
184857d4bbSMichael Holzheu #define OS_INFO_REIPL_BLOCK	1
1931e9ccc6SMikhail Zaslonko #define OS_INFO_FLAGS_ENTRY	2
2088702793SAlexander Gordeev #define OS_INFO_RESERVED	3
218572f525SAlexander Gordeev #define OS_INFO_IDENTITY_BASE	4
228572f525SAlexander Gordeev #define OS_INFO_KASLR_OFFSET	5
238572f525SAlexander Gordeev #define OS_INFO_KASLR_OFF_PHYS	6
248572f525SAlexander Gordeev #define OS_INFO_VMEMMAP		7
258572f525SAlexander Gordeev #define OS_INFO_AMODE31_START	8
268572f525SAlexander Gordeev #define OS_INFO_AMODE31_END	9
27f4cac27dSAlexander Gordeev #define OS_INFO_IMAGE_START	10
28f4cac27dSAlexander Gordeev #define OS_INFO_IMAGE_END	11
29f4cac27dSAlexander Gordeev #define OS_INFO_IMAGE_PHYS	12
30*fe742c08SSven Schnelle #define OS_INFO_MAX		13
3131e9ccc6SMikhail Zaslonko 
3231e9ccc6SMikhail Zaslonko #define OS_INFO_FLAG_REIPL_CLEAR	(1UL << 0)
334857d4bbSMichael Holzheu 
344857d4bbSMichael Holzheu struct os_info_entry {
3588702793SAlexander Gordeev 	union {
364857d4bbSMichael Holzheu 		u64	addr;
3788702793SAlexander Gordeev 		u64	val;
3888702793SAlexander Gordeev 	};
394857d4bbSMichael Holzheu 	u64	size;
404857d4bbSMichael Holzheu 	u32	csum;
414857d4bbSMichael Holzheu } __packed;
424857d4bbSMichael Holzheu 
434857d4bbSMichael Holzheu struct os_info {
444857d4bbSMichael Holzheu 	u64	magic;
454857d4bbSMichael Holzheu 	u32	csum;
464857d4bbSMichael Holzheu 	u16	version_major;
474857d4bbSMichael Holzheu 	u16	version_minor;
484857d4bbSMichael Holzheu 	u64	crashkernel_addr;
494857d4bbSMichael Holzheu 	u64	crashkernel_size;
50*fe742c08SSven Schnelle 	struct os_info_entry entry[OS_INFO_MAX];
51*fe742c08SSven Schnelle 	u8	reserved[3804];
524857d4bbSMichael Holzheu } __packed;
534857d4bbSMichael Holzheu 
544857d4bbSMichael Holzheu void os_info_init(void);
5588702793SAlexander Gordeev void os_info_entry_add_data(int nr, void *ptr, u64 len);
5688702793SAlexander Gordeev void os_info_entry_add_val(int nr, u64 val);
574857d4bbSMichael Holzheu void os_info_crashkernel_add(unsigned long base, unsigned long size);
584857d4bbSMichael Holzheu u32 os_info_csum(struct os_info *os_info);
594857d4bbSMichael Holzheu 
604857d4bbSMichael Holzheu #ifdef CONFIG_CRASH_DUMP
614857d4bbSMichael Holzheu void *os_info_old_entry(int nr, unsigned long *size);
os_info_old_value(int nr)6288702793SAlexander Gordeev static inline unsigned long os_info_old_value(int nr)
6388702793SAlexander Gordeev {
6488702793SAlexander Gordeev 	unsigned long size;
6588702793SAlexander Gordeev 
6688702793SAlexander Gordeev 	return (unsigned long)os_info_old_entry(nr, &size);
6788702793SAlexander Gordeev }
684857d4bbSMichael Holzheu #else
os_info_old_entry(int nr,unsigned long * size)694857d4bbSMichael Holzheu static inline void *os_info_old_entry(int nr, unsigned long *size)
704857d4bbSMichael Holzheu {
714857d4bbSMichael Holzheu 	return NULL;
724857d4bbSMichael Holzheu }
734857d4bbSMichael Holzheu #endif
744857d4bbSMichael Holzheu 
754857d4bbSMichael Holzheu #endif /* _ASM_S390_OS_INFO_H */
76