--- /dev/null
+/** @file\r
+ Processor or Compiler specific defines and types for LoongArch\r
+\r
+ Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef PROCESSOR_BIND_H_\r
+#define PROCESSOR_BIND_H_\r
+\r
+//\r
+// Define the processor type so other code can make processor based choices\r
+//\r
+#define MDE_CPU_LOONGARCH64\r
+\r
+#define EFIAPI\r
+\r
+//\r
+// Make sure we are using the correct packing rules per EFI specification\r
+//\r
+#ifndef __GNUC__\r
+ #pragma pack()\r
+#endif\r
+\r
+//\r
+// Assume standard LoongArch 64-bit alignment.\r
+// Need to check portability of long long\r
+//\r
+typedef unsigned long UINT64;\r
+typedef long INT64;\r
+typedef unsigned int UINT32;\r
+typedef int INT32;\r
+typedef unsigned short UINT16;\r
+typedef unsigned short CHAR16;\r
+typedef short INT16;\r
+typedef unsigned char BOOLEAN;\r
+typedef unsigned char UINT8;\r
+typedef char CHAR8;\r
+typedef char INT8;\r
+\r
+//\r
+// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r
+// 8 bytes on supported 64-bit processor instructions)\r
+//\r
+\r
+typedef UINT64 UINTN;\r
+\r
+//\r
+// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r
+// 8 bytes on supported 64-bit processor instructions)\r
+//\r
+typedef INT64 INTN;\r
+\r
+//\r
+// Processor specific defines\r
+//\r
+\r
+//\r
+// A value of native width with the highest bit set.\r
+//\r
+#define MAX_BIT 0x8000000000000000ULL\r
+//\r
+// A value of native width with the two highest bits set.\r
+//\r
+#define MAX_2_BITS 0xC000000000000000ULL\r
+\r
+//\r
+// Maximum legal LoongArch 64-bit address\r
+//\r
+#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
+\r
+//\r
+// Maximum usable address at boot time (48 bits using 4KB pages)\r
+//\r
+#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL\r
+\r
+//\r
+// Maximum legal LoongArch 64-bit INTN and UINTN values.\r
+//\r
+#define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)\r
+#define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)\r
+\r
+//\r
+// Page allocation granularity for LoongArch\r
+//\r
+#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
+#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)\r
+\r
+#if defined (__GNUC__)\r
+//\r
+// For GNU assembly code, .global or .globl can declare global symbols.\r
+// Define this macro to unify the usage.\r
+//\r
+#define ASM_GLOBAL .globl\r
+#endif\r
+\r
+//\r
+// The stack alignment required for LoongArch\r
+//\r
+#define CPU_STACK_ALIGNMENT 16\r
+\r
+/**\r
+ Return the pointer to the first instruction of a function given a function pointer.\r
+ On LOONGARCH CPU architectures, these two pointer values are the same,\r
+ so the implementation of this macro is very simple.\r
+\r
+ @param FunctionPointer A pointer to a function.\r
+\r
+ @return The pointer to the first instruction of a function given a function pointer.\r
+\r
+**/\r
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
+\r
+#ifndef __USER_LABEL_PREFIX__\r
+#define __USER_LABEL_PREFIX__\r
+#endif\r
+\r
+#endif\r
# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>\r
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
# (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP<BR>\r
+# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>\r
#\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
[Includes.RISCV64]\r
Include/RiscV64\r
\r
+[Includes.LOONGARCH64]\r
+ Include/LoongArch64\r
+\r
[LibraryClasses]\r
## @libraryclass Provides most usb APIs to support the Hid requests defined in Usb Hid 1.1 spec\r
# and the standard requests defined in Usb 1.1 spec.\r
# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>\r
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>\r
+# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>\r
#\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
PLATFORM_VERSION = 1.08\r
DSC_SPECIFICATION = 0x00010005\r
OUTPUT_DIRECTORY = Build/Mde\r
- SUPPORTED_ARCHITECTURES = IA32|X64|EBC|ARM|AARCH64|RISCV64\r
+ SUPPORTED_ARCHITECTURES = IA32|X64|EBC|ARM|AARCH64|RISCV64|LOONGARCH64\r
BUILD_TARGETS = DEBUG|RELEASE|NOOPT\r
SKUID_IDENTIFIER = DEFAULT\r
\r