Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46108
b: refs/heads/master
c: 6f284a2
h: refs/heads/master
v: v3
  • Loading branch information
Franck Bui-Huu authored and Ralf Baechle committed Feb 6, 2007
1 parent bcbddf5 commit 798c0e8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db84dc61552ae0d198a8133d28b80c3838930ba8
refs/heads/master: 6f284a2ce7b8bc49cb8455b1763357897a899abb
12 changes: 8 additions & 4 deletions trunk/arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,17 @@ static void __init bootmem_init(void)

if (min_low_pfn >= max_low_pfn)
panic("Incorrect memory mapping !!!");
if (min_low_pfn > 0) {
if (min_low_pfn > ARCH_PFN_OFFSET) {
printk(KERN_INFO
"Wasting %lu bytes for tracking %lu unused pages\n",
min_low_pfn * sizeof(struct page),
min_low_pfn);
min_low_pfn = 0;
(min_low_pfn - ARCH_PFN_OFFSET) * sizeof(struct page),
min_low_pfn - ARCH_PFN_OFFSET);
} else if (min_low_pfn < ARCH_PFN_OFFSET) {
printk(KERN_INFO
"%lu free pages won't be used\n",
ARCH_PFN_OFFSET - min_low_pfn);
}
min_low_pfn = ARCH_PFN_OFFSET;

/*
* Determine low and high memory ranges
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/asm-mips/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static inline void set_io_port_base(unsigned long base)
*/
static inline unsigned long virt_to_phys(volatile const void *address)
{
return (unsigned long)address - PAGE_OFFSET;
return (unsigned long)address - PAGE_OFFSET + PHYS_OFFSET;
}

/*
Expand All @@ -132,7 +132,7 @@ static inline unsigned long virt_to_phys(volatile const void *address)
*/
static inline void * phys_to_virt(unsigned long address)
{
return (void *)(address + PAGE_OFFSET);
return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
}

/*
Expand Down
25 changes: 21 additions & 4 deletions trunk/include/asm-mips/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@

#ifndef __ASSEMBLY__

/*
* This gives the physical RAM offset.
*/
#ifndef PHYS_OFFSET
#define PHYS_OFFSET 0UL
#endif

/*
* It's normally defined only for FLATMEM config but it's
* used in our early mem init code for all memory models.
* So always define it.
*/
#define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET)

#include <linux/pfn.h>
#include <asm/io.h>

Expand Down Expand Up @@ -132,20 +146,23 @@ typedef struct { unsigned long pgprot; } pgprot_t;
/* to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)

/*
* __pa()/__va() should be used only during mem init.
*/
#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
#define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
#else
#define __pa_page_offset(x) PAGE_OFFSET
#endif
#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x))
#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x) + PHYS_OFFSET)
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))

#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)

#ifdef CONFIG_FLATMEM

#define pfn_valid(pfn) ((pfn) < max_mapnr)
#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)

#elif defined(CONFIG_SPARSEMEM)

Expand Down

0 comments on commit 798c0e8

Please sign in to comment.