diff options
| author | Yinghai Lu <yinghai@kernel.org> | 2010-08-25 16:39:18 -0400 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2010-08-27 14:13:51 -0400 |
| commit | a587d2daebcd2bc159d4348b6a7b028950a6d803 (patch) | |
| tree | 8001158a76efe400600a4e54dc5dae384b32b6e5 /kernel | |
| parent | a9ce6bc15100023b411f8117e53a016d61889800 (diff) | |
x86: Remove not used early_res code
and some functions in e820.c that are not used anymore
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/Makefile | 1 | ||||
| -rw-r--r-- | kernel/early_res.c | 590 |
2 files changed, 0 insertions, 591 deletions
diff --git a/kernel/Makefile b/kernel/Makefile index 057472fbc27..80e61c3e44a 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
| @@ -11,7 +11,6 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o \ | |||
| 11 | hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ | 11 | hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ |
| 12 | notifier.o ksysfs.o pm_qos_params.o sched_clock.o cred.o \ | 12 | notifier.o ksysfs.o pm_qos_params.o sched_clock.o cred.o \ |
| 13 | async.o range.o | 13 | async.o range.o |
| 14 | obj-$(CONFIG_HAVE_EARLY_RES) += early_res.o | ||
| 15 | obj-y += groups.o | 14 | obj-y += groups.o |
| 16 | 15 | ||
| 17 | ifdef CONFIG_FUNCTION_TRACER | 16 | ifdef CONFIG_FUNCTION_TRACER |
diff --git a/kernel/early_res.c b/kernel/early_res.c deleted file mode 100644 index 7bfae887f21..00000000000 --- a/kernel/early_res.c +++ /dev/null | |||
| @@ -1,590 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * early_res, could be used to replace bootmem | ||
| 3 | */ | ||
| 4 | #include <linux/kernel.h> | ||
| 5 | #include <linux/types.h> | ||
| 6 | #include <linux/init.h> | ||
| 7 | #include <linux/bootmem.h> | ||
| 8 | #include <linux/mm.h> | ||
| 9 | #include <linux/early_res.h> | ||
| 10 | #include <linux/slab.h> | ||
| 11 | #include <linux/kmemleak.h> | ||
| 12 | |||
| 13 | /* | ||
| 14 | * Early reserved memory areas. | ||
| 15 | */ | ||
| 16 | /* | ||
| 17 | * need to make sure this one is bigger enough before | ||
| 18 | * find_fw_memmap_area could be used | ||
| 19 | */ | ||
| 20 | #define MAX_EARLY_RES_X 32 | ||
| 21 | |||
| 22 | struct early_res { | ||
| 23 | u64 start, end; | ||
| 24 | char name[15]; | ||
| 25 | char overlap_ok; | ||
| 26 | }; | ||
| 27 | static struct early_res early_res_x[MAX_EARLY_RES_X] __initdata; | ||
| 28 | |||
| 29 | static int max_early_res __initdata = MAX_EARLY_RES_X; | ||
| 30 | static struct early_res *early_res __initdata = &early_res_x[0]; | ||
| 31 | static int early_res_count __initdata; | ||
| 32 | |||
| 33 | static int __init find_overlapped_early(u64 start, u64 end) | ||
| 34 | { | ||
| 35 | int i; | ||
| 36 | struct early_res *r; | ||
| 37 | |||
| 38 | for (i = 0; i < max_early_res && early_res[i].end; i++) { | ||
| 39 | r = &early_res[i]; | ||
| 40 | if (end > r->start && start < r->end) | ||
| 41 | break; | ||
| 42 | } | ||
| 43 | |||
| 44 | return i; | ||
| 45 | } | ||
| 46 | |||
| 47 | /* | ||
| 48 | * Drop the i-th range from the early reservation map, | ||
| 49 | * by copying any higher ranges down one over it, and | ||
| 50 | * clearing what had been the last slot. | ||
| 51 | */ | ||
| 52 | static void __init drop_range(int i) | ||
| 53 | { | ||
| 54 | int j; | ||
| 55 | |||
| 56 | for (j = i + 1; j < max_early_res && early_res[j].end; j++) | ||
| 57 | ; | ||
| 58 | |||
| 59 | memmove(&early_res[i], &early_res[i + 1], | ||
| 60 | (j - 1 - i) * sizeof(struct early_res)); | ||
| 61 | |||
| 62 | early_res[j - 1].end = 0; | ||
| 63 | early_res_count--; | ||
| 64 | } | ||
| 65 | |||
| 66 | static void __init drop_range_partial(int i, u64 start, u64 end) | ||
| 67 | { | ||
| 68 | u64 common_start, common_end; | ||
| 69 | u64 old_start, old_end; | ||
| 70 | |||
| 71 | old_start = early_res[i].start; | ||
| 72 | old_end = early_res[i].end; | ||
| 73 | common_start = max(old_start, start); | ||
| 74 | common_end = min(old_end, end); | ||
| 75 | |||
| 76 | /* no overlap ? */ | ||
| 77 | if (common_start >= common_end) | ||
| 78 | return; | ||
| 79 | |||
| 80 | if (old_start < common_start) { | ||
| 81 | /* make head segment */ | ||
| 82 | early_res[i].end = common_start; | ||
| 83 | if (old_end > common_end) { | ||
| 84 | char name[15]; | ||
| 85 | |||
| 86 | /* | ||
| 87 | * Save a local copy of the name, since the | ||
| 88 | * early_res array could get resized inside | ||
| 89 | * reserve_early_without_check() -> | ||
| 90 | * __check_and_double_early_res(), which would | ||
| 91 | * make the current name pointer invalid. | ||
| 92 | */ | ||
| 93 | strncpy(name, early_res[i].name, | ||
| 94 | sizeof(early_res[i].name) - 1); | ||
| 95 | /* add another for left over on tail */ | ||
| 96 | reserve_early_without_check(common_end, old_end, name); | ||
| 97 | } | ||
| 98 | return; | ||
| 99 | } else { | ||
| 100 | if (old_end > common_end) { | ||
| 101 | /* reuse the entry for tail left */ | ||
| 102 | early_res[i].start = common_end; | ||
| 103 | return; | ||
| 104 | } | ||
| 105 | /* all covered */ | ||
| 106 | drop_range(i); | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | /* | ||
| 111 | * Split any existing ranges that: | ||
| 112 | * 1) are marked 'overlap_ok', and | ||
| 113 | * 2) overlap with the stated range [start, end) | ||
| 114 | * into whatever portion (if any) of the existing range is entirely | ||
| 115 | * below or entirely above the stated range. Drop the portion | ||
| 116 | * of the existing range that overlaps with the stated range, | ||
| 117 | * which will allow the caller of this routine to then add that | ||
| 118 | * stated range without conflicting with any existing range. | ||
| 119 | */ | ||
| 120 | static void __init drop_overlaps_that_are_ok(u64 start, u64 end) | ||
| 121 | { | ||
| 122 | int i; | ||
| 123 | struct early_res *r; | ||
| 124 | u64 lower_start, lower_end; | ||
| 125 | u64 upper_start, upper_end; | ||
| 126 | char name[15]; | ||
| 127 | |||
| 128 | for (i = 0; i < max_early_res && early_res[i].end; i++) { | ||
| 129 | r = &early_res[i]; | ||
| 130 | |||
| 131 | /* Continue past non-overlapping ranges */ | ||
| 132 | if (end <= r->start || start >= r->end) | ||
| 133 | continue; | ||
| 134 | |||
| 135 | /* | ||
| 136 | * Leave non-ok overlaps as is; let caller | ||
| 137 | * panic "Overlapping early reservations" | ||
| 138 | * when it hits this overlap. | ||
| 139 | */ | ||
| 140 | if (!r->overlap_ok) | ||
| 141 | return; | ||
| 142 | |||
| 143 | /* | ||
| 144 | * We have an ok overlap. We will drop it from the early | ||
| 145 | * reservation map, and add back in any non-overlapping | ||
| 146 | * portions (lower or upper) as separate, overlap_ok, | ||
| 147 | * non-overlapping ranges. | ||
| 148 | */ | ||
| 149 | |||
| 150 | /* 1. Note any non-overlapping (lower or upper) ranges. */ | ||
| 151 | strncpy(name, r->name, sizeof(name) - 1); | ||
| 152 | |||
| 153 | lower_start = lower_end = 0; | ||
| 154 | upper_start = upper_end = 0; | ||
| 155 | if (r->start < start) { | ||
| 156 | lower_start = r->start; | ||
| 157 | lower_end = start; | ||
| 158 | } | ||
| 159 | if (r->end > end) { | ||
| 160 | upper_start = end; | ||
| 161 | upper_end = r->end; | ||
| 162 | } | ||
| 163 | |||
| 164 | /* 2. Drop the original ok overlapping range */ | ||
| 165 | drop_range(i); | ||
| 166 | |||
| 167 | i--; /* resume for-loop on copied down entry */ | ||
| 168 | |||
| 169 | /* 3. Add back in any non-overlapping ranges. */ | ||
| 170 | if (lower_end) | ||
| 171 | reserve_early_overlap_ok(lower_start, lower_end, name); | ||
| 172 | if (upper_end) | ||
| 173 | reserve_early_overlap_ok(upper_start, upper_end, name); | ||
| 174 | } | ||
| 175 | } | ||
| 176 | |||
| 177 | static void __init __reserve_early(u64 start, u64 end, char *name, | ||
| 178 | int overlap_ok) | ||
| 179 | { | ||
| 180 | int i; | ||
| 181 | struct early_res *r; | ||
| 182 | |||
| 183 | i = find_overlapped_early(start, end); | ||
| 184 | if (i >= max_early_res) | ||
| 185 | panic("Too many early reservations"); | ||
| 186 | r = &early_res[i]; | ||
| 187 | if (r->end) | ||
| 188 | panic("Overlapping early reservations " | ||
| 189 | "%llx-%llx %s to %llx-%llx %s\n", | ||
| 190 | start, end - 1, name ? name : "", r->start, | ||
| 191 | r->end - 1, r->name); | ||
| 192 | r->start = start; | ||
| 193 | r->end = end; | ||
| 194 | r->overlap_ok = overlap_ok; | ||
| 195 | if (name) | ||
| 196 | strncpy(r->name, name, sizeof(r->name) - 1); | ||
| 197 | early_res_count++; | ||
| 198 | } | ||
| 199 | |||
| 200 | /* | ||
| 201 | * A few early reservtations come here. | ||
| 202 | * | ||
