From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.web10.72161.1673565247274579135 for ; Thu, 12 Jan 2023 15:14:07 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iM9Eu3x3; spf=pass (domain: gmail.com, ip: 209.85.221.43, mailfrom: pedro.falcato@gmail.com) Received: by mail-wr1-f43.google.com with SMTP id z5so18495313wrt.6 for ; Thu, 12 Jan 2023 15:14:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uSZTx5X7O3aIVQ6r2/LUnKPSrN/tKkKxRhhHYUMr0ts=; b=iM9Eu3x3QKd605t9D82jilnCjR9vAcgeH7CDDZsbuXZ80/vQX/OuDIMXJRLj8mFh9w GqV/Fop9vfi3DXqor1FqhDwc3vpiD33J95+JMdruYH2TZuDLQ9zfcvugjpr8dRXF8Yi/ E2YJXaLoE13axbvnlitt3PwRb5nU3mH2ArtYDRdg0nKQSkStIrL3ch9WSRK3HduwW6BG gx1s5Lsh8Ge/CWdaCzYF5GFd5hFqIayfQ0Uf4shHtbEcaIe7DY6g8pHWnVpYicNgF04g qkVfD6SViiTriYu1elMIxeEeW/EZvNjvqMHuLD3cJr44NYiYCTti8iSv0KkEZwSDVk2r Aftg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uSZTx5X7O3aIVQ6r2/LUnKPSrN/tKkKxRhhHYUMr0ts=; b=C8F1/G87ITWHuNJ4NjNNSzwjZLCaS5ZTSk4sGhpersUsQoPYZ8n1AXRXhKzD4zMFQJ +xAQeqHstzyhqhuJSCGTs7Fbrx5kdpQ9ZCrUwLSejn1wWoE6oLz998GbZpSoahG9LTfT A9qTWlakOpIgr6Yk94FNUro5k5p78HTSIIT8OASProF+H/0eey7fc4xUXL4LPJ17IIHE oWwEgEqbz8vq/3v/vwUrtu0bSNHfZtV/BRk5EmatQ67LG9Y5jlCfSoTTBVlCGJBLiQCx izXGMAXGcB8rwJuH71WPkHZpXfKBo7LwIq0P4BEv83NEQXvRqwAH8IU3LPdCSL8mfh+I b6VA== X-Gm-Message-State: AFqh2kpbr9HeyCP+zNTXVFuI2qPWOvEXivA+UT0c5cl0LYL7HrglYs06 IsLdf1PF110C/jDaCIm0CEJyupCz7um6r2lU X-Google-Smtp-Source: AMrXdXvH3+cSNwXEkgtd8RNyETKu6q+RLgDU3DMZ3qwa0QfAXqn2YiIt7qefTyaFjQ4vWexS8mBn9Q== X-Received: by 2002:adf:f989:0:b0:2bd:bed8:3b0f with SMTP id f9-20020adff989000000b002bdbed83b0fmr7138903wrr.35.1673565245478; Thu, 12 Jan 2023 15:14:05 -0800 (PST) Return-Path: Received: from PC-PEDRO-ARCH.lan ([2001:8a0:7280:5801:9441:3dce:686c:bfc7]) by smtp.gmail.com with ESMTPSA id l7-20020a5d6747000000b002b57bae7174sm17472396wrw.5.2023.01.12.15.14.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 15:14:05 -0800 (PST) From: "Pedro Falcato" To: devel@edk2.groups.io Cc: Pedro Falcato , Isaac Oram , Theo Jehl Subject: [PATCH edk2-platforms 2/2] QemuOpenBoardPkg: Trivial code cleanup Date: Thu, 12 Jan 2023 23:13:59 +0000 Message-Id: <20230112231359.452800-3-pedro.falcato@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230112231359.452800-1-pedro.falcato@gmail.com> References: <20230112231359.452800-1-pedro.falcato@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Small cleanups around PlatformInitPei. Signed-off-by: Pedro Falcato Cc: Isaac Oram Cc: Theo Jehl --- .../QemuOpenBoardPkg/PlatformInitPei/Cpu.c | 2 +- .../QemuOpenBoardPkg/PlatformInitPei/Memory.c | 9 ++---- .../PlatformInitPei/PlatformInit.h | 28 ++++++++++++++----- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Cpu.c b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Cpu.c index e203b2654226..2fc62a0a3e77 100644 --- a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Cpu.c +++ b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Cpu.c @@ -20,7 +20,7 @@ /** Probe Qemu FW CFG device for current CPU count and report to MpInitLib. - @return EFI_SUCCESS Detection was successful. + @retval EFI_SUCCESS Detection was successful. @retval EFI_UNSUPPORTED QEMU FW CFG device is not present. */ EFI_STATUS diff --git a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c index 4f312c36016e..223cace0ca98 100644 --- a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c +++ b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/Memory.c @@ -86,8 +86,8 @@ GetTopNonHoleAddr ( STATIC VOID ReserveMmioRegion ( - EFI_PHYSICAL_ADDRESS Start, - UINT64 Length + IN EFI_PHYSICAL_ADDRESS Start, + IN UINT64 Length ) { EFI_RESOURCE_TYPE ResourceType; @@ -121,7 +121,6 @@ InstallMemory ( ) { EFI_STATUS Status; - CONST EFI_PEI_SERVICES **PeiServicesTable; EFI_E820_ENTRY64 E820Entry; EFI_E820_ENTRY64 LargestE820Entry; QEMU_FW_CFG_FILE FwCfgFile; @@ -250,9 +249,7 @@ InstallMemory ( LargestE820Entry.BaseAddr + LargestE820Entry.Length - 1 )); - PeiServicesTable = GetPeiServicesTablePointer (); - - Status = (*PeiServices)->InstallPeiMemory (PeiServicesTable, LargestE820Entry.BaseAddr, LargestE820Entry.Length); + Status = (*PeiServices)->InstallPeiMemory (PeiServices, LargestE820Entry.BaseAddr, LargestE820Entry.Length); ASSERT_EFI_ERROR (Status); diff --git a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/PlatformInit.h b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/PlatformInit.h index f4044df3dbf5..f17df707188a 100644 --- a/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/PlatformInit.h +++ b/Platform/Qemu/QemuOpenBoardPkg/PlatformInitPei/PlatformInit.h @@ -20,19 +20,27 @@ #define PCI_MMIO_TOP_ADDRESS 0xFC000000 -EFI_STATUS -EFIAPI -PlatformInit ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ); +/** + Return the memory size below 4GB. + @return Size of memory below 4GB, in bytes. +**/ UINT32 EFIAPI GetMemoryBelow4Gb ( VOID ); +/** + Install EFI memory by probing QEMU FW CFG devices for valid E820 entries. + It also reserves space for MMIO regions such as VGA, BIOS and APIC. + + @param[in] PeiServices PEI Services pointer. + + @retval EFI_SUCCESS Memory initialization succeded. + @retval EFI_UNSUPPORTED Installation failed (etc/e820 file was not found). + @retval EFI_NOT_FOUND QEMU FW CFG device is not present. +**/ EFI_STATUS EFIAPI InstallMemory ( @@ -58,6 +66,12 @@ InitializePci ( QEMU_PLATFORM Platform ); +/** + Probe Qemu FW CFG device for current CPU count and report to MpInitLib. + + @retval EFI_SUCCESS Detection was successful. + @retval EFI_UNSUPPORTED QEMU FW CFG device is not present. + */ EFI_STATUS EFIAPI MaxCpuInit ( @@ -74,4 +88,4 @@ GetTopNonHoleAddr ( VOID ); -#endif //QEMU_OPEN_BOARD_PKG_PLATFORM_INIT_H_ +#endif // QEMU_OPEN_BOARD_PKG_PLATFORM_INIT_H_ -- 2.39.0