4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * Copyright (C) 2005-2006 Texas Instruments, Inc.
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 #include "dload_internal.h"
19 /* These are defined in coff.h, but may not be available on all platforms
20 so we'll go ahead and define them here. */
22 #define R_C60LO16 0x54 /* C60: MVK Low Half Register */
23 #define R_C60HI16 0x55 /* C60: MVKH/MVKLH High Half Register */
26 #define C6X_TRAMP_WORD_COUNT 8
27 #define C6X_TRAMP_MAX_RELOS 8
29 /* THIS HASH FUNCTION MUST MATCH THE ONE reloc_table_c6000.c */
30 #define HASH_FUNC(zz) (((((zz) + 1) * 1845UL) >> 11) & 63)
32 /* THIS MUST MATCH reloc_record_t FOR A SYMBOL BASED RELO */
33 struct c6000_relo_record {
45 struct c6000_gen_code {
46 struct tramp_gen_code_hdr hdr;
47 u32 tramp_instrs[C6X_TRAMP_WORD_COUNT];
48 struct c6000_relo_record relos[C6X_TRAMP_MAX_RELOS];
51 /* Hash mapping for relos that can cause trampolines. */
52 static const u16 tramp_map[] = {
119 static const struct c6000_gen_code tramp_gen_info[] = {
120 /* Tramp caused by R_C60PCR21 */
122 /* Header - 8 instructions, 2 relos */
124 sizeof(u32) * C6X_TRAMP_WORD_COUNT,
126 FIELD_OFFSET(struct c6000_gen_code, relos)
129 /* Trampoline instructions */
131 0x053C54F7, /* STW.D2T2 B10, *sp--[2] */
132 0x0500002A, /* || MVK.S2 <blank>, B10 */
133 0x0500006A, /* MVKH.S2 <blank>, B10 */
134 0x00280362, /* B.S2 B10 */
135 0x053C52E6, /* LDW.D2T2 *++sp[2], B10 */
136 0x00006000, /* NOP 4 */
137 0x00000000, /* NOP */
143 {4, 0, 0, R_C60LO16},
144 {8, 0, 0, R_C60HI16},
155 /* TARGET SPECIFIC FUNCTIONS THAT MUST BE DEFINED */
156 static u32 tramp_size_get(void)
158 return sizeof(u32) * C6X_TRAMP_WORD_COUNT;
161 static u32 tramp_img_pkt_size_get(void)
163 return sizeof(struct c6000_gen_code);