4 * Compex's MyLoader specific definitions
6 * Copyright (C) 2006,2007 Gabor Juhos <juhosg at openwrt.org>
7 * Copyright (C) 2007 OpenWrt.org
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
19 * Firmware file format:
22 * [<block descriptor 0>]
24 * [<block descriptor n>]
25 * <null block descriptor>
33 /* Myloader specific magic numbers */
34 #define MYLO_MAGIC_FIRMWARE 0x4C594D00
35 #define MYLO_MAGIC_20021103 0x20021103
36 #define MYLO_MAGIC_20021107 0x20021107
38 #define MYLO_MAGIC_SYS_PARAMS MYLO_MAGIC_20021107
39 #define MYLO_MAGIC_PARTITIONS MYLO_MAGIC_20021103
40 #define MYLO_MAGIC_BOARD_PARAMS MYLO_MAGIC_20021103
43 * Addresses of the data structures provided by MyLoader
45 #define MYLO_MIPS_SYS_PARAMS 0x80000800 /* System Parameters */
46 #define MYLO_MIPS_BOARD_PARAMS 0x80000A00 /* Board Parameters */
47 #define MYLO_MIPS_PARTITIONS 0x80000C00 /* Partition Table */
48 #define MYLO_MIPS_BOOT_PARAMS 0x80000E00 /* Boot Parameters */
50 /* Vendor ID's (seems to be same as the PCI vendor ID's) */
51 #define VENID_COMPEX 0x11F6
53 /* Devices based on the ADM5120 */
54 #define DEVID_COMPEX_NP27G 0x0078
55 #define DEVID_COMPEX_NP28G 0x044C
56 #define DEVID_COMPEX_NP28GHS 0x044E
57 #define DEVID_COMPEX_WP54Gv1C 0x0514
58 #define DEVID_COMPEX_WP54G 0x0515
59 #define DEVID_COMPEX_WP54AG 0x0546
60 #define DEVID_COMPEX_WPP54AG 0x0550
61 #define DEVID_COMPEX_WPP54G 0x0555
63 /* Devices based on the IXP422 */
64 #define DEVID_COMPEX_WP18 0x047E
65 #define DEVID_COMPEX_NP18A 0x0489
68 #define DEVID_COMPEX_NP26G8M 0x03E8
69 #define DEVID_COMPEX_NP26G16M 0x03E9
71 struct mylo_fw_header
{
72 uint32_t magic
; /* must be MYLO_MAGIC_FIRMWARE */
73 uint32_t crc
; /* CRC of the whole firmware */
74 uint32_t res0
; /* unknown/unused */
75 uint32_t res1
; /* unknown/unused */
76 uint16_t vid
; /* vendor ID */
77 uint16_t did
; /* device ID */
78 uint16_t svid
; /* sub vendor ID */
79 uint16_t sdid
; /* sub device ID */
80 uint32_t rev
; /* device revision */
81 uint32_t fwhi
; /* FIXME: firmware version high? */
82 uint32_t fwlo
; /* FIXME: firmware version low? */
83 uint32_t flags
; /* firmware flags */
86 #define FW_FLAG_BOARD_PARAMS_WP 0x01 /* board parameters are write protected */
87 #define FW_FLAG_BOOT_SECTOR_WE 0x02 /* enable of write boot sectors (below 64K) */
89 struct mylo_fw_blockdesc
{
90 uint32_t type
; /* block type */
91 uint32_t addr
; /* relative address to flash start */
92 uint32_t dlen
; /* size of block data in bytes */
93 uint32_t blen
; /* total size of block in bytes */
96 #define FW_DESC_TYPE_UNUSED 0
97 #define FW_DESC_TYPE_USED 1
99 struct mylo_partition
{
100 uint16_t flags
; /* partition flags */
101 uint16_t type
; /* type of the partition */
102 uint32_t addr
; /* relative address of the partition from the
104 uint32_t size
; /* size of the partition in bytes */
105 uint32_t param
; /* if this is the active partition, the
106 MyLoader load code to this address */
109 #define PARTITION_FLAG_ACTIVE 0x8000 /* this is the active partition,
110 * MyLoader loads firmware from here */
111 #define PARTITION_FLAG_ISRAM 0x2000 /* FIXME: this is a RAM partition? */
112 #define PARTIIION_FLAG_RAMLOAD 0x1000 /* FIXME: load this partition into the RAM? */
113 #define PARTITION_FLAG_PRELOAD 0x0800 /* the partition data preloaded to RAM
114 * before decompression */
115 #define PARTITION_FLAG_HAVEHDR 0x0002 /* the partition data have a header */
117 #define PARTITION_TYPE_FREE 0
118 #define PARTITION_TYPE_USED 1
120 #define MYLO_MAX_PARTITIONS 8 /* maximum number of partitions in the
123 struct mylo_partition_table
{
124 uint32_t magic
; /* must be MYLO_MAGIC_PARTITIONS */
125 uint32_t res0
; /* unknown/unused */
126 uint32_t res1
; /* unknown/unused */
127 uint32_t res2
; /* unknown/unused */
128 struct mylo_partition partitions
[MYLO_MAX_PARTITIONS
];
131 struct mylo_partition_header
{
132 uint32_t len
; /* length of the partition data */
133 uint32_t crc
; /* CRC value of the partition data */
136 struct mylo_system_params
{
137 uint32_t magic
; /* must be MYLO_MAGIC_SYS_PARAMS */
141 uint16_t vid
; /* Vendor ID */
142 uint16_t did
; /* Device ID */
143 uint16_t svid
; /* Sub Vendor ID */
144 uint16_t sdid
; /* Sub Device ID */
145 uint32_t rev
; /* device revision */
150 uint32_t flash_size
; /* Size of boot FLASH in bytes */
151 uint32_t dram_size
; /* Size of onboard RAM in bytes */
155 struct mylo_eth_addr
{
160 #define MYLO_ETHADDR_COUNT 8 /* maximum number of ethernet address
161 in the board parameters */
163 struct mylo_board_params
{
164 uint32_t magic
; /* must be MYLO_MAGIC_BOARD_PARAMS */
168 struct mylo_eth_addr addr
[MYLO_ETHADDR_COUNT
];
171 struct myloader_info
{
178 extern struct myloader_info myloader_info
;
179 extern int myloader_present(void) __init
;
181 #endif /* _MYLOADER_H_*/