printk(KERN_DEBUG "ar71xx: failed to parse mac address "
"\"%s\"\n", mac_str);
}
+
+static int __init ar71xx_ethaddr_setup(char *str)
+{
+ ar71xx_parse_mac_addr(str);
+ return 1;
+}
+__setup("ethaddr=", ar71xx_ethaddr_setup);
+
+static int __init ar71xx_kmac_setup(char *str)
+{
+ ar71xx_parse_mac_addr(str);
+ return 1;
+}
+__setup("kmac=", ar71xx_kmac_setup);
ar913x_add_device_wmac(eeprom, NULL);
}
-MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup);
+MIPS_MACHINE(AR71XX_MACH_AP81, "AP81", "Atheros AP81", ap81_setup);
}
}
-MIPS_MACHINE(AR71XX_MACH_AP83, "Atheros AP83", ap83_setup);
+MIPS_MACHINE(AR71XX_MACH_AP83, "AP83", "Atheros AP83", ap83_setup);
aw_nr580_gpio_buttons);
}
-MIPS_MACHINE(AR71XX_MACH_AW_NR580, "AzureWave AW-NR580", aw_nr580_setup);
+MIPS_MACHINE(AR71XX_MACH_AW_NR580, "AW-NR580", "AzureWave AW-NR580",
+ aw_nr580_setup);
ar913x_add_device_wmac(eeprom, wlan_mac);
}
-MIPS_MACHINE(AR71XX_MACH_DIR_615_C1, "D-Link DIR-615 rev. C1", dir_615c1_setup);
+MIPS_MACHINE(AR71XX_MACH_DIR_615_C1, "DIR-615-C1", "D-Link DIR-615 rev. C1",
+ dir_615c1_setup);
(u8 *) KSEG1ADDR(DIR825B1_MAC_LOCATION_1));
}
-MIPS_MACHINE(AR71XX_MACH_DIR_825_B1, "D-Link DIR-825 rev. B1", dir825b1_setup);
+MIPS_MACHINE(AR71XX_MACH_DIR_825_B1, "DIR-825-B1", "D-Link DIR-825 rev. B1",
+ dir825b1_setup);
/* Nothing to do */
}
-MIPS_MACHINE(AR71XX_MACH_GENERIC, "Generic AR71xx board", ar71xx_generic_init);
+MIPS_MACHINE(AR71XX_MACH_GENERIC, "Generic", "Generic AR71xx board",
+ ar71xx_generic_init);
ar913x_add_device_wmac(eeprom, NULL);
}
-MIPS_MACHINE(AR71XX_MACH_MZK_W04NU, "Planex MZK-W04NU", mzk_w04nu_setup);
+MIPS_MACHINE(AR71XX_MACH_MZK_W04NU, "MZK-W04NU", "Planex MZK-W04NU",
+ mzk_w04nu_setup);
ar913x_add_device_wmac(eeprom, NULL);
}
-MIPS_MACHINE(AR71XX_MACH_MZK_W300NH, "Planex MZK-W300NH", mzk_w300nh_setup);
+MIPS_MACHINE(AR71XX_MACH_MZK_W300NH, "MZK-W300NH", "Planex MZK-W300NH",
+ mzk_w300nh_setup);
pb42_pci_init();
}
-MIPS_MACHINE(AR71XX_MACH_PB42, "Atheros PB42", pb42_init);
+MIPS_MACHINE(AR71XX_MACH_PB42, "PB42", "Atheros PB42", pb42_init);
pb44_gpio_buttons);
}
-MIPS_MACHINE(AR71XX_MACH_PB44, "Atheros PB44", pb44_init);
+MIPS_MACHINE(AR71XX_MACH_PB44, "PB44", "Atheros PB44", pb44_init);
ar71xx_pci_init(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
}
-MIPS_MACHINE(AR71XX_MACH_RB_411, "MikroTik RouterBOARD 411/A/AH", rb411_setup);
+MIPS_MACHINE(AR71XX_MACH_RB_411, "411", "MikroTik RouterBOARD 411/A/AH",
+ rb411_setup);
static void __init rb411u_setup(void)
{
ar71xx_add_device_usb();
}
-MIPS_MACHINE(AR71XX_MACH_RB_411U, "MikroTik RouterBOARD 411U", rb411u_setup);
+MIPS_MACHINE(AR71XX_MACH_RB_411U, "411U", "MikroTik RouterBOARD 411U",
+ rb411u_setup);
static void __init rb433_setup(void)
{
ar71xx_pci_init(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
}
-MIPS_MACHINE(AR71XX_MACH_RB_433, "MikroTik RouterBOARD 433/AH", rb433_setup);
+MIPS_MACHINE(AR71XX_MACH_RB_433, "433", "MikroTik RouterBOARD 433/AH",
+ rb433_setup);
static void __init rb433u_setup(void)
{
ar71xx_add_device_usb();
}
-MIPS_MACHINE(AR71XX_MACH_RB_433U, "MikroTik RouterBOARD 433UAH", rb433u_setup);
+MIPS_MACHINE(AR71XX_MACH_RB_433U, "433U", "MikroTik RouterBOARD 433UAH",
+ rb433u_setup);
static void __init rb450_generic_setup(int gige)
{
rb450_generic_setup(0);
}
-MIPS_MACHINE(AR71XX_MACH_RB_450, "MikroTik RouterBOARD 450", rb450_setup);
+MIPS_MACHINE(AR71XX_MACH_RB_450, "450", "MikroTik RouterBOARD 450",
+ rb450_setup);
static void __init rb450g_setup(void)
{
rb450_generic_setup(1);
}
-MIPS_MACHINE(AR71XX_MACH_RB_450G, "MikroTik RouterBOARD 450G", rb450g_setup);
+MIPS_MACHINE(AR71XX_MACH_RB_450G, "450G", "MikroTik RouterBOARD 450G",
+ rb450g_setup);
static void __init rb493_setup(void)
{
ar71xx_pci_init(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
}
-MIPS_MACHINE(AR71XX_MACH_RB_493, "MikroTik RouterBOARD 493/AH", rb493_setup);
+MIPS_MACHINE(AR71XX_MACH_RB_493, "493", "MikroTik RouterBOARD 493/AH",
+ rb493_setup);
ar913x_add_device_wmac(eeprom, wlan_mac);
}
-MIPS_MACHINE(AR71XX_MACH_TEW_632BRP, "TRENDnet TEW-632BRP", tew_632brp_setup);
+MIPS_MACHINE(AR71XX_MACH_TEW_632BRP, "TEW-632BRP", "TRENDnet TEW-632BRP",
+ tew_632brp_setup);
ar913x_add_device_wmac(eeprom, NULL);
}
-MIPS_MACHINE(AR71XX_MACH_TL_WR1043ND, "TP-LINK TL-WR1043ND", tl_wr1043nd_setup);
+MIPS_MACHINE(AR71XX_MACH_TL_WR1043ND, "TL-WR1043ND", "TP-LINK TL-WR1043ND",
+ tl_wr1043nd_setup);
ap91_pci_init(ee, NULL);
}
-MIPS_MACHINE(AR71XX_MACH_TL_WR741ND, "TP-LINK TL-WR741ND", tl_wr741nd_setup);
+MIPS_MACHINE(AR71XX_MACH_TL_WR741ND, "TL-WR741ND", "TP-LINK TL-WR741ND",
+ tl_wr741nd_setup);
pb42_pci_init();
}
-MIPS_MACHINE(AR71XX_MACH_TL_WR841N_V1, "TP-LINK TL-WR841N v1",
+MIPS_MACHINE(AR71XX_MACH_TL_WR841N_V1, "TL-WR841N-v1.5", "TP-LINK TL-WR841N v1",
tl_wr841n_v1_setup);
ar913x_add_device_wmac(eeprom, mac);
}
-MIPS_MACHINE(AR71XX_MACH_TL_WR941ND, "TP-LINK TL-WR941ND", tl_wr941nd_setup);
+MIPS_MACHINE(AR71XX_MACH_TL_WR941ND, "TL-WR941ND", "TP-LINK TL-WR941ND",
+ tl_wr941nd_setup);
ubnt_rs_leds_gpio);
}
-MIPS_MACHINE(AR71XX_MACH_UBNT_RS, "Ubiquiti RouterStation", ubnt_rs_setup);
+MIPS_MACHINE(AR71XX_MACH_UBNT_RS, "UBNT-RS", "Ubiquiti RouterStation",
+ ubnt_rs_setup);
+
+MIPS_MACHINE(AR71XX_MACH_UBNT_AR71XX, "Ubiquiti AR71xx-based board",
+ "Ubiquiti RouterStation", ubnt_rs_setup);
static void __init ubnt_rspro_setup(void)
{
ubnt_rs_leds_gpio);
}
-MIPS_MACHINE(AR71XX_MACH_UBNT_RSPRO, "Ubiquiti RouterStation Pro",
+MIPS_MACHINE(AR71XX_MACH_UBNT_RSPRO, "UBNT-RSPRO", "Ubiquiti RouterStation Pro",
ubnt_rspro_setup);
static void __init ubnt_lsx_setup(void)
ubnt_generic_setup();
}
-MIPS_MACHINE(AR71XX_MACH_UBNT_LSX, "Ubiquiti LSX", ubnt_lsx_setup);
+MIPS_MACHINE(AR71XX_MACH_UBNT_LSX, "UBNT-LSX", "Ubiquiti LSX", ubnt_lsx_setup);
#define UBNT_LSSR71_PHY_MASK (1 << 1)
ubnt_ls_sr71_leds_gpio);
}
-MIPS_MACHINE(AR71XX_MACH_UBNT_LSSR71, "Ubiquiti LS-SR71", ubnt_lssr71_setup);
+MIPS_MACHINE(AR71XX_MACH_UBNT_LSSR71, "UBNT-LS-SR71", "Ubiquiti LS-SR71",
+ ubnt_lssr71_setup);
static void __init ubnt_m_setup(void)
{
ar71xx_add_device_usb();
}
-MIPS_MACHINE(AR71XX_MACH_UBNT_BULLET_M, "Ubiquiti Bullet M", ubnt_m_setup);
-MIPS_MACHINE(AR71XX_MACH_UBNT_ROCKET_M, "Ubiquiti Rocket M", ubnt_rocket_m_setup);
+MIPS_MACHINE(AR71XX_MACH_UBNT_BULLET_M, "UBNT-BM", "Ubiquiti Bullet M",
+ ubnt_m_setup);
+MIPS_MACHINE(AR71XX_MACH_UBNT_ROCKET_M, "UBNT-RM", "Ubiquiti Rocket M",
+ ubnt_rocket_m_setup);
/* TODO detect the second ethernet port and use one
init function for all Ubiquiti MIMO series products */
ar71xx_add_device_eth(1);
}
-MIPS_MACHINE(AR71XX_MACH_UBNT_NANO_M, "Ubiquiti Nanostation M", ubnt_nano_m_setup);
+MIPS_MACHINE(AR71XX_MACH_UBNT_NANO_M, "UBNT-NM", "Ubiquiti Nanostation M",
+ ubnt_nano_m_setup);
art + WNDR3700_WMAC1_MAC_OFFSET);
}
-MIPS_MACHINE(AR71XX_MACH_WNDR3700, "NETGEAR WNDR3700", wndr3700_setup);
+MIPS_MACHINE(AR71XX_MACH_WNDR3700, "WNDR3700", "NETGEAR WNDR3700",
+ wndr3700_setup);
ar913x_add_device_wmac(eeprom, NULL);
}
-MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup);
+MIPS_MACHINE(AR71XX_MACH_WNR2000, "WNR2000", "NETGEAR WNR2000", wnr2000_setup);
wp543_gpio_buttons);
}
-MIPS_MACHINE(AR71XX_MACH_WP543, "Compex WP543", wp543_setup);
+MIPS_MACHINE(AR71XX_MACH_WP543, "WP543", "Compex WP543", wp543_setup);
}
-MIPS_MACHINE(AR71XX_MACH_WRT160NL, "Linksys WRT160NL", wrt160nl_setup);
+MIPS_MACHINE(AR71XX_MACH_WRT160NL, "WRT160NL", "Linksys WRT160NL",
+ wrt160nl_setup);
/* TODO: PCI support */
}
-MIPS_MACHINE(AR71XX_MACH_WRT400N, "Linksys WRT400N", wrt400n_setup);
+MIPS_MACHINE(AR71XX_MACH_WRT400N, "WRT400N", "Linksys WRT400N", wrt400n_setup);
AR71XX_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */
AR71XX_MACH_UBNT_LSX, /* Ubiquiti LSX */
AR71XX_MACH_UBNT_RS, /* Ubiquiti RouterStation */
+ AR71XX_MACH_UBNT_AR71XX, /* Ubiquiti AR71xx-based board */
AR71XX_MACH_UBNT_RSPRO, /* Ubiquiti RouterStation Pro */
AR71XX_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */
AR71XX_MACH_UBNT_ROCKET_M, /* Ubiquiti Rocket M */
AR71XX_MACH_WRT400N, /* Linksys WRT400N */
};
-extern enum ar71xx_mach_type ar71xx_mach;
-
#endif /* _AR71XX_MACHTYPE_H */
#include <asm/mach-ar71xx/ar71xx.h>
-#include "machtype.h"
-#include "devices.h"
-
-struct board_rec {
- char *name;
- enum ar71xx_mach_type mach_type;
-};
-
-static struct board_rec boards[] __initdata = {
- {
- .name = "411",
- .mach_type = AR71XX_MACH_RB_411,
- }, {
- .name = "411U",
- .mach_type = AR71XX_MACH_RB_411U,
- }, {
- .name = "433",
- .mach_type = AR71XX_MACH_RB_433,
- }, {
- .name = "433U",
- .mach_type = AR71XX_MACH_RB_433U,
- }, {
- .name = "450",
- .mach_type = AR71XX_MACH_RB_450,
- }, {
- .name = "450G",
- .mach_type = AR71XX_MACH_RB_450G,
- }, {
- .name = "493",
- .mach_type = AR71XX_MACH_RB_493,
- }, {
- .name = "AP81",
- .mach_type = AR71XX_MACH_AP81,
- }, {
- .name = "AP83",
- .mach_type = AR71XX_MACH_AP83,
- }, {
- .name = "AW-NR580",
- .mach_type = AR71XX_MACH_AW_NR580,
- }, {
- .name = "DIR-825-B1",
- .mach_type = AR71XX_MACH_DIR_825_B1,
- }, {
- .name = "TEW-632BRP",
- .mach_type = AR71XX_MACH_TEW_632BRP,
- }, {
- .name = "DIR-615-C1",
- .mach_type = AR71XX_MACH_DIR_615_C1,
- }, {
- .name = "TL-WR741ND",
- .mach_type = AR71XX_MACH_TL_WR741ND,
- }, {
- .name = "TL-WR841N-v1.5",
- .mach_type = AR71XX_MACH_TL_WR841N_V1,
- }, {
- .name = "TL-WR941ND",
- .mach_type = AR71XX_MACH_TL_WR941ND,
- }, {
- .name = "TL-WR1043ND",
- .mach_type = AR71XX_MACH_TL_WR1043ND,
- }, {
- .name = "UBNT-RS",
- .mach_type = AR71XX_MACH_UBNT_RS,
- }, {
- .name = "UBNT-RSPRO",
- .mach_type = AR71XX_MACH_UBNT_RSPRO,
- }, {
- .name = "Ubiquiti AR71xx-based board",
- .mach_type = AR71XX_MACH_UBNT_RS,
- }, {
- .name = "UBNT-LS-SR71",
- .mach_type = AR71XX_MACH_UBNT_LSSR71,
- }, {
- .name = "UBNT-LSX",
- .mach_type = AR71XX_MACH_UBNT_LSX,
- }, {
- .name = "UBNT-BM",
- .mach_type = AR71XX_MACH_UBNT_BULLET_M,
- }, {
- .name = "UBNT-RM",
- .mach_type = AR71XX_MACH_UBNT_ROCKET_M,
- }, {
- .name = "UBNT-NM",
- .mach_type = AR71XX_MACH_UBNT_NANO_M,
- }, {
- .name = "WNDR3700",
- .mach_type = AR71XX_MACH_WNDR3700,
- }, {
- .name = "WNR2000",
- .mach_type = AR71XX_MACH_WNR2000,
- }, {
- .name = "WRT160NL",
- .mach_type = AR71XX_MACH_WRT160NL,
- }, {
- .name = "WP543",
- .mach_type = AR71XX_MACH_WP543,
- }, {
- .name = "WRT400N",
- .mach_type = AR71XX_MACH_WRT400N,
- }, {
- .name = "PB42",
- .mach_type = AR71XX_MACH_PB42,
- }, {
- .name = "PB44",
- .mach_type = AR71XX_MACH_PB44,
- }, {
- .name = "MZK-W300NH",
- .mach_type = AR71XX_MACH_MZK_W300NH,
- }, {
- .name = "MZK-W04NU",
- .mach_type = AR71XX_MACH_MZK_W04NU,
- }
-};
-
-static int __init ar71xx_board_setup(char *name)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(boards); i++)
- if (strcmp(name, boards[i].name) == 0) {
- ar71xx_mach = boards[i].mach_type;
- break;
- }
-
- return 1;
-}
-__setup("board=", ar71xx_board_setup);
-
-static int __init ar71xx_ethaddr_setup(char *str)
-{
- ar71xx_parse_mac_addr(str);
- return 1;
-}
-__setup("ethaddr=", ar71xx_ethaddr_setup);
-
-static int __init ar71xx_kmac_setup(char *str)
-{
- ar71xx_parse_mac_addr(str);
- return 1;
-}
-__setup("kmac=", ar71xx_kmac_setup);
-
static inline int is_valid_ram_addr(void *addr)
{
if (((u32) addr > KSEG0) &&
(unsigned int)fw_arg2, (unsigned int)fw_arg3);
- ar71xx_mach = AR71XX_MACH_GENERIC;
-
if (ar71xx_prom_init_myloader())
return;
#define AR91XX_BASE_FREQ 5000000
#define AR724X_BASE_FREQ 5000000
-enum ar71xx_mach_type ar71xx_mach;
-
u32 ar71xx_cpu_freq;
EXPORT_SYMBOL_GPL(ar71xx_cpu_freq);
mips_hpt_frequency = ar71xx_cpu_freq / 2;
}
+__setup("board=", mips_machtype_setup);
+
static int __init ar71xx_machine_setup(void)
{
ar71xx_gpio_init();
ar71xx_add_device_uart();
ar71xx_add_device_wdt();
- mips_machine_setup(ar71xx_mach);
+ mips_machine_setup();
return 0;
}
--- /dev/null
+--- a/arch/mips/kernel/mips_machine.c
++++ b/arch/mips/kernel/mips_machine.c
+@@ -7,12 +7,13 @@
+ *
+ */
+ #include <linux/mm.h>
++#include <linux/string.h>
+
+ #include <asm/mips_machine.h>
+-#include <asm/bootinfo.h>
+
+ static struct list_head mips_machines __initdata =
+ LIST_HEAD_INIT(mips_machines);
++static char *mips_machid __initdata;
+
+ char *mips_machine_name = "Unknown";
+
+@@ -55,20 +56,64 @@ void __init mips_machine_set_name(char *
+ }
+ }
+
+-void __init mips_machine_setup(unsigned long machtype)
++void __init mips_machine_setup(void)
+ {
+ struct mips_machine *mach;
+
+- mach = mips_machine_find(machtype);
++ mach = mips_machine_find(mips_machtype);
+ if (!mach) {
+- printk(KERN_ALERT "MIPS: no machine registered for "
+- "machtype %lu\n", machtype);
++ printk(KERN_WARNING "MIPS: no machine registered for "
++ "machtype %lu\n", mips_machtype);
+ return;
+ }
+
+ mips_machine_set_name(mach->mach_name);
+- printk(KERN_INFO "MIPS: machine is %s\n", mips_machine_name);
++ printk(KERN_NOTICE "MIPS: machine is %s\n", mips_machine_name);
+
+ if (mach->mach_setup)
+ mach->mach_setup();
+ }
++
++int __init mips_machtype_setup(char *id)
++{
++ if (mips_machid == NULL)
++ mips_machid = id;
++
++ return 1;
++}
++
++__setup("machtype=", mips_machtype_setup);
++
++static int __init mips_machtype_init(void)
++{
++ struct list_head *this;
++ struct mips_machine *mach;
++
++ if (mips_machid == NULL)
++ return 0;
++
++ list_for_each(this, &mips_machines) {
++ mach = list_entry(this, struct mips_machine, list);
++ if (strncmp(mach->mach_id, mips_machid,
++ strlen(mips_machid)) == 0
++ ) {
++ mips_machtype = mach->mach_type;
++ return 0;
++ }
++ }
++
++ printk(KERN_WARNING
++ "MIPS: no machine found for id: '%s', registered machines:\n",
++ mips_machid);
++ printk(KERN_WARNING "%32s %s\n", "id", "name");
++
++ list_for_each(this, &mips_machines) {
++ mach = list_entry(this, struct mips_machine, list);
++ printk(KERN_WARNING "%32s %s\n",
++ mach->mach_id, mach->mach_name);
++ }
++
++ return 0;
++}
++
++core_initcall(mips_machtype_init);
+--- a/include/asm-mips/mips_machine.h
++++ b/include/asm-mips/mips_machine.h
+@@ -13,24 +13,32 @@
+ #include <linux/init.h>
+ #include <linux/list.h>
+
++#include <asm/bootinfo.h>
++
+ struct mips_machine {
+ unsigned long mach_type;
+- void (*mach_setup)(void);
++ char *mach_id;
+ char *mach_name;
++ void (*mach_setup)(void);
+ struct list_head list;
+ };
+
+ void mips_machine_register(struct mips_machine *) __init;
+-void mips_machine_setup(unsigned long machtype) __init;
++void mips_machine_setup(void) __init;
++int mips_machtype_setup(char *id) __init;
+ void mips_machine_set_name(char *name) __init;
+
+ 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 = \
++#define MIPS_MACHINE(_type, _id, _name, _setup) \
++static char machine_name_##_type[] __initconst \
++ __aligned(1) = _name; \
++static char machine_id_##_type[] __initconst \
++ __aligned(1) = _id; \
++static struct mips_machine machine_##_type __initconst = \
+ { \
+ .mach_type = _type, \
++ .mach_id = machine_id_##_type, \
+ .mach_name = machine_name_##_type, \
+ .mach_setup = _setup, \
+ }; \
--- /dev/null
+--- a/arch/mips/kernel/mips_machine.c
++++ b/arch/mips/kernel/mips_machine.c
+@@ -7,12 +7,13 @@
+ *
+ */
+ #include <linux/mm.h>
++#include <linux/string.h>
+
+ #include <asm/mips_machine.h>
+-#include <asm/bootinfo.h>
+
+ static struct list_head mips_machines __initdata =
+ LIST_HEAD_INIT(mips_machines);
++static char *mips_machid __initdata;
+
+ char *mips_machine_name = "Unknown";
+
+@@ -55,20 +56,64 @@ void __init mips_machine_set_name(char *
+ }
+ }
+
+-void __init mips_machine_setup(unsigned long machtype)
++void __init mips_machine_setup(void)
+ {
+ struct mips_machine *mach;
+
+- mach = mips_machine_find(machtype);
++ mach = mips_machine_find(mips_machtype);
+ if (!mach) {
+- printk(KERN_ALERT "MIPS: no machine registered for "
+- "machtype %lu\n", machtype);
++ printk(KERN_WARNING "MIPS: no machine registered for "
++ "machtype %lu\n", mips_machtype);
+ return;
+ }
+
+ mips_machine_set_name(mach->mach_name);
+- printk(KERN_INFO "MIPS: machine is %s\n", mips_machine_name);
++ printk(KERN_NOTICE "MIPS: machine is %s\n", mips_machine_name);
+
+ if (mach->mach_setup)
+ mach->mach_setup();
+ }
++
++int __init mips_machtype_setup(char *id)
++{
++ if (mips_machid == NULL)
++ mips_machid = id;
++
++ return 1;
++}
++
++__setup("machtype=", mips_machtype_setup);
++
++static int __init mips_machtype_init(void)
++{
++ struct list_head *this;
++ struct mips_machine *mach;
++
++ if (mips_machid == NULL)
++ return 0;
++
++ list_for_each(this, &mips_machines) {
++ mach = list_entry(this, struct mips_machine, list);
++ if (strncmp(mach->mach_id, mips_machid,
++ strlen(mips_machid)) == 0
++ ) {
++ mips_machtype = mach->mach_type;
++ return 0;
++ }
++ }
++
++ printk(KERN_WARNING
++ "MIPS: no machine found for id: '%s', registered machines:\n",
++ mips_machid);
++ printk(KERN_WARNING "%32s %s\n", "id", "name");
++
++ list_for_each(this, &mips_machines) {
++ mach = list_entry(this, struct mips_machine, list);
++ printk(KERN_WARNING "%32s %s\n",
++ mach->mach_id, mach->mach_name);
++ }
++
++ return 0;
++}
++
++core_initcall(mips_machtype_init);
+--- a/include/asm-mips/mips_machine.h
++++ b/include/asm-mips/mips_machine.h
+@@ -13,24 +13,32 @@
+ #include <linux/init.h>
+ #include <linux/list.h>
+
++#include <asm/bootinfo.h>
++
+ struct mips_machine {
+ unsigned long mach_type;
+- void (*mach_setup)(void);
++ char *mach_id;
+ char *mach_name;
++ void (*mach_setup)(void);
+ struct list_head list;
+ };
+
+ void mips_machine_register(struct mips_machine *) __init;
+-void mips_machine_setup(unsigned long machtype) __init;
++void mips_machine_setup(void) __init;
++int mips_machtype_setup(char *id) __init;
+ void mips_machine_set_name(char *name) __init;
+
+ 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 = \
++#define MIPS_MACHINE(_type, _id, _name, _setup) \
++static char machine_name_##_type[] __initconst \
++ __aligned(1) = _name; \
++static char machine_id_##_type[] __initconst \
++ __aligned(1) = _id; \
++static struct mips_machine machine_##_type __initconst = \
+ { \
+ .mach_type = _type, \
++ .mach_id = machine_id_##_type, \
+ .mach_name = machine_name_##_type, \
+ .mach_setup = _setup, \
+ }; \
--- /dev/null
+--- a/arch/mips/kernel/mips_machine.c
++++ b/arch/mips/kernel/mips_machine.c
+@@ -7,12 +7,13 @@
+ *
+ */
+ #include <linux/mm.h>
++#include <linux/string.h>
+
+ #include <asm/mips_machine.h>
+-#include <asm/bootinfo.h>
+
+ static struct list_head mips_machines __initdata =
+ LIST_HEAD_INIT(mips_machines);
++static char *mips_machid __initdata;
+
+ char *mips_machine_name = "Unknown";
+
+@@ -55,20 +56,64 @@ void __init mips_machine_set_name(char *
+ }
+ }
+
+-void __init mips_machine_setup(unsigned long machtype)
++void __init mips_machine_setup(void)
+ {
+ struct mips_machine *mach;
+
+- mach = mips_machine_find(machtype);
++ mach = mips_machine_find(mips_machtype);
+ if (!mach) {
+- printk(KERN_ALERT "MIPS: no machine registered for "
+- "machtype %lu\n", machtype);
++ printk(KERN_WARNING "MIPS: no machine registered for "
++ "machtype %lu\n", mips_machtype);
+ return;
+ }
+
+ mips_machine_set_name(mach->mach_name);
+- printk(KERN_INFO "MIPS: machine is %s\n", mips_machine_name);
++ printk(KERN_NOTICE "MIPS: machine is %s\n", mips_machine_name);
+
+ if (mach->mach_setup)
+ mach->mach_setup();
+ }
++
++int __init mips_machtype_setup(char *id)
++{
++ if (mips_machid == NULL)
++ mips_machid = id;
++
++ return 1;
++}
++
++__setup("machtype=", mips_machtype_setup);
++
++static int __init mips_machtype_init(void)
++{
++ struct list_head *this;
++ struct mips_machine *mach;
++
++ if (mips_machid == NULL)
++ return 0;
++
++ list_for_each(this, &mips_machines) {
++ mach = list_entry(this, struct mips_machine, list);
++ if (strncmp(mach->mach_id, mips_machid,
++ strlen(mips_machid)) == 0
++ ) {
++ mips_machtype = mach->mach_type;
++ return 0;
++ }
++ }
++
++ printk(KERN_WARNING
++ "MIPS: no machine found for id: '%s', registered machines:\n",
++ mips_machid);
++ printk(KERN_WARNING "%32s %s\n", "id", "name");
++
++ list_for_each(this, &mips_machines) {
++ mach = list_entry(this, struct mips_machine, list);
++ printk(KERN_WARNING "%32s %s\n",
++ mach->mach_id, mach->mach_name);
++ }
++
++ return 0;
++}
++
++core_initcall(mips_machtype_init);
+--- a/include/asm-mips/mips_machine.h
++++ b/include/asm-mips/mips_machine.h
+@@ -13,24 +13,32 @@
+ #include <linux/init.h>
+ #include <linux/list.h>
+
++#include <asm/bootinfo.h>
++
+ struct mips_machine {
+ unsigned long mach_type;
+- void (*mach_setup)(void);
++ char *mach_id;
+ char *mach_name;
++ void (*mach_setup)(void);
+ struct list_head list;
+ };
+
+ void mips_machine_register(struct mips_machine *) __init;
+-void mips_machine_setup(unsigned long machtype) __init;
++void mips_machine_setup(void) __init;
++int mips_machtype_setup(char *id) __init;
+ void mips_machine_set_name(char *name) __init;
+
+ 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 = \
++#define MIPS_MACHINE(_type, _id, _name, _setup) \
++static char machine_name_##_type[] __initconst \
++ __aligned(1) = _name; \
++static char machine_id_##_type[] __initconst \
++ __aligned(1) = _id; \
++static struct mips_machine machine_##_type __initconst = \
+ { \
+ .mach_type = _type, \
++ .mach_id = machine_id_##_type, \
+ .mach_name = machine_name_##_type, \
+ .mach_setup = _setup, \
+ }; \