LCOV - code coverage report
Current view: top level - kernel - instr.c (source / functions) Hit Total Coverage
Test: combined.info Lines: 8 25 32.0 %
Date: 2022-04-01 14:17:54 Functions: 2 7 28.6 %
Branches: 0 4 0.0 %

           Branch data     Line data    Source code
       1                 :            : #include <linux/device.h>
       2                 :            : #include <linux/scatterlist.h>
       3                 :            : #include <linux/mm_types.h>
       4                 :            : #include <linux/dma-direction.h>
       5                 :            : #include <linux/instr.h>
       6                 :            : #include <linux/drifuzz.h>
       7                 :            : 
       8                 :          0 : inline void instr_dma_map_single(dma_addr_t addr, struct device *dev, 
       9                 :            :                 void *ptr, size_t size, int direction, 
      10                 :            :                                 unsigned long attrs) {
      11                 :            :         // printk(KERN_INFO "Device [%s] dma map pointer [%px] size [%lu]"
      12                 :            :     //          " dir [%u] to dma_addr [%llx]\n", 
      13                 :            :     //          dev->driver->name, ptr, size, direction, addr);
      14                 :          0 :     if ((direction == DMA_BIDIRECTIONAL ||
      15         [ #  # ]:          0 :         direction == DMA_FROM_DEVICE))
      16                 :          0 :             handle_stream_dma_init((uint64_t)addr, (uint64_t)ptr, size);
      17                 :          0 : }
      18                 :            : EXPORT_SYMBOL(instr_dma_map_single);
      19                 :            : 
      20                 :          0 : inline void instr_dma_unmap_single(struct device *dev, dma_addr_t addr,
      21                 :            :                 size_t size, int direction, unsigned long attrs) {
      22                 :            :         // printk(KERN_INFO "Device [%s] dma unmap dma_addr [%llx] size [%lu]"
      23                 :            :         //      " dir [%u]\n",
      24                 :            :         //      dev->driver->name, addr, size, direction);
      25                 :          0 :     if ((direction == DMA_BIDIRECTIONAL ||
      26         [ #  # ]:          0 :         direction == DMA_FROM_DEVICE))
      27                 :          0 :             handle_stream_dma_exit((uint64_t)addr);
      28                 :          0 : }
      29                 :            : EXPORT_SYMBOL(instr_dma_unmap_single);
      30                 :            : 
      31                 :          0 : inline void instr_dma_map_page(dma_addr_t addr, struct device *dev,
      32                 :            :         struct page* page, size_t offset, size_t size, int direction,
      33                 :            :         unsigned long attrs) {
      34                 :            :     // printk(KERN_INFO "Device [%s] dma map page with offset [%lu]"
      35                 :            :     //     " size[%lu] dir [%u] to dma_addr [%llx]\n",
      36                 :            :     //     dev->driver->name, offset, size, direction, addr);
      37                 :          0 : }
      38                 :            : EXPORT_SYMBOL(instr_dma_map_page);
      39                 :            : 
      40                 :          0 : inline void instr_dma_unmap_page(struct device *dev, dma_addr_t addr,
      41                 :            :         size_t size, int direction, unsigned long attrs) {
      42                 :            :     // printk(KERN_INFO "Device [%s] dma unmap page dma_addr [%llx]"
      43                 :            :     //     " size[%lu] dir [%u]\n",
      44                 :            :     //     dev->driver->name, addr, size, direction);
      45                 :          0 : }
      46                 :            : EXPORT_SYMBOL(instr_dma_unmap_page);
      47                 :            : 
      48                 :      10623 : inline void instr_dma_map_sg(int ents, struct device*dev,
      49                 :            :         struct scatterlist *sgl, int nents, int direction, 
      50                 :            :         unsigned long attrs) {
      51                 :      10623 :     int i;
      52                 :      10623 :     struct scatterlist *sg;
      53                 :            : 
      54                 :            :     // printk(KERN_INFO "Device dma map scatterlist begin\n");
      55                 :            :     // for_each_sg(sgl, sg, nents, i) {
      56                 :            :     //     printk(KERN_INFO "Device [%s] dma map page with offset [%u]"
      57                 :            :     //         " size[%u] dir [%u] to dma_addr [%llx]\n",
      58                 :            :     //         dev->driver->name, sg->offset, sg->length, direction, 
      59                 :            :     //         sg->dma_address);
      60                 :            :     // }
      61                 :            :     // printk(KERN_INFO "Device dma map scatterlist end\n");
      62                 :            : 
      63                 :      10623 : }
      64                 :            : EXPORT_SYMBOL(instr_dma_map_sg);
      65                 :            : 
      66                 :      10623 : inline void instr_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
      67                 :            :         int nents, int direction, unsigned long attrs) {
      68                 :      10623 :     int i;
      69                 :      10623 :     struct scatterlist *sg;
      70                 :            : 
      71                 :            :     // printk(KERN_INFO "Device dma unmap scatterlist begin\n");
      72                 :            :     // for_each_sg(sgl, sg, nents, i) {
      73                 :            :     //     printk(KERN_INFO "Device [%s] dma unmap dma_addr [%llx]"
      74                 :            :     //         " size[%u] dir [%u]",
      75                 :            :     //         dev->driver->name, sg->dma_address, sg->length, direction);
      76                 :            :     // }
      77                 :            :     // printk(KERN_INFO "Device dma unmap scatterlist end\n");
      78                 :      10623 : }
      79                 :            : EXPORT_SYMBOL(instr_dma_unmap_sg);
      80                 :            : 
      81                 :          0 : inline void instr_request_irq(int res, unsigned int irq, 
      82                 :            :         void *handler, unsigned long flags, const char *name, 
      83                 :            :         void *dev) {
      84                 :          0 :         printk(KERN_INFO "Device [%s] request irq [%u] res [%d] handler [%p]\n",
      85                 :            :                         name, irq, res, (void*)handler);
      86                 :          0 : }
      87                 :            : EXPORT_SYMBOL(instr_request_irq);

Generated by: LCOV version 1.14