Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: Kill off machvec aliases.

We now throw all of the machvecs in to .machvec.init and either
select one on the command line, or copy out the first (and
usually only) one to sh_mv. The rest are freed as usual.

This gets rid of all of the silly sh_mv aliasing and makes the
selection explicit rather than link-order dependent.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

authored by

Paul Mundt and committed by
Paul Mundt
82f81f47 25f8151b

+69 -91
+1 -2
arch/sh/boards/dreamcast/setup.c
··· 60 60 #endif 61 61 } 62 62 63 - struct sh_machine_vector mv_dreamcast __initmv = { 63 + static struct sh_machine_vector mv_dreamcast __initmv = { 64 64 .mv_name = "Sega Dreamcast", 65 65 .mv_setup = dreamcast_setup, 66 66 .mv_irq_demux = systemasic_irq_demux, ··· 70 70 .mv_consistent_free = dreamcast_consistent_free, 71 71 #endif 72 72 }; 73 - ALIAS_MV(dreamcast)
+1 -3
arch/sh/boards/hp6xx/mach.c
··· 13 13 #include <asm/io.h> 14 14 #include <asm/irq.h> 15 15 16 - struct sh_machine_vector mv_hp6xx __initmv = { 16 + static struct sh_machine_vector mv_hp6xx __initmv = { 17 17 .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM, 18 18 19 19 .mv_inb = hd64461_inb, ··· 42 42 43 43 .mv_irq_demux = hd64461_irq_demux, 44 44 }; 45 - 46 - ALIAS_MV(hp6xx)
+1 -2
arch/sh/boards/hp6xx/setup.c
··· 98 98 } 99 99 device_initcall(hp6xx_devices_setup); 100 100 101 - struct sh_machine_vector mv_hp6xx __initmv = { 101 + static struct sh_machine_vector mv_hp6xx __initmv = { 102 102 .mv_name = "hp6xx", 103 103 .mv_setup = hp6xx_setup, 104 104 .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM, 105 105 .mv_irq_demux = hd64461_irq_demux, 106 106 }; 107 - ALIAS_MV(hp6xx)
+1 -2
arch/sh/boards/landisk/setup.c
··· 97 97 /* 98 98 * The Machine Vector 99 99 */ 100 - struct sh_machine_vector mv_landisk __initmv = { 100 + static struct sh_machine_vector mv_landisk __initmv = { 101 101 .mv_name = "LANDISK", 102 102 .mv_nr_irqs = 72, 103 103 .mv_setup = landisk_setup, 104 104 .mv_init_irq = init_landisk_IRQ, 105 105 }; 106 - ALIAS_MV(landisk)
+1 -2
arch/sh/boards/lboxre2/setup.c
··· 77 77 /* 78 78 * The Machine Vector 79 79 */ 80 - struct sh_machine_vector mv_lboxre2 __initmv = { 80 + static struct sh_machine_vector mv_lboxre2 __initmv = { 81 81 .mv_name = "L-BOX RE2", 82 82 .mv_nr_irqs = 72, 83 83 .mv_init_irq = init_lboxre2_IRQ, 84 84 }; 85 - ALIAS_MV(lboxre2)
+1 -2
arch/sh/boards/mpc1211/setup.c
··· 338 338 /* 339 339 * The Machine Vector 340 340 */ 341 - struct sh_machine_vector mv_mpc1211 __initmv = { 341 + static struct sh_machine_vector mv_mpc1211 __initmv = { 342 342 .mv_name = "Interface MPC-1211(CTP/PCI/MPC-SH02)", 343 343 .mv_setup = mpc1211_setup, 344 344 .mv_nr_irqs = 48, 345 345 .mv_irq_demux = mpc1211_irq_demux, 346 346 .mv_init_irq = init_mpc1211_IRQ, 347 347 }; 348 - ALIAS_MV(mpc1211)
+1 -2
arch/sh/boards/renesas/edosk7705/setup.c
··· 21 21 /* 22 22 * The Machine Vector 23 23 */ 24 - struct sh_machine_vector mv_edosk7705 __initmv = { 24 + static struct sh_machine_vector mv_edosk7705 __initmv = { 25 25 .mv_name = "EDOSK7705", 26 26 .mv_nr_irqs = 80, 27 27 ··· 41 41 .mv_isa_port2addr = sh_edosk7705_isa_port2addr, 42 42 .mv_init_irq = sh_edosk7705_init_irq, 43 43 }; 44 - ALIAS_MV(edosk7705)
+1 -2
arch/sh/boards/renesas/hs7751rvoip/setup.c
··· 89 89 printk(KERN_INFO "Renesas Technology Sales HS7751RVoIP-2 support.\n"); 90 90 } 91 91 92 - struct sh_machine_vector mv_hs7751rvoip __initmv = { 92 + static struct sh_machine_vector mv_hs7751rvoip __initmv = { 93 93 .mv_name = "HS7751RVoIP", 94 94 .mv_setup = hs7751rvoip_setup, 95 95 .mv_nr_irqs = 72, ··· 118 118 .mv_init_irq = hs7751rvoip_init_irq, 119 119 .mv_ioport_map = hs7751rvoip_ioport_map, 120 120 }; 121 - ALIAS_MV(hs7751rvoip)
+1 -2
arch/sh/boards/renesas/r7780rp/setup.c
··· 166 166 /* 167 167 * The Machine Vector 168 168 */ 169 - struct sh_machine_vector mv_highlander __initmv = { 169 + static struct sh_machine_vector mv_highlander __initmv = { 170 170 .mv_name = "Highlander", 171 171 .mv_nr_irqs = 109, 172 172 .mv_setup = highlander_setup, 173 173 .mv_init_irq = highlander_init_irq, 174 174 }; 175 - ALIAS_MV(highlander)
+1 -2
arch/sh/boards/renesas/rts7751r2d/setup.c
··· 176 176 /* 177 177 * The Machine Vector 178 178 */ 179 - struct sh_machine_vector mv_rts7751r2d __initmv = { 179 + static struct sh_machine_vector mv_rts7751r2d __initmv = { 180 180 .mv_name = "RTS7751R2D", 181 181 .mv_setup = rts7751r2d_setup, 182 182 .mv_nr_irqs = 72, ··· 189 189 .mv_consistent_free = voyagergx_consistent_free, 190 190 #endif 191 191 }; 192 - ALIAS_MV(rts7751r2d)
+1 -2
arch/sh/boards/renesas/sh7710voipgw/setup.c
··· 88 88 /* 89 89 * The Machine Vector 90 90 */ 91 - struct sh_machine_vector mv_sh7710voipgw __initmv = { 91 + static struct sh_machine_vector mv_sh7710voipgw __initmv = { 92 92 .mv_name = "SH7710 VoIP Gateway", 93 93 .mv_nr_irqs = 104, 94 94 .mv_init_irq = sh7710voipgw_init_irq, 95 95 }; 96 - ALIAS_MV(sh7710voipgw)
+1 -2
arch/sh/boards/renesas/systemh/setup.c
··· 28 28 make_systemh_irq(0xb); /* Ethernet interrupt */ 29 29 } 30 30 31 - struct sh_machine_vector mv_7751systemh __initmv = { 31 + static struct sh_machine_vector mv_7751systemh __initmv = { 32 32 .mv_name = "7751 SystemH", 33 33 .mv_nr_irqs = 72, 34 34 ··· 55 55 56 56 .mv_init_irq = sh7751systemh_init_irq, 57 57 }; 58 - ALIAS_MV(7751systemh)
+1 -2
arch/sh/boards/saturn/setup.c
··· 18 18 /* 19 19 * The Machine Vector 20 20 */ 21 - struct sh_machine_vector mv_saturn __initmv = { 21 + static struct sh_machine_vector mv_saturn __initmv = { 22 22 .mv_name = "Sega Saturn", 23 23 .mv_nr_irqs = 80, /* Fix this later */ 24 24 ··· 28 28 .mv_ioremap = saturn_ioremap, 29 29 .mv_iounmap = saturn_iounmap, 30 30 }; 31 - ALIAS_MV(saturn)
+1 -2
arch/sh/boards/se/7206/setup.c
··· 70 70 * The Machine Vector 71 71 */ 72 72 73 - struct sh_machine_vector mv_se __initmv = { 73 + static struct sh_machine_vector mv_se __initmv = { 74 74 .mv_name = "SolutionEngine", 75 75 .mv_nr_irqs = 256, 76 76 .mv_inb = se7206_inb, ··· 96 96 97 97 .mv_init_irq = init_se7206_IRQ, 98 98 }; 99 - ALIAS_MV(se)
+1 -2
arch/sh/boards/se/7300/setup.c
··· 46 46 /* 47 47 * The Machine Vector 48 48 */ 49 - struct sh_machine_vector mv_7300se __initmv = { 49 + static struct sh_machine_vector mv_7300se __initmv = { 50 50 .mv_name = "SolutionEngine 7300", 51 51 .mv_nr_irqs = 109, 52 52 .mv_inb = sh7300se_inb, ··· 72 72 73 73 .mv_init_irq = init_7300se_IRQ, 74 74 }; 75 - ALIAS_MV(7300se)
+1 -2
arch/sh/boards/se/73180/setup.c
··· 46 46 /* 47 47 * The Machine Vector 48 48 */ 49 - struct sh_machine_vector mv_73180se __initmv = { 49 + static struct sh_machine_vector mv_73180se __initmv = { 50 50 .mv_name = "SolutionEngine 73180", 51 51 .mv_nr_irqs = 108, 52 52 .mv_inb = sh73180se_inb, ··· 73 73 .mv_init_irq = init_73180se_IRQ, 74 74 .mv_irq_demux = shmse_irq_demux, 75 75 }; 76 - ALIAS_MV(73180se)
+1 -2
arch/sh/boards/se/7343/setup.c
··· 64 64 /* 65 65 * The Machine Vector 66 66 */ 67 - struct sh_machine_vector mv_7343se __initmv = { 67 + static struct sh_machine_vector mv_7343se __initmv = { 68 68 .mv_name = "SolutionEngine 7343", 69 69 .mv_setup = sh7343se_setup, 70 70 .mv_nr_irqs = 108, ··· 92 92 .mv_init_irq = init_7343se_IRQ, 93 93 .mv_irq_demux = shmse_irq_demux, 94 94 }; 95 - ALIAS_MV(7343se)
+1 -2
arch/sh/boards/se/7619/setup.c
··· 15 15 * The Machine Vector 16 16 */ 17 17 18 - struct sh_machine_vector mv_se __initmv = { 18 + static struct sh_machine_vector mv_se __initmv = { 19 19 .mv_name = "SolutionEngine", 20 20 .mv_nr_irqs = 108, 21 21 }; 22 - ALIAS_MV(se)
+1 -2
arch/sh/boards/se/770x/setup.c
··· 122 122 /* 123 123 * The Machine Vector 124 124 */ 125 - struct sh_machine_vector mv_se __initmv = { 125 + static struct sh_machine_vector mv_se __initmv = { 126 126 .mv_name = "SolutionEngine", 127 127 .mv_setup = smsc_setup, 128 128 #if defined(CONFIG_CPU_SH4) ··· 160 160 161 161 .mv_init_irq = init_se_IRQ, 162 162 }; 163 - ALIAS_MV(se)
+1 -2
arch/sh/boards/se/7722/setup.c
··· 137 137 /* 138 138 * The Machine Vector 139 139 */ 140 - struct sh_machine_vector mv_se7722 __initmv = { 140 + static struct sh_machine_vector mv_se7722 __initmv = { 141 141 .mv_name = "Solution Engine 7722" , 142 142 .mv_setup = se7722_setup , 143 143 .mv_nr_irqs = 109 , ··· 145 145 .mv_irq_demux = se7722_irq_demux, 146 146 147 147 }; 148 - ALIAS_MV(se7722)
+1 -2
arch/sh/boards/se/7751/setup.c
··· 48 48 /* 49 49 * The Machine Vector 50 50 */ 51 - struct sh_machine_vector mv_7751se __initmv = { 51 + static struct sh_machine_vector mv_7751se __initmv = { 52 52 .mv_name = "7751 SolutionEngine", 53 53 .mv_nr_irqs = 72, 54 54 ··· 71 71 72 72 .mv_init_irq = init_7751se_IRQ, 73 73 }; 74 - ALIAS_MV(7751se)
+1 -2
arch/sh/boards/se/7780/setup.c
··· 113 113 /* 114 114 * The Machine Vector 115 115 */ 116 - struct sh_machine_vector mv_se7780 __initmv = { 116 + static struct sh_machine_vector mv_se7780 __initmv = { 117 117 .mv_name = "Solution Engine 7780" , 118 118 .mv_setup = se7780_setup , 119 119 .mv_nr_irqs = 111 , 120 120 .mv_init_irq = init_se7780_IRQ, 121 121 }; 122 - ALIAS_MV(se7780)
+1 -2
arch/sh/boards/sh03/setup.c
··· 74 74 } 75 75 __initcall(sh03_devices_setup); 76 76 77 - struct sh_machine_vector mv_sh03 __initmv = { 77 + static struct sh_machine_vector mv_sh03 __initmv = { 78 78 .mv_name = "Interface (CTP/PCI-SH03)", 79 79 .mv_setup = sh03_setup, 80 80 .mv_nr_irqs = 48, 81 81 .mv_ioport_map = sh03_ioport_map, 82 82 .mv_init_irq = init_sh03_IRQ, 83 83 }; 84 - ALIAS_MV(sh03)
+1 -2
arch/sh/boards/shmin/setup.c
··· 43 43 44 44 } 45 45 46 - struct sh_machine_vector mv_shmin __initmv = { 46 + static struct sh_machine_vector mv_shmin __initmv = { 47 47 .mv_name = "SHMIN", 48 48 .mv_init_irq = init_shmin_irq, 49 49 .mv_ioport_map = shmin_ioport_map, 50 50 }; 51 - ALIAS_MV(shmin)
+1 -2
arch/sh/boards/snapgear/setup.c
··· 96 96 /* 97 97 * The Machine Vector 98 98 */ 99 - struct sh_machine_vector mv_snapgear __initmv = { 99 + static struct sh_machine_vector mv_snapgear __initmv = { 100 100 .mv_name = "SnapGear SecureEdge5410", 101 101 .mv_setup = snapgear_setup, 102 102 .mv_nr_irqs = 72, ··· 117 117 118 118 .mv_init_irq = init_snapgear_IRQ, 119 119 }; 120 - ALIAS_MV(snapgear)
+1 -2
arch/sh/boards/superh/microdev/setup.c
··· 371 371 /* 372 372 * The Machine Vector 373 373 */ 374 - struct sh_machine_vector mv_sh4202_microdev __initmv = { 374 + static struct sh_machine_vector mv_sh4202_microdev __initmv = { 375 375 .mv_name = "SH4-202 MicroDev", 376 376 .mv_setup = microdev_setup, 377 377 .mv_nr_irqs = 72, /* QQQ need to check this - use the MACRO */ ··· 403 403 .mv_heartbeat = microdev_heartbeat, 404 404 #endif 405 405 }; 406 - ALIAS_MV(sh4202_microdev)
+1 -2
arch/sh/boards/titan/setup.c
··· 28 28 make_ipr_irq(titan_ipr_map, ARRAY_SIZE(titan_ipr_map)); 29 29 } 30 30 31 - struct sh_machine_vector mv_titan __initmv = { 31 + static struct sh_machine_vector mv_titan __initmv = { 32 32 .mv_name = "Titan", 33 33 34 34 .mv_inb = titan_inb, ··· 52 52 53 53 .mv_init_irq = init_titan_irq, 54 54 }; 55 - ALIAS_MV(titan)
+1 -2
arch/sh/boards/unknown/setup.c
··· 15 15 #include <linux/init.h> 16 16 #include <asm/machvec.h> 17 17 18 - struct sh_machine_vector mv_unknown __initmv = { 18 + static struct sh_machine_vector mv_unknown __initmv = { 19 19 .mv_name = "Unknown", 20 20 }; 21 - ALIAS_MV(unknown)
+31 -14
arch/sh/kernel/machvec.c
··· 29 29 struct sh_machine_vector *mv; 30 30 31 31 for_each_mv(mv) 32 - if (strcasecmp(name, get_system_type()) == 0) 32 + if (strcasecmp(name, mv->mv_name) == 0) 33 33 return mv; 34 34 35 35 return NULL; ··· 55 55 mv_name[mv_len] = '\0'; 56 56 from = mv_end; 57 57 58 - if (strcmp(sh_mv.mv_name, mv_name) != 0) { 59 - mvp = get_mv_byname(mv_name); 60 - if (unlikely(!mvp)) { 61 - printk("Available vectors:\n\n\t"); 62 - for_each_mv(mvp) 63 - printk("'%s', ", mvp->mv_name); 64 - printk("\n\n"); 65 - panic("Failed to select machvec '%s' -- halting.\n", 66 - mv_name); 67 - } else 68 - sh_mv = *mvp; 69 - } 58 + mvp = get_mv_byname(mv_name); 59 + if (unlikely(!mvp)) { 60 + printk("Available vectors:\n\n\t"); 61 + for_each_mv(mvp) 62 + printk("'%s', ", mvp->mv_name); 63 + printk("\n\n"); 64 + panic("Failed to select machvec '%s' -- halting.\n", 65 + mv_name); 66 + } else 67 + sh_mv = *mvp; 70 68 71 - printk(KERN_NOTICE "Booting machvec: %s\n", sh_mv.mv_name); 72 69 return 0; 73 70 } 74 71 early_param("sh_mv", early_parse_mv); 75 72 76 73 void __init sh_mv_setup(void) 77 74 { 75 + /* 76 + * Only overload the machvec if one hasn't been selected on 77 + * the command line with sh_mv= 78 + */ 79 + if (strcmp(sh_mv.mv_name, "Unknown") != 0) { 80 + unsigned long machvec_size; 81 + 82 + machvec_size = ((unsigned long)&__machvec_end - 83 + (unsigned long)&__machvec_start); 84 + 85 + /* 86 + * If the machvec hasn't been preselected, use the first 87 + * vector (usually the only one) from .machvec.init. 88 + */ 89 + if (machvec_size >= sizeof(struct sh_machine_vector)) 90 + sh_mv = *(struct sh_machine_vector *)&__machvec_start; 91 + } 92 + 93 + printk(KERN_NOTICE "Booting machvec: %s\n", get_system_type()); 94 + 78 95 /* 79 96 * Manually walk the vec, fill in anything that the board hasn't yet 80 97 * by hand, wrapping to the generic implementation.
+7
arch/sh/kernel/setup.c
··· 42 42 * The bigger value means no problem. 43 43 */ 44 44 struct sh_cpuinfo boot_cpu_data = { CPU_SH_NONE, 10000000, }; 45 + 46 + /* 47 + * The machine vector. First entry in .machvec.init, or clobbered by 48 + * sh_mv= on the command line, prior to .machvec.init teardown. 49 + */ 50 + struct sh_machine_vector sh_mv = { .mv_name = "Unknown", }; 51 + 45 52 #ifdef CONFIG_VT 46 53 struct screen_info screen_info; 47 54 #endif
+3 -1
include/asm-sh/machvec.h
··· 13 13 #include <linux/types.h> 14 14 #include <linux/time.h> 15 15 #include <asm/machtypes.h> 16 - #include <asm/machvec_init.h> 17 16 18 17 struct device; 19 18 ··· 66 67 extern struct sh_machine_vector sh_mv; 67 68 68 69 #define get_system_type() sh_mv.mv_name 70 + 71 + #define __initmv \ 72 + __attribute_used__ __attribute__((__section__ (".machvec.init"))) 69 73 70 74 #endif /* _ASM_SH_MACHVEC_H */
-19
include/asm-sh/machvec_init.h
··· 1 - /* 2 - * include/asm-sh/machvec_init.h 3 - * 4 - * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) 5 - * 6 - * May be copied or modified under the terms of the GNU General Public 7 - * License. See linux/COPYING for more information. 8 - * 9 - * This file has goodies to help simplify instantiation of machine vectors. 10 - */ 11 - 12 - #ifndef __SH_MACHVEC_INIT_H 13 - #define __SH_MACHVEC_INIT_H 14 - 15 - #define __initmv __attribute__((unused,__section__ (".machvec.init"))) 16 - #define ALIAS_MV(system) \ 17 - asm(".weak sh_mv\nsh_mv = mv_"#system ); 18 - 19 - #endif /* __SH_MACHVEC_INIT_H */