From patchwork Fri Mar 4 13:11:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lombard X-Patchwork-Id: 1601006 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=efHXyW3V; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 4K97bF5mLJz9sG9 for ; Sat, 5 Mar 2022 00:13:45 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4K97bD5KLJz30HJ for ; Sat, 5 Mar 2022 00:13:44 +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=efHXyW3V; 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.158.5; 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=efHXyW3V; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 4K97YM6XM8z30CP for ; Sat, 5 Mar 2022 00:12:07 +1100 (AEDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 224CmlVi032064 for ; Fri, 4 Mar 2022 13:12:02 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=+9egaDA5fTlmyLmccf9MiKJPkoFBDCbzDQ9FM2BmtuU=; b=efHXyW3VpMH6Yw5uEimd3TcCWEqsis09Ib3gunF44F5Iv9oEp0JosLzVL3wlJ+9/YtOZ FWYUJhdo1GVBEIyqLzt+lR06Uk01IPcizKGJQvLTXybnPpoS9lww+iZG46hyNg30oS0f E8z6rz+KPoW6jZo+RR2UQjksZWkYZERznYbQt4GBR8oAwc2MRxtfFOTPxAirznVzRf0w r8Cd6OYmkb9TMrUFjf+0iNFiiD3ux2gmHx/mLTfh9RRXlw3elHZrSSfZisAAbJwWApK5 /se96X571vmuDHylCmpZ0WbjrDyrij5SpesIbgmXAz4HcW2D4JUyX5Pqhrxoi4Kid0wg ag== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ekk3trdvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 Mar 2022 13:12:01 +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 224D7daj026300 for ; Fri, 4 Mar 2022 13:12:00 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06ams.nl.ibm.com with ESMTP id 3ek4kbssk3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 Mar 2022 13:12:00 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 224D0w5l40763720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 4 Mar 2022 13:00:58 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB48E11C054 for ; Fri, 4 Mar 2022 13:11:57 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD7A811C04A for ; Fri, 4 Mar 2022 13:11:57 +0000 (GMT) Received: from li-ed209401-43e8-11cb-8043-c0c0b85d70f7.ibm.com.com (unknown [9.171.29.80]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Fri, 4 Mar 2022 13:11:57 +0000 (GMT) From: Christophe Lombard To: skiboot@lists.ozlabs.org Date: Fri, 4 Mar 2022 14:11:39 +0100 Message-Id: <20220304131154.58409-7-clombard@linux.vnet.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220304131154.58409-1-clombard@linux.vnet.ibm.com> References: <20220304131154.58409-1-clombard@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: qmvJLn5zsLSiUL15DN0gROpi2MUJ_NiV X-Proofpoint-ORIG-GUID: qmvJLn5zsLSiUL15DN0gROpi2MUJ_NiV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-04_02,2022-03-04_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203040071 Subject: [Skiboot] [PATCH V2 06/21] core/pldm: Encode GetPLDMTypes 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" The GetPLDMTypes command can be used to discover the PLDM type capabilities supported by a PLDM terminus and to get a list of the PLDM types that are supported. Signed-off-by: Christophe Lombard Reviewed-by: Abhishek Singh Tomar --- core/pldm/pldm-responder.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/core/pldm/pldm-responder.c b/core/pldm/pldm-responder.c index 76ccaab1..2bd6fd07 100644 --- a/core/pldm/pldm-responder.c +++ b/core/pldm/pldm-responder.c @@ -125,6 +125,44 @@ static struct pldm_cmd base_get_tid = { .handler = get_tid_handler, }; +/* + * GetPLDMTypes (0x04) + * The GetPLDMTypes command can be used to discover the PLDM type + * capabilities supported by a PLDM terminus and to get a list of the + * PLDM types that are supported. + */ +static int get_types_handler(const struct pldm_rx_data *req) +{ + char resp_buf[PKT_SIZE(struct pldm_get_types_resp)]; + bitmap_elem_t type_map[BITMAP_ELEMS(32)]; + struct pldm_type *iter; + + /* + * build the supported type list from the registered type + * handlers + */ + memset(type_map, 0, sizeof(type_map)); + list_for_each(&pldm_type_list, iter, link) + bitmap_set_bit(type_map, iter->pldm_type_id); + + for (int i = 0; i < BITMAP_ELEMS(32); i++) + type_map[i] = cpu_to_le64(type_map[i]); + + memset(resp_buf, 0, sizeof(resp_buf)); + encode_get_types_resp(req->hdrinf.instance, + PLDM_SUCCESS, + (bitfield8_t *)type_map, + (void *) resp_buf); + pldm_send(resp_buf, sizeof(resp_buf)); + + return OPAL_SUCCESS; +} +static struct pldm_cmd base_get_types = { + .name = "GetPLDMTypes", + .pldm_cmd_id = PLDM_GET_PLDM_TYPES, + .handler = get_types_handler, +}; + int pldm_rx_handle_request(struct pldm_rx_data *rx) { const struct pldm_type *t; @@ -151,6 +189,7 @@ int pldm_mctp_responder_init(void) pldm_add_type(&pldm_base_type); pldm_add_cmd(&pldm_base_type, &base_get_tid); + pldm_add_cmd(&pldm_base_type, &base_get_types); return OPAL_SUCCESS; }