--- /dev/null
+/** @file\r
+*\r
+* Copyright (c) 2012, ARM Limited. All rights reserved.\r
+*\r
+* This program and the accompanying materials\r
+* are licensed and made available under the terms and conditions of the BSD License\r
+* which accompanies this distribution. The full text of the license may be found at\r
+* http://opensource.org/licenses/bsd-license.php\r
+*\r
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#ifndef __ARM_SMC_LIB__\r
+#define __ARM_SMC_LIB__\r
+\r
+VOID\r
+ArmCallSmc (\r
+ IN OUT UINTN *Rx\r
+ );\r
+\r
+VOID\r
+ArmCallSmcArg1 (\r
+ IN OUT UINTN *Rx,\r
+ IN OUT UINTN *Arg1\r
+ );\r
+\r
+VOID\r
+ArmCallSmcArg2 (\r
+ IN OUT UINTN *Rx,\r
+ IN OUT UINTN *Arg1,\r
+ IN OUT UINTN *Arg2\r
+ );\r
+\r
+VOID\r
+ArmCallSmcArg3 (\r
+ IN OUT UINTN *Rx,\r
+ IN OUT UINTN *Arg1,\r
+ IN OUT UINTN *Arg2,\r
+ IN OUT UINTN *Arg3\r
+ );\r
+\r
+#endif\r
--- /dev/null
+//\r
+// Copyright (c) 2012, ARM Limited. All rights reserved.\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+//\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+//\r
+\r
+.text\r
+.align 3\r
+.arch_extension sec\r
+\r
+GCC_ASM_EXPORT(ArmCallSmc)\r
+GCC_ASM_EXPORT(ArmCallSmcArg1)\r
+GCC_ASM_EXPORT(ArmCallSmcArg2)\r
+GCC_ASM_EXPORT(ArmCallSmcArg3)\r
+\r
+ASM_PFX(ArmCallSmc):\r
+ push {r1}\r
+ mov r1, r0\r
+ ldr r0,[r1]\r
+ smc #0\r
+ str r0,[r1]\r
+ pop {r1}\r
+ blx lr\r
+\r
+// Arg1 in R1\r
+ASM_PFX(ArmCallSmcArg1):\r
+ push {r2-r3}\r
+ mov r2, r0\r
+ mov r3, r1\r
+ ldr r0,[r2]\r
+ ldr r1,[r3]\r
+ smc #0\r
+ str r0,[r2]\r
+ str r1,[r3]\r
+ pop {r2-r3}\r
+ blx lr\r
+\r
+ASM_PFX(ArmCallSmcArg2):\r
+ push {r3-r5}\r
+ mov r3, r0\r
+ mov r4, r1\r
+ mov r5, r2\r
+ ldr r0,[r3]\r
+ ldr r1,[r4]\r
+ ldr r2,[r5]\r
+ smc #0\r
+ str r0,[r3]\r
+ str r1,[r4]\r
+ str r2,[r5]\r
+ pop {r3-r5}\r
+ blx lr\r
+\r
+ASM_PFX(ArmCallSmcArg3):\r
+ push {r4-r7}\r
+ mov r4, r0\r
+ mov r5, r1\r
+ mov r6, r2\r
+ mov r7, r3\r
+ ldr r0,[r4]\r
+ ldr r1,[r5]\r
+ ldr r2,[r6]\r
+ ldr r3,[r7]\r
+ smc #0\r
+ str r0,[r4]\r
+ str r1,[r5]\r
+ str r2,[r6]\r
+ str r3,[r7]\r
+ pop {r4-r7}\r
+ blx lr\r
--- /dev/null
+//\r
+// Copyright (c) 2012, ARM Limited. All rights reserved.\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+//\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+//\r
+\r
+ EXPORT ArmCallSmc\r
+ EXPORT ArmCallSmcArg1\r
+ EXPORT ArmCallSmcArg2\r
+ EXPORT ArmCallSmcArg3\r
+\r
+ AREA ArmSmc, CODE, READONLY\r
+\r
+ArmCallSmc\r
+ push {r1}\r
+ mov r1, r0\r
+ ldr r0,[r1]\r
+ smc #0\r
+ str r0,[r1]\r
+ pop {r1}\r
+ blx lr\r
+\r
+// Arg1 in R1\r
+ArmCallSmcArg1\r
+ push {r2-r3}\r
+ mov r2, r0\r
+ mov r3, r1\r
+ ldr r0,[r2]\r
+ ldr r1,[r3]\r
+ smc #0\r
+ str r0,[r2]\r
+ str r1,[r3]\r
+ pop {r2-r3}\r
+ blx lr\r
+\r
+ArmCallSmcArg2\r
+ push {r3-r5}\r
+ mov r3, r0\r
+ mov r4, r1\r
+ mov r5, r2\r
+ ldr r0,[r3]\r
+ ldr r1,[r4]\r
+ ldr r2,[r5]\r
+ smc #0\r
+ str r0,[r3]\r
+ str r1,[r4]\r
+ str r2,[r5]\r
+ pop {r3-r5}\r
+ blx lr\r
+\r
+ArmCallSmcArg3\r
+ push {r4-r7}\r
+ mov r4, r0\r
+ mov r5, r1\r
+ mov r6, r2\r
+ mov r7, r3\r
+ ldr r0,[r4]\r
+ ldr r1,[r5]\r
+ ldr r2,[r6]\r
+ ldr r3,[r7]\r
+ smc #0\r
+ str r0,[r4]\r
+ str r1,[r5]\r
+ str r2,[r6]\r
+ str r3,[r7]\r
+ pop {r4-r7}\r
+ blx lr\r
+\r
+ END\r
--- /dev/null
+#/** @file\r
+# \r
+# Copyright (c) 2012, ARM Ltd. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# \r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# \r
+#**/\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = ArmSmcLib\r
+ FILE_GUID = eb3f17d5-a3cc-4eac-8912-84162d0f79da \r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = ArmSmcLib\r
+ \r
+[Sources.common]\r
+ ArmSmc.asm | RVCT\r
+ ArmSmc.S | GCC\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ ArmPlatformPkg/ArmPlatformPkg.dec\r