+marcin.s.woj...@gmail.com

Hi Narinder,

czw., 21 gru 2023 o 01:54 Narinder Dhillon <ndhil...@marvell.com> napisaƂ(a):
>
> From: Narinder Dhillon <ndhil...@marvell.com>
>
> This patch provides SMC call needed by Odyssey to determine available
> memory size.
>
> Signed-off-by: Narinder Dhillon <ndhil...@marvell.com>
> ---
>  Silicon/Marvell/Library/SmcLib/SmcLib.c       | 24 +++++++++++++++
>  Silicon/Marvell/Library/SmcLib/SmcLib.inf     | 29 +++++++++++++++++++
>  .../Include/Library/SmcLib.h                  | 28 ++++++++++++++++++
>  3 files changed, 81 insertions(+)
>  create mode 100644 Silicon/Marvell/Library/SmcLib/SmcLib.c
>  create mode 100644 Silicon/Marvell/Library/SmcLib/SmcLib.inf
>  create mode 100644 Silicon/Marvell/MarvellSiliconPkg/Include/Library/SmcLib.h
>
> diff --git a/Silicon/Marvell/Library/SmcLib/SmcLib.c 
> b/Silicon/Marvell/Library/SmcLib/SmcLib.c
> new file mode 100644
> index 0000000000..20a2fb2017
> --- /dev/null
> +++ b/Silicon/Marvell/Library/SmcLib/SmcLib.c
> @@ -0,0 +1,24 @@
> +/** @file
> +*
> +* SPDX-License-Identifier: BSD-2-Clause-Patent
> +* https://spdx.org/licenses
> +*
> +* Copyright (C) 2023 Marvell
> +*
> +* Source file for Marvell SMC Interface
> +*
> +**/
> +
> +#include <Library/SmcLib.h>
> +#include <Library/ArmSmcLib.h>  // ArmCallSmc
> +
> +UINTN SmcGetRamSize ( IN UINTN Node )
> +{
> +  ARM_SMC_ARGS ArmSmcArgs;
> +
> +  ArmSmcArgs.Arg0 = MV_SMC_ID_DRAM_SIZE;
> +  ArmSmcArgs.Arg1 = Node;
> +  ArmCallSmc (&ArmSmcArgs);
> +
> +  return ArmSmcArgs.Arg0;
> +}
> diff --git a/Silicon/Marvell/Library/SmcLib/SmcLib.inf 
> b/Silicon/Marvell/Library/SmcLib/SmcLib.inf
> new file mode 100644
> index 0000000000..7fc1085b85
> --- /dev/null
> +++ b/Silicon/Marvell/Library/SmcLib/SmcLib.inf
> @@ -0,0 +1,29 @@
> +#/** @file
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +# https://spdx.org/licenses
> +#
> +# Copyright (C) 2023 Marvell
> +#
> +# Marvell SMC Interface library
> +#
> +#**/
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = SmcLib
> +  FILE_GUID                      = fee427a7-816a-4636-bb81-a640c8288f28
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  LIBRARY_CLASS                  = SmcLib
> +
> +[Sources]
> +  SmcLib.c
> +
> +[Packages]
> +  ArmPkg/ArmPkg.dec
> +  MdePkg/MdePkg.dec
> +  Silicon/Marvell/MarvellSiliconPkg/MarvellSiliconPkg.dec
> +
> +[LibraryClasses]
> +  ArmSmcLib
> diff --git a/Silicon/Marvell/MarvellSiliconPkg/Include/Library/SmcLib.h 
> b/Silicon/Marvell/MarvellSiliconPkg/Include/Library/SmcLib.h

This file should be placed in
Silicon/Marvell/MarvellSiliconPkg/Include/IndustryStandard and:
- either renamed to e.g. OdysseySmcLib.h
- or its contents merged with existing
Silicon/Marvell/MarvellSiliconPkg/Include/IndustryStandard/MvSmc.h
The SMC ID's are not conflicting, so the latter could be pretty clean,
assuming comments above the #define groups:

/* Marvell Armada/Cn913x SiP services SMC ID's */
#define MV_SMC_ID_COMPHY_POWER_ON         0x82000001
#define MV_SMC_ID_COMPHY_POWER_OFF        0x82000002
#define MV_SMC_ID_COMPHY_PLL_LOCK         0x82000003
...

/* Marvell Odyssey SiP services SMC ID's */
#define MV_SMC_ID_CALL_COUNT              0xc200ff00
...

Best regards,
Marcin

> new file mode 100644
> index 0000000000..f2d0bed356
> --- /dev/null
> +++ b/Silicon/Marvell/MarvellSiliconPkg/Include/Library/SmcLib.h
> @@ -0,0 +1,28 @@
> +/** @file
> +*
> +* SPDX-License-Identifier: BSD-2-Clause-Patent
> +* https://spdx.org/licenses
> +*
> +* Copyright (C) 2023 Marvell
> +*
> +* Header file for for Marvell SMC Interface
> +*
> +**/
> +
> +#ifndef __SMCLIB_H__
> +#define __SMCLIB_H__
> +
> +/* SMC function IDs for Marvell Service queries */
> +
> +#define MV_SMC_ID_CALL_COUNT              0xc200ff00
> +#define MV_SMC_ID_UID                     0xc200ff01
> +
> +#define MV_SMC_ID_VERSION                 0xc200ff03
> +
> +/* x1 - node number */
> +#define MV_SMC_ID_DRAM_SIZE               0xc2000301
> +
> +
> +UINTN SmcGetRamSize (IN UINTN Node);
> +
> +#endif
> --
> 2.34.1
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113709): https://edk2.groups.io/g/devel/message/113709
Mute This Topic: https://groups.io/mt/103292511/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to