126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* 226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * dspbridge/mpu_driver/src/dynload/module_list.h 326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * DSP-BIOS Bridge driver support functions for TI OMAP processors. 526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Copyright (C) 2008 Texas Instruments, Inc. 726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * This package is free software; you can redistribute it and/or modify 926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * it under the terms of the GNU General Public License version 2 as 1026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * published by the Free Software Foundation. 1126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 1226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna */ 1626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 1726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* 1826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * This C header file gives the layout of the data structure created by the 1926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * dynamic loader to describe the set of modules loaded into the DSP. 2026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 2126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Linked List Structure: 2226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * ---------------------- 2326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * The data structure defined here is a singly-linked list. The list 2426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * represents the set of modules which are currently loaded in the DSP memory. 2526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * The first entry in the list is a header record which contains a flag 2626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * representing the state of the list. The rest of the entries in the list 2726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * are module records. 2826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 2926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Global symbol _DLModules designates the first record in the list (i.e. the 3026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * header record). This symbol must be defined in any program that wishes to 3126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * use DLLview plug-in. 3226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 3326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * String Representation: 3426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * ---------------------- 3526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * The string names of the module and its sections are stored in a block of 3626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * memory which follows the module record itself. The strings are ordered: 3726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * module name first, followed by section names in order from the first 3826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * section to the last. String names are tightly packed arrays of 8-bit 3926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * characters (two characters per 16-bit word on the C55x). Strings are 4026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * zero-byte-terminated. 4126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 4226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Creating and updating the list: 4326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * ------------------------------- 4426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Upon loading a new module into the DSP memory the dynamic loader inserts a 4526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * new module record as the first module record in the list. The fields of 4626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * this module record are initialized to reflect the properties of the module. 4726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * The dynamic loader does NOT increment the flag/counter in the list's header 4826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * record. 4926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 5026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Upon unloading a module from the DSP memory the dynamic loader removes the 5126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * module's record from this list. The dynamic loader also increments the 5226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * flag/counter in the list's header record to indicate that the list has been 5326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * changed. 5426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna */ 5526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 5626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#ifndef _MODULE_LIST_H_ 5726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#define _MODULE_LIST_H_ 5826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 5926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#include <linux/types.h> 6026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 6126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* Global pointer to the modules_header structure */ 6226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#define MODULES_HEADER "_DLModules" 6326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#define MODULES_HEADER_NO_UNDERSCORE "DLModules" 6426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 6526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* Initial version number */ 6626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#define INIT_VERSION 1 6726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 6826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* Verification number -- to be recorded in each module record */ 6926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#define VERIFICATION 0x79 7026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 7126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* forward declarations */ 7226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Lunastruct dll_module; 7326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Lunastruct dll_sect; 7426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 7526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* the first entry in the list is the modules_header record; 7626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * its address is contained in the global _DLModules pointer */ 7726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Lunastruct modules_header { 7826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 7926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* 8026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Address of the first dll_module record in the list or NULL. 8126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Note: for C55x this is a word address (C55x data is 8226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * word-addressable) 8326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna */ 8426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u32 first_module; 8526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 8626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Combined storage size (in target addressable units) of the 8726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * dll_module record which follows this header record, or zero 8826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * if the list is empty. This size includes the module's string table. 8926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Note: for C55x the unit is a 16-bit word */ 9026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u16 first_module_size; 9126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 9226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Counter is incremented whenever a module record is removed from 9326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * the list */ 9426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u16 update_flag; 9526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 9626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna}; 9726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 9826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* for each 32-bits in above structure, a bitmap, LSB first, whose bits are: 9926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 0 => a 32-bit value, 1 => 2 16-bit values */ 10026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* swapping bitmap for type modules_header */ 10126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#define MODULES_HEADER_BITMAP 0x2 10226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 10326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* information recorded about each section in a module */ 10426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Lunastruct dll_sect { 10526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 10626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Load-time address of the section. 10726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Note: for C55x this is a byte address for program sections, and 10826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * a word address for data sections. C55x program memory is 10926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * byte-addressable, while data memory is word-addressable. */ 11026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u32 sect_load_adr; 11126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 11226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Run-time address of the section. 11326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Note 1: for C55x this is a byte address for program sections, and 11426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * a word address for data sections. 11526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Note 2: for C55x two most significant bits of this field indicate 11626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * the section type: '00' for a code section, '11' for a data section 11726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * (C55 addresses are really only 24-bits wide). */ 11826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u32 sect_run_adr; 11926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 12026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna}; 12126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 12226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* the rest of the entries in the list are module records */ 12326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Lunastruct dll_module { 12426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 12526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Address of the next dll_module record in the list, or 0 if this is 12626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * the last record in the list. 12726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Note: for C55x this is a word address (C55x data is 12826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * word-addressable) */ 12926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u32 next_module; 13026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 13126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Combined storage size (in target addressable units) of the 13226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * dll_module record which follows this one, or zero if this is the 13326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * last record in the list. This size includes the module's string 13426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * table. 13526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * Note: for C55x the unit is a 16-bit word. */ 13626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u16 next_module_size; 13726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 13826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* version number of the tooling; set to INIT_VERSION for Phase 1 */ 13926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u16 version; 14026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 14126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* the verification word; set to VERIFICATION */ 14226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u16 verification; 14326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 14426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Number of sections in the sects array */ 14526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u16 num_sects; 14626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 14726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Module's "unique" id; copy of the timestamp from the host 14826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * COFF file */ 14926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna u32 timestamp; 15026f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 15126f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna /* Array of num_sects elements of the module's section records */ 15226f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna struct dll_sect sects[1]; 15326f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna}; 15426f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 15526f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna/* for each 32 bits in above structure, a bitmap, LSB first, whose bits are: 15626f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna * 0 => a 32-bit value, 1 => 2 16-bit values */ 15726f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#define DLL_MODULE_BITMAP 0x6 /* swapping bitmap for type dll_module */ 15826f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna 15926f8db7d2e20218272cbf889edfdb8328b4cd9c3Omar Ramirez Luna#endif /* _MODULE_LIST_H_ */ 160