1/* 2 * cfg.h 3 * 4 * DSP-BIOS Bridge driver support functions for TI OMAP processors. 5 * 6 * PM Configuration module. 7 * 8 * Copyright (C) 2005-2006 Texas Instruments, Inc. 9 * 10 * This package is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License version 2 as 12 * published by the Free Software Foundation. 13 * 14 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17 */ 18 19#ifndef CFG_ 20#define CFG_ 21#include <dspbridge/host_os.h> 22#include <dspbridge/cfgdefs.h> 23 24/* 25 * ======== cfg_exit ======== 26 * Purpose: 27 * Discontinue usage of the CFG module. 28 * Parameters: 29 * Returns: 30 * Requires: 31 * cfg_init(void) was previously called. 32 * Ensures: 33 * Resources acquired in cfg_init(void) are freed. 34 */ 35extern void cfg_exit(void); 36 37/* 38 * ======== cfg_get_auto_start ======== 39 * Purpose: 40 * Retreive the autostart mask, if any, for this board. 41 * Parameters: 42 * dev_node_obj: Handle to the dev_node who's driver we are querying. 43 * auto_start: Ptr to location for 32 bit autostart mask. 44 * Returns: 45 * 0: Success. 46 * -EFAULT: dev_node_obj is invalid. 47 * -ENODATA: Unable to retreive resource. 48 * Requires: 49 * CFG initialized. 50 * Ensures: 51 * 0: *auto_start contains autostart mask for this devnode. 52 */ 53extern int cfg_get_auto_start(struct cfg_devnode *dev_node_obj, 54 u32 *auto_start); 55 56/* 57 * ======== cfg_get_cd_version ======== 58 * Purpose: 59 * Retrieves the version of the PM Class Driver. 60 * Parameters: 61 * version: Ptr to u32 to contain version number upon return. 62 * Returns: 63 * 0: Success. version contains Class Driver version in 64 * the form: 0xAABBCCDD where AABB is Major version and 65 * CCDD is Minor. 66 * -EPERM: Failure. 67 * Requires: 68 * CFG initialized. 69 * Ensures: 70 * 0: Success. 71 * else: *version is NULL. 72 */ 73extern int cfg_get_cd_version(u32 *version); 74 75/* 76 * ======== cfg_get_dev_object ======== 77 * Purpose: 78 * Retrieve the Device Object handle for a given devnode. 79 * Parameters: 80 * dev_node_obj: Platform's dev_node handle from which to retrieve 81 * value. 82 * value: Ptr to location to store the value. 83 * Returns: 84 * 0: Success. 85 * -EFAULT: dev_node_obj is invalid or device_obj is invalid. 86 * -ENODATA: The resource is not available. 87 * Requires: 88 * CFG initialized. 89 * Ensures: 90 * 0: *value is set to the retrieved u32. 91 * else: *value is set to 0L. 92 */ 93extern int cfg_get_dev_object(struct cfg_devnode *dev_node_obj, 94 u32 *value); 95 96/* 97 * ======== cfg_get_exec_file ======== 98 * Purpose: 99 * Retreive the default executable, if any, for this board. 100 * Parameters: 101 * dev_node_obj: Handle to the dev_node who's driver we are querying. 102 * buf_size: Size of buffer. 103 * str_exec_file: Ptr to character buf to hold ExecFile. 104 * Returns: 105 * 0: Success. 106 * -EFAULT: dev_node_obj is invalid or str_exec_file is invalid. 107 * -ENODATA: The resource is not available. 108 * Requires: 109 * CFG initialized. 110 * Ensures: 111 * 0: Not more than buf_size bytes were copied into str_exec_file, 112 * and *str_exec_file contains default executable for this 113 * devnode. 114 */ 115extern int cfg_get_exec_file(struct cfg_devnode *dev_node_obj, 116 u32 buf_size, char *str_exec_file); 117 118/* 119 * ======== cfg_get_object ======== 120 * Purpose: 121 * Retrieve the Driver Object handle From the Registry 122 * Parameters: 123 * value: Ptr to location to store the value. 124 * dw_type Type of Object to Get 125 * Returns: 126 * 0: Success. 127 * Requires: 128 * CFG initialized. 129 * Ensures: 130 * 0: *value is set to the retrieved u32(non-Zero). 131 * else: *value is set to 0L. 132 */ 133extern int cfg_get_object(u32 *value, u8 dw_type); 134 135/* 136 * ======== cfg_get_perf_value ======== 137 * Purpose: 138 * Retrieve a flag indicating whether PERF should log statistics for the 139 * PM class driver. 140 * Parameters: 141 * enable_perf: Location to store flag. 0 indicates the key was 142 * not found, or had a zero value. A nonzero value 143 * means the key was found and had a nonzero value. 144 * Returns: 145 * Requires: 146 * enable_perf != NULL; 147 * Ensures: 148 */ 149extern void cfg_get_perf_value(bool *enable_perf); 150 151/* 152 * ======== cfg_get_zl_file ======== 153 * Purpose: 154 * Retreive the ZLFile, if any, for this board. 155 * Parameters: 156 * dev_node_obj: Handle to the dev_node who's driver we are querying. 157 * buf_size: Size of buffer. 158 * str_zl_file_name: Ptr to character buf to hold ZLFileName. 159 * Returns: 160 * 0: Success. 161 * -EFAULT: str_zl_file_name is invalid or dev_node_obj is invalid. 162 * -ENODATA: couldn't find the ZLFileName. 163 * Requires: 164 * CFG initialized. 165 * Ensures: 166 * 0: Not more than buf_size bytes were copied into 167 * str_zl_file_name, and *str_zl_file_name contains ZLFileName 168 * for this devnode. 169 */ 170extern int cfg_get_zl_file(struct cfg_devnode *dev_node_obj, 171 u32 buf_size, char *str_zl_file_name); 172 173/* 174 * ======== cfg_init ======== 175 * Purpose: 176 * Initialize the CFG module's private state. 177 * Parameters: 178 * Returns: 179 * TRUE if initialized; FALSE if error occured. 180 * Requires: 181 * Ensures: 182 * A requirement for each of the other public CFG functions. 183 */ 184extern bool cfg_init(void); 185 186/* 187 * ======== cfg_set_dev_object ======== 188 * Purpose: 189 * Store the Device Object handle for a given devnode. 190 * Parameters: 191 * dev_node_obj: Platform's dev_node handle we are storing value with. 192 * value: Arbitrary value to store. 193 * Returns: 194 * 0: Success. 195 * -EFAULT: dev_node_obj is invalid. 196 * -EPERM: Internal Error. 197 * Requires: 198 * CFG initialized. 199 * Ensures: 200 * 0: The Private u32 was successfully set. 201 */ 202extern int cfg_set_dev_object(struct cfg_devnode *dev_node_obj, 203 u32 value); 204 205/* 206 * ======== CFG_SetDrvObject ======== 207 * Purpose: 208 * Store the Driver Object handle. 209 * Parameters: 210 * value: Arbitrary value to store. 211 * dw_type Type of Object to Store 212 * Returns: 213 * 0: Success. 214 * -EPERM: Internal Error. 215 * Requires: 216 * CFG initialized. 217 * Ensures: 218 * 0: The Private u32 was successfully set. 219 */ 220extern int cfg_set_object(u32 value, u8 dw_type); 221 222#endif /* CFG_ */ 223