blob: bd63790f88d26007679e53b11da641a4a99e2801 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/*
2 * linux/arch/arm/mach-mmp/include/mach/ramdump_defs.h
3 *
4 * Support for the Marvell PXA RAMDUMP error handling capability.
5 *
6 * Author: Anton Eidelman (anton.eidelman@marvell.com)
7 * Created: May 20, 2010
8 * Copyright: (C) Copyright 2006 Marvell International Ltd.
9 *
10 */
11/*******************************************************************************
12Copyright (C) Marvell International Ltd. and its affiliates
13
14This software file (the "File") is owned and distributed by Marvell
15International Ltd. and/or its affiliates ("Marvell") under the following
16alternative licensing terms. Once you have made an election to distribute the
17File under one of the following license alternatives, please (i) delete this
18introductory statement regarding license alternatives, (ii) delete the two
19license alternatives that you have not elected to use and (iii) preserve the
20Marvell copyright notice above.
21
22********************************************************************************
23Marvell Commercial License Option
24
25If you received this File from Marvell and you have entered into a commercial
26license agreement (a "Commercial License") with Marvell, the File is licensed
27to you under the terms of the applicable Commercial License.
28
29********************************************************************************
30Marvell GPL License Option
31
32If you received this File from Marvell, you may opt to use, redistribute and/or
33modify this File in accordance with the terms and conditions of the General
34Public License Version 2, June 1991 (the "GPL License"), a copy of which is
35available along with the File in the license.txt file or by writing to the Free
36Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or
37on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
38
39THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED
40WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
41DISCLAIMED. The GPL License provides additional details about this warranty
42disclaimer.
43********************************************************************************
44Marvell BSD License Option
45
46If you received this File from Marvell, you may opt to use, redistribute and/or
47modify this File under the following licensing terms.
48Redistribution and use in source and binary forms, with or without modification,
49are permitted provided that the following conditions are met:
50
51 * Redistributions of source code must retain the above copyright notice,
52 this list of conditions and the following disclaimer.
53
54 * Redistributions in binary form must reproduce the above copyright
55 notice, this list of conditions and the following disclaimer in the
56 documentation and/or other materials provided with the distribution.
57
58 * Neither the name of Marvell nor the names of its contributors may be
59 used to endorse or promote products derived from this software without
60 specific prior written permission.
61
62THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
63ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
64WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
65DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
66ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
67(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
68LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
69ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
70(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
71SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
72
73*******************************************************************************/
74
75#ifndef ARCH_ARM_MACH_PXA_RAMDUMP_DEFS_H
76#define ARCH_ARM_MACH_PXA_RAMDUMP_DEFS_H
77
78/*
79 * Types for 32/64-bit architectures support.
80 * T_PTR: used below for objects that are pointers, for which
81 * we do not want to allocate 64-bit on all architectures.
82 * In native arm code these can be (unsigned long),
83 * however when compiled inside parser tools on host, this
84 * may result in a mismatch. Host build can redefine T_PTR to avoid this.
85 *
86 * u64: used below for objects that are always allocated 64-bit.
87 * For example, pointers inside RDC structure, because we do not want
88 * to compile two instances of RDC for 32- and 64-bit in the parser tools.
89 * u64 may need to be defined in the host builds.
90 */
91#define T_PTR unsigned long
92
93/************************************************************************/
94/* RAMDUMP definitions */
95/************************************************************************/
96/* RDC header is at fixed address adjacent to the top of DDR space */
97#define RDC_SIGNATURE 0x41434452 /* ascii(RDCA), little endian */
98#define RDC_OFFSET 0x002FFC00 /* from CP area start */
99#define ISRAM_PA 0x5c000000
100
101#define DDR0_BASE 0x00000000
102#define DDR1_BASE 0x40000000
103#define CP_AREA_SIZE 0x01000000 /* fixed top 16MB of bank 0 */
104#define CP_ADDRESS(ddr0_size) (DDR0_BASE+(ddr0_size)-CP_AREA_SIZE)
105#define RDC_ADDRESS(ddr0_size) (CP_ADDRESS(ddr0_size)+RDC_OFFSET)
106
107/* ISRAM dump is located before RDC header. More objects can be added here.
108 Not included into the struct rdc_area as the size of isram and
109 other objects might not be known at compile time.
110 Macro's below may use function calls or variable references.*/
111#define RDC_ISRAM_START(header, isram_size) \
112 ((void *)(((unsigned long)header)-isram_size))
113
114/* Data Item objects in RDC */
115#define MAX_RDI_NAME 8
116struct rdc_dataitem {
117 unsigned char size; /* total bytes to the next item */
118 unsigned char type; /* one of enum rdc_di_type */
119 unsigned short attrbits;/* bit per body element, lsb first */
120 char name[MAX_RDI_NAME];/* 8-char ascii item name */
121 union {
122 unsigned w[1]; /* contents: not aligned to 64-bit */
123 } body;
124};
125
126struct kallsyms_record {
127 T_PTR kallsyms_addresses;
128 T_PTR kallsyms_names;
129 unsigned kallsyms_num_syms;
130 T_PTR kallsyms_token_table;
131 T_PTR kallsyms_token_index;
132 T_PTR kallsyms_markers;
133};
134
135/* RDC: the location is fixed at RDC_ADDRESS. Size is 1KB. */
136struct rdc_area {
137 struct rdc_header {
138 unsigned signature;
139 unsigned kernel_build_id;
140 unsigned error_id;
141 unsigned reserved[5];
142 unsigned ramdump_data_addr; /* physical addr of ramdump_data */
143 unsigned isram_pa; /* physical addr of ISRAM dump */
144 unsigned isram_size; /* size of ISRAM dump */
145 unsigned isram_crc32; /* verify contents survived flush/reset */
146 unsigned ramfile_addr; /* physical addr of the first or NULL */
147 /* mipsram is here so it can be extracted w/o symbol table */
148 unsigned mipsram_pa; /* physical addr of mipsram buffer */
149 unsigned mipsram_size; /* size of mipsram buffer */
150 unsigned ddr_bank0_size; /* for future use in RDP */
151 unsigned pgd; /* init_mm.pgd pa: translate vmalloc addresses */
152 unsigned kallsyms; /* VA of struct kallsyms_record */
153 unsigned kallsyms_hi; /* upper 32 bit of the above */
154 unsigned kernel_build_id_hi; /* upper 32 bit of the above */
155 unsigned reserved1[12]; /* Up to offset 0x80 */
156 } header;
157 union { /*upto 1KB*/
158 unsigned char space[0x400-sizeof(struct rdc_header)];
159 struct rdc_dataitem rdi[1];
160 } body;
161};
162
163/* use this for debug and memory consistency checking.
164 Note: CRC32 no 2-s complement option is used */
165#define RAMDUMP_ISRAM_CRC_CHECK
166
167#endif