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.79]) by mx.groups.io with SMTP id smtpd.web12.4353.1658825515890913511 for ; Tue, 26 Jul 2022 01:51:56 -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.79, mailfrom: crystallee@ami.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8VLDugMMU14lWJIoQacnvfGfyM8iVXwJ2rbU6Q7c1f8GdcM+kYEaoKHykPcFn4Frze9HPoVmdJUZi/wBWsbpwzxVvyCAuC39/usOsmrItTBcKcyybu5NyZzsWcBTZeHkbWuqTIhjCFPJzLrvWG1kVD6MHbAO+EB3rHKZtlaN68yMmz+QMasyrwTUV3xM0a0+Qd89Vg+I5wntFO0raHdw4UX2gzIpVno9kIKLguV3ZDXTbNctvjNg04T5z7wE2bBJdgJIANCeF2DMYb818B7aHzdRLxK7k+DlO+/iq8UPfD72eZdoQnw21ReYLrv++Sse+mgnc4mJzL4JCR5DU3NWg== 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=02GAnoN3WUC+G1oq5myYl21hA0WFiq6WVOGSZFSih/g=; b=ChEh4FDs6U1R33HIYCZR7bYd1urdxgPm3Hf0a3+Mo0+SIDoW927xx8mAp7IztK4EfRGzaH86jpM0KnSo+DI1jWhNHNaHnGzRjACergRDLzTppDCaRrRn018YU3QUP2d5a3fiikTBg9mE/C7sAe4PIAvzP6J7VGZ7i+aMKUFER1i4caSQIxXWK7hOF/q7gS66GZqpF5ckMoaTiCOTBqRoeUHxJqoIG/Vb9g/4pjzsoyXcrBJdfoMNwhpXqnew7B0qXZCGBO4Nmlc9P+s1XYJQb29fKI3iMDyxraz4F8RoxzsyUgeobM7NLrEtfLDpPXOOLeN8zrMEaBPymYFBg/0FBQ== 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=02GAnoN3WUC+G1oq5myYl21hA0WFiq6WVOGSZFSih/g=; b=RaMjH9NPCe4YxtyjczLbJlVQanwqjwFNU0os9MPolBticVl1aI3FMtLdH+o36Oy16UYRTn9fGLe+EJwLS12uZD0HjlTNyhdR1gLqBfclR6Ujj1ozlOZuyaTpqhlc2q4MGYxDXK15TRVEv1R6ZRN2clev5NpD7QcJDxlksBb6p6c= Received: from DS7PR10MB5278.namprd10.prod.outlook.com (2603:10b6:5:3a5::9) by MWHPR10MB1438.namprd10.prod.outlook.com (2603:10b6:300:24::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Tue, 26 Jul 2022 08:51:52 +0000 Received: from DS7PR10MB5278.namprd10.prod.outlook.com ([fe80::c0bd:5980:ffad:4bdc]) by DS7PR10MB5278.namprd10.prod.outlook.com ([fe80::c0bd:5980:ffad:4bdc%6]) with mapi id 15.20.5458.025; Tue, 26 Jul 2022 08:51:52 +0000 From: =?iso-2022-jp?B?Q3J5c3RhbExlZSBbGyRCTXtXXjN+GyhCXQ==?= To: "devel@edk2.groups.io" CC: =?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: AQHYoMzzoq07xttTKkectnYzEuNBbg== Date: Tue, 26 Jul 2022 08:51:52 +0000 Message-ID: <37a42ca68b9dfc69f499a447128f1f4cd334d248.1658822180.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: 75790d27-af04-4522-02fe-08da6ee415dd x-ms-traffictypediagnostic: MWHPR10MB1438:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: j+avFUqFkEgvKLGsGDSE+MNRZItTdLupTRkUJHqvMYv6EzvINGbRqcUPWtIdxv4u0iRFGkzMrVrhYIsnzzhIcYmsu05pfu5PvHVniQimivblQCwGz/v42O7rEEy7tLrl4F6GEe2gbF4YUuxVQUdfDN6BFkxvVmF/ilthKmEpToismeiti/+SchRp+fkA+Qf43ecZw+MeFX4xqndXdQyPQCG9yN6uMXfex1pHHPYKZP8swbnMnfQgae1je52hnNWf5vImXwvAHRQJ6WaiWdpuGMA3TuFY9eCJfAAbUnQ2qVQFFT/4FxxRwhTc6+abV85KinDyNoWdy0oKdG7oh3BB9Sn+qV6uYab3EHOBIOOGcK4hLUFlcK2/iduryD52r6oKIC/8zoSrGFvI75DO314yutBqN+fDRivSP3A02zF5LYiuSC2auu++GO453VYv3OLXwJ/1NQv+od6VFu0C3OQ+2NcQzVu/ajt3E2W5j1xpZrthDJg0FeMfpW7AXCJqzIFKnzgSMDxj60Z9P2sPFhWhLdId+PMfDhllsZ4ipCt5yfXXOxU232QQ7MjCfRSIvIp2aILA1JAozJNF5XWlXNkj7/yLYZAalkBWtEOmhNsUQFbNzemrOcUAuMyE4kO0NDR1mtkmoRkuh5oIs0n1e5SaFtQeMTlWoejagxM/AC5PJBlg+xAIE5lQlh/0mVODZesxlfLSNHyyxnBfPUCa5GE+tjwhr3V8OIrNS4I9T/iaEAmxiEdKTerX5YIwUtP53FA3C1FhE6dsJCqwKo66zFklqOGivwTaszbZLy53w6jfiQDLbl1JvZtwryuAY+1BSK2LTGaY0chu8/W6awon7W6kl61Nci77luB1AVOJesCHFa4bpou+Um3o6sQ8zZhygdib 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)(396003)(136003)(366004)(346002)(39850400004)(376002)(83380400001)(38100700002)(2906002)(122000001)(15650500001)(85182001)(71200400001)(86362001)(26005)(66476007)(66946007)(54906003)(91956017)(64756008)(8676002)(4326008)(38070700005)(6916009)(66556008)(36756003)(66446008)(76116006)(2616005)(316002)(40140700001)(478600001)(8936002)(19627235002)(6512007)(6506007)(186003)(41300700001)(5660300002)(30864003)(6486002)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-2022-jp?B?OVRLbFl5dlU3R2lZUGVqZGtaRDNyOEtzQ25mWFBWaTFFRU83TjhSUGtU?= =?iso-2022-jp?B?ZzRjaDd3VDArTU9hSWtTSFBCcHRxUUZlMElxYVJpcWpNdU92L0V1aVBQ?= =?iso-2022-jp?B?Z244WFY1RzlRMEdTK1FvS2lCTjVrS2pDQ2NpeGxmNDVlY1B5MUJIeEZE?= =?iso-2022-jp?B?YW0vY05yMms2WEROeHN0TVk1cHYvWFZqSmI1WWNSR0d6VFZYeGFsNTlv?= =?iso-2022-jp?B?dVg3WS9yakNYcmxzZEIzSFVnQnBGWXduQWlWVmwzYUcyNUxnMnJ4Q2xa?= =?iso-2022-jp?B?MFoxTWNvVnpPKzZpalVvWlluWTh2V2dzaERZc1grcVROSWtBNWZyVXJk?= =?iso-2022-jp?B?ekFvSDRKMm4vV285QmhtclorNGFIWk1Kdm5VQ0gxMHF3a2lVZlkzTFlV?= =?iso-2022-jp?B?THFRRUtxTnZTZXo0bDNWSzl1K0ZHa0JrYjZqSjYweUF6c0h2YXNHd3d1?= =?iso-2022-jp?B?bDNuclNkVXFuN3plMVl0cENOUlpEWTZ2VWVCOForOVlJVE0xVUZ5dDY2?= =?iso-2022-jp?B?Ny9SamhYZG1meFlqRFBCYVRXcE9BYW9HQzJScHZJT0o3WnNSb1M4MXYz?= =?iso-2022-jp?B?N1ZDN090REhTT2tFaXI4NHNzc0ZraU90ei9vTXltd0UvbGhKZGFuQzVZ?= =?iso-2022-jp?B?Q0RrRTdXeDI3SVcza21pZFJObFVBMlJ5bFZlNWl6ZThBS1RYNFhxLzVu?= =?iso-2022-jp?B?RldMaWxqaUliMFBMN3czL29mN1IwOHp1QU1BNmhzV2pzaFJNY1dZQUpY?= =?iso-2022-jp?B?dWRpL0c1TDJGWEdmRjRrTHNkTEJrSGtCSHFxSmNyUnZrb2R1eHAwSXJh?= =?iso-2022-jp?B?M1E3bWRUWTNacGtpbHVyZkdKNEV5MklmRnV1K2x1anM3SlZHUFp6SGNQ?= =?iso-2022-jp?B?THlrTkt3d1BycTh0dnNDNkJtNkExRlVJdUY3OFhrZytSWGhYSTZ2UCtq?= =?iso-2022-jp?B?c2JTMVVUZWxKdEdPUkkvYzVvSjYyMkErOG53SkhGbWphbjJSakRaV01a?= =?iso-2022-jp?B?UTN0eUdzR0tzQXpvRjRVQ1Z1T1pVZVhiYzZCS0hXZndTazgzelFGQUpJ?= =?iso-2022-jp?B?cDdJUDVDM3JMQjA1TkhjQ1Jha3E0R3VqS01OM1M4bEpwVnNBK0wwcUI0?= =?iso-2022-jp?B?ZjNNMGVnQmJlUmNSQk5JZHBkT0JZLzljeW1hRUx1YkhZL0VBMDNrL2M3?= =?iso-2022-jp?B?N2ZrSTVrVHJ1MklyY2JTNGxiM0twL1drbE5iTGdQRXd3UjhxV1MyVDlL?= =?iso-2022-jp?B?MEsvNnYxVktxb1NRUEhmWWFGcDkyRFk2dGs0Z2ttSjhjcGZYMmU4VkJM?= =?iso-2022-jp?B?MVZXRWJQZUFHOTZ5ZjFTUTVNTFZrVDhyVXVtdG15UVhPMTc4OUt0Uitk?= =?iso-2022-jp?B?MUdvNVZEY3IwbGZZdWZ2QzQwT0l1RGxXVmRLYnRxT05vQXBGSW9GSXp3?= =?iso-2022-jp?B?QXd3WFdLVTVnNmJiQXJpeVE0ejNLdDI1TFB6ZExqamJZSVJvdVNqVGI3?= =?iso-2022-jp?B?R0RNV3NrVUJneHc1L2RzT3M2Q3FNTnB4UnJ0bENMYUFIV0o1OVBvSlJz?= =?iso-2022-jp?B?T0N5enhkQ3VQYWk0TTR0Ti8yYS93U0pQbldNUzVBSEdQT0I4dzg3eTBP?= =?iso-2022-jp?B?dFpDT3czT3ZXWjloMWNhYkVoYnVHcURmYkdxMHZ2L0FsTmdyemlNOWpt?= =?iso-2022-jp?B?UHV1MVNCVytMem9vdmN6S2ZtM0c5aEg0SHBxb3Q5UmMzV3FRNTdxVUUr?= =?iso-2022-jp?B?cmo5U2UxWTJJWnBFYzFGS3ZITEZkdHlvSzJvT1pwUE5HdFNSVjV3NDcy?= =?iso-2022-jp?B?QlBpT0JzclNZblF2dDFsdkVWOHBJZ0lkRFRhZHJtZlJ5ejkwVzRpQkp4?= =?iso-2022-jp?B?OWZjMTYvbGwyazlLdmZGbUw1NE0xOU1BdkFma0xDeVFYdGpYN0lxaVVo?= =?iso-2022-jp?B?eHRaTG9nSkVuVlhFSlcwWm9HUm03WlY1QTVWblgwRDhQangyVTF2RHNj?= =?iso-2022-jp?B?Y2ZNYlkvSnd6ZjRRYjE2c25mb2ZDd2JDSUJRYkphbUFQc20rY2hBaHk3?= =?iso-2022-jp?B?SVJGQVhVRFhCeGE3VkVYL3pxVjJDWUpOakk4Si9FT1ZJWjVLU0xDWjVu?= =?iso-2022-jp?B?Z1RyY0pDbldjRnowZERaWCsrL0xKTWNoejNnb25LU3RWMGRwdWdmYXFa?= =?iso-2022-jp?B?T0dtS09YWHB2bkJvMytMNE40dzZBTUNyZURtZTNIMWE2dGl0ckV1NW5P?= =?iso-2022-jp?B?aHBpeXNBS2RLNVljbEMycjd3bnVsNmNiTjBCUityQjVLRXdTY3JqN0dW?= =?iso-2022-jp?B?TEpmMWJDTFZBSmg3SytWOVNBTURiU3gzRkE9PQ==?= 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: 75790d27-af04-4522-02fe-08da6ee415dd X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jul 2022 08:51:52.4594 (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: +fItSyaAopEgjUzTkm4JlMvsxL2DuQRUi4SVHiQIM0ajyDE+y83QNWOqY3/UrJBYdElFhpuM8/W+r05U5apH9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1438 Content-Language: en-US Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable 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= .