From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A472B459C3; Wed, 18 Sep 2024 08:11:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7487D42EAB; Wed, 18 Sep 2024 08:10:05 +0200 (CEST) Received: from lf-2-37.ptr.blmpb.com (lf-2-37.ptr.blmpb.com [101.36.218.37]) by mails.dpdk.org (Postfix) with ESMTP id 3E2E842E7F for ; Wed, 18 Sep 2024 08:10:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1726639798; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=z80af32ib3cmeNS/GEELfJiRIE1DVEj/iYSCIknVaYM=; b=QLnvOr8HUsE1i07/uDt7u2Jw+cdDmWoMwWut47HrcUq2pdcoZuzdMjm7U0VDQyGXs3Fmma DnlxjLS/6HNo8dJgCnmjj7OnYkxCugKrIecvp24eN30H5H+65fNISI0nD4Jm1c91mx92Lq BxHw88gnJ52KQ5ZFm/pc7P4+OPjhlj31YXxT+q2Oy3vhNc6EqQKkyv7t2+ZX3LNkKIfeLp T18Wmz3/QWuBRDS1FM8Dugi9mG7NTgX9iQ8z0BaCi4prhS97KwK1nu/sut51oG6DuY2eZs LkVNMNsEq1d5FUE6DLvZ25cgE3iDF994wVU8w7Wxgw9PeXh6HXBauJm2H51D1g== To: Mime-Version: 1.0 From: "WanRenyong" Date: Wed, 18 Sep 2024 14:09:28 +0800 X-Lms-Return-Path: Message-Id: <20240918060936.1231758-12-wanry@yunsilicon.com> X-Mailer: git-send-email 2.25.1 Content-Type: text/plain; charset=UTF-8 Cc: , "WanRenyong" Subject: [PATCH v3 11/19] net/xsc: add mailbox and structure X-Original-From: WanRenyong Content-Transfer-Encoding: 7bit Received: from ubuntu-liun.yunsilicon.com ([58.34.192.114]) by smtp.feishu.cn with ESMTPS; Wed, 18 Sep 2024 14:09:56 +0800 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Mailbox is a communication channel between driver and firmware. Signed-off-by: WanRenyong --- drivers/net/xsc/xsc_ctrl.c | 8 ++++++++ drivers/net/xsc/xsc_ctrl.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/net/xsc/xsc_ctrl.c b/drivers/net/xsc/xsc_ctrl.c index 956a8549e6..fe294a8bc7 100644 --- a/drivers/net/xsc/xsc_ctrl.c +++ b/drivers/net/xsc/xsc_ctrl.c @@ -55,3 +55,11 @@ xsc_ioctl(struct xsc_dev *dev, int cmd, int opcode, free(hdr); return ret; } + +int +xsc_mailbox_exec(struct xsc_dev *dev, void *data_in, + int in_len, void *data_out, int out_len) +{ + /* ignore opcode in hdr->attr when cmd = XSC_IOCTL_CMDQ_RAW */ + return xsc_ioctl(dev, XSC_IOCTL_CMDQ_RAW, 0, data_in, in_len, data_out, out_len); +} diff --git a/drivers/net/xsc/xsc_ctrl.h b/drivers/net/xsc/xsc_ctrl.h index 833984745b..7b4d9db9ed 100644 --- a/drivers/net/xsc/xsc_ctrl.h +++ b/drivers/net/xsc/xsc_ctrl.h @@ -40,6 +40,35 @@ struct xsc_ioctl_hdr { struct xsc_ioctl_attr attr; }; +/* ioctl */ +struct xsc_inbox_hdr { + __be16 opcode; + uint8_t rsvd[4]; + __be16 opmod; +}; + +struct xsc_outbox_hdr { + uint8_t status; + uint8_t rsvd[3]; + __be32 syndrome; +}; + +/* ioctl mbox */ +struct xsc_ioctl_mbox_in { + struct xsc_inbox_hdr hdr; + __be16 len; + __be16 rsvd; + uint8_t data[]; +}; + +struct xsc_ioctl_mbox_out { + struct xsc_outbox_hdr hdr; + __be32 error; + __be16 len; + __be16 rsvd; + uint8_t data[]; +}; + struct xsc_ioctl_data_tl { uint16_t table; uint16_t opmod; @@ -82,5 +111,7 @@ struct xsc_ioctl_get_hwinfo { int xsc_ioctl(struct xsc_dev *dev, int cmd, int opcode, void *data_in, int in_len, void *data_out, int out_len); +int xsc_mailbox_exec(struct xsc_dev *dev, void *data_in, + int in_len, void *data_out, int out_len); #endif /* _XSC_CTRL_H_ */ -- 2.25.1