From nobody Thu May 9 07:23:29 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+94969+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+94969+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1665468068; cv=none; d=zohomail.com; s=zohoarc; b=BiHle4IYUvVAG8WeDR8Blx3amXK8Oa90r5XRSWKzm1MdHI17TqIJkRAmil+iX85yfhwsN8lPeHp00lEHY83gGBnuVpqDA/KWXPb5DNfjz9abfvVyd0eWDnEPmP/nhLIBNcUkbCwOmWFmzXcLz60eGpD6WwNVShZErgwXz5JDzz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665468068; 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=puWhxhQu3j4gutELIiEBlJdPtF1fVJCZHJs38uctukk=; b=ZT73Ls5hpNQ/lzHpAxMMVen7K04ekOvrC/iAiU6x8LENyGAsIl9AVgCvx+jd6+pLJ/2P2j+BV5hzx/i7TnqPlzgKsacmMG72q72dcuOQFGGQIbN4j+p72HdtJ9WDwVC7guADeeLRhQAj7BQGe8tFg+X40czQP90/rUAm23E+58w= 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+94969+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 1665468068383242.34489126112032; Mon, 10 Oct 2022 23:01:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rn2fYY1788612xgXG0anZWwt; Mon, 10 Oct 2022 23:01:08 -0700 X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web08.4102.1665468067476464766 for ; Mon, 10 Oct 2022 23:01:07 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10496"; a="284797438" X-IronPort-AV: E=Sophos;i="5.95,175,1661842800"; d="scan'208";a="284797438" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 23:01:06 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10496"; a="657219935" X-IronPort-AV: E=Sophos;i="5.95,175,1661842800"; d="scan'208";a="657219935" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.56.220]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 23:01:05 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Zhiguang Liu , Eric Dong , Ray Ni , Rahul Kumar Subject: [edk2-devel] [PATCH] UefiCpuPkg:Add RegisterExceptionHandler in PeiCpuExceptionHandlerLib Date: Tue, 11 Oct 2022 14:00:47 +0800 Message-Id: <20221011060047.516-1-dun.tan@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,dun.tan@intel.com X-Gm-Message-State: mfLx3RmW5CuYxi7QCzw9j1Rnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1665468068; bh=XzTzAvtto3TkS7VnBVmxQlem8LnhOz+mFncHNLGe3QE=; h=Cc:Date:From:Reply-To:Subject:To; b=JTvvUo4A8cDjS/BqeMBadLwbnSFw81r4lkQK0nSp3SlUFjWYLglNijqi2D9fl/lw1UW jOvh7rnfPpM5X2RhsALWqG55d7JjN2g1t7YP9JLwe+IjR7NWafBmBagOZMltZFAbLLwrH Se29W2yJK4npInhTkESqMdJkLAO5WVu7Fbs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1665468068690100001 Content-Type: text/plain; charset="utf-8" Add RegisterExceptionHandler for PeiCpuExceptionHandlerLib instance Signed-off-by: Zhiguang Liu Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar --- 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) * CPU_EXCEPTION_NUM); 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 (#94969): https://edk2.groups.io/g/devel/message/94969 Mute This Topic: https://groups.io/mt/94253420/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-