diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 13:32:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 13:32:02 -0400 |
commit | b91cba52e9b7b3f1c0037908a192d93a869ca9e5 (patch) | |
tree | bbce7f323c8f52b308af5a152673a75b3e445360 /arch/sh/kernel/machvec.c | |
parent | 98283bb49c6c8c070ebde9f47489d3e9a83c1323 (diff) | |
parent | e509ac4bbc661052dc73a2e8138800ba77d4ecb9 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6: (68 commits)
sh: sh-rtc support for SH7709.
sh: Revert __xdiv64_32 size change.
sh: Update r7785rp defconfig.
sh: Export div symbols for GCC 4.2 and ST GCC.
sh: fix race in parallel out-of-tree build
sh: Kill off dead mach.c for hp6xx.
sh: hd64461.h cleanup and added comments.
sh: Update the alignment when 4K stacks are used.
sh: Add a .bss.page_aligned section for 4K stacks.
sh: Don't let SH-4A clobber SH-4 CFLAGS.
sh: Add parport stub for SuperIO ports.
sh: Drop -Wa,-dsp for DSP tuning.
sh: Update dreamcast defconfig.
fb: pvr2fb: A few more __devinit annotations for PCI.
fb: pvr2fb: Fix up section mismatch warnings.
sh: Select IPR-IRQ for SH7091.
sh: Correct __xdiv64_32/div64_32 return value size.
sh: Fix timer-tmu build for SH-3.
sh: Add cpu and mach links to CLEAN_FILES.
sh: Preliminary support for the SH-X3 CPU.
...
Diffstat (limited to 'arch/sh/kernel/machvec.c')
-rw-r--r-- | arch/sh/kernel/machvec.c | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c new file mode 100644 index 000000000000..23c5948f0124 --- /dev/null +++ b/arch/sh/kernel/machvec.c | |||
@@ -0,0 +1,130 @@ | |||
1 | /* | ||
2 | * arch/sh/kernel/machvec.c | ||
3 | * | ||
4 | * The SuperH machine vector setup handlers, yanked from setup.c | ||
5 | * | ||
6 | * Copyright (C) 1999 Niibe Yutaka | ||
7 | * Copyright (C) 2002 - 2007 Paul Mundt | ||
8 | * | ||
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 | ||
11 | * for more details. | ||
12 | */ | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/string.h> | ||
15 | #include <asm/machvec.h> | ||
16 | #include <asm/sections.h> | ||
17 | #include <asm/io.h> | ||
18 | #include <asm/irq.h> | ||
19 | |||
20 | #define MV_NAME_SIZE 32 | ||
21 | |||
22 | #define for_each_mv(mv) \ | ||
23 | for ((mv) = (struct sh_machine_vector *)&__machvec_start; \ | ||
24 | (mv) && (unsigned long)(mv) < (unsigned long)&__machvec_end; \ | ||
25 | (mv)++) | ||
26 | |||
27 | static struct sh_machine_vector * __init get_mv_byname(const char *name) | ||
28 | { | ||
29 | struct sh_machine_vector *mv; | ||
30 | |||
31 | for_each_mv(mv) | ||
32 | if (strcasecmp(name, mv->mv_name) == 0) | ||
33 | return mv; | ||
34 | |||
35 | return NULL; | ||
36 | } | ||
37 | |||
38 | static unsigned int __initdata machvec_selected; | ||
39 | |||
40 | static int __init early_parse_mv(char *from) | ||
41 | { | ||
42 | char mv_name[MV_NAME_SIZE] = ""; | ||
43 | char *mv_end; | ||
44 | char *mv_comma; | ||
45 | int mv_len; | ||
46 | struct sh_machine_vector *mvp; | ||
47 | |||
48 | mv_end = strchr(from, ' '); | ||
49 | if (mv_end == NULL) | ||
50 | mv_end = from + strlen(from); | ||
51 | |||
52 | mv_comma = strchr(from, ','); | ||
53 | mv_len = mv_end - from; | ||
54 | if (mv_len > (MV_NAME_SIZE-1)) | ||
55 | mv_len = MV_NAME_SIZE-1; | ||
56 | memcpy(mv_name, from, mv_len); | ||
57 | mv_name[mv_len] = '\0'; | ||
58 | from = mv_end; | ||
59 | |||
60 | machvec_selected = 1; | ||
61 | |||
62 | /* Boot with the generic vector */ | ||
63 | if (strcmp(mv_name, "generic") == 0) | ||
64 | return 0; | ||
65 | |||
66 | mvp = get_mv_byname(mv_name); | ||
67 | if (unlikely(!mvp)) { | ||
68 | printk("Available vectors:\n\n\t'%s', ", sh_mv.mv_name); | ||
69 | for_each_mv(mvp) | ||
70 | printk("'%s', ", mvp->mv_name); | ||
71 | printk("\n\n"); | ||
72 | panic("Failed to select machvec '%s' -- halting.\n", | ||
73 | mv_name); | ||
74 | } else | ||
75 | sh_mv = *mvp; | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | early_param("sh_mv", early_parse_mv); | ||
80 | |||
81 | void __init sh_mv_setup(void) | ||
82 | { | ||
83 | /* | ||
84 | * Only overload the machvec if one hasn't been selected on | ||
85 | * the command line with sh_mv= | ||
86 | */ | ||
87 | if (!machvec_selected) { | ||
88 | unsigned long machvec_size; | ||
89 | |||
90 | machvec_size = ((unsigned long)&__machvec_end - | ||
91 | (unsigned long)&__machvec_start); | ||
92 | |||
93 | /* | ||
94 | * If the machvec hasn't been preselected, use the first | ||
95 | * vector (usually the only one) from .machvec.init. | ||
96 | */ | ||
97 | if (machvec_size >= sizeof(struct sh_machine_vector)) | ||
98 | sh_mv = *(struct sh_machine_vector *)&__machvec_start; | ||
99 | } | ||
100 | |||
101 | printk(KERN_NOTICE "Booting machvec: %s\n", get_system_type()); | ||
102 | |||
103 | /* | ||
104 | * Manually walk the vec, fill in anything that the board hasn't yet | ||
105 | * by hand, wrapping to the generic implementation. | ||
106 | */ | ||
107 | #define mv_set(elem) do { \ | ||
108 | if (!sh_mv.mv_##elem) \ | ||
109 | sh_mv.mv_##elem = generic_##elem; \ | ||
110 | } while (0) | ||
111 | |||
112 | mv_set(inb); mv_set(inw); mv_set(inl); | ||
113 | mv_set(outb); mv_set(outw); mv_set(outl); | ||
114 | |||
115 | mv_set(inb_p); mv_set(inw_p); mv_set(inl_p); | ||
116 | mv_set(outb_p); mv_set(outw_p); mv_set(outl_p); | ||
117 | |||
118 | mv_set(insb); mv_set(insw); mv_set(insl); | ||
119 | mv_set(outsb); mv_set(outsw); mv_set(outsl); | ||
120 | |||
121 | mv_set(readb); mv_set(readw); mv_set(readl); | ||
122 | mv_set(writeb); mv_set(writew); mv_set(writel); | ||
123 | |||
124 | mv_set(ioport_map); | ||
125 | mv_set(ioport_unmap); | ||
126 | mv_set(irq_demux); | ||
127 | |||
128 | if (!sh_mv.mv_nr_irqs) | ||
129 | sh_mv.mv_nr_irqs = NR_IRQS; | ||
130 | } | ||