Re: [edk2-devel] [Patch] [edk2-platforms] AdvancedFeaturePkg/Cmos: Add Cmos related libraries.

2019-05-13 Thread Liming Gao
Sure. I will send RFC for new Package. 

>-Original Message-
>From: Kubacki, Michael A
>Sent: Tuesday, May 14, 2019 2:53 AM
>To: Gao, Liming ; devel@edk2.groups.io; Dong, Eric
>
>Cc: Ni, Ray ; Desimone, Nathaniel L
>
>Subject: RE: [edk2-devel] [Patch] [edk2-platforms]
>AdvancedFeaturePkg/Cmos: Add Cmos related libraries.
>
>Agree, this is not a feature but code that may be reused to support multiple
>features.
>
>We do need a new location to hold such reusable code. Liming, would you like
>to
>send the RFC to request this new package?
>
>Thanks,
>Michael
>
>> -Original Message-
>> From: Gao, Liming
>> Sent: Monday, May 13, 2019 5:37 AM
>> To: devel@edk2.groups.io; Dong, Eric 
>> Cc: Ni, Ray ; Kubacki, Michael A
>> ; Desimone, Nathaniel L
>> 
>> Subject: RE: [edk2-devel] [Patch] [edk2-platforms]
>> AdvancedFeaturePkg/Cmos: Add Cmos related libraries.
>>
>> Eric:
>>   Now, edk2-platform devel-MinPlatform branch has merged into edk2-
>> platform master branch.
>>
>>   For this change, I propose to add new GenericBoardPkg in Platform\Intel
>> directory for the common board features.
>>
>> Thanks
>> Liming
>> > -Original Message-
>> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>> > Dong, Eric
>> > Sent: Tuesday, May 7, 2019 3:31 PM
>> > To: devel@edk2.groups.io
>> > Cc: Ni, Ray ; Kubacki, Michael A
>> > ; Desimone, Nathaniel L
>> > 
>> > Subject: [edk2-devel] [Patch] [edk2-platforms]
>AdvancedFeaturePkg/Cmos:
>> Add Cmos related libraries.
>> >
>> > https://bugzilla.tianocore.org/show_bug.cgi?id=1552
>> >
>> > Add two libraries used to provide CMOS related operation.
>> >
>> > CmosAccessLib exports below APIs:
>> >   CmosWrite32
>> >   CmosWrite16
>> >   CmosWrite8
>> >   CmosRead32
>> >   CmosRead16
>> >   CmosRead8
>> >   CmosInit
>> >
>> > PlatformCmosAccessLib export below APIs:
>> >   PlatformCmosGetEntry
>> >   PlatformCmosGetNmiState
>> >
>> > PlatformCmosAccessLib will be consumed by CmosAccessLib.
>> >
>> > Cc: Ray Ni 
>> > Cc: Michael Kubacki 
>> > Cc: Nate Desimone 
>> > Signed-off-by: Eric Dong 
>> > ---
>> >  .../Cmos/Include/Library/CmosAccessLib.h  | 112 
>> >  .../Include/Library/PlatformCmosAccessLib.h   |  74 +++
>> >  .../Library/CmosAccessLib/CmosAccessLib.c | 492
>++
>> >  .../Library/CmosAccessLib/CmosAccessLib.inf   |  34 ++
>> >  .../CmosAccessLib/CmosAccessLibInternal.h |  41 ++
>> >  .../PlatformCmosAccessLibNull.c   |  45 ++
>> >  .../PlatformCmosAccessLibNull.inf |  30 ++
>> >  7 files changed, 828 insertions(+)
>> >  create mode 100644
>> >
>>
>Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
>> >  create mode 100644
>> >
>>
>Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/PlatformCmosAc
>> c
>> > essLib.h  create mode 100644
>> >
>>
>Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAcc
>> es
>> > sLib.c  create mode 100644
>> >
>>
>Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAcc
>> es
>> > sLib.inf  create mode 100644
>> >
>>
>Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAcc
>> es
>> > sLibInternal.h  create mode 100644
>> >
>>
>Platform/Intel/AdvancedFeaturePkg/Cmos/Library/PlatformCmosAccessLibN
>> u
>> > ll/PlatformCmosAccessLibNull.c  create mode 100644
>> >
>>
>Platform/Intel/AdvancedFeaturePkg/Cmos/Library/PlatformCmosAccessLibN
>> u
>> > ll/PlatformCmosAccessLibNull.inf
>> >
>> > diff --git
>> >
>>
>a/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib
>> > .h
>> >
>>
>b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib
>> > .h
>> > new file mode 100644
>> > index 000..5f5029c
>> > --- /dev/null
>> > +++
>> b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAcces
>> > +++ sLib.h
>> > @@ -0,0 +1,112 @@
>> > +/** @file
>> > +  CmosAccessLib header file.
>> > +
>> > +Copyright (c) 2019, Intel Corporation. All rights reserved. This
>> > +program and the accompanying materials

Re: [edk2-devel] [Patch] [edk2-platforms] AdvancedFeaturePkg/Cmos: Add Cmos related libraries.

2019-05-13 Thread Kubacki, Michael A
Agree, this is not a feature but code that may be reused to support multiple 
features.

We do need a new location to hold such reusable code. Liming, would you like to 
send the RFC to request this new package?

Thanks,
Michael

> -Original Message-
> From: Gao, Liming
> Sent: Monday, May 13, 2019 5:37 AM
> To: devel@edk2.groups.io; Dong, Eric 
> Cc: Ni, Ray ; Kubacki, Michael A
> ; Desimone, Nathaniel L
> 
> Subject: RE: [edk2-devel] [Patch] [edk2-platforms]
> AdvancedFeaturePkg/Cmos: Add Cmos related libraries.
> 
> Eric:
>   Now, edk2-platform devel-MinPlatform branch has merged into edk2-
> platform master branch.
> 
>   For this change, I propose to add new GenericBoardPkg in Platform\Intel
> directory for the common board features.
> 
> Thanks
> Liming
> > -Original Message-
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Dong, Eric
> > Sent: Tuesday, May 7, 2019 3:31 PM
> > To: devel@edk2.groups.io
> > Cc: Ni, Ray ; Kubacki, Michael A
> > ; Desimone, Nathaniel L
> > 
> > Subject: [edk2-devel] [Patch] [edk2-platforms] AdvancedFeaturePkg/Cmos:
> Add Cmos related libraries.
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1552
> >
> > Add two libraries used to provide CMOS related operation.
> >
> > CmosAccessLib exports below APIs:
> >   CmosWrite32
> >   CmosWrite16
> >   CmosWrite8
> >   CmosRead32
> >   CmosRead16
> >   CmosRead8
> >   CmosInit
> >
> > PlatformCmosAccessLib export below APIs:
> >   PlatformCmosGetEntry
> >   PlatformCmosGetNmiState
> >
> > PlatformCmosAccessLib will be consumed by CmosAccessLib.
> >
> > Cc: Ray Ni 
> > Cc: Michael Kubacki 
> > Cc: Nate Desimone 
> > Signed-off-by: Eric Dong 
> > ---
> >  .../Cmos/Include/Library/CmosAccessLib.h  | 112 
> >  .../Include/Library/PlatformCmosAccessLib.h   |  74 +++
> >  .../Library/CmosAccessLib/CmosAccessLib.c | 492 ++
> >  .../Library/CmosAccessLib/CmosAccessLib.inf   |  34 ++
> >  .../CmosAccessLib/CmosAccessLibInternal.h |  41 ++
> >  .../PlatformCmosAccessLibNull.c   |  45 ++
> >  .../PlatformCmosAccessLibNull.inf |  30 ++
> >  7 files changed, 828 insertions(+)
> >  create mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
> >  create mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/PlatformCmosAc
> c
> > essLib.h  create mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAcc
> es
> > sLib.c  create mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAcc
> es
> > sLib.inf  create mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAcc
> es
> > sLibInternal.h  create mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/PlatformCmosAccessLibN
> u
> > ll/PlatformCmosAccessLibNull.c  create mode 100644
> >
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/PlatformCmosAccessLibN
> u
> > ll/PlatformCmosAccessLibNull.inf
> >
> > diff --git
> >
> a/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib
> > .h
> >
> b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib
> > .h
> > new file mode 100644
> > index 000..5f5029c
> > --- /dev/null
> > +++
> b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAcces
> > +++ sLib.h
> > @@ -0,0 +1,112 @@
> > +/** @file
> > +  CmosAccessLib header file.
> > +
> > +Copyright (c) 2019, Intel Corporation. All rights reserved. This
> > +program and the accompanying materials are licensed and made
> > +available under the terms and conditions of the BSD License that
> accompanies this distribution.
> > +The full text of the license may be found at
> > +http://opensource.org/licenses/bsd-license.php.
> > +
> > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> > +
> > +**/
> > +
> > +#ifndef _CMOS_ACCESS_LIB_H_
> > +#define _CMOS_ACCESS_LIB_H_
> > +
> > +/**
> > +  Read a byte value from a CMOS address.
> > +
> > +  @param [in] Address   Location to read from CMOS
> > +
> > +  @return The byte value read from the CMOS address.
> > +**/
> > +UINT8
> > +EFIAPI
> > +CmosRead8 (
> > +  IN  U

Re: [edk2-devel] [Patch] [edk2-platforms] AdvancedFeaturePkg/Cmos: Add Cmos related libraries.

2019-05-13 Thread Liming Gao
Eric:
  Now, edk2-platform devel-MinPlatform branch has merged into edk2-platform 
master branch.

  For this change, I propose to add new GenericBoardPkg in Platform\Intel 
directory for the common board features. 

Thanks
Liming
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Dong, 
> Eric
> Sent: Tuesday, May 7, 2019 3:31 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray ; Kubacki, Michael A 
> ; Desimone, Nathaniel L
> 
> Subject: [edk2-devel] [Patch] [edk2-platforms] AdvancedFeaturePkg/Cmos: Add 
> Cmos related libraries.
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1552
> 
> Add two libraries used to provide CMOS related operation.
> 
> CmosAccessLib exports below APIs:
>   CmosWrite32
>   CmosWrite16
>   CmosWrite8
>   CmosRead32
>   CmosRead16
>   CmosRead8
>   CmosInit
> 
> PlatformCmosAccessLib export below APIs:
>   PlatformCmosGetEntry
>   PlatformCmosGetNmiState
> 
> PlatformCmosAccessLib will be consumed by CmosAccessLib.
> 
> Cc: Ray Ni 
> Cc: Michael Kubacki 
> Cc: Nate Desimone 
> Signed-off-by: Eric Dong 
> ---
>  .../Cmos/Include/Library/CmosAccessLib.h  | 112 
>  .../Include/Library/PlatformCmosAccessLib.h   |  74 +++
>  .../Library/CmosAccessLib/CmosAccessLib.c | 492 ++
>  .../Library/CmosAccessLib/CmosAccessLib.inf   |  34 ++
>  .../CmosAccessLib/CmosAccessLibInternal.h |  41 ++
>  .../PlatformCmosAccessLibNull.c   |  45 ++
>  .../PlatformCmosAccessLibNull.inf |  30 ++
>  7 files changed, 828 insertions(+)
>  create mode 100644 
> Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
>  create mode 100644 
> Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/PlatformCmosAccessLib.h
>  create mode 100644 
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAccessLib.c
>  create mode 100644 
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAccessLib.inf
>  create mode 100644 
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAccessLibInternal.h
>  create mode 100644 
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLibNull.c
>  create mode 100644 
> Platform/Intel/AdvancedFeaturePkg/Cmos/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLibNull.inf
> 
> diff --git 
> a/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
> b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
> new file mode 100644
> index 000..5f5029c
> --- /dev/null
> +++ b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
> @@ -0,0 +1,112 @@
> +/** @file
> +  CmosAccessLib header file.
> +
> +Copyright (c) 2019, Intel Corporation. All rights reserved.
> +This program and the accompanying materials are licensed and made available 
> under
> +the terms and conditions of the BSD License that accompanies this 
> distribution.
> +The full text of the license may be found at
> +http://opensource.org/licenses/bsd-license.php.
> +
> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +
> +**/
> +
> +#ifndef _CMOS_ACCESS_LIB_H_
> +#define _CMOS_ACCESS_LIB_H_
> +
> +/**
> +  Read a byte value from a CMOS address.
> +
> +  @param [in] Address   Location to read from CMOS
> +
> +  @return The byte value read from the CMOS address.
> +**/
> +UINT8
> +EFIAPI
> +CmosRead8 (
> +  IN  UINT8 Address
> +  );
> +
> +/**
> +  Write a byte value to a CMOS address.
> +
> +  @param [in] Address Location to write to CMOS.
> +  @param [in] DataThe byte value write to the CMOS address.
> +**/
> +VOID
> +EFIAPI
> +CmosWrite8 (
> +  IN UINT8 Address,
> +  IN UINT8 Data
> +  );
> +
> +/**
> +  Read a word value from a CMOS address.
> +
> +  @param [in] Address   Location to read from CMOS
> +
> +  @return The word value read from the CMOS address.
> +**/
> +UINT16
> +EFIAPI
> +CmosRead16 (
> +  IN  UINT8  Address
> +  );
> +
> +/**
> +  Write a word value to a CMOS address.
> +
> +  @param [in] Address Location to write to CMOS.
> +  @param [in] DataThe word value write to the CMOS address.
> +**/
> +VOID
> +EFIAPI
> +CmosWrite16 (
> +  IN UINT8  Address,
> +  IN UINT16 Data
> +  );
> +
> +/**
> +  Read a dword value from a CMOS address.
> +
> +  @param [in] Address   Location to read from CMOS
> +
> +  @return The dword value read from the CMOS address.
> +**/
> +UINT32
> +EFIAPI
> +CmosRead32 (
> +  IN  

[edk2-devel] [Patch] [edk2-platforms] AdvancedFeaturePkg/Cmos: Add Cmos related libraries.

2019-05-07 Thread Dong, Eric
https://bugzilla.tianocore.org/show_bug.cgi?id=1552

Add two libraries used to provide CMOS related operation.

CmosAccessLib exports below APIs:
  CmosWrite32
  CmosWrite16
  CmosWrite8
  CmosRead32
  CmosRead16
  CmosRead8
  CmosInit

PlatformCmosAccessLib export below APIs:
  PlatformCmosGetEntry
  PlatformCmosGetNmiState

PlatformCmosAccessLib will be consumed by CmosAccessLib.

Cc: Ray Ni 
Cc: Michael Kubacki 
Cc: Nate Desimone 
Signed-off-by: Eric Dong 
---
 .../Cmos/Include/Library/CmosAccessLib.h  | 112 
 .../Include/Library/PlatformCmosAccessLib.h   |  74 +++
 .../Library/CmosAccessLib/CmosAccessLib.c | 492 ++
 .../Library/CmosAccessLib/CmosAccessLib.inf   |  34 ++
 .../CmosAccessLib/CmosAccessLibInternal.h |  41 ++
 .../PlatformCmosAccessLibNull.c   |  45 ++
 .../PlatformCmosAccessLibNull.inf |  30 ++
 7 files changed, 828 insertions(+)
 create mode 100644 
Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
 create mode 100644 
Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/PlatformCmosAccessLib.h
 create mode 100644 
Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAccessLib.c
 create mode 100644 
Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAccessLib.inf
 create mode 100644 
Platform/Intel/AdvancedFeaturePkg/Cmos/Library/CmosAccessLib/CmosAccessLibInternal.h
 create mode 100644 
Platform/Intel/AdvancedFeaturePkg/Cmos/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLibNull.c
 create mode 100644 
Platform/Intel/AdvancedFeaturePkg/Cmos/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLibNull.inf

diff --git 
a/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h 
b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
new file mode 100644
index 000..5f5029c
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/CmosAccessLib.h
@@ -0,0 +1,112 @@
+/** @file
+  CmosAccessLib header file.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _CMOS_ACCESS_LIB_H_
+#define _CMOS_ACCESS_LIB_H_
+
+/**
+  Read a byte value from a CMOS address.
+
+  @param [in] Address   Location to read from CMOS
+
+  @return The byte value read from the CMOS address.
+**/
+UINT8
+EFIAPI
+CmosRead8 (
+  IN  UINT8 Address
+  );
+
+/**
+  Write a byte value to a CMOS address.
+
+  @param [in] Address Location to write to CMOS.
+  @param [in] DataThe byte value write to the CMOS address.
+**/
+VOID
+EFIAPI
+CmosWrite8 (
+  IN UINT8 Address,
+  IN UINT8 Data
+  );
+
+/**
+  Read a word value from a CMOS address.
+
+  @param [in] Address   Location to read from CMOS
+
+  @return The word value read from the CMOS address.
+**/
+UINT16
+EFIAPI
+CmosRead16 (
+  IN  UINT8  Address
+  );
+
+/**
+  Write a word value to a CMOS address.
+
+  @param [in] Address Location to write to CMOS.
+  @param [in] DataThe word value write to the CMOS address.
+**/
+VOID
+EFIAPI
+CmosWrite16 (
+  IN UINT8  Address,
+  IN UINT16 Data
+  );
+
+/**
+  Read a dword value from a CMOS address.
+
+  @param [in] Address   Location to read from CMOS
+
+  @return The dword value read from the CMOS address.
+**/
+UINT32
+EFIAPI
+CmosRead32 (
+  IN  UINT8  Address
+  );
+
+/**
+  Write a dword value to a CMOS address.
+
+  @param [in] Address Location to write to CMOS.
+  @param [in] DataThe dword value write to the CMOS address.
+**/
+VOID
+EFIAPI
+CmosWrite32 (
+  IN UINT8  Address,
+  IN UINT32 Data
+  );
+
+/**
+  Initialize the CMOS.
+
+  It initialize the CMOS area when Force is TRUE or the checksum is incorrect.
+
+  @param[in]  Force  TRUE indicating initializing the CMOS area without 
checking the checksum.
+
+  @retval TRUE  The CMOS is initialized to default value.
+  @retval FALSE The CMOS isn't initialized to default value.
+**/
+BOOLEAN
+EFIAPI
+CmosInit (
+  IN  BOOLEAN Force
+  );
+
+#endif // _CMOS_ACCESS_LIB_H_
diff --git 
a/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/PlatformCmosAccessLib.h
 
b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/PlatformCmosAccessLib.h
new file mode 100644
index 000..8c44ae2
--- /dev/null
+++ 
b/Platform/Intel/AdvancedFeaturePkg/Cmos/Include/Library/PlatformCmosAccessLib.h
@@ -0,0 +1,74 @@
+/** @file
+  Platform CMOS Access Library Header File.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this