Loading drivers/char/diag/Makefile +1 −2 Original line number Diff line number Diff line Loading @@ -3,6 +3,5 @@ obj-$(CONFIG_DIAGFWD_BRIDGE_CODE) += diagfwd_bridge.o obj-$(CONFIG_USB_QCOM_DIAG_BRIDGE) += diagfwd_hsic.o obj-$(CONFIG_USB_QCOM_DIAG_BRIDGE) += diagfwd_smux.o obj-$(CONFIG_MSM_MHI) += diagfwd_mhi.o obj-$(CONFIG_DIAG_OVER_PCIE) += diag_pcie.o obj-$(CONFIG_DIAG_USES_SMD) += diagfwd_smd.o diagchar-objs := diagchar_core.o diagchar_hdlc.o diagfwd.o diagfwd_glink.o diagfwd_peripheral.o diagfwd_socket.o diag_mux.o diag_memorydevice.o diag_usb.o diagmem.o diagfwd_cntl.o diag_dci.o diag_masks.o diag_debugfs.o diagchar-objs := diagchar_core.o diagchar_hdlc.o diagfwd.o diagfwd_glink.o diagfwd_peripheral.o diagfwd_socket.o diag_mux.o diag_memorydevice.o diag_usb.o diagmem.o diagfwd_cntl.o diag_dci.o diag_masks.o diag_debugfs.o diag_pcie.o No newline at end of file drivers/char/diag/diag_debugfs.c +1 −9 Original line number Diff line number Diff line /* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -44,9 +44,7 @@ static struct dentry *diag_dbgfs_dent; static int diag_dbgfs_table_index; static int diag_dbgfs_mempool_index; static int diag_dbgfs_usbinfo_index; #ifdef CONFIG_DIAG_OVER_PCIE static int diag_dbgfs_pcieinfo_index; #endif static int diag_dbgfs_smdinfo_index; static int diag_dbgfs_socketinfo_index; static int diag_dbgfs_glinkinfo_index; Loading Loading @@ -485,7 +483,6 @@ static ssize_t diag_dbgfs_read_usbinfo(struct file *file, char __user *ubuf, return ret; } #ifdef CONFIG_DIAG_OVER_PCIE static ssize_t diag_dbgfs_read_pcieinfo(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { Loading Loading @@ -545,7 +542,6 @@ static ssize_t diag_dbgfs_read_pcieinfo(struct file *file, char __user *ubuf, kfree(buf); return ret; } #endif #ifdef CONFIG_DIAG_USES_SMD static ssize_t diag_dbgfs_read_smdinfo(struct file *file, char __user *ubuf, Loading Loading @@ -1146,11 +1142,9 @@ const struct file_operations diag_dbgfs_usbinfo_ops = { .read = diag_dbgfs_read_usbinfo, }; #ifdef CONFIG_DIAG_OVER_PCIE const struct file_operations diag_dbgfs_pcieinfo_ops = { .read = diag_dbgfs_read_pcieinfo, }; #endif const struct file_operations diag_dbgfs_dcistats_ops = { .read = diag_dbgfs_read_dcistats, Loading Loading @@ -1211,12 +1205,10 @@ int diag_debugfs_init(void) if (!entry) goto err; #ifdef CONFIG_DIAG_OVER_PCIE entry = debugfs_create_file("pcieinfo", 0444, diag_dbgfs_dent, 0, &diag_dbgfs_pcieinfo_ops); if (!entry) goto err; #endif entry = debugfs_create_file("dci_stats", 0444, diag_dbgfs_dent, 0, &diag_dbgfs_dcistats_ops); Loading drivers/char/diag/diag_mux.c +24 −29 Original line number Diff line number Diff line /* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -31,12 +31,6 @@ #include "diagfwd_peripheral.h" #include "diag_ipc_logging.h" #ifdef CONFIG_DIAG_OVER_PCIE #define diag_mux_register_ops diag_pcie_register_ops #else #define diag_mux_register_ops diag_usb_register_ops #endif struct diag_mux_state_t *diag_mux; static struct diag_logger_t usb_logger; static struct diag_logger_t md_logger; Loading @@ -58,7 +52,6 @@ static struct diag_logger_ops md_log_ops = { .close_peripheral = diag_md_close_peripheral, }; #ifdef CONFIG_DIAG_OVER_PCIE static struct diag_logger_ops pcie_log_ops = { .open = diag_pcie_connect_all, .close = diag_pcie_disconnect_all, Loading @@ -66,7 +59,6 @@ static struct diag_logger_ops pcie_log_ops = { .write = diag_pcie_write, .close_peripheral = NULL }; #endif int diag_mux_init(void) { Loading @@ -82,18 +74,16 @@ int diag_mux_init(void) md_logger.mode = DIAG_MEMORY_DEVICE_MODE; md_logger.log_ops = &md_log_ops; diag_md_init(); #ifdef CONFIG_DIAG_OVER_PCIE pcie_logger.mode = DIAG_PCIE_MODE; pcie_logger.log_ops = &pcie_log_ops; diag_mux->pcie_ptr = &pcie_logger; #endif /* * Set USB logging as the default logger. This is the mode * Diag should be in when it initializes. */ diag_mux->usb_ptr = &usb_logger; diag_mux->md_ptr = &md_logger; switch (driver->transport_set) { switch (driver->pcie_transport_def) { case DIAG_ROUTE_TO_PCIE: diag_mux->logger = &pcie_logger; diag_mux->mode = DIAG_PCIE_MODE; Loading @@ -113,7 +103,6 @@ void diag_mux_exit(void) kfree(diag_mux); } #ifdef CONFIG_DIAG_OVER_PCIE int diag_pcie_register_ops(int proc, int ctx, struct diag_mux_ops *ops) { int err = 0; Loading @@ -127,22 +116,13 @@ int diag_pcie_register_ops(int proc, int ctx, struct diag_mux_ops *ops) pcie_logger.ops[proc] = ops; err = diag_pcie_register(proc, ctx, ops); if (err) { driver->transport_set = DIAG_ROUTE_TO_USB; diag_mux->logger = &usb_logger; diag_mux->mode = DIAG_USB_MODE; usb_logger.ops[proc] = ops; err = diag_usb_register(proc, ctx, ops); if (err) { pr_err("diag: MUX: unable to register usb operations for proc: %d, err: %d\n", proc, err); return err; } pr_err("diag: MUX: unable to register pcie operations for proc: %d, err: %d\n", proc, err); return err; } return 0; } #else int diag_usb_register_ops(int proc, int ctx, struct diag_mux_ops *ops) { int err = 0; Loading @@ -161,7 +141,6 @@ int diag_usb_register_ops(int proc, int ctx, struct diag_mux_ops *ops) } return 0; } #endif int diag_mux_register(int proc, int ctx, struct diag_mux_ops *ops) { Loading @@ -172,9 +151,17 @@ int diag_mux_register(int proc, int ctx, struct diag_mux_ops *ops) if (proc < 0 || proc >= NUM_MUX_PROC) return 0; err = diag_mux_register_ops(proc, ctx, ops); if (err) err = diag_pcie_register_ops(proc, ctx, ops); if (err) { pr_err("diag: MUX: unable to register PCIe operations, continuing with USB registrations for proc: %d, err: %d\n", proc, err); } err = diag_usb_register_ops(proc, ctx, ops); if (err) { pr_err("diag: MUX: unable to register USB operations for proc: %d, err: %d\n", proc, err); return err; } md_logger.ops[proc] = ops; err = diag_md_register(proc, ctx, ops); if (err) { Loading @@ -182,7 +169,6 @@ int diag_mux_register(int proc, int ctx, struct diag_mux_ops *ops) proc, err); return err; } return 0; } Loading Loading @@ -308,6 +294,10 @@ int diag_mux_switch_logging(int *req_mode, int *peripheral_mask) diag_mux->pcie_ptr->log_ops->close(); diag_mux->logger = diag_mux->md_ptr; diag_mux->md_ptr->log_ops->open(); } else if (*req_mode == DIAG_USB_MODE) { diag_mux->pcie_ptr->log_ops->close(); diag_mux->logger = diag_mux->usb_ptr; diag_mux->usb_ptr->log_ops->open(); } else if (*req_mode == DIAG_MULTI_MODE) { diag_mux->md_ptr->log_ops->open(); diag_mux->logger = NULL; Loading @@ -318,6 +308,10 @@ int diag_mux_switch_logging(int *req_mode, int *peripheral_mask) diag_mux->usb_ptr->log_ops->close(); diag_mux->logger = diag_mux->md_ptr; diag_mux->md_ptr->log_ops->open(); } else if (*req_mode == DIAG_PCIE_MODE) { diag_mux->usb_ptr->log_ops->close(); diag_mux->logger = diag_mux->pcie_ptr; diag_mux->pcie_ptr->log_ops->open(); } else if (*req_mode == DIAG_MULTI_MODE) { diag_mux->md_ptr->log_ops->open(); diag_mux->logger = NULL; Loading @@ -333,7 +327,8 @@ int diag_mux_switch_logging(int *req_mode, int *peripheral_mask) diag_mux->logger = diag_mux->pcie_ptr; diag_mux->pcie_ptr->log_ops->open(); } else if (*req_mode == DIAG_MULTI_MODE) { if (driver->transport_set == DIAG_ROUTE_TO_PCIE) if (driver->pcie_transport_def == DIAG_ROUTE_TO_PCIE || driver->transport_set == DIAG_ROUTE_TO_PCIE) diag_mux->pcie_ptr->log_ops->open(); else diag_mux->usb_ptr->log_ops->open(); Loading drivers/char/diag/diag_mux.h +1 −2 Original line number Diff line number Diff line /* Copyright (c) 2014-2016, 2018 The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2016, 2018-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -77,5 +77,4 @@ int diag_mux_close_all(void); int diag_mux_switch_logging(int *new_mode, int *peripheral_mask); int diag_pcie_register_ops(int proc, int ctx, struct diag_mux_ops *ops); int diag_usb_register_ops(int proc, int ctx, struct diag_mux_ops *ops); int diag_mux_register_ops(int proc, int ctx, struct diag_mux_ops *ops); #endif drivers/char/diag/diag_pcie.c +3 −2 Original line number Diff line number Diff line /* Copyright (c) 2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -85,6 +85,7 @@ void diag_pcie_read_work_fn(struct work_struct *work) ureq.mode = IPA_DMA_SYNC; ureq.buf = pcie_info->in_chan_attr.read_buffer; ureq.len = pcie_info->in_chan_attr.read_buffer_size; ureq.transfer_len = 0; bytes_avail = mhi_dev_read_channel(&ureq); if (bytes_avail < 0) return; Loading Loading @@ -319,7 +320,7 @@ int diag_pcie_write(int id, unsigned char *buf, int len, int ctxt) pcie_info = &diag_pcie[id]; if (len > pcie_info->out_chan_attr.max_pkt_size) { DIAG_LOG(DIAG_DEBUG_MUX, "len: %d, max_size: %d\n", DIAG_LOG(DIAG_DEBUG_MUX, "len: %d, max_size: %zu\n", len, pcie_info->out_chan_attr.max_pkt_size); return diag_pcie_write_ext(pcie_info, buf, len, ctxt); } Loading Loading
drivers/char/diag/Makefile +1 −2 Original line number Diff line number Diff line Loading @@ -3,6 +3,5 @@ obj-$(CONFIG_DIAGFWD_BRIDGE_CODE) += diagfwd_bridge.o obj-$(CONFIG_USB_QCOM_DIAG_BRIDGE) += diagfwd_hsic.o obj-$(CONFIG_USB_QCOM_DIAG_BRIDGE) += diagfwd_smux.o obj-$(CONFIG_MSM_MHI) += diagfwd_mhi.o obj-$(CONFIG_DIAG_OVER_PCIE) += diag_pcie.o obj-$(CONFIG_DIAG_USES_SMD) += diagfwd_smd.o diagchar-objs := diagchar_core.o diagchar_hdlc.o diagfwd.o diagfwd_glink.o diagfwd_peripheral.o diagfwd_socket.o diag_mux.o diag_memorydevice.o diag_usb.o diagmem.o diagfwd_cntl.o diag_dci.o diag_masks.o diag_debugfs.o diagchar-objs := diagchar_core.o diagchar_hdlc.o diagfwd.o diagfwd_glink.o diagfwd_peripheral.o diagfwd_socket.o diag_mux.o diag_memorydevice.o diag_usb.o diagmem.o diagfwd_cntl.o diag_dci.o diag_masks.o diag_debugfs.o diag_pcie.o No newline at end of file
drivers/char/diag/diag_debugfs.c +1 −9 Original line number Diff line number Diff line /* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -44,9 +44,7 @@ static struct dentry *diag_dbgfs_dent; static int diag_dbgfs_table_index; static int diag_dbgfs_mempool_index; static int diag_dbgfs_usbinfo_index; #ifdef CONFIG_DIAG_OVER_PCIE static int diag_dbgfs_pcieinfo_index; #endif static int diag_dbgfs_smdinfo_index; static int diag_dbgfs_socketinfo_index; static int diag_dbgfs_glinkinfo_index; Loading Loading @@ -485,7 +483,6 @@ static ssize_t diag_dbgfs_read_usbinfo(struct file *file, char __user *ubuf, return ret; } #ifdef CONFIG_DIAG_OVER_PCIE static ssize_t diag_dbgfs_read_pcieinfo(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { Loading Loading @@ -545,7 +542,6 @@ static ssize_t diag_dbgfs_read_pcieinfo(struct file *file, char __user *ubuf, kfree(buf); return ret; } #endif #ifdef CONFIG_DIAG_USES_SMD static ssize_t diag_dbgfs_read_smdinfo(struct file *file, char __user *ubuf, Loading Loading @@ -1146,11 +1142,9 @@ const struct file_operations diag_dbgfs_usbinfo_ops = { .read = diag_dbgfs_read_usbinfo, }; #ifdef CONFIG_DIAG_OVER_PCIE const struct file_operations diag_dbgfs_pcieinfo_ops = { .read = diag_dbgfs_read_pcieinfo, }; #endif const struct file_operations diag_dbgfs_dcistats_ops = { .read = diag_dbgfs_read_dcistats, Loading Loading @@ -1211,12 +1205,10 @@ int diag_debugfs_init(void) if (!entry) goto err; #ifdef CONFIG_DIAG_OVER_PCIE entry = debugfs_create_file("pcieinfo", 0444, diag_dbgfs_dent, 0, &diag_dbgfs_pcieinfo_ops); if (!entry) goto err; #endif entry = debugfs_create_file("dci_stats", 0444, diag_dbgfs_dent, 0, &diag_dbgfs_dcistats_ops); Loading
drivers/char/diag/diag_mux.c +24 −29 Original line number Diff line number Diff line /* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -31,12 +31,6 @@ #include "diagfwd_peripheral.h" #include "diag_ipc_logging.h" #ifdef CONFIG_DIAG_OVER_PCIE #define diag_mux_register_ops diag_pcie_register_ops #else #define diag_mux_register_ops diag_usb_register_ops #endif struct diag_mux_state_t *diag_mux; static struct diag_logger_t usb_logger; static struct diag_logger_t md_logger; Loading @@ -58,7 +52,6 @@ static struct diag_logger_ops md_log_ops = { .close_peripheral = diag_md_close_peripheral, }; #ifdef CONFIG_DIAG_OVER_PCIE static struct diag_logger_ops pcie_log_ops = { .open = diag_pcie_connect_all, .close = diag_pcie_disconnect_all, Loading @@ -66,7 +59,6 @@ static struct diag_logger_ops pcie_log_ops = { .write = diag_pcie_write, .close_peripheral = NULL }; #endif int diag_mux_init(void) { Loading @@ -82,18 +74,16 @@ int diag_mux_init(void) md_logger.mode = DIAG_MEMORY_DEVICE_MODE; md_logger.log_ops = &md_log_ops; diag_md_init(); #ifdef CONFIG_DIAG_OVER_PCIE pcie_logger.mode = DIAG_PCIE_MODE; pcie_logger.log_ops = &pcie_log_ops; diag_mux->pcie_ptr = &pcie_logger; #endif /* * Set USB logging as the default logger. This is the mode * Diag should be in when it initializes. */ diag_mux->usb_ptr = &usb_logger; diag_mux->md_ptr = &md_logger; switch (driver->transport_set) { switch (driver->pcie_transport_def) { case DIAG_ROUTE_TO_PCIE: diag_mux->logger = &pcie_logger; diag_mux->mode = DIAG_PCIE_MODE; Loading @@ -113,7 +103,6 @@ void diag_mux_exit(void) kfree(diag_mux); } #ifdef CONFIG_DIAG_OVER_PCIE int diag_pcie_register_ops(int proc, int ctx, struct diag_mux_ops *ops) { int err = 0; Loading @@ -127,22 +116,13 @@ int diag_pcie_register_ops(int proc, int ctx, struct diag_mux_ops *ops) pcie_logger.ops[proc] = ops; err = diag_pcie_register(proc, ctx, ops); if (err) { driver->transport_set = DIAG_ROUTE_TO_USB; diag_mux->logger = &usb_logger; diag_mux->mode = DIAG_USB_MODE; usb_logger.ops[proc] = ops; err = diag_usb_register(proc, ctx, ops); if (err) { pr_err("diag: MUX: unable to register usb operations for proc: %d, err: %d\n", proc, err); return err; } pr_err("diag: MUX: unable to register pcie operations for proc: %d, err: %d\n", proc, err); return err; } return 0; } #else int diag_usb_register_ops(int proc, int ctx, struct diag_mux_ops *ops) { int err = 0; Loading @@ -161,7 +141,6 @@ int diag_usb_register_ops(int proc, int ctx, struct diag_mux_ops *ops) } return 0; } #endif int diag_mux_register(int proc, int ctx, struct diag_mux_ops *ops) { Loading @@ -172,9 +151,17 @@ int diag_mux_register(int proc, int ctx, struct diag_mux_ops *ops) if (proc < 0 || proc >= NUM_MUX_PROC) return 0; err = diag_mux_register_ops(proc, ctx, ops); if (err) err = diag_pcie_register_ops(proc, ctx, ops); if (err) { pr_err("diag: MUX: unable to register PCIe operations, continuing with USB registrations for proc: %d, err: %d\n", proc, err); } err = diag_usb_register_ops(proc, ctx, ops); if (err) { pr_err("diag: MUX: unable to register USB operations for proc: %d, err: %d\n", proc, err); return err; } md_logger.ops[proc] = ops; err = diag_md_register(proc, ctx, ops); if (err) { Loading @@ -182,7 +169,6 @@ int diag_mux_register(int proc, int ctx, struct diag_mux_ops *ops) proc, err); return err; } return 0; } Loading Loading @@ -308,6 +294,10 @@ int diag_mux_switch_logging(int *req_mode, int *peripheral_mask) diag_mux->pcie_ptr->log_ops->close(); diag_mux->logger = diag_mux->md_ptr; diag_mux->md_ptr->log_ops->open(); } else if (*req_mode == DIAG_USB_MODE) { diag_mux->pcie_ptr->log_ops->close(); diag_mux->logger = diag_mux->usb_ptr; diag_mux->usb_ptr->log_ops->open(); } else if (*req_mode == DIAG_MULTI_MODE) { diag_mux->md_ptr->log_ops->open(); diag_mux->logger = NULL; Loading @@ -318,6 +308,10 @@ int diag_mux_switch_logging(int *req_mode, int *peripheral_mask) diag_mux->usb_ptr->log_ops->close(); diag_mux->logger = diag_mux->md_ptr; diag_mux->md_ptr->log_ops->open(); } else if (*req_mode == DIAG_PCIE_MODE) { diag_mux->usb_ptr->log_ops->close(); diag_mux->logger = diag_mux->pcie_ptr; diag_mux->pcie_ptr->log_ops->open(); } else if (*req_mode == DIAG_MULTI_MODE) { diag_mux->md_ptr->log_ops->open(); diag_mux->logger = NULL; Loading @@ -333,7 +327,8 @@ int diag_mux_switch_logging(int *req_mode, int *peripheral_mask) diag_mux->logger = diag_mux->pcie_ptr; diag_mux->pcie_ptr->log_ops->open(); } else if (*req_mode == DIAG_MULTI_MODE) { if (driver->transport_set == DIAG_ROUTE_TO_PCIE) if (driver->pcie_transport_def == DIAG_ROUTE_TO_PCIE || driver->transport_set == DIAG_ROUTE_TO_PCIE) diag_mux->pcie_ptr->log_ops->open(); else diag_mux->usb_ptr->log_ops->open(); Loading
drivers/char/diag/diag_mux.h +1 −2 Original line number Diff line number Diff line /* Copyright (c) 2014-2016, 2018 The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2016, 2018-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -77,5 +77,4 @@ int diag_mux_close_all(void); int diag_mux_switch_logging(int *new_mode, int *peripheral_mask); int diag_pcie_register_ops(int proc, int ctx, struct diag_mux_ops *ops); int diag_usb_register_ops(int proc, int ctx, struct diag_mux_ops *ops); int diag_mux_register_ops(int proc, int ctx, struct diag_mux_ops *ops); #endif
drivers/char/diag/diag_pcie.c +3 −2 Original line number Diff line number Diff line /* Copyright (c) 2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -85,6 +85,7 @@ void diag_pcie_read_work_fn(struct work_struct *work) ureq.mode = IPA_DMA_SYNC; ureq.buf = pcie_info->in_chan_attr.read_buffer; ureq.len = pcie_info->in_chan_attr.read_buffer_size; ureq.transfer_len = 0; bytes_avail = mhi_dev_read_channel(&ureq); if (bytes_avail < 0) return; Loading Loading @@ -319,7 +320,7 @@ int diag_pcie_write(int id, unsigned char *buf, int len, int ctxt) pcie_info = &diag_pcie[id]; if (len > pcie_info->out_chan_attr.max_pkt_size) { DIAG_LOG(DIAG_DEBUG_MUX, "len: %d, max_size: %d\n", DIAG_LOG(DIAG_DEBUG_MUX, "len: %d, max_size: %zu\n", len, pcie_info->out_chan_attr.max_pkt_size); return diag_pcie_write_ext(pcie_info, buf, len, ctxt); } Loading