adm5120: move common routerboot definitions into a separate header file
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / prom / routerboot.c
index 47483450fd5e636b6404f84350e8b3151cd3c040..d9a06d968e629a084fc1cb5cf2ac80fcbb855c17 100644 (file)
@@ -1,48 +1,34 @@
 /*
- *  $Id$
- *
  *  Mikrotik's RouterBOOT specific prom routines
  *
- *  Copyright (C) 2007 OpenWrt.org
- *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
+ *  Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ *  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.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the
- *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- *  Boston, MA  02110-1301, USA.
  */
 
 #include <linux/types.h>
-#include <linux/autoconf.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/string.h>
+#include <linux/module.h>
+#include <linux/routerboot.h>
 
 #include <asm/bootinfo.h>
 #include <asm/addrspace.h>
 
-#include <adm5120_defs.h>
+#include <asm/mach-adm5120/adm5120_defs.h>
 #include <prom/routerboot.h>
 #include "prom_read.h"
 
-static struct rb_hard_settings rb_hs;
+struct rb_hard_settings rb_hs;
 static int rb_found;
 
 static int __init routerboot_load_hs(u8 *buf, u16 buflen)
 {
        u16 id, len;
-       u8 *mac;
-       int i, j;
 
        memset(&rb_hs, 0, sizeof(rb_hs));
 
@@ -84,15 +70,8 @@ static int __init routerboot_load_hs(u8 *buf, u16 buflen)
                        rb_hs.mac_count = prom_read_le32(buf);
                        break;
                case RB_ID_MAC_ADDRESS_PACK:
-                       rb_hs.mac_count = len/RB_MAC_SIZE;
-                       if (rb_hs.mac_count > RB_MAX_MAC_COUNT)
-                               rb_hs.mac_count = RB_MAX_MAC_COUNT;
-                       mac = buf;
-                       for (i = 0; i < rb_hs.mac_count; i++) {
-                               for (j = 0; j < RB_MAC_SIZE; j++)
-                                       rb_hs.macs[i][j] = mac[j];
-                               mac += RB_MAC_SIZE;
-                       }
+                       if ((len / RB_MAC_SIZE) > 0)
+                               rb_hs.mac_base = buf;
                        break;
                }