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 23090A0032 for ; Fri, 17 Jun 2022 19:24:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E98040F19; Fri, 17 Jun 2022 19:24:12 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 0581840F19; Fri, 17 Jun 2022 19:24:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655486650; x=1687022650; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=LjZeHT4bbRPc+H2rsCSJO3GIkr8Dn/LqhG9C9knFqc8=; b=b9UjDDHjUHPFrKNGzFrBziqyVDRngsAe33qN2S22MMana83kIsFSGMlq CNmVgxr8DA8HvT8Sw4KpCEl0biZ8NpfDzl+v110yFm0GTEFGcfR2PXvp1 W3h9+HkS4QXdIml964kyyqRgQ5+rh4tGpUkB1egDid1qWLe2WihUufS3d 1o99P3qdFXVC2IhJlOnJK925MvOf/OIJ2yNVsHXR/Q8nw2bvRTFhtMnWR MXv4sV5zpVmOVYPli220ChCDJpxEN+pNok7U0Ksl1Wj9pewr8nuBH8QW4 V7FqbHDrqQ6GahXidn4DWicP0iaZg/gsN2YTsudhe8M6XFb2DrewldwHU w==; X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="304936367" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="304936367" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2022 07:43:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="912628864" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga005.fm.intel.com with ESMTP; 17 Jun 2022 07:43:09 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 17 Jun 2022 07:43:09 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Fri, 17 Jun 2022 07:43:09 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.172) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Fri, 17 Jun 2022 07:43:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I2wmzMxKYPCOcjxjKKni+eFpRzAOQjhbpJxFi8VdZWUVzYwlOJ+v6Hzc3XVTQvJwAtnWjFJZqMTECxVKJCgVB0PfXSNHThjYalQ5pQNpREgpKDL6BVTNZGSA2FKvXcm8N3Ura21/4uT4L45QR9EJhdZhiPn4xM1PfDQHEKYI8kDl3sRKvuddPUbUHpytJ7AVGDmtcRXGOati0LN+Zld5w+a2CfyYG3/Apjir6lc+IHY8vf18giGpgDtYbugJcfT1p1dLVvIVnHJ9+7UO1wBfOch4HzwCUcPsKUm2JWj7ibSumNC/Xb+HYFQ7QRF1SBJubD+h3g/lxRJZP8mrHWM+lQ== 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=/BWHzrXCndJPYOpb/RojcpuIloXVfSoPCWte6YBM5vg=; b=YQzvsAZ9wBAvT2BL0p3fx1c9yS+9o1yDk3r+7zhz1Id5+JDq0C7p5UeLt2qsVUyMfvFLJvs0gPuFp9o1x5wraEXhh+fhufaiUwE3mZgZnv8I/o1rhRYOYRqCG9iD8JK2jVZIFPVrfyc5aZM1C2vUouZ7IY0ZoFlPOwtmt1apMU3EzSaAGQ5HmyQ+WqDYB7gUF1YNbfZHc1PGOFl/P7R9TETC+WRKxNrQU7dMQwCezgNlaZGsFM9Vra5QJ2qZziePWlChAGRjcnzpe4C+XCedXzSH+JwmsHjtdY8psVIpWysyRv3v56DCn1Alm4CFoGbTtwFf3EQ87qfZqgJOGqpCBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4252.namprd11.prod.outlook.com (2603:10b6:5:201::26) by CY4PR11MB1269.namprd11.prod.outlook.com (2603:10b6:903:2d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Fri, 17 Jun 2022 14:43:00 +0000 Received: from DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::b9d5:600c:9f13:bc96]) by DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::b9d5:600c:9f13:bc96%7]) with mapi id 15.20.5332.023; Fri, 17 Jun 2022 14:43:00 +0000 From: "Xu, Rosen" To: "Huang, Wei" , "dev@dpdk.org" , "thomas@monjalon.net" , "nipun.gupta@nxp.com" , "hemant.agrawal@nxp.com" CC: "stable@dpdk.org" , "Zhang, Tianfei" , "Zhang, Qi Z" Subject: RE: [PATCH v3 4/4] raw/ifpga/base: add PMCI sensor driver Thread-Topic: [PATCH v3 4/4] raw/ifpga/base: add PMCI sensor driver Thread-Index: AQHYghmNa6Hk5Nn3pkeaKZIkJrEi261TrMrg Date: Fri, 17 Jun 2022 14:43:00 +0000 Message-ID: References: <1654827900-10023-1-git-send-email-wei.huang@intel.com> <1655450375-10739-1-git-send-email-wei.huang@intel.com> <1655450375-10739-5-git-send-email-wei.huang@intel.com> In-Reply-To: <1655450375-10739-5-git-send-email-wei.huang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTI4ZWM4NmQtMGE5My00ODdkLWI4MDEtZWI3NDBiYTQyNTQwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZG12dzZINlVtM3JiS01xNkFwQTcyMFlZY3ozQ3dWM2lzU09WZE84dklaNWxcL1VZNXdlZnVuY29ob3luczdKMHEifQ== x-ctpclassification: CTP_NT authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7e65cec2-1ccb-43cd-5264-08da506fad45 x-ms-traffictypediagnostic: CY4PR11MB1269:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8WuMHBmI+n1VHHG20kXrsXK0SkNWC6BFnjglMQzsolr63wNkIOxjhltr2Jg7OI187VzE8mOi7qmIDxHzTyRGUWhPSAN5qTEnJengTegC1nRqpUgeSrmo5bItgauDBE3L4bdtRMMSwjGKQKDRTTXcogHE1rbEKBwGNfTVBxVHJcMys2TcozqRVgSzra3XyQMPr7aLZwuw3Epp7QHV6Y6wND9VJAom3XlaS5W3xHOyVQM3RUtoZIaSis++FOwy+Po2N0ZzTwH/sAKli5v9wdsKYecqjPl0H46yyMFD3vtTiNEl9WPHr5vuu1jk7XARKC2dVbRsWarpCkeXDyJMJrUGS+dDXJ1Z00vxVHrX99/Ed4dWY8ER56ZkkK37uQFHfvrY2a5MwvdvoQjevwEACeNw3Ek4kFyvekxjmzGwdtA6hXYqjRaGwK8iSpvNoPrEUbxjl4MlHVr+s/5uxwcf631Bq0Pah8QhUcDRjIsKI8pChMCzpY3FpVE3JJjAJfy0ZDfQJh15iJIHpIuXK6K4yJZbt0rHyxcQfkgW9G47Ngg36K2s7y9TnEpPvAApfkkCKjFJ0hK+6hzQvOsafoX0tBBW1ffo6Z5+KSdyDOTGdNH+JNRBaBQ4rehQ6MQPQH7R9qF3E5l5SbUK07FejNV8EfLNiwOo1hcBxOjRvxWB46kPYpE2+xhosY12DcgcMY6hCZ+DgI1BYrzwVpJz/DPWfDVV7Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4252.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(2906002)(186003)(38070700005)(30864003)(86362001)(66476007)(316002)(64756008)(38100700002)(66946007)(76116006)(66446008)(54906003)(66556008)(8676002)(4326008)(110136005)(71200400001)(82960400001)(55016003)(5660300002)(33656002)(498600001)(122000001)(8936002)(52536014)(83380400001)(107886003)(9686003)(26005)(53546011)(7696005)(6506007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?S99iIdu4b2mW+eHt3a06sEUYJUfv3mShKF45bOmwFiQh2UxaG3IVlj230h+k?= =?us-ascii?Q?9DFf9jPfkh+MDV6UjDjbagOaU9HlX64lAhuqs02hPn3qBs3fhQSQiWhe4f9A?= =?us-ascii?Q?Z9Ra0FneU96fxNWoGxHJBKHXzg7wVdGiBvBhMjvBDNkkpKLyL3hg6/bNdEiy?= =?us-ascii?Q?6m3M+YR1YqZ2cWQ7blxLNrxGl/uINy+9OiB1rl04ovppNw+Yb8zNFY+uRuk+?= =?us-ascii?Q?HqIbKLpVL4yg24WFmXwD6VIG+F4NBp/E4TLjED3io7Du2WdBx8Jpb3Mcdsbc?= =?us-ascii?Q?aQuu6s34412vaoANwl4gaMy3f7N2w7DSkYs6ipPt8qbbkD2F0wbBNegup5ec?= =?us-ascii?Q?Yd8jM0VgXv2t+/se6o9hDmuGTRQHiew7TNVZBvoQCoGfgniVeyEv+PkYpkcE?= =?us-ascii?Q?P2rEdouN3374EYTJxAfeDytHTX885UMmGiqVSHGNpEmFclPDr2+dizEyYYRX?= =?us-ascii?Q?i0gX7263r95sWxuLJg+hUqOvMft97ej5IxSukGWcs/ms+eoSejG1GvwEhjr4?= =?us-ascii?Q?84MjmUmiyeZylBxkH6Z792KPpVS3q8zwHPlaPQHVBjvXk46GZ7+gRJ23pJkQ?= =?us-ascii?Q?ojaQ/qE8NzEKQA7bjbncKKJizs7PPIBrc1WCWPo1MMObGKsQKNj/bMD8N/wC?= =?us-ascii?Q?XyNq6p02YcKkVMSUhINzb9kpMn613YFJhM4ZIeChPom9C7X/aptM1V+eMxHG?= =?us-ascii?Q?XCYYSh9nW/K4vuVF3fRApV1D26RVfu9nq7fHuL3a8uQIBa6IX4XtoqxGMaG5?= =?us-ascii?Q?nGwqABncwR6546ZS+8yGfnnA80mXYRhqlLJaxACMyWYl78Bfc6/yCGuAvEej?= =?us-ascii?Q?098KUQWFwtLW1WN3jfW1OXoiEHgLWAgMX4JMvDeFmzmkq6Idcp1x2Y/Gfp67?= =?us-ascii?Q?rUG07C4OrYABRFNNo23i4RuuR3ek1MsSkM0xIDpTJNrL0ZdTTfgGGyQQUpA5?= =?us-ascii?Q?LK3yg1MiqqbQ82C6K122f9dp5JPp9vEeceRbeNg+Q/XSTM3EsKBdPwdywA5/?= =?us-ascii?Q?+h1YmSaio3LWkGk+vR4J/yzxSrbAI5TK0K8qf/42mXPwvqljMscr3+wyB4eI?= =?us-ascii?Q?z0oIW/kTbZOdKxCCRplcaOYt04gDLoO/REUdz5udWBHVQHRNwNlHlo4C+yOM?= =?us-ascii?Q?KGz3xijV+cqCP3MOz/dcUgWPKSOJJvxm+IMGZl3re7kNU6P771rOriXL+JjG?= =?us-ascii?Q?5D/g+OiO8CIGQ94XRidawy+SFMrtcR7P2uj3kBUHaRxGVPJGf6lBo2ruD36f?= =?us-ascii?Q?qDiFpCono/m83Xp7nnzN53Egfo8KzFJwBVPwKqTCx/8X4XKleG3Cd+4claqy?= =?us-ascii?Q?PWwDf7F2nTgi5E+eD3bEyKNGsFETl9+WfQosbGM3msJX6I2aSDr+qomrfqAP?= =?us-ascii?Q?vOVF8FdNUbwbW26SzXeOE9lmrKNLNHUM2sRa3Y1R5K2ynqxKTcNd0EPfuJEo?= =?us-ascii?Q?ZRLtt3jXfRZrE17PSK/ln897H5m2eUKynx5HD34lTUwtbI9VxxMWR0FuHVMs?= =?us-ascii?Q?kH3SxVTQQ/An6mPYswmGTuFR4BmPw/QidYbA/fWWWM2z9hXRTHbMap82QeDA?= =?us-ascii?Q?/fHEuCJAH0aIiHSFLCPby4JFKgOg4HY4JoDOFeNsyPlHMTmmOtqCMmsCt0bE?= =?us-ascii?Q?KLY3tTwonAnp/w9G8nosBEMNufkXmD3Erp7B/QwOmRl4+kebRsIfh7LIb4FR?= =?us-ascii?Q?NNOFZ7KvqCE83OtutFhSTS63oZB6tK0XtGCvGr8dxnt2/DmoEhymghfD/o7I?= =?us-ascii?Q?rYixKJ2VNw=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4252.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e65cec2-1ccb-43cd-5264-08da506fad45 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jun 2022 14:43:00.4627 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: EID9sBrdKuLlCaC5BsyyLpk2eU1+WI9h3V4C1zRrrlF2p3sU1jeYvChbLqqk643Up5xad2eASisjZaJyRv7QdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1269 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, > -----Original Message----- > From: Huang, Wei > Sent: Friday, June 17, 2022 15:20 > To: dev@dpdk.org; thomas@monjalon.net; nipun.gupta@nxp.com; > hemant.agrawal@nxp.com > Cc: stable@dpdk.org; Xu, Rosen ; Zhang, Tianfei > ; Zhang, Qi Z ; Huang, Wei > > Subject: [PATCH v3 4/4] raw/ifpga/base: add PMCI sensor driver >=20 > N6000 ADP platform support more sensors than N3000, they are accessed > with the help of PMCI sensor driver. >=20 > Signed-off-by: Wei Huang > --- > drivers/raw/ifpga/base/opae_hw_api.c | 29 +++ > drivers/raw/ifpga/base/opae_hw_api.h | 1 + > drivers/raw/ifpga/base/opae_intel_max10.c | 326 > ++++++++++++++++++++++++++++++ > drivers/raw/ifpga/base/opae_intel_max10.h | 35 ++++ > 4 files changed, 391 insertions(+) >=20 > diff --git a/drivers/raw/ifpga/base/opae_hw_api.c > b/drivers/raw/ifpga/base/opae_hw_api.c > index fd08326..1117c3e 100644 > --- a/drivers/raw/ifpga/base/opae_hw_api.c > +++ b/drivers/raw/ifpga/base/opae_hw_api.c > @@ -831,6 +831,35 @@ int opae_manager_get_retimer_status(struct > opae_manager *mgr, } >=20 > /** > + * opae_manager_get_sensor_list - get sensor name list > + * @mgr: opae_manager of sensors > + * @buf: buffer to accommodate name list separated by semicolon > + * @size: size of buffer > + * > + * Return: the pointer of the opae_sensor_info */ int > +opae_mgr_get_sensor_list(struct opae_manager *mgr, char *buf, size_t > +size) { > + struct opae_sensor_info *sensor; > + uint32_t offset =3D 0; > + > + opae_mgr_for_each_sensor(mgr, sensor) { > + if (sensor->name) { > + if (buf && (offset < size)) > + snprintf(buf + offset, size - offset, "%s;", > + sensor->name); > + offset +=3D strlen(sensor->name) + 1; > + } > + } > + > + if (buf && (offset > 0) && (offset <=3D size)) > + buf[offset-1] =3D 0; > + > + return offset; > +} > + > +/** > * opae_manager_get_sensor_by_id - get sensor device > * @id: the id of the sensor > * > diff --git a/drivers/raw/ifpga/base/opae_hw_api.h > b/drivers/raw/ifpga/base/opae_hw_api.h > index de1e984..613563a 100644 > --- a/drivers/raw/ifpga/base/opae_hw_api.h > +++ b/drivers/raw/ifpga/base/opae_hw_api.h > @@ -94,6 +94,7 @@ int opae_manager_flash(struct opae_manager *mgr, int > acc_id, const char *buf, > u32 size, u64 *status); > int opae_manager_get_eth_group_region_info(struct opae_manager *mgr, > u8 group_id, struct opae_eth_group_region_info *info); > +int opae_mgr_get_sensor_list(struct opae_manager *mgr, char *buf, > +size_t size); > struct opae_sensor_info *opae_mgr_get_sensor_by_name(struct > opae_manager *mgr, > const char *name); > struct opae_sensor_info *opae_mgr_get_sensor_by_id(struct > opae_manager *mgr, diff --git > a/drivers/raw/ifpga/base/opae_intel_max10.c > b/drivers/raw/ifpga/base/opae_intel_max10.c > index 9c01729..dd97a5f 100644 > --- a/drivers/raw/ifpga/base/opae_intel_max10.c > +++ b/drivers/raw/ifpga/base/opae_intel_max10.c > @@ -1102,6 +1102,328 @@ int max10_get_bmcfw_version(struct > intel_max10_device *dev, unsigned int *val) > .auth_result =3D M10BMC_PMCI_AUTH_RESULT, }; >=20 > +static const struct max10_sensor_raw_data n6000bmc_temp_tbl[] =3D { > + { 0x444, 0x448, 0x44c, 0x0, 0x0, 500, > + "FPGA E-TILE Temperature #1" }, > + { 0x450, 0x454, 0x458, 0x0, 0x0, 500, > + "FPGA E-TILE Temperature #2" }, > + { 0x45c, 0x460, 0x464, 0x0, 0x0, 500, > + "FPGA E-TILE Temperature #3" }, > + { 0x468, 0x46c, 0x470, 0x0, 0x0, 500, > + "FPGA E-TILE Temperature #4" }, > + { 0x474, 0x478, 0x47c, 0x0, 0x0, 500, > + "FPGA P-TILE Temperature" }, > + { 0x484, 0x488, 0x48c, 0x0, 0x0, 500, > + "FPGA FABRIC Digital Temperature#1" }, > + { 0x490, 0x494, 0x498, 0x0, 0x0, 500, > + "FPGA FABRIC Digital Temperature#2" }, > + { 0x49c, 0x4a0, 0x4a4, 0x0, 0x0, 500, > + "FPGA FABRIC Digital Temperature#3" }, > + { 0x4a8, 0x4ac, 0x4b0, 0x0, 0x0, 500, > + "FPGA FABRIC Digital Temperature#4" }, > + { 0x4b4, 0x4b8, 0x4bc, 0x0, 0x0, 500, > + "FPGA FABRIC Digital Temperature#5" }, > + { 0x4c0, 0x4c4, 0x4c8, 0x0, 0x0, 500, > + "FPGA FABRIC Remote Digital Temperature#1" }, > + { 0x4cc, 0x4d0, 0x4d4, 0x0, 0x0, 500, > + "FPGA FABRIC Remote Digital Temperature#2" }, > + { 0x4d8, 0x4dc, 0x4e0, 0x0, 0x0, 500, > + "FPGA FABRIC Remote Digital Temperature#3" }, > + { 0x4e4, 0x4e8, 0x4ec, 0x0, 0x0, 500, > + "FPGA FABRIC Remote Digital Temperature#4" }, > + { 0x4f0, 0x4f4, 0x4f8, 0x0, 0x0, 500, > + "Board Top Near FPGA Temperature" }, > + { 0x4fc, 0x500, 0x504, 0x52c, 0x0, 500, > + "Board Bottom Near CVL Temperature" }, > + { 0x508, 0x50c, 0x510, 0x52c, 0x0, 500, > + "Board Top East Near VRs Temperature" }, > + { 0x514, 0x518, 0x51c, 0x52c, 0x0, 500, > + "Columbiaville Die Temperature" }, > + { 0x520, 0x524, 0x528, 0x52c, 0x0, 500, > + "Board Rear Side Temperature" }, > + { 0x530, 0x534, 0x538, 0x52c, 0x0, 500, > + "Board Front Side Temperature" }, > + { 0x53c, 0x540, 0x544, 0x0, 0x0, 500, > + "QSFP1 Temperature" }, > + { 0x548, 0x54c, 0x550, 0x0, 0x0, 500, > + "QSFP2 Temperature" }, > + { 0x554, 0x0, 0x0, 0x0, 0x0, 500, > + "FPGA Core Voltage Phase 0 VR Temperature" }, > + { 0x560, 0x0, 0x0, 0x0, 0x0, 500, > + "FPGA Core Voltage Phase 1 VR Temperature" }, > + { 0x56c, 0x0, 0x0, 0x0, 0x0, 500, > + "FPGA Core Voltage Phase 2 VR Temperature" }, > + { 0x578, 0x0, 0x0, 0x0, 0x0, 500, > + "FPGA Core Voltage VR Controller Temperature" }, > + { 0x584, 0x0, 0x0, 0x0, 0x0, 500, > + "FPGA VCCH VR Temperature" }, > + { 0x590, 0x0, 0x0, 0x0, 0x0, 500, > + "FPGA VCC_1V2 VR Temperature" }, > + { 0x59c, 0x0, 0x0, 0x0, 0x0, 500, > + "FPGA VCCH, VCC_1V2 VR Controller Temperature" }, > + { 0x5a8, 0x0, 0x0, 0x0, 0x0, 500, > + "3V3 VR Temperature" }, > + { 0x5b4, 0x5b8, 0x5bc, 0x0, 0x0, 500, > + "CVL Core Voltage VR Temperature" }, > + { 0x5c4, 0x5c8, 0x5cc, 0x5c0, 0x0, 500, > + "FPGA P-Tile Temperature [Remote]" }, > + { 0x5d0, 0x5d4, 0x5d8, 0x5c0, 0x0, 500, > + "FPGA E-Tile Temperature [Remote]" }, > + { 0x5dc, 0x5e0, 0x5e4, 0x5c0, 0x0, 500, > + "FPGA SDM Temperature [Remote]" }, > + { 0x5e8, 0x5ec, 0x5f0, 0x5c0, 0x0, 500, > + "FPGA Corner Temperature [Remote]" }, }; > + > +static const struct max10_sensor_data n6000bmc_tmp_data =3D { > + .type =3D SENSOR_TMP_NAME, > + .number =3D ARRAY_SIZE(n6000bmc_temp_tbl), > + .table =3D n6000bmc_temp_tbl, > +}; > + > +static const struct max10_sensor_raw_data n6000bmc_in_tbl[] =3D { > + { 0x5f4, 0x0, 0x0, 0x0, 0x0, 1, > + "Inlet 12V PCIe Rail Voltage" }, > + { 0x60c, 0x0, 0x0, 0x0, 0x0, 1, > + "Inlet 12V Aux Rail Voltage" }, > + { 0x624, 0x0, 0x0, 0x0, 0x0, 1, > + "Inlet 3V3 PCIe Rail Voltage" }, > + { 0x63c, 0x0, 0x0, 0x0, 0x0, 1, > + "FPGA Core Voltage Rail Voltage" }, > + { 0x644, 0x0, 0x0, 0x0, 0x0, 1, > + "FPGA VCCH Rail Voltage" }, > + { 0x64c, 0x0, 0x0, 0x0, 0x0, 1, > + "FPGA VCC_1V2 Rail Voltage" }, > + { 0x654, 0x0, 0x0, 0x0, 0x0, 1, > + "FPGA VCCH_GXER_1V1, VCCA_1V8 Voltage" }, > + { 0x664, 0x0, 0x0, 0x0, 0x0, 1, > + "FPGA VCCIO_1V2 Voltage" }, > + { 0x674, 0x0, 0x0, 0x0, 0x0, 1, > + "CVL Non Core Rails Inlet Voltage" }, > + { 0x684, 0x0, 0x0, 0x0, 0x0, 1, > + "MAX10 & Board CLK PWR 3V3 Inlet Voltage" }, > + { 0x694, 0x0, 0x0, 0x0, 0x0, 1, > + "CVL Core Voltage Rail Voltage" }, > + { 0x6ac, 0x0, 0x0, 0x0, 0x0, 1, > + "Board 3V3 VR Voltage" }, > + { 0x6b4, 0x0, 0x0, 0x0, 0x0, 1, > + "QSFP 3V3 Rail Voltage" }, > + { 0x6c4, 0x0, 0x0, 0x0, 0x0, 1, > + "QSFP (Primary) Supply Rail Voltage" }, > + { 0x6c8, 0x0, 0x0, 0x0, 0x0, 1, > + "QSFP (Secondary) Supply Rail Voltage" }, > + { 0x6cc, 0x0, 0x0, 0x0, 0x0, 1, > + "VCCCLK_GXER_2V5 Voltage" }, > + { 0x6d0, 0x0, 0x0, 0x0, 0x0, 1, > + "AVDDH_1V1_CVL Voltage" }, > + { 0x6d4, 0x0, 0x0, 0x0, 0x0, 1, > + "VDDH_1V8_CVL Voltage" }, > + { 0x6d8, 0x0, 0x0, 0x0, 0x0, 1, > + "VCCA_PLL Voltage" }, > + { 0x6e0, 0x0, 0x0, 0x0, 0x0, 1, > + "VCCRT_GXER_0V9 Voltage" }, > + { 0x6e8, 0x0, 0x0, 0x0, 0x0, 1, > + "VCCRT_GXEL_0V9 Voltage" }, > + { 0x6f0, 0x0, 0x0, 0x0, 0x0, 1, > + "VCCH_GXPL_1V8 Voltage" }, > + { 0x6f4, 0x0, 0x0, 0x0, 0x0, 1, > + "VCCPT_1V8 Voltage" }, > + { 0x6fc, 0x0, 0x0, 0x0, 0x0, 1, > + "VCC_3V3_M10 Voltage" }, > + { 0x700, 0x0, 0x0, 0x0, 0x0, 1, > + "VCC_1V8_M10 Voltage" }, > + { 0x704, 0x0, 0x0, 0x0, 0x0, 1, > + "VCC_1V2_EMIF1_2_3 Voltage" }, > + { 0x70c, 0x0, 0x0, 0x0, 0x0, 1, > + "VCC_1V2_EMIF4_5 Voltage" }, > + { 0x714, 0x0, 0x0, 0x0, 0x0, 1, > + "VCCA_1V8 Voltage" }, > + { 0x718, 0x0, 0x0, 0x0, 0x0, 1, > + "VCCH_GXER_1V1 Voltage" }, > + { 0x71c, 0x0, 0x0, 0x0, 0x0, 1, > + "AVDD_ETH_0V9_CVL Voltage" }, > + { 0x720, 0x0, 0x0, 0x0, 0x0, 1, > + "AVDD_PCIE_0V9_CVL Voltage" }, > +}; > + > +static const struct max10_sensor_data n6000bmc_in_data =3D { > + .type =3D SENSOR_IN_NAME, > + .number =3D ARRAY_SIZE(n6000bmc_in_tbl), > + .table =3D n6000bmc_in_tbl, > +}; > + > +static const struct max10_sensor_raw_data n6000bmc_curr_tbl[] =3D { > + { 0x600, 0x604, 0x608, 0x0, 0x0, 1, > + "Inlet 12V PCIe Rail Current" }, > + { 0x618, 0x61c, 0x620, 0x0, 0x0, 1, > + "Inlet 12V Aux Rail Current" }, > + { 0x630, 0x634, 0x638, 0x0, 0x0, 1, > + "Inlet 3V3 PCIe Rail Current" }, > + { 0x640, 0x0, 0x0, 0x0, 0x0, 1, > + "FPGA Core Voltage Rail Current" }, > + { 0x648, 0x0, 0x0, 0x0, 0x0, 1, > + "FPGA VCCH Rail Current" }, > + { 0x650, 0x0, 0x0, 0x0, 0x0, 1, > + "FPGA VCC_1V2 Rail Current" }, > + { 0x658, 0x65c, 0x660, 0x0, 0x0, 1, > + "FPGA VCCH_GXER_1V1, VCCA_1V8 Current" }, > + { 0x668, 0x66c, 0x670, 0x0, 0x0, 1, > + "FPGA VCCIO_1V2 Current" }, > + { 0x678, 0x67c, 0x680, 0x0, 0x0, 1, > + "CVL Non Core Rails Inlet Current" }, > + { 0x688, 0x68c, 0x680, 0x0, 0x0, 1, > + "MAX10 & Board CLK PWR 3V3 Inlet Current" }, > + { 0x690, 0x0, 0x0, 0x0, 0x0, 1, > + "CVL Core Voltage Rail Current" }, > + { 0x6b0, 0x0, 0x0, 0x0, 0x0, 1, > + "Board 3V3 VR Current" }, > + { 0x6b8, 0x6bc, 0x670, 0x0, 0x0, 1, > + "QSFP 3V3 Rail Current" }, > +}; > + > +static const struct max10_sensor_data n6000bmc_curr_data =3D { > + .type =3D SENSOR_CURR_NAME, > + .number =3D ARRAY_SIZE(n6000bmc_curr_tbl), > + .table =3D n6000bmc_curr_tbl, > +}; > + > +static const struct max10_sensor_raw_data n6000bmc_power_tbl[] =3D { > + { 0x724, 0x0, 0x0, 0x0, 0x0, 1000, "Board Power" }, }; > + > +static const struct max10_sensor_data n6000bmc_power_data =3D { > + .type =3D SENSOR_POWER_NAME, > + .number =3D ARRAY_SIZE(n6000bmc_power_tbl), > + .table =3D n6000bmc_power_tbl, > +}; > + > +static const struct max10_sensor_board_data > n6000bmc_sensor_board_data =3D { > + .tables =3D { > + [sensor_temp] =3D &n6000bmc_tmp_data, > + [sensor_in] =3D &n6000bmc_in_data, > + [sensor_curr] =3D &n6000bmc_curr_data, > + [sensor_power] =3D &n6000bmc_power_data, > + }, > +}; > + > +static int get_sensor_data(struct intel_max10_device *dev, > + struct opae_sensor_info *sensor, > + unsigned int *value, > + unsigned int reg, > + unsigned int flags) > +{ > + int ret; > + unsigned int data; > + > + if (!reg) > + return 0; > + > + ret =3D max10_sys_read(dev, reg, &data); > + if (ret) > + return ret; > + > + if (data =3D=3D SENSOR_INVALID) { > + dev_debug(dev, "%s: sensor:%s invalid 0x%x at:%d\n", > + __func__, sensor->name, data, reg); > + return ret; > + } > + > + *value =3D data * sensor->multiplier; > + sensor->flags |=3D flags; > + > + return 0; > +} > + > +static int max10_parse_sensor_data(struct intel_max10_device *dev, > + const struct max10_sensor_data *sdata) { > + struct opae_sensor_info *sensor; > + const struct max10_sensor_raw_data *raw; > + const struct max10_sensor_raw_data *table =3D > + (const struct max10_sensor_raw_data *)sdata->table; > + unsigned int i; > + static unsigned int sensor_id; > + int ret =3D 0; > + > + for (i =3D 0; i < sdata->number; i++) { > + raw =3D &table[i]; > + > + sensor =3D opae_zmalloc(sizeof(*sensor)); > + if (!sensor) { > + ret =3D -EINVAL; > + goto free_sensor; > + } > + > + sensor->type =3D sdata->type; > + sensor->id =3D sensor_id++; > + > + if (!raw->reg_input) > + continue; > + > + sensor->value_reg =3D raw->reg_input; > + sensor->multiplier =3D raw->multiplier; > + sensor->name =3D raw->label; > + > + ret =3D get_sensor_data(dev, sensor, > + &sensor->high_warn, > + raw->reg_high_warn, > + OPAE_SENSOR_HIGH_WARN_VALID); > + if (ret) > + break; > + > + ret =3D get_sensor_data(dev, sensor, > + &sensor->high_fatal, > + raw->reg_high_fatal, > + OPAE_SENSOR_HIGH_FATAL_VALID); > + if (ret) > + break; > + > + ret =3D get_sensor_data(dev, sensor, > + &sensor->hysteresis, > + raw->reg_hyst, > + OPAE_SENSOR_HYSTERESIS_VALID); > + if (ret) > + break; > + > + ret =3D get_sensor_data(dev, sensor, > + &sensor->low_warn, > + raw->reg_low_warn, > + OPAE_SENSOR_LOW_WARN_VALID); > + if (ret) > + break; > + > + sensor->flags |=3D OPAE_SENSOR_VALID; > + > + TAILQ_INSERT_TAIL(&dev->opae_sensor_list, sensor, node); > + dev_info(dev, "found valid sensor: %s\n", sensor->name); > + } > + > + return ret; > + > +free_sensor: > + max10_sensor_uinit(dev); > + return ret; > +} > + > +static int max10_sensor_init_table(struct intel_max10_device *dev, > + const struct max10_sensor_board_data *data) { > + int ret =3D 0; > + unsigned int i; > + const struct max10_sensor_data *sdata; > + > + for (i =3D 0; i < ARRAY_SIZE(data->tables); i++) { > + sdata =3D data->tables[i]; > + if (!sdata) > + continue; > + ret =3D max10_parse_sensor_data(dev, sdata); > + if (ret) > + break; > + } > + > + return ret; > +} > + > int > intel_max10_device_init(struct intel_max10_device *dev) { @@ -1153,6 > +1475,10 @@ int max10_get_bmcfw_version(struct intel_max10_device > *dev, unsigned int *val) > dev->bmc_ops.flash_write =3D pmci_flash_bulk_write; > dev->bmc_ops.check_flash_range =3D > pmci_check_flash_address; >=20 > + ret =3D max10_sensor_init_table(dev, > &n6000bmc_sensor_board_data); > + if (ret) > + return ret; > + > ret =3D pthread_mutex_init(&dev->bmc_ops.lock, NULL); > if (ret) > return ret; > diff --git a/drivers/raw/ifpga/base/opae_intel_max10.h > b/drivers/raw/ifpga/base/opae_intel_max10.h > index 0f3360e..7841df1 100644 > --- a/drivers/raw/ifpga/base/opae_intel_max10.h > +++ b/drivers/raw/ifpga/base/opae_intel_max10.h > @@ -410,6 +410,41 @@ struct opae_sensor_info { > unsigned int value_reg; > }; >=20 > +#define SENSOR_INVALID 0xdeadbeef > + > +struct max10_sensor_raw_data { > + unsigned int reg_input; > + unsigned int reg_high_warn; > + unsigned int reg_high_fatal; > + unsigned int reg_hyst; > + unsigned int reg_low_warn; > + unsigned int multiplier; > + const char *label; > +}; > + > +struct max10_sensor_data { > + const char *type; > + unsigned int number; > + const struct max10_sensor_raw_data *table; }; > + > +enum max10_sensor_types { > + sensor_temp, > + sensor_in, > + sensor_curr, > + sensor_power, > + sensor_max, > +}; > + > +#define SENSOR_TMP_NAME "Temperature" > +#define SENSOR_IN_NAME "Voltage" > +#define SENSOR_CURR_NAME "Current" > +#define SENSOR_POWER_NAME "Power" > + > +struct max10_sensor_board_data { > + const struct max10_sensor_data *tables[sensor_max]; }; > + > /* indirect access for PMCI */ > #define PMCI_INDIRECT_BASE 0x400 > #define INDIRECT_CMD_OFF (PMCI_INDIRECT_BASE + 0x0) > -- > 1.8.3.1 Reviewed-by: Rosen Xu