diff options
| author | Yuanyuan Liu <yuanliu@codeaurora.org> | 2016-08-23 16:51:36 -0700 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-09-27 12:32:29 -0700 |
| commit | 61d7a95a6a93813c1fa97c696d62d808f7f89000 (patch) | |
| tree | 9a4644092bd76731cc3e65c012155af87a2a94d6 | |
| parent | 6f0d53034452709e9ac38600320ee8970235808d (diff) | |
qcacmn: Call PLD APIs of athdiag read/write when bus type is SNOC
Call PLD APIs of athdiag read/write if current bus type is SNOC.
CRs-Fixed: 1061835
Change-Id: I992a29027e36c98bac429f2402e93462195bd76c
| -rw-r--r-- | hif/src/ath_procfs.c | 34 | ||||
| -rw-r--r-- | pld_stub/inc/pld_common.h | 12 |
2 files changed, 46 insertions, 0 deletions
diff --git a/hif/src/ath_procfs.c b/hif/src/ath_procfs.c index e977b0e79ae9..d1f720286633 100644 --- a/hif/src/ath_procfs.c +++ b/hif/src/ath_procfs.c @@ -32,6 +32,7 @@ #include <linux/proc_fs.h> /* Necessary because we use the proc fs */ #include <asm/uaccess.h> /* for copy_from_user */ #include "hif.h" +#include "hif_main.h" #if defined(HIF_USB) #include "if_usb.h" #endif @@ -39,6 +40,7 @@ #include "if_sdio.h" #endif #include "hif_debug.h" +#include "pld_common.h" #define PROCFS_NAME "athdiagpfs" #define PROCFS_DIR "cld" @@ -63,6 +65,8 @@ static ssize_t ath_procfs_diag_read(struct file *file, char __user *buf, hif_handle_t hif_hdl; int rv; uint8_t *read_buffer = NULL; + struct hif_softc *scn; + uint32_t offset = 0, memtype = 0; read_buffer = qdf_mem_malloc(count); if (NULL == read_buffer) { @@ -74,6 +78,18 @@ static ssize_t ath_procfs_diag_read(struct file *file, char __user *buf, HIF_DBG("rd buff 0x%p cnt %zu offset 0x%x buf 0x%p", read_buffer, count, (int)*pos, buf); + scn = HIF_GET_SOFTC(hif_hdl); + if (scn->bus_type == QDF_BUS_TYPE_SNOC) { + memtype = ((uint32_t)(*pos) & 0xff000000) >> 24; + offset = (uint32_t)(*pos) & 0xffffff; + HIF_TRACE("%s: offset 0x%x memtype 0x%x, datalen %zu\n", + __func__, offset, memtype, count); + rv = pld_athdiag_read(scn->qdf_dev->dev, + offset, memtype, count, + (uint8_t *)read_buffer); + goto out; + } + if ((count == 4) && ((((uint32_t) (*pos)) & 3) == 0)) { /* reading a word? */ rv = hif_diag_read_access(hif_hdl, (uint32_t)(*pos), @@ -83,6 +99,8 @@ static ssize_t ath_procfs_diag_read(struct file *file, char __user *buf, (uint8_t *)read_buffer, count); } +out: + if (copy_to_user(buf, read_buffer, count)) { qdf_mem_free(read_buffer); HIF_ERROR("%s: copy_to_user error in /proc/%s", @@ -105,6 +123,8 @@ static ssize_t ath_procfs_diag_write(struct file *file, hif_handle_t hif_hdl; int rv; uint8_t *write_buffer = NULL; + struct hif_softc *scn; + uint32_t offset = 0, memtype = 0; write_buffer = qdf_mem_malloc(count); if (NULL == write_buffer) { @@ -123,6 +143,18 @@ static ssize_t ath_procfs_diag_write(struct file *file, write_buffer, buf, count, (int)*pos, *((uint32_t *) write_buffer)); + scn = HIF_GET_SOFTC(hif_hdl); + if (scn->bus_type == QDF_BUS_TYPE_SNOC) { + memtype = ((uint32_t)(*pos) & 0xff000000) >> 24; + offset = (uint32_t)(*pos) & 0xffffff; + HIF_TRACE("%s: offset 0x%x memtype 0x%x, datalen %zu\n", + __func__, offset, memtype, count); + rv = pld_athdiag_write(scn->qdf_dev->dev, + offset, memtype, count, + (uint8_t *)write_buffer); + goto out; + } + if ((count == 4) && ((((uint32_t) (*pos)) & 3) == 0)) { /* reading a word? */ uint32_t value = *((uint32_t *)write_buffer); @@ -132,6 +164,8 @@ static ssize_t ath_procfs_diag_write(struct file *file, (uint8_t *)write_buffer, count); } +out: + qdf_mem_free(write_buffer); if (rv == 0) { return count; diff --git a/pld_stub/inc/pld_common.h b/pld_stub/inc/pld_common.h index 7689c9d6d4ae..83ed961f4e3f 100644 --- a/pld_stub/inc/pld_common.h +++ b/pld_stub/inc/pld_common.h @@ -210,6 +210,18 @@ static inline void pld_runtime_exit(struct device *dev) { return; } +static inline int pld_athdiag_read(struct device *dev, + uint32_t offset, uint32_t memtype, + uint32_t datalen, uint8_t *output) +{ + return 0; +} +static inline int pld_athdiag_write(struct device *dev, + uint32_t offset, uint32_t memtype, + uint32_t datalen, uint8_t *input) +{ + return 0; +} #endif #endif |
