From 6e3f2d5424ad56d37a309f6301c3f56e623304a0 Mon Sep 17 00:00:00 2001 From: doupengda Date: Thu, 6 Jul 2023 14:30:34 +0800 Subject: [PATCH] gnu-efi add CHAR16 for loongarch64 --- 0001-gnu-efi-add-CHAR16-for-loongarch64.patch | 90 +++++++++++++++++++ gnu-efi.spec | 12 ++- 2 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 0001-gnu-efi-add-CHAR16-for-loongarch64.patch diff --git a/0001-gnu-efi-add-CHAR16-for-loongarch64.patch b/0001-gnu-efi-add-CHAR16-for-loongarch64.patch new file mode 100644 index 0000000..6c0b8b8 --- /dev/null +++ b/0001-gnu-efi-add-CHAR16-for-loongarch64.patch @@ -0,0 +1,90 @@ +From fa8ec7665759ac492e7d4f5371acdab4f866e2b0 Mon Sep 17 00:00:00 2001 +From: doupengda +Date: Thu, 6 Jul 2023 06:22:38 +0000 +Subject: [PATCH] gnu-efi add CHAR16 for loongarch64 + +--- + Make.defaults | 5 +++++ + apps/AllocPages.c | 4 ++++ + apps/FreePages.c | 5 ++++- + inc/loongarch64/efibind.h | 6 ++++++ + 4 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/Make.defaults b/Make.defaults +index 1277d14..434a44e 100755 +--- a/Make.defaults ++++ b/Make.defaults +@@ -149,6 +149,11 @@ ifeq ($(ARCH),mips64el) + ARCH3264 = -mabi=64 + endif + ++ifeq ($(ARCH),loongarch64) ++ CFLAGS += -march=loongarch64 ++ ARCH3264 = -mabi=lp64d ++endif ++ + # + # Set HAVE_EFI_OBJCOPY if objcopy understands --target efi-[app|bsdrv|rtdrv], + # otherwise we need to compose the PE/COFF header using the assembler +diff --git a/apps/AllocPages.c b/apps/AllocPages.c +index bb81849..b475355 100644 +--- a/apps/AllocPages.c ++++ b/apps/AllocPages.c +@@ -92,7 +92,11 @@ BS_Code 0000000071902000-00000000721FEFFF 00000000000008FD 000000000000000F + + + #define MAX_NUM_PAGES 0x000000000F000000 ++#ifdef __loongarch64 ++#define MAX_ADDR (((9ULL << 60) | (0xC << 28)) -1) ++#else + #define MAX_ADDR ((1ULL << 46) - 1) ++#endif + + + #ifdef DEBUG +diff --git a/apps/FreePages.c b/apps/FreePages.c +index 247c75d..020f17c 100644 +--- a/apps/FreePages.c ++++ b/apps/FreePages.c +@@ -67,8 +67,11 @@ Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F + */ + + #define MAX_NUM_PAGES 0x000000000F000000 +- ++#ifdef __loongarch64 ++#define MAX_ADDR (((9ULL << 60) | (0xC << 28)) -1) ++#else + #define MAX_ADDR ((1ULL << 46) - 1) ++#endif + + #ifdef DEBUG + #undef DEBUG +diff --git a/inc/loongarch64/efibind.h b/inc/loongarch64/efibind.h +index aaf3fb7..23178a0 100644 +--- a/inc/loongarch64/efibind.h ++++ b/inc/loongarch64/efibind.h +@@ -46,6 +46,10 @@ typedef int64_t intptr_t; + # define __WCHAR_TYPE__ short + #endif + ++#ifndef __CHAR16_TYPE__ ++# define __CHAR16_TYPE__ unsigned short ++#endif ++ + typedef uint64_t UINT64; + typedef int64_t INT64; + +@@ -54,8 +58,10 @@ typedef int32_t INT32; + + typedef uint16_t UINT16; + typedef int16_t INT16; ++typedef __CHAR16_TYPE__ CHAR16; + typedef uint8_t UINT8; + typedef int8_t INT8; ++typedef char CHAR8; + typedef __WCHAR_TYPE__ WCHAR; + + #undef VOID +-- +2.33.0 + diff --git a/gnu-efi.spec b/gnu-efi.spec index 48f2a75..5b91c8b 100644 --- a/gnu-efi.spec +++ b/gnu-efi.spec @@ -1,15 +1,16 @@ %define debug_package %{nil} Name: gnu-efi Version: 3.0.17 -Release: 1 +Release: 2 Summary: Development Libraries and headers for EFI Epoch: 1 License: BSD URL: https://sourceforge.net/projects/gnu-efi -ExclusiveArch: x86_64 aarch64 +ExclusiveArch: x86_64 aarch64 loongarch64 Source0: https://sourceforge.net/projects/gnu-efi/files/%{name}-%{version}.tar.bz2 #stubs-32.h comes from http://www.gnu.org/software/glibc/ Source1: stubs-32.h +Patch1: 0001-gnu-efi-add-CHAR16-for-loongarch64.patch %global efidir %(eval echo $(grep ^ID= /etc/os-release | sed 's/^ID=//')) @@ -19,6 +20,10 @@ Source1: stubs-32.h %ifarch aarch64 %global efiarch aarch64 %endif +%ifarch loongarch64 +%global efiarch loongarch64 +%endif + Provides: %{name}-utils = %{epoch}:%{version}-%{release} Obsoletes: %{name}-utils < %{epoch}:%{version}-%{release} @@ -78,6 +83,9 @@ mv ia32/apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/%{efidir}/ia3 %{_includedir}/efi %changelog +* Thu Jul 6 2023 doupengda - 1:3.0.17-2 +- gnu-efi add CHAR16 for loongarch64 + * Tue Jun 20 2023 chenchen - 1:3.0.17-1 - Upgrade to version 3.0.17 -- Gitee