public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Narinder Dhillon" <ndhillon@marvell.com>
To: <devel@edk2.groups.io>
Cc: <quic_llindhol@quicinc.com>, <marcin.s.wojtas@gmail.com>,
	<sbalcerak@marvell.com>, <AbdulLateef.Attar@amd.com>,
	Narinder Dhillon <ndhillon@marvell.com>
Subject: [edk2-devel] [edk2-platforms PATCH v4 2/7] Silicon/Marvell: Odyssey SmcLib
Date: Sat, 4 May 2024 14:32:25 -0700	[thread overview]
Message-ID: <20240504213230.31976-3-ndhillon@marvell.com> (raw)
In-Reply-To: <20240504213230.31976-1-ndhillon@marvell.com>

From: Narinder Dhillon <ndhillon@marvell.com>

This patch provides SMC call needed by Odyssey to determine size
of available memory.

Signed-off-by: Narinder Dhillon <ndhillon@marvell.com>
---
 Silicon/Marvell/Library/SmcLib/SmcLib.c       | 24 +++++++++++++++
 Silicon/Marvell/Library/SmcLib/SmcLib.inf     | 29 +++++++++++++++++++
 .../Include/IndustryStandard/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/IndustryStandard/SmcLib.h

diff --git a/Silicon/Marvell/Library/SmcLib/SmcLib.c b/Silicon/Marvell/Library/SmcLib/SmcLib.c
new file mode 100644
index 0000000000..0280983dd0
--- /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 <IndustryStandard/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/IndustryStandard/SmcLib.h b/Silicon/Marvell/MarvellSiliconPkg/Include/IndustryStandard/SmcLib.h
new file mode 100644
index 0000000000..5251f4cd00
--- /dev/null
+++ b/Silicon/Marvell/MarvellSiliconPkg/Include/IndustryStandard/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 (#118567): https://edk2.groups.io/g/devel/message/118567
Mute This Topic: https://groups.io/mt/105913424/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-05-04 21:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04 21:32 [edk2-devel] [edk2-platforms PATCH v4 0/7] Silicon/Marvell/OdysseyPkg Narinder Dhillon
2024-05-04 21:32 ` [edk2-devel] [edk2-platforms PATCH v4 1/7] Silicon/Marvell: New Marvell Odyssey processor Narinder Dhillon
2024-05-04 21:32 ` Narinder Dhillon [this message]
2024-05-04 21:32 ` [edk2-devel] [edk2-platforms PATCH v4 3/7] Silicon/Marvell: Odyssey watchdog driver Narinder Dhillon
2024-05-04 21:32 ` [edk2-devel] [edk2-platforms PATCH v4 4/7] Silicon/Marvell: Device tree driver Narinder Dhillon
2024-05-04 21:32 ` [edk2-devel] [edk2-platforms PATCH v4 5/7] Silicon/Marvell: Driver to publish device tree Narinder Dhillon
2024-05-04 21:32 ` [edk2-devel] [edk2-platforms PATCH v4 6/7] Silicon/Marvell: Command to dump " Narinder Dhillon
2024-05-04 21:32 ` [edk2-devel] [edk2-platforms PATCH v4 7/7] Silicon/Marvell: Odyssey project description files Narinder Dhillon
  -- strict thread matches above, loose matches on Subject: below --
2024-07-20 19:53 [edk2-devel] [edk2-platforms PATCH v4 0/7] Silicon/Marvell/OdysseyPkg Narinder Dhillon
2024-07-20 19:53 ` [edk2-devel] [edk2-platforms PATCH v4 2/7] Silicon/Marvell: Odyssey SmcLib Narinder Dhillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240504213230.31976-3-ndhillon@marvell.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox