/* SPDX-License-Identifier: GPL-2.01*2* Header file for the CDX Bus3*4* Copyright (C) 2022-2023, Advanced Micro Devices, Inc.5*/67#ifndef _CDX_H_8#define _CDX_H_910#include <linux/cdx/cdx_bus.h>1112/**13* struct cdx_dev_params - CDX device parameters14* @cdx: CDX controller associated with the device15* @parent: Associated CDX Bus device16* @vendor: Vendor ID for CDX device17* @device: Device ID for CDX device18* @subsys_vendor: Sub vendor ID for CDX device19* @subsys_device: Sub device ID for CDX device20* @bus_num: Bus number for this CDX device21* @dev_num: Device number for this device22* @res: array of MMIO region entries23* @res_count: number of valid MMIO regions24* @req_id: Requestor ID associated with CDX device25* @class: Class of the CDX Device26* @revision: Revision of the CDX device27* @msi_dev_id: MSI device ID associated with CDX device28* @num_msi: Number of MSI's supported by the device29*/30struct cdx_dev_params {31struct cdx_controller *cdx;32struct device *parent;33u16 vendor;34u16 device;35u16 subsys_vendor;36u16 subsys_device;37u8 bus_num;38u8 dev_num;39struct resource res[MAX_CDX_DEV_RESOURCES];40u8 res_count;41u32 req_id;42u32 class;43u8 revision;44u32 msi_dev_id;45u32 num_msi;46};4748/**49* cdx_register_controller - Register a CDX controller and its ports50* on the CDX bus.51* @cdx: The CDX controller to register52*53* Return: -errno on failure, 0 on success.54*/55int cdx_register_controller(struct cdx_controller *cdx);5657/**58* cdx_unregister_controller - Unregister a CDX controller59* @cdx: The CDX controller to unregister60*/61void cdx_unregister_controller(struct cdx_controller *cdx);6263/**64* cdx_device_add - Add a CDX device. This function adds a CDX device65* on the CDX bus as per the device parameters provided66* by caller. It also creates and registers an associated67* Linux generic device.68* @dev_params: device parameters associated with the device to be created.69*70* Return: -errno on failure, 0 on success.71*/72int cdx_device_add(struct cdx_dev_params *dev_params);7374/**75* cdx_bus_add - Add a CDX bus. This function adds a bus on the CDX bus76* subsystem. It creates a CDX device for the corresponding bus and77* also registers an associated Linux generic device.78* @cdx: Associated CDX controller79* @us_num: Bus number80*81* Return: associated Linux generic device pointer on success or NULL on failure.82*/83struct device *cdx_bus_add(struct cdx_controller *cdx, u8 bus_num);8485/**86* cdx_msi_domain_init - Init the CDX bus MSI domain.87* @dev: Device of the CDX bus controller88*89* Return: CDX MSI domain, NULL on failure90*/91struct irq_domain *cdx_msi_domain_init(struct device *dev);9293#endif /* _CDX_H_ */949596