4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * Implementation of platform specific config services.
8 * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
19 #include <linux/types.h>
21 /* ----------------------------------- DSP/BIOS Bridge */
22 #include <dspbridge/dbdefs.h>
24 /* ----------------------------------- Trace & Debug */
25 #include <dspbridge/dbc.h>
27 /* ----------------------------------- OS Adaptation Layer */
29 /* ----------------------------------- This */
30 #include <dspbridge/cfg.h>
31 #include <dspbridge/drv.h>
34 struct list_head link;
35 char sz_string[MAXREGPATHLENGTH];
39 * ======== cfg_exit ========
41 * Discontinue usage of the CFG module.
49 * ======== cfg_get_auto_start ========
51 * Retreive the autostart mask, if any, for this board.
53 int cfg_get_auto_start(struct cfg_devnode *dev_node_obj,
58 struct drv_data *drv_datap = dev_get_drvdata(bridge);
60 dw_buf_size = sizeof(*auto_start);
63 if (!auto_start || !drv_datap)
66 *auto_start = (drv_datap->base_img) ? 1 : 0;
68 DBC_ENSURE((status == 0 &&
69 (*auto_start == 0 || *auto_start == 1))
75 * ======== cfg_get_dev_object ========
77 * Retrieve the Device Object handle for a given devnode.
79 int cfg_get_dev_object(struct cfg_devnode *dev_node_obj,
84 struct drv_data *drv_datap = dev_get_drvdata(bridge);
95 dw_buf_size = sizeof(value);
98 /* check the device string and then store dev object */
101 ((char *)((struct drv_ext *)dev_node_obj)->sz_string,
103 *value = (u32)drv_datap->dev_object;
106 pr_err("%s: Failed, status 0x%x\n", __func__, status);
111 * ======== cfg_get_exec_file ========
113 * Retreive the default executable, if any, for this board.
115 int cfg_get_exec_file(struct cfg_devnode *dev_node_obj, u32 buf_size,
119 struct drv_data *drv_datap = dev_get_drvdata(bridge);
124 else if (!str_exec_file || !drv_datap)
127 if (strlen(drv_datap->base_img) > buf_size)
130 if (!status && drv_datap->base_img)
131 strcpy(str_exec_file, drv_datap->base_img);
134 pr_err("%s: Failed, status 0x%x\n", __func__, status);
135 DBC_ENSURE(((status == 0) &&
136 (strlen(str_exec_file) <= buf_size))
142 * ======== cfg_get_object ========
144 * Retrieve the Object handle from the Registry
146 int cfg_get_object(u32 *value, u8 dw_type)
148 int status = -EINVAL;
149 struct drv_data *drv_datap = dev_get_drvdata(bridge);
151 DBC_REQUIRE(value != NULL);
157 case (REG_DRV_OBJECT):
158 if (drv_datap->drv_object) {
159 *value = (u32)drv_datap->drv_object;
165 case (REG_MGR_OBJECT):
166 if (drv_datap->mgr_object) {
167 *value = (u32)drv_datap->mgr_object;
179 pr_err("%s: Failed, status 0x%x\n", __func__, status);
181 DBC_ENSURE((!status && *value != 0) || (status && *value == 0));
186 * ======== cfg_init ========
188 * Initialize the CFG module's private state.
196 * ======== cfg_set_dev_object ========
198 * Store the Device Object handle and dev_node pointer for a given devnode.
200 int cfg_set_dev_object(struct cfg_devnode *dev_node_obj, u32 value)
203 struct drv_data *drv_datap = dev_get_drvdata(bridge);
206 pr_err("%s: Failed, status 0x%x\n", __func__, status);
214 /* Store the Bridge device object in the Registry */
216 if (!(strcmp((char *)dev_node_obj, "TIOMAP1510")))
217 drv_datap->dev_object = (void *) value;
220 pr_err("%s: Failed, status 0x%x\n", __func__, status);
226 * ======== cfg_set_object ========
228 * Store the Driver Object handle
230 int cfg_set_object(u32 value, u8 dw_type)
232 int status = -EINVAL;
233 struct drv_data *drv_datap = dev_get_drvdata(bridge);
239 case (REG_DRV_OBJECT):
240 drv_datap->drv_object = (void *)value;
243 case (REG_MGR_OBJECT):
244 drv_datap->mgr_object = (void *)value;
251 pr_err("%s: Failed, status 0x%x\n", __func__, status);