From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.45299.1660845271793102498 for ; Thu, 18 Aug 2022 10:54:32 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=jhJwMv9t; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: isaac.w.oram@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660845271; x=1692381271; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=EUr/Dym3ynVoHTX9om4DTqtoCbWzNO7nN1WFCluX9Gw=; b=jhJwMv9tQWhMg8QEZeiZUJ0kmr3n/XOS8FiisZsOG9eByxtwV3VxihkV Jj+bG7ZO6UkII+CXWcqsLt4uS0LfakNFQHi2+NekeSAGwoBNV3uvwgPHO Vl7Ak70QCiqJTV84Xv67hDSIXxmSu+gxtzd9gVQnjlq67QLMQaeNguEQm rJRz/+dCxhEhKQvSdY/Wt9iHCK36BZiEe0ynaMKV8eQ2iAUvMMcMm0xOn HZx7IdhU7ITxH38pJZajsTxwptH0YFCoeN6jg4UUbrKYPWftNsxtDF/Ki +xVdK3y1dNfY+uF/RCFc3hZx9pivWKIsy7h7Zd85qxS5WTT0CeCW0STPg A==; X-IronPort-AV: E=McAfee;i="6500,9779,10443"; a="290395156" X-IronPort-AV: E=Sophos;i="5.93,247,1654585200"; d="scan'208,217";a="290395156" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 10:54:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,247,1654585200"; d="scan'208,217";a="734137652" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga004.jf.intel.com with ESMTP; 18 Aug 2022 10:54:23 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 18 Aug 2022 10:54:23 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 18 Aug 2022 10:54:22 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Thu, 18 Aug 2022 10:54:22 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.45) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Thu, 18 Aug 2022 10:54:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KJ2WlMofIFQVnmYj1h8D+aSn8h3wgO758DC2C5aqk/EtdWEgVagkyK3N1UN58q91ZZyScbU4RdyLqEqvAEq4rVtUknkW/mNVFygUpf0swMWlcdsBpNRaSJWTVOvi5BRa6IUkb6FZ160CMZUfZzTIAEt7lESWfTK8Dbjav9qiIYGJCTwPxTVmgePMzHs4MS3xn8i/v2KYNkRDj0kS2xCbiFNUs9Ulci3tJBXzZtwY2VV4pfPUkD8BHkuTIFLOjMVLHCKwg5ecCCaKPKRXo5pg/EEiId46+UbJgk2dWo6Q5f4C970WpHEi/Kq/8ZDfqTCXvgse7WamsaK/uUgHJRvCkQ== 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=2wDcBJOjFBagfCJhiBv+U2DA5sXVNRN5qlGCd29wxsE=; b=St5Dzb5fg2jkaD7sc4fqlV3njcnaCAhZJoz4t/u01l/mcn9pTYkSN+R81GIQ5jb46bFnHCykbaSJTuu3uz4KcfS7CVneWke7JoqdNPgVyNC54xOMBA7QzAfxNslwOgPx/bi6wdrCdUNEgwSzrOsXz02nq17bo0qvNMQpQYecBru0fLQS/+BJSq8lMS+beUfrM15+n/hor5D9HTaT3HS2iy+YCz0DJymkmd+Rs6K7XZHnUVThWDBaiXyzI/r+Jvu/pyfDzKWsM3/xXOCejS+/upCOMw+BjzsQtztjGi9JMZrhIPkDvSuqGfqeyiaMxXtC3y1fnC5ay0DtVhKzxCofEg== 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 SA1PR11MB5801.namprd11.prod.outlook.com (2603:10b6:806:23d::13) by MN2PR11MB4429.namprd11.prod.outlook.com (2603:10b6:208:18b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Thu, 18 Aug 2022 17:54:15 +0000 Received: from SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::2cdd:30d3:f7f5:97a1]) by SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::2cdd:30d3:f7f5:97a1%5]) with mapi id 15.20.5504.027; Thu, 18 Aug 2022 17:54:15 +0000 From: "Oram, Isaac W" To: =?iso-2022-jp?B?Q3J5c3RhbExlZSBbGyRCTXtXXjN+GyhCXQ==?= , "Desimone, Nathaniel L" , "Zeng, Star" , "Gao, Zhichao" , "maciej.rabeda@linux.intel.com" , "siyuan.fu@intel.com" , "Wu, Jiaxin" , "Liu, Zhiguang" , "Bi, Dandan" , "Gao, Liming" , "devel@edk2.groups.io" , "Ni, Ray" , "Sinha, Ankit" , "Chaganty, Rangasai V" CC: =?iso-2022-jp?B?RGF2aWRIc2llaCBbGyRCPFU6JUNSGyhCXQ==?= Subject: Re: [PATCH 1/1] AsfPkg: Add Alert standard format support Thread-Topic: [PATCH 1/1] AsfPkg: Add Alert standard format support Thread-Index: AQHYoMzzoq07xttTKkectnYzEuNBbq2vTDYAgALhnlA= Date: Thu, 18 Aug 2022 17:54:15 +0000 Message-ID: References: <37a42ca68b9dfc69f499a447128f1f4cd334d248.1658822180.git.CrystalLee@ami.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action 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: b5bdb259-2dd6-473a-4761-08da8142aa56 x-ms-traffictypediagnostic: MN2PR11MB4429:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 84soeeLxE+qN/NZV1CbpV1UxwiygPSypfvPnjnQK3hjsGTIUBhTI3GJp/R2HRqkH7fYchALLYrmZfeB/05jUFIwIj+F7IsaSD8CwphHGjNwnWd7ul8Mp2dNhYCINOPAd1TfwJNBWtOo9Aw53fV+wYV195rK8+Sj/4C2q2vULuD3cKYcAHj/gDLqCfy71WUwQiHGHRJTp7iGng1CoGW9puts8kH4PP1nYxTBl3pBsQ1fSxgBnH5JSwV7gVABRLhrRjKdQpFsdTGyHbMtJB9z9aUuZtYBjXDwLD5yPYSQCfpRFE0C/Y4AB9bNduuD4NtePynbE9XYsMv8+qV/Oa6pH+0q48i8fS5Kl6BIa1etSiSU30rswZSxb23+vVfbi0c+4lJSNg1xU8yLFYGkxOlPWOvrc4QlTh2TM/V0ISnSATs1MweGtHaJNvbSwcwlFew4/doi+iPmypMEEuEvkjXVUzv2qyW0Chq+kCzYs1OGFLhV2IRgrbei8f2C5BAjd0MPUGSZFElbYt3gpaE9HkXUR5ykv20rDwsLXm2J9i/WmndO8zoiZd3nEaxHrJZH3YhIdkdkmzcahT9NTgm/0Wp6FdoenIGZCHiQ2Hs7rEI9amxHpPXJEoQPNcsU2OqPFxWu15bw3leMvH5sPRWMtGDOFZGCDzRgfUB46fEZ/FmoETCw61bNNCS+Ht3+Elr+utLghQfjLJlKPxyMDoiU+gclqFvlx/s05/tfLx+zHobsEBSuyNVK5Ca6D3sVPFxJUQfvmRwIg0ubWQWt0tI0XUerlmBUsKRv/QOiea77vIbHFsEQJL2ssWNEvsBO67exiMY5DN3IVbLCkS9X70mFF65hNhxmQffGRvSigED1oRbSj8dg= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB5801.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(346002)(396003)(39860400002)(376002)(136003)(186003)(921005)(83380400001)(38070700005)(122000001)(30864003)(52536014)(5660300002)(8936002)(76116006)(4326008)(41300700001)(66446008)(64756008)(8676002)(66946007)(55016003)(15650500001)(38100700002)(82960400001)(2906002)(53546011)(6506007)(7696005)(9686003)(71200400001)(6636002)(19627235002)(316002)(110136005)(40140700001)(26005)(86362001)(33656002)(66556008)(478600001)(66476007)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-2022-jp?B?UmcxYnpJSjZ0eTViaVFFNktXeDFXckdRcFZLTHFCVGx5dm94dVlyU0xl?= =?iso-2022-jp?B?K3VFN2ZMRnRueExReEc1bmNDcDg4V0tyWXBxd0RSeE83dko2Tm9iZFdD?= =?iso-2022-jp?B?Q2pOeDBDQytaN05sVWNScUQ5eG5uR3VXU01qemovc2V4U1dmVEVNT1B5?= =?iso-2022-jp?B?ak50ek5xSFkrVHZoa0ZTbHRlMWFNNy91TmE1NkRvQUhadUw2VTRnMmVn?= =?iso-2022-jp?B?NHd3UVpTWDVBa01UYXBuZk9tQk1qcnZGSWdPNVJVRGh6TEg3UW5TOFJX?= =?iso-2022-jp?B?RFArNHhYOVBiVnR4dHdPSnNYb2tlc0FON04wRkFDT05RVFFmS211K1FZ?= =?iso-2022-jp?B?R0g1N3ZMdTBuRTgwM1dyVHplL3FIVEoxY0JIQXFrYk5EQjRoQ0FEMHBD?= =?iso-2022-jp?B?VzhmQ0IrZnRSRzZuYmlJQTFSWXVxd2dYZm5GN0pUYjBSeGtzbW1odGhz?= =?iso-2022-jp?B?QzlrVUN2Y2hhVmYzc3FOTW0rWUpuK0Jpa0t2SEtoQmdLdmJoYmllSVVx?= =?iso-2022-jp?B?azFEbVBXK1EyMzJuMTdVMUtFNW5WOFRNRm84Zm5uYWk5UTVUQjRXOXRl?= =?iso-2022-jp?B?cXNIb2ZDYXpSV0psM2kwUVVQUXdBQWpyR3BLb2xDYWFXY3gwYjZ5bmE5?= =?iso-2022-jp?B?NEswQUMzUHVmUzl3bGF1MllWNlhBWm9MMTM1L3NBaG5tOC9VVG5WZWI4?= =?iso-2022-jp?B?YVFiZGlaWVhiRW1oUnphSjhjSFJnSFQ2S2xwNjZLeVJLejd6Q0toREU2?= =?iso-2022-jp?B?S01kOUp2SWRuTGUrbVBhM01hcGVMRjhTLzdKeEZKWjZ0ZUpSZFRnY25q?= =?iso-2022-jp?B?clpWZWdEYTdtYmhFaGcxblpqQjJpR0JwWjRwMEZGOVZUQ1N2SitaUDk3?= =?iso-2022-jp?B?dXZpUURHZFgxdHBGNnVIRFFOOTczN3JzTm9BZllvT1NWZzNmeHJrMGQ1?= =?iso-2022-jp?B?NllPQ3lxdWVNeUFMQXV1azhIUXNZN3R1MUI1K2g2K1pLZEhxK2F3Ni80?= =?iso-2022-jp?B?VHArVU9BUjBCQXYwUkZMYjJHOENIbjhXTFBZNjFaYitEY0VEVHB1bFVB?= =?iso-2022-jp?B?SGxJenFhWXNFZ1RnOW1JRmJOY1NDcWxzRmRVaWV1OGJGTVlhNVZudW4r?= =?iso-2022-jp?B?a1lVaC9Sbm1UTlJ5SENpL0hWUHNNbXMyMnJsMmtmZXRJbzZLdzB1aWR3?= =?iso-2022-jp?B?blloUWJPZTJVa1lZcHdRd1R1dm1ockg0VW9FWW51azZadWEwNzdHaFhp?= =?iso-2022-jp?B?TittM3RJdHQrYkJ4UlFaQ3hUK1FqVVlKNFArWll1dXZoYktNQjMrb3kr?= =?iso-2022-jp?B?bzlQMmxqeDFiR3RjNGRaMitST29XdmZBaFAzMlpIbSt5R3RDOHdONk16?= =?iso-2022-jp?B?aW9YTXpINkJDaWd4TVpxd3pXZ1YxdXhuaUs3SDBpblB0b1hWbjA2amt5?= =?iso-2022-jp?B?N3YvazV5UG9uMHdhRUYvU0J6c1dOSTdrVVhYWEFrTmRvUnM3M1pYeFda?= =?iso-2022-jp?B?UC90UUN6b2QxVE1EQlpGOWVOaHZWVE5hME93ME1GUWpwbVJQVi92ZUNl?= =?iso-2022-jp?B?YWtBR2pEaUNJUGVyd0hpQmR3SXZ0WVRBaDJUTzJDK0VVYkVjc0MxblNU?= =?iso-2022-jp?B?MDcrQm5PKzBGcWxqclk2ZHZUMmZwOFh0bS92SGlnMUp0MWgrZE9pelVl?= =?iso-2022-jp?B?eVZmVXBuclh3RnJ1aHVGTEs2cTVSclZZTnZJU3Y0RTJZdVM0dU9XSEg3?= =?iso-2022-jp?B?Q29HT3N1NmNZSGJJU2x0VEtYZkRKcTVRd1BGcHB3dCt3VEZWTjZUNkhr?= =?iso-2022-jp?B?eWtkRjA5cEJwK0QxeXZQKzZKRHpCa2daNWkrMENER3ZvNDdBMUFaRUE2?= =?iso-2022-jp?B?ZGRST3J2Z1JuWjFCbkFPVzVyMVNrcG9pZzEyWlBrVDlsSzNoY3ZtS2xW?= =?iso-2022-jp?B?WFhqdWtUcm1CajRvUnpIVmhxeHE1U2t3WXJ0VDNCY2JObW55c2VJVWFs?= =?iso-2022-jp?B?T21BVXRQOTRPdmNiMExIbTBDWFEwZ1lLYTlXYWFJRVZPOTNnZ2o3SGQ2?= =?iso-2022-jp?B?TVFURlpWRHhBUDRWanVMcnMzUTAzdlJVWmVXUVh0UmoyU1NqSEhPVFVW?= =?iso-2022-jp?B?bnNvOWhkZVRQNHNUR0pubjU4VEtIeFlRVnk4THB4bi9YSzZFb0ZtNGRi?= =?iso-2022-jp?B?Ynd5VVcyTGw1REIxVjVsTExlcFhPSkJNUjA4WXFPVjM4WEVtOHR6bVpN?= =?iso-2022-jp?B?bmZueGJmQ05zclpCOEZsVDU4NEJKRUh6S1lpb3ZzaWlVY3JQMFN2bVV1?= =?iso-2022-jp?B?aTJ3bg==?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB5801.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5bdb259-2dd6-473a-4761-08da8142aa56 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Aug 2022 17:54:15.1639 (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: u7+UiANlUMjRVH/1+Ki5fosd6kpsTAgYN4FroCafyMM5rfMCf3l/L+CJlIShzQH/NrqhzoOUE+DmD+DYO3zVJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4429 Return-Path: isaac.w.oram@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_SA1PR11MB58011A7BF531167677B7D0A0D06D9SA1PR11MB5801namp_" --_000_SA1PR11MB58011A7BF531167677B7D0A0D06D9SA1PR11MB5801namp_ Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable Crystal, Package location: We could easily add it to edk2-platforms/Features/Intel/OutOfBandManagement= and integrate it into the AdvancedFeaturePkg. These individual feature pa= ckages aren=1B$B!G=1B(Bt necessarily intended to be Intel specific and are = often meant to be widely usable. I like the pattern because it moves us to= wards a consistent method of allowing board ports to enable features indivi= dually and customize via PCD primarily. You would need to add a readme, fe= ature enable PCD, and include files that can be integrated into the Advance= dFeaturePkg. If the pattern proves workable and useful, we would probably = migrate to a larger scope in edk2-platforms. Another option is to add it to edk2-platforms/Features/AsfPkg similar to th= e Ext4Pkg. And if maintainers like it, it could readily fit in edk2 as well. I don=1B= $B!G=1B(Bt know what the current thinking is on edk2 expansion. Design comments: * I think that Asf.h should go in MdePkg/Include/IndustryStandards if i= t is standards spec content. * I don=1B$B!G=1B(Bt think that you need a library for InstallAsfAcpiTa= bleEvent () function. In my opinion, it is overkill as it should only ever= be called by the one ASF DXE driver. I guess that you are intending that = it is customizable by board making their own instance of the library. I wo= uld prefer customization via PCD if that is reasonable. But it is more an = option for you to consider and not a request to change it. * Please add a Readme.md that describes integration, use, and porting d= etails. Nit code review comments: * Asf.h has a whitespace alignment issue on line 78 * AsfPei.inf - does it really support EBC? I also like to delete empty= sections, but your choice. * ## PRODUCES and ## CONSUMES are helpful, please add where missing in = INF. * AsfDxe.c - function headers occasionally missing @param and @retval * Line 331 has a trailing =1B$B!F=1B(B\=1B$B!G=1B(B that seems quite= out of place Regards, Isaac -----Original Message----- From: CrystalLee [=1B$BM{W^3~=1B(B] Sent: Sunday, August 14, 2022 6:33 PM To: Oram, Isaac W ; Desimone, Nathaniel L ; Zeng, Star ; Gao, Zhichao ; maciej.rabeda@linux.intel.com; siyuan.fu@intel.com; W= u, Jiaxin ; Liu, Zhiguang ; Bi= , Dandan ; Gao, Liming ; dev= el@edk2.groups.io Cc: DavidHsieh [=1B$B; CrystalLee [=1B$BM{= W^3~=1B(B] Subject: RE: [PATCH 1/1] AsfPkg: Add Alert standard format support +cc: isaac.w.ora, nathaniel.l.desimone, star.zeng, zhichao.gao, maciej.rabe= da, jiaxin.wu, siyuan.fu, zhiguang.liu, dandan.bi, gaoliming, rfc Hi, I would like to propose to add Alert standard format support which is based on ASF2.0 specification(DSP0136). REF:https://www.dmtf.org/sites/default/files/standards/documents/DSP0136.pd= f Could you suggest which package is suitable for this feature? The Asf Acpi table may be different base on platform support, but other fea= ture could be generic. Since I'm not sure which package to include this feature, I create a tempor= arily Asfpkg to include my patch. Asf branch in forked edk2 reop REF:https://github.com/CrystalLee-77/edk2/tree/AlertStandardFormatSupport Currently, the drivers focus on below features 1. ASF Smbus alert-relate messages (progress logs or error logs) 2. Publish ASF ACPI table for remote control and other information Drivers description: Asf Pei driver: send Bios present and memory initial related messages. Asf Dxe driver: 1. Get boot options from device(DSP0136, ch5.2 boot option messages) 2. Install Asf Acpi table. 3. Register callback function through RscHandler Protocol, the function wil= l send standard messages base on the reported status code. 4. Register callback function on ready to boot event, this function will se= nd set system state(S0) message to device. 5. Install Asf protocol, the protocol include the boot options information = in step 1 so other drivers can get the information. Thanks, Crystal -----Original Message----- From: CrystalLee [=1B$BM{W^3~=1B(B] > Sent: Tuesday, July 26, 2022 4:52 PM To: devel@edk2.groups.io Cc: DavidHsieh [=1B$B>; CrystalLee [=1B$BM{W^3~=1B(B] > Subject: [PATCH 1/1] AsfPkg: Add Alert standard format support Alert Standard format specification(DSP0136) REF:https://www.dmtf.org/sites/default/files/standards/documents/DSP0136.pd= f Send standard alert message base on the status code reported by drivers. Report Asf configuration and capabilities in Asf ACPI table More information: I'm not sure which package is suitable for this feature. So I create AsfPkg as temporary location. My branch in forked edk2 reop REF:https://github.com/CrystalLee-77/edk2/tree/AlertStandardFormatSupport Asf Pei driver: send Bios present and memory initial related message. Asf Dxe driver: 1. Get boot options from device(DSP0136, ch5.2 boot option messages) 2. Install Asf Acpi table. 3. Register callback function through RscHandler Protocol, the function wil= l send stardand messages base on the reported status code. 4. Register callback function on ready to boot event, this function will se= nd set system state(S0) message to device. 5. Intall Asf protocol, the protocol include the boot options information i= n step 1 and push event function for send message to device. Signed-off-by: Crystal Lee > --- AsfPkg/Asf/AsfDxe/AsfDxe.c | 338 +++++++++++++++++ AsfPkg/Asf/AsfDxe/AsfDxeEvent.c | 319 ++++++++++++++++ AsfPkg/Asf/AsfPei/AsfPei.c | 384 ++++++++++++++++++= ++ AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.c | 210 +++++++++++ AsfPkg/Asf/AsfDxe/AsfDxe.h | 67 ++++ AsfPkg/Asf/AsfDxe/AsfDxe.inf | 52 +++ AsfPkg/Asf/AsfDxe/AsfDxe.uni | 15 + AsfPkg/Asf/AsfDxe/AsfDxeExtra.uni | 13 + AsfPkg/Asf/AsfPei/AsfPei.inf | 57 +++ AsfPkg/Asf/AsfPei/AsfPei.uni | 15 + AsfPkg/Asf/AsfPei/AsfPeiExtra.uni | 13 + AsfPkg/AsfPkg.dec | 47 +++ AsfPkg/AsfPkg.dsc | 59 +++ AsfPkg/Include/AsfMessages.h | 104 ++++++ AsfPkg/Include/IndustryStandard/Asf.h | 145 ++++++++ AsfPkg/Include/Library/AsfAcpiTableLib.h | 26 ++ AsfPkg/Include/Protocol/AsfProtocol.h | 57 +++ AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.inf | 30 ++ AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.uni | 15 + 19 files changed, 1966 insertions(+) diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.c b/AsfPkg/Asf/AsfDxe/AsfDxe.c new file mode 100644 index 000000000000..1919dec6d095 --- /dev/null +++ b/AsfPkg/Asf/AsfDxe/AsfDxe.c @@ -0,0 +1,338 @@ +/** @file + Asf Dxe driver which is used for sending event record log to NIC or rece= iving + boot option command from NIC and provide in Asf Dxe protocol. + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +ASF_BOOT_OPTION gAsfBootOption =3D { 0, 0, 0, 0, 0, 0, 0 }; +ASF_PROTOCOL gAsfProtocol =3D { AsfPushEvent, NULL }; +EFI_SMBUS_DEVICE_ADDRESS mFixedTargetAddress; +EFI_SMBUS_HC_PROTOCOL *mSmBus =3D NULL; + +/** + Send message through SmBus to lan card. + + @param[in] Command Command of System Firmware Events. + @param[in] Length Length of the data in bytes. + @param[in] AsfEvent Message data. + + @retval EFI_SUCCESS Push Event successfully. + @retval Others Push Event error. +**/ +EFI_STATUS +EFIAPI +AsfPushEvent ( + IN UINT8 Command, + IN UINTN Length, + IN UINT8 *AsfEvent + ) +{ + EFI_STATUS Status; + + if (mSmBus =3D=3D NULL) { + return EFI_UNSUPPORTED; + } + + Status =3D mSmBus->Execute ( + mSmBus, + mFixedTargetAddress, + Command, + EfiSmbusWriteBlock, + TRUE, + &Length, + AsfEvent + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "AsfPushEvent Status =3D %r\n", Status)); + } + + return Status; +} + +/** + This function pushes the System Firmware State Events. + + @param[in] SystemState System Firmware State. + +**/ +VOID +EFIAPI +AsfPushSystemState ( + IN UINT8 SystemState + ) +{ + mAsfSystemState.EventSensorType =3D SystemState; + AsfPushEvent ( + mAsfSystemState.Command, + mAsfSystemState.ByteCount, + (UINT8 *)&(mAsfSystemState.SubCommand) + ); + return; +} + +/** + This function processes the System Firmware Progress/Error Events. + + @param[in] MessageErrorLevel Progress or error or system management me= ssage Type. + @param[in] MessageType Specific ASF message type. + +**/ +VOID +EFIAPI +AsfPushSystemErrorProgressEvent ( + IN UINT32 MessageErrorLevel, + IN ASF_MESSAGE_TYPE MessageType + ) +{ + UINTN i; + + if ((MessageErrorLevel & PcdGet32 (PcdAsfMessageErrorLevel)) || + ((gAsfBootOption.BootOptionBit & ASF_BOP_BIT_FORCE_PROGRESS_EVENT))) + { + for ( i =3D 0; i < mAsfMessagesSize; i++ ) { + if ( mAsfMessages[i].Type =3D=3D MessageType ) { + AsfPushEvent ( + mAsfMessages[i].Message.Command, + mAsfMessages[i].Message.ByteCount, + (UINT8 *)&(mAsfMessages[i].Message.SubCommand) + ); + break; + } + } + } + + return; +} + +/** + Send relate progress or error message to lan card + + @param[in] CodeType Indicates the type of status code being rep= orted. + @param[in] Value Describes the current status of a hardware = or software entity. + This included information about the class a= nd subclass that is used to + classify the entity as well as an operation= . + @param[in] Instance The enumeration of a hardware or software e= ntity within + the system. Valid instance numbers start wi= th 1. + @param[in] CallerId This optional parameter may be used to iden= tify the caller. + This parameter allows the status code drive= r to apply different rules to + different callers. + @param[in] Data This optional parameter may be used to pass= additional data. + + @retval EFI_SUCCESS Reported all the progress and error codes f= or Asf successfully. +**/ +EFI_STATUS +EFIAPI +AsfRscHandlerCallback ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID *CallerId, + IN EFI_STATUS_CODE_DATA *Data + ) +{ + UINTN Index; + + if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_PROGRESS_CODE) { + for (Index =3D 0; Index < mMsgProgressMapSize; Index++) { + if (mMsgProgressMap[Index].StatusCode =3D=3D Value) { + AsfPushSystemErrorProgressEvent (MESSAGE_ERROR_LEVEL_PROGRESS, mMs= gProgressMap[Index].MessageType); + break; + } + } + } + + if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_ERROR_CODE) { + for ( Index =3D 0; Index < mMsgErrorMapSize; Index++ ) { + if ( mMsgErrorMap[Index].StatusCode =3D=3D Value ) { + AsfPushSystemErrorProgressEvent (MESSAGE_ERROR_LEVEL_ERROR, mMsgEr= rorMap[Index].MessageType); + break; + } + } + } + + return EFI_SUCCESS; +} + +/** + This function issues the ASF Get/Clear Boot Option command. + + @retval EFI_SUCCESS Reported all the progress and error codes for Asf su= ccessfully. + @retval Others Smbus Execute function return error. +**/ +EFI_STATUS +EFIAPI +AsfGetBootOption ( + IN EFI_SMBUS_DEVICE_ADDRESS AsfSlaveAddress + ) +{ + EFI_STATUS Status; + UINTN Length =3D sizeof (ASF_BOOT_OPTION); + ASF_BOOT_OPTION BootOption; + + // Initialize get boot option Buffer. + SetMem (&BootOption, sizeof (ASF_BOOT_OPTION), 0); + + // Execute ASFMSG_CMD_CONFIG command. + Status =3D mSmBus->Execute ( + mSmBus, + AsfSlaveAddress, + ASFMSG_CMD_CONFIG, + EfiSmbusReadBlock, + TRUE, + &Length, + &BootOption + ); + if ( EFI_ERROR (Status)) { + return Status; + } + + if ( BootOption.SubCommand =3D=3D ASFMSG_SUBCMD_RET_BOOT_OPTION ) { + // copy Return Boot Option to global ASF Boot Option buffer. + CopyMem (&gAsfBootOption, &BootOption, sizeof (ASF_BOOT_OPTION)); + gAsfProtocol.BootOption =3D &gAsfBootOption; + // Execute Clear Boot Option command. + BootOption.SubCommand =3D ASFMSG_SUBCMD_CLR_BOOT_OPTION; + BootOption.Version =3D 0x10; + Length =3D 2; + mSmBus->Execute ( + mSmBus, + AsfSlaveAddress, + ASFMSG_CMD_CONFIG, + EfiSmbusWriteBlock, + TRUE, + &Length, + &BootOption + ); + } + + return Status; +} + +/** + This Event Callback processes the requests at EFI Ready to Boot Event tr= iggered. + + @param[in] Event A pointer to the Event that triggered the callbac= k. + @param[in] Context A pointer to private data registered with the cal= lback function. +**/ +VOID +EFIAPI +AsfReadyToBootEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // Push System State S0 - "Working". + AsfPushSystemState (ASFMSG_SYSTEM_STATE_S0); + + gBS->CloseEvent (Event); + return; +} + +/** + Register callback if Acpi protocol is not ready, else install ASF acpi= table directly. + +**/ +VOID +EFIAPI +InstallAsfAcpiTable ( + VOID + ) +{ + EFI_STATUS Status; + EFI_EVENT Event; + VOID *Registration; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID = **)&AcpiTableProtocol); + if (!EFI_ERROR (Status)) { + InstallAsfAcpiTableEvent (NULL, NULL); + } else { + Status =3D gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + InstallAsfAcpiTableEvent, + NULL, + &Event + ); + + if (!EFI_ERROR (Status)) { + Status =3D gBS->RegisterProtocolNotify ( + &gEfiAcpiTableProtocolGuid, + Event, + &Registration + ); + + if (EFI_ERROR (Status)) { + gBS->CloseEvent (Event); + } + } + } + + return; +} + +/** + This is the standard EFI driver entry point for DXE phase of ASF. + + @param[in] ImageHandle Image handle of the loaded driver + @param[in] SystemTable Pointer to the System Table + + @retval EFI_SUCCESS This driver initial correctly + @retval Others This driver initial fail +**/ +EFI_STATUS +EFIAPI +AsfDxeEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_RSC_HANDLER_PROTOCOL *RscHandler; + EFI_EVENT AsfEfiReadyToBootEvent; + + Status =3D gBS->LocateProtocol (&gEfiSmbusHcProtocolGuid, NULL, (VOID **= )&mSmBus); + if ( EFI_ERROR (Status)) { + return Status; + } + + mFixedTargetAddress.SmbusDeviceAddress =3D PcdGet8 (PcdSmbusSlaveAddress= ForDashLan) >> 1; + if (mFixedTargetAddress.SmbusDeviceAddress =3D=3D 0) { + return EFI_UNSUPPORTED; + } + + Status =3D AsfGetBootOption (mFixedTargetAddress); + if ( EFI_ERROR (Status)) { + return Status; + } + + InstallAsfAcpiTable (); + + // Send mother board initialization message. + AsfPushSystemErrorProgressEvent (MESSAGE_ERROR_LEVEL_PROGRESS, MsgMother= BoardInit); + + Status =3D gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid, NULL, (VOID= **)&RscHandler); + if (!EFI_ERROR (Status)) { + RscHandler->Register (AsfRscHandlerCallback, TPL_CALLBACK); + } + + EfiCreateEventReadyToBootEx ( + TPL_CALLBACK, + AsfReadyToBootEvent, + NULL, + &AsfEfiReadyToBootEvent + ); + + gBS->InstallProtocolInterface ( + &ImageHandle, \ + &gAsfProtocolGuid, + EFI_NATIVE_INTERFACE, + &gAsfProtocol + ); + + return EFI_SUCCESS; +} diff --git a/AsfPkg/Asf/AsfDxe/AsfDxeEvent.c b/AsfPkg/Asf/AsfDxe/AsfDxeEven= t.c new file mode 100644 index 000000000000..64265c6d5c3c --- /dev/null +++ b/AsfPkg/Asf/AsfDxe/AsfDxeEvent.c @@ -0,0 +1,319 @@ +/** @file + Asf messages define + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +MESSAGE_DATA_HUB_MAP mMsgProgressMap[] =3D { + { MsgHddInit, EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENABLE = }, + { MsgApInit, EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC= _AP_INIT }, + { MsgUserInitSetup, EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETU= P }, + { MsgUsbResourceConfig, EFI_IO_BUS_USB | EFI_P_PC_ENABLE = }, + { MsgPciResourceConfig, EFI_IO_BUS_PCI | EFI_IOB_PCI_BUS_ENUM = }, + { MsgVideoInit, EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_ENABLE = }, + { MsgKbcInit, EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE = }, + { MsgKbcTest, EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF= _TEST } +}; + +MESSAGE_DATA_HUB_MAP mMsgErrorMap[] =3D { + { MsgNoVideo, EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED }, + { MsgKbdFailure, EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED }, + { MsgHddFailure, EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_NOT_DETECTED } +}; + +ASF_MESSAGE mAsfMessages[] =3D { + { + MsgHddInit, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_DISK, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_HARD_DISK_INITIALIZATION + } + }, + { + MsgApInit, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_PROCESSOR, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_AP_INITIALIZATION + } + }, + { + MsgUserInitSetup, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_BIOS, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_SETUP_INITIALIZATION + } + }, + { + MsgUsbResourceConfig, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_BIOS, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_USB_RESOURCE_CONFIG + } + }, + { + MsgPciResourceConfig, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_BIOS, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_PCI_RESOURCE_CONFIG + } + }, + { + MsgVideoInit, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_ADD_IN_CARD, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_VIDEO_INITIALIZATION + } + }, + { + MsgKbcInit, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_SYSTEM_BOARD, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_KEYBOARD_INITIALIZATION + } + }, + { + MsgKbcTest, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_SYSTEM_BOARD, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_KEYBOARD_TEST + } + }, + { + MsgMotherBoardInit, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_MONITOR, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_SYSTEM_BOARD, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_BOARD_INITIALIZATION + } + }, + { + MsgNoVideo, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_NO_BOOTABLE_MEDIA, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_ADD_IN_CARD, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_NO_VIDEO + } + }, + { + MsgKbdFailure, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_ERROR, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_SYSTEM_BOARD, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_KEYBOARD_FAILURE + } + }, + { + MsgHddFailure, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_ERROR, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_RECOVERABLE, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_DISK, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_HARD_DISK_FAILURE + } + }, + { + MsgChassisIntrusion, + { + ASFMSG_COMMAND_MESSAGING, + 0x0b, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_CHASSIS_INTRUSION, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_CHASSIS_INTRUSION, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_MONITOR, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_SYSTEM_BOARD, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED + } + }, + { + MsgNoBootMedia, + { + ASFMSG_COMMAND_MESSAGING, + 0x0d, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_BOOT_ERROR, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_ERROR, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_RECOVERABLE, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_UNSPECIFIED, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_UNSPECIFIED + } + } +}; + +UINTN mMsgProgressMapSize =3D sizeof (mMsgProgressMap) / sizeof (MESSAGE_= DATA_HUB_MAP); +UINTN mMsgErrorMapSize =3D sizeof (mMsgErrorMap) / sizeof (MESSAGE_DAT= A_HUB_MAP); +UINTN mAsfMessagesSize =3D sizeof (mAsfMessages) / sizeof (ASF_MESSAGE= ); + +ASF_MSG_NORETRANSMIT mAsfSystemState =3D +{ + ASFMSG_COMMAND_SYSTEM_STATE, + 0x3, // ByteCount + ASFMSG_SUBCOMMAND_SET_SYSTEM_STATE, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_SYSTEM_STATE_S0 +}; diff --git a/AsfPkg/Asf/AsfPei/AsfPei.c b/AsfPkg/Asf/AsfPei/AsfPei.c new file mode 100644 index 000000000000..8b44cd26e0fe --- /dev/null +++ b/AsfPkg/Asf/AsfPei/AsfPei.c @@ -0,0 +1,384 @@ +/** @file + Asf Pei Initialization Driver. + + Follow Asf spec to send progress or error message to Smbus device + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + This Event Notify processes the ASF request at Memory Initial Completed. + + @param[in] PeiServices General purpose services available to ev= ery PEIM. + @param[in] NotifyDescriptor The notification structure this PEIM reg= istered on install. + @param[in] Ppi The memory discovered PPI. Not used. + + @retval EFI_SUCCESS Succeeds. + @retval EFI_UNSUPPORTED Push Event error. + +**/ +EFI_STATUS +EFIAPI +MsgMemoryInitCompleted ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ); + +STATIC EFI_PEI_NOTIFY_DESCRIPTOR mMemoryDiscoveredNotifyDes =3D { + EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINAT= E_LIST, + &gEfiPeiMemoryDiscoveredPpiGuid, + MsgMemoryInitCompleted +}; + +ASF_MSG_NORETRANSMIT mAsfSystemStateWorking =3D \ +{ + ASFMSG_COMMAND_SYSTEM_STATE, + 0x3, // ByteCount + ASFMSG_SUBCOMMAND_SET_SYSTEM_STATE, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_SYSTEM_STATE_S0 +}; + +ASF_MSG_NORETRANSMIT mMsgStopTimer =3D +{ + ASFMSG_COMMAND_MANAGEMENT_CONTROL, + 0x2, // ByteCount + ASFMSG_SUBCOMMAND_STOP_WATCH_DOG, + ASFMSG_VERSION_NUMBER_10 +}; + +// 3.1.5.3 System Firmware Progress Events +ASF_MSG_NORETRANSMIT mMsgBiosPresent =3D +{ + ASFMSG_COMMAND_MESSAGING, + 0xd, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_ENTITY_PRESENCE, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_ENTITY_PRESENT, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_BIOS, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_UNSPECIFIED +}; + +// Starting memory initialization and test. +ASF_MSG_NORETRANSMIT mMsgMemoryInit =3D +{ + ASFMSG_COMMAND_MESSAGING, + 0xd, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_MEMORY_DEVICE, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_MEMORY_INITIALIZATION +}; + +// Memory initialized and tested. +ASF_MSG_NORETRANSMIT mMsgMemoryInitialized =3D +{ + ASFMSG_COMMAND_MESSAGING, + 0xd, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_EXIT, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_MEMORY_DEVICE, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_MEMORY_INITIALIZATION +}; + +ASF_MSG_NORETRANSMIT mAsfmsgCacheInit =3D +{ + ASFMSG_COMMAND_MESSAGING, + 0xd, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_MONITOR, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_PROCESSOR, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_CACHE_INITIALIZATION +}; + +ASF_MSG_NORETRANSMIT mAsfmsgMemoryMissing =3D +{ + ASFMSG_COMMAND_MESSAGING, + 0xd, // ByteCount + ASFMSG_SUBCOMMAND_NO_RETRANSMIT, + ASFMSG_VERSION_NUMBER_10, + ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS, + ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC, + ASFMSG_EVENT_OFFSET_SYS_FW_ERROR, + ASFMSG_EVENT_SOURCE_TYPE_ASF10, + ASFMSG_EVENT_SEVERITY_NON_CRITICAL, + ASFMSG_SENSOR_DEVICE_UNSPECIFIED, + ASFMSG_SENSOR_NUMBER_UNSPECIFIED, + ASFMSG_ENTITY_MEMORY_DEVICE, + ASFMSG_ENTITY_INSTANCE_UNSPECIFIED, + ASFMSG_EVENT_DATA1, + ASFMSG_EVENT_DATA_NO_MEMORY +}; + +/** + This function pushes the PEI System Firmware Progress Events. + + @param[in] SmBus Pointer to the SmBus PPI. + @param[in] FixedTargetAddress Device address + @param[in] MessageErrorLevel Progress or error or system management me= ssage Type. + @param[in] MessageBuffer Pointer to the Event Data Buffer. + +**/ +VOID +EFIAPI +AsfPushProgressMessage ( + IN EFI_PEI_SMBUS2_PPI *SmBus, + IN EFI_SMBUS_DEVICE_ADDRESS FixedTargetAddress, + IN UINT32 MessageErrorLevel, + IN UINT8 *MessageBuffer + ) +{ + EFI_STATUS Status; + UINTN Length; + + if (MessageErrorLevel & PcdGet32 (PcdAsfMessageErrorLevel)) { + Length =3D ((ASF_MSG_NORETRANSMIT *)MessageBuffer)->ByteCount; + Status =3D SmBus->Execute ( + SmBus, + FixedTargetAddress, + ((ASF_MSG_NORETRANSMIT *)MessageBuffer)->Command, + EfiSmbusWriteBlock, + TRUE, + &Length, + (UINT8 *)(MessageBuffer+2) + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Push alert message fail, status =3D %r\n", Sta= tus)); + } + } + + return; +} + +/** + This callback registered by Report Status Code Ppi for Memory Missing PE= T. + + @param[in] PeiServices General purpose services available to ever= y PEIM. + @param[in] Type Indicates the type of status code being re= ported. + @param[in] Value Describes the current status of a hardware= or software entity. + This included information about the class = and subclass that is + used to classify the entity as well as an = operation. + @param[in] Instance The enumeration of a hardware or software = entity within the system. + Valid instance numbers start with 1. + @param[in] CallerId This optional parameter may be used to ide= ntify the caller. + This parameter allows the status code driv= er to apply different + rules to different callers. + @param[in] Data This optional parameter may be used to pas= s additional data. + + @retval EFI_SUCCESS Always return EFI_SUCCESS + +**/ +EFI_STATUS +EFIAPI +AsfPeiStatusCodeCallBack ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE Type, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID *CallerId, + IN EFI_STATUS_CODE_DATA *Data + ) +{ + EFI_STATUS Status; + EFI_PEI_SMBUS2_PPI *SmBus; + EFI_SMBUS_DEVICE_ADDRESS FixedTargetAddress; + + FixedTargetAddress.SmbusDeviceAddress =3D PcdGet8 (PcdSmbusSlaveAddressF= orDashLan) >> 1; + if (FixedTargetAddress.SmbusDeviceAddress =3D=3D 0) { + return EFI_SUCCESS; + } + + Status =3D PeiServicesLocatePpi ( + &gEfiPeiSmbus2PpiGuid, + 0, + NULL, + (VOID **)&SmBus + ); + if ( EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + + if ((Type & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_ERROR_CODE) { + if ((Value =3D=3D (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_MEMORY_N= OT_INSTALLED)) || + (Value =3D=3D (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_D= ETECTED))) + { + // Error message - Memory Missing. + AsfPushProgressMessage (SmBus, FixedTargetAddress, MESSAGE_ERROR_LEV= EL_ERROR, (UINT8 *)&mAsfmsgMemoryMissing); + } + } + + if (((Type & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_PROGRESS_CODE) && + (Value =3D=3D (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACH= E_INIT))) + { + // Progress message - Cache initialization. + AsfPushProgressMessage (SmBus, FixedTargetAddress, MESSAGE_ERROR_LEVEL= _PROGRESS, (UINT8 *)&mAsfmsgCacheInit); + } + + return EFI_SUCCESS; +} + +/** + This send memory initialized message after memory discovered. + + @param[in] PeiServices General purpose services available to ev= ery PEIM. + @param[in] NotifyDescriptor The notification structure this PEIM reg= istered on install. + @param[in] Ppi The memory discovered PPI. + + @retval EFI_SUCCESS Always return EFI_SUCCESS + +**/ +EFI_STATUS +EFIAPI +MsgMemoryInitCompleted ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ) +{ + EFI_STATUS Status; + EFI_PEI_SMBUS2_PPI *SmBus; + EFI_BOOT_MODE BootMode; + EFI_SMBUS_DEVICE_ADDRESS FixedTargetAddress; + + FixedTargetAddress.SmbusDeviceAddress =3D PcdGet8 (PcdSmbusSlaveAddressF= orDashLan) >> 1; + if (FixedTargetAddress.SmbusDeviceAddress =3D=3D 0) { + return EFI_SUCCESS; + } + + Status =3D PeiServicesLocatePpi ( + &gEfiPeiSmbus2PpiGuid, + 0, + NULL, + (VOID **)&SmBus + ); + if ( EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + + // Progress message - Completed memory initialization and test. + AsfPushProgressMessage (SmBus, FixedTargetAddress, MESSAGE_ERROR_LEVEL_P= ROGRESS, (UINT8 *)&mMsgMemoryInitialized); + + // Get Boot Path. + Status =3D PeiServicesGetBootMode (&BootMode); + if (!EFI_ERROR (Status) && (BootMode =3D=3D BOOT_ON_S3_RESUME)) { + // Push System State Working if S3 resuming. + AsfPushProgressMessage ( + SmBus, + FixedTargetAddress, + MESSAGE_ERROR_LEVEL_SYSTEM_MANAGEMENT, + (UINT8 *)&mAsfSystemStateWorking + ); + } + + return EFI_SUCCESS; +} + +/** + Asf PEI module entry point + + @param[in] FileHandle FileHandle Handle of the file being in= voked. + @param[in] PeiServices Describes the list of possible PEI Serv= ices. + + @retval EFI_SUCCESS The PEIM initialized successfully. + +**/ +EFI_STATUS +EFIAPI +AsfPeiEntry ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + EFI_PEI_SMBUS2_PPI *SmBus; + EFI_PEI_RSC_HANDLER_PPI *RscHndrPpi; + EFI_SMBUS_DEVICE_ADDRESS FixedTargetAddress; + + FixedTargetAddress.SmbusDeviceAddress =3D PcdGet8 (PcdSmbusSlaveAddressF= orDashLan) >> 1; + if (FixedTargetAddress.SmbusDeviceAddress =3D=3D 0) { + return EFI_UNSUPPORTED; + } + + Status =3D PeiServicesLocatePpi ( + &gEfiPeiSmbus2PpiGuid, + 0, + NULL, + (VOID **)&SmBus + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // If the managed client's firmware supports a system boot-failure watch= dog timer, + // the firmware issues the Stop Watchdog Timer command to stop the timer= that is + // automatically started by the alert-sending device at power-on reset. + // + AsfPushProgressMessage (SmBus, FixedTargetAddress, MESSAGE_ERROR_LEVEL_S= YSTEM_MANAGEMENT, (UINT8 *)&mMsgStopTimer); + + // Progress message - BIOS Present. + AsfPushProgressMessage (SmBus, FixedTargetAddress, MESSAGE_ERROR_LEVEL_P= ROGRESS, (UINT8 *)&mMsgBiosPresent); + + // Progress message - Started memory initialization and test. + AsfPushProgressMessage (SmBus, FixedTargetAddress, MESSAGE_ERROR_LEVEL_P= ROGRESS, (UINT8 *)&mMsgMemoryInit); + + PeiServicesNotifyPpi (&mMemoryDiscoveredNotifyDes); + + Status =3D PeiServicesLocatePpi ( + &gEfiPeiRscHandlerPpiGuid, + 0, + NULL, + (VOID **)&RscHndrPpi + ); + if (!EFI_ERROR (Status)) { + RscHndrPpi->Register ((EFI_PEI_RSC_HANDLER_CALLBACK)AsfPeiStatusCodeCa= llBack); + } + + return EFI_SUCCESS; +} diff --git a/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.c b/AsfPkg/Libr= ary/AsfAcpiTableLib/AsfAcpiTableLib.c new file mode 100644 index 000000000000..7476dbf52752 --- /dev/null +++ b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.c @@ -0,0 +1,210 @@ +/** @file + Asf Acpi table + + Install Asf Acpi table + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include + +// ASF Table Definitions +// Below array size define should follow AsfAcpiTable setting +#define ASF_RCTL_DEVICES_ARRAY_LENGTH 4 +#define ASF_ADDR_DEVICE_ARRAY_LENGTH 11 + +#pragma pack(push,1) + +// +// Alert Remote Control System Actions. +// +typedef struct { + EFI_ACPI_ASF_RCTL AsfRctl; + EFI_ACPI_ASF_CONTROLDATA ControlDataArray[ASF_RCTL_DEVICES_ARRAY_LENG= TH]; +} ACPI_ASF_RCTL_ALL; + +// +// SmBus Devices with fixed addresses. +// +typedef struct { + EFI_ACPI_ASF_ADDR AsfAddr; + UINT8 FixedSmBusAddresses[ASF_ADDR_DEVICE_ARRAY_LENGTH]; +} ACPI_ASF_ADDR_ALL; + +// +// ACPI 1.0 Structure for ASF Descriptor Table. +// +typedef struct { + EFI_ACPI_SDT_HEADER Header; + EFI_ACPI_ASF_INFO AsfInfo; + ACPI_ASF_RCTL_ALL AsfRctlAll; + EFI_ACPI_ASF_RMCP AsfRmcp; + ACPI_ASF_ADDR_ALL AsfAddrAll; +} ASF_DESCRIPTION_TABLE; + +#pragma pack(pop) + +#define EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE_REVISION 0x20 + +ASF_DESCRIPTION_TABLE AsfAcpiTable =3D { + { + EFI_ACPI_ASF_DESCRIPTION_TABLE_SIGNATURE, + sizeof (ASF_DESCRIPTION_TABLE), + EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE_REVISION, + 0, // Checksum + + // OEM identification + { 'O', 'E', 'M', '_', 'I', 'D' }, + + // OEM table identification + { 'D', '8', '6', '5', 'G', 'C', 'H', ' '}, // OEM table identific= ation + + 1, // OEM revision number + ((((('M' << 8) + 'S') << 8) + 'F') << 8) + 'T', // ASL compiler vendor= ID + 1000000 // ASL compiler revisi= on number + }, + { + // + // EFI_ACPI_ASF_INFO + // + { + 0x00, // Type "ASF_INFO" + 0x00, // Reserved + sizeof (EFI_ACPI_ASF_INFO) // Length + }, + 0x05, // Min Watchdog Reset Value + 0xFF, // Min ASF Sensor poll Wait Time + 0x0001, // System ID + 0x57010000, // IANA Manufacture ID for Intel + 0x00, // Feature Flag + { + 0x00, // Reserved + 0x00, + 0x00 + } // Reserved + }, + { + // + // ACPI_ASF_RCTL_ALL + // + { + // + // EFI_ACPI_ASF_RCTL + // + { + 0x02, // Type "ASF_RCTL" + 0x00, // Reserved + sizeof (ACPI_ASF_RCTL_ALL) // Length + }, + 0x04, // Number of Controls + 0x04, // Array Element Length + 0x0000 // Reserved + }, + { + // + // EFI_ACPI_ASF_CONTROLDATA + // + { 0x00, 0x88, 0x00, 0x03 }, // Control 0 --> Reset system + { 0x01, 0x88, 0x00, 0x02 }, // Control 1 --> Power Off system + { 0x02, 0x88, 0x00, 0x01 }, // Control 2 --> Power On system + { 0x03, 0x88, 0x00, 0x04 } // Control 3 --> Power Cycle Reset (off = then on) + } + }, + { + // + // EFI_ACPI_ASF_RMCP + // + { + 0x03, // Type "ASF_RMCP" + 0x00, // Reserved + sizeof (EFI_ACPI_ASF_RMCP) // Length + }, + { + // Remote Control Capabilities supported Bit Masks + 0x00, // System Firmware Capabilities Bit Mask= byte 1 + 0x00, // System Firmware Capabilities Bit Mask= byte 2 + 0x00, // System Firmware Capabilities Bit Mask= byte 3 + 0x00, // System Firmware Capabilities Bit Mask= byte 4 + 0x00, // Special Commands Bit Mask byte 1 + 0x00, // Special Commands Bit Mask byte 2 + 0xF0 // System Capabilities Bit Mask (Support= s Reset, + // Power-Up, Power-Down, Power-Cycle Res= et for + // compat and secure port. + }, + 0x00, // Boot Option Complete Code + 0x57010000, // IANA ID for Intel Manufacturer + 0x00, // Special Command + { 0x00, 0x00 }, // Special Command Parameter + { 0x00, 0x00 }, // Boot Options + { 0x00, 0x00 } // OEM Parameters + }, + { + // + // ACPI_ASF_ADDR_ALL + // + { + // + // EFI_ACPI_ASF_ADDR + // + { + 0x84, // Type "ASF_ADDR", last record + 0x00, // Reserved + sizeof (ACPI_ASF_ADDR_ALL) // Length + }, + 0x00, // SEEPROM Address + ASF_ADDR_DEVICE_ARRAY_LENGTH // Number Of Devices + }, + // + // Fixed SMBus Address + // + { + 0x5C, 0x68, 0x88, 0xC2, 0xD2, + 0xDC, 0xA0, 0xA2, 0xA4, 0xA6, + 0xC8 + } + } +}; + +/** + This function install the ASF acpi Table. + + @param[in] Event A pointer to the Event that triggered the callback= . + @param[in] Context A pointer to private data registered with the call= back function. +**/ +VOID +EFIAPI +InstallAsfAcpiTableEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + UINTN TableHandle =3D 0; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID = **)&AcpiTableProtocol); + + if ( EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Locate Acpi protocol %r Error\n", Status)); + return; + } + + if (Event !=3D NULL) { + gBS->CloseEvent (Event); + } + + AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + &AsfAcpiTable, + AsfAcpiTable.Header.Length, + &TableHandle + ); + + return; +} diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.h b/AsfPkg/Asf/AsfDxe/AsfDxe.h new file mode 100644 index 000000000000..7f59fc27d86d --- /dev/null +++ b/AsfPkg/Asf/AsfDxe/AsfDxe.h @@ -0,0 +1,67 @@ +/** @file + Asf Dxe driver which is used for sending event record log to NIC or rece= iving + boot option command from NIC and provide in Asf Dxe protocol. + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef __ASF_DXE_H__ +#define __ASF_DXE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern MESSAGE_DATA_HUB_MAP mMsgProgressMap[]; +extern MESSAGE_DATA_HUB_MAP mMsgErrorMap[]; +extern ASF_MESSAGE mAsfMessages[]; +extern UINTN mMsgProgressMapSize; +extern UINTN mMsgErrorMapSize; +extern UINTN mAsfMessagesSize; +extern ASF_MSG_NORETRANSMIT mAsfSystemState; + +/** + This function pushes the DXE System Firmware Events. + + @param[in] Command Command of System Firmware Events. + @param[in] Length Length of the data in bytes. + @param[in] AsfEvent System Firmware Events Command. + + @retval EFI_SUCCESS Push Event successfully. + @retval EFI_UNSUPPORTED Push Event error. +**/ +EFI_STATUS +EFIAPI +AsfPushEvent ( + IN UINT8 Command, + IN UINTN Length, + IN UINT8 *AsfEvent + ); + +/** + This function install the ASF acpi Table. + + @param[in] Event A pointer to the Event that triggered the callback= . + @param[in] Context A pointer to private data registered with the call= back function. +**/ +VOID +EFIAPI +InstallAsfAcpiTableEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ); + +#endif //__ASF_DXE_H__ diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.inf b/AsfPkg/Asf/AsfDxe/AsfDxe.inf new file mode 100644 index 000000000000..247fc6ca9da6 --- /dev/null +++ b/AsfPkg/Asf/AsfDxe/AsfDxe.inf @@ -0,0 +1,52 @@ +## @file +# Asf Dxe driver which is used for sending event record log to NIC or rec= eiving +# boot option command from NIC and provide in Asf Dxe protocol. +# +# Copyright (c) 1985 - 2022, AMI. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D AsfDxe + MODULE_UNI_FILE =3D AsfDxe.uni + FILE_GUID =3D ED7AD1A2-1427-41EC-A71E-32EC9A1549E8 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D AsfDxeEntry + +[Sources] + AsfDxe.c + AsfDxe.h + AsfDxeEvent.c + +[Packages] + MdePkg/MdePkg.dec + AsfPkg/AsfPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + DebugLib + BaseMemoryLib + PrintLib + AsfAcpiTableLib + UefiLib + +[Protocols] + gEfiRscHandlerProtocolGuid + gAsfProtocolGuid # Produce + gEfiAcpiTableProtocolGuid + gEfiSmbusHcProtocolGuid + +[Guids] + +[FixedPcd] + gAsfPkgTokenSpaceGuid.PcdSmbusSlaveAddressForDashLan + gAsfPkgTokenSpaceGuid.PcdAsfMessageErrorLevel + +[Depex] + TRUE + +[UserExtensions.TianoCore."ExtraFiles"] + AsfDxeExtra.uni diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.uni b/AsfPkg/Asf/AsfDxe/AsfDxe.uni new file mode 100644 index 000000000000..02ff1f72931d --- /dev/null +++ b/AsfPkg/Asf/AsfDxe/AsfDxe.uni @@ -0,0 +1,15 @@ +// /** @file +// Asf DXE Module +// +// Follow Asf spec to send progress or error message to Smbus device +// +// Copyright (c) 1985 - 2022, AMI. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Asf DXE Module" + +#string STR_MODULE_DESCRIPTION #language en-US "Follow Asf spec t= o send progress or error message to Smbus device." + diff --git a/AsfPkg/Asf/AsfDxe/AsfDxeExtra.uni b/AsfPkg/Asf/AsfDxe/AsfDxeEx= tra.uni new file mode 100644 index 000000000000..dbc747257c85 --- /dev/null +++ b/AsfPkg/Asf/AsfDxe/AsfDxeExtra.uni @@ -0,0 +1,13 @@ +// /** @file +// Asf Dxe Module +// +// Follow Asf spec to send progress or error message to Smbus device +// +// Copyright (c) 1985 - 2022, AMI. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Asf DXE" diff --git a/AsfPkg/Asf/AsfPei/AsfPei.inf b/AsfPkg/Asf/AsfPei/AsfPei.inf new file mode 100644 index 000000000000..0569a86e0925 --- /dev/null +++ b/AsfPkg/Asf/AsfPei/AsfPei.inf @@ -0,0 +1,57 @@ +## @file +# Asf PEIM +# +# Follow Asf spec to send progress or error message to Smbus device +# +# Copyright (c) 1985 - 2022, AMI. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D AsfPei + MODULE_UNI_FILE =3D AsfPei.uni + FILE_GUID =3D D2603B09-B8A2-4837-AA1E-EAE8E4DF78E7 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D AsfPeiEntry + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# + +[Sources] + AsfPei.c + +[Packages] + MdePkg/MdePkg.dec + AsfPkg/AsfPkg.dec + +[LibraryClasses] + PeimEntryPoint + PeiServicesLib + DebugLib + +[Guids] + +[Ppis] + gEfiPeiRscHandlerPpiGuid + gEfiPeiMemoryDiscoveredPpiGuid + gEfiPeiSmbus2PpiGuid + +[FeaturePcd] + +[Pcd] + +[FixedPcd] + gAsfPkgTokenSpaceGuid.PcdSmbusSlaveAddressForDashLan + gAsfPkgTokenSpaceGuid.PcdAsfMessageErrorLevel + +[Depex] + gEfiPeiSmbus2PpiGuid + +[UserExtensions.TianoCore."ExtraFiles"] + AsfPeiExtra.uni + diff --git a/AsfPkg/Asf/AsfPei/AsfPei.uni b/AsfPkg/Asf/AsfPei/AsfPei.uni new file mode 100644 index 000000000000..646712917e12 --- /dev/null +++ b/AsfPkg/Asf/AsfPei/AsfPei.uni @@ -0,0 +1,15 @@ +// /** @file +// Asf PEI Module +// +// Follow Asf spec to send progress or error message to Smbus device +// +// Copyright (c) 1985 - 2022, AMI. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Asf PEI Module" + +#string STR_MODULE_DESCRIPTION #language en-US "Follow Asf spec t= o send progress or error message to Smbus device." + diff --git a/AsfPkg/Asf/AsfPei/AsfPeiExtra.uni b/AsfPkg/Asf/AsfPei/AsfPeiEx= tra.uni new file mode 100644 index 000000000000..72819f49862c --- /dev/null +++ b/AsfPkg/Asf/AsfPei/AsfPeiExtra.uni @@ -0,0 +1,13 @@ +// /** @file +// Asf PEI Module +// +// Follow Asf spec to send progress or error message to Smbus device +// +// Copyright (c) 1985 - 2022, AMI. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Asf PEI" diff --git a/AsfPkg/AsfPkg.dec b/AsfPkg/AsfPkg.dec new file mode 100644 index 000000000000..b7bca0ac2231 --- /dev/null +++ b/AsfPkg/AsfPkg.dec @@ -0,0 +1,47 @@ +## @file +# This package defines Asf specific interfaces and library classes. +# +# Copyright (c) 1985 - 2022, AMI. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + DEC_SPECIFICATION =3D 0x00010005 + PACKAGE_NAME =3D AsfPkg + PACKAGE_GUID =3D 025BE9BD-50B3-4139-9A70-4336E277= 339A + PACKAGE_VERSION =3D 1.0 + +[Includes] + Include + +[LibraryClasses] + ## @libraryclass Install Asf Acpi table + ## + AsfAcpiTableLib|AsfPkg\Library\AsfAcpiTableLib\AsfAcpiTableLib.inf + +[Guids] + gAsfPkgTokenSpaceGuid =3D { 0xa12d9aa4, 0xe69b, 0x425c, { 0x96, 0xc5,= 0x41, 0x8d, 0xb1, 0xd0, 0xb9, 0x4f }} + +[Ppis] + +[Protocols] + ## Asf protocol GUID + # Include/Protocol/AmiAsfProtocol.h + gAsfProtocolGuid =3D { 0xdec89827, 0x8a7e, 0x45e0, { 0= xbc, 0xb5, 0xd5, 0x3b, 0x46, 0x14, 0xad, 0xb8 } } + +[PcdsFeatureFlag] + +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] + ## Specify the Dash lan SmBus slave address. + # @Prompt Slave address of Dash lan + gAsfPkgTokenSpaceGuid.PcdSmbusSlaveAddressForDashLan|0x0|UINT8|0x0000000= 1 + + ## This flag is used to control which message would be send. + # If enabled, Asf driver will send message to device.

