Loading...
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | /*
* dbdcd.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Defines the DSP/BIOS Bridge Configuration Database (DCD) API.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBDCD_
#define DBDCD_
#include <dspbridge/dbdcddef.h>
#include <dspbridge/host_os.h>
#include <dspbridge/nldrdefs.h>
/*
* ======== dcd_auto_register ========
* Purpose:
* This function automatically registers DCD objects specified in a
* special COFF section called ".dcd_register"
* Parameters:
* hdcd_mgr: A DCD manager handle.
* sz_coff_path: Pointer to name of COFF file containing DCD
* objects to be registered.
* Returns:
* 0: Success.
* -EACCES: Unable to find auto-registration/read/load section.
* -EFAULT: Invalid DCD_HMANAGER handle..
* Requires:
* DCD initialized.
* Ensures:
* Note:
* Due to the DCD database construction, it is essential for a DCD-enabled
* COFF file to contain the right COFF sections, especially
* ".dcd_register", which is used for auto registration.
*/
extern int dcd_auto_register(struct dcd_manager *hdcd_mgr,
char *sz_coff_path);
/*
* ======== dcd_auto_unregister ========
* Purpose:
* This function automatically unregisters DCD objects specified in a
* special COFF section called ".dcd_register"
* Parameters:
* hdcd_mgr: A DCD manager handle.
* sz_coff_path: Pointer to name of COFF file containing
* DCD objects to be unregistered.
* Returns:
* 0: Success.
* -EACCES: Unable to find auto-registration/read/load section.
* -EFAULT: Invalid DCD_HMANAGER handle..
* Requires:
* DCD initialized.
* Ensures:
* Note:
* Due to the DCD database construction, it is essential for a DCD-enabled
* COFF file to contain the right COFF sections, especially
* ".dcd_register", which is used for auto unregistration.
*/
extern int dcd_auto_unregister(struct dcd_manager *hdcd_mgr,
char *sz_coff_path);
/*
* ======== dcd_create_manager ========
* Purpose:
* This function creates a DCD module manager.
* Parameters:
* sz_zl_dll_name: Pointer to a DLL name string.
* dcd_mgr: A pointer to a DCD manager handle.
* Returns:
* 0: Success.
* -ENOMEM: Unable to allocate memory for DCD manager handle.
* -EPERM: General failure.
* Requires:
* DCD initialized.
* sz_zl_dll_name is non-NULL.
* dcd_mgr is non-NULL.
* Ensures:
* A DCD manager handle is created.
*/
extern int dcd_create_manager(char *sz_zl_dll_name,
struct dcd_manager **dcd_mgr);
/*
* ======== dcd_destroy_manager ========
* Purpose:
* This function destroys a DCD module manager.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* Returns:
* 0: Success.
* -EFAULT: Invalid DCD manager handle.
* Requires:
* DCD initialized.
* Ensures:
*/
extern int dcd_destroy_manager(struct dcd_manager *hdcd_mgr);
/*
* ======== dcd_enumerate_object ========
* Purpose:
* This function enumerates currently visible DSP/BIOS Bridge objects
* and returns the UUID and type of each enumerated object.
* Parameters:
* index: The object enumeration index.
* obj_type: Type of object to enumerate.
* uuid_obj: Pointer to a dsp_uuid object.
* Returns:
* 0: Success.
* -EPERM: Unable to enumerate through the DCD database.
* ENODATA: Enumeration completed. This is not an error code.
* Requires:
* DCD initialized.
* uuid_obj is a valid pointer.
* Ensures:
* Details:
* This function can be used in conjunction with dcd_get_object_def to
* retrieve object properties.
*/
extern int dcd_enumerate_object(s32 index,
enum dsp_dcdobjtype obj_type,
struct dsp_uuid *uuid_obj);
/*
* ======== dcd_exit ========
* Purpose:
* This function cleans up the DCD module.
* Parameters:
* Returns:
* Requires:
* DCD initialized.
* Ensures:
*/
extern void dcd_exit(void);
/*
* ======== dcd_get_dep_libs ========
* Purpose:
* Given the uuid of a library and size of array of uuids, this function
* fills the array with the uuids of all dependent libraries of the input
* library.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* uuid_obj: Pointer to a dsp_uuid for a library.
* num_libs: Size of uuid array (number of library uuids).
* dep_lib_uuids: Array of dependent library uuids to be filled in.
* prstnt_dep_libs: Array indicating if corresponding lib is persistent.
* phase: phase to obtain correct input library
* Returns:
* 0: Success.
* -ENOMEM: Memory allocation failure.
* -EACCES: Failure to read section containing library info.
* -EPERM: General failure.
* Requires:
* DCD initialized.
* Valid hdcd_mgr.
* uuid_obj != NULL
* dep_lib_uuids != NULL.
* Ensures:
*/
extern int dcd_get_dep_libs(struct dcd_manager *hdcd_mgr,
struct dsp_uuid *uuid_obj,
u16 num_libs,
struct dsp_uuid *dep_lib_uuids,
bool *prstnt_dep_libs,
enum nldr_phase phase);
/*
* ======== dcd_get_num_dep_libs ========
* Purpose:
* Given the uuid of a library, determine its number of dependent
* libraries.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* uuid_obj: Pointer to a dsp_uuid for a library.
* num_libs: Size of uuid array (number of library uuids).
* num_pers_libs: number of persistent dependent library.
* phase: Phase to obtain correct input library
* Returns:
* 0: Success.
* -ENOMEM: Memory allocation failure.
* -EACCES: Failure to read section containing library info.
* -EPERM: General failure.
* Requires:
* DCD initialized.
* Valid hdcd_mgr.
* uuid_obj != NULL
* num_libs != NULL.
* Ensures:
*/
extern int dcd_get_num_dep_libs(struct dcd_manager *hdcd_mgr,
struct dsp_uuid *uuid_obj,
u16 *num_libs,
u16 *num_pers_libs,
enum nldr_phase phase);
/*
* ======== dcd_get_library_name ========
* Purpose:
* This function returns the name of a (dynamic) library for a given
* UUID.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* uuid_obj: Pointer to a dsp_uuid that represents a unique DSP/BIOS
* Bridge object.
* str_lib_name: Buffer to hold library name.
* buff_size: Contains buffer size. Set to string size on output.
* phase: Which phase to load
* phase_split: Are phases in multiple libraries
* Returns:
* 0: Success.
* -EPERM: General failure.
* Requires:
* DCD initialized.
* Valid hdcd_mgr.
* str_lib_name != NULL.
* uuid_obj != NULL
* buff_size != NULL.
* Ensures:
*/
extern int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
struct dsp_uuid *uuid_obj,
char *str_lib_name,
u32 *buff_size,
enum nldr_phase phase,
bool *phase_split);
/*
* ======== dcd_get_object_def ========
* Purpose:
* This function returns the properties/attributes of a DSP/BIOS Bridge
* object.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* uuid_obj: Pointer to a dsp_uuid that represents a unique
* DSP/BIOS Bridge object.
* obj_type: The type of DSP/BIOS Bridge object to be
* referenced (node, processor, etc).
* obj_def: Pointer to an object definition structure. A
* union of various possible DCD object types.
* Returns:
* 0: Success.
* -EACCES: Unable to access/read/parse/load content of object code
* section.
* -EPERM: General failure.
* -EFAULT: Invalid DCD_HMANAGER handle.
* Requires:
* DCD initialized.
* obj_uuid is non-NULL.
* obj_def is non-NULL.
* Ensures:
*/
extern int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
struct dsp_uuid *obj_uuid,
enum dsp_dcdobjtype obj_type,
struct dcd_genericobj *obj_def);
/*
* ======== dcd_get_objects ========
* Purpose:
* This function finds all DCD objects specified in a special
* COFF section called ".dcd_register", and for each object,
* call a "register" function. The "register" function may perform
* various actions, such as 1) register nodes in the node database, 2)
* unregister nodes from the node database, and 3) add overlay nodes.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* sz_coff_path: Pointer to name of COFF file containing DCD
* objects.
* register_fxn: Callback fxn to be applied on each located
* DCD object.
* handle: Handle to pass to callback.
* Returns:
* 0: Success.
* -EACCES: Unable to access/read/parse/load content of object code
* section.
* -EFAULT: Invalid DCD_HMANAGER handle..
* Requires:
* DCD initialized.
* Ensures:
* Note:
* Due to the DCD database construction, it is essential for a DCD-enabled
* COFF file to contain the right COFF sections, especially
* ".dcd_register", which is used for auto registration.
*/
extern int dcd_get_objects(struct dcd_manager *hdcd_mgr,
char *sz_coff_path,
dcd_registerfxn register_fxn, void *handle);
/*
* ======== dcd_init ========
* Purpose:
* This function initializes DCD.
* Parameters:
* Returns:
* FALSE: Initialization failed.
* TRUE: Initialization succeeded.
* Requires:
* Ensures:
* DCD initialized.
*/
extern bool dcd_init(void);
/*
* ======== dcd_register_object ========
* Purpose:
* This function registers a DSP/BIOS Bridge object in the DCD database.
* Parameters:
* uuid_obj: Pointer to a dsp_uuid that identifies a DSP/BIOS
* Bridge object.
* obj_type: Type of object.
* psz_path_name: Path to the object's COFF file.
* Returns:
* 0: Success.
* -EPERM: Failed to register object.
* Requires:
* DCD initialized.
* uuid_obj and szPathName are non-NULL values.
* obj_type is a valid type value.
* Ensures:
*/
extern int dcd_register_object(struct dsp_uuid *uuid_obj,
enum dsp_dcdobjtype obj_type,
char *psz_path_name);
/*
* ======== dcd_unregister_object ========
* Purpose:
* This function de-registers a valid DSP/BIOS Bridge object from the DCD
* database.
* Parameters:
* uuid_obj: Pointer to a dsp_uuid that identifies a DSP/BIOS Bridge
* object.
* obj_type: Type of object.
* Returns:
* 0: Success.
* -EPERM: Unable to de-register the specified object.
* Requires:
* DCD initialized.
* uuid_obj is a non-NULL value.
* obj_type is a valid type value.
* Ensures:
*/
extern int dcd_unregister_object(struct dsp_uuid *uuid_obj,
enum dsp_dcdobjtype obj_type);
#endif /* _DBDCD_H */
|