Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / cdx / controller / mcdi_functions.h
blobb9942affdc6b2d9e0ab3f427f8f97ad113e88415
1 /* SPDX-License-Identifier: GPL-2.0
3 * Header file for MCDI FW interaction for CDX bus.
5 * Copyright (C) 2022-2023, Advanced Micro Devices, Inc.
6 */
8 #ifndef CDX_MCDI_FUNCTIONS_H
9 #define CDX_MCDI_FUNCTIONS_H
11 #include "mcdi.h"
12 #include "../cdx.h"
14 /**
15 * cdx_mcdi_get_num_buses - Get the total number of buses on
16 * the controller.
17 * @cdx: pointer to MCDI interface.
19 * Return: total number of buses available on the controller,
20 * <0 on failure
22 int cdx_mcdi_get_num_buses(struct cdx_mcdi *cdx);
24 /**
25 * cdx_mcdi_get_num_devs - Get the total number of devices on
26 * a particular bus of the controller.
27 * @cdx: pointer to MCDI interface.
28 * @bus_num: Bus number.
30 * Return: total number of devices available on the bus, <0 on failure
32 int cdx_mcdi_get_num_devs(struct cdx_mcdi *cdx, int bus_num);
34 /**
35 * cdx_mcdi_get_dev_config - Get configuration for a particular
36 * bus_num:dev_num
37 * @cdx: pointer to MCDI interface.
38 * @bus_num: Bus number.
39 * @dev_num: Device number.
40 * @dev_params: Pointer to cdx_dev_params, this is populated by this
41 * device with the configuration corresponding to the provided
42 * bus_num:dev_num.
44 * Return: 0 total number of devices available on the bus, <0 on failure
46 int cdx_mcdi_get_dev_config(struct cdx_mcdi *cdx,
47 u8 bus_num, u8 dev_num,
48 struct cdx_dev_params *dev_params);
50 /**
51 * cdx_mcdi_bus_enable - Enable CDX bus represented by bus_num
52 * @cdx: pointer to MCDI interface.
53 * @bus_num: Bus number.
55 * Return: 0 on success, <0 on failure
57 int cdx_mcdi_bus_enable(struct cdx_mcdi *cdx, u8 bus_num);
59 /**
60 * cdx_mcdi_bus_disable - Disable CDX bus represented by bus_num
61 * @cdx: pointer to MCDI interface.
62 * @bus_num: Bus number.
64 * Return: 0 on success, <0 on failure
66 int cdx_mcdi_bus_disable(struct cdx_mcdi *cdx, u8 bus_num);
68 /**
69 * cdx_mcdi_write_msi - Write MSI configuration for CDX device
70 * @cdx: pointer to MCDI interface.
71 * @bus_num: Bus number.
72 * @dev_num: Device number.
73 * @msi_vector: Device-relative MSI vector number.
74 * Must be < MSI_COUNT reported for the device.
75 * @msi_address: MSI address to be used by the hardware. Typically, on ARM
76 * systems this address is translated by the IOMMU (if enabled) and
77 * it is the responsibility of the entity managing the IOMMU (APU kernel)
78 * to supply the correct IOVA here.
79 * @msi_data: MSI data to be used by the hardware. On versal-net, only the
80 * lower 16-bits are used, the remaining bits are ignored and should be
81 * set to zero.
83 * Return: 0 on success, <0 on failure
85 int cdx_mcdi_write_msi(struct cdx_mcdi *cdx, u8 bus_num, u8 dev_num,
86 u32 msi_vector, u64 msi_address, u32 msi_data);
88 /**
89 * cdx_mcdi_reset_device - Reset cdx device represented by bus_num:dev_num
90 * @cdx: pointer to MCDI interface.
91 * @bus_num: Bus number.
92 * @dev_num: Device number.
94 * Return: 0 on success, <0 on failure
96 int cdx_mcdi_reset_device(struct cdx_mcdi *cdx,
97 u8 bus_num, u8 dev_num);
99 /**
100 * cdx_mcdi_bus_master_enable - Set/Reset bus mastering for cdx device
101 * represented by bus_num:dev_num
102 * @cdx: pointer to MCDI interface.
103 * @bus_num: Bus number.
104 * @dev_num: Device number.
105 * @enable: Enable bus mastering if set, disable otherwise.
107 * Return: 0 on success, <0 on failure
109 int cdx_mcdi_bus_master_enable(struct cdx_mcdi *cdx, u8 bus_num,
110 u8 dev_num, bool enable);
113 * cdx_mcdi_msi_enable - Enable/Disable MSIs for cdx device represented
114 * by bus_num:dev_num
115 * @cdx: pointer to MCDI interface.
116 * @bus_num: Bus number.
117 * @dev_num: Device number.
118 * @enable: Enable msi's if set, disable otherwise.
120 * Return: 0 on success, <0 on failure
122 int cdx_mcdi_msi_enable(struct cdx_mcdi *cdx, u8 bus_num,
123 u8 dev_num, bool enable);
125 #endif /* CDX_MCDI_FUNCTIONS_H */