tools: edimax_fw_header: fix suspicious memset usage
[openwrt/openwrt.git] / target / linux / adm5120 / files / arch / mips / adm5120 / prom / bootbase.c
index 7ab9d46bd6da9d19fb1200237c48b41dc0ad4819..063281e3f7a8b24192925ad8aa832d90802d1353 100644 (file)
@@ -1,29 +1,15 @@
 /*
- *  $Id$
- *
  *  ZyXEL's Bootbase 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>
@@ -32,7 +18,7 @@
 #include <asm/addrspace.h>
 #include <asm/byteorder.h>
 
-#include <adm5120_defs.h>
+#include <asm/mach-adm5120/adm5120_defs.h>
 #include <prom/zynos.h>
 #include "prom_read.h"
 
@@ -41,7 +27,7 @@
 #define BOOTEXT_ADDR_MIN       KSEG1ADDR(ADM5120_SRAM0_BASE)
 #define BOOTEXT_ADDR_MAX       (BOOTEXT_ADDR_MIN + (2*1024*1024))
 
-static int bootbase_found = 0;
+static int bootbase_found;
 static struct zynos_board_info *board_info;
 
 struct bootbase_info bootbase_info;
@@ -66,14 +52,22 @@ static inline u32 bootbase_get_bootext_addr(void)
        return prom_read_be32(&board_info->bootext_addr);
 }
 
+static inline void bootbase_get_mac(u8 *mac)
+{
+       int     i;
+
+       for (i = 0; i < 6; i++)
+               mac[i] = board_info->mac[i];
+}
+
 static inline u16 bootbase_get_vendor_id(void)
 {
-#define CHECK_VENDOR(n) (strnicmp(board_info->vendor,(n),strlen(n)) == 0)
+#define CHECK_VENDOR(n) (strnicmp(board_info->vendor, (n), strlen(n)) == 0)
        unsigned char vendor[ZYNOS_NAME_LEN];
        int i;
 
-       for (i=0; i<ZYNOS_NAME_LEN; i++)
-               vendor[i]=board_info->vendor[i];
+       for (i = 0; i < ZYNOS_NAME_LEN; i++)
+               vendor[i] = board_info->vendor[i];
 
        if CHECK_VENDOR(ZYNOS_VENDOR_ZYXEL)
                return ZYNOS_VENDOR_ID_ZYXEL;
@@ -115,6 +109,7 @@ int __init bootbase_present(void)
 
        bootbase_info.vendor_id = bootbase_get_vendor_id();
        bootbase_info.board_id = bootbase_get_board_id();
+       bootbase_get_mac(bootbase_info.mac);
 
        bootbase_found = 1;