blob: bbaf278bdccc0fe26e4d9d652bd1efd00e2c0d9a [file] [log] [blame]
Mahesh Salgaonkareb39c882012-02-16 01:14:22 +00001/*
2 * Firmware Assisted dump header file.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright 2011 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
20 */
21
22#ifndef __PPC64_FA_DUMP_H__
23#define __PPC64_FA_DUMP_H__
24
25#ifdef CONFIG_FA_DUMP
26
27/*
28 * The RMA region will be saved for later dumping when kernel crashes.
29 * RMA is Real Mode Area, the first block of logical memory address owned
30 * by logical partition, containing the storage that may be accessed with
31 * translate off.
32 */
33#define RMA_START 0x0
34#define RMA_END (ppc64_rma_size)
35
36/*
37 * On some Power systems where RMO is 128MB, it still requires minimum of
38 * 256MB for kernel to boot successfully. When kdump infrastructure is
39 * configured to save vmcore over network, we run into OOM issue while
40 * loading modules related to network setup. Hence we need aditional 64M
41 * of memory to avoid OOM issue.
42 */
43#define MIN_BOOT_MEM (((RMA_END < (0x1UL << 28)) ? (0x1UL << 28) : RMA_END) \
44 + (0x1UL << 26))
45
46/* Firmware provided dump sections */
47#define FADUMP_CPU_STATE_DATA 0x0001
48#define FADUMP_HPTE_REGION 0x0002
49#define FADUMP_REAL_MODE_REGION 0x0011
50
Mahesh Salgaonkar3ccc00a2012-02-20 02:15:03 +000051/* Dump request flag */
52#define FADUMP_REQUEST_FLAG 0x00000001
53
54/* FAD commands */
55#define FADUMP_REGISTER 1
56#define FADUMP_UNREGISTER 2
57#define FADUMP_INVALIDATE 3
58
59/* Kernel Dump section info */
60struct fadump_section {
61 u32 request_flag;
62 u16 source_data_type;
63 u16 error_flags;
64 u64 source_address;
65 u64 source_len;
66 u64 bytes_dumped;
67 u64 destination_address;
68};
69
70/* ibm,configure-kernel-dump header. */
71struct fadump_section_header {
72 u32 dump_format_version;
73 u16 dump_num_sections;
74 u16 dump_status_flag;
75 u32 offset_first_dump_section;
76
77 /* Fields for disk dump option. */
78 u32 dd_block_size;
79 u64 dd_block_offset;
80 u64 dd_num_blocks;
81 u32 dd_offset_disk_path;
82
83 /* Maximum time allowed to prevent an automatic dump-reboot. */
84 u32 max_time_auto;
85};
86
87/*
88 * Firmware Assisted dump memory structure. This structure is required for
89 * registering future kernel dump with power firmware through rtas call.
90 *
91 * No disk dump option. Hence disk dump path string section is not included.
92 */
93struct fadump_mem_struct {
94 struct fadump_section_header header;
95
96 /* Kernel dump sections */
97 struct fadump_section cpu_state_data;
98 struct fadump_section hpte_region;
99 struct fadump_section rmr_region;
100};
101
102/* Firmware-assisted dump configuration details. */
Mahesh Salgaonkareb39c882012-02-16 01:14:22 +0000103struct fw_dump {
104 unsigned long cpu_state_data_size;
105 unsigned long hpte_region_size;
106 unsigned long boot_memory_size;
107 unsigned long reserve_dump_area_start;
108 unsigned long reserve_dump_area_size;
109 /* cmd line option during boot */
110 unsigned long reserve_bootvar;
111
112 int ibm_configure_kernel_dump;
113
114 unsigned long fadump_enabled:1;
115 unsigned long fadump_supported:1;
116 unsigned long dump_active:1;
Mahesh Salgaonkar3ccc00a2012-02-20 02:15:03 +0000117 unsigned long dump_registered:1;
Mahesh Salgaonkareb39c882012-02-16 01:14:22 +0000118};
119
120extern int early_init_dt_scan_fw_dump(unsigned long node,
121 const char *uname, int depth, void *data);
122extern int fadump_reserve_mem(void);
Mahesh Salgaonkar3ccc00a2012-02-20 02:15:03 +0000123extern int setup_fadump(void);
124extern int is_fadump_active(void);
125#else /* CONFIG_FA_DUMP */
126static inline int is_fadump_active(void) { return 0; }
Mahesh Salgaonkareb39c882012-02-16 01:14:22 +0000127#endif
128#endif