Skip to content

Commit

Permalink
microblaze: PCI early support for noMMU system
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Simek <monstr@monstr.eu>
  • Loading branch information
Michal Simek committed Mar 11, 2010
1 parent 1be53e0 commit 79bf3a1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion arch/microblaze/include/asm/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <asm/io.h>
#include <asm/page.h>
#include <asm/cache.h>
#include <asm/pgtable.h>

#define PGDIR_ORDER 0

Expand Down Expand Up @@ -111,7 +112,6 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
unsigned long address)
{
pte_t *pte;
extern int mem_init_done;
extern void *early_get_page(void);
if (mem_init_done) {
pte = (pte_t *)__get_free_page(GFP_KERNEL |
Expand Down
6 changes: 6 additions & 0 deletions arch/microblaze/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

#ifndef __ASSEMBLY__
extern int mem_init_done;
#endif

#ifndef CONFIG_MMU

#define pgd_present(pgd) (1) /* pages are always present on non MMU */
Expand Down Expand Up @@ -51,6 +55,8 @@ static inline int pte_file(pte_t pte) { return 0; }

#define arch_enter_lazy_cpu_mode() do {} while (0)

#define pgprot_noncached_wc(prot) prot

#else /* CONFIG_MMU */

#include <asm-generic/4level-fixup.h>
Expand Down
14 changes: 9 additions & 5 deletions arch/microblaze/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
#include <asm/sections.h>
#include <asm/tlb.h>

/* Use for MMU and noMMU because of PCI generic code */
int mem_init_done;

#ifndef CONFIG_MMU
unsigned int __page_offset;
EXPORT_SYMBOL(__page_offset);

#else
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);

int mem_init_done;
static int init_bootmem_done;
#endif /* CONFIG_MMU */

Expand Down Expand Up @@ -202,9 +204,7 @@ void __init mem_init(void)
printk(KERN_INFO "Memory: %luk/%luk available\n",
nr_free_pages() << (PAGE_SHIFT-10),
num_physpages << (PAGE_SHIFT-10));
#ifdef CONFIG_MMU
mem_init_done = 1;
#endif
}

#ifndef CONFIG_MMU
Expand All @@ -216,6 +216,10 @@ int ___range_ok(unsigned long addr, unsigned long size)
}
EXPORT_SYMBOL(___range_ok);

int page_is_ram(unsigned long pfn)
{
return __range_ok(pfn, 0);
}
#else
int page_is_ram(unsigned long pfn)
{
Expand Down Expand Up @@ -344,6 +348,8 @@ void __init *early_get_page(void)
return p;
}

#endif /* CONFIG_MMU */

void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
{
if (mem_init_done)
Expand All @@ -365,5 +371,3 @@ void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
}
return p;
}

#endif /* CONFIG_MMU */
2 changes: 2 additions & 0 deletions arch/microblaze/pci/pci-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,13 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus,
* memory, effectively behaving just like /dev/zero
*/
if ((offset + size) > hose->isa_mem_size) {
#ifdef CONFIG_MMU
printk(KERN_DEBUG
"Process %s (pid:%d) mapped non-existing PCI"
"legacy memory for 0%04x:%02x\n",
current->comm, current->pid, pci_domain_nr(bus),
bus->number);
#endif
if (vma->vm_flags & VM_SHARED)
return shmem_zero_setup(vma);
return 0;
Expand Down

0 comments on commit 79bf3a1

Please sign in to comment.