LCOV - code coverage report
Current view: top level - kernel - instr.c (source / functions) Hit Total Coverage
Test: combined.info Lines: 22 25 88.0 %
Date: 2022-03-28 16:04:14 Functions: 6 7 85.7 %
Branches: 4 4 100.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                 :      13692 : 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                 :      13692 :     if ((direction == DMA_BIDIRECTIONAL ||
      15         [ +  + ]:      13692 :         direction == DMA_FROM_DEVICE))
      16                 :      13312 :             handle_stream_dma_init((uint64_t)addr, (uint64_t)ptr, size);
      17                 :      13692 : }
      18                 :            : EXPORT_SYMBOL(instr_dma_map_single);
      19                 :            : 
      20                 :      13692 : 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                 :      13692 :     if ((direction == DMA_BIDIRECTIONAL ||
      26         [ +  + ]:      13692 :         direction == DMA_FROM_DEVICE))
      27                 :      13312 :             handle_stream_dma_exit((uint64_t)addr);
      28                 :      13692 : }
      29                 :            : EXPORT_SYMBOL(instr_dma_unmap_single);
      30                 :            : 
      31                 :      13692 : 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                 :      13692 : }
      38                 :            : EXPORT_SYMBOL(instr_dma_map_page);
      39                 :            : 
      40                 :      13692 : 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                 :      13692 : }
      46                 :            : EXPORT_SYMBOL(instr_dma_unmap_page);
      47                 :            : 
      48                 :      12875 : inline void instr_dma_map_sg(int ents, struct device*dev,
      49                 :            :         struct scatterlist *sgl, int nents, int direction, 
      50                 :            :         unsigned long attrs) {
      51                 :      12875 :     int i;
      52                 :      12875 :     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                 :      12875 : }
      64                 :            : EXPORT_SYMBOL(instr_dma_map_sg);
      65                 :            : 
      66                 :      12875 : inline void instr_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
      67                 :            :         int nents, int direction, unsigned long attrs) {
      68                 :      12875 :     int i;
      69                 :      12875 :     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                 :      12875 : }
      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