Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99869
b: refs/heads/master
c: 7a1fd98
h: refs/heads/master
i:
  99867: e4355ab
v: v3
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Jul 8, 2008
1 parent 8a94b60 commit 835165c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9a250347591da3e60b5ee53dd1d341732f081117
refs/heads/master: 7a1fd9866cbb59a00006f1e0fd5726951b167c97
35 changes: 35 additions & 0 deletions trunk/arch/x86/kernel/e820.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,41 @@ u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
return real_updated_size;
}

/* make e820 not cover the range */
u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
int checktype)
{
int i;
u64 real_removed_size = 0;

for (i = 0; i < e820.nr_map; i++) {
struct e820entry *ei = &e820.map[i];
u64 final_start, final_end;

if (checktype && ei->type != old_type)
continue;
/* totally covered? */
if (ei->addr >= start &&
(ei->addr + ei->size) <= (start + size)) {
real_removed_size += ei->size;
memset(ei, 0, sizeof(struct e820entry));
continue;
}
/* partially covered */
final_start = max(start, ei->addr);
final_end = min(start + size, ei->addr + ei->size);
if (final_start >= final_end)
continue;
real_removed_size += final_end - final_start;

ei->size -= final_end - final_start;
if (ei->addr < final_start)
continue;
ei->addr = final_end;
}
return real_removed_size;
}

void __init update_e820(void)
{
int nr_map;
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-x86/e820.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, int *pnr_map);
extern int copy_e820_map(struct e820entry *biosmap, int nr_map);
extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
unsigned new_type);
extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
int checktype);
extern void update_e820(void);
extern void e820_setup_gap(void);
struct setup_data;
Expand Down

0 comments on commit 835165c

Please sign in to comment.