forked from Minki/linux
5bbec3cfe3
changes to arch/sh. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAABAgAGBQJfODUiAAoJELcQ+SIFb8Hau0wH/iPeZyv0EhIwL41OPrWhm5wb 26MNWPvPjYIpKVpr0HMXiffILv595ntvrH0Ujnh1+e8J2kRj0eT+T91UkoyGSfav oWmjgcG3NRK6p9882Oo8Xavjr1cTTclOmmDInR4lpAcfIBXkeq2eX0R1h2IuGdNM idGlXhJMkgV+xTlgZy7pYmw5pvFMqL5j7fAUQxm0UoY9kbu8Ac4bOR5WrqtFpkjt xTh9141YvSSfpRx9uMzrQLuUYGzGePhnjUGSUf/b1deYG/33lNtzhHr+QMK6BpXr zdhFalJP40+m+2tG0nCBpAIZcWiOLGb23in5n/trFx3BGZfUf5EKnhZEGUYeE7Q= =XWDn -----END PGP SIGNATURE----- Merge tag 'sh-for-5.9' of git://git.libc.org/linux-sh Pull arch/sh updates from Rich Felker: "Cleanup, SECCOMP_FILTER support, message printing fixes, and other changes to arch/sh" * tag 'sh-for-5.9' of git://git.libc.org/linux-sh: (34 commits) sh: landisk: Add missing initialization of sh_io_port_base sh: bring syscall_set_return_value in line with other architectures sh: Add SECCOMP_FILTER sh: Rearrange blocks in entry-common.S sh: switch to copy_thread_tls() sh: use the generic dma coherent remap allocator sh: don't allow non-coherent DMA for NOMMU dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig sh: unexport register_trapped_io and match_trapped_io_handler sh: don't include <asm/io_trapped.h> in <asm/io.h> sh: move the ioremap implementation out of line sh: move ioremap_fixed details out of <asm/io.h> sh: remove __KERNEL__ ifdefs from non-UAPI headers sh: sort the selects for SUPERH alphabetically sh: remove -Werror from Makefiles sh: Replace HTTP links with HTTPS ones arch/sh/configs: remove obsolete CONFIG_SOC_CAMERA* sh: stacktrace: Remove stacktrace_ops.stack() sh: machvec: Modernize printing of kernel messages sh: pci: Modernize printing of kernel messages ...
123 lines
2.8 KiB
C
123 lines
2.8 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* arch/sh/kernel/machvec.c
|
|
*
|
|
* The SuperH machine vector setup handlers, yanked from setup.c
|
|
*
|
|
* Copyright (C) 1999 Niibe Yutaka
|
|
* Copyright (C) 2002 - 2007 Paul Mundt
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/string.h>
|
|
#include <asm/machvec.h>
|
|
#include <asm/sections.h>
|
|
#include <asm/addrspace.h>
|
|
#include <asm/setup.h>
|
|
#include <asm/io.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/processor.h>
|
|
|
|
#define MV_NAME_SIZE 32
|
|
|
|
#define for_each_mv(mv) \
|
|
for ((mv) = (struct sh_machine_vector *)&__machvec_start; \
|
|
(mv) && (unsigned long)(mv) < (unsigned long)&__machvec_end; \
|
|
(mv)++)
|
|
|
|
static struct sh_machine_vector * __init get_mv_byname(const char *name)
|
|
{
|
|
struct sh_machine_vector *mv;
|
|
|
|
for_each_mv(mv)
|
|
if (strcasecmp(name, mv->mv_name) == 0)
|
|
return mv;
|
|
|
|
return NULL;
|
|
}
|
|
|
|
static unsigned int __initdata machvec_selected;
|
|
|
|
static int __init early_parse_mv(char *from)
|
|
{
|
|
char mv_name[MV_NAME_SIZE] = "";
|
|
char *mv_end;
|
|
char *mv_comma;
|
|
int mv_len;
|
|
struct sh_machine_vector *mvp;
|
|
|
|
mv_end = strchr(from, ' ');
|
|
if (mv_end == NULL)
|
|
mv_end = from + strlen(from);
|
|
|
|
mv_comma = strchr(from, ',');
|
|
mv_len = mv_end - from;
|
|
if (mv_len > (MV_NAME_SIZE-1))
|
|
mv_len = MV_NAME_SIZE-1;
|
|
memcpy(mv_name, from, mv_len);
|
|
mv_name[mv_len] = '\0';
|
|
from = mv_end;
|
|
|
|
machvec_selected = 1;
|
|
|
|
/* Boot with the generic vector */
|
|
if (strcmp(mv_name, "generic") == 0)
|
|
return 0;
|
|
|
|
mvp = get_mv_byname(mv_name);
|
|
if (unlikely(!mvp)) {
|
|
pr_info("Available vectors:\n\n\t'%s', ", sh_mv.mv_name);
|
|
for_each_mv(mvp)
|
|
pr_cont("'%s', ", mvp->mv_name);
|
|
pr_cont("\n\n");
|
|
panic("Failed to select machvec '%s' -- halting.\n",
|
|
mv_name);
|
|
} else
|
|
sh_mv = *mvp;
|
|
|
|
return 0;
|
|
}
|
|
early_param("sh_mv", early_parse_mv);
|
|
|
|
void __init sh_mv_setup(void)
|
|
{
|
|
/*
|
|
* Only overload the machvec if one hasn't been selected on
|
|
* the command line with sh_mv=
|
|
*/
|
|
if (!machvec_selected) {
|
|
unsigned long machvec_size;
|
|
|
|
machvec_size = ((unsigned long)&__machvec_end -
|
|
(unsigned long)&__machvec_start);
|
|
|
|
/*
|
|
* Sanity check for machvec section alignment. Ensure
|
|
* __initmv hasn't been misused.
|
|
*/
|
|
if (machvec_size % sizeof(struct sh_machine_vector))
|
|
panic("machvec misaligned, invalid __initmv use?");
|
|
|
|
/*
|
|
* If the machvec hasn't been preselected, use the first
|
|
* vector (usually the only one) from .machvec.init.
|
|
*/
|
|
if (machvec_size >= sizeof(struct sh_machine_vector))
|
|
sh_mv = *(struct sh_machine_vector *)&__machvec_start;
|
|
}
|
|
|
|
pr_notice("Booting machvec: %s\n", get_system_type());
|
|
|
|
/*
|
|
* Manually walk the vec, fill in anything that the board hasn't yet
|
|
* by hand, wrapping to the generic implementation.
|
|
*/
|
|
#define mv_set(elem) do { \
|
|
if (!sh_mv.mv_##elem) \
|
|
sh_mv.mv_##elem = generic_##elem; \
|
|
} while (0)
|
|
|
|
mv_set(irq_demux);
|
|
mv_set(mode_pins);
|
|
mv_set(mem_init);
|
|
}
|