+ # BIT0 - Progress message is enabled.
+ # BIT1 - Error message is enabled.
+ # BIT2 - System menagement message is enabled.
+ # Other - reserved + # @Prompt Message level + gAsfPkgTokenSpaceGuid.PcdAsfMessageErrorLevel|0x7|UINT32|0x00000002 + diff --git a/AsfPkg/AsfPkg.dsc b/AsfPkg/AsfPkg.dsc new file mode 100644 index 000000000000..acbede1ca02d --- /dev/null +++ b/AsfPkg/AsfPkg.dsc @@ -0,0 +1,59 @@ +## @file +# Asf Package +# +# Copyright (c) 1985 - 2022, AMI. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + PLATFORM_NAME =3D AsfPkg + PLATFORM_GUID =3D 79D22E13-3F30-470A-AF9D-B80CB4324379 + PLATFORM_VERSION =3D 0.10 + DSC_SPECIFICATION =3D 0x00010005 + OUTPUT_DIRECTORY =3D Build/AsfPkg + SUPPORTED_ARCHITECTURES =3D IA32|X64 + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT + + +[LibraryClasses] + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull= .inf + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf + ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf + RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLib= Null.inf + + +[LibraryClasses.common.SEC] + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + +[LibraryClasses.common.PEIM] + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + +[LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM] + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf + +[LibraryClasses.common.DXE_DRIVER] + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + AsfAcpiTableLib|AsfPkg\Library\AsfAcpiTableLib\AsfAcpiTableLib.inf + +[Components] + +[Components.IA32, Components.X64] + AsfPkg/Asf/AsfPei/AsfPei.inf + AsfPkg/Asf/AsfDxe/AsfDxe.inf diff --git a/AsfPkg/Include/AsfMessages.h b/AsfPkg/Include/AsfMessages.h new file mode 100644 index 000000000000..6e79f4993f33 --- /dev/null +++ b/AsfPkg/Include/AsfMessages.h @@ -0,0 +1,104 @@ +/** @file + Asf message format define. + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + Format defined in Asf 2.0 Specification. +**/ + +#ifndef __ASF_MESSAGES_H__ +#define __ASF_MESSAGES_H__ + +#include +#include + +#define MESSAGE_ERROR_LEVEL_PROGRESS BIT0 +#define MESSAGE_ERROR_LEVEL_ERROR BIT1 +#define MESSAGE_ERROR_LEVEL_SYSTEM_MANAGEMENT BIT2 + +#pragma pack(push,1) + +/** + This message causes the alert-sending device to transmit a single, + un-retransmitted PET frame. If the alert-sending device is either tempor= arily + unable to handle the message or unable to send the requested PET frame + because the device's transport media is down, the device must NACK the m= essage + according to SMBUS_2.0 definitions; otherwise, the device sends the + single-frame transmission. +**/ +typedef struct { + UINT8 Command; ///< Message Command. + UINT8 ByteCount; ///< Length of the data in bytes. + UINT8 SubCommand; ///< SubCommand No Retransmit. + UINT8 Version; ///< Version Number. + UINT8 EventSensorType; ///< Event Sensor Type. + UINT8 EventType; ///< Event Type. + UINT8 EventOffset; ///< Event Offset. + UINT8 EventSourceType; ///< Describes the originator of the event. + UINT8 EventSeverity; ///< The severity of the event + UINT8 SensorDevice; ///< The Sensor Device that caused the event + UINT8 SensorNumber; ///< Identify a given instance of a sensor rel= ative to the Sensor Device. + UINT8 Entity; ///< Indicates the platform device or subsyste= m associated with the event. + UINT8 EntityInstance; ///< Identifies which unique device is associa= ted with the event. + UINT8 EventData1; + UINT8 EventData2; + UINT8 EventData3; + UINT8 EventData4; + UINT8 EventData5; +} ASF_MSG_NORETRANSMIT; + +/** + This is the ASF START WatchDog Timer Data structure. + +**/ +typedef struct { + UINT8 Command; + UINT8 ByteCount; + UINT8 SubCommand; + UINT8 Version; +} ASF_STOP_WATCHDOG; + +/** + This is the ASF Message Type structure. + +**/ +typedef enum { + MsgHddInit, + MsgApInit, + MsgUserInitSetup, + MsgUsbResourceConfig, + MsgPciResourceConfig, + MsgVideoInit, + MsgKbcInit, + MsgKbcTest, + MsgMotherBoardInit, + MsgNoVideo, + MsgKbdFailure, + MsgHddFailure, + MsgChassisIntrusion, + MsgNoBootMedia +} ASF_MESSAGE_TYPE; + +/** + This is the Message Data Hub Map Structure. + +**/ +typedef struct { + ASF_MESSAGE_TYPE MessageType; + EFI_STATUS_CODE_VALUE StatusCode; +} MESSAGE_DATA_HUB_MAP; + +/** + This is the ASF System Firmware Event Structure. + +**/ +typedef struct { + ASF_MESSAGE_TYPE Type; + ASF_MSG_NORETRANSMIT Message; +} ASF_MESSAGE; + +#pragma pack(pop) + +#endif //__ASF_MESSAGES_H__ diff --git a/AsfPkg/Include/IndustryStandard/Asf.h b/AsfPkg/Include/Industr= yStandard/Asf.h new file mode 100644 index 000000000000..69b6a0230d4f --- /dev/null +++ b/AsfPkg/Include/IndustryStandard/Asf.h @@ -0,0 +1,145 @@ +/** @file + Asf message commands byte define. + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Revision Reference: + Data defined in Asf 2.0 Specification. +**/ + +#ifndef __ASF_H__ +#define __ASF_H__ + +#include + +// +// Boot option messages +// +#define ASFMSG_CMD_CONFIG 0x3 // ASF Configuration +#define ASFMSG_SUBCMD_CLR_BOOT_OPTION 0x15 // Clear Boot Options +#define ASFMSG_SUBCMD_RET_BOOT_OPTION 0x16 // Return Boot Options +#define ASFMSG_SUBCMD_NO_BOOT_OPTION 0x17 // No Boot Options + +// +// System states +// +#define ASFMSG_SYSTEM_STATE_S0 0 // S0/G0 "Working" +#define ASFMSG_SYSTEM_STATE_S1 1 // S1 +#define ASFMSG_SYSTEM_STATE_S2 2 // S2 +#define ASFMSG_SYSTEM_STATE_S3 3 // S3 +#define ASFMSG_SYSTEM_STATE_S4 4 // S4 +#define ASFMSG_SYSTEM_STATE_S5 5 // S5/G2 "Soft-off" + +// +// Asf version +// +#define ASFMSG_VERSION_NUMBER_10 0x10 + +// +// System firmware capabilities Bit +// +#define ASF_BOP_BIT_FORCE_PROGRESS_EVENT BIT12 + +// +// Asf message command +// +#define ASFMSG_COMMAND_SYSTEM_STATE 0x1 +#define ASFMSG_COMMAND_MANAGEMENT_CONTROL 0x2 +#define ASFMSG_COMMAND_MESSAGING 0x4 + +// +// Asf message subcommand +// +#define ASFMSG_SUBCOMMAND_STOP_WATCH_DOG 0x14 +#define ASFMSG_SUBCOMMAND_NO_RETRANSMIT 0x16 +#define ASFMSG_SUBCOMMAND_SET_SYSTEM_STATE 0x18 + +// +// Asf message event sensor type +// +#define ASFMSG_EVENT_SENSOR_TYPE_CHASSIS_INTRUSION 0x5 +#define ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRESS 0xF +#define ASFMSG_EVENT_SENSOR_TYPE_BOOT_ERROR 0x1E +#define ASFMSG_EVENT_SENSOR_TYPE_ENTITY_PRESENCE 0x25 + +// +// Asf message event type +// +#define ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC 0x6F + +// +// Asf message event offset +// +#define ASFMSG_EVENT_OFFSET_ENTITY_PRESENT 0x0 + +#define ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY 0x2 +#define ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_EXIT 0x82 +#define ASFMSG_EVENT_OFFSET_SYS_FW_ERROR 0x0 + +#define ASFMSG_EVENT_OFFSET_NO_BOOTABLE_MEDIA 0x0 +#define ASFMSG_EVENT_OFFSET_CHASSIS_INTRUSION 0x0 + +// +// Asf message event source type +// +#define ASFMSG_EVENT_SOURCE_TYPE_ASF10 0x68 + +// +// Asf message event severity +// +#define ASFMSG_EVENT_SEVERITY_MONITOR 0x1 +#define ASFMSG_EVENT_SEVERITY_NON_CRITICAL 0x8 +#define ASFMSG_EVENT_SEVERITY_CRITICAL 0x10 +#define ASFMSG_EVENT_SEVERITY_NON_RECOVERABLE 0x20 + +// +// Asf message sensor device +// +#define ASFMSG_SENSOR_DEVICE_UNSPECIFIED 0xFF + +// +// Asf message sensor number +// +#define ASFMSG_SENSOR_NUMBER_UNSPECIFIED 0xFF + +// +// Asf message Entity +// + +#define ASFMSG_ENTITY_UNSPECIFIED 0x0 +#define ASFMSG_ENTITY_PROCESSOR 0x3 +#define ASFMSG_ENTITY_DISK 0x4 +#define ASFMSG_ENTITY_SYSTEM_BOARD 0x7 +#define ASFMSG_ENTITY_ADD_IN_CARD 0xB +#define ASFMSG_ENTITY_BIOS 0x22 +#define ASFMSG_ENTITY_MEMORY_DEVICE 0x20 + +// +// Asf message entity instance +// +#define ASFMSG_ENTITY_INSTANCE_UNSPECIFIED 0x0 + +// +// Asf message event data +// +#define ASFMSG_EVENT_DATA1 0x40 +#define ASFMSG_EVENT_DATA_UNSPECIFIED 0x0 +#define ASFMSG_EVENT_DATA_MEMORY_INITIALIZATION 0x1 +#define ASFMSG_EVENT_DATA_HARD_DISK_INITIALIZATION 0x2 +#define ASFMSG_EVENT_DATA_AP_INITIALIZATION 0x3 +#define ASFMSG_EVENT_DATA_SETUP_INITIALIZATION 0x5 +#define ASFMSG_EVENT_DATA_USB_RESOURCE_CONFIG 0x6 +#define ASFMSG_EVENT_DATA_PCI_RESOURCE_CONFIG 0x7 +#define ASFMSG_EVENT_DATA_VIDEO_INITIALIZATION 0x9 +#define ASFMSG_EVENT_DATA_CACHE_INITIALIZATION 0xA +#define ASFMSG_EVENT_DATA_KEYBOARD_INITIALIZATION 0xC +#define ASFMSG_EVENT_DATA_BOARD_INITIALIZATION 0x14 +#define ASFMSG_EVENT_DATA_KEYBOARD_TEST 0x17 + +#define ASFMSG_EVENT_DATA_NO_MEMORY 0x1 +#define ASFMSG_EVENT_DATA_HARD_DISK_FAILURE 0x3 +#define ASFMSG_EVENT_DATA_KEYBOARD_FAILURE 0x7 +#define ASFMSG_EVENT_DATA_NO_VIDEO 0xA + +#endif //__ASF_H__ diff --git a/AsfPkg/Include/Library/AsfAcpiTableLib.h b/AsfPkg/Include/Libr= ary/AsfAcpiTableLib.h new file mode 100644 index 000000000000..4b1d687825ff --- /dev/null +++ b/AsfPkg/Include/Library/AsfAcpiTableLib.h @@ -0,0 +1,26 @@ +/** @file + Provides services to create Asf Acpi table. + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef __ASF_ACPI_TABLE_LIB_H__ +#define __ASF_ACPI_TABLE_LIB_H__ + +#include + +/** + This function install the ASF acpi Table. + + @param[in] Event A pointer to the Event that triggered the callback= . + @param[in] Context A pointer to private data registered with the call= back function. +**/ +VOID +EFIAPI +InstallAsfAcpiTableEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ); + +#endif diff --git a/AsfPkg/Include/Protocol/AsfProtocol.h b/AsfPkg/Include/Protoco= l/AsfProtocol.h new file mode 100644 index 000000000000..d3af0fba73bd --- /dev/null +++ b/AsfPkg/Include/Protocol/AsfProtocol.h @@ -0,0 +1,57 @@ +/** @file + Asf protocol define. + + Copyright (c) 1985 - 2022, AMI. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef __ASF_PROTOCOL_H__ +#define __ASF_PROTOCOL_H__ + +#include + +#define ASF_PROTOCOL_GUID \ + { \ + 0xdec89827, 0x8a7e, 0x45e0, { 0xbc, 0xb5, 0xd5, 0x3b, 0x46, 0x14, 0xad= , 0xb8 } \ + } + +#pragma pack(push, 1) + +/** + This is the ASF Boot Option data structure. + +**/ +typedef struct { + UINT8 SubCommand; + UINT8 Version; + UINT32 IanaId; + UINT8 SpecialCommand; + UINT16 SpecCmdParameter; + UINT16 BootOptionBit; + UINT16 OemParameter; +} ASF_BOOT_OPTION; + +/** + This is the ASF PUSH EVENT Structure. + +**/ +typedef EFI_STATUS (EFIAPI *ASF_PUSH_EVENT)( + IN UINT8 Command, + IN UINTN Length, + IN UINT8 *ASFEvent + ); + +/** + This is the AMI ASF Protocol Structure. + +**/ +typedef struct { + ASF_PUSH_EVENT PushEvent; + ASF_BOOT_OPTION *BootOption; +} ASF_PROTOCOL; + +#pragma pack(pop) + +extern EFI_GUID gAsfProtocolGuid; + +#endif //__ASF_PROTOCOL_H__ diff --git a/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.inf b/AsfPkg/Li= brary/AsfAcpiTableLib/AsfAcpiTableLib.inf new file mode 100644 index 000000000000..ca90d02f005b --- /dev/null +++ b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.inf @@ -0,0 +1,30 @@ +## @file +# Asf Acpi table Library instance that create Asf Acpi table +# +# Copyright (c) 1985 - 2022, AMI. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D AsfAcpiTableLib + MODULE_UNI_FILE =3D AsfAcpiTableLib.uni + FILE_GUID =3D 9A0EC995-0F1A-444C-BA02-8C3F0482AE8C + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D AsfAcpiTableLib | DXE_DRIVER DXE_RUNT= IME_DRIVER UEFI_APPLICATION UEFI_DRIVER + +[Sources] + AsfAcpiTableLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[Protocols] + gEfiAcpiTableProtocolGuid ## CONSUMES + +[LibraryClasses] + BaseLib + DebugLib + diff --git a/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.uni b/AsfPkg/Li= brary/AsfAcpiTableLib/AsfAcpiTableLib.uni new file mode 100644 index 000000000000..681458140452 --- /dev/null +++ b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.uni @@ -0,0 +1,15 @@ +// /** @file +// Asf Acpi table +// +// Install Asf Acpi table +// +// Copyright (c) 1985 - 2022, AMI. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Asf Acpi table" + +#string STR_MODULE_DESCRIPTION #language en-US "Install Asf Acpi = table." + -- 2.36.0.windows.1 -The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. Please promptly notify the sender by reply e-mail or by telephone= at 770-246-8600, and then delete or destroy all copies of the transmission= . --_000_SA1PR11MB58011A7BF531167677B7D0A0D06D9SA1PR11MB5801namp_ Content-Type: text/html; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable

