brintos

brintos / linux-shallow public Read only

0
0
Text · 2.6 KiB · 9c60c04 Raw
95 lines · c
1/* SPDX-License-Identifier: GPL-2.02 *3 * Header file for the CDX Bus4 *5 * Copyright (C) 2022-2023, Advanced Micro Devices, Inc.6 */7 8#ifndef _CDX_H_9#define _CDX_H_10 11#include <linux/cdx/cdx_bus.h>12 13/**14 * struct cdx_dev_params - CDX device parameters15 * @cdx: CDX controller associated with the device16 * @parent: Associated CDX Bus device17 * @vendor: Vendor ID for CDX device18 * @device: Device ID for CDX device19 * @subsys_vendor: Sub vendor ID for CDX device20 * @subsys_device: Sub device ID for CDX device21 * @bus_num: Bus number for this CDX device22 * @dev_num: Device number for this device23 * @res: array of MMIO region entries24 * @res_count: number of valid MMIO regions25 * @req_id: Requestor ID associated with CDX device26 * @class: Class of the CDX Device27 * @revision: Revision of the CDX device28 * @msi_dev_id: MSI device ID associated with CDX device29 * @num_msi: Number of MSI's supported by the device30 */31struct cdx_dev_params {32	struct cdx_controller *cdx;33	struct device *parent;34	u16 vendor;35	u16 device;36	u16 subsys_vendor;37	u16 subsys_device;38	u8 bus_num;39	u8 dev_num;40	struct resource res[MAX_CDX_DEV_RESOURCES];41	u8 res_count;42	u32 req_id;43	u32 class;44	u8 revision;45	u32 msi_dev_id;46	u32 num_msi;47};48 49/**50 * cdx_register_controller - Register a CDX controller and its ports51 *		on the CDX bus.52 * @cdx: The CDX controller to register53 *54 * Return: -errno on failure, 0 on success.55 */56int cdx_register_controller(struct cdx_controller *cdx);57 58/**59 * cdx_unregister_controller - Unregister a CDX controller60 * @cdx: The CDX controller to unregister61 */62void cdx_unregister_controller(struct cdx_controller *cdx);63 64/**65 * cdx_device_add - Add a CDX device. This function adds a CDX device66 *		on the CDX bus as per the device parameters provided67 *		by caller. It also creates and registers an associated68 *		Linux generic device.69 * @dev_params: device parameters associated with the device to be created.70 *71 * Return: -errno on failure, 0 on success.72 */73int cdx_device_add(struct cdx_dev_params *dev_params);74 75/**76 * cdx_bus_add - Add a CDX bus. This function adds a bus on the CDX bus77 *		subsystem. It creates a CDX device for the corresponding bus and78 *		also registers an associated Linux generic device.79 * @cdx: Associated CDX controller80 * @us_num: Bus number81 *82 * Return: associated Linux generic device pointer on success or NULL on failure.83 */84struct device *cdx_bus_add(struct cdx_controller *cdx, u8 bus_num);85 86/**87 * cdx_msi_domain_init - Init the CDX bus MSI domain.88 * @dev: Device of the CDX bus controller89 *90 * Return: CDX MSI domain, NULL on failure91 */92struct irq_domain *cdx_msi_domain_init(struct device *dev);93 94#endif /* _CDX_H_ */95