/* Write mgmt frame to this file to send it */ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, size_t len, loff_t *ppos) { struct wil6210_priv *wil = file->private_data; struct wiphy *wiphy = wil_to_wiphy(wil); struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr; struct cfg80211_mgmt_tx_params params; int rc; void *frame; if (!len) return -EINVAL; frame = memdup_user(buf, len); if (IS_ERR(frame)) return PTR_ERR(frame); params.buf = frame; params.len = len; rc = wil_cfg80211_mgmt_tx(wiphy, wdev, ¶ms, NULL); kfree(frame); wil_info(wil, "-> %d\n", rc); return len; }
/* Write mgmt frame to this file to send it */ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, size_t len, loff_t *ppos) { struct wil6210_priv *wil = file->private_data; struct wiphy *wiphy = wil_to_wiphy(wil); struct wireless_dev *wdev = wil_to_wdev(wil); struct cfg80211_mgmt_tx_params params; int rc; void *frame = kmalloc(len, GFP_KERNEL); if (!frame) return -ENOMEM; if (copy_from_user(frame, buf, len)) { kfree(frame); return -EIO; } params.buf = frame; params.len = len; params.chan = wdev->preset_chandef.chan; rc = wil_cfg80211_mgmt_tx(wiphy, wdev, ¶ms, NULL); kfree(frame); wil_info(wil, "%s() -> %d\n", __func__, rc); return len; }
int wil6210_debugfs_init(struct wil6210_priv *wil) { struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME, wil_to_wiphy(wil)->debugfsdir); if (IS_ERR_OR_NULL(dbg)) return -ENODEV; debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox); debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring); debugfs_create_file("stations", S_IRUGO, dbg, wil, &fops_sta); debugfs_create_file("desc", S_IRUGO, dbg, wil, &fops_txdesc); debugfs_create_u32("desc_index", S_IRUGO | S_IWUSR, dbg, &dbg_txdesc_index); debugfs_create_u32("vring_index", S_IRUGO | S_IWUSR, dbg, &dbg_vring_index); debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf); debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid); debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg, &wil->secure_pcp); wil_debugfs_create_ulong("status", S_IRUGO | S_IWUSR, dbg, &wil->status); debugfs_create_u32("fw_version", S_IRUGO, dbg, &wil->fw_version); debugfs_create_x32("hw_version", S_IRUGO, dbg, &wil->hw_version); wil6210_debugfs_create_ISR(wil, "USER_ICR", dbg, HOSTADDR(RGF_USER_USER_ICR)); wil6210_debugfs_create_ISR(wil, "DMA_EP_TX_ICR", dbg, HOSTADDR(RGF_DMA_EP_TX_ICR)); wil6210_debugfs_create_ISR(wil, "DMA_EP_RX_ICR", dbg, HOSTADDR(RGF_DMA_EP_RX_ICR)); wil6210_debugfs_create_ISR(wil, "DMA_EP_MISC_ICR", dbg, HOSTADDR(RGF_DMA_EP_MISC_ICR)); wil6210_debugfs_create_pseudo_ISR(wil, dbg); wil6210_debugfs_create_ITR_CNT(wil, dbg); wil_debugfs_create_iomem_x32("RGF_USER_USAGE_1", S_IRUGO, dbg, wil->csr + HOSTADDR(RGF_USER_USAGE_1)); debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr); debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread); debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset); debugfs_create_file("rxon", S_IWUSR, dbg, wil, &fops_rxon); debugfs_create_file("tx_mgmt", S_IWUSR, dbg, wil, &fops_txmgmt); debugfs_create_file("wmi_send", S_IWUSR, dbg, wil, &fops_wmi); debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp); debugfs_create_file("freq", S_IRUGO, dbg, wil, &fops_freq); debugfs_create_file("link", S_IRUGO, dbg, wil, &fops_link); debugfs_create_file("info", S_IRUGO, dbg, wil, &fops_info); wil6210_debugfs_init_blobs(wil, dbg); return 0; }
int wil6210_debugfs_init(struct wil6210_priv *wil) { struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME, wil_to_wiphy(wil)->debugfsdir); if (IS_ERR_OR_NULL(dbg)) return -ENODEV; wil6210_debugfs_init_files(wil, dbg); wil6210_debugfs_init_isr(wil, dbg); wil6210_debugfs_init_blobs(wil, dbg); wil6210_debugfs_init_offset(wil, dbg, wil, dbg_wil_off); wil6210_debugfs_init_offset(wil, dbg, (void * __force)wil->csr, dbg_wil_regs); wil6210_debugfs_init_offset(wil, dbg, NULL, dbg_statics); wil6210_debugfs_create_pseudo_ISR(wil, dbg); wil6210_debugfs_create_ITR_CNT(wil, dbg); return 0; }
/* * Write mgmt frame to this file to send it */ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, size_t len, loff_t *ppos) { struct wil6210_priv *wil = file->private_data; #if 0 struct net_device *ndev = wil_to_ndev(wil); #endif struct wiphy *wiphy = wil_to_wiphy(wil); struct wireless_dev *wdev = wil_to_wdev(wil); int rc; void *frame = kmalloc(len, GFP_KERNEL); if (!frame) return -ENOMEM; if (copy_from_user(frame, buf, len)) return -EIO; #if 0 rc = wmi_set_channel(wil, 1); if (rc) return rc; rc = wmi_call(wil, WMI_RX_ON_CMDID, NULL, 0, WMI_RX_ON_DONE_EVENTID, NULL, 0, 20); if (rc) return rc; #endif rc = wil_cfg80211_mgmt_tx(wiphy, wdev, wdev->preset_chandef.chan, true, 0, frame, len, true, false, NULL); kfree(frame); wil_info(wil, "%s() -> %d\n", __func__, rc); #if 0 msleep(300); rtnl_lock(); dev_close(ndev); ndev->flags &= ~IFF_UP; rtnl_unlock(); wil_reset(wil); #endif return len; }
/*----------------*/ int wil6210_debugfs_init(struct wil6210_priv *wil) { struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME, wil_to_wiphy(wil)->debugfsdir); if (IS_ERR_OR_NULL(dbg)) return -ENODEV; debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox); debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring); debugfs_create_file("txdesc", S_IRUGO, dbg, wil, &fops_txdesc); debugfs_create_u32("txdesc_index", S_IRUGO | S_IWUSR, dbg, &dbg_txdesc_index); debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf); debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid); debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg, &wil->secure_pcp); wil6210_debugfs_create_ISR(wil, "USER_ICR", dbg, HOSTADDR(RGF_USER_USER_ICR)); wil6210_debugfs_create_ISR(wil, "DMA_EP_TX_ICR", dbg, HOSTADDR(RGF_DMA_EP_TX_ICR)); wil6210_debugfs_create_ISR(wil, "DMA_EP_RX_ICR", dbg, HOSTADDR(RGF_DMA_EP_RX_ICR)); wil6210_debugfs_create_ISR(wil, "DMA_EP_MISC_ICR", dbg, HOSTADDR(RGF_DMA_EP_MISC_ICR)); wil6210_debugfs_create_pseudo_ISR(wil, dbg); wil6210_debugfs_create_ITR_CNT(wil, dbg); debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr); debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread); debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset); debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp); wil->rgf_blob.data = (void * __force)wil->csr + 0; wil->rgf_blob.size = 0xa000; wil_debugfs_create_ioblob("blob_rgf", S_IRUGO, dbg, &wil->rgf_blob); wil->fw_code_blob.data = (void * __force)wil->csr + 0x40000; wil->fw_code_blob.size = 0x40000; wil_debugfs_create_ioblob("blob_fw_code", S_IRUGO, dbg, &wil->fw_code_blob); wil->fw_data_blob.data = (void * __force)wil->csr + 0x80000; wil->fw_data_blob.size = 0x8000; wil_debugfs_create_ioblob("blob_fw_data", S_IRUGO, dbg, &wil->fw_data_blob); wil->fw_peri_blob.data = (void * __force)wil->csr + 0x88000; wil->fw_peri_blob.size = 0x18000; wil_debugfs_create_ioblob("blob_fw_peri", S_IRUGO, dbg, &wil->fw_peri_blob); wil->uc_code_blob.data = (void * __force)wil->csr + 0xa0000; wil->uc_code_blob.size = 0x10000; wil_debugfs_create_ioblob("blob_uc_code", S_IRUGO, dbg, &wil->uc_code_blob); wil->uc_data_blob.data = (void * __force)wil->csr + 0xb0000; wil->uc_data_blob.size = 0x4000; wil_debugfs_create_ioblob("blob_uc_data", S_IRUGO, dbg, &wil->uc_data_blob); return 0; }