Skip to content

Commit 8386aeb

Browse files
mflemingpmundt
authored andcommitted
sh: Make most PMB functions static
There's no need to export the internal PMB functions for allocating, freeing and modifying PMB entries, etc. This way we can restrict the interface for PMB. Also remove the static from pmb_init() so that we have more freedom in setting up the initial PMB entries and turning on MMU 32bit mode. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent b336f12 commit 8386aeb

3 files changed

Lines changed: 13 additions & 16 deletions

File tree

‎arch/sh/include/asm/mmu.h‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,10 @@ struct pmb_entry {
6464
};
6565

6666
/* arch/sh/mm/pmb.c */
67-
int __set_pmb_entry(unsigned long vpn, unsigned long ppn,
68-
unsigned long flags, int *entry);
69-
int set_pmb_entry(struct pmb_entry *pmbe);
70-
void clear_pmb_entry(struct pmb_entry *pmbe);
71-
struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
72-
unsigned long flags);
73-
void pmb_free(struct pmb_entry *pmbe);
7467
long pmb_remap(unsigned long virt, unsigned long phys,
7568
unsigned long size, unsigned long flags);
7669
void pmb_unmap(unsigned long addr);
70+
int pmb_init(void);
7771
#endif /* __ASSEMBLY__ */
7872

7973
#endif /* __MMU_H */

‎arch/sh/kernel/setup.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,10 @@ void __init setup_arch(char **cmdline_p)
453453

454454
paging_init();
455455

456+
#ifdef CONFIG_PMB
457+
pmb_init();
458+
#endif
459+
456460
#ifdef CONFIG_SMP
457461
plat_smp_setup();
458462
#endif

‎arch/sh/mm/pmb.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ static int pmb_alloc_entry(void)
115115
return pos;
116116
}
117117

118-
struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
119-
unsigned long flags)
118+
static struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
119+
unsigned long flags)
120120
{
121121
struct pmb_entry *pmbe;
122122
int pos;
@@ -141,7 +141,7 @@ struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
141141
return pmbe;
142142
}
143143

144-
void pmb_free(struct pmb_entry *pmbe)
144+
static void pmb_free(struct pmb_entry *pmbe)
145145
{
146146
spin_lock_irq(&pmb_list_lock);
147147
pmb_list_del(pmbe);
@@ -153,8 +153,8 @@ void pmb_free(struct pmb_entry *pmbe)
153153
/*
154154
* Must be in P2 for __set_pmb_entry()
155155
*/
156-
void __set_pmb_entry(unsigned long vpn, unsigned long ppn,
157-
unsigned long flags, int pos)
156+
static void __set_pmb_entry(unsigned long vpn, unsigned long ppn,
157+
unsigned long flags, int pos)
158158
{
159159
ctrl_outl(vpn | PMB_V, mk_pmb_addr(pos));
160160

@@ -171,14 +171,14 @@ void __set_pmb_entry(unsigned long vpn, unsigned long ppn,
171171
ctrl_outl(ppn | flags | PMB_V, mk_pmb_data(pos));
172172
}
173173

174-
void __uses_jump_to_uncached set_pmb_entry(struct pmb_entry *pmbe)
174+
static void __uses_jump_to_uncached set_pmb_entry(struct pmb_entry *pmbe)
175175
{
176176
jump_to_uncached();
177177
__set_pmb_entry(pmbe->vpn, pmbe->ppn, pmbe->flags, pmbe->entry);
178178
back_to_cached();
179179
}
180180

181-
void __uses_jump_to_uncached clear_pmb_entry(struct pmb_entry *pmbe)
181+
static void __uses_jump_to_uncached clear_pmb_entry(struct pmb_entry *pmbe)
182182
{
183183
unsigned int entry = pmbe->entry;
184184
unsigned long addr;
@@ -327,7 +327,7 @@ static void pmb_cache_ctor(void *pmb)
327327
memset(pmb, 0, sizeof(struct pmb_entry));
328328
}
329329

330-
static int __uses_jump_to_uncached pmb_init(void)
330+
int __uses_jump_to_uncached pmb_init(void)
331331
{
332332
unsigned int nr_entries = ARRAY_SIZE(pmb_init_map);
333333
unsigned int entry, i;
@@ -364,7 +364,6 @@ static int __uses_jump_to_uncached pmb_init(void)
364364

365365
return 0;
366366
}
367-
arch_initcall(pmb_init);
368367

369368
static int pmb_seq_show(struct seq_file *file, void *iter)
370369
{

0 commit comments

Comments
 (0)