Path: blob/master/drivers/cdx/controller/mcdi_functions.h
26428 views
/* SPDX-License-Identifier: GPL-2.01*2* Header file for MCDI FW interaction for CDX bus.3*4* Copyright (C) 2022-2023, Advanced Micro Devices, Inc.5*/67#ifndef CDX_MCDI_FUNCTIONS_H8#define CDX_MCDI_FUNCTIONS_H910#include "mcdi.h"11#include "../cdx.h"1213/**14* cdx_mcdi_get_num_buses - Get the total number of buses on15* the controller.16* @cdx: pointer to MCDI interface.17*18* Return: total number of buses available on the controller,19* <0 on failure20*/21int cdx_mcdi_get_num_buses(struct cdx_mcdi *cdx);2223/**24* cdx_mcdi_get_num_devs - Get the total number of devices on25* a particular bus of the controller.26* @cdx: pointer to MCDI interface.27* @bus_num: Bus number.28*29* Return: total number of devices available on the bus, <0 on failure30*/31int cdx_mcdi_get_num_devs(struct cdx_mcdi *cdx, int bus_num);3233/**34* cdx_mcdi_get_dev_config - Get configuration for a particular35* bus_num:dev_num36* @cdx: pointer to MCDI interface.37* @bus_num: Bus number.38* @dev_num: Device number.39* @dev_params: Pointer to cdx_dev_params, this is populated by this40* device with the configuration corresponding to the provided41* bus_num:dev_num.42*43* Return: 0 total number of devices available on the bus, <0 on failure44*/45int cdx_mcdi_get_dev_config(struct cdx_mcdi *cdx,46u8 bus_num, u8 dev_num,47struct cdx_dev_params *dev_params);4849/**50* cdx_mcdi_bus_enable - Enable CDX bus represented by bus_num51* @cdx: pointer to MCDI interface.52* @bus_num: Bus number.53*54* Return: 0 on success, <0 on failure55*/56int cdx_mcdi_bus_enable(struct cdx_mcdi *cdx, u8 bus_num);5758/**59* cdx_mcdi_bus_disable - Disable CDX bus represented by bus_num60* @cdx: pointer to MCDI interface.61* @bus_num: Bus number.62*63* Return: 0 on success, <0 on failure64*/65int cdx_mcdi_bus_disable(struct cdx_mcdi *cdx, u8 bus_num);6667/**68* cdx_mcdi_write_msi - Write MSI configuration for CDX device69* @cdx: pointer to MCDI interface.70* @bus_num: Bus number.71* @dev_num: Device number.72* @msi_vector: Device-relative MSI vector number.73* Must be < MSI_COUNT reported for the device.74* @msi_address: MSI address to be used by the hardware. Typically, on ARM75* systems this address is translated by the IOMMU (if enabled) and76* it is the responsibility of the entity managing the IOMMU (APU kernel)77* to supply the correct IOVA here.78* @msi_data: MSI data to be used by the hardware. On versal-net, only the79* lower 16-bits are used, the remaining bits are ignored and should be80* set to zero.81*82* Return: 0 on success, <0 on failure83*/84int cdx_mcdi_write_msi(struct cdx_mcdi *cdx, u8 bus_num, u8 dev_num,85u32 msi_vector, u64 msi_address, u32 msi_data);8687/**88* cdx_mcdi_reset_device - Reset cdx device represented by bus_num:dev_num89* @cdx: pointer to MCDI interface.90* @bus_num: Bus number.91* @dev_num: Device number.92*93* Return: 0 on success, <0 on failure94*/95int cdx_mcdi_reset_device(struct cdx_mcdi *cdx,96u8 bus_num, u8 dev_num);9798/**99* cdx_mcdi_bus_master_enable - Set/Reset bus mastering for cdx device100* represented by bus_num:dev_num101* @cdx: pointer to MCDI interface.102* @bus_num: Bus number.103* @dev_num: Device number.104* @enable: Enable bus mastering if set, disable otherwise.105*106* Return: 0 on success, <0 on failure107*/108int cdx_mcdi_bus_master_enable(struct cdx_mcdi *cdx, u8 bus_num,109u8 dev_num, bool enable);110111/**112* cdx_mcdi_msi_enable - Enable/Disable MSIs for cdx device represented113* by bus_num:dev_num114* @cdx: pointer to MCDI interface.115* @bus_num: Bus number.116* @dev_num: Device number.117* @enable: Enable msi's if set, disable otherwise.118*119* Return: 0 on success, <0 on failure120*/121int cdx_mcdi_msi_enable(struct cdx_mcdi *cdx, u8 bus_num,122u8 dev_num, bool enable);123124#endif /* CDX_MCDI_FUNCTIONS_H */125126127