1
0
Fork 0
alistair23-linux/arch/m68k/sun3/config.c

224 lines
5.4 KiB
C
Raw Normal View History

/*
* linux/arch/m68k/sun3/config.c
*
* Copyright (C) 1996,1997 Pekka Pietik{inen
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/seq_file.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/init.h>
mm: remove include/linux/bootmem.h Move remaining definitions and declarations from include/linux/bootmem.h into include/linux/memblock.h and remove the redundant header. The includes were replaced with the semantic patch below and then semi-automated removal of duplicated '#include <linux/memblock.h> @@ @@ - #include <linux/bootmem.h> + #include <linux/memblock.h> [sfr@canb.auug.org.au: dma-direct: fix up for the removal of linux/bootmem.h] Link: http://lkml.kernel.org/r/20181002185342.133d1680@canb.auug.org.au [sfr@canb.auug.org.au: powerpc: fix up for removal of linux/bootmem.h] Link: http://lkml.kernel.org/r/20181005161406.73ef8727@canb.auug.org.au [sfr@canb.auug.org.au: x86/kaslr, ACPI/NUMA: fix for linux/bootmem.h removal] Link: http://lkml.kernel.org/r/20181008190341.5e396491@canb.auug.org.au Link: http://lkml.kernel.org/r/1536927045-23536-30-git-send-email-rppt@linux.vnet.ibm.com Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chris Zankel <chris@zankel.net> Cc: "David S. Miller" <davem@davemloft.net> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Greentime Hu <green.hu@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Guan Xuetao <gxt@pku.edu.cn> Cc: Ingo Molnar <mingo@redhat.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Jonas Bonn <jonas@southpole.se> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Ley Foon Tan <lftan@altera.com> Cc: Mark Salter <msalter@redhat.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Matt Turner <mattst88@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Simek <monstr@monstr.eu> Cc: Palmer Dabbelt <palmer@sifive.com> Cc: Paul Burton <paul.burton@mips.com> Cc: Richard Kuo <rkuo@codeaurora.org> Cc: Richard Weinberger <richard@nod.at> Cc: Rich Felker <dalias@libc.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Serge Semin <fancer.lancer@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-30 16:09:49 -06:00
#include <linux/memblock.h>
#include <linux/platform_device.h>
#include <asm/oplib.h>
#include <asm/setup.h>
#include <asm/contregs.h>
#include <asm/movs.h>
#include <asm/pgalloc.h>
#include <asm/sun3-head.h>
#include <asm/sun3mmu.h>
#include <asm/machdep.h>
#include <asm/machines.h>
#include <asm/idprom.h>
#include <asm/intersil.h>
#include <asm/irq.h>
#include <asm/sections.h>
#include <asm/segment.h>
#include <asm/sun3ints.h>
char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
static void sun3_sched_init(void);
extern void sun3_get_model (char* model);
extern int sun3_hwclk(int set, struct rtc_time *t);
volatile char* clock_va;
extern unsigned long availmem;
unsigned long num_pages;
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)
{
unsigned char enable_register;
int i;
m68k_machtype= MACH_SUN3;
m68k_cputype = CPU_68020;
m68k_fputype = FPU_68881; /* mc68881 actually */
m68k_mmutype = MMU_SUN3;
clock_va = (char *) 0xfe06000; /* dark */
sun3_intreg = (unsigned char *) 0xfe0a000; /* magic */
sun3_disable_interrupts();
prom_init((void *)LINUX_OPPROM_BEGVM);
GET_CONTROL_BYTE(AC_SENABLE,enable_register);
enable_register |= 0x50; /* Enable FPU */
SET_CONTROL_BYTE(AC_SENABLE,enable_register);
GET_CONTROL_BYTE(AC_SENABLE,enable_register);
/* This code looks suspicious, because it doesn't subtract
memory belonging to the kernel from the available space */
memset(sun3_reserved_pmeg, 0, sizeof(sun3_reserved_pmeg));
/* Reserve important PMEGS */
/* FIXME: These should be probed instead of hardcoded */
for (i=0; i<8; i++) /* Kernel PMEGs */
sun3_reserved_pmeg[i] = 1;
sun3_reserved_pmeg[247] = 1; /* ROM mapping */
sun3_reserved_pmeg[248] = 1; /* AMD Ethernet */
sun3_reserved_pmeg[251] = 1; /* VB area */
sun3_reserved_pmeg[254] = 1; /* main I/O */
sun3_reserved_pmeg[249] = 1;
sun3_reserved_pmeg[252] = 1;
sun3_reserved_pmeg[253] = 1;
set_fs(KERNEL_DS);
}
/* Without this, Bad Things happen when something calls arch_reset. */
static void sun3_reboot (void)
{
prom_reboot ("vmlinux");
}
static void sun3_halt (void)
{
prom_halt ();
}
/* sun3 bootmem allocation */
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;
availmem = memory_start;
m68k_setup_node(0);
}
void __init config_sun3(void)
{
unsigned long memory_start, memory_end;
pr_info("ARCH: SUN3\n");
idprom_init();
/* Subtract kernel memory from available memory */
mach_sched_init = sun3_sched_init;
mach_init_IRQ = sun3_init_IRQ;
mach_reset = sun3_reboot;
mach_get_model = sun3_get_model;
mach_hwclk = sun3_hwclk;
mach_halt = sun3_halt;
mach_get_hardware_list = sun3_get_hardware_list;
memory_start = ((((unsigned long)_end) + 0x2000) & ~0x1fff);
// PROM seems to want the last couple of physical pages. --m
memory_end = *(romvec->pv_sun3mem) + PAGE_OFFSET - 2*PAGE_SIZE;
m68k_num_memory=1;
m68k_memory[0].size=*(romvec->pv_sun3mem);
sun3_bootmem_alloc(memory_start, memory_end);
}
static void __init sun3_sched_init(void)
{
sun3_disable_interrupts();
intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE);
intersil_clock->int_reg=INTERSIL_HZ_100_MASK;
intersil_clear();
sun3_enable_irq(5);
intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_ENABLE|INTERSIL_24H_MODE);
sun3_enable_interrupts();
intersil_clear();
}
#if IS_ENABLED(CONFIG_SUN3_SCSI)
static const struct resource sun3_scsi_vme_rsrc[] __initconst = {
{
.flags = IORESOURCE_IRQ,
.start = SUN3_VEC_VMESCSI0,
.end = SUN3_VEC_VMESCSI0,
}, {
.flags = IORESOURCE_MEM,
.start = 0xff200000,
.end = 0xff200021,
}, {
.flags = IORESOURCE_IRQ,
.start = SUN3_VEC_VMESCSI1,
.end = SUN3_VEC_VMESCSI1,
}, {
.flags = IORESOURCE_MEM,
.start = 0xff204000,
.end = 0xff204021,
},
};
/*
* Int: level 2 autovector
* IO: type 1, base 0x00140000, 5 bits phys space: A<4..0>
*/
static const struct resource sun3_scsi_rsrc[] __initconst = {
{
.flags = IORESOURCE_IRQ,
.start = 2,
.end = 2,
}, {
.flags = IORESOURCE_MEM,
.start = 0x00140000,
.end = 0x0014001f,
},
};
int __init sun3_platform_init(void)
{
switch (idprom->id_machtype) {
case SM_SUN3 | SM_3_160:
case SM_SUN3 | SM_3_260:
platform_device_register_simple("sun3_scsi_vme", -1,
sun3_scsi_vme_rsrc, ARRAY_SIZE(sun3_scsi_vme_rsrc));
break;
case SM_SUN3 | SM_3_50:
case SM_SUN3 | SM_3_60:
platform_device_register_simple("sun3_scsi", -1,
sun3_scsi_rsrc, ARRAY_SIZE(sun3_scsi_rsrc));
break;
}
return 0;
}
arch_initcall(sun3_platform_init);
#endif