enable start-stop-daemon by default, i want to use this to clean up a few init script...
[openwrt/openwrt.git] / target / linux / adm5120-2.6 / files / include / asm-mips / mach-adm5120 / prom / myloader.h
1 /*
2 * $Id$
3 *
4 * Compex's MyLoader specific definitions
5 *
6 * Copyright (C) 2006,2007 Gabor Juhos <juhosg at openwrt.org>
7 * Copyright (C) 2007 OpenWrt.org
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 */
24
25 #ifndef _MYLOADER_H_
26 #define _MYLOADER_H_
27
28 /*
29 * Firmware file format:
30 *
31 * <header>
32 * [<block descriptor 0>]
33 * ...
34 * [<block descriptor n>]
35 * <null block descriptor>
36 * [<block data 0>]
37 * ...
38 * [<block data n>]
39 *
40 *
41 */
42
43 /* Myloader specific magic numbers */
44 #define MYLO_MAGIC_FIRMWARE 0x4C594D00
45 #define MYLO_MAGIC_20021103 0x20021103
46 #define MYLO_MAGIC_20021107 0x20021107
47
48 #define MYLO_MAGIC_SYS_PARAMS MYLO_MAGIC_20021107
49 #define MYLO_MAGIC_PARTITIONS MYLO_MAGIC_20021103
50 #define MYLO_MAGIC_BOARD_PARAMS MYLO_MAGIC_20021103
51
52 /*
53 * Addresses of the data structures provided by MyLoader
54 */
55 #define MYLO_MIPS_SYS_PARAMS 0x80000800 /* System Parameters */
56 #define MYLO_MIPS_BOARD_PARAMS 0x80000A00 /* Board Parameters */
57 #define MYLO_MIPS_PARTITIONS 0x80000C00 /* Partition Table */
58 #define MYLO_MIPS_BOOT_PARAMS 0x80000E00 /* Boot Parameters */
59
60 /* Vendor ID's (seems to be same as the PCI vendor ID's) */
61 #define VENID_COMPEX 0x11F6
62
63 /* Devices based on the ADM5120 */
64 #define DEVID_COMPEX_NP27G 0x0078
65 #define DEVID_COMPEX_NP28G 0x044C
66 #define DEVID_COMPEX_NP28GHS 0x044E
67 #define DEVID_COMPEX_WP54Gv1C 0x0514
68 #define DEVID_COMPEX_WP54G 0x0515
69 #define DEVID_COMPEX_WP54AG 0x0546
70 #define DEVID_COMPEX_WPP54AG 0x0550
71 #define DEVID_COMPEX_WPP54G 0x0555
72
73 /* Devices based on the IXP422 */
74 #define DEVID_COMPEX_WP18 0x047E
75 #define DEVID_COMPEX_NP18A 0x0489
76
77 /* Other devices */
78 #define DEVID_COMPEX_NP26G8M 0x03E8
79 #define DEVID_COMPEX_NP26G16M 0x03E9
80
81 struct mylo_fw_header {
82 uint32_t magic; /* must be MYLO_MAGIC_FIRMWARE */
83 uint32_t crc; /* CRC of the whole firmware */
84 uint32_t res0; /* unknown/unused */
85 uint32_t res1; /* unknown/unused */
86 uint16_t vid; /* vendor ID */
87 uint16_t did; /* device ID */
88 uint16_t svid; /* sub vendor ID */
89 uint16_t sdid; /* sub device ID */
90 uint32_t rev; /* device revision */
91 uint32_t fwhi; /* FIXME: firmware version high? */
92 uint32_t fwlo; /* FIXME: firmware version low? */
93 uint32_t flags; /* firmware flags */
94 };
95
96 #define FW_FLAG_BOARD_PARAMS_WP 0x01 /* board parameters are write protected */
97 #define FW_FLAG_BOOT_SECTOR_WE 0x02 /* enable of write boot sectors (below 64K) */
98
99 struct mylo_fw_blockdesc {
100 uint32_t type; /* block type */
101 uint32_t addr; /* relative address to flash start */
102 uint32_t dlen; /* size of block data in bytes */
103 uint32_t blen; /* total size of block in bytes */
104 };
105
106 #define FW_DESC_TYPE_UNUSED 0
107 #define FW_DESC_TYPE_USED 1
108
109 struct mylo_partition {
110 uint16_t flags; /* partition flags */
111 uint16_t type; /* type of the partition */
112 uint32_t addr; /* relative address of the partition from the
113 flash start */
114 uint32_t size; /* size of the partition in bytes */
115 uint32_t param; /* if this is the active partition, the
116 MyLoader load code to this address */
117 };
118
119 #define PARTITION_FLAG_ACTIVE 0x8000 /* this is the active partition,
120 * MyLoader loads firmware from here */
121 #define PARTITION_FLAG_ISRAM 0x2000 /* FIXME: this is a RAM partition? */
122 #define PARTIIION_FLAG_RAMLOAD 0x1000 /* FIXME: load this partition into the RAM? */
123 #define PARTITION_FLAG_PRELOAD 0x0800 /* the partition data preloaded to RAM
124 * before decompression */
125 #define PARTITION_FLAG_HAVEHDR 0x0002 /* the partition data have a header */
126
127 #define PARTITION_TYPE_FREE 0
128 #define PARTITION_TYPE_USED 1
129
130 #define MYLO_MAX_PARTITIONS 8 /* maximum number of partitions in the
131 partition table */
132
133 struct mylo_partition_table {
134 uint32_t magic; /* must be MYLO_MAGIC_PARTITIONS */
135 uint32_t res0; /* unknown/unused */
136 uint32_t res1; /* unknown/unused */
137 uint32_t res2; /* unknown/unused */
138 struct mylo_partition partitions[MYLO_MAX_PARTITIONS];
139 };
140
141 struct mylo_partition_header {
142 uint32_t len; /* length of the partition data */
143 uint32_t crc; /* CRC value of the partition data */
144 };
145
146 struct mylo_system_params {
147 uint32_t magic; /* must be MYLO_MAGIC_SYS_PARAMS */
148 uint32_t res0;
149 uint32_t res1;
150 uint32_t mylo_ver;
151 uint16_t vid; /* Vendor ID */
152 uint16_t did; /* Device ID */
153 uint16_t svid; /* Sub Vendor ID */
154 uint16_t sdid; /* Sub Device ID */
155 uint32_t rev; /* device revision */
156 uint32_t fwhi;
157 uint32_t fwlo;
158 uint32_t tftp_addr;
159 uint32_t prog_start;
160 uint32_t flash_size; /* Size of boot FLASH in bytes */
161 uint32_t dram_size; /* Size of onboard RAM in bytes */
162 };
163
164
165 struct mylo_eth_addr {
166 uint8_t mac[6];
167 uint8_t csum[2];
168 };
169
170 #define MYLO_ETHADDR_COUNT 8 /* maximum number of ethernet address
171 in the board parameters */
172
173 struct mylo_board_params {
174 uint32_t magic; /* must be MYLO_MAGIC_BOARD_PARAMS */
175 uint32_t res0;
176 uint32_t res1;
177 uint32_t res2;
178 struct mylo_eth_addr addr[MYLO_ETHADDR_COUNT];
179 };
180
181 struct myloader_info {
182 u32 vid;
183 u32 did;
184 u32 svid;
185 u32 sdid;
186 };
187
188 extern struct myloader_info myloader_info;
189 extern int myloader_present(void) __init;
190
191 #endif /* _MYLOADER_H_*/