From patchwork Fri Mar 18 14:36:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lombard X-Patchwork-Id: 1607070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=Qjf25/wg; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KKmmq2Xt3z9s3q for ; Sat, 19 Mar 2022 01:36:59 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KKmmq1kBBz3bPR for ; Sat, 19 Mar 2022 01:36:59 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=Qjf25/wg; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=clombard@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=Qjf25/wg; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KKmmD2lyKz30FC for ; Sat, 19 Mar 2022 01:36:28 +1100 (AEDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22ICnwde040564 for ; Fri, 18 Mar 2022 14:36:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=QdEgG/mrKBbUWUxm9LRFumb1rn9uTKQVVjH9aUeer1M=; b=Qjf25/wgu3iKyiA7xQVrs1+zTpMTg0ehHDKRI3UKd0Xa/DZSLqu5VkwQjM3M0UMcjYSy d7vDK5cvV1MsiDK8jKnccMl1HDHsx99C7gg+sndeH8FNyqKJqijI44rcgy6+Akqgpvpl xlxqf4jICbFL0glwSFZqv/oigdFsErOAPvWkeYiF/W2VsguTXM4pMMBTOalsUU/SxW1K QCrA0vEKq3H9FSZXklWC+mvIn2TfMyIH+smb3qFPck3uhk2ZJu16IiM2mvm6USipVM+V u1hW6kgsloKqV88W/wpFH5yQ0ly43RDyDHdVMR71hwERfunc4/v1UPOCQMqsFxXLylV1 yA== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ev10jr01m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 Mar 2022 14:36:25 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22IEJ4xq005144 for ; Fri, 18 Mar 2022 14:36:23 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma06ams.nl.ibm.com with ESMTP id 3euc6r58hr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 Mar 2022 14:36:23 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22IEaLMk50332032 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 18 Mar 2022 14:36:21 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C1BA11C052 for ; Fri, 18 Mar 2022 14:36:21 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D2D511C04A for ; Fri, 18 Mar 2022 14:36:21 +0000 (GMT) Received: from li-ed209401-43e8-11cb-8043-c0c0b85d70f7.ibm.com.com (unknown [9.171.63.232]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Fri, 18 Mar 2022 14:36:20 +0000 (GMT) From: Christophe Lombard To: skiboot@lists.ozlabs.org Date: Fri, 18 Mar 2022 15:36:03 +0100 Message-Id: <20220318143619.83489-6-clombard@linux.vnet.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220318143619.83489-1-clombard@linux.vnet.ibm.com> References: <20220318143619.83489-1-clombard@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 0f16lrOE2DMe74nnRoSd9axdqkfzVh2P X-Proofpoint-GUID: 0f16lrOE2DMe74nnRoSd9axdqkfzVh2P X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-18_10,2022-03-15_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 clxscore=1015 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=877 malwarescore=0 adultscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203180080 Subject: [Skiboot] [PATCH V3 05/21] core/pldm: Encode GetTID response X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" A PLDM Terminus is defined as the point of communication termination for PLDM messages and the PLDM functions associated with those messages. Given a PLDM terminus, a mechanism is required that can uniquely identify each terminus so that the semantic information can be bound to that identification. The Terminus ID (TID) is a value that identifies a PLDM terminus. TIDs are used in PLDM messages when it is necessary to identify the PLDM terminus that is the source of the PLDM Message. The GetTID command is used to retrieve the present Terminus ID (TID) setting for a PLDM Terminus. Reviewed-by: Abhishek Singh Tomar Signed-off-by: Christophe Lombard --- core/pldm/pldm-responder.c | 39 ++++++++++++++++++++++++++++++++++++++ core/pldm/pldm.h | 1 + 2 files changed, 40 insertions(+) diff --git a/core/pldm/pldm-responder.c b/core/pldm/pldm-responder.c index c1aad7c9..834b8ebf 100644 --- a/core/pldm/pldm-responder.c +++ b/core/pldm/pldm-responder.c @@ -78,6 +78,17 @@ static void pldm_add_type(struct pldm_type *new_type) new_type->name, new_type->pldm_type_id); } +static void pldm_add_cmd(struct pldm_type *type, struct pldm_cmd *new_cmd) +{ + assert(new_cmd->pldm_cmd_id < 256); /* limited by GetPLDMCommands */ + assert(new_cmd->handler); + assert(!find_cmd(type, new_cmd->pldm_cmd_id)); + + list_add_tail(&type->commands, &new_cmd->link); + prlog(PR_DEBUG, "Registered command %s (%d) under %s\n", + new_cmd->name, new_cmd->pldm_cmd_id, type->name); +} + /* * PLDM Base commands support */ @@ -88,6 +99,32 @@ static struct pldm_type pldm_base_type = { .version = { 0xF1, 0xF0, 0xF0, 0x00 }, }; +/* + * GetTID command (0x02) + * The GetTID command is used to retrieve the present Terminus ID (TID) + * setting for a PLDM Terminus. + */ +static int get_tid_handler(const struct pldm_rx_data *req) +{ + char resp_buf[PKT_SIZE(struct pldm_get_tid_resp)]; + + memset(resp_buf, 0, sizeof(resp_buf)); + + encode_get_tid_resp(req->hdrinf.instance, + PLDM_SUCCESS, + HOST_TID, + (void *) resp_buf); + + pldm_send(req->source_eid, resp_buf, sizeof(resp_buf)); + + return OPAL_SUCCESS; +} +static struct pldm_cmd base_get_tid = { + .name = "GetTid", + .pldm_cmd_id = PLDM_GET_TID, + .handler = get_tid_handler, +}; + int pldm_rx_handle_request(struct pldm_rx_data *rx) { const struct pldm_type *t; @@ -113,5 +150,7 @@ int pldm_mctp_responder_init(void) /* Register mandatory commands we'll respond to - DSP0240 */ pldm_add_type(&pldm_base_type); + pldm_add_cmd(&pldm_base_type, &base_get_tid); + return OPAL_SUCCESS; } diff --git a/core/pldm/pldm.h b/core/pldm/pldm.h index 52469a0f..21b03463 100644 --- a/core/pldm/pldm.h +++ b/core/pldm/pldm.h @@ -17,6 +17,7 @@ void printbuf(const char *name, const char *msg, int len); * BMC EID default = 8. */ # define BMC_EID 8 +# define HOST_TID 9 #define PKT_SIZE(x) (sizeof(struct pldm_msg_hdr) + sizeof(x))