root/drivers/pci/controller/pci-hyperv-intf.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. hyperv_read_cfg_blk
  2. hyperv_write_cfg_blk
  3. hyperv_reg_block_invalidate
  4. exit_hv_pci_intf
  5. init_hv_pci_intf

   1 // SPDX-License-Identifier: GPL-2.0
   2 /*
   3  * Copyright (c) Microsoft Corporation.
   4  *
   5  * Author:
   6  *   Haiyang Zhang <haiyangz@microsoft.com>
   7  *
   8  * This small module is a helper driver allows other drivers to
   9  * have a common interface with the Hyper-V PCI frontend driver.
  10  */
  11 
  12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  13 
  14 #include <linux/kernel.h>
  15 #include <linux/module.h>
  16 #include <linux/hyperv.h>
  17 
  18 struct hyperv_pci_block_ops hvpci_block_ops;
  19 EXPORT_SYMBOL_GPL(hvpci_block_ops);
  20 
  21 int hyperv_read_cfg_blk(struct pci_dev *dev, void *buf, unsigned int buf_len,
  22                         unsigned int block_id, unsigned int *bytes_returned)
  23 {
  24         if (!hvpci_block_ops.read_block)
  25                 return -EOPNOTSUPP;
  26 
  27         return hvpci_block_ops.read_block(dev, buf, buf_len, block_id,
  28                                           bytes_returned);
  29 }
  30 EXPORT_SYMBOL_GPL(hyperv_read_cfg_blk);
  31 
  32 int hyperv_write_cfg_blk(struct pci_dev *dev, void *buf, unsigned int len,
  33                          unsigned int block_id)
  34 {
  35         if (!hvpci_block_ops.write_block)
  36                 return -EOPNOTSUPP;
  37 
  38         return hvpci_block_ops.write_block(dev, buf, len, block_id);
  39 }
  40 EXPORT_SYMBOL_GPL(hyperv_write_cfg_blk);
  41 
  42 int hyperv_reg_block_invalidate(struct pci_dev *dev, void *context,
  43                                 void (*block_invalidate)(void *context,
  44                                                          u64 block_mask))
  45 {
  46         if (!hvpci_block_ops.reg_blk_invalidate)
  47                 return -EOPNOTSUPP;
  48 
  49         return hvpci_block_ops.reg_blk_invalidate(dev, context,
  50                                                   block_invalidate);
  51 }
  52 EXPORT_SYMBOL_GPL(hyperv_reg_block_invalidate);
  53 
  54 static void __exit exit_hv_pci_intf(void)
  55 {
  56 }
  57 
  58 static int __init init_hv_pci_intf(void)
  59 {
  60         return 0;
  61 }
  62 
  63 module_init(init_hv_pci_intf);
  64 module_exit(exit_hv_pci_intf);
  65 
  66 MODULE_DESCRIPTION("Hyper-V PCI Interface");
  67 MODULE_LICENSE("GPL v2");

/* [<][>][^][v][top][bottom][index][help] */