diff options
Diffstat (limited to 'arch/m68k/sun3')
-rw-r--r-- | arch/m68k/sun3/Makefile | 2 | ||||
-rw-r--r-- | arch/m68k/sun3/config.c | 21 | ||||
-rw-r--r-- | arch/m68k/sun3/dvma.c | 3 | ||||
-rw-r--r-- | arch/m68k/sun3/idprom.c | 4 | ||||
-rw-r--r-- | arch/m68k/sun3/intersil.c | 1 | ||||
-rw-r--r-- | arch/m68k/sun3/leds.c | 2 | ||||
-rw-r--r-- | arch/m68k/sun3/mmu_emu.c | 62 | ||||
-rw-r--r-- | arch/m68k/sun3/prom/printf.c | 5 | ||||
-rw-r--r-- | arch/m68k/sun3/sun3.h | 22 | ||||
-rw-r--r-- | arch/m68k/sun3/sun3dvma.c | 24 | ||||
-rw-r--r-- | arch/m68k/sun3/sun3ints.c | 16 |
11 files changed, 79 insertions, 83 deletions
diff --git a/arch/m68k/sun3/Makefile b/arch/m68k/sun3/Makefile index 9960c46d303c..4e99e17d82ea 100644 --- a/arch/m68k/sun3/Makefile +++ b/arch/m68k/sun3/Makefile @@ -5,4 +5,4 @@ obj-y := sun3ints.o sun3dvma.o idprom.o -obj-$(CONFIG_SUN3) += config.o mmu_emu.o leds.o dvma.o intersil.o +obj-$(CONFIG_SUN3) += config.o mmu_emu.o leds.o dvma.o intersil.o prom/ diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c index 229ea37dfe1b..cd8af809e0ca 100644 --- a/arch/m68k/sun3/config.c +++ b/arch/m68k/sun3/config.c @@ -17,12 +17,12 @@ #include <linux/init.h> #include <linux/memblock.h> #include <linux/platform_device.h> +#include <linux/linkage.h> #include <asm/oplib.h> #include <asm/setup.h> #include <asm/contregs.h> #include <asm/movs.h> -#include <asm/pgtable.h> #include <asm/pgalloc.h> #include <asm/sun3-head.h> #include <asm/sun3mmu.h> @@ -32,14 +32,14 @@ #include <asm/intersil.h> #include <asm/irq.h> #include <asm/sections.h> -#include <asm/segment.h> #include <asm/sun3ints.h> +#include <asm/config.h> + +#include "sun3.h" char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; -static void sun3_sched_init(irq_handler_t handler); -extern void sun3_get_model (char* model); -extern int sun3_hwclk(int set, struct rtc_time *t); +static void sun3_sched_init(void); volatile char* clock_va; extern unsigned long availmem; @@ -50,7 +50,7 @@ static void sun3_get_hardware_list(struct seq_file *m) seq_printf(m, "PROM Revision:\t%s\n", romvec->pv_monid); } -void __init sun3_init(void) +asmlinkage void __init sun3_init(void) { unsigned char enable_register; int i; @@ -90,7 +90,7 @@ void __init sun3_init(void) sun3_reserved_pmeg[249] = 1; sun3_reserved_pmeg[252] = 1; sun3_reserved_pmeg[253] = 1; - set_fs(KERNEL_DS); + set_fc(USER_DATA); } /* Without this, Bad Things happen when something calls arch_reset. */ @@ -109,13 +109,10 @@ static void sun3_halt (void) static void __init sun3_bootmem_alloc(unsigned long memory_start, unsigned long memory_end) { - unsigned long start_page; - /* align start/end to page boundaries */ memory_start = ((memory_start + (PAGE_SIZE-1)) & PAGE_MASK); memory_end = memory_end & PAGE_MASK; - start_page = __pa(memory_start) >> PAGE_SHIFT; max_pfn = num_pages = __pa(memory_end) >> PAGE_SHIFT; high_memory = (void *)memory_end; @@ -152,7 +149,7 @@ void __init config_sun3(void) sun3_bootmem_alloc(memory_start, memory_end); } -static void __init sun3_sched_init(irq_handler_t timer_routine) +static void __init sun3_sched_init(void) { sun3_disable_interrupts(); intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE); @@ -202,7 +199,7 @@ static const struct resource sun3_scsi_rsrc[] __initconst = { }, }; -int __init sun3_platform_init(void) +static int __init sun3_platform_init(void) { switch (idprom->id_machtype) { case SM_SUN3 | SM_3_160: diff --git a/arch/m68k/sun3/dvma.c b/arch/m68k/sun3/dvma.c index a2c1c9304895..83fcae6a0e79 100644 --- a/arch/m68k/sun3/dvma.c +++ b/arch/m68k/sun3/dvma.c @@ -14,7 +14,6 @@ #include <linux/memblock.h> #include <linux/list.h> #include <asm/page.h> -#include <asm/pgtable.h> #include <asm/sun3mmu.h> #include <asm/dvma.h> @@ -30,7 +29,7 @@ static unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr) j = *(volatile unsigned long *)kaddr; *(volatile unsigned long *)kaddr = j; - ptep = pfn_pte(virt_to_pfn(kaddr), PAGE_KERNEL); + ptep = pfn_pte(virt_to_pfn((void *)kaddr), PAGE_KERNEL); pte = pte_val(ptep); // pr_info("dvma_remap: addr %lx -> %lx pte %08lx\n", kaddr, vaddr, pte); if(ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] != pte) { diff --git a/arch/m68k/sun3/idprom.c b/arch/m68k/sun3/idprom.c index 1ace5353d78f..ca633a5f5eb1 100644 --- a/arch/m68k/sun3/idprom.c +++ b/arch/m68k/sun3/idprom.c @@ -17,6 +17,8 @@ #include <asm/idprom.h> #include <asm/machines.h> /* Fun with Sun released architectures. */ +#include "sun3.h" + struct idprom *idprom; EXPORT_SYMBOL(idprom); @@ -83,7 +85,7 @@ static void __init display_system_type(unsigned char machtype) prom_halt(); } -void sun3_get_model(unsigned char* model) +void sun3_get_model(char *model) { register int i; diff --git a/arch/m68k/sun3/intersil.c b/arch/m68k/sun3/intersil.c index 8fc74864de81..29674cfa9bb3 100644 --- a/arch/m68k/sun3/intersil.c +++ b/arch/m68k/sun3/intersil.c @@ -17,6 +17,7 @@ #include <asm/intersil.h> #include <asm/machdep.h> +#include "sun3.h" /* bits to set for start/run of the intersil */ #define STOP_VAL (INTERSIL_STOP | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE) diff --git a/arch/m68k/sun3/leds.c b/arch/m68k/sun3/leds.c index 7c67b58ebf13..4bb95318fd54 100644 --- a/arch/m68k/sun3/leds.c +++ b/arch/m68k/sun3/leds.c @@ -3,6 +3,8 @@ #include <asm/sun3mmu.h> #include <asm/io.h> +#include "sun3.h" + void sun3_leds(unsigned char byte) { unsigned char dfc; diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c index 582a1284059a..b39fc3717d8e 100644 --- a/arch/m68k/sun3/mmu_emu.c +++ b/arch/m68k/sun3/mmu_emu.c @@ -17,18 +17,18 @@ #include <linux/bitops.h> #include <linux/module.h> #include <linux/sched/mm.h> +#include <linux/string_choices.h> #include <asm/setup.h> #include <asm/traps.h> #include <linux/uaccess.h> #include <asm/page.h> -#include <asm/pgtable.h> #include <asm/sun3mmu.h> -#include <asm/segment.h> #include <asm/oplib.h> #include <asm/mmu_context.h> #include <asm/dvma.h> +#include "sun3.h" #undef DEBUG_MMU_EMU #define DEBUG_PROM_MAPS @@ -69,7 +69,7 @@ static unsigned char ctx_avail = CONTEXTS_NUM-1; unsigned long rom_pages[256]; /* Print a PTE value in symbolic form. For debugging. */ -void print_pte (pte_t pte) +static void print_pte(pte_t pte) { #if 0 /* Verbose version. */ @@ -192,14 +192,13 @@ void __init mmu_emu_init(unsigned long bootmem_end) for(seg = 0; seg < PAGE_OFFSET; seg += SUN3_PMEG_SIZE) sun3_put_segmap(seg, SUN3_INVALID_PMEG); - set_fs(MAKE_MM_SEG(3)); + set_fc(3); for(seg = 0; seg < 0x10000000; seg += SUN3_PMEG_SIZE) { i = sun3_get_segmap(seg); for(j = 1; j < CONTEXTS_NUM; j++) (*(romvec->pv_setctxt))(j, (void *)seg, i); } - set_fs(KERNEL_DS); - + set_fc(USER_DATA); } /* erase the mappings for a dead context. Uses the pg_dir for hints @@ -209,32 +208,32 @@ void __init mmu_emu_init(unsigned long bootmem_end) context for when they're cleared */ void clear_context(unsigned long context) { - unsigned char oldctx; - unsigned long i; + unsigned char oldctx; + unsigned long i; - if(context) { - if(!ctx_alloc[context]) - panic("clear_context: context not allocated\n"); + if (context) { + if (!ctx_alloc[context]) + panic("%s: context not allocated\n", __func__); - ctx_alloc[context]->context = SUN3_INVALID_CONTEXT; - ctx_alloc[context] = (struct mm_struct *)0; - ctx_avail++; - } + ctx_alloc[context]->context = SUN3_INVALID_CONTEXT; + ctx_alloc[context] = (struct mm_struct *)0; + ctx_avail++; + } - oldctx = sun3_get_context(); + oldctx = sun3_get_context(); - sun3_put_context(context); + sun3_put_context(context); - for(i = 0; i < SUN3_INVALID_PMEG; i++) { - if((pmeg_ctx[i] == context) && (pmeg_alloc[i] == 1)) { - sun3_put_segmap(pmeg_vaddr[i], SUN3_INVALID_PMEG); - pmeg_ctx[i] = 0; - pmeg_alloc[i] = 0; - pmeg_vaddr[i] = 0; - } - } + for (i = 0; i < SUN3_INVALID_PMEG; i++) { + if ((pmeg_ctx[i] == context) && (pmeg_alloc[i] == 1)) { + sun3_put_segmap(pmeg_vaddr[i], SUN3_INVALID_PMEG); + pmeg_ctx[i] = 0; + pmeg_alloc[i] = 0; + pmeg_vaddr[i] = 0; + } + } - sun3_put_context(oldctx); + sun3_put_context(oldctx); } /* gets an empty context. if full, kills the next context listed to @@ -264,7 +263,7 @@ unsigned long get_free_context(struct mm_struct *mm) } // check to make sure one was really free... if(new == CONTEXTS_NUM) - panic("get_free_context: failed to find free context"); + panic("%s: failed to find free context", __func__); } ctx_alloc[new] = mm; @@ -372,16 +371,15 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault) } #ifdef DEBUG_MMU_EMU - pr_info("mmu_emu_handle_fault: vaddr=%lx type=%s crp=%p\n", - vaddr, read_flag ? "read" : "write", crp); + pr_info("%s: vaddr=%lx type=%s crp=%px\n", __func__, vaddr, + str_read_write(read_flag), crp); #endif segment = (vaddr >> SUN3_PMEG_SIZE_BITS) & 0x7FF; offset = (vaddr >> SUN3_PTE_SIZE_BITS) & 0xF; #ifdef DEBUG_MMU_EMU - pr_info("mmu_emu_handle_fault: segment=%lx offset=%lx\n", segment, - offset); + pr_info("%s: segment=%lx offset=%lx\n", __func__, segment, offset); #endif pte = (pte_t *) pgd_val (*(crp + segment)); @@ -420,7 +418,7 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault) pte_val (*pte) |= SUN3_PAGE_ACCESSED; #ifdef DEBUG_MMU_EMU - pr_info("seg:%ld crp:%p ->", get_fs().seg, crp); + pr_info("seg:%ld crp:%px ->", get_fc(), crp); print_pte_vaddr (vaddr); pr_cont("\n"); #endif diff --git a/arch/m68k/sun3/prom/printf.c b/arch/m68k/sun3/prom/printf.c index b6724cc66795..db5537ef1250 100644 --- a/arch/m68k/sun3/prom/printf.c +++ b/arch/m68k/sun3/prom/printf.c @@ -25,15 +25,14 @@ prom_printf(char *fmt, ...) { va_list args; char ch, *bptr; - int i; va_start(args, fmt); #ifdef CONFIG_KGDB ppbuf[0] = 'O'; - i = vsprintf(ppbuf + 1, fmt, args) + 1; + vsprintf(ppbuf + 1, fmt, args) + 1; #else - i = vsprintf(ppbuf, fmt, args); + vsprintf(ppbuf, fmt, args); #endif bptr = ppbuf; diff --git a/arch/m68k/sun3/sun3.h b/arch/m68k/sun3/sun3.h new file mode 100644 index 000000000000..8d98c0aaedc0 --- /dev/null +++ b/arch/m68k/sun3/sun3.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include <linux/linkage.h> + +struct rtc_time; + +/* config.c */ +asmlinkage void sun3_init(void); + +/* idprom.c */ +void sun3_get_model(char *model); + +/* intersil.c */ +int sun3_hwclk(int set, struct rtc_time *t); + +/* leds.c */ +void sun3_leds(unsigned char byte); + +/* mmu_emu.c */ +void mmu_emu_init(unsigned long bootmem_end); +int mmu_emu_handle_fault(unsigned long vaddr, int read_flag, int kernel_fault); +void print_pte_vaddr(unsigned long vaddr); diff --git a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c index 399f3d06125f..225fc735e466 100644 --- a/arch/m68k/sun3/sun3dvma.c +++ b/arch/m68k/sun3/sun3dvma.c @@ -16,23 +16,10 @@ #include <linux/list.h> #include <asm/page.h> -#include <asm/pgtable.h> #include <asm/dvma.h> #undef DVMA_DEBUG -#ifdef CONFIG_SUN3X -extern void dvma_unmap_iommu(unsigned long baddr, int len); -#else -static inline void dvma_unmap_iommu(unsigned long a, int b) -{ -} -#endif - -#ifdef CONFIG_SUN3 -extern void sun3_dvma_init(void); -#endif - static unsigned long *iommu_use; #define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT) @@ -206,9 +193,7 @@ static inline int free_baddr(unsigned long baddr) unsigned long len; struct hole *hole; struct list_head *cur; - unsigned long orig_baddr; - orig_baddr = baddr; len = dvma_entry_use(baddr); dvma_entry_use(baddr) = 0; baddr &= DVMA_PAGE_MASK; @@ -267,18 +252,11 @@ void __init dvma_init(void) list_add(&(hole->list), &hole_list); - iommu_use = memblock_alloc(IOMMU_TOTAL_ENTRIES * sizeof(unsigned long), + iommu_use = memblock_alloc_or_panic(IOMMU_TOTAL_ENTRIES * sizeof(unsigned long), SMP_CACHE_BYTES); - if (!iommu_use) - panic("%s: Failed to allocate %zu bytes\n", __func__, - IOMMU_TOTAL_ENTRIES * sizeof(unsigned long)); - dvma_unmap_iommu(DVMA_START, DVMA_SIZE); -#ifdef CONFIG_SUN3 sun3_dvma_init(); -#endif - } unsigned long dvma_map_align(unsigned long kaddr, int len, int align) diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c index a5824abb4a39..32eaf55f87be 100644 --- a/arch/m68k/sun3/sun3ints.c +++ b/arch/m68k/sun3/sun3ints.c @@ -11,14 +11,13 @@ #include <linux/sched.h> #include <linux/kernel_stat.h> #include <linux/interrupt.h> -#include <asm/segment.h> #include <asm/intersil.h> #include <asm/oplib.h> #include <asm/sun3ints.h> #include <asm/irq_regs.h> #include <linux/seq_file.h> -extern void sun3_leds (unsigned char); +#include "sun3.h" void sun3_disable_interrupts(void) { @@ -30,11 +29,11 @@ void sun3_enable_interrupts(void) sun3_enable_irq(0); } -static int led_pattern[8] = { - ~(0x80), ~(0x01), - ~(0x40), ~(0x02), - ~(0x20), ~(0x04), - ~(0x10), ~(0x08) +static unsigned char led_pattern[8] = { + (u8)~(0x80), (u8)~(0x01), + (u8)~(0x40), (u8)~(0x02), + (u8)~(0x20), (u8)~(0x04), + (u8)~(0x10), (u8)~(0x08) }; volatile unsigned char* sun3_intreg; @@ -73,8 +72,7 @@ static irqreturn_t sun3_int5(int irq, void *dev_id) #ifdef CONFIG_SUN3 intersil_clear(); #endif - xtime_update(1); - update_process_times(user_mode(get_irq_regs())); + legacy_timer_tick(1); cnt = kstat_irqs_cpu(irq, 0); if (!(cnt % 20)) sun3_leds(led_pattern[cnt % 160 / 20]); |