d9e1096cbe8d7dff1d231475c244e1fca677a613
2 * Mikrotik's RouterBOOT specific prom routines
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
12 #include <linux/types.h>
13 #include <linux/autoconf.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/string.h>
17 #include <linux/module.h>
19 #include <asm/bootinfo.h>
20 #include <asm/addrspace.h>
22 #include <asm/mach-adm5120/adm5120_defs.h>
23 #include <prom/routerboot.h>
24 #include "prom_read.h"
26 struct rb_hard_settings rb_hs
;
29 static int __init
routerboot_load_hs(u8
*buf
, u16 buflen
)
33 memset(&rb_hs
, 0, sizeof(rb_hs
));
38 if (prom_read_le32(buf
) != RB_MAGIC_HARD
)
41 /* skip magic value */
46 id
= prom_read_le16(buf
);
49 if (id
== RB_ID_TERMINATOR
|| buflen
< 2)
52 len
= prom_read_le16(buf
);
60 case RB_ID_BIOS_VERSION
:
61 rb_hs
.bios_ver
= (char *)buf
;
63 case RB_ID_BOARD_NAME
:
64 rb_hs
.name
= (char *)buf
;
66 case RB_ID_MEMORY_SIZE
:
67 rb_hs
.mem_size
= prom_read_le32(buf
);
69 case RB_ID_MAC_ADDRESS_COUNT
:
70 rb_hs
.mac_count
= prom_read_le32(buf
);
72 case RB_ID_MAC_ADDRESS_PACK
:
73 if ((len
/ RB_MAC_SIZE
) > 0)
86 #define RB_BS_OFFS 0x14
87 #define RB_OFFS_MAX (128*1024)
89 int __init
routerboot_present(void)
91 struct rb_bios_settings
*bs
;
98 base
= (u8
*)KSEG1ADDR(ADM5120_SRAM0_BASE
);
99 bs
= (struct rb_bios_settings
*)(base
+ RB_BS_OFFS
);
101 off
= prom_read_le32(&bs
->hs_offs
);
102 len
= prom_read_le32(&bs
->hs_size
);
103 if (off
> RB_OFFS_MAX
)
106 if (routerboot_load_hs(base
+off
, len
) != 0)
115 char *routerboot_get_boardname(void)
This page took 0.047053 seconds and 3 git commands to generate.