Commit d3059cbc authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: cleanup lmb code

From: Anton Blanchard <anton@samba.org>

- remove LMB_MEMORY_AREA, LMB_IO_AREA, we only allocate/reserve memory
  areas now
- remove lmb_property->type, lmb_region->iosize, lmb_region->lcd_size,
  no longer used
- bump number of regions to 128, we'll hit this limit sooner or later
  with our big boxes (if we have more than 64 PCI host bridges the
  reserved array will fill up for example)
- make all the lmb stuff __init
- no need to explicitly zero struct lmb lmb now we zero the BSS early
- we had two functions to dump the lmb array, kill one of them
- move the inline functions into lmb.c, they are only ever called from
  there
parent a930a896
This diff is collapsed.
......@@ -699,9 +699,6 @@ prom_dump_lmb(void)
prom_print(RELOC(" memory.size = 0x"));
prom_print_hex(_lmb->memory.size);
prom_print_nl();
prom_print(RELOC(" memory.lcd_size = 0x"));
prom_print_hex(_lmb->memory.lcd_size);
prom_print_nl();
for (i=0; i < _lmb->memory.cnt ;i++) {
prom_print(RELOC(" memory.region[0x"));
prom_print_hex(i);
......@@ -714,9 +711,6 @@ prom_dump_lmb(void)
prom_print(RELOC(" .size = 0x"));
prom_print_hex(_lmb->memory.region[i].size);
prom_print_nl();
prom_print(RELOC(" .type = 0x"));
prom_print_hex(_lmb->memory.region[i].type);
prom_print_nl();
}
prom_print_nl();
......@@ -726,9 +720,6 @@ prom_dump_lmb(void)
prom_print(RELOC(" reserved.size = 0x"));
prom_print_hex(_lmb->reserved.size);
prom_print_nl();
prom_print(RELOC(" reserved.lcd_size = 0x"));
prom_print_hex(_lmb->reserved.lcd_size);
prom_print_nl();
for (i=0; i < _lmb->reserved.cnt ;i++) {
prom_print(RELOC(" reserved.region[0x"));
prom_print_hex(i);
......@@ -741,9 +732,6 @@ prom_dump_lmb(void)
prom_print(RELOC(" .size = 0x"));
prom_print_hex(_lmb->reserved.region[i].size);
prom_print_nl();
prom_print(RELOC(" .type = 0x"));
prom_print_hex(_lmb->reserved.region[i].type);
prom_print_nl();
}
}
#endif /* DEBUG_PROM */
......
......@@ -699,10 +699,6 @@ void __init do_init_bootmem(void)
/* add all physical memory to the bootmem map */
for (i=0; i < lmb.memory.cnt; i++) {
unsigned long physbase, size;
unsigned long type = lmb.memory.region[i].type;
if ( type != LMB_MEMORY_AREA )
continue;
physbase = lmb.memory.region[i].physbase;
size = lmb.memory.region[i].size;
......@@ -743,12 +739,8 @@ static int __init setup_kcore(void)
for (i=0; i < lmb.memory.cnt; i++) {
unsigned long physbase, size;
unsigned long type = lmb.memory.region[i].type;
struct kcore_list *kcore_mem;
if (type != LMB_MEMORY_AREA)
continue;
physbase = lmb.memory.region[i].physbase;
size = lmb.memory.region[i].size;
......
......@@ -257,10 +257,6 @@ void __init do_init_bootmem(void)
for (i = 0; i < lmb.memory.cnt; i++) {
unsigned long physbase, size;
unsigned long type = lmb.memory.region[i].type;
if (type != LMB_MEMORY_AREA)
continue;
physbase = lmb.memory.region[i].physbase;
size = lmb.memory.region[i].size;
......
......@@ -13,12 +13,12 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/config.h>
#include <linux/init.h>
#include <asm/prom.h>
extern unsigned long reloc_offset(void);
#define MAX_LMB_REGIONS 64
#define MAX_LMB_REGIONS 128
union lmb_reg_property {
struct reg_property32 addr32[MAX_LMB_REGIONS];
......@@ -26,24 +26,17 @@ union lmb_reg_property {
struct reg_property_pmac addrPM[MAX_LMB_REGIONS];
};
#define LMB_MEMORY_AREA 1
#define LMB_IO_AREA 2
#define LMB_ALLOC_ANYWHERE 0
#define LMB_ALLOC_FIRST4GBYTE (1UL<<32)
struct lmb_property {
unsigned long base;
unsigned long physbase;
unsigned long size;
unsigned long type;
};
struct lmb_region {
unsigned long cnt;
unsigned long size;
unsigned long iosize;
unsigned long lcd_size; /* Least Common Denominator */
struct lmb_property region[MAX_LMB_REGIONS+1];
};
......@@ -54,63 +47,17 @@ struct lmb {
struct lmb_region reserved;
};
extern struct lmb lmb;
extern void lmb_init(void);
extern void lmb_analyze(void);
extern long lmb_add(unsigned long, unsigned long);
#ifdef CONFIG_MSCHUNKS
extern long lmb_add_io(unsigned long base, unsigned long size);
#endif /* CONFIG_MSCHUNKS */
extern long lmb_reserve(unsigned long, unsigned long);
extern unsigned long lmb_alloc(unsigned long, unsigned long);
extern unsigned long lmb_alloc_base(unsigned long, unsigned long, unsigned long);
extern unsigned long lmb_phys_mem_size(void);
extern unsigned long lmb_end_of_DRAM(void);
extern unsigned long lmb_abs_to_phys(unsigned long);
extern void lmb_dump(char *);
static inline unsigned long
lmb_addrs_overlap(unsigned long base1, unsigned long size1,
unsigned long base2, unsigned long size2)
{
return ((base1 < (base2+size2)) && (base2 < (base1+size1)));
}
static inline long
lmb_regions_overlap(struct lmb_region *rgn, unsigned long r1, unsigned long r2)
{
unsigned long base1 = rgn->region[r1].base;
unsigned long size1 = rgn->region[r1].size;
unsigned long base2 = rgn->region[r2].base;
unsigned long size2 = rgn->region[r2].size;
return lmb_addrs_overlap(base1,size1,base2,size2);
}
static inline long
lmb_addrs_adjacent(unsigned long base1, unsigned long size1,
unsigned long base2, unsigned long size2)
{
if ( base2 == base1 + size1 ) {
return 1;
} else if ( base1 == base2 + size2 ) {
return -1;
}
return 0;
}
static inline long
lmb_regions_adjacent(struct lmb_region *rgn, unsigned long r1, unsigned long r2)
{
unsigned long base1 = rgn->region[r1].base;
unsigned long size1 = rgn->region[r1].size;
unsigned long type1 = rgn->region[r1].type;
unsigned long base2 = rgn->region[r2].base;
unsigned long size2 = rgn->region[r2].size;
unsigned long type2 = rgn->region[r2].type;
return (type1 == type2) && lmb_addrs_adjacent(base1,size1,base2,size2);
}
extern struct lmb lmb __initdata;
extern void __init lmb_init(void);
extern void __init lmb_analyze(void);
extern long __init lmb_add(unsigned long, unsigned long);
extern long __init lmb_reserve(unsigned long, unsigned long);
extern unsigned long __init lmb_alloc(unsigned long, unsigned long);
extern unsigned long __init lmb_alloc_base(unsigned long, unsigned long,
unsigned long);
extern unsigned long __init lmb_phys_mem_size(void);
extern unsigned long __init lmb_end_of_DRAM(void);
extern unsigned long __init lmb_abs_to_phys(unsigned long);
#endif /* _PPC64_LMB_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment