at v6.8-rc2 92 lines 2.6 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 2 * 3 * Header file for MCDI FW interaction for CDX bus. 4 * 5 * Copyright (C) 2022-2023, Advanced Micro Devices, Inc. 6 */ 7 8#ifndef CDX_MCDI_FUNCTIONS_H 9#define CDX_MCDI_FUNCTIONS_H 10 11#include "mcdi.h" 12#include "../cdx.h" 13 14/** 15 * cdx_mcdi_get_num_buses - Get the total number of buses on 16 * the controller. 17 * @cdx: pointer to MCDI interface. 18 * 19 * Return: total number of buses available on the controller, 20 * <0 on failure 21 */ 22int cdx_mcdi_get_num_buses(struct cdx_mcdi *cdx); 23 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. 29 * 30 * Return: total number of devices available on the bus, <0 on failure 31 */ 32int cdx_mcdi_get_num_devs(struct cdx_mcdi *cdx, int bus_num); 33 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. 43 * 44 * Return: 0 total number of devices available on the bus, <0 on failure 45 */ 46int cdx_mcdi_get_dev_config(struct cdx_mcdi *cdx, 47 u8 bus_num, u8 dev_num, 48 struct cdx_dev_params *dev_params); 49 50/** 51 * cdx_mcdi_bus_enable - Enable CDX bus represented by bus_num 52 * @cdx: pointer to MCDI interface. 53 * @bus_num: Bus number. 54 * 55 * Return: 0 on success, <0 on failure 56 */ 57int cdx_mcdi_bus_enable(struct cdx_mcdi *cdx, u8 bus_num); 58 59/** 60 * cdx_mcdi_bus_disable - Disable CDX bus represented by bus_num 61 * @cdx: pointer to MCDI interface. 62 * @bus_num: Bus number. 63 * 64 * Return: 0 on success, <0 on failure 65 */ 66int cdx_mcdi_bus_disable(struct cdx_mcdi *cdx, u8 bus_num); 67 68/** 69 * cdx_mcdi_reset_device - Reset cdx device represented by bus_num:dev_num 70 * @cdx: pointer to MCDI interface. 71 * @bus_num: Bus number. 72 * @dev_num: Device number. 73 * 74 * Return: 0 on success, <0 on failure 75 */ 76int cdx_mcdi_reset_device(struct cdx_mcdi *cdx, 77 u8 bus_num, u8 dev_num); 78 79/** 80 * cdx_mcdi_bus_master_enable - Set/Reset bus mastering for cdx device 81 * represented by bus_num:dev_num 82 * @cdx: pointer to MCDI interface. 83 * @bus_num: Bus number. 84 * @dev_num: Device number. 85 * @enable: Enable bus mastering if set, disable otherwise. 86 * 87 * Return: 0 on success, <0 on failure 88 */ 89int cdx_mcdi_bus_master_enable(struct cdx_mcdi *cdx, u8 bus_num, 90 u8 dev_num, bool enable); 91 92#endif /* CDX_MCDI_FUNCTIONS_H */