Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173386
b: refs/heads/master
c: 20b5014
h: refs/heads/master
v: v3
  • Loading branch information
Matt Fleming authored and Paul Mundt committed Oct 10, 2009
1 parent 4087cd6 commit 321ffef
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 54 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: ef269b32763b22100eda9c0bf99d462c6cd65377
refs/heads/master: 20b5014b3e5fe7b874a3f6a1dc03b0c21cb222cd
2 changes: 2 additions & 0 deletions trunk/arch/sh/include/asm/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#define PMB_E_MASK 0x0000000f
#define PMB_E_SHIFT 8

#define PMB_PFN_MASK 0xff000000

#define PMB_SZ_16M 0x00000000
#define PMB_SZ_64M 0x00000010
#define PMB_SZ_128M 0x00000080
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sh/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void __init setup_arch(char **cmdline_p)

paging_init();

#ifdef CONFIG_PMB
#ifdef CONFIG_PMB_ENABLE
pmb_init();
#endif

Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/sh/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ obj-y += $(tlb-y)
endif

obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
obj-$(CONFIG_PMB) += pmb.o
obj-$(CONFIG_PMB_FIXED) += pmb-fixed.o
obj-$(CONFIG_PMB_ENABLE) += pmb.o
obj-$(CONFIG_NUMA) += numa.o

# Special flags for fault_64.o. This puts restrictions on the number of
Expand Down
45 changes: 0 additions & 45 deletions trunk/arch/sh/mm/pmb-fixed.c

This file was deleted.

65 changes: 60 additions & 5 deletions trunk/arch/sh/mm/pmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,20 @@ static int pmb_alloc_entry(void)
}

static struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
unsigned long flags)
unsigned long flags, int entry)
{
struct pmb_entry *pmbe;
int pos;

pos = pmb_alloc_entry();
if (pos < 0)
return ERR_PTR(pos);
if (entry == PMB_NO_ENTRY) {
pos = pmb_alloc_entry();
if (pos < 0)
return ERR_PTR(pos);
} else {
if (test_bit(entry, &pmb_map))
return ERR_PTR(-ENOSPC);
pos = entry;
}

pmbe = &pmb_entry_list[pos];
if (!pmbe)
Expand Down Expand Up @@ -187,7 +193,8 @@ long pmb_remap(unsigned long vaddr, unsigned long phys,
if (size < pmb_sizes[i].size)
continue;

pmbe = pmb_alloc(vaddr, phys, pmb_flags | pmb_sizes[i].flag);
pmbe = pmb_alloc(vaddr, phys, pmb_flags | pmb_sizes[i].flag,
PMB_NO_ENTRY);
if (IS_ERR(pmbe)) {
err = PTR_ERR(pmbe);
goto out;
Expand Down Expand Up @@ -272,6 +279,7 @@ static void __pmb_unmap(struct pmb_entry *pmbe)
} while (pmbe);
}

#ifdef CONFIG_PMB
int __uses_jump_to_uncached pmb_init(void)
{
unsigned int i;
Expand Down Expand Up @@ -309,6 +317,53 @@ int __uses_jump_to_uncached pmb_init(void)

return 0;
}
#else
int __uses_jump_to_uncached pmb_init(void)
{
int i;
unsigned long addr, data;

jump_to_uncached();

for (i = 0; i < PMB_ENTRY_MAX; i++) {
struct pmb_entry *pmbe;
unsigned long vpn, ppn, flags;

addr = PMB_DATA + (i << PMB_E_SHIFT);
data = ctrl_inl(addr);
if (!(data & PMB_V))
continue;

if (data & PMB_C) {
#if defined(CONFIG_CACHE_WRITETHROUGH)
data |= PMB_WT;
#elif defined(CONFIG_CACHE_WRITEBACK)
data &= ~PMB_WT;
#else
data &= ~(PMB_C | PMB_WT);
#endif
}
ctrl_outl(data, addr);

ppn = data & PMB_PFN_MASK;

flags = data & (PMB_C | PMB_WT | PMB_UB);
flags |= data & PMB_SZ_MASK;

addr = PMB_ADDR + (i << PMB_E_SHIFT);
data = ctrl_inl(addr);

vpn = data & PMB_PFN_MASK;

pmbe = pmb_alloc(vpn, ppn, flags, i);
WARN_ON(IS_ERR(pmbe));
}

back_to_cached();

return 0;
}
#endif /* CONFIG_PMB */

static int pmb_seq_show(struct seq_file *file, void *iter)
{
Expand Down

0 comments on commit 321ffef

Please sign in to comment.