1 /****************************************************************************
2 **+-----------------------------------------------------------------------+**
3 **| |**
4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
5 **| All rights reserved. |**
6 **| |**
7 **| Redistribution and use in source and binary forms, with or without |**
8 **| modification, are permitted provided that the following conditions |**
9 **| are met: |**
10 **| |**
11 **| * Redistributions of source code must retain the above copyright |**
12 **| notice, this list of conditions and the following disclaimer. |**
13 **| * Redistributions in binary form must reproduce the above copyright |**
14 **| notice, this list of conditions and the following disclaimer in |**
15 **| the documentation and/or other materials provided with the |**
16 **| distribution. |**
17 **| * Neither the name Texas Instruments nor the names of its |**
18 **| contributors may be used to endorse or promote products derived |**
19 **| from this software without specific prior written permission. |**
20 **| |**
21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
32 **| |**
33 **+-----------------------------------------------------------------------+**
34 ****************************************************************************/
35
36
37 /* Dm: #include <linux/config.h> */
38 #include <linux/module.h>
39 #include <linux/errno.h>
40 #include <linux/string.h>
41 #include <linux/proc_fs.h>
42
43 #include "healthMonitor.h"
44 #include "whalCtrl.h"
45 #include "osTIType.h"
46 #include "configMgr.h"
47
48 int proc_stat_res_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data);
49 static struct proc_dir_entry *res;
50
proc_stat_init(TI_HANDLE * pHandle)51 int proc_stat_init(TI_HANDLE *pHandle)
52 {
53 configMgr_t *pConfigManager = (configMgr_t *)pHandle;
54 res = proc_mkdir("tiwlan", NULL);
55 create_proc_read_entry("tiwlan0_proc_stat", 0, res, proc_stat_res_read_proc, pConfigManager->hHealthMonitor);
56 return 0;
57 }
58
proc_stat_res_read_proc(char * page,char ** start,off_t off,int count,int * eof,void * data)59 int proc_stat_res_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data)
60 {
61 int len=0;
62 healthMonitor_t *pHealthMonitor = (healthMonitor_t*) data;
63 WHAL_CTRL *pWhalCtrl = (WHAL_CTRL *)pHealthMonitor->hHalCtrl;
64 whalCtrl_hwStatus_t *pHwStatus = &pWhalCtrl->pHwCtrl->HwStatus;
65
66 count -= 80; /* some reserve */
67
68 len += (len<count)?sprintf(page+len,"-------------- STA Health Configuration ---------------\n"):0;
69 len += (len<count)?sprintf(page+len,"Full recovery enabled = %d\n",pHealthMonitor->bFullRecoveryEnable):0;
70 len += (len<count)?sprintf(page+len,"Timer interval = %d msec\n",pHealthMonitor->timerInterval):0;
71 len += (len<count)?sprintf(page+len,"\n"):0;
72
73
74 len += (len<count)?sprintf(page+len,"-------------- STA Health Failure Statistics ---------------\n"):0;
75 len += (len<count)?sprintf(page+len,"Health test perfomred = %d\n",pHealthMonitor->numOfHealthTests):0;
76 len += (len<count)?sprintf(page+len,"Full recovery performed = %d\n",pHealthMonitor->numOfRecoveryPerformed):0;
77 len += (len<count)?sprintf(page+len,"No scan complete failure = %d\n",pHealthMonitor->recoveryTriggersNumber[ NO_SCAN_COMPLETE_FAILURE ]):0;
78 len += (len<count)?sprintf(page+len,"Mailbox failure = %d\n",pHealthMonitor->recoveryTriggersNumber[ MBOX_FAILURE ]):0;
79 len += (len<count)?sprintf(page+len,"HW awake failure = %d\n",pHealthMonitor->recoveryTriggersNumber[ HW_AWAKE_FAILURE ]):0;
80 len += (len<count)?sprintf(page+len,"Bus error = %d\n",pHealthMonitor->recoveryTriggersNumber[ BUS_ERROR ]):0;
81 len += (len<count)?sprintf(page+len,"Device error = %d\n",pHealthMonitor->recoveryTriggersNumber[ DEVICE_ERROR ]):0;
82 len += (len<count)?sprintf(page+len,"Tx Stuck Errors = %d\n",pHealthMonitor->recoveryTriggersNumber[ TX_STUCK ]):0;
83 len += (len<count)?sprintf(page+len,"Disconnect timeouts = %d\n",pHealthMonitor->recoveryTriggersNumber[ DISCONNECT_TIMEOUT ]):0;
84 len += (len<count)?sprintf(page+len,"Power save failures = %d\n",pHealthMonitor->recoveryTriggersNumber[ POWER_SAVE_FAILURE ]):0;
85 len += (len<count)?sprintf(page+len,"measurement failures = %d\n",pHealthMonitor->recoveryTriggersNumber[ MEASUREMENT_FAILURE ]):0;
86
87 len += (len<count)?sprintf(page+len,"--------------- whalCtrl_PrintHwStatus ---------------\n\n"):0;
88 len += (len<count)?sprintf(page+len,"NumMboxErrDueToPeriodicBuiltInTestCheck = %d\n", pHwStatus->NumMboxErrDueToPeriodicBuiltInTestCheck):0;
89 len += (len<count)?sprintf(page+len,"NumMboxFailures = %d\n", pHwStatus->NumMboxFailures):0;
90 len += (len<count)?sprintf(page+len, "\n"):0;
91 *eof = 1;
92 return len;
93 }
94
proc_stat_destroy(void)95 int proc_stat_destroy(void)
96 {
97 remove_proc_entry("tiwlan0_proc_stat", res);
98 remove_proc_entry("tiwlan", NULL);
99 return 0;
100 }
101
102
103
104
105
106