Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f8303dd3
Commit
f8303dd3
authored
Feb 26, 2008
by
Paul Mackerras
Browse files
Options
Browse Files
Download
Plain Diff
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6
parents
bfa274e2
74b20dad
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
223 additions
and
163 deletions
+223
-163
arch/powerpc/Kconfig
arch/powerpc/Kconfig
+1
-0
arch/powerpc/kernel/btext.c
arch/powerpc/kernel/btext.c
+2
-1
arch/powerpc/kernel/crash.c
arch/powerpc/kernel/crash.c
+2
-1
arch/powerpc/kernel/crash_dump.c
arch/powerpc/kernel/crash_dump.c
+2
-1
arch/powerpc/kernel/machine_kexec.c
arch/powerpc/kernel/machine_kexec.c
+2
-1
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/prom.c
+1
-1
arch/powerpc/kernel/rtas.c
arch/powerpc/kernel/rtas.c
+1
-1
arch/powerpc/kernel/setup-common.c
arch/powerpc/kernel/setup-common.c
+1
-1
arch/powerpc/kernel/setup_64.c
arch/powerpc/kernel/setup_64.c
+1
-1
arch/powerpc/kernel/vdso.c
arch/powerpc/kernel/vdso.c
+2
-1
arch/powerpc/mm/Makefile
arch/powerpc/mm/Makefile
+1
-1
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/hash_utils_64.c
+2
-1
arch/powerpc/mm/init_32.c
arch/powerpc/mm/init_32.c
+1
-1
arch/powerpc/mm/init_64.c
arch/powerpc/mm/init_64.c
+1
-1
arch/powerpc/mm/mem.c
arch/powerpc/mm/mem.c
+1
-1
arch/powerpc/mm/numa.c
arch/powerpc/mm/numa.c
+2
-1
arch/powerpc/mm/ppc_mmu_32.c
arch/powerpc/mm/ppc_mmu_32.c
+1
-1
arch/powerpc/mm/stab.c
arch/powerpc/mm/stab.c
+3
-1
arch/powerpc/platforms/cell/iommu.c
arch/powerpc/platforms/cell/iommu.c
+1
-1
arch/powerpc/platforms/maple/setup.c
arch/powerpc/platforms/maple/setup.c
+1
-1
arch/powerpc/platforms/powermac/setup.c
arch/powerpc/platforms/powermac/setup.c
+1
-1
arch/powerpc/platforms/ps3/htab.c
arch/powerpc/platforms/ps3/htab.c
+2
-1
arch/powerpc/platforms/ps3/mm.c
arch/powerpc/platforms/ps3/mm.c
+2
-1
arch/powerpc/platforms/ps3/os-area.c
arch/powerpc/platforms/ps3/os-area.c
+2
-1
arch/powerpc/sysdev/dart_iommu.c
arch/powerpc/sysdev/dart_iommu.c
+1
-1
arch/sparc64/Kconfig
arch/sparc64/Kconfig
+1
-0
include/asm-powerpc/abs_addr.h
include/asm-powerpc/abs_addr.h
+2
-1
include/asm-powerpc/lmb.h
include/asm-powerpc/lmb.h
+8
-74
include/asm-sparc64/lmb.h
include/asm-sparc64/lmb.h
+10
-0
include/linux/lmb.h
include/linux/lmb.h
+83
-0
lib/Kconfig
lib/Kconfig
+3
-0
lib/Makefile
lib/Makefile
+2
-0
lib/lmb.c
lib/lmb.c
+77
-64
No files found.
arch/powerpc/Kconfig
View file @
f8303dd3
...
...
@@ -90,6 +90,7 @@ config PPC
select HAVE_IDE
select HAVE_OPROFILE
select HAVE_KPROBES
select HAVE_LMB
config EARLY_PRINTK
bool
...
...
arch/powerpc/kernel/btext.c
View file @
f8303dd3
...
...
@@ -7,6 +7,7 @@
#include <linux/string.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/lmb.h>
#include <asm/sections.h>
#include <asm/prom.h>
...
...
@@ -15,7 +16,7 @@
#include <asm/mmu.h>
#include <asm/pgtable.h>
#include <asm/io.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/processor.h>
#include <asm/udbg.h>
...
...
arch/powerpc/kernel/crash.c
View file @
f8303dd3
...
...
@@ -24,12 +24,13 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/types.h>
#include <linux/lmb.h>
#include <asm/processor.h>
#include <asm/machdep.h>
#include <asm/kexec.h>
#include <asm/kdump.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/firmware.h>
#include <asm/smp.h>
#include <asm/system.h>
...
...
arch/powerpc/kernel/crash_dump.c
View file @
f8303dd3
...
...
@@ -13,8 +13,9 @@
#include <linux/crash_dump.h>
#include <linux/bootmem.h>
#include <linux/lmb.h>
#include <asm/kdump.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/firmware.h>
#include <asm/uaccess.h>
...
...
arch/powerpc/kernel/machine_kexec.c
View file @
f8303dd3
...
...
@@ -12,8 +12,9 @@
#include <linux/kexec.h>
#include <linux/reboot.h>
#include <linux/threads.h>
#include <linux/lmb.h>
#include <asm/machdep.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
void
machine_crash_shutdown
(
struct
pt_regs
*
regs
)
{
...
...
arch/powerpc/kernel/prom.c
View file @
f8303dd3
...
...
@@ -31,10 +31,10 @@
#include <linux/kexec.h>
#include <linux/debugfs.h>
#include <linux/irq.h>
#include <linux/lmb.h>
#include <asm/prom.h>
#include <asm/rtas.h>
#include <asm/lmb.h>
#include <asm/page.h>
#include <asm/processor.h>
#include <asm/irq.h>
...
...
arch/powerpc/kernel/rtas.c
View file @
f8303dd3
...
...
@@ -22,6 +22,7 @@
#include <linux/smp.h>
#include <linux/completion.h>
#include <linux/cpumask.h>
#include <linux/lmb.h>
#include <asm/prom.h>
#include <asm/rtas.h>
...
...
@@ -34,7 +35,6 @@
#include <asm/system.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
#include <asm/lmb.h>
#include <asm/udbg.h>
#include <asm/syscalls.h>
#include <asm/smp.h>
...
...
arch/powerpc/kernel/setup-common.c
View file @
f8303dd3
...
...
@@ -34,6 +34,7 @@
#include <linux/serial_8250.h>
#include <linux/debugfs.h>
#include <linux/percpu.h>
#include <linux/lmb.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/processor.h>
...
...
@@ -56,7 +57,6 @@
#include <asm/cache.h>
#include <asm/page.h>
#include <asm/mmu.h>
#include <asm/lmb.h>
#include <asm/xmon.h>
#include <asm/cputhreads.h>
...
...
arch/powerpc/kernel/setup_64.c
View file @
f8303dd3
...
...
@@ -33,6 +33,7 @@
#include <linux/serial_8250.h>
#include <linux/bootmem.h>
#include <linux/pci.h>
#include <linux/lmb.h>
#include <asm/io.h>
#include <asm/kdump.h>
#include <asm/prom.h>
...
...
@@ -55,7 +56,6 @@
#include <asm/cache.h>
#include <asm/page.h>
#include <asm/mmu.h>
#include <asm/lmb.h>
#include <asm/firmware.h>
#include <asm/xmon.h>
#include <asm/udbg.h>
...
...
arch/powerpc/kernel/vdso.c
View file @
f8303dd3
...
...
@@ -21,13 +21,14 @@
#include <linux/elf.h>
#include <linux/security.h>
#include <linux/bootmem.h>
#include <linux/lmb.h>
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/processor.h>
#include <asm/mmu.h>
#include <asm/mmu_context.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/machdep.h>
#include <asm/cputable.h>
#include <asm/sections.h>
...
...
arch/powerpc/mm/Makefile
View file @
f8303dd3
...
...
@@ -6,7 +6,7 @@ ifeq ($(CONFIG_PPC64),y)
EXTRA_CFLAGS
+=
-mno-minimal-toc
endif
obj-y
:=
fault.o mem.o
lmb.o
\
obj-y
:=
fault.o mem.o
\
init_
$(CONFIG_WORD_SIZE)
.o
\
pgtable_
$(CONFIG_WORD_SIZE)
.o
\
mmu_context_
$(CONFIG_WORD_SIZE)
.o
...
...
arch/powerpc/mm/hash_utils_64.c
View file @
f8303dd3
...
...
@@ -31,6 +31,7 @@
#include <linux/cache.h>
#include <linux/init.h>
#include <linux/signal.h>
#include <linux/lmb.h>
#include <asm/processor.h>
#include <asm/pgtable.h>
...
...
@@ -41,7 +42,7 @@
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/machdep.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/abs_addr.h>
#include <asm/tlbflush.h>
#include <asm/io.h>
...
...
arch/powerpc/mm/init_32.c
View file @
f8303dd3
...
...
@@ -30,6 +30,7 @@
#include <linux/highmem.h>
#include <linux/initrd.h>
#include <linux/pagemap.h>
#include <linux/lmb.h>
#include <asm/pgalloc.h>
#include <asm/prom.h>
...
...
@@ -41,7 +42,6 @@
#include <asm/machdep.h>
#include <asm/btext.h>
#include <asm/tlb.h>
#include <asm/lmb.h>
#include <asm/sections.h>
#include "mmu_decl.h"
...
...
arch/powerpc/mm/init_64.c
View file @
f8303dd3
...
...
@@ -38,11 +38,11 @@
#include <linux/nodemask.h>
#include <linux/module.h>
#include <linux/poison.h>
#include <linux/lmb.h>
#include <asm/pgalloc.h>
#include <asm/page.h>
#include <asm/prom.h>
#include <asm/lmb.h>
#include <asm/rtas.h>
#include <asm/io.h>
#include <asm/mmu_context.h>
...
...
arch/powerpc/mm/mem.c
View file @
f8303dd3
...
...
@@ -31,6 +31,7 @@
#include <linux/initrd.h>
#include <linux/pagemap.h>
#include <linux/suspend.h>
#include <linux/lmb.h>
#include <asm/pgalloc.h>
#include <asm/prom.h>
...
...
@@ -42,7 +43,6 @@
#include <asm/machdep.h>
#include <asm/btext.h>
#include <asm/tlb.h>
#include <asm/lmb.h>
#include <asm/sections.h>
#include <asm/vdso.h>
...
...
arch/powerpc/mm/numa.c
View file @
f8303dd3
...
...
@@ -17,8 +17,9 @@
#include <linux/nodemask.h>
#include <linux/cpu.h>
#include <linux/notifier.h>
#include <linux/lmb.h>
#include <asm/sparsemem.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/system.h>
#include <asm/smp.h>
...
...
arch/powerpc/mm/ppc_mmu_32.c
View file @
f8303dd3
...
...
@@ -26,11 +26,11 @@
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/highmem.h>
#include <linux/lmb.h>
#include <asm/prom.h>
#include <asm/mmu.h>
#include <asm/machdep.h>
#include <asm/lmb.h>
#include "mmu_decl.h"
...
...
arch/powerpc/mm/stab.c
View file @
f8303dd3
...
...
@@ -12,12 +12,14 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/lmb.h>
#include <asm/pgtable.h>
#include <asm/mmu.h>
#include <asm/mmu_context.h>
#include <asm/paca.h>
#include <asm/cputable.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/abs_addr.h>
#include <asm/firmware.h>
#include <asm/iseries/hv_call.h>
...
...
arch/powerpc/platforms/cell/iommu.c
View file @
f8303dd3
...
...
@@ -28,13 +28,13 @@
#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/lmb.h>
#include <asm/prom.h>
#include <asm/iommu.h>
#include <asm/machdep.h>
#include <asm/pci-bridge.h>
#include <asm/udbg.h>
#include <asm/lmb.h>
#include <asm/firmware.h>
#include <asm/cell-regs.h>
...
...
arch/powerpc/platforms/maple/setup.c
View file @
f8303dd3
...
...
@@ -43,6 +43,7 @@
#include <linux/smp.h>
#include <linux/bitops.h>
#include <linux/of_device.h>
#include <linux/lmb.h>
#include <asm/processor.h>
#include <asm/sections.h>
...
...
@@ -57,7 +58,6 @@
#include <asm/dma.h>
#include <asm/cputable.h>
#include <asm/time.h>
#include <asm/lmb.h>
#include <asm/mpic.h>
#include <asm/rtas.h>
#include <asm/udbg.h>
...
...
arch/powerpc/platforms/powermac/setup.c
View file @
f8303dd3
...
...
@@ -53,6 +53,7 @@
#include <linux/suspend.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
#include <linux/lmb.h>
#include <asm/reg.h>
#include <asm/sections.h>
...
...
@@ -74,7 +75,6 @@
#include <asm/iommu.h>
#include <asm/smu.h>
#include <asm/pmc.h>
#include <asm/lmb.h>
#include <asm/udbg.h>
#include "pmac.h"
...
...
arch/powerpc/platforms/ps3/htab.c
View file @
f8303dd3
...
...
@@ -19,9 +19,10 @@
*/
#include <linux/kernel.h>
#include <linux/lmb.h>
#include <asm/machdep.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/udbg.h>
#include <asm/lv1call.h>
#include <asm/ps3fb.h>
...
...
arch/powerpc/platforms/ps3/mm.c
View file @
f8303dd3
...
...
@@ -21,9 +21,10 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/memory_hotplug.h>
#include <linux/lmb.h>
#include <asm/firmware.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include <asm/udbg.h>
#include <asm/lv1call.h>
...
...
arch/powerpc/platforms/ps3/os-area.c
View file @
f8303dd3
...
...
@@ -24,8 +24,9 @@
#include <linux/fs.h>
#include <linux/syscalls.h>
#include <linux/ctype.h>
#include <linux/lmb.h>
#include <asm/
lmb
.h>
#include <asm/
prom
.h>
#include "platform.h"
...
...
arch/powerpc/sysdev/dart_iommu.c
View file @
f8303dd3
...
...
@@ -37,6 +37,7 @@
#include <linux/dma-mapping.h>
#include <linux/vmalloc.h>
#include <linux/suspend.h>
#include <linux/lmb.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/iommu.h>
...
...
@@ -44,7 +45,6 @@
#include <asm/machdep.h>
#include <asm/abs_addr.h>
#include <asm/cacheflush.h>
#include <asm/lmb.h>
#include <asm/ppc-pci.h>
#include "dart.h"
...
...
arch/sparc64/Kconfig
View file @
f8303dd3
...
...
@@ -15,6 +15,7 @@ config SPARC64
bool
default y
select HAVE_IDE
select HAVE_LMB
help
SPARC is a family of RISC microprocessors designed and marketed by
Sun Microsystems, incorporated. This port covers the newer 64-bit
...
...
include/asm-powerpc/abs_addr.h
View file @
f8303dd3
...
...
@@ -12,10 +12,11 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/lmb.h>
#include <asm/types.h>
#include <asm/page.h>
#include <asm/prom.h>
#include <asm/lmb.h>
#include <asm/firmware.h>
struct
mschunks_map
{
...
...
include/asm-powerpc/lmb.h
View file @
f8303dd3
#ifndef _ASM_POWERPC_LMB_H
#define _ASM_POWERPC_LMB_H
#ifdef __KERNEL__
/*
* Definitions for talking to the Open Firmware PROM on
* Power Macintosh computers.
*
* Copyright (C) 2001 Peter Bergner, IBM Corp.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <asm/udbg.h>
#include <linux/init.h>
#include <asm/prom.h>
#define LMB_DBG(fmt...) udbg_printf(fmt)
#define MAX_LMB_REGIONS 128
#ifdef CONFIG_PPC32
extern
unsigned
long
__max_low_memory
;
#define LMB_REAL_LIMIT __max_low_memory
#else
#define LMB_REAL_LIMIT 0
#endif
struct
lmb_property
{
unsigned
long
base
;
unsigned
long
size
;
};
struct
lmb_region
{
unsigned
long
cnt
;
unsigned
long
size
;
struct
lmb_property
region
[
MAX_LMB_REGIONS
+
1
];
};
struct
lmb
{
unsigned
long
debug
;
unsigned
long
rmo_size
;
struct
lmb_region
memory
;
struct
lmb_region
reserved
;
};
extern
struct
lmb
lmb
;
extern
void
__init
lmb_init
(
void
);
extern
void
__init
lmb_analyze
(
void
);
extern
long
__init
lmb_add
(
unsigned
long
base
,
unsigned
long
size
);
extern
long
__init
lmb_reserve
(
unsigned
long
base
,
unsigned
long
size
);
extern
unsigned
long
__init
lmb_alloc
(
unsigned
long
size
,
unsigned
long
align
);
extern
unsigned
long
__init
lmb_alloc_base
(
unsigned
long
size
,
unsigned
long
align
,
unsigned
long
max_addr
);
extern
unsigned
long
__init
__lmb_alloc_base
(
unsigned
long
size
,
unsigned
long
align
,
unsigned
long
max_addr
);
extern
unsigned
long
__init
lmb_phys_mem_size
(
void
);
extern
unsigned
long
__init
lmb_end_of_DRAM
(
void
);
extern
void
__init
lmb_enforce_memory_limit
(
unsigned
long
memory_limit
);
extern
int
__init
lmb_is_reserved
(
unsigned
long
addr
);
extern
void
lmb_dump_all
(
void
);
static
inline
unsigned
long
lmb_size_bytes
(
struct
lmb_region
*
type
,
unsigned
long
region_nr
)
{
return
type
->
region
[
region_nr
].
size
;
}
static
inline
unsigned
long
lmb_size_pages
(
struct
lmb_region
*
type
,
unsigned
long
region_nr
)
{
return
lmb_size_bytes
(
type
,
region_nr
)
>>
PAGE_SHIFT
;
}
static
inline
unsigned
long
lmb_start_pfn
(
struct
lmb_region
*
type
,
unsigned
long
region_nr
)
{
return
type
->
region
[
region_nr
].
base
>>
PAGE_SHIFT
;
}
static
inline
unsigned
long
lmb_end_pfn
(
struct
lmb_region
*
type
,
unsigned
long
region_nr
)
{
return
lmb_start_pfn
(
type
,
region_nr
)
+
lmb_size_pages
(
type
,
region_nr
);
}
#endif
/* __KERNEL__ */
#endif
/* _ASM_POWERPC_LMB_H */
include/asm-sparc64/lmb.h
0 → 100644
View file @
f8303dd3
#ifndef _SPARC64_LMB_H
#define _SPARC64_LMB_H
#include <asm/oplib.h>
#define LMB_DBG(fmt...) prom_printf(fmt)
#define LMB_REAL_LIMIT 0
#endif
/* !(_SPARC64_LMB_H) */
include/linux/lmb.h
0 → 100644
View file @
f8303dd3
#ifndef _LINUX_LMB_H
#define _LINUX_LMB_H
#ifdef __KERNEL__
/*
* Logical memory blocks.
*
* Copyright (C) 2001 Peter Bergner, IBM Corp.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/init.h>
#include <linux/mm.h>
#define MAX_LMB_REGIONS 128
struct
lmb_property
{
u64
base
;
u64
size
;
};
struct
lmb_region
{
unsigned
long
cnt
;
u64
size
;
struct
lmb_property
region
[
MAX_LMB_REGIONS
+
1
];
};
struct
lmb
{
unsigned
long
debug
;
u64
rmo_size
;
struct
lmb_region
memory
;
struct
lmb_region
reserved
;
};
extern
struct
lmb
lmb
;
extern
void
__init
lmb_init
(
void
);
extern
void
__init
lmb_analyze
(
void
);
extern
long
__init
lmb_add
(
u64
base
,
u64
size
);
extern
long
__init
lmb_reserve
(
u64
base
,
u64
size
);
extern
u64
__init
lmb_alloc
(
u64
size
,
u64
align
);
extern
u64
__init
lmb_alloc_base
(
u64
size
,
u64
,
u64
max_addr
);
extern
u64
__init
__lmb_alloc_base
(
u64
size
,
u64
align
,
u64
max_addr
);
extern
u64
__init
lmb_phys_mem_size
(
void
);
extern
u64
__init
lmb_end_of_DRAM
(
void
);
extern
void
__init
lmb_enforce_memory_limit
(
u64
memory_limit
);
extern
int
__init
lmb_is_reserved
(
u64
addr
);
extern
void
lmb_dump_all
(
void
);
static
inline
u64
lmb_size_bytes
(
struct
lmb_region
*
type
,
unsigned
long
region_nr
)
{
return
type
->
region
[
region_nr
].
size
;
}
static
inline
u64
lmb_size_pages
(
struct
lmb_region
*
type
,
unsigned
long
region_nr
)
{
return
lmb_size_bytes
(
type
,
region_nr
)
>>
PAGE_SHIFT
;
}
static
inline
u64
lmb_start_pfn
(
struct
lmb_region
*
type
,
unsigned
long
region_nr
)
{
return
type
->
region
[
region_nr
].
base
>>
PAGE_SHIFT
;
}
static
inline
u64
lmb_end_pfn
(
struct
lmb_region
*
type
,
unsigned
long
region_nr
)
{
return
lmb_start_pfn
(
type
,
region_nr
)
+
lmb_size_pages
(
type
,
region_nr
);
}
#include <asm/lmb.h>
#endif
/* __KERNEL__ */
#endif
/* _LINUX_LMB_H */
lib/Kconfig
View file @
f8303dd3
...
...
@@ -141,4 +141,7 @@ config HAS_DMA
config CHECK_SIGNATURE
bool
config HAVE_LMB
boolean
endmenu
lib/Makefile
View file @
f8303dd3
...
...
@@ -70,6 +70,8 @@ obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o
lib-$(CONFIG_GENERIC_BUG)
+=
bug.o
obj-$(CONFIG_HAVE_LMB)
+=
lmb.o
hostprogs-y
:=
gen_crc32table
clean-files
:=
crc32table.h
...
...
arch/powerpc/mm
/lmb.c
→
lib
/lmb.c
View file @
f8303dd3
...
...
@@ -3,7 +3,7 @@
*
* Peter Bergner, IBM Corp. June 2001.
* Copyright (C) 2001 Peter Bergner.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
...
...
@@ -13,19 +13,12 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/bitops.h>
#include <asm/types.h>
#include <asm/page.h>
#include <asm/prom.h>
#include <asm/lmb.h>
#ifdef CONFIG_PPC32
#include "mmu_decl.h"
/* for __max_low_memory */
#endif
#include <linux/lmb.h>
#undef DEBUG
#ifdef DEBUG
#include <asm/udbg.h>
#define DBG(fmt...) udbg_printf(fmt)
#define DBG(fmt...) LMB_DBG(fmt)
#else
#define DBG(fmt...)
#endif
...
...
@@ -41,33 +34,34 @@ void lmb_dump_all(void)
DBG
(
"lmb_dump_all:
\n
"
);
DBG
(
" memory.cnt = 0x%lx
\n
"
,
lmb
.
memory
.
cnt
);
DBG
(
" memory.size = 0x%lx
\n
"
,
lmb
.
memory
.
size
);
DBG
(
" memory.size = 0x%llx
\n
"
,
(
unsigned
long
long
)
lmb
.
memory
.
size
);
for
(
i
=
0
;
i
<
lmb
.
memory
.
cnt
;
i
++
)
{
DBG
(
" memory.region[0x%x].base = 0x%lx
\n
"
,
i
,
lmb
.
memory
.
region
[
i
].
base
);
DBG
(
" .size = 0x%lx
\n
"
,
lmb
.
memory
.
region
[
i
].
size
);
DBG
(
" memory.region[0x%x].base = 0x%l
l
x
\n
"
,
i
,
(
unsigned
long
long
)
lmb
.
memory
.
region
[
i
].
base
);
DBG
(
" .size = 0x%l
l
x
\n
"
,
(
unsigned
long
long
)
lmb
.
memory
.
region
[
i
].
size
);
}
DBG
(
"
\n
reserved.cnt = 0x%lx
\n
"
,
lmb
.
reserved
.
cnt
);
DBG
(
" reserved.size = 0x%lx
\n
"
,
lmb
.
reserved
.
size
);
for
(
i
=
0
;
i
<
lmb
.
reserved
.
cnt
;
i
++
)
{
DBG
(
" reserved.region[0x%x].base = 0x%lx
\n
"
,
i
,
lmb
.
reserved
.
region
[
i
].
base
);
DBG
(
" .size = 0x%lx
\n
"
,
lmb
.
reserved
.
region
[
i
].
size
);
DBG
(
" reserved.region[0x%x].base = 0x%l
l
x
\n
"
,
i
,
(
unsigned
long
long
)
lmb
.
reserved
.
region
[
i
].
base
);
DBG
(
" .size = 0x%l
l
x
\n
"
,
(
unsigned
long
long
)
lmb
.
reserved
.
region
[
i
].
size
);
}
#endif
/* DEBUG */
}
static
unsigned
long
__init
lmb_addrs_overlap
(
u
nsigned
long
base1
,
u
nsigned
long
size1
,
unsigned
long
base2
,
unsigned
long
size2
)
static
unsigned
long
__init
lmb_addrs_overlap
(
u
64
base1
,
u
64
size1
,
u64
base2
,
u64
size2
)
{
return
((
base1
<
(
base2
+
size2
))
&&
(
base2
<
(
base1
+
size1
)));
}
static
long
__init
lmb_addrs_adjacent
(
u
nsigned
long
base1
,
unsigned
long
size1
,
u
nsigned
long
base2
,
unsigned
long
size2
)
static
long
__init
lmb_addrs_adjacent
(
u
64
base1
,
u64
size1
,
u
64
base2
,
u64
size2
)
{
if
(
base2
==
base1
+
size1
)
return
1
;
...
...
@@ -80,10 +74,10 @@ static long __init lmb_addrs_adjacent(unsigned long base1, unsigned long size1,
static
long
__init
lmb_regions_adjacent
(
struct
lmb_region
*
rgn
,
unsigned
long
r1
,
unsigned
long
r2
)
{
u
nsigned
long
base1
=
rgn
->
region
[
r1
].
base
;
u
nsigned
long
size1
=
rgn
->
region
[
r1
].
size
;
u
nsigned
long
base2
=
rgn
->
region
[
r2
].
base
;
u
nsigned
long
size2
=
rgn
->
region
[
r2
].
size
;
u
64
base1
=
rgn
->
region
[
r1
].
base
;
u
64
size1
=
rgn
->
region
[
r1
].
size
;
u
64
base2
=
rgn
->
region
[
r2
].
base
;
u
64
size2
=
rgn
->
region
[
r2
].
size
;
return
lmb_addrs_adjacent
(
base1
,
size1
,
base2
,
size2
);
}
...
...
@@ -135,16 +129,21 @@ void __init lmb_analyze(void)
}
/* This routine called with relocation disabled. */
static
long
__init
lmb_add_region
(
struct
lmb_region
*
rgn
,
unsigned
long
base
,
unsigned
long
size
)
static
long
__init
lmb_add_region
(
struct
lmb_region
*
rgn
,
u64
base
,
u64
size
)
{
unsigned
long
coalesced
=
0
;
long
adjacent
,
i
;
if
((
rgn
->
cnt
==
1
)
&&
(
rgn
->
region
[
0
].
size
==
0
))
{
rgn
->
region
[
0
].
base
=
base
;
rgn
->
region
[
0
].
size
=
size
;
return
0
;
}
/* First try and coalesce this LMB with another. */
for
(
i
=
0
;
i
<
rgn
->
cnt
;
i
++
)
{
u
nsigned
long
rgnbase
=
rgn
->
region
[
i
].
base
;
u
nsigned
long
rgnsize
=
rgn
->
region
[
i
].
size
;
u
64
rgnbase
=
rgn
->
region
[
i
].
base
;
u
64
rgnsize
=
rgn
->
region
[
i
].
size
;
if
((
rgnbase
==
base
)
&&
(
rgnsize
==
size
))
/* Already have this region, so we're done */
...
...
@@ -185,13 +184,18 @@ static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base,
break
;
}
}
if
(
base
<
rgn
->
region
[
0
].
base
)
{
rgn
->
region
[
0
].
base
=
base
;
rgn
->
region
[
0
].
size
=
size
;
}
rgn
->
cnt
++
;
return
0
;
}
/* This routine may be called with relocation disabled. */
long
__init
lmb_add
(
u
nsigned
long
base
,
unsigned
long
size
)
long
__init
lmb_add
(
u
64
base
,
u64
size
)
{
struct
lmb_region
*
_rgn
=
&
(
lmb
.
memory
);
...
...
@@ -203,7 +207,7 @@ long __init lmb_add(unsigned long base, unsigned long size)
}
long
__init
lmb_reserve
(
u
nsigned
long
base
,
unsigned
long
size
)
long
__init
lmb_reserve
(
u
64
base
,
u64
size
)
{
struct
lmb_region
*
_rgn
=
&
(
lmb
.
reserved
);
...
...
@@ -212,14 +216,14 @@ long __init lmb_reserve(unsigned long base, unsigned long size)
return
lmb_add_region
(
_rgn
,
base
,
size
);
}
long
__init
lmb_overlaps_region
(
struct
lmb_region
*
rgn
,
u
nsigned
long
base
,
u
nsigned
long
size
)
long
__init
lmb_overlaps_region
(
struct
lmb_region
*
rgn
,
u
64
base
,
u
64
size
)
{
unsigned
long
i
;
for
(
i
=
0
;
i
<
rgn
->
cnt
;
i
++
)
{
u
nsigned
long
rgnbase
=
rgn
->
region
[
i
].
base
;
u
nsigned
long
rgnsize
=
rgn
->
region
[
i
].
size
;
u
64
rgnbase
=
rgn
->
region
[
i
].
base
;
u
64
rgnsize
=
rgn
->
region
[
i
].
size
;
if
(
lmb_addrs_overlap
(
base
,
size
,
rgnbase
,
rgnsize
)
)
{
break
;
}
...
...
@@ -228,54 +232,61 @@ long __init lmb_overlaps_region(struct lmb_region *rgn, unsigned long base,
return
(
i
<
rgn
->
cnt
)
?
i
:
-
1
;
}
u
nsigned
long
__init
lmb_alloc
(
unsigned
long
size
,
unsigned
long
align
)
u
64
__init
lmb_alloc
(
u64
size
,
u64
align
)
{
return
lmb_alloc_base
(
size
,
align
,
LMB_ALLOC_ANYWHERE
);
}
unsigned
long
__init
lmb_alloc_base
(
unsigned
long
size
,
unsigned
long
align
,
unsigned
long
max_addr
)
u64
__init
lmb_alloc_base
(
u64
size
,
u64
align
,
u64
max_addr
)
{
u
nsigned
long
alloc
;
u
64
alloc
;
alloc
=
__lmb_alloc_base
(
size
,
align
,
max_addr
);
if
(
alloc
==
0
)
panic
(
"ERROR: Failed to allocate 0x%l
x bytes below 0x%
lx.
\n
"
,
size
,
max_addr
);
panic
(
"ERROR: Failed to allocate 0x%l
lx bytes below 0x%l
lx.
\n
"
,
(
unsigned
long
long
)
size
,
(
unsigned
long
long
)
max_addr
);
return
alloc
;
}
unsigned
long
__init
__lmb_alloc_base
(
unsigned
long
size
,
unsigned
long
align
,
unsigned
long
max_addr
)
static
u64
lmb_align_down
(
u64
addr
,
u64
size
)
{
return
addr
&
~
(
size
-
1
);
}
static
u64
lmb_align_up
(
u64
addr
,
u64
size
)
{
return
(
addr
+
(
size
-
1
))
&
~
(
size
-
1
);
}
u64
__init
__lmb_alloc_base
(
u64
size
,
u64
align
,
u64
max_addr
)
{
long
i
,
j
;
u
nsigned
long
base
=
0
;
u
64
base
=
0
;
BUG_ON
(
0
==
size
);
#ifdef CONFIG_PPC32
/* On 32-bit, make sure we allocate lowmem */
/* On some platforms, make sure we allocate lowmem */
if
(
max_addr
==
LMB_ALLOC_ANYWHERE
)
max_addr
=
__max_low_memory
;
#endif
max_addr
=
LMB_REAL_LIMIT
;
for
(
i
=
lmb
.
memory
.
cnt
-
1
;
i
>=
0
;
i
--
)
{
u
nsigned
long
lmbbase
=
lmb
.
memory
.
region
[
i
].
base
;
u
nsigned
long
lmbsize
=
lmb
.
memory
.
region
[
i
].
size
;
u
64
lmbbase
=
lmb
.
memory
.
region
[
i
].
base
;
u
64
lmbsize
=
lmb
.
memory
.
region
[
i
].
size
;
if
(
max_addr
==
LMB_ALLOC_ANYWHERE
)
base
=
_ALIGN_DOWN
(
lmbbase
+
lmbsize
-
size
,
align
);
base
=
lmb_align_down
(
lmbbase
+
lmbsize
-
size
,
align
);
else
if
(
lmbbase
<
max_addr
)
{
base
=
min
(
lmbbase
+
lmbsize
,
max_addr
);
base
=
_ALIGN_DOWN
(
base
-
size
,
align
);
base
=
lmb_align_down
(
base
-
size
,
align
);
}
else
continue
;
while
((
lmbbase
<=
base
)
&&
((
j
=
lmb_overlaps_region
(
&
lmb
.
reserved
,
base
,
size
))
>=
0
)
)
base
=
_ALIGN_DOWN
(
lmb
.
reserved
.
region
[
j
].
base
-
size
,
align
);
base
=
lmb_align_down
(
lmb
.
reserved
.
region
[
j
].
base
-
size
,
align
);
if
((
base
!=
0
)
&&
(
lmbbase
<=
base
))
break
;
...
...
@@ -284,18 +295,19 @@ unsigned long __init __lmb_alloc_base(unsigned long size, unsigned long align,
if
(
i
<
0
)
return
0
;
lmb_add_region
(
&
lmb
.
reserved
,
base
,
size
);
if
(
lmb_add_region
(
&
lmb
.
reserved
,
base
,
lmb_align_up
(
size
,
align
))
<
0
)
return
0
;
return
base
;
}
/* You must call lmb_analyze() before this. */
u
nsigned
long
__init
lmb_phys_mem_size
(
void
)
u
64
__init
lmb_phys_mem_size
(
void
)
{
return
lmb
.
memory
.
size
;
}
u
nsigned
long
__init
lmb_end_of_DRAM
(
void
)
u
64
__init
lmb_end_of_DRAM
(
void
)
{
int
idx
=
lmb
.
memory
.
cnt
-
1
;
...
...
@@ -303,9 +315,10 @@ unsigned long __init lmb_end_of_DRAM(void)
}
/* You must call lmb_analyze() after this. */
void
__init
lmb_enforce_memory_limit
(
u
nsigned
long
memory_limit
)
void
__init
lmb_enforce_memory_limit
(
u
64
memory_limit
)
{
unsigned
long
i
,
limit
;
unsigned
long
i
;
u64
limit
;
struct
lmb_property
*
p
;
if
(
!
memory_limit
)
...
...
@@ -343,13 +356,13 @@ void __init lmb_enforce_memory_limit(unsigned long memory_limit)
}
}
int
__init
lmb_is_reserved
(
u
nsigned
long
addr
)
int
__init
lmb_is_reserved
(
u
64
addr
)
{
int
i
;
for
(
i
=
0
;
i
<
lmb
.
reserved
.
cnt
;
i
++
)
{
u
nsigned
long
upper
=
lmb
.
reserved
.
region
[
i
].
base
+
lmb
.
reserved
.
region
[
i
].
size
-
1
;
u
64
upper
=
lmb
.
reserved
.
region
[
i
].
base
+
lmb
.
reserved
.
region
[
i
].
size
-
1
;
if
((
addr
>=
lmb
.
reserved
.
region
[
i
].
base
)
&&
(
addr
<=
upper
))
return
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment