static int debug_modem_err(char *buf, int max) { char *x; int size; int i = 0; x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG); if (x != 0) { x[SZ_DIAG_ERR_MSG - 1] = 0; i += scnprintf(buf + i, max - i, "smem: DIAG '%s'\n", x); } x = smem_get_entry(SMEM_ERR_CRASH_LOG, &size); if (x != 0) { x[size - 1] = 0; i += scnprintf(buf + i, max - i, "smem: CRASH LOG\n'%s'\n", x); } i += scnprintf(buf + i, max - i, "\n"); return i; }
static int debug_read_alloc_tbl(char *buf, int max) { struct smd_alloc_elm *shared; int n, i = 0; shared = smem_find(ID_CH_ALLOC_TBL, sizeof(struct smd_alloc_elm[64])); if (!shared) return 0; for (n = 0; n < 64; n++) { i += scnprintf(buf + i, max - i, "name=%s cid=%d ch type=%d " "xfer type=%d ref_count=%d\n", shared[n].name, shared[n].cid, SMD_CHANNEL_TYPE(shared[n].type), SMD_XFER_TYPE(shared[n].type), shared[n].ref_count); } return i; }
static int debug_read_smsm_state(char *buf, int max) { uint32_t *smsm; int n, i = 0; smsm = smem_find(ID_SHARED_STATE, SMSM_NUM_ENTRIES * sizeof(uint32_t)); if (smsm) for (n = 0; n < SMSM_NUM_ENTRIES; n++) i += scnprintf(buf + i, max - i, "entry %d: 0x%08x\n", n, smsm[n]); #if CONFIG_SMD_OFFSET_TCXO_STAT if (sleep_stat) { i += scnprintf(buf + i, max - i, "tcxo_time: 0x%x (%ds) tcxo_cnt: %d\n" "suspend_tcxo_time: 0x%x (%ds) suspend_tcxo_cnt: %d\n" "garbage_pkt_cnt: %d " "zone_based_reg_cnt: %d " "idle_hand_off_cnt: %d " "mo_2g_probe_cnt: %d " "mo_3g_probe_cnt: %d\n", sleep_stat->tcxo_time, sleep_stat->tcxo_time >> 15, sleep_stat->tcxo_cnt, sleep_stat->suspend_tcxo_time, sleep_stat->suspend_tcxo_time >> 15, sleep_stat->suspend_tcxo_cnt, sleep_stat->garbage_pkt_cnt, sleep_stat->zone_based_reg_cnt, sleep_stat->idle_hand_off_cnt, sleep_stat->mo_2g_probe_cnt, sleep_stat->mo_3g_probe_cnt); } #endif return i; }
/** * print_smd_ch_table - Print the current state of every valid SMD channel in a * specific SMD channel allocation table to a human * readable formatted output. * * @s: the sequential file to print to * @tbl: a valid pointer to the channel allocation table to print from * @num_tbl_entries: total number of entries in the table referenced by @tbl * @ch_base_id: the SMEM item id corresponding to the array of channel * structures for the channels found in @tbl * @fifo_base_id: the SMEM item id corresponding to the array of channel fifos * for the channels found in @tbl * @pid: processor id to use for any SMEM operations * @flags: flags to use for any SMEM operations */ static void print_smd_ch_table(struct seq_file *s, struct smd_alloc_elm *tbl, unsigned num_tbl_entries, unsigned ch_base_id, unsigned fifo_base_id, unsigned pid, unsigned flags) { void *half_ch; unsigned half_ch_size; uint32_t ch_type; void *buffer; unsigned buffer_size; int n; /* * formatted, human readable channel state output, ie: ID|CHANNEL NAME |T|PROC |STATE |FIFO SZ|RDPTR |WRPTR |FLAGS |DATAPEN ------------------------------------------------------------------------------- 00|DS |S|APPS |CLOSED |0x02000|0x00000|0x00000|dcCiwrsb|0x00000 | | |MDMSW|OPENING|0x02000|0x00000|0x00000|dcCiwrsb|0x00000 ------------------------------------------------------------------------------- */ seq_printf(s, "%2s|%-19s|%1s|%-5s|%-7s|%-7s|%-7s|%-7s|%-8s|%-7s\n", "ID", "CHANNEL NAME", "T", "PROC", "STATE", "FIFO SZ", "RDPTR", "WRPTR", "FLAGS", "DATAPEN"); seq_puts(s, "-------------------------------------------------------------------------------\n"); for (n = 0; n < num_tbl_entries; ++n) { if (strlen(tbl[n].name) == 0) continue; seq_printf(s, "%2u|%-19s|%s|", tbl[n].cid, tbl[n].name, smd_xfer_type_to_str(SMD_XFER_TYPE(tbl[n].type))); ch_type = SMD_CHANNEL_TYPE(tbl[n].type); if (is_word_access_ch(ch_type)) half_ch_size = sizeof(struct smd_half_channel_word_access); else half_ch_size = sizeof(struct smd_half_channel); half_ch = smem_find(ch_base_id + n, 2 * half_ch_size, pid, flags); buffer = smem_get_entry(fifo_base_id + n, &buffer_size, pid, flags); if (half_ch && buffer) print_half_ch_state(s, half_ch, get_half_ch_funcs(ch_type), buffer_size / 2, smd_edge_to_local_pid(ch_type)); seq_puts(s, "\n"); seq_printf(s, "%2s|%-19s|%1s|", "", "", ""); if (half_ch && buffer) print_half_ch_state(s, half_ch + half_ch_size, get_half_ch_funcs(ch_type), buffer_size / 2, smd_edge_to_remote_pid(ch_type)); seq_puts(s, "\n"); seq_puts(s, "-------------------------------------------------------------------------------\n"); } }
void smsm_print_sleep_info(unsigned wakeup_reason_only) { unsigned long flags; uint32_t *ptr; #if defined(CONFIG_MSM_N_WAY_SMD) struct msm_dem_slave_data *smd_int_info; #else struct tramp_gpio_smem *gpio; struct smsm_interrupt_info *int_info; #endif spin_lock_irqsave(&smem_lock, flags); if (!wakeup_reason_only) { ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr)); if (ptr) pr_info("SMEM_SMSM_SLEEP_DELAY: %x\n", *ptr); ptr = smem_alloc(SMEM_SMSM_LIMIT_SLEEP, sizeof(*ptr)); if (ptr) pr_info("SMEM_SMSM_LIMIT_SLEEP: %x\n", *ptr); ptr = smem_alloc(SMEM_SLEEP_POWER_COLLAPSE_DISABLED, sizeof(*ptr)); if (ptr) pr_info("SMEM_SLEEP_POWER_COLLAPSE_DISABLED: %x\n", *ptr); } #if !defined(CONFIG_MSM_N_WAY_SMD) int_info = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*int_info)); if (int_info) pr_info("SMEM_SMSM_INT_INFO %x %x %x\n", int_info->interrupt_mask, int_info->pending_interrupts, int_info->wakeup_reason); gpio = smem_alloc(SMEM_GPIO_INT, sizeof(*gpio)); if (gpio) { int i; if (!wakeup_reason_only) { for (i = 0; i < NUM_GPIO_INT_REGISTERS; i++) pr_info("SMEM_GPIO_INT: %d: e %x d %x p %x\n", i, gpio->enabled[i], gpio->detection[i], gpio->polarity[i]); } for (i = 0; i < GPIO_SMEM_NUM_GROUPS; i++) pr_info("SMEM_GPIO_INT: %d: f %d: %d %d...\n", i, gpio->num_fired[i], gpio->fired[i][0], gpio->fired[i][1]); } #else smd_int_info = smem_find(SMEM_APPS_DEM_SLAVE_DATA, sizeof(*smd_int_info)); if (smd_int_info) { pr_info("SMEM_APPS_DEM_SLAVE_DATA: %ds %x %x %x %x %x %x %x %s %x\n", smd_int_info->sleep_time / 32768, smd_int_info->interrupt_mask, smd_int_info->resources_used, smd_int_info->reserved1, smd_int_info->wakeup_reason, smd_int_info->pending_interrupts, smd_int_info->rpc_prog, smd_int_info->rpc_proc, smd_int_info->smd_port_name, smd_int_info->reserved2); } #endif spin_unlock_irqrestore(&smem_lock, flags); }