From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.82]) by mx.groups.io with SMTP id smtpd.web08.22183.1659940209145743223 for ; Sun, 07 Aug 2022 23:30:09 -0700 Authentication-Results: mx.groups.io; dkim=fail, err=mail: missing word in phrase: charset not supported: "iso-2022-jp"; spf=pass (domain: ami.com, ip: 40.107.244.82, mailfrom: crystallee@ami.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OS7IQwuUtWIws9jgn57tdUw8xXVDW5ZnvYX87GX1avCdZ/fFRChFFQVfmGg7vN5FfSAXeCfxpdV7xJVSk6jKIBOkK84Q0VZQ0MKtMAsE7YGSNifbGevQ8Ya6fWfBmhTzLKDASKKvy0fL/39TCZxBj1C+xh3hwKlOJSl4UzQlk1taZiE2ODrEys830pViNiom85ekDvnnvb3YS1Ib7vEzALWGrBrnWbeE8levTd69HvrWtCnOYc39UR7yTHGj+O97N1QyDitumCeDt8OjZ0w9615scNL9YQV/nWfK84w2d8OrEAKrBKkmYoOKcdxJ3LkQKpcmmxwjcFGZS9lOswToaA== 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=yLfNOHhJO9qMN5wS/IcTGW7AoazaH0r4eJbrfEpbCnA=; b=LSmlbydA/D3bpOdfIZc67vcIzN8U8OAHYs0WV+rdZPcVCsDIVZsNPVKtj1HMfU+901IKVJuWqTe5GkHhSSozrQcAzZDX83DvuALSgc+d/u0+7WKeI/N0ZvB4pP+tIjQ/fQuLoq3RnSZtRwSSEf+OV7v9xa2A18zSbQuIuVRW7M8AH/QRry/rOG+Bp0qX71PlgM0qfNshslS44E17uPRzaZokqfXfYDIkPjRCgGsXEhBzOi3j5PxOyyzHHcDvZAJ6/GSALg1nI/+UbAG20gbTp18QwZfSgGk2xJNgeCxV5WqOAVysxjzTDSblAaf7v1LZUGAV+5r37OW8yUNVB4mL8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ami.com; dmarc=pass action=none header.from=ami.com; dkim=pass header.d=ami.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ami.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yLfNOHhJO9qMN5wS/IcTGW7AoazaH0r4eJbrfEpbCnA=; b=LJHVrm/d682kkKAYGa+APc6RAMuS5p/6o8yoxHLthclgUvZiVFhXzKagzlX3AIuCM6cubS5ZUL7BDqmsbM/7NUeSR3t5cDutb4X87x80JS3XduTrNc9uL0jzePlsl31qtBL+XXdj+Clybcf3A7zQk7V6CvQ8YWfJU4ymJc8XdR4= Received: from DS7PR10MB5278.namprd10.prod.outlook.com (2603:10b6:5:3a5::9) by BYAPR10MB3221.namprd10.prod.outlook.com (2603:10b6:a03:14f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Mon, 8 Aug 2022 06:30:04 +0000 Received: from DS7PR10MB5278.namprd10.prod.outlook.com ([fe80::c0bd:5980:ffad:4bdc]) by DS7PR10MB5278.namprd10.prod.outlook.com ([fe80::c0bd:5980:ffad:4bdc%5]) with mapi id 15.20.5504.020; Mon, 8 Aug 2022 06:30:04 +0000 From: =?iso-2022-jp?B?Q3J5c3RhbExlZSBbGyRCTXtXXjN+GyhCXQ==?= To: "devel@edk2.groups.io" CC: "isaac.w.oram@intel.com" , "nathaniel.l.desimone@intel.com" , "star.zeng@intel.com" , "zhichao.gao@intel.com" , "maciej.rabeda@linux.intel.com" , "jiaxin.wu@intel.com" , "siyuan.fu@intel.com" , "zhiguang.liu@intel.com" , "dandan.bi@intel.com" , "gaoliming@byosoft.com.cn" , =?iso-2022-jp?B?RGF2aWRIc2llaCBbGyRCPFU6JUNSGyhCXQ==?= , =?iso-2022-jp?B?Q3J5c3RhbExlZSBbGyRCTXtXXjN+GyhCXQ==?= Subject: [PATCH 1/1] AsfPkg: Add Alert standard format support Thread-Topic: [PATCH 1/1] AsfPkg: Add Alert standard format support Thread-Index: AQHYqvBLDZfaiV3KPU2U2ULA0Yrz3g== Date: Mon, 8 Aug 2022 06:30:04 +0000 Message-ID: <37a42ca68b9dfc69f499a447128f1f4cd334d248.1659513255.git.CrystalLee@ami.com> References: In-Reply-To: Accept-Language: zh-TW, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.36.0.windows.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ami.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 009d9bf8-f268-4a1a-4fa8-08da79076dde x-ms-traffictypediagnostic: BYAPR10MB3221:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qx/krzYjhiQmSLL059vUbZM08ML36zQdQz/0y5pAIQjctIxH0/TymmTvEnwOku9Tj7MXHb27DZwaz5J73lJyaA+j2DXOpUGDyo3fTuokGNIh51uQlGhHFAXTuHzEnJd8//XzcmT4RMrmTuwGOxAXu8umQYt2NGj77vG1P9+6893eZ1XH4RLO4PF5rXvE42W6gjOWOInJ0QIPv7Cs+swKVQDlKjwTBu80EPippZPb6Eiot4wdLkIzInK0zzx8PHRuZ5Ba1LEgOVEZnVTOSo6rljFDc5suS4tMnqYlhi/zo+ctYMV7xCHFcQLvvF2Fb7o56+9lCW2LJ5a7VINCsy3twoCb4+8DddkcWEIKGGAk/dvbtEYypf5xm+T5GmsJdCm8AeEtBjzAxwdLKP2PccHPxdtXjqV4iy4oCkx3ffzDKIowqQtzSvuB7Ihhn2A/UqCktdMn4OMSx29y8mUxhmaHzRV/opKhGyy30NtXBylWXB07+MxqMAFcQmoX7UrvMPoh6G4QkgH7uahXdKSfsTtC3hVqRlOwUH4uwK6wFjqWKJyXdQ1e1LrRkK75fbiEXPhZFQpX9mWB0kPZl3OXTMILf1SXKk5hg6aycvdkxrpk1yPLrmfwlVWO7acjYWa3Ya81udv71URvusXW4hLunRmDdGcNXhVdpmMyjRSPZYVmFiA+zovBIor5z0cpgl88i7wpI01Z4Jd17ToijZ1h9pyfwYGY6BwTLxZlOkVxmruYQAMc0ktM1Q+7FrQkt2OoWcVi9s39NlThzXJhSHi8HJcDwSjvTG+RPCkcYtsVcTzYPbXPpjE0HtzHt5JR34b/gGTS+mpQifLvyE1oKdeN/qoIuemE/eRa6wFNZLlaLkknA8RSB0ENC5sP3cEbEtG1JFns x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5278.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(136003)(396003)(376002)(366004)(346002)(39840400004)(85182001)(186003)(41300700001)(86362001)(2616005)(26005)(6506007)(6512007)(71200400001)(122000001)(36756003)(83380400001)(8676002)(64756008)(316002)(6916009)(54906003)(19627235002)(40140700001)(66556008)(91956017)(8936002)(76116006)(66946007)(4326008)(15650500001)(2906002)(66446008)(478600001)(6486002)(30864003)(7416002)(5660300002)(38100700002)(66476007)(38070700005)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-2022-jp?B?NVJ3MXJEWWEvMk5PNitVcTJEaWl2aDJpRnN4WldacHZwdUFCL0p0TmFW?= =?iso-2022-jp?B?UVhscTFuYnRjcUdPNU82WFdmYkV4OFZtOHRhd2x1aEFJUW5CRGtNSk15?= =?iso-2022-jp?B?dDJrVjZZamZTT1lhNVZ5Ry96R21zOW54TXhTL2RxaUtBY3p5SHdXZFBm?= =?iso-2022-jp?B?dDZCMTBTSEFtRi9INjMvZWlMazZiZWtDaVpGcDA2b2YwNUgvUURHTWs5?= =?iso-2022-jp?B?THB4VFNVRE9nRFdsVkhqVVE0VzRCMW0zVHJIdkNLaFBGYmtjcXlDbTMv?= =?iso-2022-jp?B?TnVQbFJEN20rM0dGSjZvS3VxWkRXWHBNZE93RzdPN2d0aWlaL0N4UDkr?= =?iso-2022-jp?B?TE9PVE5JMnhraEVVNjVNOEZGTVliaUgwQ3FvcVlNdUwyNGxxdEJlNTJn?= =?iso-2022-jp?B?R1JQU0dwTUxOZ3RyTG8zV3lkRlVOYVdDQVA4cFVpZFJGTWMzckNkbDJO?= =?iso-2022-jp?B?S2xWYmNsV2dTalFHOWhMaHVSZnZsdW9LZjFCMFZOc3psUTEzK0w0bSsx?= =?iso-2022-jp?B?M2xwSllBbDRqUXlLTDUrRngzTWp1c1VuendVcm82OFZpV3NzYUM4TDVW?= =?iso-2022-jp?B?c3hxaDF4UTdvaW10eXlSRmZvaksxQ2laUzN0RUwyYmpsZy9IUGRicEFR?= =?iso-2022-jp?B?WEJOS2R5NzUwTnJQSi91amJjSmJNZ1dzdXNaZ1I3NGtyTUtnbC9TMjQ0?= =?iso-2022-jp?B?OEdnNlBiMFV3K0tOT2RXODFpbldpYlNyb2Q2UFh5THFvNWtTaWgrT09C?= =?iso-2022-jp?B?UHVwczVPK0dCeUs4QVBKcFNBVzdhTlJrVzVtb3lpVjVMQkhTZ0VZc2Vs?= =?iso-2022-jp?B?cllGRVZkSG81MUZabjFsK0pXdFUwelliV094cUlBN3ljSVMvWThrRWtw?= =?iso-2022-jp?B?UFJhUVBNSnY0ZExMT0dmRUl4blhiR0FvTDNISVIwdEt4RFVDVTY5S1k4?= =?iso-2022-jp?B?a250MGlMdkZ1YjM1K0Y0bjkyU0k5NnZBc002Q0lYcy9wNWtWbk1JVThD?= =?iso-2022-jp?B?RDBIY1FaY2wrSGdNTGpBOHFtdzZTUXlpdHVWZzdVM2w3aFR5aEROb29S?= =?iso-2022-jp?B?RWN4aGZKMHhTdW5uOW5WWVRKRnlrYXVZR1RueEpBU0FqcWtNUk1aMElz?= =?iso-2022-jp?B?NkxlN05UVkt0RFIzMGQrVWlGL3Q3NnlUck4rRVJEeVNTTE1YVmhrOVhT?= =?iso-2022-jp?B?VFFDOWNsb1FRdkhxZzFOSy9ZSHcyMXI0eXFldDlRK3dCUElWY0FxWmQy?= =?iso-2022-jp?B?L3hicmQwbVgyRWpEa281RlBWVFdnSGtvMGd6Z3VURjV3WDFkUWR5WkI4?= =?iso-2022-jp?B?bjl2ZklYMWxHbWpjUlBwdWtvYm10d2VHY2RqSGRaUkdadWRlNjl2bWpy?= =?iso-2022-jp?B?QjJ2Vjh1Q3RCU3lhSUJOWnhqVVkyT3hDRm10b0hRSjJjejFma3ZHbmk2?= =?iso-2022-jp?B?UTVBbkVXNURSd0lUd1JSZG1ibUMyNytHNG9jUjJUUW1RdjhhMkRkcWlM?= =?iso-2022-jp?B?UVhyVW5IU3FON2srUkEzM3E5SU1hZFNueHNVdkpvZHZJY0NXd05maEV0?= =?iso-2022-jp?B?UFpWTE9hMFloZm1pVDd3VWE2TWVsL0RxQWhTUDBSU1crR21UcDM0dk9y?= =?iso-2022-jp?B?QTNZS3hFMkkwckxVOGpvNTRhcUJ6TWtSTDNiTForek9EM0NDakFNby9C?= =?iso-2022-jp?B?Q2wrd01sK0Nja1didFpvLy9ESS9TUXp1c2FST3I1TG8zT1B3c29mM1Q4?= =?iso-2022-jp?B?VVF2VzdNUkVoeStVeW0vZWttOW1Pc3RHOTc3Q1hqamtvcU1jeDJFSEpV?= =?iso-2022-jp?B?b1loUnFQd1ZLeVZzenl4OVp3a21NMnNydWhvTmU2MWV0ZCtHU3NXMU5T?= =?iso-2022-jp?B?S1pwbW9RYnJ1ZEVmeHRxNkRTZmFMbVFyallESVJtK1l5S3dybUdqNnFG?= =?iso-2022-jp?B?L3IvdEQydSswVEdmNVFsM0h2enR3RXBQdFM1Ti9nQjdsUjJGRTFHbTNs?= =?iso-2022-jp?B?b0dIS1htbFZvNVdOQzhabmV4MWtqelllcXdGeklwUklRdElCK0lra1NI?= =?iso-2022-jp?B?aTRZNGdzT2xFNlVqT20wcTFFdDZEejFrSUZSL0IvWGVuMnRsdmZHbnpo?= =?iso-2022-jp?B?SHN2ZG5hdXFoM2VicDJ0VU9udlhxM2ducWxURm9aOVc1UlkvOFQxRGZM?= =?iso-2022-jp?B?cXVOM01TMWZWV3JMTWpqNzZoZEhYTWFSSnNQQmRFVG5weE9JdTBlUWh1?= =?iso-2022-jp?B?M0NlaEJ4dGNUQmh0bkxla21Na1A4VjNqdzZEMGFwL1NkWjMvVmlFZ3lD?= =?iso-2022-jp?B?MkU1R2tML2RpNGtmc0IzRTI0SlVUbEFra3c9PQ==?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5278.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 009d9bf8-f268-4a1a-4fa8-08da79076dde X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Aug 2022 06:30:04.0895 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fYsL8B4FaNKqFReDA3SjXKd/yMQedJ2egh2uHVAE3+PM2pkiCbcB3VAD80tUESYSqLg7tQGjjKMY9Zoz8cuvmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3221 Content-Language: en-US Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable 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? 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. 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 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= .