2 * arch/sh/kernel/machvec.c
4 * The SuperH machine vector setup handlers, yanked from setup.c
6 * Copyright (C) 1999 Niibe Yutaka
7 * Copyright (C) 2002 - 2007 Paul Mundt
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
13 #include <linux/init.h>
14 #include <linux/string.h>
15 #include <asm/machvec.h>
16 #include <asm/sections.h>
20 #define MV_NAME_SIZE 32
22 #define for_each_mv(mv) \
23 for ((mv) = (struct sh_machine_vector *)&__machvec_start; \
24 (mv) && (unsigned long)(mv) < (unsigned long)&__machvec_end; \
27 static struct sh_machine_vector * __init get_mv_byname(const char *name)
29 struct sh_machine_vector *mv;
32 if (strcasecmp(name, get_system_type()) == 0)
38 static int __init early_parse_mv(char *from)
40 char mv_name[MV_NAME_SIZE] = "";
44 struct sh_machine_vector *mvp;
46 mv_end = strchr(from, ' ');
48 mv_end = from + strlen(from);
50 mv_comma = strchr(from, ',');
51 mv_len = mv_end - from;
52 if (mv_len > (MV_NAME_SIZE-1))
53 mv_len = MV_NAME_SIZE-1;
54 memcpy(mv_name, from, mv_len);
55 mv_name[mv_len] = '\0';
58 if (strcmp(sh_mv.mv_name, mv_name) != 0) {
59 mvp = get_mv_byname(mv_name);
61 printk("Available vectors:\n\n\t");
63 printk("'%s', ", mvp->mv_name);
65 panic("Failed to select machvec '%s' -- halting.\n",
71 printk(KERN_NOTICE "Booting machvec: %s\n", sh_mv.mv_name);
74 early_param("sh_mv", early_parse_mv);
76 void __init sh_mv_setup(void)
79 * Manually walk the vec, fill in anything that the board hasn't yet
80 * by hand, wrapping to the generic implementation.
82 #define mv_set(elem) do { \
83 if (!sh_mv.mv_##elem) \
84 sh_mv.mv_##elem = generic_##elem; \
87 mv_set(inb); mv_set(inw); mv_set(inl);
88 mv_set(outb); mv_set(outw); mv_set(outl);
90 mv_set(inb_p); mv_set(inw_p); mv_set(inl_p);
91 mv_set(outb_p); mv_set(outw_p); mv_set(outl_p);
93 mv_set(insb); mv_set(insw); mv_set(insl);
94 mv_set(outsb); mv_set(outsw); mv_set(outsl);
96 mv_set(readb); mv_set(readw); mv_set(readl);
97 mv_set(writeb); mv_set(writew); mv_set(writel);
100 mv_set(ioport_unmap);
103 if (!sh_mv.mv_nr_irqs)
104 sh_mv.mv_nr_irqs = NR_IRQS;