diff options
Diffstat (limited to 'arch/powerpc/platforms/pseries/hotplug-memory.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/hotplug-memory.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 01e7b5bb3c1d..deab5f946090 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c | |||
@@ -10,14 +10,14 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/of.h> | 12 | #include <linux/of.h> |
13 | #include <linux/lmb.h> | 13 | #include <linux/memblock.h> |
14 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
15 | #include <asm/firmware.h> | 15 | #include <asm/firmware.h> |
16 | #include <asm/machdep.h> | 16 | #include <asm/machdep.h> |
17 | #include <asm/pSeries_reconfig.h> | 17 | #include <asm/pSeries_reconfig.h> |
18 | #include <asm/sparsemem.h> | 18 | #include <asm/sparsemem.h> |
19 | 19 | ||
20 | static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size) | 20 | static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size) |
21 | { | 21 | { |
22 | unsigned long start, start_pfn; | 22 | unsigned long start, start_pfn; |
23 | struct zone *zone; | 23 | struct zone *zone; |
@@ -26,7 +26,7 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size) | |||
26 | start_pfn = base >> PAGE_SHIFT; | 26 | start_pfn = base >> PAGE_SHIFT; |
27 | 27 | ||
28 | if (!pfn_valid(start_pfn)) { | 28 | if (!pfn_valid(start_pfn)) { |
29 | lmb_remove(base, lmb_size); | 29 | memblock_remove(base, memblock_size); |
30 | return 0; | 30 | return 0; |
31 | } | 31 | } |
32 | 32 | ||
@@ -41,20 +41,20 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size) | |||
41 | * to sysfs "state" file and we can't remove sysfs entries | 41 | * to sysfs "state" file and we can't remove sysfs entries |
42 | * while writing to it. So we have to defer it to here. | 42 | * while writing to it. So we have to defer it to here. |
43 | */ | 43 | */ |
44 | ret = __remove_pages(zone, start_pfn, lmb_size >> PAGE_SHIFT); | 44 | ret = __remove_pages(zone, start_pfn, memblock_size >> PAGE_SHIFT); |
45 | if (ret) | 45 | if (ret) |
46 | return ret; | 46 | return ret; |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Update memory regions for memory remove | 49 | * Update memory regions for memory remove |
50 | */ | 50 | */ |
51 | lmb_remove(base, lmb_size); | 51 | memblock_remove(base, memblock_size); |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Remove htab bolted mappings for this section of memory | 54 | * Remove htab bolted mappings for this section of memory |
55 | */ | 55 | */ |
56 | start = (unsigned long)__va(base); | 56 | start = (unsigned long)__va(base); |
57 | ret = remove_section_mapping(start, start + lmb_size); | 57 | ret = remove_section_mapping(start, start + memblock_size); |
58 | 58 | ||
59 | /* Ensure all vmalloc mappings are flushed in case they also | 59 | /* Ensure all vmalloc mappings are flushed in case they also |
60 | * hit that section of memory | 60 | * hit that section of memory |
@@ -69,7 +69,7 @@ static int pseries_remove_memory(struct device_node *np) | |||
69 | const char *type; | 69 | const char *type; |
70 | const unsigned int *regs; | 70 | const unsigned int *regs; |
71 | unsigned long base; | 71 | unsigned long base; |
72 | unsigned int lmb_size; | 72 | unsigned int memblock_size; |
73 | int ret = -EINVAL; | 73 | int ret = -EINVAL; |
74 | 74 | ||
75 | /* | 75 | /* |
@@ -80,16 +80,16 @@ static int pseries_remove_memory(struct device_node *np) | |||
80 | return 0; | 80 | return 0; |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Find the bae address and size of the lmb | 83 | * Find the bae address and size of the memblock |
84 | */ | 84 | */ |
85 | regs = of_get_property(np, "reg", NULL); | 85 | regs = of_get_property(np, "reg", NULL); |
86 | if (!regs) | 86 | if (!regs) |
87 | return ret; | 87 | return ret; |
88 | 88 | ||
89 | base = *(unsigned long *)regs; | 89 | base = *(unsigned long *)regs; |
90 | lmb_size = regs[3]; | 90 | memblock_size = regs[3]; |
91 | 91 | ||
92 | ret = pseries_remove_lmb(base, lmb_size); | 92 | ret = pseries_remove_memblock(base, memblock_size); |
93 | return ret; | 93 | return ret; |
94 | } | 94 | } |
95 | 95 | ||
@@ -98,7 +98,7 @@ static int pseries_add_memory(struct device_node *np) | |||
98 | const char *type; | 98 | const char *type; |
99 | const unsigned int *regs; | 99 | const unsigned int *regs; |
100 | unsigned long base; | 100 | unsigned long base; |
101 | unsigned int lmb_size; | 101 | unsigned int memblock_size; |
102 | int ret = -EINVAL; | 102 | int ret = -EINVAL; |
103 | 103 | ||
104 | /* | 104 | /* |
@@ -109,43 +109,43 @@ static int pseries_add_memory(struct device_node *np) | |||
109 | return 0; | 109 | return 0; |
110 | 110 | ||
111 | /* | 111 | /* |
112 | * Find the base and size of the lmb | 112 | * Find the base and size of the memblock |
113 | */ | 113 | */ |
114 | regs = of_get_property(np, "reg", NULL); | 114 | regs = of_get_property(np, "reg", NULL); |
115 | if (!regs) | 115 | if (!regs) |
116 | return ret; | 116 | return ret; |
117 | 117 | ||
118 | base = *(unsigned long *)regs; | 118 | base = *(unsigned long *)regs; |
119 | lmb_size = regs[3]; | 119 | memblock_size = regs[3]; |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Update memory region to represent the memory add | 122 | * Update memory region to represent the memory add |
123 | */ | 123 | */ |
124 | ret = lmb_add(base, lmb_size); | 124 | ret = memblock_add(base, memblock_size); |
125 | return (ret < 0) ? -EINVAL : 0; | 125 | return (ret < 0) ? -EINVAL : 0; |
126 | } | 126 | } |
127 | 127 | ||
128 | static int pseries_drconf_memory(unsigned long *base, unsigned int action) | 128 | static int pseries_drconf_memory(unsigned long *base, unsigned int action) |
129 | { | 129 | { |
130 | struct device_node *np; | 130 | struct device_node *np; |
131 | const unsigned long *lmb_size; | 131 | const unsigned long *memblock_size; |
132 | int rc; | 132 | int rc; |
133 | 133 | ||
134 | np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); | 134 | np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); |
135 | if (!np) | 135 | if (!np) |
136 | return -EINVAL; | 136 | return -EINVAL; |
137 | 137 | ||
138 | lmb_size = of_get_property(np, "ibm,lmb-size", NULL); | 138 | memblock_size = of_get_property(np, "ibm,memblock-size", NULL); |
139 | if (!lmb_size) { | 139 | if (!memblock_size) { |
140 | of_node_put(np); | 140 | of_node_put(np); |
141 | return -EINVAL; | 141 | return -EINVAL; |
142 | } | 142 | } |
143 | 143 | ||
144 | if (action == PSERIES_DRCONF_MEM_ADD) { | 144 | if (action == PSERIES_DRCONF_MEM_ADD) { |
145 | rc = lmb_add(*base, *lmb_size); | 145 | rc = memblock_add(*base, *memblock_size); |
146 | rc = (rc < 0) ? -EINVAL : 0; | 146 | rc = (rc < 0) ? -EINVAL : 0; |
147 | } else if (action == PSERIES_DRCONF_MEM_REMOVE) { | 147 | } else if (action == PSERIES_DRCONF_MEM_REMOVE) { |
148 | rc = pseries_remove_lmb(*base, *lmb_size); | 148 | rc = pseries_remove_memblock(*base, *memblock_size); |
149 | } else { | 149 | } else { |
150 | rc = -EINVAL; | 150 | rc = -EINVAL; |
151 | } | 151 | } |