From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id E714FAC1486 for ; Fri, 17 Nov 2023 10:00:05 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=GauuqtD9NAOhtT/cA3xjbVrU3SYB3ydVNOBpluJ3Ytc=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1700215204; v=1; b=wH9ZiFQ4XvwMKLsTDCLg0kF54O1bdgazCtbFxH+HR/xUHTYzveTmnp4vlpa7Cl4XptM70wgI Ge4Y9GRHFSEAPk5ACJTLA2U8h1vHTUU08gSAyAYmHI2wv3KODuWli4MVgA8O67NfVRuzw7IEm6X JBPEia7G0LCOz0PV0XIF5Enc= X-Received: by 127.0.0.2 with SMTP id RoyoYY7687511xR6P2Auee6q; Fri, 17 Nov 2023 02:00:04 -0800 X-Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web10.8339.1700215203224672136 for ; Fri, 17 Nov 2023 02:00:04 -0800 X-Received: from loongson.cn (unknown [10.2.9.245]) by gateway (Coremail) with SMTP id _____8CxyOiiOVdl6MY6AA--.14583S3; Fri, 17 Nov 2023 18:00:02 +0800 (CST) X-Received: from code-server.gen (unknown [10.2.9.245]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxndygOVdleTlFAA--.20049S2; Fri, 17 Nov 2023 18:00:00 +0800 (CST) From: "Chao Li" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu , Leif Lindholm , Ard Biesheuvel , Sami Mujawar , Laszlo Ersek Subject: [edk2-devel] [PATCH v3 10/39] MdePkg: Add method of LoongArch64 to PeiServicesTablePointerLibReg Date: Fri, 17 Nov 2023 17:59:59 +0800 Message-Id: <20231117095959.3609016-1-lichao@loongson.cn> In-Reply-To: <20231117095742.3605778-1-lichao@loongs> References: <20231117095742.3605778-1-lichao@loongs> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxndygOVdleTlFAA--.20049S2 X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQASCGVWzaoGGAAps4 X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Precedence: Bulk 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,lichao@loongson.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 6ls0h5hMGLwEPIGZyjXpMSX9x7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=wH9ZiFQ4; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io LoongArch uses the reigster LOONGARCH_CSR_KS0 in the PEI stage to set and get the PEI service table pointer. Add this method to PeiServiceTablePointerLibReg. This is a code first phase, I will update the PI specification next. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Laszlo Ersek Signed-off-by: Chao Li --- .../LoongArch64/PeiServicesTablePointerReg.c | 47 +++++++++++++++++++ .../PeiServicesTablePointerLibReg.inf | 3 ++ 2 files changed, 50 insertions(+) create mode 100644 MdePkg/Library/PeiServicesTablePointerLibReg/LoongArch64/PeiServicesTablePointerReg.c diff --git a/MdePkg/Library/PeiServicesTablePointerLibReg/LoongArch64/PeiServicesTablePointerReg.c b/MdePkg/Library/PeiServicesTablePointerLibReg/LoongArch64/PeiServicesTablePointerReg.c new file mode 100644 index 0000000000..368c907992 --- /dev/null +++ b/MdePkg/Library/PeiServicesTablePointerLibReg/LoongArch64/PeiServicesTablePointerReg.c @@ -0,0 +1,47 @@ +/** @file + PEI Services Table Pointer Library For LoongArch. + + Used Register Mechanism. + + Copyright (c) 2023 Loongson Technology Corporation Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + Set the pointer PEI Service Table to a CPU register. + + Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer + in a platform specific manner. + + @param PeiServicesTablePointer The address of PeiServices. +**/ +VOID +EFIAPI +SetPeiServicesTablePointerToRegester ( + IN UINTN PeiServicesTablePointer + ) +{ + CsrWrite (LOONGARCH_CSR_KS0, (UINTN)PeiServicesTablePointer); +} + +/** + Retrieves the cached value of the PEI Services Table pointer from a CPU register. + + Returns the cached value of the PEI Services Table pointer in a CPU specific manner + as specified in the CPU binding section of the Platform Initialization Pre-EFI + Initialization Core Interface Specification. + + @return The pointer to PeiServices. +**/ +CONST EFI_PEI_SERVICES ** +EFIAPI +GetPeiServicesTablePointerFromRegister ( + VOID + ) +{ + return (CONST EFI_PEI_SERVICES **)(CsrRead (LOONGARCH_CSR_KS0)); +} diff --git a/MdePkg/Library/PeiServicesTablePointerLibReg/PeiServicesTablePointerLibReg.inf b/MdePkg/Library/PeiServicesTablePointerLibReg/PeiServicesTablePointerLibReg.inf index 22499e22ad..b26a970b12 100644 --- a/MdePkg/Library/PeiServicesTablePointerLibReg/PeiServicesTablePointerLibReg.inf +++ b/MdePkg/Library/PeiServicesTablePointerLibReg/PeiServicesTablePointerLibReg.inf @@ -30,6 +30,9 @@ [Sources] PeiServicesTablePointer.c +[Sources.LOONGARCH64] + LoongArch64/PeiServicesTablePointerReg.c + [Packages] MdePkg/MdePkg.dec -- 2.27.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111363): https://edk2.groups.io/g/devel/message/111363 Mute This Topic: https://groups.io/mt/102644762/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-