From patchwork Thu Aug 10 08:44:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Nipun" X-Patchwork-Id: 133778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp286214vqi; Thu, 10 Aug 2023 02:10:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqwdVbHRsbhlDo+qyj8OmyXPZRYVI+q5ib3TNTy6Qj7Oyv3Owrmkq7s1Qj2qM8R/UXqlTv X-Received: by 2002:a05:6358:5916:b0:139:d6cf:c430 with SMTP id g22-20020a056358591600b00139d6cfc430mr2218790rwf.6.1691658647868; Thu, 10 Aug 2023 02:10:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691658647; cv=pass; d=google.com; s=arc-20160816; b=Y6ysqeWHJzc8TxQPS7J677zAULOhC/a9meWQcffoAH4uP3faTSpMxMc4oOot1yHM/t PDg6QpFNe7JZWBCSPEcbrYEFxz8tTrRU9buWsMBEkFGcr2k+S6nvGjRE2AKib1csx+nY nY9scsc6FOa+ZWOqy07IAd/NsSfE8OvyNLO1jjslt6dq+wP1OIjQn86lRClHjrMPQ+1k yUlTID4Qc6RZPHN89vnPoD9EWAqwqFOCXTiK15nDzuRtjDm15UeYRa9vH7u6erXVr3oD 2EQrtJ1Lm1YZYrOsnrVNBNdXvLspA6n/L3QhhG3DuXX4eIORL5RqBYjLaBXuZ7WPqXyD FE3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=E0ITBgDcsUS7C9+Fo7odr0gcHBZsJ4138cB+awwnaX4=; fh=Ni1nsrg1oOMllulTte61KVXg/7l8962UlCxeEssxYck=; b=V76TN90pKVUCpdlV8O66jOgLZcAaqLUguswD/2uBsH9TiC620+wGxAfI+nUEvZqjIW meFtZsT6o6fTSwpQFIzkGZZoGSBqoJoyzwJOD4zQxtzlX9vpmSiWQyOrCk6vrqPkul7U Gd+3M9IhqamtdyW28an/XTH5HaRd0JkvHB+nVCoLk5aKdOQOr0/iu1/AhCtUpc2Fb9Iv FRE8zXnd3/2vNXjKE6QN+m268FsGzAl/8B6xMoOFJd0JZuaZYjYPdlt4wSlrl6nF56LO tZ22d8QJzs9QEirJEEz1XMWlhVPHedk44C0ejUSDoWqXsWjlXJd2QDze6y+UE+0CXbXV lhyg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zTM0DLwp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t186-20020a6381c3000000b0055beccf9921si1160256pgd.212.2023.08.10.02.10.34; Thu, 10 Aug 2023 02:10:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zTM0DLwp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234291AbjHJIo0 (ORCPT + 99 others); Thu, 10 Aug 2023 04:44:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234206AbjHJIoZ (ORCPT ); Thu, 10 Aug 2023 04:44:25 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2044.outbound.protection.outlook.com [40.107.220.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7572E1BFA for ; Thu, 10 Aug 2023 01:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O3t9IDiLLjbBpBYgySpX0PmXlLjolLGUtuiotK4VcVKIQksiz79HHwvT9DKxzaHoPPkhrTsgHixnd7mF9PxQH05Oz6t1E22WRslplVUxP7b8/vD3a5kfNsOyZjUrxbcI3TPtQEN9MhLU1e/gEWW4biJoMM/CTt3O+5rwBlFuNvpmgBDME4wR+E66zjc0UIvOWoCpL54G6mewIAC8oeUjN/y3/za+vQrEVnvvxAeRf3euBhpcBNXcSuMTsBVphJL648dcXRe4KCW2FxS/xeOBsBUWOgdbdkL9fS2xbPEu7QBGLxzAMqPofwN2O7DN9VgPEUqWub5K3tSYUdjG52FBqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E0ITBgDcsUS7C9+Fo7odr0gcHBZsJ4138cB+awwnaX4=; b=MTJnNdiYBIKz7yhX7rwTgkpNWUe8iZd188YgENek0KK1HzB+pr8kNJzuPQlHsxc0/6AaHt6WrHvzRmPwVLvJMrnbTRAP85xaXJuLSruqO8vOjG/cNePYfXSbLE/gAAEu9b/N7eCwNWtwZfy0El9CtxW0B36eHxvszNyyLwQJupa41DduK6n5YTW3Ce7nd3QXd5Z+Fz7n9hGFx/iFeWk+lLL4iQvTOHT3WIV3k0Hu69ekRvF00yGqP5yII72rrhU2cVl66lQr5ThSx6U0qFfhZrHAaIthaVXfCDpHCcnZThjS1wUZUECCga3c5asctJz0BQaYM315q9R5qCjMhg+h7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E0ITBgDcsUS7C9+Fo7odr0gcHBZsJ4138cB+awwnaX4=; b=zTM0DLwpr+j7Jj2CgwIR9BB5Qjp41O5xo44LCWN9MDaAlwei0Yv8TlEGZF5OatIJf1c9PEal65owSpsGw1BmRZP5yV9vvZ6ZzIMiCtneWsFzfzHZoMlwncrOF4UMHNWxHH9IO7BP43DM0HpuQOrLezNxCXGMOznBrCvT13sI51I= Received: from DS7PR03CA0127.namprd03.prod.outlook.com (2603:10b6:5:3b4::12) by MW6PR12MB8734.namprd12.prod.outlook.com (2603:10b6:303:249::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Thu, 10 Aug 2023 08:44:21 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:5:3b4:cafe::4e) by DS7PR03CA0127.outlook.office365.com (2603:10b6:5:3b4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30 via Frontend Transport; Thu, 10 Aug 2023 08:44:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000EE33.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Thu, 10 Aug 2023 08:44:20 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 10 Aug 2023 03:44:19 -0500 Received: from xhdipdslab41.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Thu, 10 Aug 2023 03:44:17 -0500 From: Nipun Gupta To: , , CC: , , , , , Nipun Gupta Subject: [PATCH v6 1/3] cdx: add support for bus mastering Date: Thu, 10 Aug 2023 14:14:07 +0530 Message-ID: <20230810084409.4922-1-nipun.gupta@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE33:EE_|MW6PR12MB8734:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ac0bfd2-e0ca-4bc2-aaa8-08db997dfdae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 14ci+eXjvU7xhCD6vSmdZD6etQwmMQC5OyQVxBzsS7qVD52JxCXXIJeYj6YE7uyAe4bXPSmpcFknwvuc+x+t/DD7SzIQ3hskcw4pxMpccDV5K4uWNg6whkjE0yps50Xy4sB7Yb9wMd4XpNSbs+ngNXKg4uLrOqsG+fvNHmwsXDvmFPxWGygliUqqyAuCbb2L1m0rqRDpYqp9CeC7RizxLe4+Ua3p5AqYfjdF6HyBhRSwTd7DuBh9Ia6t8bRFWvW7GgQk+fH0wk9UUjEqK01Yrnfe56YZ+ndNmakKrzD4tSlLd/Dpn3gwaa1RidnOFIM1SFHjuZDkf/h0syPzaFi52Elg4fHSI8sTyrZ8H26h3Zg915hOyaCUAjDkUBdgWYicAFX7thR5U615iwsJHiewr4+ewRxAj2m0LX96FIQ96u/B6SkTbTbE3Wd71tRbLNgC1Og7ILG4Hu6kDzkfDcuq8ljlH6SSfldwlWGvknBewweYam8HJEawDu5y8MwdEkmAR3XhDOmMZx0sb5r96phb5CJtpzRaDsrazjTqEL0SymDIJX7IE1ognsEQ3KVoee2bGrLlFwbObbM95ajlTMqO3a4+5U+1ausfoNSQiYggosnn1m1rlGX0yCz/NrMj7MIik1XKezi/yJCo3UzUq3HSeojSQFN87M5+RCJvEcigJYU0+6mtPWl8SiLItU6s9B6rekNl2zIDzCOFQC8YZKeHjIDBp+ke1bRHEd9n6YapMSA1e4w10OYawqP89REXSyBDg5fLlb2kRfy0pn2YMaKEgA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(376002)(82310400008)(1800799006)(186006)(451199021)(46966006)(40470700004)(36840700001)(110136005)(54906003)(356005)(44832011)(478600001)(8676002)(8936002)(40460700003)(5660300002)(82740400003)(1076003)(336012)(26005)(81166007)(40480700001)(6666004)(86362001)(2906002)(70206006)(70586007)(36756003)(36860700001)(83380400001)(47076005)(2616005)(426003)(316002)(4326008)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2023 08:44:20.7852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ac0bfd2-e0ca-4bc2-aaa8-08db997dfdae X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE33.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8734 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773832658033295256 X-GMAIL-MSGID: 1773832658033295256 Introduce cdx_set_master() and cdx_clear_master() APIs to support enable and disable of bus mastering. Drivers need to use these APIs to enable/disable DMAs from the CDX devices. Signed-off-by: Nipun Gupta Reviewed-by: Pieter Jansen van Vuuren --- Changes v5->v6: - change cdx_clear_master() to int return type Changes v4->v5: - No change in this patch, patch 2/3 and patch 3/3 are updated Changes v3->v4: - Added user of the Bus master enable and disable APIs in patch 2/2. There is no change in this patch. Changes v2->v3: - Changed return value from EOPNOTSUPP to -EOPNOTSUPP in cdx_set_master() Changes v1->v2: - Replace bme with bus_master_enable - Added check for dev_configure API callback - remove un-necessary error prints - changed conditional to if-else - updated commit message to use 72 columns drivers/cdx/cdx.c | 31 +++++++++++++ drivers/cdx/controller/cdx_controller.c | 4 ++ drivers/cdx/controller/mcdi_functions.c | 58 +++++++++++++++++++++++++ drivers/cdx/controller/mcdi_functions.h | 13 ++++++ include/linux/cdx/cdx_bus.h | 18 ++++++++ 5 files changed, 124 insertions(+) diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c index d2cad4c670a0..363951b50034 100644 --- a/drivers/cdx/cdx.c +++ b/drivers/cdx/cdx.c @@ -182,6 +182,37 @@ cdx_match_id(const struct cdx_device_id *ids, struct cdx_device *dev) return NULL; } +int cdx_set_master(struct cdx_device *cdx_dev) +{ + struct cdx_controller *cdx = cdx_dev->cdx; + struct cdx_device_config dev_config; + int ret = -EOPNOTSUPP; + + dev_config.type = CDX_DEV_BUS_MASTER_CONF; + dev_config.bus_master_enable = true; + if (cdx->ops->dev_configure) + ret = cdx->ops->dev_configure(cdx, cdx_dev->bus_num, + cdx_dev->dev_num, &dev_config); + + return ret; +} +EXPORT_SYMBOL_GPL(cdx_set_master); + +int cdx_clear_master(struct cdx_device *cdx_dev) +{ + struct cdx_controller *cdx = cdx_dev->cdx; + struct cdx_device_config dev_config; + int ret = -EOPNOTSUPP; + + dev_config.type = CDX_DEV_BUS_MASTER_CONF; + dev_config.bus_master_enable = false; + if (cdx->ops->dev_configure) + ret = cdx->ops->dev_configure(cdx, cdx_dev->bus_num, + cdx_dev->dev_num, &dev_config); + return ret; +} +EXPORT_SYMBOL_GPL(cdx_clear_master); + /** * cdx_bus_match - device to driver matching callback * @dev: the cdx device to match against diff --git a/drivers/cdx/controller/cdx_controller.c b/drivers/cdx/controller/cdx_controller.c index dc52f95f8978..39aa569d8e07 100644 --- a/drivers/cdx/controller/cdx_controller.c +++ b/drivers/cdx/controller/cdx_controller.c @@ -55,6 +55,10 @@ static int cdx_configure_device(struct cdx_controller *cdx, case CDX_DEV_RESET_CONF: ret = cdx_mcdi_reset_device(cdx->priv, bus_num, dev_num); break; + case CDX_DEV_BUS_MASTER_CONF: + ret = cdx_mcdi_bus_master_enable(cdx->priv, bus_num, dev_num, + dev_config->bus_master_enable); + break; default: ret = -EINVAL; } diff --git a/drivers/cdx/controller/mcdi_functions.c b/drivers/cdx/controller/mcdi_functions.c index 0158f26533dd..6acd8fea4586 100644 --- a/drivers/cdx/controller/mcdi_functions.c +++ b/drivers/cdx/controller/mcdi_functions.c @@ -137,3 +137,61 @@ int cdx_mcdi_reset_device(struct cdx_mcdi *cdx, u8 bus_num, u8 dev_num) return ret; } + +static int cdx_mcdi_ctrl_flag_get(struct cdx_mcdi *cdx, u8 bus_num, + u8 dev_num, u32 *flags) +{ + MCDI_DECLARE_BUF(inbuf, MC_CMD_CDX_DEVICE_CONTROL_GET_IN_LEN); + MCDI_DECLARE_BUF(outbuf, MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_LEN); + size_t outlen; + int ret; + + MCDI_SET_DWORD(inbuf, CDX_DEVICE_CONTROL_GET_IN_BUS, bus_num); + MCDI_SET_DWORD(inbuf, CDX_DEVICE_CONTROL_GET_IN_DEVICE, dev_num); + ret = cdx_mcdi_rpc(cdx, MC_CMD_CDX_DEVICE_CONTROL_GET, inbuf, + sizeof(inbuf), outbuf, sizeof(outbuf), &outlen); + if (ret) + return ret; + + if (outlen != MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_LEN) + return -EIO; + + *flags = MCDI_DWORD(outbuf, CDX_DEVICE_CONTROL_GET_OUT_FLAGS); + + return 0; +} + +static int cdx_mcdi_ctrl_flag_set(struct cdx_mcdi *cdx, u8 bus_num, + u8 dev_num, bool enable, int lbn) +{ + MCDI_DECLARE_BUF(inbuf, MC_CMD_CDX_DEVICE_CONTROL_SET_IN_LEN); + u32 flags; + int ret; + + /* + * Get flags and then set/reset BUS_MASTER_BIT according to + * the input params. + */ + ret = cdx_mcdi_ctrl_flag_get(cdx, bus_num, dev_num, &flags); + if (ret) + return ret; + + flags = flags & (u32)(~(BIT(lbn))); + if (enable) + flags |= (1 << lbn); + + MCDI_SET_DWORD(inbuf, CDX_DEVICE_CONTROL_SET_IN_BUS, bus_num); + MCDI_SET_DWORD(inbuf, CDX_DEVICE_CONTROL_SET_IN_DEVICE, dev_num); + MCDI_SET_DWORD(inbuf, CDX_DEVICE_CONTROL_SET_IN_FLAGS, flags); + ret = cdx_mcdi_rpc(cdx, MC_CMD_CDX_DEVICE_CONTROL_SET, inbuf, + sizeof(inbuf), NULL, 0, NULL); + + return ret; +} + +int cdx_mcdi_bus_master_enable(struct cdx_mcdi *cdx, u8 bus_num, + u8 dev_num, bool enable) +{ + return cdx_mcdi_ctrl_flag_set(cdx, bus_num, dev_num, enable, + MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_MASTER_ENABLE_LBN); +} diff --git a/drivers/cdx/controller/mcdi_functions.h b/drivers/cdx/controller/mcdi_functions.h index 7440ace5539a..a448d6581eb4 100644 --- a/drivers/cdx/controller/mcdi_functions.h +++ b/drivers/cdx/controller/mcdi_functions.h @@ -58,4 +58,17 @@ int cdx_mcdi_get_dev_config(struct cdx_mcdi *cdx, int cdx_mcdi_reset_device(struct cdx_mcdi *cdx, u8 bus_num, u8 dev_num); +/** + * cdx_mcdi_bus_master_enable - Set/Reset bus mastering for cdx device + * represented by bus_num:dev_num + * @cdx: pointer to MCDI interface. + * @bus_num: Bus number. + * @dev_num: Device number. + * @enable: Enable bus mastering if set, disable otherwise. + * + * Return: 0 on success, <0 on failure + */ +int cdx_mcdi_bus_master_enable(struct cdx_mcdi *cdx, u8 bus_num, + u8 dev_num, bool enable); + #endif /* CDX_MCDI_FUNCTIONS_H */ diff --git a/include/linux/cdx/cdx_bus.h b/include/linux/cdx/cdx_bus.h index bead71b7bc73..8320ec3b9e37 100644 --- a/include/linux/cdx/cdx_bus.h +++ b/include/linux/cdx/cdx_bus.h @@ -21,11 +21,13 @@ struct cdx_controller; enum { + CDX_DEV_BUS_MASTER_CONF, CDX_DEV_RESET_CONF, }; struct cdx_device_config { u8 type; + bool bus_master_enable; }; typedef int (*cdx_scan_cb)(struct cdx_controller *cdx); @@ -170,4 +172,20 @@ extern struct bus_type cdx_bus_type; */ int cdx_dev_reset(struct device *dev); +/** + * cdx_set_master - enables bus-mastering for CDX device + * @cdx_dev: the CDX device to enable + * + * Return: 0 for success, -errno on failure + */ +int cdx_set_master(struct cdx_device *cdx_dev); + +/** + * cdx_clear_master - disables bus-mastering for CDX device + * @cdx_dev: the CDX device to disable + * + * Return: 0 for success, -errno on failure + */ +int cdx_clear_master(struct cdx_device *cdx_dev); + #endif /* _CDX_BUS_H_ */