diff options
author | Paul Jackson <pj@sgi.com> | 2008-05-14 11:15:52 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-25 04:55:11 -0400 |
commit | 5b7eb2e9ef4e467a1248537b47a63bab265be3cc (patch) | |
tree | e60a17b9af8496acef43bbb7c16fd998f48c0270 /arch | |
parent | 6e9bcc796b120d17b08dde7ab958b82ddb899889 (diff) |
x86 boot: longer comment explaining sanitize_e820_map routine
Elaborate on the comment for sanitize_e820_map(), epxlaining more what
it does, what it inputs, and what it returns. Rearrange the placement of
this comment to fit kernel conventions, before the routine's code rather
than buried inside it.
Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/e820.c | 94 |
1 files changed, 56 insertions, 38 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 91abf5b2fb94..41c480ae47df 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -139,9 +139,64 @@ void __init e820_print_map(char *who) | |||
139 | * Sanitize the BIOS e820 map. | 139 | * Sanitize the BIOS e820 map. |
140 | * | 140 | * |
141 | * Some e820 responses include overlapping entries. The following | 141 | * Some e820 responses include overlapping entries. The following |
142 | * replaces the original e820 map with a new one, removing overlaps. | 142 | * replaces the original e820 map with a new one, removing overlaps, |
143 | * and resolving conflicting memory types in favor of highest | ||
144 | * numbered type. | ||
143 | * | 145 | * |
146 | * The input parameter biosmap points to an array of 'struct | ||
147 | * e820entry' which on entry has elements in the range [0, *pnr_map) | ||
148 | * valid, and which has space for up to max_nr_map entries. | ||
149 | * On return, the resulting sanitized e820 map entries will be in | ||
150 | * overwritten in the same location, starting at biosmap. | ||
151 | * | ||
152 | * The integer pointed to by pnr_map must be valid on entry (the | ||
153 | * current number of valid entries located at biosmap) and will | ||
154 | * be updated on return, with the new number of valid entries | ||
155 | * (something no more than max_nr_map.) | ||
156 | * | ||
157 | * The return value from sanitize_e820_map() is zero if it | ||
158 | * successfully 'sanitized' the map entries passed in, and is -1 | ||
159 | * if it did nothing, which can happen if either of (1) it was | ||
160 | * only passed one map entry, or (2) any of the input map entries | ||
161 | * were invalid (start + size < start, meaning that the size was | ||
162 | * so big the described memory range wrapped around through zero.) | ||
163 | * | ||
164 | * Visually we're performing the following | ||
165 | * (1,2,3,4 = memory types)... | ||
166 | * | ||
167 | * Sample memory map (w/overlaps): | ||
168 | * ____22__________________ | ||
169 | * ______________________4_ | ||
170 | * ____1111________________ | ||
171 | * _44_____________________ | ||
172 | * 11111111________________ | ||
173 | * ____________________33__ | ||
174 | * ___________44___________ | ||
175 | * __________33333_________ | ||
176 | * ______________22________ | ||
177 | * ___________________2222_ | ||
178 | * _________111111111______ | ||
179 | * _____________________11_ | ||
180 | * _________________4______ | ||
181 | * | ||
182 | * Sanitized equivalent (no overlap): | ||
183 | * 1_______________________ | ||
184 | * _44_____________________ | ||
185 | * ___1____________________ | ||
186 | * ____22__________________ | ||
187 | * ______11________________ | ||
188 | * _________1______________ | ||
189 | * __________3_____________ | ||
190 | * ___________44___________ | ||
191 | * _____________33_________ | ||
192 | * _______________2________ | ||
193 | * ________________1_______ | ||
194 | * _________________4______ | ||
195 | * ___________________2____ | ||
196 | * ____________________33__ | ||
197 | * ______________________4_ | ||
144 | */ | 198 | */ |
199 | |||
145 | int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, | 200 | int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, |
146 | int *pnr_map) | 201 | int *pnr_map) |
147 | { | 202 | { |
@@ -162,43 +217,6 @@ static struct e820entry new_bios[E820_X_MAX] __initdata; | |||
162 | int old_nr, new_nr, chg_nr; | 217 | int old_nr, new_nr, chg_nr; |
163 | int i; | 218 | int i; |
164 | 219 | ||
165 | /* | ||
166 | Visually we're performing the following | ||
167 | (1,2,3,4 = memory types)... | ||
168 | |||
169 | Sample memory map (w/overlaps): | ||
170 | ____22__________________ | ||
171 | ______________________4_ | ||
172 | ____1111________________ | ||
173 | _44_____________________ | ||
174 | 11111111________________ | ||
175 | ____________________33__ | ||
176 | ___________44___________ | ||
177 | __________33333_________ | ||
178 | ______________22________ | ||
179 | ___________________2222_ | ||
180 | _________111111111______ | ||
181 | _____________________11_ | ||
182 | _________________4______ | ||
183 | |||
184 | Sanitized equivalent (no overlap): | ||
185 | 1_______________________ | ||
186 | _44_____________________ | ||
187 | ___1____________________ | ||
188 | ____22__________________ | ||
189 | ______11________________ | ||
190 | _________1______________ | ||
191 | __________3_____________ | ||
192 | ___________44___________ | ||
193 | _____________33_________ | ||
194 | _______________2________ | ||
195 | ________________1_______ | ||
196 | _________________4______ | ||
197 | ___________________2____ | ||
198 | ____________________33__ | ||
199 | ______________________4_ | ||
200 | */ | ||
201 | |||
202 | /* if there's only one memory region, don't bother */ | 220 | /* if there's only one memory region, don't bother */ |
203 | if (*pnr_map < 2) | 221 | if (*pnr_map < 2) |
204 | return -1; | 222 | return -1; |