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/kernel.h>
14 #include <linux/init.h>
15 #include <linux/string.h>
16 #include <linux/module.h>
18 #include <asm/bootinfo.h>
19 #include <asm/addrspace.h>
21 #include <asm/mach-adm5120/adm5120_defs.h>
22 #include <prom/routerboot.h>
23 #include "prom_read.h"
25 struct rb_hard_settings rb_hs
;
28 static int __init
routerboot_load_hs(u8
*buf
, u16 buflen
)
32 memset(&rb_hs
, 0, sizeof(rb_hs
));
37 if (prom_read_le32(buf
) != RB_MAGIC_HARD
)
40 /* skip magic value */
45 id
= prom_read_le16(buf
);
48 if (id
== RB_ID_TERMINATOR
|| buflen
< 2)
51 len
= prom_read_le16(buf
);
59 case RB_ID_BIOS_VERSION
:
60 rb_hs
.bios_ver
= (char *)buf
;
62 case RB_ID_BOARD_NAME
:
63 rb_hs
.name
= (char *)buf
;
65 case RB_ID_MEMORY_SIZE
:
66 rb_hs
.mem_size
= prom_read_le32(buf
);
68 case RB_ID_MAC_ADDRESS_COUNT
:
69 rb_hs
.mac_count
= prom_read_le32(buf
);
71 case RB_ID_MAC_ADDRESS_PACK
:
72 if ((len
/ RB_MAC_SIZE
) > 0)
85 #define RB_BS_OFFS 0x14
86 #define RB_OFFS_MAX (128*1024)
88 int __init
routerboot_present(void)
90 struct rb_bios_settings
*bs
;
97 base
= (u8
*)KSEG1ADDR(ADM5120_SRAM0_BASE
);
98 bs
= (struct rb_bios_settings
*)(base
+ RB_BS_OFFS
);
100 off
= prom_read_le32(&bs
->hs_offs
);
101 len
= prom_read_le32(&bs
->hs_size
);
102 if (off
> RB_OFFS_MAX
)
105 if (routerboot_load_hs(base
+off
, len
) != 0)
114 char *routerboot_get_boardname(void)
This page took 0.049479 seconds and 5 git commands to generate.