blob: 3a8b900223059fa3309f63324900825b62d82e35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#ifndef _UBI_IPL_H
#define _UBI_IPL_H
/*
* Copyright (c) International Business Machines Corp., 2006
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Constants calculated from the CFG_XXX defines
*
* Declaration of the loader function which is invoked by the
* assembler part of the IPL
*/
/* Size of IPL - is 4K for NAND and can also be 4K for NOR */
#define IPL_SIZE 4096
/* Needed in asm code to upload the data, needed in C-code for CRC32 */
#define IPL_RAMADDR (CFG_MEMTOP - IPL_SIZE)
#if !defined(__ASSEMBLY__)
#include <stdint.h>
#include <mtd/ubi-header.h>
/* Address of the flash info structure */
#define FINFO_ADDR (struct ubi_scan_info *) (CFG_MEMTOP - CFG_IPLSIZE * 1024)
/* Size of the flash info structure */
#define FINFO_SIZE sizeof(struct ubi_scan_info)
/* Blockinfo array address */
#define BINFO_ADDR (struct ubi_vid_hdr *) ((void *)FINFO_ADDR + FINFO_SIZE)
/* Number of erase blocks */
#define NR_ERASE_BLOCKS ((CFG_FLASHSIZE * 1024) / CFG_BLOCKSIZE)
/* Blockinfo size */
#define BINFO_SIZE (NR_ERASE_BLOCKS * sizeof(struct ubi_vid_hdr))
/* Images array address */
#define IMAGES_ADDR (struct ubi_vid_hdr **) ((void *)BINFO_ADDR + BINFO_SIZE)
/* Images array size */
#define IMAGES_SIZE (NR_ERASE_BLOCKS * sizeof(unsigned int))
/* Total size of flash info + blockinfo + images */
#define INFO_SIZE ((FINFO_SIZE + BINFO_SIZE + IMAGES_SIZE) / sizeof(uint32_t))
/* Load address of the SPL */
#define SPL_ADDR (void *) ((void *)FINFO_ADDR - CFG_SPLCODE * 1024)
#define IPL_SIZE_CRC32 (IPL_SIZE - sizeof(uint32_t))
#define IPL_RAMADDR_CRC32 ((void *)(IPL_RAMADDR + sizeof(uint32_t)))
/*
* Linker script magic to ensure that load_spl() is linked to the
* right place
*/
#define __crc32 __attribute__((__section__(".crc32")))
#define __entry __attribute__((__section__(".entry.text")))
#define __unused __attribute__((unused))
#define MIN(x,y) ((x)<(y)?(x):(y))
#define stop_on_error(x) \
{ while (1); }
void __entry load_spl(void);
void hardware_init(void);
#endif /* __ASSEMBLY__ */
#endif
|