X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/27c303501e47f15ba64569c28b1a1a125ba1714b..19b6acd0905aef3f8718e694c0264ef5ddcf6403:/target/linux/generic-2.6/patches-2.6.30/020-mips_multi_machine_support.patch diff --git a/target/linux/generic-2.6/patches-2.6.30/020-mips_multi_machine_support.patch b/target/linux/generic-2.6/patches-2.6.30/020-mips_multi_machine_support.patch index ceb61580b..caabacc33 100644 --- a/target/linux/generic-2.6/patches-2.6.30/020-mips_multi_machine_support.patch +++ b/target/linux/generic-2.6/patches-2.6.30/020-mips_multi_machine_support.patch @@ -1,8 +1,8 @@ --- /dev/null -+++ b/include/asm-mips/mips_machine.h ++++ b/arch/mips/include/asm/mips_machine.h @@ -0,0 +1,47 @@ +/* -+ * Copyright (C) 2008 Gabor Juhos ++ * Copyright (C) 2008-2009 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published @@ -16,25 +16,25 @@ +#include +#include + -+#define MIPS_MACHINE_NAME_LEN 64 -+ +struct mips_machine { + unsigned long mach_type; + void (*mach_setup)(void); -+ unsigned char mach_name[MIPS_MACHINE_NAME_LEN]; ++ char *mach_name; + struct list_head list; +}; + +void mips_machine_register(struct mips_machine *) __init; +void mips_machine_setup(unsigned long machtype) __init; ++void mips_machine_set_name(char *name) __init; + -+extern unsigned char mips_machine_name[MIPS_MACHINE_NAME_LEN]; ++extern char *mips_machine_name; + +#define MIPS_MACHINE(_type, _name, _setup) \ ++static char machine_name_##_type[] __initdata = _name; \ +static struct mips_machine machine_##_type __initdata = \ +{ \ + .mach_type = _type, \ -+ .mach_name = _name, \ ++ .mach_name = machine_name_##_type, \ + .mach_setup = _setup, \ +}; \ + \ @@ -50,15 +50,16 @@ + --- /dev/null +++ b/arch/mips/kernel/mips_machine.c -@@ -0,0 +1,58 @@ +@@ -0,0 +1,74 @@ +/* -+ * Copyright (C) 2008 Gabor Juhos ++ * Copyright (C) 2008-2009 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ ++#include + +#include +#include @@ -66,7 +67,7 @@ +static struct list_head mips_machines __initdata = + LIST_HEAD_INIT(mips_machines); + -+unsigned char mips_machine_name[MIPS_MACHINE_NAME_LEN] = "Unknown"; ++char *mips_machine_name = "Unknown"; + +static struct mips_machine * __init mips_machine_find(unsigned long machtype) +{ @@ -88,6 +89,25 @@ + list_add_tail(&mach->list, &mips_machines); +} + ++void __init mips_machine_set_name(char *name) ++{ ++ unsigned int len; ++ char *p; ++ ++ if (name == NULL) ++ return; ++ ++ len = strlen(name); ++ p = kmalloc(len + 1, GFP_KERNEL); ++ if (p) { ++ strncpy(p, name, len); ++ p[len] = '\0'; ++ mips_machine_name = p; ++ } else { ++ printk(KERN_WARNING "MIPS: no memory for machine_name\n"); ++ } ++} ++ +void __init mips_machine_setup(unsigned long machtype) +{ + struct mips_machine *mach; @@ -99,16 +119,12 @@ + return; + } + -+ if (mach->mach_name[0]) -+ strncpy(mips_machine_name, mach->mach_name, -+ MIPS_MACHINE_NAME_LEN); -+ ++ mips_machine_set_name(mach->mach_name); + printk(KERN_INFO "MIPS: machine is %s\n", mips_machine_name); + + if (mach->mach_setup) + mach->mach_setup(); +} -+ --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile @@ -85,6 +85,7 @@ obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o @@ -121,7 +137,7 @@ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -802,6 +802,9 @@ config MIPS_DISABLE_OBSOLETE_IDE +@@ -803,6 +803,9 @@ config MIPS_DISABLE_OBSOLETE_IDE config SYNC_R4K bool