LCOV - code coverage report
Current view: top level - tty/serial/8250 - 8250_pcilib.c (source / functions) Coverage Total Hit
Test: TTY Combined Coverage Lines: 0.0 % 22 0
Test Date: 2025-08-26 15:45:50 Functions: 0.0 % 2 0

            Line data    Source code
       1              : // SPDX-License-Identifier: GPL-2.0
       2              : /*
       3              :  * 8250 PCI library.
       4              :  *
       5              :  * Copyright (C) 2001 Russell King, All Rights Reserved.
       6              :  */
       7              : #include <linux/errno.h>
       8              : #include <linux/ioport.h>
       9              : #include <linux/pci.h>
      10              : #include <linux/types.h>
      11              : 
      12              : #include "8250.h"
      13              : #include "8250_pcilib.h"
      14              : 
      15            0 : int serial_8250_warn_need_ioport(struct pci_dev *dev)
      16              : {
      17            0 :         dev_warn(&dev->dev,
      18              :                  "Serial port not supported because of missing I/O resource\n");
      19              : 
      20            0 :         return -ENXIO;
      21              : }
      22              : EXPORT_SYMBOL_NS_GPL(serial_8250_warn_need_ioport, "SERIAL_8250_PCI");
      23              : 
      24            0 : int serial8250_pci_setup_port(struct pci_dev *dev, struct uart_8250_port *port,
      25              :                    u8 bar, unsigned int offset, int regshift)
      26              : {
      27            0 :         if (bar >= PCI_STD_NUM_BARS)
      28            0 :                 return -EINVAL;
      29              : 
      30            0 :         if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
      31            0 :                 if (!pcim_iomap(dev, bar, 0) && !pcim_iomap_table(dev))
      32            0 :                         return -ENOMEM;
      33              : 
      34            0 :                 port->port.iotype = UPIO_MEM;
      35            0 :                 port->port.iobase = 0;
      36            0 :                 port->port.mapbase = pci_resource_start(dev, bar) + offset;
      37            0 :                 port->port.membase = pcim_iomap_table(dev)[bar] + offset;
      38            0 :                 port->port.regshift = regshift;
      39            0 :         } else if (IS_ENABLED(CONFIG_HAS_IOPORT)) {
      40            0 :                 port->port.iotype = UPIO_PORT;
      41            0 :                 port->port.iobase = pci_resource_start(dev, bar) + offset;
      42            0 :                 port->port.mapbase = 0;
      43            0 :                 port->port.membase = NULL;
      44            0 :                 port->port.regshift = 0;
      45              :         } else {
      46              :                 return serial_8250_warn_need_ioport(dev);
      47              :         }
      48            0 :         return 0;
      49            0 : }
      50              : EXPORT_SYMBOL_NS_GPL(serial8250_pci_setup_port, "SERIAL_8250_PCI");
      51              : MODULE_DESCRIPTION("8250 PCI library");
      52              : MODULE_LICENSE("GPL");
        

Generated by: LCOV version 2.0-1