2 * Hypervisor-assisted dump
4 * Linas Vepstas, Manish Ahuja 2008
5 * Copyright 2008 IBM Corp.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
14 #include <linux/init.h>
16 #include <linux/pfn.h>
17 #include <linux/swap.h>
20 #include <asm/phyp_dump.h>
21 #include <asm/machdep.h>
24 /* Variables, used to communicate data between early boot and late boot */
25 static struct phyp_dump phyp_dump_vars
;
26 struct phyp_dump
*phyp_dump_info
= &phyp_dump_vars
;
29 * release_memory_range -- release memory previously lmb_reserved
30 * @start_pfn: starting physical frame number
31 * @nr_pages: number of pages to free.
33 * This routine will release memory that had been previously
34 * lmb_reserved in early boot. The released memory becomes
35 * available for genreal use.
38 release_memory_range(unsigned long start_pfn
, unsigned long nr_pages
)
41 unsigned long end_pfn
;
44 end_pfn
= start_pfn
+ nr_pages
;
46 for (i
= start_pfn
; i
<= end_pfn
; i
++) {
47 rpage
= pfn_to_page(i
);
48 if (PageReserved(rpage
)) {
49 ClearPageReserved(rpage
);
50 init_page_count(rpage
);
57 static int __init
phyp_dump_setup(void)
59 unsigned long start_pfn
, nr_pages
;
61 /* If no memory was reserved in early boot, there is nothing to do */
62 if (phyp_dump_info
->init_reserve_size
== 0)
65 /* Release memory that was reserved in early boot */
66 start_pfn
= PFN_DOWN(phyp_dump_info
->init_reserve_start
);
67 nr_pages
= PFN_DOWN(phyp_dump_info
->init_reserve_size
);
68 release_memory_range(start_pfn
, nr_pages
);
72 machine_subsys_initcall(pseries
, phyp_dump_setup
);
74 int __init
early_init_dt_scan_phyp_dump(unsigned long node
,
75 const char *uname
, int depth
, void *data
)
77 const unsigned int *sizes
;
79 phyp_dump_info
->phyp_dump_configured
= 0;
80 phyp_dump_info
->phyp_dump_is_active
= 0;
82 if (depth
!= 1 || strcmp(uname
, "rtas") != 0)
85 if (of_get_flat_dt_prop(node
, "ibm,configure-kernel-dump", NULL
))
86 phyp_dump_info
->phyp_dump_configured
++;
88 if (of_get_flat_dt_prop(node
, "ibm,dump-kernel", NULL
))
89 phyp_dump_info
->phyp_dump_is_active
++;
91 sizes
= of_get_flat_dt_prop(node
, "ibm,configure-kernel-dump-sizes",
97 phyp_dump_info
->cpu_state_size
= *((unsigned long *)&sizes
[1]);
100 phyp_dump_info
->hpte_region_size
=
101 *((unsigned long *)&sizes
[4]);
This page took 0.035107 seconds and 5 git commands to generate.