// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ #include <linux/virtio_pci_admin.h> #include "virtio_pci_common.h" /* * virtio_pci_admin_has_legacy_io - Checks whether the legacy IO * commands are supported * @dev: VF pci_dev * * Returns true on success. */ bool virtio_pci_admin_has_legacy_io(struct pci_dev *pdev) { … } EXPORT_SYMBOL_GPL(…); static int virtio_pci_admin_legacy_io_write(struct pci_dev *pdev, u16 opcode, u8 offset, u8 size, u8 *buf) { … } /* * virtio_pci_admin_legacy_io_write_common - Write legacy common configuration * of a member device * @dev: VF pci_dev * @offset: starting byte offset within the common configuration area to write to * @size: size of the data to write * @buf: buffer which holds the data * * Note: caller must serialize access for the given device. * Returns 0 on success, or negative on failure. */ int virtio_pci_admin_legacy_common_io_write(struct pci_dev *pdev, u8 offset, u8 size, u8 *buf) { … } EXPORT_SYMBOL_GPL(…); /* * virtio_pci_admin_legacy_io_write_device - Write legacy device configuration * of a member device * @dev: VF pci_dev * @offset: starting byte offset within the device configuration area to write to * @size: size of the data to write * @buf: buffer which holds the data * * Note: caller must serialize access for the given device. * Returns 0 on success, or negative on failure. */ int virtio_pci_admin_legacy_device_io_write(struct pci_dev *pdev, u8 offset, u8 size, u8 *buf) { … } EXPORT_SYMBOL_GPL(…); static int virtio_pci_admin_legacy_io_read(struct pci_dev *pdev, u16 opcode, u8 offset, u8 size, u8 *buf) { … } /* * virtio_pci_admin_legacy_device_io_read - Read legacy device configuration of * a member device * @dev: VF pci_dev * @offset: starting byte offset within the device configuration area to read from * @size: size of the data to be read * @buf: buffer to hold the returned data * * Note: caller must serialize access for the given device. * Returns 0 on success, or negative on failure. */ int virtio_pci_admin_legacy_device_io_read(struct pci_dev *pdev, u8 offset, u8 size, u8 *buf) { … } EXPORT_SYMBOL_GPL(…); /* * virtio_pci_admin_legacy_common_io_read - Read legacy common configuration of * a member device * @dev: VF pci_dev * @offset: starting byte offset within the common configuration area to read from * @size: size of the data to be read * @buf: buffer to hold the returned data * * Note: caller must serialize access for the given device. * Returns 0 on success, or negative on failure. */ int virtio_pci_admin_legacy_common_io_read(struct pci_dev *pdev, u8 offset, u8 size, u8 *buf) { … } EXPORT_SYMBOL_GPL(…); /* * virtio_pci_admin_legacy_io_notify_info - Read the queue notification * information for legacy interface * @dev: VF pci_dev * @req_bar_flags: requested bar flags * @bar: on output the BAR number of the owner or member device * @bar_offset: on output the offset within bar * * Returns 0 on success, or negative on failure. */ int virtio_pci_admin_legacy_io_notify_info(struct pci_dev *pdev, u8 req_bar_flags, u8 *bar, u64 *bar_offset) { … } EXPORT_SYMBOL_GPL(…);