xref: /freebsd/sys/powerpc/include/dump.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1bdb9ab0dSMark Johnston /*-
2bdb9ab0dSMark Johnston  * Copyright (c) 2014 EMC Corp.
3bdb9ab0dSMark Johnston  * Author: Conrad Meyer <conrad.meyer@isilon.com>
4bdb9ab0dSMark Johnston  * All rights reserved.
5bdb9ab0dSMark Johnston  *
6bdb9ab0dSMark Johnston  * Redistribution and use in source and binary forms, with or without
7bdb9ab0dSMark Johnston  * modification, are permitted provided that the following conditions
8bdb9ab0dSMark Johnston  * are met:
9bdb9ab0dSMark Johnston  * 1. Redistributions of source code must retain the above copyright
10bdb9ab0dSMark Johnston  *    notice, this list of conditions and the following disclaimer.
11bdb9ab0dSMark Johnston  * 2. Redistributions in binary form must reproduce the above copyright
12bdb9ab0dSMark Johnston  *    notice, this list of conditions and the following disclaimer in the
13bdb9ab0dSMark Johnston  *    documentation and/or other materials provided with the distribution.
14bdb9ab0dSMark Johnston  *
15bdb9ab0dSMark Johnston  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16bdb9ab0dSMark Johnston  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17bdb9ab0dSMark Johnston  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18bdb9ab0dSMark Johnston  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19bdb9ab0dSMark Johnston  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20bdb9ab0dSMark Johnston  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21bdb9ab0dSMark Johnston  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22bdb9ab0dSMark Johnston  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23bdb9ab0dSMark Johnston  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24bdb9ab0dSMark Johnston  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25bdb9ab0dSMark Johnston  * SUCH DAMAGE.
26bdb9ab0dSMark Johnston  */
27bdb9ab0dSMark Johnston 
28bdb9ab0dSMark Johnston #ifndef _MACHINE_DUMP_H_
29bdb9ab0dSMark Johnston #define	_MACHINE_DUMP_H_
30bdb9ab0dSMark Johnston 
31bdb9ab0dSMark Johnston #define	KERNELDUMP_ARCH_VERSION	KERNELDUMP_POWERPC_VERSION
32bdb9ab0dSMark Johnston #define	EM_VALUE		ELF_ARCH /* Defined in powerpc/include/elf.h */
33bdb9ab0dSMark Johnston #define	DUMPSYS_MD_PA_NPAIRS	(PHYS_AVAIL_SZ + 1)
34bdb9ab0dSMark Johnston #define	DUMPSYS_NUM_AUX_HDRS	0
35bdb9ab0dSMark Johnston 
36ab4ed843SMitchell Horne /* How often to check the dump progress bar? */
37ab4ed843SMitchell Horne #define	DUMPSYS_PB_CHECK_BITS	20	/* Every 1MB */
38ab4ed843SMitchell Horne 
39bdb9ab0dSMark Johnston void dumpsys_pa_init(void);
40bdb9ab0dSMark Johnston void dumpsys_unmap_chunk(vm_paddr_t, size_t, void *);
41*10fe6f80SMitchell Horne size_t dumpsys_scan_pmap(struct bitset *);
420ecc478bSLeandro Lupori void *dumpsys_dump_pmap_init(unsigned blkpgs);
430ecc478bSLeandro Lupori void *dumpsys_dump_pmap(void *ctx, void *buf, u_long *nbytes);
44bdb9ab0dSMark Johnston 
45bdb9ab0dSMark Johnston static inline struct dump_pa *
dumpsys_pa_next(struct dump_pa * p)46bdb9ab0dSMark Johnston dumpsys_pa_next(struct dump_pa *p)
47bdb9ab0dSMark Johnston {
48bdb9ab0dSMark Johnston 
49bdb9ab0dSMark Johnston 	return (dumpsys_gen_pa_next(p));
50bdb9ab0dSMark Johnston }
51bdb9ab0dSMark Johnston 
52bdb9ab0dSMark Johnston static inline void
dumpsys_wbinv_all(void)53bdb9ab0dSMark Johnston dumpsys_wbinv_all(void)
54bdb9ab0dSMark Johnston {
55bdb9ab0dSMark Johnston 
56bdb9ab0dSMark Johnston 	dumpsys_gen_wbinv_all();
57bdb9ab0dSMark Johnston }
58bdb9ab0dSMark Johnston 
59bdb9ab0dSMark Johnston static inline int
dumpsys_write_aux_headers(struct dumperinfo * di)60bdb9ab0dSMark Johnston dumpsys_write_aux_headers(struct dumperinfo *di)
61bdb9ab0dSMark Johnston {
62bdb9ab0dSMark Johnston 
63bdb9ab0dSMark Johnston 	return (dumpsys_gen_write_aux_headers(di));
64bdb9ab0dSMark Johnston }
65bdb9ab0dSMark Johnston 
66bdb9ab0dSMark Johnston static inline int
dumpsys(struct dumperinfo * di)67bdb9ab0dSMark Johnston dumpsys(struct dumperinfo *di)
68bdb9ab0dSMark Johnston {
69bdb9ab0dSMark Johnston 
70bdb9ab0dSMark Johnston 	return (dumpsys_generic(di));
71bdb9ab0dSMark Johnston }
72bdb9ab0dSMark Johnston 
73bdb9ab0dSMark Johnston #endif  /* !_MACHINE_DUMP_H_ */
74