Crystal,

 

Package location:

 

We could easily add it to edk2-platforms/Features= /Intel/OutOfBandManagement and integrate it into the AdvancedFeaturePkg.&nb= sp; These individual feature packages aren=1B$B!G=1B(Bt necessarily intende= d to be Intel specific and are often meant to be widely usable.  I like the pattern because it moves us towards a consistent = method of allowing board ports to enable features individually and customiz= e via PCD primarily.  You would need to add a readme, feature enable P= CD, and include files that can be integrated into the AdvancedFeaturePkg.  If the pattern proves workable and usef= ul, we would probably migrate to a larger scope in edk2-platforms.

 

Another option is to add it to edk2-platforms/Fea= tures/AsfPkg similar to the Ext4Pkg.

And if maintainers like it, it could readily fit = in edk2 as well.  I don=1B$B!G=1B(Bt know what the current thinking is= on edk2 expansion.

 

Design comments:

  • I think that A= sf.h should go in MdePkg/Include/IndustryStandards if it is standards spec = content.
  • I don=1B$B!G=1B(Bt think that you need a library for InstallAsfAc= piTableEvent () function.  In my opinion, it is overkill as it should = only ever be called by the one ASF DXE driver.  I guess that you are i= ntending that it is customizable by board making their own instance of the library.=   I would prefer customization via PCD if that is reasonable.  Bu= t it is more an option for you to consider and not a request to change it.&= nbsp;
  •  

    Nit code review comments:

    • Asf.h has a wh= itespace alignment issue on line 78
    • AsfPei.inf – does it really supp= ort EBC?  I also like to delete empty sections, but your choice.<= /o:p>
    • ## P= RODUCES and ## CONSUMES are helpful, please add where missing in INF.<= /o:p>
    • AsfD= xe.c – function headers occasionally missing @param and @retval<= /o:p>
      • Line 331 has a= trailing =1B$B!F=1B(B\=1B$B!G=1B(B that seems quite out of place

     

    Regards,
    Isaac

     

    -----O= riginal Message-----
    From: CrystalLee [
    =1B$BM{W^3~=1B(B] <CrystalLee@ami.com>
    Sent: Sunday, August 14, 2022 6:33 PM
    To: Oram, Isaac W <isaac.w.oram@intel.com>; Desimone, Nathaniel L <= ;nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>= ; Gao, Zhichao <zhichao.gao@intel.com>; maciej.rabeda@linux.intel.com= ; siyuan.fu@intel.com; Wu, Jiaxin <jiaxin.wu@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan <dandan.bi@int= el.com>; Gao, Liming <gaoliming@byosoft.com.cn>; devel@edk2.groups= .io
    Cc: DavidHsieh [
    =1B$B] <DavidHsieh@ami.com>; CrystalLee [<= /span>=1B$BM{W^3~=1B(B] <CrystalLee@ami.com>
    Subject: RE: [PATCH 1/1] AsfPkg: Add Alert standard format support

     

    +cc: isaac.w.ora, nathaniel.l.desimone, star.zeng= , zhichao.gao, maciej.rabeda, jiaxin.wu, siyuan.fu, zhiguang.liu, dandan.bi= , gaoliming, rfc

     

    Hi,

     

    I would like to propose to add Alert standard for= mat support which is based

    on ASF2.0 specification(DSP0136).

    REF:https://www.dmtf.org/sites/default/files/stan= dards/documents/DSP0136.pdf

     

    Could you suggest which package is suitable for t= his feature?

    The Asf Acpi table may be different base on platf= orm support, but other feature could  be generic.

     

    Since I'm not sure which package to include this = feature, I create a temporarily

    Asfpkg to include my patch.

    Asf branch in forked edk2 reop

    REF:https://github.com/CrystalLee-77/edk2/tree/Al= ertStandardFormatSupport

     

    Currently, the drivers focus on below features

    1. ASF Smbus alert-relate messages (progress logs= or error logs)

    2. Publish ASF ACPI table for remote control and = other information

     

    Drivers description:

    Asf Pei driver: send Bios present and memory init= ial related messages.

    Asf Dxe driver:

    1. Get boot options from device(DSP0136, ch5.2 bo= ot option messages)

    2. Install Asf Acpi table.

    3. Register callback function through RscHandler = Protocol, the function will

    send standard messages base on the reported statu= s code.

    4. Register callback function on ready to boot ev= ent, this function will send

    set system state(S0) message to device.

    5. Install Asf protocol, the protocol include the= boot options information in

    step 1 so other drivers can get the information.<= o:p>

     

    Thanks,

    Crystal

     

    -----Original Message-----

    From: CrystalLee [=1B$BM{W^3~=1B(B] <CrystalLee= @ami.com>

    Sent: Tuesday, July 26, 2022 4:52 PM

    To: devel@edk2.groups.io

    Cc: DavidHsieh [=1B$B] <DavidHsieh@a= mi.com>; CrystalLee [=1B$BM{W^3~=1B(B] <CrystalLee@ami.com>

    Subject: [PATCH 1/1] AsfPkg: Add Alert standard f= ormat support

     

    Alert Standard format specification(DSP0136)=

    REF:https://www.dmtf.org/sites/default/files/stan= dards/documents/DSP0136.pdf

     

    Send standard alert message base on the status co= de reported by drivers.

    Report Asf configuration and capabilities in Asf = ACPI table

     

    More information:

    I'm not sure which package is suitable for this f= eature. So I create AsfPkg

    as temporary location.

     

    My branch in forked edk2 reop

    REF:https://github.com/CrystalLee-77/edk2/tree/Al= ertStandardFormatSupport

     

    Asf Pei driver: send Bios present and memory init= ial related message.

    Asf Dxe driver:

    1. Get boot options from device(DSP0136, ch5.2 bo= ot option messages)

    2. Install Asf Acpi table.

    3. Register callback function through RscHandler = Protocol, the function will

    send stardand messages base on the reported statu= s code.

    4. Register callback function on ready to boot ev= ent, this function will send

    set system state(S0) message to device.

    5. Intall Asf protocol, the protocol include the = boot options information in

    step 1 and push event function for send message t= o device.

     

    Signed-off-by: Crystal Lee <C= rystalLee@ami.com>

    ---

    AsfPkg/Asf/AsfDxe/AsfDxe.c    = ;            &n= bsp;        | 338 +++++++++++++++++=

    AsfPkg/Asf/AsfDxe/AsfDxeEvent.c   =             &nb= sp;    | 319 ++++++++++++++++

    AsfPkg/Asf/AsfPei/AsfPei.c    = ;            &n= bsp;        | 384 ++++++++++++++++++++

    AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.c&= nbsp;  | 210 +++++++++++

    AsfPkg/Asf/AsfDxe/AsfDxe.h    = ;            &n= bsp;        |  67 ++++

    AsfPkg/Asf/AsfDxe/AsfDxe.inf   &nb= sp;            =        |  52 +++

    AsfPkg/Asf/AsfDxe/AsfDxe.uni   &nb= sp;             = ;      |  15 +

    AsfPkg/Asf/AsfDxe/AsfDxeExtra.uni  &nbs= p;            &= nbsp;  |  13 +

    AsfPkg/Asf/AsfPei/AsfPei.inf   &nb= sp;            =        |  57 +++

    AsfPkg/Asf/AsfPei/AsfPei.uni   &nb= sp;            =        |  15 +

    AsfPkg/Asf/AsfPei/AsfPeiExtra.uni  &nbs= p;             =   |  13 +

    AsfPkg/AsfPkg.dec     &n= bsp;            = ;            &n= bsp;   |  47 +++

    AsfPkg/AsfPkg.dsc     &n= bsp;            = ;            &n= bsp;   |  59 +++

    AsfPkg/Include/AsfMessages.h   &nb= sp;            =        | 104 ++++++

    AsfPkg/Include/IndustryStandard/Asf.h  =             | 145 ++= ++++++

    AsfPkg/Include/Library/AsfAcpiTableLib.h &nb= sp;         |  26 ++

    AsfPkg/Include/Protocol/AsfProtocol.h  =             |  = 57 +++

    AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.in= f |  30 ++

    AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.un= i |  15 +

    19 files changed, 1966 insertions(+)

     

    diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.c b/AsfPkg/= Asf/AsfDxe/AsfDxe.c

    new file mode 100644

    index 000000000000..1919dec6d095

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfDxe/AsfDxe.c

    @@ -0,0 +1,338 @@

    +/** @file

     

    +  Asf Dxe driver which is used for sending = event record log to NIC or receiving

     

    +  boot option command from NIC and provide = in Asf Dxe protocol.

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +**/

     

    +

     

    +#include <AsfDxe.h>

     

    +

     

    +ASF_BOOT_OPTION     &nb= sp;     gAsfBootOption =3D { 0, 0, 0, 0, 0, 0, 0 };

     

    +ASF_PROTOCOL      =         gAsfProtocol   =3D { A= sfPushEvent, NULL };

     

    +EFI_SMBUS_DEVICE_ADDRESS  mFixedTargetAddre= ss;

     

    +EFI_SMBUS_HC_PROTOCOL     *m= SmBus =3D NULL;

     

    +

     

    +/**

     

    +  Send message through SmBus to lan card.

     

    +

     

    +  @param[in] Command    = ;  Command of System Firmware Events.

     

    +  @param[in] Length    =    Length of the data in bytes.

     

    +  @param[in] AsfEvent   &nbs= p; Message data.

     

    +

     

    +  @retval EFI_SUCCESS   &nbs= p; Push Event successfully.

     

    +  @retval Others    &nb= sp;     Push Event error.

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +AsfPushEvent  (

     

    +  IN  UINT8  Command,<= /p>

     

    +  IN  UINTN  Length,

     

    +  IN  UINT8  *AsfEvent=

     

    +  )

     

    +{

     

    +  EFI_STATUS  Status;

     

    +

     

    +  if (mSmBus =3D=3D NULL) {

     

    +    return EFI_UNSUPPORTED;<= /o:p>

     

    +  }

     

    +

     

    +  Status =3D mSmBus->Execute (

     

    +        =              mS= mBus,

     

    +        =              mF= ixedTargetAddress,

     

    +        =              Co= mmand,

     

    +        =              Ef= iSmbusWriteBlock,

     

    +        =              TR= UE,

     

    +        =              &a= mp;Length,

     

    +        =              As= fEvent

     

    +        =              );=

     

    +  if (EFI_ERROR (Status)) {

     

    +    DEBUG ((DEBUG_ERROR, "As= fPushEvent Status =3D %r\n", Status));

     

    +  }

     

    +

     

    +  return Status;

     

    +}

     

    +

     

    +/**

     

    +  This function pushes the System Firmware = State Events.

     

    +

     

    +  @param[in] SystemState    = System Firmware State.

     

    +

     

    +**/

     

    +VOID

     

    +EFIAPI

     

    +AsfPushSystemState  (

     

    +  IN  UINT8  SystemState

     

    +  )

     

    +{

     

    +  mAsfSystemState.EventSensorType =3D Syste= mState;

     

    +  AsfPushEvent (

     

    +    mAsfSystemState.Command,=

     

    +    mAsfSystemState.ByteCount,

     

    +    (UINT8 *)&(mAsfSystemStat= e.SubCommand)

     

    +    );

     

    +  return;

     

    +}

     

    +

     

    +/**

     

    +  This function processes the System Firmwa= re Progress/Error Events.

     

    +

     

    +  @param[in] MessageErrorLevel   = Progress or error or system management message Type.

     

    +  @param[in] MessageType   &= nbsp;     Specific ASF message type.

     

    +

     

    +**/

     

    +VOID

     

    +EFIAPI

     

    +AsfPushSystemErrorProgressEvent  (

     

    +  IN UINT32     &n= bsp;      MessageErrorLevel,

     

    +  IN ASF_MESSAGE_TYPE  MessageType

     

    +  )

     

    +{

     

    +  UINTN  i;

     

    +

     

    +  if ((MessageErrorLevel & PcdGet32 (Pc= dAsfMessageErrorLevel)) ||

     

    +      ((gAsfBootOption.= BootOptionBit & ASF_BOP_BIT_FORCE_PROGRESS_EVENT)))

     

    +  {

     

    +    for ( i =3D 0; i < mAsfMes= sagesSize; i++ ) {

     

    +      if ( mAsfMessages= [i].Type =3D=3D MessageType ) {

     

    +        AsfPu= shEvent (

     

    +        =   mAsfMessages[i].Message.Command,

     

    +        =   mAsfMessages[i].Message.ByteCount,

     

    +        =   (UINT8 *)&(mAsfMessages[i].Message.SubCommand)

     

    +        =   );

     

    +        break= ;

     

    +      }

     

    +    }

     

    +  }

     

    +

     

    +  return;

     

    +}

     

    +

     

    +/**

     

    +  Send relate progress or error message to = lan card

     

    +

     

    +  @param[in]  CodeType  &nbs= p;      Indicates the type of status code being re= ported.

     

    +  @param[in]  Value   &= nbsp;        Describes the current statu= s of a hardware or software entity.

     

    +        =             &nb= sp;          This included inf= ormation about the class and subclass that is used to

     

    +        =             &nb= sp;          classify the enti= ty as well as an operation.

     

    +  @param[in]  Instance  &nbs= p;      The enumeration of a hardware or software = entity within

     

    +        =             &nb= sp;          the system. Valid= instance numbers start with 1.

     

    +  @param[in]  CallerId  &nbs= p;      This optional parameter may be used to ide= ntify the caller.

     

    +        =             &nb= sp;          This parameter al= lows the status code driver to apply different rules to

     

    +        =             &nb= sp;          different callers= .

     

    +  @param[in]  Data   &n= bsp;         This optional paramete= r may be used to pass additional data.

     

    +

     

    +  @retval EFI_SUCCESS   &nbs= p;      Reported all the progress and error codes = for Asf successfully.

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +AsfRscHandlerCallback (

     

    +  IN EFI_STATUS_CODE_TYPE   CodeT= ype,

     

    +  IN EFI_STATUS_CODE_VALUE  Value,

     

    +  IN UINT32     &n= bsp;           Instance,<= o:p>

     

    +  IN EFI_GUID     =           *CallerId,

     

    +  IN EFI_STATUS_CODE_DATA   *Data=

     

    +  )

     

    +{

     

    +  UINTN  Index;

     

    +

     

    +  if ((CodeType & EFI_STATUS_CODE_TYPE_= MASK) =3D=3D EFI_PROGRESS_CODE) {

     

    +    for (Index =3D 0; Index < = mMsgProgressMapSize; Index++) {

     

    +      if (mMsgProgressM= ap[Index].StatusCode =3D=3D Value) {

     

    +        AsfPu= shSystemErrorProgressEvent (MESSAGE_ERROR_LEVEL_PROGRESS, mMsgProgressMap[I= ndex].MessageType);

     

    +        break= ;

     

    +      }

     

    +    }

     

    +  }

     

    +

     

    +  if ((CodeType & EFI_STATUS_CODE_TYPE_= MASK) =3D=3D EFI_ERROR_CODE) {

     

    +    for ( Index =3D 0; Index <= mMsgErrorMapSize; Index++ ) {

     

    +      if ( mMsgErrorMap= [Index].StatusCode =3D=3D Value ) {

     

    +        AsfPu= shSystemErrorProgressEvent (MESSAGE_ERROR_LEVEL_ERROR, mMsgErrorMap[Index].= MessageType);

     

    +        break= ;

     

    +      }

     

    +    }

     

    +  }

     

    +

     

    +  return EFI_SUCCESS;

     

    +}

     

    +

     

    +/**

     

    +  This function issues the ASF Get/Clear Bo= ot Option command.

     

    +

     

    +  @retval EFI_SUCCESS Reported all the prog= ress and error codes for Asf successfully.

     

    +  @retval Others    &nb= sp; Smbus Execute function return error.

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +AsfGetBootOption (

     

    +  IN  EFI_SMBUS_DEVICE_ADDRESS  A= sfSlaveAddress

     

    +  )

     

    +{

     

    +  EFI_STATUS     &= nbsp; Status;

     

    +  UINTN      =       Length =3D sizeof (ASF_BOOT_OPTION);

     

    +  ASF_BOOT_OPTION  BootOption;

     

    +

     

    +  // Initialize get boot option Buffer.

     

    +  SetMem (&BootOption, sizeof (ASF_BOOT= _OPTION), 0);

     

    +

     

    +  // Execute ASFMSG_CMD_CONFIG command.

     

    +  Status =3D mSmBus->Execute (

     

    +        =              mS= mBus,

     

    +        =              As= fSlaveAddress,

     

    +        =              AS= FMSG_CMD_CONFIG,

     

    +        =              Ef= iSmbusReadBlock,

     

    +        =              TR= UE,

     

    +        =              &a= mp;Length,

     

    +        =              &a= mp;BootOption

     

    +        =              );=

     

    +  if ( EFI_ERROR (Status)) {

     

    +    return Status;

     

    +  }

     

    +

     

    +  if ( BootOption.SubCommand =3D=3D ASFMSG_= SUBCMD_RET_BOOT_OPTION ) {

     

    +    // copy Return Boot Option to= global ASF Boot Option buffer.

     

    +    CopyMem (&gAsfBootOption,= &BootOption, sizeof (ASF_BOOT_OPTION));

     

    +    gAsfProtocol.BootOption =3D &= amp;gAsfBootOption;

     

    +    // Execute Clear Boot Option = command.

     

    +    BootOption.SubCommand =3D ASF= MSG_SUBCMD_CLR_BOOT_OPTION;

     

    +    BootOption.Version  = ;  =3D 0x10;

     

    +    Length    = ;            =3D 2;<= o:p>

     

    +    mSmBus->Execute (

     

    +        =       mSmBus,

     

    +        =       AsfSlaveAddress,

     

    +        =       ASFMSG_CMD_CONFIG,

     

    +        =       EfiSmbusWriteBlock,

     

    +        =       TRUE,

     

    +        =       &Length,

     

    +        =       &BootOption

     

    +        =       );

     

    +  }

     

    +

     

    +  return Status;

     

    +}

     

    +

     

    +/**

     

    +  This Event Callback processes the request= s at EFI Ready to Boot Event triggered.

     

    +

     

    +  @param[in]  Event   &= nbsp;  A pointer to the Event that triggered the callback.<= /p>

     

    +  @param[in]  Context   = ; A pointer to private data registered with the callback function.

     

    +**/

     

    +VOID

     

    +EFIAPI

     

    +AsfReadyToBootEvent (

     

    +  IN  EFI_EVENT  Event,

     

    +  IN  VOID    &nbs= p;  *Context

     

    +  )

     

    +{

     

    +  // Push System State S0 - "Working&q= uot;.

     

    +  AsfPushSystemState (ASFMSG_SYSTEM_STATE_S= 0);

     

    +

     

    +  gBS->CloseEvent (Event);

     

    +  return;

     

    +}

     

    +

     

    +/**

     

    +    Register callback if Acpi pro= tocol is not ready, else install ASF acpi table directly.

     

    +

     

    +**/

     

    +VOID

     

    +EFIAPI

     

    +InstallAsfAcpiTable (

     

    +  VOID

     

    +  )

     

    +{

     

    +  EFI_STATUS     &= nbsp;         Status;

     

    +  EFI_EVENT     &n= bsp;          Event;

     

    +  VOID      &= nbsp;           &nbs= p;  *Registration;

     

    +  EFI_ACPI_TABLE_PROTOCOL  *AcpiTableP= rotocol;

     

    +

     

    +  Status =3D gBS->LocateProtocol (&g= EfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);

     

    +  if (!EFI_ERROR (Status)) {

     

    +    InstallAsfAcpiTableEvent (NUL= L, NULL);

     

    +  } else {

     

    +    Status =3D gBS->CreateEven= t (

     

    +        =             EVT_NOTI= FY_SIGNAL,

     

    +        =             TPL_CALL= BACK,

     

    +        =             InstallA= sfAcpiTableEvent,

     

    +        =             NULL,

     

    +        =             &Eve= nt

     

    +        =             );<= /o:p>

     

    +

     

    +    if (!EFI_ERROR (Status)) {

     

    +      Status =3D gBS-&g= t;RegisterProtocolNotify (

     

    +        =             &nb= sp; &gEfiAcpiTableProtocolGuid,

     

    +        =             &nb= sp; Event,

     

    +        =             &nb= sp; &Registration

     

    +        =             &nb= sp; );

     

    +

     

    +      if (EFI_ERROR (St= atus)) {

     

    +        gBS-&= gt;CloseEvent (Event);

     

    +      }

     

    +    }

     

    +  }

     

    +

     

    +  return;

     

    +}

     

    +

     

    +/**

     

    +  This is the standard EFI driver entry poi= nt for DXE phase of ASF.

     

    +

     

    +  @param[in] ImageHandle   Image = handle of the loaded driver

     

    +  @param[in] SystemTable   Pointe= r to the System Table

     

    +

     

    +  @retval EFI_SUCCESS   &nbs= p;  This driver initial correctly

     

    +  @retval Others    &nb= sp;      This driver initial fail

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +AsfDxeEntry (

     

    +  IN EFI_HANDLE    &nbs= p;   ImageHandle,

     

    +  IN EFI_SYSTEM_TABLE  *SystemTable

     

    +  )

     

    +{

     

    +  EFI_STATUS     &= nbsp;          Status;

     

    +  EFI_RSC_HANDLER_PROTOCOL  *RscHandle= r;

     

    +  EFI_EVENT     &n= bsp;           AsfEfiRead= yToBootEvent;

     

    +

     

    +  Status =3D gBS->LocateProtocol (&g= EfiSmbusHcProtocolGuid, NULL, (VOID **)&mSmBus);

     

    +  if ( EFI_ERROR (Status)) {

     

    +    return Status;

     

    +  }

     

    +

     

    +  mFixedTargetAddress.SmbusDeviceAddress = =3D PcdGet8 (PcdSmbusSlaveAddressForDashLan) >> 1;

     

    +  if (mFixedTargetAddress.SmbusDeviceAddres= s =3D=3D 0) {

     

    +    return EFI_UNSUPPORTED;<= /o:p>

     

    +  }

     

    +

     

    +  Status =3D AsfGetBootOption (mFixedTarget= Address);

     

    +  if ( EFI_ERROR (Status)) {

     

    +    return Status;

     

    +  }

     

    +

     

    +  InstallAsfAcpiTable ();

     

    +

     

    +  // Send mother board initialization messa= ge.

     

    +  AsfPushSystemErrorProgressEvent (MESSAGE_= ERROR_LEVEL_PROGRESS, MsgMotherBoardInit);

     

    +

     

    +  Status =3D gBS->LocateProtocol (&g= EfiRscHandlerProtocolGuid, NULL, (VOID **)&RscHandler);

     

    +  if (!EFI_ERROR (Status)) {

     

    +    RscHandler->Register (AsfR= scHandlerCallback, TPL_CALLBACK);

     

    +  }

     

    +

     

    +  EfiCreateEventReadyToBootEx (<= /p>

     

    +    TPL_CALLBACK,

     

    +    AsfReadyToBootEvent,

     

    +    NULL,

     

    +    &AsfEfiReadyToBootEvent

     

    +    );

     

    +

     

    +  gBS->InstallProtocolInterface (

     

    +        = &ImageHandle, \

     

    +        = &gAsfProtocolGuid,

     

    +        = EFI_NATIVE_INTERFACE,

     

    +        = &gAsfProtocol

     

    +        = );

     

    +

     

    +  return EFI_SUCCESS;

     

    +}

     

    diff --git a/AsfPkg/Asf/AsfDxe/AsfDxeEvent.c b/As= fPkg/Asf/AsfDxe/AsfDxeEvent.c

    new file mode 100644

    index 000000000000..64265c6d5c3c

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfDxe/AsfDxeEvent.c<= /p>

    @@ -0,0 +1,319 @@

    +/** @file

     

    +  Asf messages define

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +**/

     

    +

     

    +#include <AsfDxe.h>

     

    +

     

    +MESSAGE_DATA_HUB_MAP  mMsgProgressMap[] =3D= {

     

    +  { MsgHddInit,    &nbs= p;      EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENAB= LE             = },

     

    +  { MsgApInit,     = ;       EFI_COMPUTING_UNIT_HOST_PROCESSOR | E= FI_CU_HP_PC_AP_INIT },

     

    +  { MsgUserInitSetup,   &nbs= p; EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP    = ;    },

     

    +  { MsgUsbResourceConfig, EFI_IO_BUS_USB | = EFI_P_PC_ENABLE          =             &nb= sp;  },

     

    +  { MsgPciResourceConfig, EFI_IO_BUS_PCI | = EFI_IOB_PCI_BUS_ENUM         &= nbsp;          },

     

    +  { MsgVideoInit,    &n= bsp;    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_ENABLE =           },

     

    +  { MsgKbcInit,    &nbs= p;      EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE&= nbsp;           &nbs= p;   },

     

    +  { MsgKbcTest,    &nbs= p;      EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_P= C_SELF_TEST    }

     

    +};

     

    +

     

    +MESSAGE_DATA_HUB_MAP  mMsgErrorMap[] =3D {<= o:p>

     

    +  { MsgNoVideo,    EFI_PERIP= HERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED },

     

    +  { MsgKbdFailure, EFI_PERIPHERAL_KEYBOARD = | EFI_P_EC_NOT_DETECTED      },

     

    +  { MsgHddFailure, EFI_PERIPHERAL_FIXED_MED= IA | EFI_P_EC_NOT_DETECTED   }

     

    +};

     

    +

     

    +ASF_MESSAGE  mAsfMessages[] =3D {

     

    +  {

     

    +    MsgHddInit,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_DIS= K,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _HARD_DISK_INITIALIZATION

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgApInit,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_PRO= CESSOR,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _AP_INITIALIZATION

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgUserInitSetup,<= /p>

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_BIO= S,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _SETUP_INITIALIZATION

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgUsbResourceConfig,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_BIO= S,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _USB_RESOURCE_CONFIG

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgPciResourceConfig,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_BIO= S,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _PCI_RESOURCE_CONFIG

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgVideoInit,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_ADD= _IN_CARD,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _VIDEO_INITIALIZATION

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgKbcInit,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_SYS= TEM_BOARD,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _KEYBOARD_INITIALIZATION

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgKbcTest,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_SYS= TEM_BOARD,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _KEYBOARD_TEST

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgMotherBoardInit,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_PROGRESS_ENTRY,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_MONITOR,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_SYS= TEM_BOARD,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _BOARD_INITIALIZATION

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgNoVideo,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_NO_BOOTABLE_MEDIA,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_ADD= _IN_CARD,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _NO_VIDEO

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgKbdFailure,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_ERROR,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_CRITICAL,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_SYS= TEM_BOARD,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _KEYBOARD_FAILURE

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgHddFailure,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_FW_ERROR_PROGRESS,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_ERROR,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_RECOVERABLE,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_DIS= K,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _HARD_DISK_FAILURE

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgChassisIntrusion,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0b, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_CHASSIS_INTRUSION,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_CHASSIS_INTRUSION,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_MONITOR,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_SYS= TEM_BOARD,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED

     

    +    }

     

    +  },

     

    +  {

     

    +    MsgNoBootMedia,

     

    +    {

     

    +      ASFMSG_COMMAND_ME= SSAGING,

     

    +      0x0d, // ByteCoun= t

     

    +      ASFMSG_SUBCOMMAND= _NO_RETRANSMIT,

     

    +      ASFMSG_VERSION_NU= MBER_10,

     

    +      ASFMSG_EVENT_SENS= OR_TYPE_BOOT_ERROR,

     

    +      ASFMSG_EVENT_TYPE= _SENSOR_SPECIFIC,

     

    +      ASFMSG_EVENT_OFFS= ET_SYS_FW_ERROR,

     

    +      ASFMSG_EVENT_SOUR= CE_TYPE_ASF10,

     

    +      ASFMSG_EVENT_SEVE= RITY_NON_RECOVERABLE,

     

    +      ASFMSG_SENSOR_DEV= ICE_UNSPECIFIED,

     

    +      ASFMSG_SENSOR_NUM= BER_UNSPECIFIED,

     

    +      ASFMSG_ENTITY_UNS= PECIFIED,

     

    +      ASFMSG_ENTITY_INS= TANCE_UNSPECIFIED,

     

    +      ASFMSG_EVENT_DATA= 1,

     

    +      ASFMSG_EVENT_DATA= _UNSPECIFIED

     

    +    }

     

    +  }

     

    +};

     

    +

     

    +UINTN  mMsgProgressMapSize =3D sizeof (mMsg= ProgressMap) / sizeof (MESSAGE_DATA_HUB_MAP);

     

    +UINTN  mMsgErrorMapSize    = =3D sizeof (mMsgErrorMap) / sizeof (MESSAGE_DATA_HUB_MAP);

     

    +UINTN  mAsfMessagesSize    = =3D sizeof (mAsfMessages) / sizeof (ASF_MESSAGE);

     

    +

     

    +ASF_MSG_NORETRANSMIT  mAsfSystemState =3D

     

    +{

     

    +  ASFMSG_COMMAND_SYSTEM_STATE,

     

    +  0x3,    // ByteCount<= /o:p>

     

    +  ASFMSG_SUBCOMMAND_SET_SYSTEM_STATE,<= /o:p>

     

    +  ASFMSG_VERSION_NUMBER_10,

     

    +  ASFMSG_SYSTEM_STATE_S0

     

    +};

     

    diff --git a/AsfPkg/Asf/AsfPei/AsfPei.c b/AsfPkg/= Asf/AsfPei/AsfPei.c

    new file mode 100644

    index 000000000000..8b44cd26e0fe

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfPei/AsfPei.c

    @@ -0,0 +1,384 @@

    +/** @file

     

    +  Asf Pei Initialization Driver.=

     

    +

     

    +  Follow Asf spec to send progress or error= message to Smbus device

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +**/

     

    +

     

    +#include <AsfMessages.h>

     

    +#include <Base.h>

     

    +#include <Ppi/ReportStatusCodeHandler.h>

     

    +#include <Ppi/MemoryDiscovered.h>

     

    +#include <Ppi/Smbus2.h>

     

    +#include <Library/DebugLib.h>

     

    +#include <Library/PeiServicesLib.h>

     

    +#include <Pi/PiStatusCode.h>

     

    +

     

    +/**

     

    +  This Event Notify processes the ASF reque= st at Memory Initial Completed.

     

    +

     

    +  @param[in] PeiServices   &= nbsp;      General purpose services available to e= very PEIM.

     

    +  @param[in] NotifyDescriptor  &n= bsp;  The notification structure this PEIM registered on install.=

     

    +  @param[in] Ppi    &nb= sp;            = The memory discovered PPI.  Not used.

     

    +

     

    +  @retval EFI_SUCCESS   &nbs= p;         Succeeds.

     

    +  @retval EFI_UNSUPPORTED   =       Push Event error.

     

    +

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +MsgMemoryInitCompleted (

     

    +  IN EFI_PEI_SERVICES   &nbs= p;       **PeiServices,

     

    +  IN EFI_PEI_NOTIFY_DESCRIPTOR  *Notif= yDescriptor,

     

    +  IN VOID     &nbs= p;            &= nbsp;    *Ppi

     

    +  );

     

    +

     

    +STATIC EFI_PEI_NOTIFY_DESCRIPTOR  mMemoryDi= scoveredNotifyDes =3D {

     

    +  EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | = EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,

     

    +  &gEfiPeiMemoryDiscoveredPpiGuid,=

     

    +  MsgMemoryInitCompleted

     

    +};

     

    +

     

    +ASF_MSG_NORETRANSMIT  mAsfSystemStateWorkin= g =3D \

     

    +{

     

    +  ASFMSG_COMMAND_SYSTEM_STATE,

     

    +  0x3,    // ByteCount<= /o:p>

     

    +  ASFMSG_SUBCOMMAND_SET_SYSTEM_STATE,<= /o:p>

     

    +  ASFMSG_VERSION_NUMBER_10,

     

    +  ASFMSG_SYSTEM_STATE_S0

     

    +};

     

    +

     

    +ASF_MSG_NORETRANSMIT  mMsgStopTimer =3D

     

    +{

     

    +  ASFMSG_COMMAND_MANAGEMENT_CONTROL,

     

    +  0x2,    // ByteCount<= /o:p>

     

    +  ASFMSG_SUBCOMMAND_STOP_WATCH_DOG,

     

    +  ASFMSG_VERSION_NUMBER_10

     

    +};

     

    +

     

    +// 3.1.5.3 System Firmware Progress Events<= /o:p>

     

    +ASF_MSG_NORETRANSMIT  mMsgBiosPresent =3D

     

    +{

     

    +  ASFMSG_COMMAND_MESSAGING,

     

    +  0xd,    // ByteCount<= /o:p>

     

    +  ASFMSG_SUBCOMMAND_NO_RETRANSMIT,

     

    +  ASFMSG_VERSION_NUMBER_10,

     

    +  ASFMSG_EVENT_SENSOR_TYPE_ENTITY_PRESENCE,=

     

    +  ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC,

     

    +  ASFMSG_EVENT_OFFSET_ENTITY_PRESENT,<= /o:p>

     

    +  ASFMSG_EVENT_SOURCE_TYPE_ASF10,

     

    +  ASFMSG_EVENT_SEVERITY_NON_CRITICAL,<= /o:p>

     

    +  ASFMSG_SENSOR_DEVICE_UNSPECIFIED,

     

    +  ASFMSG_SENSOR_NUMBER_UNSPECIFIED,

     

    +  ASFMSG_ENTITY_BIOS,

     

    +  ASFMSG_ENTITY_INSTANCE_UNSPECIFIED,<= /o:p>

     

    +  ASFMSG_EVENT_DATA1,

     

    +  ASFMSG_EVENT_DATA_UNSPECIFIED<= /p>

     

    +};

     

    +

     

    +// Starting memory initialization and test.=

     

    +ASF_MSG_NORETRANSMIT  mMsgMemoryInit =3D

     

    +{

     

    +  ASFMSG_COMMAND_MESSAGING,

     

    +  0xd,    // ByteCount<= /o:p>

     

    +  ASFMSG_SUBCOMMAND_NO_RETRANSMIT,

     

    +  ASFMSG_VERSION_NUMBER_10,

     

    +  ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRES= S,

     

    +  ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC,

     

    +  ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY= ,

     

    +  ASFMSG_EVENT_SOURCE_TYPE_ASF10,

     

    +  ASFMSG_EVENT_SEVERITY_NON_CRITICAL,<= /o:p>

     

    +  ASFMSG_SENSOR_DEVICE_UNSPECIFIED,

     

    +  ASFMSG_SENSOR_NUMBER_UNSPECIFIED,

     

    +  ASFMSG_ENTITY_MEMORY_DEVICE,

     

    +  ASFMSG_ENTITY_INSTANCE_UNSPECIFIED,<= /o:p>

     

    +  ASFMSG_EVENT_DATA1,

     

    +  ASFMSG_EVENT_DATA_MEMORY_INITIALIZATION

     

    +};

     

    +

     

    +// Memory initialized and tested.

     

    +ASF_MSG_NORETRANSMIT  mMsgMemoryInitialized= =3D

     

    +{

     

    +  ASFMSG_COMMAND_MESSAGING,

     

    +  0xd,    // ByteCount<= /o:p>

     

    +  ASFMSG_SUBCOMMAND_NO_RETRANSMIT,

     

    +  ASFMSG_VERSION_NUMBER_10,

     

    +  ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRES= S,

     

    +  ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC,

     

    +  ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_EXIT,=

     

    +  ASFMSG_EVENT_SOURCE_TYPE_ASF10,

     

    +  ASFMSG_EVENT_SEVERITY_NON_CRITICAL,<= /o:p>

     

    +  ASFMSG_SENSOR_DEVICE_UNSPECIFIED,

     

    +  ASFMSG_SENSOR_NUMBER_UNSPECIFIED,

     

    +  ASFMSG_ENTITY_MEMORY_DEVICE,

     

    +  ASFMSG_ENTITY_INSTANCE_UNSPECIFIED,<= /o:p>

     

    +  ASFMSG_EVENT_DATA1,

     

    +  ASFMSG_EVENT_DATA_MEMORY_INITIALIZATION

     

    +};

     

    +

     

    +ASF_MSG_NORETRANSMIT  mAsfmsgCacheInit =3D<= o:p>

     

    +{

     

    +  ASFMSG_COMMAND_MESSAGING,

     

    +  0xd,    // ByteCount<= /o:p>

     

    +  ASFMSG_SUBCOMMAND_NO_RETRANSMIT,

     

    +  ASFMSG_VERSION_NUMBER_10,

     

    +  ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRES= S,

     

    +  ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC,

     

    +  ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTRY= ,

     

    +  ASFMSG_EVENT_SOURCE_TYPE_ASF10,

     

    +  ASFMSG_EVENT_SEVERITY_MONITOR,=

     

    +  ASFMSG_SENSOR_DEVICE_UNSPECIFIED,

     

    +  ASFMSG_SENSOR_NUMBER_UNSPECIFIED,

     

    +  ASFMSG_ENTITY_PROCESSOR,

     

    +  ASFMSG_ENTITY_INSTANCE_UNSPECIFIED,<= /o:p>

     

    +  ASFMSG_EVENT_DATA1,

     

    +  ASFMSG_EVENT_DATA_CACHE_INITIALIZATION

     

    +};

     

    +

     

    +ASF_MSG_NORETRANSMIT  mAsfmsgMemoryMissing = =3D

     

    +{

     

    +  ASFMSG_COMMAND_MESSAGING,

     

    +  0xd,    // ByteCount<= /o:p>

     

    +  ASFMSG_SUBCOMMAND_NO_RETRANSMIT,

     

    +  ASFMSG_VERSION_NUMBER_10,

     

    +  ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRES= S,

     

    +  ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC,

     

    +  ASFMSG_EVENT_OFFSET_SYS_FW_ERROR,

     

    +  ASFMSG_EVENT_SOURCE_TYPE_ASF10,

     

    +  ASFMSG_EVENT_SEVERITY_NON_CRITICAL,<= /o:p>

     

    +  ASFMSG_SENSOR_DEVICE_UNSPECIFIED,

     

    +  ASFMSG_SENSOR_NUMBER_UNSPECIFIED,

     

    +  ASFMSG_ENTITY_MEMORY_DEVICE,

     

    +  ASFMSG_ENTITY_INSTANCE_UNSPECIFIED,<= /o:p>

     

    +  ASFMSG_EVENT_DATA1,

     

    +  ASFMSG_EVENT_DATA_NO_MEMORY

     

    +};

     

    +

     

    +/**

     

    +  This function pushes the PEI System Firmw= are Progress Events.

     

    +

     

    +  @param[in] SmBus    &= nbsp;          Pointer to the = SmBus PPI.

     

    +  @param[in] FixedTargetAddress  Devic= e address

     

    +  @param[in] MessageErrorLevel   = Progress or error or system management message Type.

     

    +  @param[in] MessageBuffer   = ;    Pointer to the Event Data Buffer.

     

    +

     

    +**/

     

    +VOID

     

    +EFIAPI

     

    +AsfPushProgressMessage (

     

    +  IN EFI_PEI_SMBUS2_PPI   &n= bsp;    *SmBus,

     

    +  IN EFI_SMBUS_DEVICE_ADDRESS  FixedTa= rgetAddress,

     

    +  IN UINT32     &n= bsp;            = ;  MessageErrorLevel,

     

    +  IN UINT8     &nb= sp;            =    *MessageBuffer

     

    +  )

     

    +{

     

    +  EFI_STATUS  Status;

     

    +  UINTN      = Length;

     

    +

     

    +  if (MessageErrorLevel & PcdGet32 (Pcd= AsfMessageErrorLevel)) {

     

    +    Length =3D ((ASF_MSG_NORETRAN= SMIT *)MessageBuffer)->ByteCount;

     

    +    Status =3D SmBus->Execute = (

     

    +        =             &nb= sp; SmBus,

     

    +        =             &nb= sp; FixedTargetAddress,

     

    +        =              &n= bsp;((ASF_MSG_NORETRANSMIT *)MessageBuffer)->Command,

     

    +        =             &nb= sp; EfiSmbusWriteBlock,

     

    +        =             &nb= sp; TRUE,

     

    +        =             &nb= sp; &Length,

     

    +        =             &nb= sp; (UINT8 *)(MessageBuffer+2)

     

    +        =             &nb= sp; );

     

    +    if (EFI_ERROR (Status)) {

     

    +      DEBUG ((DEBUG_ERR= OR, "Push alert message fail, status =3D %r\n", Status));

     

    +    }

     

    +  }

     

    +

     

    +  return;

     

    +}

     

    +

     

    +/**

     

    +  This callback registered by Report Status= Code Ppi for Memory Missing PET.

     

    +

     

    +  @param[in] PeiServices   &= nbsp;    General purpose services available to every PEIM.

     

    +  @param[in] Type    &n= bsp;          Indicates the ty= pe of status code being reported.

     

    +  @param[in] Value    &= nbsp;         Describes the current= status of a hardware or software entity.

     

    +        =             &nb= sp;           This includ= ed information about the class and subclass that is

     

    +        =             &nb= sp;           used to cla= ssify the entity as well as an operation.

     

    +  @param[in] Instance   &nbs= p;       The enumeration of a hardware or sof= tware entity within the system.

     

    +        =             &nb= sp;           Valid insta= nce numbers start with 1.

     

    +  @param[in] CallerId   &nbs= p;       This optional parameter may be used = to identify the caller.

     

    +        =             &nb= sp;           This parame= ter allows the status code driver to apply different

     

    +        =             &nb= sp;           rules to di= fferent callers.

     

    +  @param[in] Data    &n= bsp;          This optional pa= rameter may be used to pass additional data.

     

    +

     

    +  @retval EFI_SUCCESS   &nbs= p;       Always return EFI_SUCCESS=

     

    +

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +AsfPeiStatusCodeCallBack (

     

    +  IN  EFI_PEI_SERVICES  &nbs= p;    **PeiServices,

     

    +  IN  EFI_STATUS_CODE_TYPE  = Type,

     

    +  IN  EFI_STATUS_CODE_VALUE  Valu= e,

     

    +  IN  UINT32    &n= bsp;            Inst= ance,

     

    +  IN  EFI_GUID    =            *CallerId,

     

    +  IN  EFI_STATUS_CODE_DATA  = *Data

     

    +  )

     

    +{

     

    +  EFI_STATUS     &= nbsp;          Status;

     

    +  EFI_PEI_SMBUS2_PPI    = ;    *SmBus;

     

    +  EFI_SMBUS_DEVICE_ADDRESS  FixedTarge= tAddress;

     

    +

     

    +  FixedTargetAddress.SmbusDeviceAddress =3D= PcdGet8 (PcdSmbusSlaveAddressForDashLan) >> 1;

     

    +  if (FixedTargetAddress.SmbusDeviceAddress= =3D=3D 0) {

     

    +    return EFI_SUCCESS;

     

    +  }

     

    +

     

    +  Status =3D PeiServicesLocatePpi (

     

    +        =      &gEfiPeiSmbus2PpiGuid,

     

    +        =      0,

     

    +        =      NULL,

     

    +        =      (VOID **)&SmBus

     

    +        =      );

     

    +  if ( EFI_ERROR (Status)) {

     

    +    return EFI_SUCCESS;

     

    +  }

     

    +

     

    +  if ((Type & EFI_STATUS_CODE_TYPE_MASK= ) =3D=3D EFI_ERROR_CODE) {

     

    +    if ((Value =3D=3D (EFI_SOFTWA= RE_PEI_CORE | EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED)) ||

     

    +        (Valu= e =3D=3D (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_DETECTED)))

     

    +    {

     

    +      // Error message = - Memory Missing.

     

    +      AsfPushProgressMe= ssage (SmBus, FixedTargetAddress, MESSAGE_ERROR_LEVEL_ERROR, (UINT8 *)&= mAsfmsgMemoryMissing);

     

    +    }

     

    +  }

     

    +

     

    +  if (((Type & EFI_STATUS_CODE_TYPE_MAS= K) =3D=3D EFI_PROGRESS_CODE) &&

     

    +      (Value =3D=3D (EF= I_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACHE_INIT)))

     

    +  {

     

    +    // Progress message - Cache i= nitialization.

     

    +    AsfPushProgressMessage (SmBus= , FixedTargetAddress, MESSAGE_ERROR_LEVEL_PROGRESS, (UINT8 *)&mAsfmsgCa= cheInit);

     

    +  }

     

    +

     

    +  return EFI_SUCCESS;

     

    +}

     

    +

     

    +/**

     

    +  This send memory initialized message afte= r memory discovered.

     

    +

     

    +  @param[in] PeiServices   &= nbsp;      General purpose services available to e= very PEIM.

     

    +  @param[in] NotifyDescriptor  &n= bsp;  The notification structure this PEIM registered on install.=

     

    +  @param[in] Ppi    &nb= sp;            = The memory discovered PPI.

     

    +

     

    +  @retval EFI_SUCCESS   &nbs= p;         Always return EFI_SUCCES= S

     

    +

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +MsgMemoryInitCompleted (

     

    +  IN EFI_PEI_SERVICES   &nbs= p;       **PeiServices,

     

    +  IN EFI_PEI_NOTIFY_DESCRIPTOR  *Notif= yDescriptor,

     

    +  IN VOID     &nbs= p;            &= nbsp;    *Ppi

     

    +  )

     

    +{

     

    +  EFI_STATUS     &= nbsp;          Status;

     

    +  EFI_PEI_SMBUS2_PPI    = ;    *SmBus;

     

    +  EFI_BOOT_MODE    &nbs= p;        BootMode;

     

    +  EFI_SMBUS_DEVICE_ADDRESS  FixedTarge= tAddress;

     

    +

     

    +  FixedTargetAddress.SmbusDeviceAddress =3D= PcdGet8 (PcdSmbusSlaveAddressForDashLan) >> 1;

     

    +  if (FixedTargetAddress.SmbusDeviceAddress= =3D=3D 0) {

     

    +    return EFI_SUCCESS;

     

    +  }

     

    +

     

    +  Status =3D PeiServicesLocatePpi (

     

    +        =      &gEfiPeiSmbus2PpiGuid,

     

    +        =      0,

     

    +        =      NULL,

     

    +        =      (VOID **)&SmBus

     

    +        =      );

     

    +  if ( EFI_ERROR (Status)) {

     

    +    return EFI_SUCCESS;

     

    +  }

     

    +

     

    +  // Progress message - Completed memory in= itialization and test.

     

    +  AsfPushProgressMessage (SmBus, FixedTarge= tAddress, MESSAGE_ERROR_LEVEL_PROGRESS, (UINT8 *)&mMsgMemoryInitialized= );

     

    +

     

    +  // Get Boot Path.

     

    +  Status =3D PeiServicesGetBootMode (&B= ootMode);

     

    +  if (!EFI_ERROR (Status) && (BootM= ode =3D=3D BOOT_ON_S3_RESUME)) {

     

    +    // Push System State Working = if S3 resuming.

     

    +    AsfPushProgressMessage (=

     

    +      SmBus,=

     

    +      FixedTargetAddres= s,

     

    +      MESSAGE_ERROR_LEV= EL_SYSTEM_MANAGEMENT,

     

    +      (UINT8 *)&mAs= fSystemStateWorking

     

    +      );

     

    +  }

     

    +

     

    +  return EFI_SUCCESS;

     

    +}

     

    +

     

    +/**

     

    +  Asf PEI module entry point

     

    +

     

    +  @param[in]  FileHandle  &n= bsp;        FileHandle  Handle of t= he file being invoked.

     

    +  @param[in]  PeiServices  &= nbsp;       Describes the list of possible PE= I Services.

     

    +

     

    +  @retval     EFI_SUCCE= SS          The PEIM initializ= ed successfully.

     

    +

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +AsfPeiEntry (

     

    +  IN       EF= I_PEI_FILE_HANDLE  FileHandle,

     

    +  IN CONST EFI_PEI_SERVICES  &nbs= p;  **PeiServices

     

    +  )

     

    +{

     

    +  EFI_STATUS     &= nbsp;          Status;

     

    +  EFI_PEI_SMBUS2_PPI    = ;    *SmBus;

     

    +  EFI_PEI_RSC_HANDLER_PPI   *RscH= ndrPpi;

     

    +  EFI_SMBUS_DEVICE_ADDRESS  FixedTarge= tAddress;

     

    +

     

    +  FixedTargetAddress.SmbusDeviceAddress =3D= PcdGet8 (PcdSmbusSlaveAddressForDashLan) >> 1;

     

    +  if (FixedTargetAddress.SmbusDeviceAddress= =3D=3D 0) {

     

    +    return EFI_UNSUPPORTED;<= /o:p>

     

    +  }

     

    +

     

    +  Status =3D PeiServicesLocatePpi (

     

    +        =      &gEfiPeiSmbus2PpiGuid,

     

    +        =      0,

     

    +        =      NULL,

     

    +        =      (VOID **)&SmBus

     

    +        =      );

     

    +  if (EFI_ERROR (Status)) {

     

    +    return Status;

     

    +  }

     

    +

     

    +  //

     

    +  // If the managed client's firmware suppo= rts a system boot-failure watchdog timer,

     

    +  // the firmware issues the Stop Watchdog = Timer command to stop the timer that is

     

    +  // automatically started by the alert-sen= ding device at power-on reset.

     

    +  //

     

    +  AsfPushProgressMessage (SmBus, FixedTarge= tAddress, MESSAGE_ERROR_LEVEL_SYSTEM_MANAGEMENT, (UINT8 *)&mMsgStopTime= r);

     

    +

     

    +  // Progress message - BIOS Present.<= /o:p>

     

    +  AsfPushProgressMessage (SmBus, FixedTarge= tAddress, MESSAGE_ERROR_LEVEL_PROGRESS, (UINT8 *)&mMsgBiosPresent);

     

    +

     

    +  // Progress message - Started memory init= ialization and test.

     

    +  AsfPushProgressMessage (SmBus, FixedTarge= tAddress, MESSAGE_ERROR_LEVEL_PROGRESS, (UINT8 *)&mMsgMemoryInit);=

     

    +

     

    +  PeiServicesNotifyPpi (&mMemoryDiscove= redNotifyDes);

     

    +

     

    +  Status =3D PeiServicesLocatePpi (

     

    +        =      &gEfiPeiRscHandlerPpiGuid,

     

    +        =      0,

     

    +        =      NULL,

     

    +        =      (VOID **)&RscHndrPpi

     

    +         = ;    );

     

    +  if (!EFI_ERROR (Status)) {

     

    +    RscHndrPpi->Register ((EFI= _PEI_RSC_HANDLER_CALLBACK)AsfPeiStatusCodeCallBack);

     

    +  }

     

    +

     

    +  return EFI_SUCCESS;

     

    +}

     

    diff --git a/AsfPkg/Library/AsfAcpiTableLib/AsfAc= piTableLib.c b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.c<= /p>

    new file mode 100644

    index 000000000000..7476dbf52752

    --- /dev/null

    +++ b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTable= Lib.c

    @@ -0,0 +1,210 @@

    +/** @file

     

    +  Asf Acpi table

     

    +

     

    +  Install Asf Acpi table

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +**/

     

    +

     

    +#include <Library/UefiBootServicesTableLib.h&= gt;

     

    +#include <Library/DebugLib.h>

     

    +#include <Protocol/AcpiSystemDescriptionTable= .h>

     

    +#include <IndustryStandard/AlertStandardForma= tTable.h>

     

    +#include <IndustryStandard/Acpi.h>

     

    +#include <Protocol/AcpiTable.h>=

     

    +

     

    +// ASF Table Definitions

     

    +// Below array size define should follow AsfAcpi= Table setting

     

    +#define ASF_RCTL_DEVICES_ARRAY_LENGTH  4

     

    +#define ASF_ADDR_DEVICE_ARRAY_LENGTH  = 11

     

    +

     

    +#pragma pack(push,1)

     

    +

     

    +//

     

    +// Alert Remote Control System Actions.

     

    +//

     

    +typedef struct {

     

    +  EFI_ACPI_ASF_RCTL    =        AsfRctl;

     

    +  EFI_ACPI_ASF_CONTROLDATA   = ; ControlDataArray[ASF_RCTL_DEVICES_ARRAY_LENGTH];

     

    +} ACPI_ASF_RCTL_ALL;

     

    +

     

    +//

     

    +// SmBus Devices with fixed addresses.

     

    +//

     

    +typedef struct {

     

    +  EFI_ACPI_ASF_ADDR    AsfAd= dr;

     

    +  UINT8      =           FixedSmBusAddresses[= ASF_ADDR_DEVICE_ARRAY_LENGTH];

     

    +} ACPI_ASF_ADDR_ALL;

     

    +

     

    +//

     

    +// ACPI 1.0 Structure for ASF Descriptor Table.<= o:p>

     

    +//

     

    +typedef struct {

     

    +  EFI_ACPI_SDT_HEADER    Hea= der;

     

    +  EFI_ACPI_ASF_INFO    =   AsfInfo;

     

    +  ACPI_ASF_RCTL_ALL    =   AsfRctlAll;

     

    +  EFI_ACPI_ASF_RMCP    =   AsfRmcp;

     

    +  ACPI_ASF_ADDR_ALL    =   AsfAddrAll;

     

    +} ASF_DESCRIPTION_TABLE;

     

    +

     

    +#pragma pack(pop)

     

    +

     

    +#define EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE_REVIS= ION  0x20

     

    +

     

    +ASF_DESCRIPTION_TABLE  AsfAcpiTable =3D {

     

    +  {

     

    +    EFI_ACPI_ASF_DESCRIPTION_TABL= E_SIGNATURE,

     

    +    sizeof (ASF_DESCRIPTION_TABLE= ),

     

    +    EFI_ACPI_1_0_ASF_DESCRIPTION_= TABLE_REVISION,

     

    +    0,    &nb= sp;            =             &nb= sp;            =     //  Checksum

     

    +

     

    +    // OEM identification

     

    +    { 'O',  'E',  'M',&= nbsp; '_', 'I', 'D' },

     

    +

     

    +    // OEM table identification

     

    +    { 'D',  '8',  '6',&= nbsp; '5', 'G', 'C', 'H', ' '},   // OEM table identification

     

    +

     

    +    1,    &nb= sp;            =             &nb= sp;            =     // OEM revision number

     

    +    ((((('M' << 8) + 'S') &= lt;< 8) + 'F') << 8) + 'T', // ASL compiler vendor ID

     

    +    1000000   &nbs= p;            &= nbsp;           &nbs= p;            // ASL= compiler revision number

     

    +  },

     

    +  {

     

    +    //

     

    +    // EFI_ACPI_ASF_INFO

     

    +    //

     

    +    {

     

    +      0x00,  =             &nb= sp;       // Type "ASF_INFO"

     

    +      0x00,  =             &nb= sp;       // Reserved

     

    +      sizeof (EFI_ACPI_= ASF_INFO) // Length

     

    +    },

     

    +    0x05,    =            // Min Watchdo= g Reset Value

     

    +    0xFF,    =            // Min ASF Sen= sor poll Wait Time

     

    +    0x0001,   &nbs= p;         // System ID<= /p>

     

    +    0x57010000,   =       // IANA Manufacture ID for Intel<= /p>

     

    +    0x00,    =            // Feature Fla= g

     

    +    {

     

    +      0x00,  =            // Reserved

     

    +      0x00,<= /p>

     

    +      0x00

     

    +    } // Reserved

     

    +  },

     

    +  {

     

    +    //

     

    +    // ACPI_ASF_RCTL_ALL

     

    +    //

     

    +    {

     

    +      //

     

    +      // EFI_ACPI_ASF_R= CTL

     

    +      //

     

    +      {

     

    +        0x02,=             &nb= sp;         // Type "ASF_RCTL&= quot;

     

    +        0x00,=             &nb= sp;         // Reserved<= /p>

     

    +        sizeo= f (ACPI_ASF_RCTL_ALL) // Length

     

    +      },

     

    +      0x04,  =            // Number of C= ontrols

     

    +      0x04,  =            // Array Eleme= nt Length

     

    +      0x0000  = ;          // Reserved

     

    +    },

     

    +    {

     

    +      //

     

    +      // EFI_ACPI_ASF_C= ONTROLDATA

     

    +      //

     

    +      { 0x00, 0x88, 0x0= 0, 0x03 }, // Control 0 --> Reset system

     

    +      { 0x01, 0x88, 0x0= 0, 0x02 }, // Control 1 --> Power Off system

     

    +      { 0x02, 0x88, 0x0= 0, 0x01 }, // Control 2 --> Power On system

     

    +      { 0x03, 0x88, 0x0= 0, 0x04 }  // Control 3 --> Power Cycle Reset (off then on)

     

    +    }

     

    +  },

     

    +  {

     

    +    //

     

    +    // EFI_ACPI_ASF_RMCP

     

    +    //

     

    +    {

     

    +      0x03,  =             &nb= sp;       // Type "ASF_RMCP"

     

    +      0x00,  =             &nb= sp;       // Reserved

     

    +      sizeof (EFI_ACPI_= ASF_RMCP) // Length

     

    +    },

     

    +    {

     

    +      // Remote Control= Capabilities supported Bit Masks

     

    +      0x00,  =             &nb= sp;        // System Firmware Capabiliti= es Bit Mask byte 1

     

    +      0x00,  =             &nb= sp;        // System Firmware Capabiliti= es Bit Mask byte 2

     

    +      0x00,  =             &nb= sp;        // System Firmware Capabiliti= es Bit Mask byte 3

     

    +      0x00,  =             &nb= sp;        // System Firmware Capabiliti= es Bit Mask byte 4

     

    +      0x00,  =             &nb= sp;        // Special Commands Bit Mask = byte 1

     

    +      0x00,  =             &nb= sp;        // Special Commands Bit Mask = byte 2

     

    +      0xF0  &= nbsp;           &nbs= p;         // System Capabilities B= it Mask (Supports Reset,

     

    +        =             &nb= sp;            = // Power-Up, Power-Down, Power-Cycle Reset for

     

    +        =             &nb= sp;            = // compat and secure port.

     

    +    },

     

    +    0x00,    =             &nb= sp;      // Boot Option Complete Code

     

    +    0x57010000,   =             &nb= sp; // IANA ID for Intel Manufacturer

     

    +    0x00,    =             &nb= sp;      // Special Command

     

    +    { 0x00, 0x00 },  &n= bsp;          // Special Comma= nd Parameter

     

    +    { 0x00, 0x00 },  &n= bsp;          // Boot Options<= o:p>

     

    +    { 0x00, 0x00 }  &nb= sp;           // OEM Para= meters

     

    +  },

     

    +  {

     

    +    //

     

    +    // ACPI_ASF_ADDR_ALL

     

    +    //

     

    +    {

     

    +      //

     

    +      // EFI_ACPI_ASF_A= DDR

     

    +      //

     

    +      {

     

    +        0x84,=             &nb= sp;         // Type "ASF_ADDR&= quot;, last record

     

    +        0x00,=             &nb= sp;         // Reserved<= /p>

     

    +        sizeo= f (ACPI_ASF_ADDR_ALL) // Length

     

    +      },

     

    +      0x00,  =             &nb= sp;         // SEEPROM Address=

     

    +      ASF_ADDR_DEVICE_A= RRAY_LENGTH // Number Of Devices

     

    +    },

     

    +    //

     

    +    // Fixed SMBus Address

     

    +    //

     

    +    {

     

    +      0x5C, 0x68, 0x88,= 0xC2, 0xD2,

     

    +      0xDC, 0xA0, 0xA2,= 0xA4, 0xA6,

     

    +      0xC8

     

    +    }

     

    +  }

     

    +};

     

    +

     

    +/**

     

    +  This function install the ASF acpi Table.=

     

    +

     

    +  @param[in]  Event   &= nbsp; A pointer to the Event that triggered the callback.

     

    +  @param[in]  Context   A po= inter to private data registered with the callback function.

     

    +**/

     

    +VOID

     

    +EFIAPI

     

    +InstallAsfAcpiTableEvent  (

     

    +  IN EFI_EVENT  Event,

     

    +  IN VOID     &nbs= p; *Context

     

    +  )

     

    +{

     

    +  EFI_STATUS     &= nbsp;         Status;

     

    +  UINTN      =             &nb= sp; TableHandle =3D 0;

     

    +  EFI_ACPI_TABLE_PROTOCOL  *AcpiTableP= rotocol;

     

    +

     

    +  Status =3D gBS->LocateProtocol (&g= EfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);

     

    +

     

    +  if ( EFI_ERROR (Status)) {

     

    +    DEBUG ((DEBUG_ERROR, "Lo= cate Acpi protocol %r Error\n", Status));

     

    +    return;

     

    +  }

     

    +

     

    +  if (Event !=3D NULL) {

     

    +    gBS->CloseEvent (Event);

     

    +  }

     

    +

     

    +  AcpiTableProtocol->InstallAcpiTable (<= o:p>

     

    +        =             &nb= sp;  AcpiTableProtocol,

     

    +        =             &nb= sp;  &AsfAcpiTable,

     

    +        =             &nb= sp;  AsfAcpiTable.Header.Length,

     

    +        =             &nb= sp;  &TableHandle

     

    +        =             &nb= sp;  );

     

    +

     

    +  return;

     

    +}

     

    diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.h b/AsfPkg/= Asf/AsfDxe/AsfDxe.h

    new file mode 100644

    index 000000000000..7f59fc27d86d

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfDxe/AsfDxe.h

    @@ -0,0 +1,67 @@

    +/** @file

     

    +  Asf Dxe driver which is used for sending = event record log to NIC or receiving

     

    +  boot option command from NIC and provide = in Asf Dxe protocol.

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +**/

     

    +

     

    +#ifndef __ASF_DXE_H__

     

    +#define __ASF_DXE_H__

     

    +

     

    +#include <Pi/PiStatusCode.h>

     

    +#include <Protocol/AsfProtocol.h>

     

    +#include <IndustryStandard/SmBus.h>

     

    +#include <Protocol/SmbusHc.h>

     

    +#include <Protocol/ReportStatusCodeHandler.h&= gt;

     

    +#include <Library/BaseLib.h>

     

    +#include <Library/UefiLib.h>

     

    +#include <Library/DebugLib.h>

     

    +#include <Library/UefiBootServicesTableLib.h&= gt;

     

    +#include <Library/UefiRuntimeServicesTableLib= .h>

     

    +#include <Library/BaseMemoryLib.h>

     

    +#include <Library/PrintLib.h>

     

    +#include <Protocol/AcpiTable.h>=

     

    +#include <Library/AsfAcpiTableLib.h><= /o:p>

     

    +#include <AsfMessages.h>

     

    +

     

    +extern MESSAGE_DATA_HUB_MAP   &nb= sp; mMsgProgressMap[];

     

    +extern MESSAGE_DATA_HUB_MAP   &nb= sp; mMsgErrorMap[];

     

    +extern ASF_MESSAGE     =          mAsfMessages[];=

     

    +extern UINTN      =             &nb= sp; mMsgProgressMapSize;

     

    +extern UINTN      =             &nb= sp; mMsgErrorMapSize;

     

    +extern UINTN      =             &nb= sp; mAsfMessagesSize;

     

    +extern ASF_MSG_NORETRANSMIT   &nb= sp; mAsfSystemState;

     

    +

     

    +/**

     

    +  This function pushes the DXE System Firmw= are Events.

     

    +

     

    +  @param[in] Command    = ;  Command of System Firmware Events.

     

    +  @param[in] Length    =    Length of the data in bytes.

     

    +  @param[in] AsfEvent   &nbs= p; System Firmware Events Command.

     

    +

     

    +  @retval EFI_SUCCESS   &nbs= p; Push Event successfully.

     

    +  @retval EFI_UNSUPPORTED Push Event error.=

     

    +**/

     

    +EFI_STATUS

     

    +EFIAPI

     

    +AsfPushEvent  (

     

    +  IN  UINT8  Command,<= /p>

     

    +  IN  UINTN  Length,

     

    +  IN  UINT8  *AsfEvent=

     

    +  );

     

    +

     

    +/**

     

    +  This function install the ASF acpi Table.=

     

    +

     

    +  @param[in]  Event   &= nbsp; A pointer to the Event that triggered the callback.

     

    +  @param[in]  Context   A po= inter to private data registered with the callback function.

     

    +**/

     

    +VOID

     

    +EFIAPI

     

    +InstallAsfAcpiTableEvent  (

     

    +  IN EFI_EVENT  Event,

     

    +  IN VOID     &nbs= p; *Context

     

    +  );

     

    +

     

    +#endif //__ASF_DXE_H__

     

    diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.inf b/AsfPk= g/Asf/AsfDxe/AsfDxe.inf

    new file mode 100644

    index 000000000000..247fc6ca9da6

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfDxe/AsfDxe.inf

    @@ -0,0 +1,52 @@

    +## @file

     

    +#  Asf Dxe driver which is used for sending= event record log to NIC or receiving

     

    +#  boot option command from NIC and provide= in Asf Dxe protocol.

     

    +#

     

    +#  Copyright (c) 1985 - 2022, AMI. All righ= ts reserved.<BR>

     

    +#  SPDX-License-Identifier: BSD-2-Clause-Pa= tent

     

    +##

     

    +

     

    +[Defines]

     

    +  INF_VERSION     =       =3D 0x00010005

     

    +  BASE_NAME     &n= bsp;       =3D AsfDxe

     

    +  MODULE_UNI_FILE    &n= bsp;  =3D AsfDxe.uni

     

    +  FILE_GUID     &n= bsp;       =3D ED7AD1A2-1427-41EC-A71E-32EC9A= 1549E8

     

    +  MODULE_TYPE     =       =3D DXE_DRIVER

     

    +  VERSION_STRING    &nb= sp;   =3D 1.0

     

    +  ENTRY_POINT     =       =3D AsfDxeEntry

     

    +

     

    +[Sources]

     

    +  AsfDxe.c

     

    +  AsfDxe.h

     

    +  AsfDxeEvent.c

     

    +

     

    +[Packages]

     

    +  MdePkg/MdePkg.dec

     

    +  AsfPkg/AsfPkg.dec

     

    +

     

    +[LibraryClasses]

     

    +  UefiDriverEntryPoint

     

    +  UefiRuntimeServicesTableLib

     

    +  DebugLib

     

    +  BaseMemoryLib

     

    +  PrintLib

     

    +  AsfAcpiTableLib

     

    +  UefiLib

     

    +

     

    +[Protocols]

     

    +  gEfiRscHandlerProtocolGuid

     

    +  gAsfProtocolGuid    &= nbsp;           # Produce=

     

    +  gEfiAcpiTableProtocolGuid

     

    +  gEfiSmbusHcProtocolGuid

     

    +

     

    +[Guids]

     

    +

     

    +[FixedPcd]

     

    +  gAsfPkgTokenSpaceGuid.PcdSmbusSlaveAddres= sForDashLan

     

    +  gAsfPkgTokenSpaceGuid.PcdAsfMessageErrorL= evel

     

    +

     

    +[Depex]

     

    +  TRUE

     

    +

     

    +[UserExtensions.TianoCore."ExtraFiles"= ]

     

    +  AsfDxeExtra.uni

     

    diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.uni b/AsfPk= g/Asf/AsfDxe/AsfDxe.uni

    new file mode 100644

    index 000000000000..02ff1f72931d

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfDxe/AsfDxe.uni

    @@ -0,0 +1,15 @@

    +// /** @file

     

    +// Asf DXE Module

     

    +//

     

    +// Follow Asf spec to send progress or error mes= sage to Smbus device

     

    +//

     

    +// Copyright (c) 1985 - 2022, AMI. All rights re= served.<BR>

     

    +// SPDX-License-Identifier: BSD-2-Clause-Patent<= o:p>

     

    +//

     

    +// **/

     

    +

     

    +

     

    +#string STR_MODULE_ABSTRACT   &nb= sp;         #language en-US "A= sf DXE Module"

     

    +

     

    +#string STR_MODULE_DESCRIPTION   =        #language en-US "Follow Asf spec = to send progress or error message to Smbus device."

     

    +

     

    diff --git a/AsfPkg/Asf/AsfDxe/AsfDxeExtra.uni b/= AsfPkg/Asf/AsfDxe/AsfDxeExtra.uni

    new file mode 100644

    index 000000000000..dbc747257c85

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfDxe/AsfDxeExtra.uni

    @@ -0,0 +1,13 @@

    +// /** @file

     

    +// Asf Dxe Module

     

    +//

     

    +// Follow Asf spec to send progress or error mes= sage to Smbus device

     

    +//

     

    +// Copyright (c) 1985 - 2022, AMI. All rights re= served.<BR>

     

    +// SPDX-License-Identifier: BSD-2-Clause-Patent<= o:p>

     

    +//

     

    +// **/

     

    +

     

    +#string STR_PROPERTIES_MODULE_NAME

     

    +#language en-US

     

    +"Asf DXE"

     

    diff --git a/AsfPkg/Asf/AsfPei/AsfPei.inf b/AsfPk= g/Asf/AsfPei/AsfPei.inf

    new file mode 100644

    index 000000000000..0569a86e0925

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfPei/AsfPei.inf

    @@ -0,0 +1,57 @@

    +## @file

     

    +#  Asf PEIM

     

    +#

     

    +#  Follow Asf spec to send progress or erro= r message to Smbus device

     

    +#

     

    +#  Copyright (c) 1985 - 2022, AMI. All righ= ts reserved.<BR>

     

    +#  SPDX-License-Identifier: BSD-2-Clause-Pa= tent

     

    +##

     

    +

     

    +[Defines]

     

    +  INF_VERSION     =             &nb= sp;  =3D 0x00010005

     

    +  BASE_NAME     &n= bsp;            = ;    =3D AsfPei

     

    +  MODULE_UNI_FILE    &n= bsp;           =3D AsfPei= .uni

     

    +  FILE_GUID     &n= bsp;            = ;    =3D D2603B09-B8A2-4837-AA1E-EAE8E4DF78E7

     

    +  MODULE_TYPE     =             &nb= sp;  =3D PEIM

     

    +  VERSION_STRING    &nb= sp;            =3D 1= .0

     

    +  ENTRY_POINT     =             &nb= sp;  =3D AsfPeiEntry

     

    +

     

    +#

     

    +# The following information is for reference onl= y and not required by the build tools.

     

    +#

     

    +#  VALID_ARCHITECTURES   &nb= sp;       =3D IA32 X64 EBC

     

    +#

     

    +

     

    +[Sources]

     

    +  AsfPei.c

     

    +

     

    +[Packages]

     

    +  MdePkg/MdePkg.dec

     

    +  AsfPkg/AsfPkg.dec

     

    +

     

    +[LibraryClasses]

     

    +  PeimEntryPoint

     

    +  PeiServicesLib

     

    +  DebugLib

     

    +

     

    +[Guids]

     

    +

     

    +[Ppis]

     

    +  gEfiPeiRscHandlerPpiGuid

     

    +  gEfiPeiMemoryDiscoveredPpiGuid=

     

    +  gEfiPeiSmbus2PpiGuid

     

    +

     

    +[FeaturePcd]

     

    +

     

    +[Pcd]

     

    +

     

    +[FixedPcd]

     

    +  gAsfPkgTokenSpaceGuid.PcdSmbusSlaveAddres= sForDashLan

     

    +  gAsfPkgTokenSpaceGuid.PcdAsfMessageErrorL= evel

     

    +

     

    +[Depex]

     

    +  gEfiPeiSmbus2PpiGuid

     

    +

     

    +[UserExtensions.TianoCore."ExtraFiles"= ]

     

    +  AsfPeiExtra.uni

     

    +

     

    diff --git a/AsfPkg/Asf/AsfPei/AsfPei.uni b/AsfPk= g/Asf/AsfPei/AsfPei.uni

    new file mode 100644

    index 000000000000..646712917e12

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfPei/AsfPei.uni

    @@ -0,0 +1,15 @@

    +// /** @file

     

    +// Asf PEI Module

     

    +//

     

    +// Follow Asf spec to send progress or error mes= sage to Smbus device

     

    +//

     

    +// Copyright (c) 1985 - 2022, AMI. All rights re= served.<BR>

     

    +// SPDX-License-Identifier: BSD-2-Clause-Patent<= o:p>

     

    +//

     

    +// **/

     

    +

     

    +

     

    +#string STR_MODULE_ABSTRACT   &nb= sp;         #language en-US "A= sf PEI Module"

     

    +

     

    +#string STR_MODULE_DESCRIPTION   =        #language en-US "Follow Asf spec = to send progress or error message to Smbus device."

     

    +

     

    diff --git a/AsfPkg/Asf/AsfPei/AsfPeiExtra.uni b/= AsfPkg/Asf/AsfPei/AsfPeiExtra.uni

    new file mode 100644

    index 000000000000..72819f49862c

    --- /dev/null

    +++ b/AsfPkg/Asf/AsfPei/AsfPeiExtra.uni

    @@ -0,0 +1,13 @@

    +// /** @file

     

    +// Asf PEI Module

     

    +//

     

    +// Follow Asf spec to send progress or error mes= sage to Smbus device

     

    +//

     

    +// Copyright (c) 1985 - 2022, AMI. All rights re= served.<BR>

     

    +// SPDX-License-Identifier: BSD-2-Clause-Patent<= o:p>

     

    +//

     

    +// **/

     

    +

     

    +#string STR_PROPERTIES_MODULE_NAME

     

    +#language en-US

     

    +"Asf PEI"

     

    diff --git a/AsfPkg/AsfPkg.dec b/AsfPkg/AsfPkg.de= c

    new file mode 100644

    index 000000000000..b7bca0ac2231

    --- /dev/null

    +++ b/AsfPkg/AsfPkg.dec

    @@ -0,0 +1,47 @@

    +## @file

     

    +# This package defines Asf specific interfaces a= nd library classes.

     

    +#

     

    +# Copyright (c) 1985 - 2022, AMI. All rights res= erved.<BR>

     

    +# SPDX-License-Identifier: BSD-2-Clause-Patent

     

    +##

     

    +

     

    +[Defines]

     

    +  DEC_SPECIFICATION    =             &nb= sp;  =3D 0x00010005

     

    +  PACKAGE_NAME     = ;            &n= bsp;      =3D AsfPkg

     

    +  PACKAGE_GUID     = ;             &= nbsp;     =3D 025BE9BD-50B3-4139-9A70-4336E277339A=

     

    +  PACKAGE_VERSION    &n= bsp;            = ;    =3D 1.0

     

    +

     

    +[Includes]

     

    +  Include

     

    +

     

    +[LibraryClasses]

     

    +  ##  @libraryclass  Install Asf = Acpi table

     

    +  ##

     

    +  AsfAcpiTableLib|AsfPkg\Library\AsfAcpiTab= leLib\AsfAcpiTableLib.inf

     

    +

     

    +[Guids]

     

    +  gAsfPkgTokenSpaceGuid    = =3D { 0xa12d9aa4, 0xe69b, 0x425c, { 0x96, 0xc5, 0x41, 0x8d, 0xb1, 0xd0, 0xb= 9, 0x4f }}

     

    +

     

    +[Ppis]

     

    +

     

    +[Protocols]

     

    +  ## Asf protocol GUID

     

    +  # Include/Protocol/AmiAsfProtocol.h<= /o:p>

     

    +  gAsfProtocolGuid    &= nbsp;           &nbs= p; =3D  { 0xdec89827, 0x8a7e, 0x45e0, { 0xbc, 0xb5, 0xd5, 0x3b, 0x46, = 0x14, 0xad, 0xb8 } }

     

    +

     

    +[PcdsFeatureFlag]

     

    +

     

    +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDy= namic, PcdsDynamicEx]

     

    +  ## Specify the Dash lan SmBus slave addre= ss.

     

    +  # @Prompt Slave address of Dash lan<= /o:p>

     

    +  gAsfPkgTokenSpaceGuid.PcdSmbusSlaveAddres= sForDashLan|0x0|UINT8|0x00000001

     

    +

     

    +  ## This flag is used to control which mes= sage would be send.

     

    +  #  If enabled, Asf driver will send = message to device.<BR><BR>

     

    +  #   BIT0  - Progress messa= ge is enabled.<BR>

     

    +  #   BIT1  - Error message = is enabled.<BR>

     

    +  #   BIT2  - System menagem= ent message is enabled.<BR>

     

    +  #   Other - reserved=

     

    +  # @Prompt Message level

     

    +  gAsfPkgTokenSpaceGuid.PcdAsfMessageErrorL= evel|0x7|UINT32|0x00000002

     

    +

     

    diff --git a/AsfPkg/AsfPkg.dsc b/AsfPkg/AsfPkg.ds= c

    new file mode 100644

    index 000000000000..acbede1ca02d

    --- /dev/null

    +++ b/AsfPkg/AsfPkg.dsc

    @@ -0,0 +1,59 @@

    +## @file

     

    +# Asf Package

     

    +#

     

    +# Copyright (c) 1985 - 2022, AMI. All rights res= erved.<BR>

     

    +# SPDX-License-Identifier: BSD-2-Clause-Patent

     

    +##

     

    +

     

    +[Defines]

     

    +  PLATFORM_NAME    &nbs= p;        =3D AsfPkg

     

    +  PLATFORM_GUID    &nbs= p;        =3D 79D22E13-3F30-470A-AF9D-B8= 0CB4324379

     

    +  PLATFORM_VERSION    &= nbsp;     =3D 0.10

     

    +  DSC_SPECIFICATION    =      =3D 0x00010005

     

    +  OUTPUT_DIRECTORY    &= nbsp;     =3D Build/AsfPkg

     

    +  SUPPORTED_ARCHITECTURES   =3D I= A32|X64

     

    +  BUILD_TARGETS    &nbs= p;        =3D DEBUG|RELEASE|NOOPT

     

    +

     

    +

     

    +[LibraryClasses]

     

    +  BaseLib|MdePkg/Library/BaseLib/BaseLib.in= f

     

    +  BaseMemoryLib|MdePkg/Library/BaseMemoryLi= b/BaseMemoryLib.inf

     

    +  DebugLib|MdePkg/Library/BaseDebugLibNull/= BaseDebugLibNull.inf

     

    +  SerialPortLib|MdePkg/Library/BaseSerialPo= rtLibNull/BaseSerialPortLibNull.inf

     

    +  DebugPrintErrorLevelLib|MdePkg/Library/Ba= seDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf

     

    +  DevicePathLib|MdePkg/Library/UefiDevicePa= thLib/UefiDevicePathLib.inf

     

    +  PcdLib|MdePkg/Library/BasePcdLibNull/Base= PcdLibNull.inf

     

    +  PrintLib|MdePkg/Library/BasePrintLib/Base= PrintLib.inf

     

    +  UefiLib|MdePkg/Library/UefiLib/UefiLib.in= f

     

    +  UefiRuntimeServicesTableLib|MdePkg/Librar= y/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf

     

    +  UefiBootServicesTableLib|MdePkg/Library/U= efiBootServicesTableLib/UefiBootServicesTableLib.inf

     

    +  UefiDriverEntryPoint|MdePkg/Library/UefiD= riverEntryPoint/UefiDriverEntryPoint.inf

     

    +  PeimEntryPoint|MdePkg/Library/PeimEntryPo= int/PeimEntryPoint.inf

     

    +  PeiServicesLib|MdePkg/Library/PeiServices= Lib/PeiServicesLib.inf

     

    +  PerformanceLib|MdePkg/Library/BasePerform= anceLibNull/BasePerformanceLibNull.inf

     

    +  ReportStatusCodeLib|MdePkg/Library/BaseRe= portStatusCodeLibNull/BaseReportStatusCodeLibNull.inf

     

    +  RegisterFilterLib|MdePkg/Library/Register= FilterLibNull/RegisterFilterLibNull.inf

     

    +

     

    +

     

    +[LibraryClasses.common.SEC]

     

    +  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib= .inf

     

    +  PeiServicesTablePointerLib|MdePkg/Library= /PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf=

     

    +  MemoryAllocationLib|MdePkg/Library/PeiMem= oryAllocationLib/PeiMemoryAllocationLib.inf

     

    +

     

    +[LibraryClasses.common.PEIM]

     

    +  MemoryAllocationLib|MdePkg/Library/PeiMem= oryAllocationLib/PeiMemoryAllocationLib.inf

     

    +  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib= .inf

     

    +

     

    +[LibraryClasses.IA32.PEIM, LibraryClasses.X64.PE= IM]

     

    +  PeiServicesTablePointerLib|MdePkg/Library= /PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf=

     

    +

     

    +[LibraryClasses.common.DXE_DRIVER]

     

    +  MemoryAllocationLib|MdePkg/Library/UefiMe= moryAllocationLib/UefiMemoryAllocationLib.inf

     

    +  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib= .inf

     

    +  AsfAcpiTableLib|AsfPkg\Library\AsfAcpiTab= leLib\AsfAcpiTableLib.inf

     

    +

     

    +[Components]

     

    +

     

    +[Components.IA32, Components.X64]

     

    +  AsfPkg/Asf/AsfPei/AsfPei.inf

     

    +  AsfPkg/Asf/AsfDxe/AsfDxe.inf

     

    diff --git a/AsfPkg/Include/AsfMessages.h b/AsfPk= g/Include/AsfMessages.h

    new file mode 100644

    index 000000000000..6e79f4993f33

    --- /dev/null

    +++ b/AsfPkg/Include/AsfMessages.h

    @@ -0,0 +1,104 @@

    +/** @file

     

    +  Asf message format define.

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +

     

    +  @par Revision Reference:

     

    +  Format defined in Asf 2.0 Specification.<= o:p>

     

    +**/

     

    +

     

    +#ifndef __ASF_MESSAGES_H__

     

    +#define __ASF_MESSAGES_H__

     

    +

     

    +#include <Base.h>

     

    +#include <IndustryStandard/Asf.h>

     

    +

     

    +#define MESSAGE_ERROR_LEVEL_PROGRESS  =          BIT0

     

    +#define MESSAGE_ERROR_LEVEL_ERROR  &nb= sp;           BIT1

     

    +#define MESSAGE_ERROR_LEVEL_SYSTEM_MANAGEMENT&nb= sp; BIT2

     

    +

     

    +#pragma pack(push,1)

     

    +

     

    +/**

     

    +  This message causes the alert-sending dev= ice to transmit a single,

     

    +  un-retransmitted PET frame. If the alert-= sending device is either temporarily

     

    +  unable to handle the message or unable to= send the requested PET frame

     

    +  because the device's transport media is d= own, the device must NACK the message

     

    +  according to SMBUS_2.0 definitions; other= wise, the device sends the

     

    +  single-frame transmission.

     

    +**/

     

    +typedef struct {

     

    +  UINT8    Command; &nb= sp;       ///< Message Command.=

     

    +  UINT8    ByteCount; &= nbsp;     ///< Length of the data in bytes.

     

    +  UINT8    SubCommand; =      ///< SubCommand No Retransmit.

     

    +  UINT8    Version; &nb= sp;       ///< Version Number.<= /p>

     

    +  UINT8    EventSensorType; = ///< Event Sensor Type.

     

    +  UINT8    EventType; &= nbsp;     ///< Event Type.

     

    +  UINT8    EventOffset; = ;    ///< Event Offset.

     

    +  UINT8    EventSourceType; = ///< Describes the originator of the event.

     

    +  UINT8    EventSeverity;&nb= sp;  ///< The severity of the event

     

    +  UINT8    SensorDevice;&nbs= p;   ///< The Sensor Device that caused the event

     

    +  UINT8    SensorNumber;&nbs= p;   ///< Identify a given instance of a sensor relative to th= e Sensor Device.

     

    +  UINT8    Entity; &nbs= p;        ///< Indicates the platform= device or subsystem associated with the event.

     

    +  UINT8    EntityInstance;&n= bsp; ///< Identifies which unique device is associated with the event.

     

    +  UINT8    EventData1;<= /o:p>

     

    +  UINT8    EventData2;<= /o:p>

     

    +  UINT8    EventData3;<= /o:p>

     

    +  UINT8    EventData4;<= /o:p>

     

    +  UINT8    EventData5;<= /o:p>

     

    +} ASF_MSG_NORETRANSMIT;

     

    +

     

    +/**

     

    +  This is the ASF START WatchDog Timer Data= structure.

     

    +

     

    +**/

     

    +typedef struct {

     

    +  UINT8    Command;

     

    +  UINT8    ByteCount;

     

    +  UINT8    SubCommand;<= /o:p>

     

    +  UINT8    Version;

     

    +} ASF_STOP_WATCHDOG;

     

    +

     

    +/**

     

    +  This is the ASF Message Type structure.

     

    +

     

    +**/

     

    +typedef enum {

     

    +  MsgHddInit,

     

    +  MsgApInit,

     

    +  MsgUserInitSetup,

     

    +  MsgUsbResourceConfig,

     

    +  MsgPciResourceConfig,

     

    +  MsgVideoInit,

     

    +  MsgKbcInit,

     

    +  MsgKbcTest,

     

    +  MsgMotherBoardInit,

     

    +  MsgNoVideo,

     

    +  MsgKbdFailure,

     

    +  MsgHddFailure,

     

    +  MsgChassisIntrusion,

     

    +  MsgNoBootMedia

     

    +} ASF_MESSAGE_TYPE;

     

    +

     

    +/**

     

    +  This is the Message Data Hub Map Structur= e.

     

    +

     

    +**/

     

    +typedef struct {

     

    +  ASF_MESSAGE_TYPE    &= nbsp;    MessageType;

     

    +  EFI_STATUS_CODE_VALUE    S= tatusCode;

     

    +} MESSAGE_DATA_HUB_MAP;

     

    +

     

    +/**

     

    +  This is the ASF System Firmware Event Str= ucture.

     

    +

     

    +**/

     

    +typedef struct {

     

    +  ASF_MESSAGE_TYPE    &= nbsp;   Type;

     

    +  ASF_MSG_NORETRANSMIT    Me= ssage;

     

    +} ASF_MESSAGE;

     

    +

     

    +#pragma pack(pop)

     

    +

     

    +#endif //__ASF_MESSAGES_H__

     

    diff --git a/AsfPkg/Include/IndustryStandard/Asf.= h b/AsfPkg/Include/IndustryStandard/Asf.h

    new file mode 100644

    index 000000000000..69b6a0230d4f

    --- /dev/null

    +++ b/AsfPkg/Include/IndustryStandard/Asf.h<= /o:p>

    @@ -0,0 +1,145 @@

    +/** @file

     

    +  Asf message commands byte define.

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +

     

    +  @par Revision Reference:

     

    +  Data defined in Asf 2.0 Specification.

     

    +**/

     

    +

     

    +#ifndef __ASF_H__

     

    +#define __ASF_H__

     

    +

     

    +#include <Base.h>

     

    +

     

    +//

     

    +// Boot option messages

     

    +//

     

    +#define ASFMSG_CMD_CONFIG    = ;          0x3   // = ASF Configuration

     

    +#define ASFMSG_SUBCMD_CLR_BOOT_OPTION  0x15=   // Clear Boot Options

     

    +#define ASFMSG_SUBCMD_RET_BOOT_OPTION  0x16=   // Return Boot Options

     

    +#define ASFMSG_SUBCMD_NO_BOOT_OPTION  = 0x17  // No Boot Options

     

    +

     

    +//

     

    +// System states

     

    +//

     

    +#define ASFMSG_SYSTEM_STATE_S0  0 &nbs= p;           // S0/G0 &qu= ot;Working"

     

    +#define ASFMSG_SYSTEM_STATE_S1  1 &nbs= p;           // S1

     

    +#define ASFMSG_SYSTEM_STATE_S2  2 &nbs= p;           // S2

     

    +#define ASFMSG_SYSTEM_STATE_S3  3 &nbs= p;           // S3

     

    +#define ASFMSG_SYSTEM_STATE_S4  4 &nbs= p;           // S4

     

    +#define ASFMSG_SYSTEM_STATE_S5  5 &nbs= p;           // S5/G2 &qu= ot;Soft-off"

     

    +

     

    +//

     

    +// Asf version

     

    +//

     

    +#define ASFMSG_VERSION_NUMBER_10  &nbs= p;   0x10

     

    +

     

    +//

     

    +// System firmware capabilities Bit

     

    +//

     

    +#define ASF_BOP_BIT_FORCE_PROGRESS_EVENT &n= bsp;      BIT12

     

    +

     

    +//

     

    +// Asf message command

     

    +//

     

    +#define ASFMSG_COMMAND_SYSTEM_STATE  &= nbsp;            0x1=

     

    +#define ASFMSG_COMMAND_MANAGEMENT_CONTROL &= nbsp;       0x2

     

    +#define ASFMSG_COMMAND_MESSAGING  &nbs= p;            &= nbsp;  0x4

     

    +

     

    +//

     

    +// Asf message subcommand

     

    +//

     

    +#define ASFMSG_SUBCOMMAND_STOP_WATCH_DOG &n= bsp;        0x14

     

    +#define ASFMSG_SUBCOMMAND_NO_RETRANSMIT &nb= sp;         0x16

     

    +#define ASFMSG_SUBCOMMAND_SET_SYSTEM_STATE =        0x18

     

    +

     

    +//

     

    +// Asf message event sensor type

     

    +//

     

    +#define ASFMSG_EVENT_SENSOR_TYPE_CHASSIS_INTRUSI= ON  0x5

     

    +#define ASFMSG_EVENT_SENSOR_TYPE_FW_ERROR_PROGRE= SS  0xF

     

    +#define ASFMSG_EVENT_SENSOR_TYPE_BOOT_ERROR = ;        0x1E

     

    +#define ASFMSG_EVENT_SENSOR_TYPE_ENTITY_PRESENCE=     0x25

     

    +

     

    +//

     

    +// Asf message event type

     

    +//

     

    +#define ASFMSG_EVENT_TYPE_SENSOR_SPECIFIC &= nbsp;         0x6F

     

    +

     

    +//

     

    +// Asf message event offset

     

    +//

     

    +#define ASFMSG_EVENT_OFFSET_ENTITY_PRESENT =          0x0

     

    +

     

    +#define ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_ENTR= Y   0x2

     

    +#define ASFMSG_EVENT_OFFSET_SYS_FW_PROGRESS_EXIT=     0x82

     

    +#define ASFMSG_EVENT_OFFSET_SYS_FW_ERROR &n= bsp; 0x0

     

    +

     

    +#define ASFMSG_EVENT_OFFSET_NO_BOOTABLE_MEDIA&nb= sp;      0x0

     

    +#define ASFMSG_EVENT_OFFSET_CHASSIS_INTRUSION&nb= sp;      0x0

     

    +

     

    +//

     

    +// Asf message event source type

     

    +//

     

    +#define ASFMSG_EVENT_SOURCE_TYPE_ASF10 &nbs= p;            0x68

     

    +

     

    +//

     

    +// Asf message event severity

     

    +//

     

    +#define ASFMSG_EVENT_SEVERITY_MONITOR  = ;             0= x1

     

    +#define ASFMSG_EVENT_SEVERITY_NON_CRITICAL =          0x8

     

    +#define ASFMSG_EVENT_SEVERITY_CRITICAL &nbs= p;            0x10

     

    +#define ASFMSG_EVENT_SEVERITY_NON_RECOVERABLE&nb= sp;      0x20

     

    +

     

    +//

     

    +// Asf message sensor device

     

    +//

     

    +#define ASFMSG_SENSOR_DEVICE_UNSPECIFIED &n= bsp;          0xFF<= /p>

     

    +

     

    +//

     

    +// Asf message sensor number

     

    +//

     

    +#define ASFMSG_SENSOR_NUMBER_UNSPECIFIED &n= bsp;          0xFF<= /p>

     

    +

     

    +//

     

    +// Asf message Entity

     

    +//

     

    +

     

    +#define ASFMSG_ENTITY_UNSPECIFIED  &nb= sp;            =     0x0

     

    +#define ASFMSG_ENTITY_PROCESSOR   = ;            &n= bsp;     0x3

     

    +#define ASFMSG_ENTITY_DISK   &nbs= p;            &= nbsp;         0x4

     

    +#define ASFMSG_ENTITY_SYSTEM_BOARD  &n= bsp;            = ;   0x7

     

    +#define ASFMSG_ENTITY_ADD_IN_CARD  &nb= sp;            =     0xB

     

    +#define ASFMSG_ENTITY_BIOS   &nbs= p;            &= nbsp;         0x22

     

    +#define ASFMSG_ENTITY_MEMORY_DEVICE  &= nbsp;           &nbs= p;  0x20

     

    +

     

    +//

     

    +// Asf message entity instance

     

    +//

     

    +#define ASFMSG_ENTITY_INSTANCE_UNSPECIFIED =          0x0

     

    +

     

    +//

     

    +// Asf message event data

     

    +//

     

    +#define ASFMSG_EVENT_DATA1   &nbs= p;            &= nbsp;         0x40

     

    +#define ASFMSG_EVENT_DATA_UNSPECIFIED  = ;             0= x0

     

    +#define ASFMSG_EVENT_DATA_MEMORY_INITIALIZATION&= nbsp;    0x1

     

    +#define ASFMSG_EVENT_DATA_HARD_DISK_INITIALIZATI= ON  0x2

     

    +#define ASFMSG_EVENT_DATA_AP_INITIALIZATION = ;        0x3

     

    +#define ASFMSG_EVENT_DATA_SETUP_INITIALIZATION&n= bsp;     0x5

     

    +#define ASFMSG_EVENT_DATA_USB_RESOURCE_CONFIG&nb= sp;      0x6

     

    +#define ASFMSG_EVENT_DATA_PCI_RESOURCE_CONFIG&nb= sp;      0x7

     

    +#define ASFMSG_EVENT_DATA_VIDEO_INITIALIZATION&n= bsp;     0x9

     

    +#define ASFMSG_EVENT_DATA_CACHE_INITIALIZATION&n= bsp;     0xA

     

    +#define ASFMSG_EVENT_DATA_KEYBOARD_INITIALIZATIO= N   0xC

     

    +#define ASFMSG_EVENT_DATA_BOARD_INITIALIZATION&n= bsp;     0x14

     

    +#define ASFMSG_EVENT_DATA_KEYBOARD_TEST &nb= sp;           0x17

     

    +

     

    +#define ASFMSG_EVENT_DATA_NO_MEMORY  &= nbsp;           &nbs= p;  0x1

     

    +#define ASFMSG_EVENT_DATA_HARD_DISK_FAILURE = ;        0x3

     

    +#define ASFMSG_EVENT_DATA_KEYBOARD_FAILURE =          0x7

     

    +#define ASFMSG_EVENT_DATA_NO_VIDEO  &n= bsp;            = ;   0xA

     

    +

     

    +#endif //__ASF_H__

     

    diff --git a/AsfPkg/Include/Library/AsfAcpiTableL= ib.h b/AsfPkg/Include/Library/AsfAcpiTableLib.h

    new file mode 100644

    index 000000000000..4b1d687825ff

    --- /dev/null

    +++ b/AsfPkg/Include/Library/AsfAcpiTableLib.h

    @@ -0,0 +1,26 @@

    +/** @file

     

    +  Provides services to create Asf Acpi tabl= e.

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +**/

     

    +

     

    +#ifndef __ASF_ACPI_TABLE_LIB_H__

     

    +#define __ASF_ACPI_TABLE_LIB_H__

     

    +

     

    +#include <Uefi.h>

     

    +

     

    +/**

     

    +  This function install the ASF acpi Table.=

     

    +

     

    +  @param[in]  Event   &= nbsp; A pointer to the Event that triggered the callback.

     

    +  @param[in]  Context   A po= inter to private data registered with the callback function.

     

    +**/

     

    +VOID

     

    +EFIAPI

     

    +InstallAsfAcpiTableEvent  (

     

    +  IN EFI_EVENT  Event,

     

    +  IN VOID     &nbs= p; *Context

     

    +  );

     

    +

     

    +#endif

     

    diff --git a/AsfPkg/Include/Protocol/AsfProtocol.= h b/AsfPkg/Include/Protocol/AsfProtocol.h

    new file mode 100644

    index 000000000000..d3af0fba73bd

    --- /dev/null

    +++ b/AsfPkg/Include/Protocol/AsfProtocol.h<= /o:p>

    @@ -0,0 +1,57 @@

    +/** @file

     

    +  Asf protocol define.

     

    +

     

    +  Copyright (c) 1985 - 2022, AMI. All right= s reserved.<BR>

     

    +  SPDX-License-Identifier: BSD-2-Clause-Pat= ent

     

    +**/

     

    +

     

    +#ifndef __ASF_PROTOCOL_H__

     

    +#define __ASF_PROTOCOL_H__

     

    +

     

    +#include <IndustryStandard/SmBus.h>

     

    +

     

    +#define ASF_PROTOCOL_GUID \

     

    +  { \

     

    +    0xdec89827, 0x8a7e, 0x45e0, {= 0xbc, 0xb5, 0xd5, 0x3b, 0x46, 0x14, 0xad, 0xb8 } \

     

    +  }

     

    +

     

    +#pragma pack(push, 1)

     

    +

     

    +/**

     

    +  This is the ASF Boot Option data structur= e.

     

    +

     

    +**/

     

    +typedef struct {

     

    +  UINT8     SubCommand;=

     

    +  UINT8     Version;

     

    +  UINT32    IanaId;

     

    +  UINT8     SpecialComm= and;

     

    +  UINT16    SpecCmdParameter= ;

     

    +  UINT16    BootOptionBit;

     

    +  UINT16    OemParameter;

     

    +} ASF_BOOT_OPTION;

     

    +

     

    +/**

     

    +  This is the ASF PUSH EVENT Structure.

     

    +

     

    +**/

     

    +typedef EFI_STATUS (EFIAPI *ASF_PUSH_EVENT)(

     

    +        =             &nb= sp;            =            IN UINT8 Comma= nd,

     

    +        =             &nb= sp;            =            IN UINTN Lengt= h,

     

    +        =             &nb= sp;            =            IN UINT8 *ASFE= vent

     

    +        =              &n= bsp;            = ;          );<= /p>

     

    +

     

    +/**

     

    +  This is the AMI ASF Protocol Structure.

     

    +

     

    +**/

     

    +typedef struct {

     

    +  ASF_PUSH_EVENT     Pu= shEvent;

     

    +  ASF_BOOT_OPTION    *BootOp= tion;

     

    +} ASF_PROTOCOL;

     

    +

     

    +#pragma pack(pop)

     

    +

     

    +extern EFI_GUID  gAsfProtocolGuid;

     

    +

     

    +#endif //__ASF_PROTOCOL_H__

     

    diff --git a/AsfPkg/Library/AsfAcpiTableLib/AsfAc= piTableLib.inf b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.inf

    new file mode 100644

    index 000000000000..ca90d02f005b

    --- /dev/null

    +++ b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTable= Lib.inf

    @@ -0,0 +1,30 @@

    +## @file

     

    +#  Asf Acpi table Library instance that cre= ate Asf Acpi table

     

    +#

     

    +#  Copyright (c) 1985 - 2022, AMI. All righ= ts reserved.<BR>

     

    +#  SPDX-License-Identifier: BSD-2-Clause-Pa= tent

     

    +##

     

    +

     

    +[Defines]

     

    +  INF_VERSION     =             &nb= sp;  =3D 0x00010005

     

    +  BASE_NAME     &n= bsp;            = ;    =3D AsfAcpiTableLib

     

    +  MODULE_UNI_FILE    &n= bsp;           =3D AsfAcp= iTableLib.uni

     

    +  FILE_GUID     &n= bsp;            = ;    =3D 9A0EC995-0F1A-444C-BA02-8C3F0482AE8C

     

    +  MODULE_TYPE     =             &nb= sp;  =3D DXE_DRIVER

     

    +  VERSION_STRING    &nb= sp;            =3D 1= .0

     

    +  LIBRARY_CLASS    &nbs= p;             = =3D AsfAcpiTableLib | DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_D= RIVER

     

    +

     

    +[Sources]

     

    +  AsfAcpiTableLib.c

     

    +

     

    +[Packages]

     

    +  MdePkg/MdePkg.dec

     

    +  MdeModulePkg/MdeModulePkg.dec<= /p>

     

    +

     

    +[Protocols]

     

    +  gEfiAcpiTableProtocolGuid  &nbs= p;            &= nbsp;     ## CONSUMES

     

    +

     

    +[LibraryClasses]

     

    +  BaseLib

     

    +  DebugLib

     

    +

     

    diff --git a/AsfPkg/Library/AsfAcpiTableLib/AsfAc= piTableLib.uni b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.uni

    new file mode 100644

    index 000000000000..681458140452

    --- /dev/null

    +++ b/AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTable= Lib.uni

    @@ -0,0 +1,15 @@

    +// /** @file

     

    +// Asf Acpi table

     

    +//

     

    +// Install Asf Acpi table

     

    +//

     

    +// Copyright (c) 1985 - 2022, AMI. All rights re= served.<BR>

     

    +// SPDX-License-Identifier: BSD-2-Clause-Patent<= o:p>

     

    +//

     

    +// **/

     

    +

     

    +

     

    +#string STR_MODULE_ABSTRACT   &nb= sp;         #language en-US "A= sf Acpi table"

     

    +

     

    +#string STR_MODULE_DESCRIPTION   =        #language en-US "Install Asf Acpi= table."

     

    +

     

    --

    2.36.0.windows.1

    -The information contained in this message may be= confidential and proprietary to American Megatrends (AMI). This communicat= ion is intended to be read only by the individual or entity to whom it is a= ddressed or by their designee. If the reader of this message is not the intended recipient, you are on notic= e that any distribution of this message, in any form, is strictly prohibite= d. Please promptly notify the sender by reply e-mail or by telephone at 770= -246-8600, and then delete or destroy all copies of the transmission.

--_000_SA1PR11MB58011A7BF531167677B7D0A0D06D9SA1PR11MB5801namp_--