Deleted Added
full compact
cvmx-bootloader.h (210286) cvmx-bootloader.h (215990)
1/***********************license start***************
1/***********************license start***************
2 * Copyright (c) 2008 Cavium Networks (support@cavium.com). All rights
3 * reserved.
2 * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
3 * reserved.
4 *
5 *
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
12 *
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 *
18 * * Neither the name of Cavium Networks nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
21 * permission.
22 *
23 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
24 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
25 * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
26 * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
27 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
28 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
29 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
30 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
31 * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
32 * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
33 *
34 *
35 * For any questions regarding licensing please contact marketing@caviumnetworks.com
36 *
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17
18 * * Neither the name of Cavium Networks nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
21 * permission.
22
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
26 * countries.
27
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
37 ***********************license end**************************************/
38
39
40
38 ***********************license end**************************************/
39
40
41
42
41#ifndef __CVMX_BOOTLOADER__
42#define __CVMX_BOOTLOADER__
43
44
45
46/**
47 * @file
48 *
49 * Bootloader definitions that are shared with other programs
50 *
43#ifndef __CVMX_BOOTLOADER__
44#define __CVMX_BOOTLOADER__
45
46
47
48/**
49 * @file
50 *
51 * Bootloader definitions that are shared with other programs
52 *
51 * <hr>$Revision: 41586 $<hr>
53 * <hr>$Revision: 49448 $<hr>
52 */
53
54
55/* The bootloader_header_t structure defines the header that is present
56** at the start of binary u-boot images. This header is used to locate the bootloader
57** image in NAND, and also to allow verification of images for normal NOR booting.
58** This structure is placed at the beginning of a bootloader binary image, and remains
59** in the executable code.
60*/
61#define BOOTLOADER_HEADER_MAGIC 0x424f4f54 /* "BOOT" in ASCII */
62
63#define BOOTLOADER_HEADER_COMMENT_LEN 64
64#define BOOTLOADER_HEADER_VERSION_LEN 64
65#define BOOTLOADER_HEADER_MAX_SIZE 0x200 /* limited by the space to the next exception handler */
66
67#define BOOTLOADER_HEADER_CURRENT_MAJOR_REV 1
54 */
55
56
57/* The bootloader_header_t structure defines the header that is present
58** at the start of binary u-boot images. This header is used to locate the bootloader
59** image in NAND, and also to allow verification of images for normal NOR booting.
60** This structure is placed at the beginning of a bootloader binary image, and remains
61** in the executable code.
62*/
63#define BOOTLOADER_HEADER_MAGIC 0x424f4f54 /* "BOOT" in ASCII */
64
65#define BOOTLOADER_HEADER_COMMENT_LEN 64
66#define BOOTLOADER_HEADER_VERSION_LEN 64
67#define BOOTLOADER_HEADER_MAX_SIZE 0x200 /* limited by the space to the next exception handler */
68
69#define BOOTLOADER_HEADER_CURRENT_MAJOR_REV 1
68#define BOOTLOADER_HEADER_CURRENT_MINOR_REV 1
70#define BOOTLOADER_HEADER_CURRENT_MINOR_REV 2
71/* Revision history
72* 1.1 Initial released revision. (SDK 1.9)
73* 1.2 TLB based relocatable image (SDK 2.0)
74*
75*
76*/
69
70/* offsets to struct bootloader_header fields for assembly use */
77
78/* offsets to struct bootloader_header fields for assembly use */
71#define MAGIC_OFFST 8
72#define HCRC_OFFST 12
73#define HLEN_OFFST 16
74#define DLEN_OFFST 24
75#define DCRC_OFFST 28
76#define GOT_OFFST 48
79#define GOT_ADDRESS_OFFSET 48
77
80
78#define LOOKUP_STEP 8192
81#define LOOKUP_STEP (64*1024)
79
80#ifndef __ASSEMBLY__
81typedef struct bootloader_header
82{
83 uint32_t jump_instr; /* Jump to executable code following the
84 ** header. This allows this header to
85 ** be (and remain) part of the executable image)
86 */
87 uint32_t nop_instr; /* Must be 0x0 */
88 uint32_t magic; /* Magic number to identify header */
82
83#ifndef __ASSEMBLY__
84typedef struct bootloader_header
85{
86 uint32_t jump_instr; /* Jump to executable code following the
87 ** header. This allows this header to
88 ** be (and remain) part of the executable image)
89 */
90 uint32_t nop_instr; /* Must be 0x0 */
91 uint32_t magic; /* Magic number to identify header */
89 uint32_t hcrc; /* CRC of all of header excluding this field */
92 uint32_t hcrc; /* CRC of all of header excluding this field */
90
91 uint16_t hlen; /* Length of header in bytes */
92 uint16_t maj_rev; /* Major revision */
93 uint16_t min_rev; /* Minor revision */
94 uint16_t board_type; /* Board type that the image is for */
95
96 uint32_t dlen; /* Length of data (immediately following header) in bytes */
97 uint32_t dcrc; /* CRC of data */
98 uint64_t address; /* Mips virtual address */
99 uint32_t flags;
100 uint16_t image_type; /* Defined in bootloader_image_t enum */
101 uint16_t resv0; /* pad */
93
94 uint16_t hlen; /* Length of header in bytes */
95 uint16_t maj_rev; /* Major revision */
96 uint16_t min_rev; /* Minor revision */
97 uint16_t board_type; /* Board type that the image is for */
98
99 uint32_t dlen; /* Length of data (immediately following header) in bytes */
100 uint32_t dcrc; /* CRC of data */
101 uint64_t address; /* Mips virtual address */
102 uint32_t flags;
103 uint16_t image_type; /* Defined in bootloader_image_t enum */
104 uint16_t resv0; /* pad */
102
103 /* The next 4 fields are placed in compile-time, not by the utility */
104 uint32_t got_address; /* compiled got address position in the image */
105 uint32_t got_num_entries; /* number of got entries */
106 uint32_t compiled_start; /* compaled start of the image address */
107 uint32_t image_start; /* relocated start of image address */
108
105
106 uint32_t reserved1;
107 uint32_t reserved2;
108 uint32_t reserved3;
109 uint32_t reserved4;
110
109 char comment_string[BOOTLOADER_HEADER_COMMENT_LEN]; /* Optional, for descriptive purposes */
110 char version_string[BOOTLOADER_HEADER_VERSION_LEN]; /* Optional, for descriptive purposes */
111} __attribute__((packed)) bootloader_header_t;
112
113
114
115/* Defines for flag field */
116#define BL_HEADER_FLAG_FAILSAFE (1)
117
118
119typedef enum
120{
111 char comment_string[BOOTLOADER_HEADER_COMMENT_LEN]; /* Optional, for descriptive purposes */
112 char version_string[BOOTLOADER_HEADER_VERSION_LEN]; /* Optional, for descriptive purposes */
113} __attribute__((packed)) bootloader_header_t;
114
115
116
117/* Defines for flag field */
118#define BL_HEADER_FLAG_FAILSAFE (1)
119
120
121typedef enum
122{
121 BL_HEADER_IMAGE_UKNOWN = 0x0,
123 BL_HEADER_IMAGE_UNKNOWN = 0x0,
122 BL_HEADER_IMAGE_STAGE2, /* Binary bootloader stage2 image (NAND boot) */
123 BL_HEADER_IMAGE_STAGE3, /* Binary bootloader stage3 image (NAND boot)*/
124 BL_HEADER_IMAGE_NOR, /* Binary bootloader for NOR boot */
125 BL_HEADER_IMAGE_PCIBOOT, /* Binary bootloader for PCI boot */
126 BL_HEADER_IMAGE_UBOOT_ENV, /* Environment for u-boot */
127 BL_HEADER_IMAGE_MAX,
128 /* Range for customer private use. Will not be used by Cavium Networks */
129 BL_HEADER_IMAGE_CUST_RESERVED_MIN = 0x1000,
130 BL_HEADER_IMAGE_CUST_RESERVED_MAX = 0x1fff,
131} bootloader_image_t;
132
133#endif /* __ASSEMBLY__ */
134
135/* Maximum address searched for NAND boot images and environments. This is used
136** by stage1 and stage2. */
137#define MAX_NAND_SEARCH_ADDR 0x400000
138
124 BL_HEADER_IMAGE_STAGE2, /* Binary bootloader stage2 image (NAND boot) */
125 BL_HEADER_IMAGE_STAGE3, /* Binary bootloader stage3 image (NAND boot)*/
126 BL_HEADER_IMAGE_NOR, /* Binary bootloader for NOR boot */
127 BL_HEADER_IMAGE_PCIBOOT, /* Binary bootloader for PCI boot */
128 BL_HEADER_IMAGE_UBOOT_ENV, /* Environment for u-boot */
129 BL_HEADER_IMAGE_MAX,
130 /* Range for customer private use. Will not be used by Cavium Networks */
131 BL_HEADER_IMAGE_CUST_RESERVED_MIN = 0x1000,
132 BL_HEADER_IMAGE_CUST_RESERVED_MAX = 0x1fff,
133} bootloader_image_t;
134
135#endif /* __ASSEMBLY__ */
136
137/* Maximum address searched for NAND boot images and environments. This is used
138** by stage1 and stage2. */
139#define MAX_NAND_SEARCH_ADDR 0x400000
140
141/* Maximum address to look for start of normal bootloader */
142#define MAX_NOR_SEARCH_ADDR 0x100000
139
140/* Defines for RAM based environment set by the host or the previous bootloader
141** in a chain boot configuration. */
142
143#define U_BOOT_RAM_ENV_ADDR (0x1000)
144#define U_BOOT_RAM_ENV_SIZE (0x1000)
145#define U_BOOT_RAM_ENV_CRC_SIZE (0x4)
146
147#endif /* __CVMX_BOOTLOADER__ */
143
144/* Defines for RAM based environment set by the host or the previous bootloader
145** in a chain boot configuration. */
146
147#define U_BOOT_RAM_ENV_ADDR (0x1000)
148#define U_BOOT_RAM_ENV_SIZE (0x1000)
149#define U_BOOT_RAM_ENV_CRC_SIZE (0x4)
150
151#endif /* __CVMX_BOOTLOADER__ */