Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * OS info memory interface
0004  *
0005  * Copyright IBM Corp. 2012
0006  * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
0007  */
0008 #ifndef _ASM_S390_OS_INFO_H
0009 #define _ASM_S390_OS_INFO_H
0010 
0011 #include <linux/uio.h>
0012 
0013 #define OS_INFO_VERSION_MAJOR   1
0014 #define OS_INFO_VERSION_MINOR   1
0015 #define OS_INFO_MAGIC       0x4f53494e464f535aULL /* OSINFOSZ */
0016 
0017 #define OS_INFO_VMCOREINFO  0
0018 #define OS_INFO_REIPL_BLOCK 1
0019 
0020 struct os_info_entry {
0021     u64 addr;
0022     u64 size;
0023     u32 csum;
0024 } __packed;
0025 
0026 struct os_info {
0027     u64 magic;
0028     u32 csum;
0029     u16 version_major;
0030     u16 version_minor;
0031     u64 crashkernel_addr;
0032     u64 crashkernel_size;
0033     struct os_info_entry entry[2];
0034     u8  reserved[4024];
0035 } __packed;
0036 
0037 void os_info_init(void);
0038 void os_info_entry_add(int nr, void *ptr, u64 len);
0039 void os_info_crashkernel_add(unsigned long base, unsigned long size);
0040 u32 os_info_csum(struct os_info *os_info);
0041 
0042 #ifdef CONFIG_CRASH_DUMP
0043 void *os_info_old_entry(int nr, unsigned long *size);
0044 size_t copy_oldmem_iter(struct iov_iter *iter, unsigned long src, size_t count);
0045 
0046 static inline int copy_oldmem_kernel(void *dst, unsigned long src, size_t count)
0047 {
0048     struct iov_iter iter;
0049     struct kvec kvec;
0050 
0051     kvec.iov_base = dst;
0052     kvec.iov_len = count;
0053     iov_iter_kvec(&iter, WRITE, &kvec, 1, count);
0054     if (copy_oldmem_iter(&iter, src, count) < count)
0055         return -EFAULT;
0056     return 0;
0057 }
0058 #else
0059 static inline void *os_info_old_entry(int nr, unsigned long *size)
0060 {
0061     return NULL;
0062 }
0063 #endif
0064 
0065 #endif /* _ASM_S390_OS_INFO_H */