summaryrefslogtreecommitdiff
path: root/drivers/cdx/controller/mcdi_functions.c
diff options
context:
space:
mode:
authorNipun Gupta <nipun.gupta@amd.com>2023-03-13 18:56:36 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-29 12:26:32 +0200
commit48a6c7bced2a781c911497f073347bec5ab4d7a5 (patch)
tree953e725238c48da61dceebf4d652ea52fdb8db38 /drivers/cdx/controller/mcdi_functions.c
parent2a226927d9b836ddec674aebbcea311727d04240 (diff)
downloadlwn-48a6c7bced2a781c911497f073347bec5ab4d7a5.tar.gz
lwn-48a6c7bced2a781c911497f073347bec5ab4d7a5.zip
cdx: add device attributes
Create sysfs entry for CDX devices. Sysfs entries provided in each of the CDX device detected by the CDX controller - vendor id - device id - remove - reset of the device. - driver override Signed-off-by: Puneet Gupta <puneet.gupta@amd.com> Signed-off-by: Nipun Gupta <nipun.gupta@amd.com> Signed-off-by: Tarak Reddy <tarak.reddy@amd.com> Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com> Tested-by: Nikhil Agarwal <nikhil.agarwal@amd.com> Link: https://lore.kernel.org/r/20230313132636.31850-8-nipun.gupta@amd.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/cdx/controller/mcdi_functions.c')
-rw-r--r--drivers/cdx/controller/mcdi_functions.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/cdx/controller/mcdi_functions.c b/drivers/cdx/controller/mcdi_functions.c
index 012b52881dd5..0158f26533dd 100644
--- a/drivers/cdx/controller/mcdi_functions.c
+++ b/drivers/cdx/controller/mcdi_functions.c
@@ -123,3 +123,17 @@ int cdx_mcdi_get_dev_config(struct cdx_mcdi *cdx,
return 0;
}
+
+int cdx_mcdi_reset_device(struct cdx_mcdi *cdx, u8 bus_num, u8 dev_num)
+{
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_CDX_DEVICE_RESET_IN_LEN);
+ int ret;
+
+ MCDI_SET_DWORD(inbuf, CDX_DEVICE_RESET_IN_BUS, bus_num);
+ MCDI_SET_DWORD(inbuf, CDX_DEVICE_RESET_IN_DEVICE, dev_num);
+
+ ret = cdx_mcdi_rpc(cdx, MC_CMD_CDX_DEVICE_RESET, inbuf, sizeof(inbuf),
+ NULL, 0, NULL);
+
+ return ret;
+}