Reviewed-by: Nate DeSimone <[email protected]>

-----Original Message-----
From: Agyeman, Prince <[email protected]> 
Sent: Tuesday, October 29, 2019 3:27 PM
To: [email protected]
Cc: Sinha, Ankit <[email protected]>; Desimone, Nathaniel L 
<[email protected]>; Kubacki, Michael A 
<[email protected]>
Subject: [edk2-platforms] [PATCH] SimicsOpenBoardPkg: Add CmosAccessLib to 
BoardX58Ich10

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2164

Replaced Cmos.c and Cmos.h with BoardModulePkg's Cmos library CmosAccessLib

Cc: Ankit Sinha <[email protected]>
Cc: Nate DeSimone <[email protected]>
Cc: Kubacki Michael A <[email protected]>

Signed-off-by: Prince Agyeman <[email protected]>
---
 .../BoardX58Ich10/OpenBoardPkg.dsc            |  2 +
 .../Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c | 57 -------------------  
.../Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h | 50 ----------------  
.../SimicsOpenBoardPkg/SimicsPei/MemDetect.c  |  4 +-
 .../SimicsOpenBoardPkg/SimicsPei/Platform.c   |  4 +-
 .../SimicsPei/SimicsPei.inf                   |  3 +-
 6 files changed, 8 insertions(+), 112 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/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 4f8ab4170d..67f1680a4f 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -115,6 +115,8 @@
   
SerializeVariablesLib|$(BOARD_PKG)/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   
SiliconPolicyInitLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyInitLib/SiliconPolicyInitLib.inf
   
SiliconPolicyUpdateLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyUpdateLib/SiliconPolicyUpdateLib.inf
+
+ PlatformCmosAccessLib|BoardModulePkg/Library/PlatformCmosAccessLibNull
+ /PlatformCmosAccessLibNull.inf
+ CmosAccessLib|BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf
 
 [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. <BR>
-
-  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. <BR>
-
-  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/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
index ee0eead5a8..4d16fd2fac 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
@@ -22,11 +22,11 @@
 #include <Library/PeimEntryPoint.h>
 #include <Library/ResourcePublicationLib.h>
 #include <Library/MtrrLib.h>
+#include <Library/CmosAccessLib.h>
 #include <SimicsPlatforms.h>
 #include <Guid/SmramMemoryReserve.h>
 
 #include "Platform.h"
-#include "Cmos.h"
 
 UINT8 mPhysMemAddressWidth;
 
@@ -105,7 +105,7 @@ GetSystemMemorySizeAbove4gb (
   )
 {
   UINT32 Size;
-  UINTN  CmosIndex;
+  UINT8  CmosIndex;
 
   //
   // CMOS 0x5b-0x5d specifies the system memory above 4GB MB.
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c 
b/Platform/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 <Library/PeimEntryPoint.h>
 #include <Library/PeiServicesLib.h>
 #include <Library/ResourcePublicationLib.h>
+#include <Library/CmosAccessLib.h>
 #include <Guid/MemoryTypeInformation.h>  #include <Ppi/MasterBootMode.h>  
#include <IndustryStandard/Pci22.h>  #include <SimicsPlatforms.h>
 
 #include "Platform.h"
-#include "Cmos.h"
 
 EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
   { EfiACPIMemoryNVS,       0x004 },
@@ -524,7 +524,7 @@ DebugDumpCmos (
   VOID
   )
 {
-  UINT32 Loop;
+  UINT8 Loop;
 
   DEBUG ((EFI_D_INFO, "CMOS:\n"));
 
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf 
b/Platform/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 @@
 #
 
 [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
 
 [Guids]
   gEfiMemoryTypeInformationGuid
@@ -53,6 +53,7 @@
   PeimEntryPoint
   MtrrLib
   PcdLib
+  CmosAccessLib
 
 [Pcd]
   gSimicsOpenBoardPkgTokenSpaceGuid.PcdSimicsPeiMemFvBase
--
2.19.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49693): https://edk2.groups.io/g/devel/message/49693
Mute This Topic: https://groups.io/mt/39678428/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to