From: "Narinder Dhillon" <ndhillon@marvell.com>
To: <devel@edk2.groups.io>
Cc: <quic_llindhol@quicinc.com>, <mw@semihalf.com>,
<sbalcerak@marvell.com>, Narinder Dhillon <ndhillon@marvell.com>
Subject: [edk2-devel] [edk2-platforms PATCH v2 3/8] Silicon/Marvell: Odyssey SmcLib
Date: Wed, 20 Dec 2023 16:54:22 -0800 [thread overview]
Message-ID: <20231221005427.13932-4-ndhillon@marvell.com> (raw)
In-Reply-To: <20231221005427.13932-1-ndhillon@marvell.com>
From: Narinder Dhillon <ndhillon@marvell.com>
This patch provides SMC call needed by Odyssey to determine available
memory size.
Signed-off-by: Narinder Dhillon <ndhillon@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
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 (#112781): https://edk2.groups.io/g/devel/message/112781
Mute This Topic: https://groups.io/mt/103292511/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2023-12-21 0:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 0:54 [edk2-devel] [edk2-platforms PATCH v2 0/8] Silicon/Marvell/OdysseyPkg: Narinder Dhillon
2023-12-21 0:54 ` [edk2-devel] [edk2-platforms PATCH v2 1/8] Silicon/Marvell: New Marvell Odyssey processor Narinder Dhillon
2024-01-12 11:14 ` Marcin Wojtas via groups.io
2023-12-21 0:54 ` [edk2-devel] [edk2-platforms PATCH v2 2/8] Silicon/Marvell: Odyssey ArmPlatformLib Narinder Dhillon
2024-01-12 11:27 ` Marcin Wojtas via groups.io
2023-12-21 0:54 ` Narinder Dhillon [this message]
2024-01-12 10:48 ` [edk2-devel] [edk2-platforms PATCH v2 3/8] Silicon/Marvell: Odyssey SmcLib Marcin Wojtas via groups.io
2023-12-21 0:54 ` [edk2-devel] [edk2-platforms PATCH v2 4/8] Silicon/Marvell: Odyssey watchdog driver Narinder Dhillon
2024-01-12 11:34 ` Marcin Wojtas via groups.io
2024-01-15 20:26 ` Narinder Dhillon
2023-12-21 0:54 ` [edk2-devel] [edk2-platforms PATCH v2 5/8] Silicon/Marvell: RTC driver Narinder Dhillon
2024-01-12 11:44 ` Marcin Wojtas via groups.io
2023-12-21 0:54 ` [edk2-devel] [edk2-platforms PATCH v2 6/8] Silicon/Marvell: Device tree driver Narinder Dhillon
2024-01-12 12:00 ` Marcin Wojtas via groups.io
2024-01-12 12:01 ` Marcin Wojtas via groups.io
2023-12-21 0:54 ` [edk2-devel] [edk2-platforms PATCH v2 7/8] Silicon/Marvell: Driver to dump board configuration Narinder Dhillon
2024-01-12 12:18 ` Marcin Wojtas via groups.io
2024-01-13 0:58 ` Narinder Dhillon
2023-12-21 0:54 ` [edk2-devel] [edk2-platforms PATCH v2 8/8] Silicon/Marvell: Odyssey project description files Narinder Dhillon
2024-01-12 13:25 ` [edk2-devel] [edk2-platforms PATCH v2 0/8] Silicon/Marvell/OdysseyPkg: Marcin Wojtas via groups.io
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=20231221005427.13932-4-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