From nobody Sun Apr 28 19:15:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65443+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65443+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=mail.si-head.nl ARC-Seal: i=1; a=rsa-sha256; t=1600776234; cv=none; d=zohomail.com; s=zohoarc; b=XL8Wc0ogbqbk2Oe87Ble1zZcbjjAw0htxWKujVuYh8Bmq1cGrTal32Q8sgdZzPLdNV482xExU6svxuQ3yyLEHS1BHutoxyLenPylxmnvSltnHupvHVY/isIY8tiOBw0r4LxWqnw8/zBff7tlrBV5E3IXF1iSRadPIDY+68ll+RI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600776234; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=YIro56IpWEkYrPh8bLC1FTFlKevqpKD8ZtBMq6zny/U=; b=ceDQYcxx7e57Jl56iKyPSXhPRvt+c0zF3ugr6TBp/x6H8s5sS8dDZU/UyJkUpzzKcsvdBqYsamVxjBd54DQ8kT3QGXkRk/22fgLx7BI6elWTnmJqqJdN8oZV6IogbwCh9U6JPPswFio2qCZK36SCbBeJIRP/UTVAHK4GxmNK2Hg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65443+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1600776234509807.9479871358678; Tue, 22 Sep 2020 05:03:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5xuJYY1788612xpkqYg6irvf; Tue, 22 Sep 2020 05:03:54 -0700 X-Received: from mail.si-head.nl (mail.si-head.nl [37.252.121.114]) by mx.groups.io with SMTP id smtpd.web10.5417.1600771148203217315 for ; Tue, 22 Sep 2020 03:39:08 -0700 X-Received: from localhost.localdomain (109-252-138-44.dynamic.spd-mgts.ru [109.252.138.44]) by mail.si-head.nl (Postfix) with ESMTPSA id D735AC16A4; Tue, 22 Sep 2020 13:39:05 +0300 (MSK) From: "Nikita" To: devel@edk2.groups.io Cc: Nikita Ermakov Subject: [edk2-devel] [PATCH] BaseTools: Add RISCV64 binding Date: Tue, 22 Sep 2020 13:38:24 +0300 Message-Id: <20200922103824.27161-1-sh1r4s3@mail.si-head.nl> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sh1r4s3@mail.si-head.nl X-Gm-Message-State: VzWoqR4NozrfHn2vhYu68zZSx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1600776234; bh=/rsSEMFvxehaC9pB19WqV//gzxGehajrKKwHzwr0xoo=; h=Cc:Date:From:Reply-To:Subject:To; b=ZvEvXZKXYivHZHeS9bDk/hfNX/gz6bMMATMwqO/w2X+nkh4Pkp3Sw2tpgW9MUAVs5xv 5etO7xTrZuSTFNkh8fe9pVWERyIQN4TbSF4oVX/m4gR4nnRuQ4d3bFbqJiJnUIMT84hD7 GyAvkjrx++p8SH2x+R7AuBZdXQw1Ev4WzLs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" - Add RISCV64 ProcessorBind.h - Add RISCV64 to Makefiles Signed-off-by: Nikita Ermakov Acked-by: Abner Chang --- BaseTools/Source/C/GNUmakefile | 3 + .../Source/C/Include/RiscV64/ProcessorBind.h | 85 +++++++++++++++++++ BaseTools/Source/C/Makefiles/header.makefile | 6 ++ 3 files changed, 94 insertions(+) create mode 100644 BaseTools/Source/C/Include/RiscV64/ProcessorBind.h diff --git a/BaseTools/Source/C/GNUmakefile b/BaseTools/Source/C/GNUmakefile index df4eb64ea9..464f432774 100644 --- a/BaseTools/Source/C/GNUmakefile +++ b/BaseTools/Source/C/GNUmakefile @@ -26,6 +26,9 @@ ifndef HOST_ARCH else ifneq (,$(findstring arm,$(uname_m))) HOST_ARCH=3DARM endif + ifneq (,$(findstring riscv64,$(uname_m))) + HOST_ARCH=3DRISCV64 + endif ifndef HOST_ARCH $(info Could not detected HOST_ARCH from uname results) $(error HOST_ARCH is not defined!) diff --git a/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h b/BaseTools= /Source/C/Include/RiscV64/ProcessorBind.h new file mode 100644 index 0000000000..1612d6ea7f --- /dev/null +++ b/BaseTools/Source/C/Include/RiscV64/ProcessorBind.h @@ -0,0 +1,85 @@ +/** @file + Processor or Compiler specific defines and types for RISC-V. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PROCESSOR_BIND_H__ +#define __PROCESSOR_BIND_H__ + +// +// Define the processor type so other code can make processor based choices +// +#define MDE_CPU_RISCV64 + +// +// Make sure we are using the correct packing rules per EFI specification +// +#ifndef __GNUC__ +#pragma pack() +#endif + +// +// Use ANSI C 2000 stdint.h integer width declarations +// +#include +typedef uint8_t BOOLEAN; +typedef int8_t INT8; +typedef uint8_t UINT8; +typedef int16_t INT16; +typedef uint16_t UINT16; +typedef int32_t INT32; +typedef uint32_t UINT32; +typedef int64_t INT64; +typedef uint64_t UINT64; +typedef char CHAR8; +typedef uint16_t CHAR16; + +// +// Unsigned value of native width. (4 bytes on supported 32-bit processor= instructions, +// 8 bytes on supported 64-bit processor instructions) +// +typedef UINT64 UINTN; + +// +// Signed value of native width. (4 bytes on supported 32-bit processor i= nstructions, +// 8 bytes on supported 64-bit processor instructions) +// +typedef INT64 INTN; + +// +// Processor specific defines +// + +// +// A value of native width with the highest bit set. +// +#define MAX_BIT 0x8000000000000000 + +// +// A value of native width with the two highest bits set. +// +#define MAX_2_BITS 0xC000000000000000 + +// +// The stack alignment required for RISC-V +// +#define CPU_STACK_ALIGNMENT 16 + +// +// Modifier to ensure that all protocol member functions and EFI intrinsics +// use the correct C calling convention. All protocol member functions and +// EFI intrinsics are required to modify their member functions with EFIAP= I. +// +#define EFIAPI + +#if defined(__GNUC__) + // + // For GNU assembly code, .global or .globl can declare global symbols. + // Define this macro to unify the usage. + // + #define ASM_GLOBAL .globl +#endif + +#endif diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Sourc= e/C/Makefiles/header.makefile index 1c105ee7d4..0df728f327 100644 --- a/BaseTools/Source/C/Makefiles/header.makefile +++ b/BaseTools/Source/C/Makefiles/header.makefile @@ -28,6 +28,9 @@ ifndef HOST_ARCH else ifneq (,$(findstring arm,$(uname_m))) HOST_ARCH=3DARM endif + ifneq (,$(findstring riscv64,$(uname_m))) + HOST_ARCH=3DRISCV64 + endif ifndef HOST_ARCH $(info Could not detected HOST_ARCH from uname results) $(error HOST_ARCH is not defined!) @@ -64,6 +67,9 @@ ARCH_INCLUDE =3D -I $(MAKEROOT)/Include/Arm/ else ifeq ($(HOST_ARCH), AARCH64) ARCH_INCLUDE =3D -I $(MAKEROOT)/Include/AArch64/ =20 +else ifeq ($(HOST_ARCH), RISCV64) +ARCH_INCLUDE =3D -I $(MAKEROOT)/Include/RiscV64/ + else $(error Bad HOST_ARCH) endif --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65443): https://edk2.groups.io/g/devel/message/65443 Mute This Topic: https://groups.io/mt/77011297/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-