debugfs.c (57219dc7bfc5cae48c8309974054733499a0dc63) debugfs.c (c33407a8c50430f1634a8809f9528b6888360e56)
1/*
2 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 1027 unchanged lines hidden (view full) ---

1036
1037static const struct file_operations fops_info = {
1038 .open = wil_info_seq_open,
1039 .release = single_release,
1040 .read = seq_read,
1041 .llseek = seq_lseek,
1042};
1043
1/*
2 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 1027 unchanged lines hidden (view full) ---

1036
1037static const struct file_operations fops_info = {
1038 .open = wil_info_seq_open,
1039 .release = single_release,
1040 .read = seq_read,
1041 .llseek = seq_lseek,
1042};
1043
1044/*---------recovery------------*/
1045/* mode = [manual|auto]
1046 * state = [idle|pending|running]
1047 */
1048static ssize_t wil_read_file_recovery(struct file *file, char __user *user_buf,
1049 size_t count, loff_t *ppos)
1050{
1051 struct wil6210_priv *wil = file->private_data;
1052 char buf[80];
1053 int n;
1054 static const char * const sstate[] = {"idle", "pending", "running"};
1055
1056 n = snprintf(buf, sizeof(buf), "mode = %s\nstate = %s\n",
1057 no_fw_recovery ? "manual" : "auto",
1058 sstate[wil->recovery_state]);
1059
1060 n = min_t(int, n, sizeof(buf));
1061
1062 return simple_read_from_buffer(user_buf, count, ppos,
1063 buf, n);
1064}
1065
1066static ssize_t wil_write_file_recovery(struct file *file,
1067 const char __user *buf_,
1068 size_t count, loff_t *ppos)
1069{
1070 struct wil6210_priv *wil = file->private_data;
1071 static const char run_command[] = "run";
1072 char buf[sizeof(run_command) + 1]; /* to detect "runx" */
1073 ssize_t rc;
1074
1075 if (wil->recovery_state != fw_recovery_pending) {
1076 wil_err(wil, "No recovery pending\n");
1077 return -EINVAL;
1078 }
1079
1080 if (*ppos != 0) {
1081 wil_err(wil, "Offset [%d]\n", (int)*ppos);
1082 return -EINVAL;
1083 }
1084
1085 if (count > sizeof(buf)) {
1086 wil_err(wil, "Input too long, len = %d\n", (int)count);
1087 return -EINVAL;
1088 }
1089
1090 rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, buf_, count);
1091 if (rc < 0)
1092 return rc;
1093
1094 buf[rc] = '\0';
1095 if (0 == strcmp(buf, run_command))
1096 wil_set_recovery_state(wil, fw_recovery_running);
1097 else
1098 wil_err(wil, "Bad recovery command \"%s\"\n", buf);
1099
1100 return rc;
1101}
1102
1103static const struct file_operations fops_recovery = {
1104 .read = wil_read_file_recovery,
1105 .write = wil_write_file_recovery,
1106 .open = simple_open,
1107};
1108
1044/*---------Station matrix------------*/
1045static void wil_print_rxtid(struct seq_file *s, struct wil_tid_ampdu_rx *r)
1046{
1047 int i;
1048 u16 index = ((r->head_seq_num - r->ssn) & 0xfff) % r->buf_size;
1049
1050 seq_printf(s, "0x%03x [", r->head_seq_num);
1051 for (i = 0; i < r->buf_size; i++) {

--- 95 unchanged lines hidden (view full) ---

1147 {"reset", S_IWUSR, &fops_reset},
1148 {"rxon", S_IWUSR, &fops_rxon},
1149 {"tx_mgmt", S_IWUSR, &fops_txmgmt},
1150 {"wmi_send", S_IWUSR, &fops_wmi},
1151 {"temp", S_IRUGO, &fops_temp},
1152 {"freq", S_IRUGO, &fops_freq},
1153 {"link", S_IRUGO, &fops_link},
1154 {"info", S_IRUGO, &fops_info},
1109/*---------Station matrix------------*/
1110static void wil_print_rxtid(struct seq_file *s, struct wil_tid_ampdu_rx *r)
1111{
1112 int i;
1113 u16 index = ((r->head_seq_num - r->ssn) & 0xfff) % r->buf_size;
1114
1115 seq_printf(s, "0x%03x [", r->head_seq_num);
1116 for (i = 0; i < r->buf_size; i++) {

--- 95 unchanged lines hidden (view full) ---

1212 {"reset", S_IWUSR, &fops_reset},
1213 {"rxon", S_IWUSR, &fops_rxon},
1214 {"tx_mgmt", S_IWUSR, &fops_txmgmt},
1215 {"wmi_send", S_IWUSR, &fops_wmi},
1216 {"temp", S_IRUGO, &fops_temp},
1217 {"freq", S_IRUGO, &fops_freq},
1218 {"link", S_IRUGO, &fops_link},
1219 {"info", S_IRUGO, &fops_info},
1220 {"recovery", S_IRUGO | S_IWUSR, &fops_recovery},
1155};
1156
1157static void wil6210_debugfs_init_files(struct wil6210_priv *wil,
1158 struct dentry *dbg)
1159{
1160 int i;
1161
1162 for (i = 0; i < ARRAY_SIZE(dbg_files); i++)

--- 26 unchanged lines hidden (view full) ---

1189 offsetof(struct wil6210_priv, name), type}
1190
1191/* fields in struct wil6210_priv */
1192static const struct dbg_off dbg_wil_off[] = {
1193 WIL_FIELD(secure_pcp, S_IRUGO | S_IWUSR, doff_u32),
1194 WIL_FIELD(status, S_IRUGO | S_IWUSR, doff_ulong),
1195 WIL_FIELD(fw_version, S_IRUGO, doff_u32),
1196 WIL_FIELD(hw_version, S_IRUGO, doff_x32),
1221};
1222
1223static void wil6210_debugfs_init_files(struct wil6210_priv *wil,
1224 struct dentry *dbg)
1225{
1226 int i;
1227
1228 for (i = 0; i < ARRAY_SIZE(dbg_files); i++)

--- 26 unchanged lines hidden (view full) ---

1255 offsetof(struct wil6210_priv, name), type}
1256
1257/* fields in struct wil6210_priv */
1258static const struct dbg_off dbg_wil_off[] = {
1259 WIL_FIELD(secure_pcp, S_IRUGO | S_IWUSR, doff_u32),
1260 WIL_FIELD(status, S_IRUGO | S_IWUSR, doff_ulong),
1261 WIL_FIELD(fw_version, S_IRUGO, doff_u32),
1262 WIL_FIELD(hw_version, S_IRUGO, doff_x32),
1263 WIL_FIELD(recovery_count, S_IRUGO, doff_u32),
1197 {},
1198};
1199
1200static const struct dbg_off dbg_wil_regs[] = {
1201 {"RGF_MAC_MTRL_COUNTER_0", S_IRUGO, HOSTADDR(RGF_MAC_MTRL_COUNTER_0),
1202 doff_io32},
1203 {"RGF_USER_USAGE_1", S_IRUGO, HOSTADDR(RGF_USER_USAGE_1), doff_io32},
1204 {},

--- 38 unchanged lines hidden ---
1264 {},
1265};
1266
1267static const struct dbg_off dbg_wil_regs[] = {
1268 {"RGF_MAC_MTRL_COUNTER_0", S_IRUGO, HOSTADDR(RGF_MAC_MTRL_COUNTER_0),
1269 doff_io32},
1270 {"RGF_USER_USAGE_1", S_IRUGO, HOSTADDR(RGF_USER_USAGE_1), doff_io32},
1271 {},

--- 38 unchanged lines hidden ---