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 /* ----------------------------------- DSP/BIOS Bridge */
20 #include <dspbridge/std.h>
21 #include <dspbridge/dbdefs.h>
23 /* ----------------------------------- Trace & Debug */
24 #include <dspbridge/dbc.h>
26 /* ----------------------------------- OS Adaptation Layer */
28 /* ----------------------------------- This */
29 #include <dspbridge/cfg.h>
30 #include <dspbridge/drv.h>
33 struct list_head link;
34 char sz_string[MAXREGPATHLENGTH];
38 * ======== cfg_exit ========
40 * Discontinue usage of the CFG module.
48 * ======== cfg_get_auto_start ========
50 * Retreive the autostart mask, if any, for this board.
52 int cfg_get_auto_start(struct cfg_devnode *dev_node_obj,
53 OUT u32 *pdwAutoStart)
57 struct drv_data *drv_datap = dev_get_drvdata(bridge);
59 dw_buf_size = sizeof(*pdwAutoStart);
62 if (!pdwAutoStart || !drv_datap)
64 if (DSP_SUCCEEDED(status))
65 *pdwAutoStart = (drv_datap->base_img) ? 1 : 0;
67 DBC_ENSURE((status == 0 &&
68 (*pdwAutoStart == 0 || *pdwAutoStart == 1))
74 * ======== cfg_get_dev_object ========
76 * Retrieve the Device Object handle for a given devnode.
78 int cfg_get_dev_object(struct cfg_devnode *dev_node_obj,
83 struct drv_data *drv_datap = dev_get_drvdata(bridge);
94 dw_buf_size = sizeof(pdwValue);
95 if (DSP_SUCCEEDED(status)) {
97 /* check the device string and then store dev object */
100 ((char *)((struct drv_ext *)dev_node_obj)->sz_string,
102 *pdwValue = (u32)drv_datap->dev_object;
104 if (DSP_FAILED(status))
105 pr_err("%s: Failed, status 0x%x\n", __func__, status);
110 * ======== cfg_get_exec_file ========
112 * Retreive the default executable, if any, for this board.
114 int cfg_get_exec_file(struct cfg_devnode *dev_node_obj, u32 ul_buf_size,
115 OUT char *pstrExecFile)
118 struct drv_data *drv_datap = dev_get_drvdata(bridge);
123 else if (!pstrExecFile || !drv_datap)
126 if (strlen(drv_datap->base_img) > ul_buf_size)
129 if (DSP_SUCCEEDED(status) && drv_datap->base_img)
130 strcpy(pstrExecFile, drv_datap->base_img);
132 if (DSP_FAILED(status))
133 pr_err("%s: Failed, status 0x%x\n", __func__, status);
134 DBC_ENSURE(((status == 0) &&
135 (strlen(pstrExecFile) <= ul_buf_size))
141 * ======== cfg_get_object ========
143 * Retrieve the Object handle from the Registry
145 int cfg_get_object(OUT u32 *pdwValue, u8 dw_type)
147 int status = -EINVAL;
148 struct drv_data *drv_datap = dev_get_drvdata(bridge);
150 DBC_REQUIRE(pdwValue != NULL);
156 case (REG_DRV_OBJECT):
157 if (drv_datap->drv_object) {
158 *pdwValue = (u32)drv_datap->drv_object;
164 case (REG_MGR_OBJECT):
165 if (drv_datap->mgr_object) {
166 *pdwValue = (u32)drv_datap->mgr_object;
176 if (DSP_FAILED(status)) {
178 pr_err("%s: Failed, status 0x%x\n", __func__, status);
180 DBC_ENSURE((DSP_SUCCEEDED(status) && *pdwValue != 0) ||
181 (DSP_FAILED(status) && *pdwValue == 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 dwValue)
203 struct drv_data *drv_datap = dev_get_drvdata(bridge);
206 pr_err("%s: Failed, status 0x%x\n", __func__, status);
213 if (DSP_SUCCEEDED(status)) {
214 /* Store the Bridge device object in the Registry */
216 if (!(strcmp((char *)dev_node_obj, "TIOMAP1510")))
217 drv_datap->dev_object = (void *) dwValue;
219 if (DSP_FAILED(status))
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 dwValue, 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 *)dwValue;
243 case (REG_MGR_OBJECT):
244 drv_datap->mgr_object = (void *)dwValue;
250 if (DSP_FAILED(status))
251 pr_err("%s: Failed, status 0x%x\n", __func__, status);