linuxinstall/src/pci.h

30 lines
1.5 KiB
C
Raw Normal View History

#pragma once
#include "utils.h"
/// @brief Checks whether the given string is a valid PCI address. If the string is not a valid PCI address, the call will return a failure result with an error message.
/// @param pci The string to check.
/// @return The result of the operation.
result_t check_pci_address(const char* pci);
/// @brief Checks whether the given PCI address exists. If the PCI address does not exist, the call will return a failure result with an error message.
/// @param pci The PCI address to check.
/// @return The result of the operation.
result_t check_pci_exists(const char* pci);
/// @brief Gets the IOMMU group of the given PCI address.
/// @param _group The integer pointer to store the resulting IOMMU group in.
/// @param pci The PCI address to get the IOMMU group of.
/// @return The result of the operation.
result_t get_iommu_group(int* _group, const char* pci);
/// @brief Checks that the given file is a PCI device. This function is used as a filter for listing PCI devices.
/// @param file The file to check.
/// @return Whether the file is a PCI device.
bool pci_filter(const char* file);
/// @brief Get the PCI devices in the given IOMMU group.
/// @param _devices The string array pointer to store the resulting devices in. The caller is responsible for freeing the strings and the array.
/// @param group The IOMMU group to get the devices of.
/// @return The result of the operation.
result_t get_iommu_group_devices(char*** _devices, int group);