From nobody Thu May 9 00:50:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95054+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95054+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1665559682; cv=none; d=zohomail.com; s=zohoarc; b=ADongkR1kEc20rwDKLDMSEzEsKuOiF6eNhk1ANuIpk/ewMPn78cnEoKfJAwWSp3HtkTdKuYwt9RqNm3EgvIuNt0jSyHu36bcI9+OotEXar+MrJkZExNscV4WnTTTAO4wcHNcqtpsGaglcOCEkyEg/TzBxjKVnw2eS61jSo/aMdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665559682; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=YZEDT9s7eigMhXZb/2LRXgv0gerf36HmEEJFzQ1dQ4Y=; b=ib/tqk/uNcR0jFhDdXxVTkZB22mZf6RY1rgfCGmXuwu+nBLz7uYnLjGO+vooqJpjkCEr5vw6qesTue+got97K/okEkE2GDW7YhC6v4nBK9q3Jtu6cP9y+Db/+gW2YKraK4WjDoJzAr8tyt6T4q9r8C3yWOL4goMgWQZNXa5QRvw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95054+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1665559682017186.64162718642103; Wed, 12 Oct 2022 00:28:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id chBVYY1788612xLBHXk35KAi; Wed, 12 Oct 2022 00:28:01 -0700 X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.17589.1665559680773652312 for ; Wed, 12 Oct 2022 00:28:01 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="292047513" X-IronPort-AV: E=Sophos;i="5.95,178,1661842800"; d="scan'208";a="292047513" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 00:27:57 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="626666716" X-IronPort-AV: E=Sophos;i="5.95,178,1661842800"; d="scan'208";a="626666716" X-Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 00:27:56 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Eric Dong , Ray Ni , Rahul Kumar Subject: [edk2-devel] [PATCH V2] UefiCpuPkg:Add RegisterExceptionHandler in PeiCpuExceptionHandlerLib Date: Wed, 12 Oct 2022 15:27:45 +0800 Message-Id: <20221012072745.549-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: sxHYgfIJJYlDRwnmbl0r5DJYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1665559681; bh=Ez34Uxb587bXQK02X9rqyjlS/rHbscdKqTqihJX42Dk=; h=Cc:Date:From:Reply-To:Subject:To; b=uSqULHJWYE0hcmpnXfiwzgggenwvZ3W/rf32EnhVe+WZzXULsDM/WBPS4kxRWLFvLKK sGjC4gjnZV4qKX7CAtV/r0bDAfo4ekobU+sZpxb/OtLRaYqZOHGVSq9hCtv6ocvejSkuC RzvpEDb2aPoG5UdI00mYf8Xe0sVzquR0sbw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1665559684334100001 Content-Type: text/plain; charset="utf-8" The PEI instance of the CpuExceptionHandlerLib didn't implement the RegisterCpuInterruptHandler() API. This patch adds the missing API. Signed-off-by: Zhiguang Liu Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Reviewed-by: Ray Ni --- UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c | 38 +++++++++= ++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c b/= UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c index 940d83a92f..1c3012b770 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c @@ -100,6 +100,42 @@ CommonExceptionHandler ( CommonExceptionHandlerWorker (ExceptionType, SystemContext, ExceptionHan= dlerData); } =20 +/** + Registers a function to be called from the processor interrupt handler. + + This function registers and enables the handler specified by InterruptHa= ndler for a processor + interrupt or exception type specified by InterruptType. If InterruptHand= ler is NULL, then the + handler for the processor interrupt or exception type specified by Inter= ruptType is uninstalled. + The installed handler is called once for each processor interrupt or exc= eption. + NOTE: This function should be invoked after InitializeCpuExceptionHandle= rs() is invoked, + otherwise EFI_UNSUPPORTED returned. + + @param[in] InterruptType Defines which interrupt or exception to ho= ok. + @param[in] InterruptHandler A pointer to a function of type EFI_CPU_IN= TERRUPT_HANDLER that is called + when a processor interrupt occurs. If this= parameter is NULL, then the handler + will be uninstalled. + + @retval EFI_SUCCESS The handler for the processor interrupt wa= s successfully installed or uninstalled. + @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handle= r for InterruptType was + previously installed. + @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler fo= r InterruptType was not + previously installed. + @retval EFI_UNSUPPORTED The interrupt specified by InterruptType i= s not supported, + or this function is not supported. +**/ +EFI_STATUS +EFIAPI +RegisterCpuInterruptHandler ( + IN EFI_EXCEPTION_TYPE InterruptType, + IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler + ) +{ + EXCEPTION_HANDLER_DATA *ExceptionHandlerData; + + ExceptionHandlerData =3D GetExceptionHandlerData (); + return RegisterCpuInterruptHandlerWorker (InterruptType, InterruptHandle= r, ExceptionHandlerData); +} + /** Initializes all CPU exceptions entries and provides the default exceptio= n handlers. =20 @@ -135,7 +171,7 @@ InitializeCpuExceptionHandlers ( ASSERT (ExceptionHandlerData !=3D NULL); ExceptionHandlerData->IdtEntryCount =3D CPU_EXCEPTION_NUM; ExceptionHandlerData->ReservedVectors =3D ReservedVectors; - ExceptionHandlerData->ExternalInterruptHandler =3D NULL; + ExceptionHandlerData->ExternalInterruptHandler =3D AllocateZeroPool (siz= eof (EFI_CPU_INTERRUPT_HANDLER) * ExceptionHandlerData->IdtEntryCount); InitializeSpinLock (&ExceptionHandlerData->DisplayMessageSpinLock); =20 Status =3D InitializeCpuExceptionHandlersWorker (VectorInfo, ExceptionHa= ndlerData); --=20 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95054): https://edk2.groups.io/g/devel/message/95054 Mute This Topic: https://groups.io/mt/94276401/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-