d5ad513d56be5e6f12d8433ab9432f7d942df15e
[openwrt.git] / target / linux / adm5120 / files / arch / mips / include / asm / mach-adm5120 / prom / routerboot.h
1 /*
2  *  Mikrotik's RouterBOOT definitions
3  *
4  *  Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
5  *
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.
9  *
10  */
11
12 #ifndef _ROUTERBOOT_H
13 #define _ROUTERBOOT_H
14
15 #define RB_MAC_SIZE             6
16
17 struct rb_bios_settings {
18         u32     hs_offs; /* hard settings offset */
19         u32     hs_size; /* hard settings size */
20         u32     fw_offs; /* firmware offset */
21         u32     ss_offs; /* soft settings offset */
22         u32     ss_size; /* soft settings size */
23 };
24
25 struct rb_hard_settings {
26         char    *name;          /* board name */
27         char    *bios_ver;      /* BIOS version */
28         u32     mem_size;       /* memory size in bytes */
29         u32     mac_count;      /* number of mac addresses */
30         u8      *mac_base;      /* mac address base */
31 };
32
33 /*
34  * Magic numbers
35  */
36 #define RB_MAGIC_HARD   0x64726148 /* "Hard" */
37 #define RB_MAGIC_SOFT   0x74666F53 /* "Soft" */
38 #define RB_MAGIC_DAWN   0x6E776144 /* "Dawn" */
39
40 #define RB_ID_TERMINATOR        0
41
42 /*
43  * ID values for Hardware settings
44  */
45 #define RB_ID_HARD_01           1
46 #define RB_ID_HARD_02           2
47 #define RB_ID_FLASH_INFO        3
48 #define RB_ID_MAC_ADDRESS_PACK  4
49 #define RB_ID_BOARD_NAME        5
50 #define RB_ID_BIOS_VERSION      6
51 #define RB_ID_HARD_07           7
52 #define RB_ID_SDRAM_TIMINGS     8
53 #define RB_ID_DEVICE_TIMINGS    9
54 #define RB_ID_SOFTWARE_ID       10
55 #define RB_ID_SERIAL_NUMBER     11
56 #define RB_ID_HARD_12           12
57 #define RB_ID_MEMORY_SIZE       13
58 #define RB_ID_MAC_ADDRESS_COUNT 14
59
60 /*
61  * ID values for Software settings
62  */
63 #define RB_ID_UART_SPEED        1
64 #define RB_ID_BOOT_DELAY        2
65 #define RB_ID_BOOT_DEVICE       3
66 #define RB_ID_BOOT_KEY          4
67 #define RB_ID_CPU_MODE          5
68 #define RB_ID_FW_VERSION        6
69 #define RB_ID_SOFT_07           7
70 #define RB_ID_SOFT_08           8
71 #define RB_ID_BOOT_PROTOCOL     9
72 #define RB_ID_SOFT_10           10
73 #define RB_ID_SOFT_11           11
74
75 /*
76  * UART_SPEED values
77  */
78 #define RB_UART_SPEED_115200    0
79 #define RB_UART_SPEED_57600     1
80 #define RB_UART_SPEED_38400     2
81 #define RB_UART_SPEED_19200     3
82 #define RB_UART_SPEED_9600      4
83 #define RB_UART_SPEED_4800      5
84 #define RB_UART_SPEED_2400      6
85 #define RB_UART_SPEED_1200      7
86
87 /*
88  * BOOT_DELAY values
89  */
90 #define RB_BOOT_DELAY_0SEC      0
91 #define RB_BOOT_DELAY_1SEC      1
92 #define RB_BOOT_DELAY_2SEC      2
93
94 /*
95  * BOOT_DEVICE values
96  */
97 #define RB_BOOT_DEVICE_ETHER    0
98 #define RB_BOOT_DEVICE_NANDETH  1
99 #define RB_BOOT_DEVICE_ETHONCE  2
100 #define RB_BOOT_DEVICE_NANDONLY 3
101
102 /*
103  * BOOT_KEY values
104  */
105 #define RB_BOOT_KEY_ANY         0
106 #define RB_BOOT_KEY_DEL         1
107
108 /*
109  * CPU_MODE values
110  */
111 #define RB_CPU_MODE_POWERSAVE   0
112 #define RB_CPU_MODE_REGULAR     1
113
114 /*
115  * BOOT_PROTOCOL values
116  */
117 #define RB_BOOT_PROTOCOL_BOOTP  0
118 #define RB_BOOT_PROTOCOL_DHCP   1
119
120 extern int routerboot_present(void) __init;
121 extern char *routerboot_get_boardname(void);
122
123 extern struct rb_hard_settings rb_hs;
124
125 #endif /* _ROUTERBOOT_H */