From nobody Thu Apr 18 06:07:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+49879+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+49879+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1572651817; cv=none; d=zoho.com; s=zohoarc; b=LeF82vLmA5RS699XL6N+QgZCC/8+kCOAxKx2QfWNxf9Vqp/OtUbEEWq0zZZgt/z132iUvG8+GxuHBwLFYNEMFSd+U4uv8L8Ha3q3+UAT3nliKnXIjKNCeTg+kLyx2+8X52gDvyb6QOaafbvSCV+j4iRcTsC4oRA3K/KDgUNsc+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572651817; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=+cbGB6kxFe4VljqNBEqk9lEDwfijV8C476QTy2gDYHM=; b=CN6Ax2Ea9nkKhaWHBZKK9nny/RBZptluU/AjV+iy8E7n1nTNdLHhRk1l/1M6OnGqvM/3LdsNmmdNmykH0zdZKo/rXBWLfHZ5CS1shlsiDTcR1omhB5SYuQS4qG6/bmOF6gn2L1ARBpfjsI0tes8DHkdzekBR604X6ix8HZuwgEg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+49879+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1572651817744727.8728429017841; Fri, 1 Nov 2019 16:43:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id naQNYY1788612xOncSQ9km0y; Fri, 01 Nov 2019 16:43:37 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web09.1697.1572651816602225936 for ; Fri, 01 Nov 2019 16:43:36 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2019 16:43:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,257,1569308400"; d="scan'208";a="199467161" X-Received: from paagyema-desk2.amr.corp.intel.com ([10.24.15.58]) by fmsmga008.fm.intel.com with ESMTP; 01 Nov 2019 16:43:36 -0700 From: "Agyeman, Prince" To: devel@edk2.groups.io Cc: Ankit Sinha , Nate DeSimone , Kubacki Michael A Subject: [edk2-devel] [edk2-platforms] [PATCH v2] SimicsOpenBoardPkg: Add CmosAccessLib to BoardX58Ich10 Date: Fri, 1 Nov 2019 16:43:35 -0700 Message-Id: <20191101234335.42520-1-prince.agyeman@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,prince.agyeman@intel.com X-Gm-Message-State: X2HwTTKypPBihw1aSlhLUG02x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1572651817; bh=t6IIMCJ1jEnG1lPFvuZWGYuQKbcZYUqkgO2kDkQTaNE=; h=Cc:Date:From:Reply-To:Subject:To; b=UQaIjKf+d1mXYyb0C5ghZb4D7YvQpqKv5fFHFTHf+NeJ1MnXCFLs1Q4t1nuNe5lmwUg 0r5htI/ZUVhmkfE+M0FjhQlXwtv0vZHxclVZRj5nzsN0WQh+Edijo5TGsUAk5GEiT3dgo WNDpnBhDEAoYxoK57Hh3L3iAaq99QwoybNg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2164 Replaced Cmos.c and Cmos.h with BoardModulePkg's Cmos library CmosAccessLib Cc: Ankit Sinha Cc: Nate DeSimone Cc: Kubacki Michael A Signed-off-by: Prince Agyeman Reviewed-by: Michael Kubacki Reviewed-by: Nate DeSimone --- .../BoardInitLib/PeiX58Ich10InitPreMemLib.c | 46 --------------- .../BoardX58Ich10/OpenBoardPkg.dsc | 2 + .../Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c | 57 ------------------- .../Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h | 50 ---------------- .../SimicsOpenBoardPkg/SimicsPei/MemDetect.c | 19 +------ .../SimicsOpenBoardPkg/SimicsPei/Platform.c | 4 +- .../SimicsPei/SimicsPei.inf | 3 +- .../SmbiosPlatformDxe/SmbiosPlatformDxe.c | 38 +------------ .../SmbiosPlatformDxe/SmbiosPlatformDxe.h | 1 + .../SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 2 + 10 files changed, 14 insertions(+), 208 deletions(-) delete mode 100644 Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c delete mode 100644 Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/Library/BoardI= nitLib/PeiX58Ich10InitPreMemLib.c b/Platform/Intel/SimicsOpenBoardPkg/Board= X58Ich10/Library/BoardInitLib/PeiX58Ich10InitPreMemLib.c index c3a31ed426..325a341cdf 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/Library/BoardInitLib/= PeiX58Ich10InitPreMemLib.c +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/Library/BoardInitLib/= PeiX58Ich10InitPreMemLib.c @@ -20,52 +20,6 @@ =20 #include "PeiX58Ich10InitLib.h" #include -/** - Reads 8-bits of CMOS data. - - Reads the 8-bits of CMOS data at the location specified by Index. - The 8-bit read value is returned. - - @param Index The CMOS location to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -CmosRead8( - IN UINTN Index - ) -{ - IoWrite8 (0x70, (UINT8)Index); - return IoRead8(0x71); -} - - -/** - Writes 8-bits of CMOS data. - - Writes 8-bits of CMOS data to the location specified by Index - with the value specified by Value and returns Value. - - @param Index The CMOS location to write. - @param Value The value to write to CMOS. - - @return The value written to CMOS. - -**/ -UINT8 -EFIAPI -CmosWrite8( - IN UINTN Index, - IN UINT8 Value - ) -{ - IoWrite8 (0x70, (UINT8)Index); - IoWrite8 (0x71, Value); - return Value; -} - =20 EFI_STATUS EFIAPI diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.d= sc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc index 78f1e80990..9b9e088cbe 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc @@ -116,6 +116,8 @@ SerializeVariablesLib|$(BOARD_PKG)/Library/SerializeVariablesLib/Seriali= zeVariablesLib.inf SiliconPolicyInitLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyInitLib/Si= liconPolicyInitLib.inf SiliconPolicyUpdateLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyUpdateLi= b/SiliconPolicyUpdateLib.inf + PlatformCmosAccessLib|BoardModulePkg/Library/PlatformCmosAccessLibNull/P= latformCmosAccessLibNull.inf + CmosAccessLib|BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf =20 [LibraryClasses.common.SEC] ####################################### diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c b/Platform/= Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c deleted file mode 100644 index b34ba9283b..0000000000 --- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c +++ /dev/null @@ -1,57 +0,0 @@ -/** @file - PC/AT CMOS access routines - - Copyright (c) 2006 - 2019 Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent -**/ - -#include "Cmos.h" -#include "Library/IoLib.h" - -/** - Reads 8-bits of CMOS data. - - Reads the 8-bits of CMOS data at the location specified by Index. - The 8-bit read value is returned. - - @param Index The CMOS location to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -CmosRead8 ( - IN UINTN Index - ) -{ - IoWrite8 (0x70, (UINT8) Index); - return IoRead8 (0x71); -} - - -/** - Writes 8-bits of CMOS data. - - Writes 8-bits of CMOS data to the location specified by Index - with the value specified by Value and returns Value. - - @param Index The CMOS location to write. - @param Value The value to write to CMOS. - - @return The value written to CMOS. - -**/ -UINT8 -EFIAPI -CmosWrite8 ( - IN UINTN Index, - IN UINT8 Value - ) -{ - IoWrite8 (0x70, (UINT8) Index); - IoWrite8 (0x71, Value); - return Value; -} - diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h b/Platform/= Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h deleted file mode 100644 index 07fa2e2d11..0000000000 --- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h +++ /dev/null @@ -1,50 +0,0 @@ -/** @file - PC/AT CMOS access routines - - Copyright (c) 2006 - 2019 Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent -**/ - -#ifndef __CMOS_H__ -#define __CMOS_H__ - -/** - Reads 8-bits of CMOS data. - - Reads the 8-bits of CMOS data at the location specified by Index. - The 8-bit read value is returned. - - @param Index The CMOS location to read. - - @return The value read. - -**/ -UINT8 -EFIAPI -CmosRead8 ( - IN UINTN Index - ); - -/** - Writes 8-bits of CMOS data. - - Writes 8-bits of CMOS data to the location specified by Index - with the value specified by Value and returns Value. - - @param Index The CMOS location to write. - @param Value The value to write to CMOS. - - @return The value written to CMOS. - -**/ -UINT8 -EFIAPI -CmosWrite8 ( - IN UINTN Index, - IN UINT8 Value - ); - - -#endif - diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c b/Plat= form/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c index ee0eead5a8..e547de0045 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c +++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c @@ -22,11 +22,11 @@ #include #include #include +#include #include #include =20 #include "Platform.h" -#include "Cmos.h" =20 UINT8 mPhysMemAddressWidth; =20 @@ -80,9 +80,6 @@ GetSystemMemorySizeBelow4gb ( VOID ) { - UINT8 Cmos0x34; - UINT8 Cmos0x35; - // // CMOS 0x34/0x35 specifies the system memory above 16 MB. // * CMOS(0x35) is the high byte @@ -91,11 +88,7 @@ GetSystemMemorySizeBelow4gb ( // * Since this is memory above 16MB, the 16MB must be added // into the calculation to get the total memory size. // - - Cmos0x34 =3D (UINT8) CmosRead8 (0x34); - Cmos0x35 =3D (UINT8) CmosRead8 (0x35); - - return (UINT32) (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB= ); + return (UINT32) (((UINTN)CmosRead16 (0x34) << 16) + SIZE_16MB); } =20 =20 @@ -105,8 +98,6 @@ GetSystemMemorySizeAbove4gb ( ) { UINT32 Size; - UINTN CmosIndex; - // // CMOS 0x5b-0x5d specifies the system memory above 4GB MB. // * CMOS(0x5d) is the most significant size byte @@ -114,11 +105,7 @@ GetSystemMemorySizeAbove4gb ( // * CMOS(0x5b) is the least significant size byte // * The size is specified in 64kb chunks // - - Size =3D 0; - for (CmosIndex =3D 0x5d; CmosIndex >=3D 0x5b; CmosIndex--) { - Size =3D (UINT32) (Size << 8) + (UINT32) CmosRead8 (CmosIndex); - } + Size =3D (CmosRead16 (0x5c) << 8) + CmosRead8 (0x5b); =20 return LShiftU64 (Size, 16); } diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c b/Platf= orm/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c index 7568d25c4e..0bec76e496 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c +++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c @@ -22,13 +22,13 @@ #include #include #include +#include #include #include #include #include =20 #include "Platform.h" -#include "Cmos.h" =20 EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =3D { { EfiACPIMemoryNVS, 0x004 }, @@ -524,7 +524,7 @@ DebugDumpCmos ( VOID ) { - UINT32 Loop; + UINT8 Loop; =20 DEBUG ((EFI_D_INFO, "CMOS:\n")); =20 diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf b/Pl= atform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf index 9499d2aad5..710fa680be 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf +++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf @@ -23,7 +23,6 @@ # =20 [Sources] - Cmos.c FeatureControl.c MemDetect.c Platform.c @@ -36,6 +35,7 @@ MinPlatformPkg/MinPlatformPkg.dec SimicsX58SktPkg/SktPkg.dec SimicsIch10Pkg/Ich10Pkg.dec + BoardModulePkg/BoardModulePkg.dec =20 [Guids] gEfiMemoryTypeInformationGuid @@ -53,6 +53,7 @@ PeimEntryPoint MtrrLib PcdLib + CmosAccessLib =20 [Pcd] gSimicsOpenBoardPkgTokenSpaceGuid.PcdSimicsPeiMemFvBase diff --git a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlat= formDxe.c b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatf= ormDxe.c index 7165c0a0c3..37c659e275 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe= .c +++ b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe= .c @@ -10,35 +10,11 @@ #include "SmbiosPlatformDxe.h" =20 =20 -/** -Reads 8-bits of CMOS data. - -Reads the 8-bits of CMOS data at the location specified by Index. -The 8-bit read value is returned. - -@param Index The CMOS location to read. - -@return The value read. - -**/ -UINT8 -EFIAPI -CmosRead8( - IN UINTN Index - ) -{ - IoWrite8(0x70, (UINT8)Index); - return IoRead8(0x71); -} - UINT32 GetSystemMemorySizeBelow4gb( VOID ) { - UINT8 Cmos0x34; - UINT8 Cmos0x35; - // // CMOS 0x34/0x35 specifies the system memory above 16 MB. // * CMOS(0x35) is the high byte @@ -47,11 +23,7 @@ GetSystemMemorySizeBelow4gb( // * Since this is memory above 16MB, the 16MB must be added // into the calculation to get the total memory size. // - - Cmos0x34 =3D (UINT8)CmosRead8(0x34); - Cmos0x35 =3D (UINT8)CmosRead8(0x35); - - return (UINT32)(((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB); + return (UINT32) (((UINTN) CmosRead16 (0x34) << 16) + SIZE_16MB); } =20 STATIC @@ -61,8 +33,6 @@ GetSystemMemorySizeAbove4gb( ) { UINT32 Size; - UINTN CmosIndex; - // // CMOS 0x5b-0x5d specifies the system memory above 4GB MB. // * CMOS(0x5d) is the most significant size byte @@ -70,11 +40,7 @@ GetSystemMemorySizeAbove4gb( // * CMOS(0x5b) is the least significant size byte // * The size is specified in 64kb chunks // - - Size =3D 0; - for (CmosIndex =3D 0x5d; CmosIndex >=3D 0x5b; CmosIndex--) { - Size =3D (UINT32)(Size << 8) + (UINT32)CmosRead8(CmosIndex); - } + Size =3D (CmosRead16 (0x5c) << 8) + CmosRead8 (0x5b); =20 return LShiftU64(Size, 16); } diff --git a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlat= formDxe.h b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatf= ormDxe.h index f9c641845c..0dc174421c 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe= .h +++ b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe= .h @@ -20,6 +20,7 @@ #include #include #include +#include =20 /** Validates the SMBIOS entry point structure diff --git a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlat= formDxe.inf b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPla= tformDxe.inf index 1420a315cf..3cc6a03564 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe= .inf +++ b/Platform/Intel/SimicsOpenBoardPkg/SmbiosPlatformDxe/SmbiosPlatformDxe= .inf @@ -32,6 +32,7 @@ MdeModulePkg/MdeModulePkg.dec SimicsOpenBoardPkg/OpenBoardPkg.dec AdvancedFeaturePkg/AdvancedFeaturePkg.dec + BoardModulePkg/BoardModulePkg.dec =20 [LibraryClasses] UefiBootServicesTableLib @@ -42,6 +43,7 @@ HobLib MemoryAllocationLib IoLib + CmosAccessLib =20 [Protocols] gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED --=20 2.19.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 (#49879): https://edk2.groups.io/g/devel/message/49879 Mute This Topic: https://groups.io/mt/40542013/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-