We are able to compile CPP files for X64 using UDK2014 by using Visual
Studio.
How do we compile the same source for AARCH64?
Appreciate the help!
Thanks,
Daniel
Changelog:
v4:
* Use 64-bit value on PL061 register base address.
* Use fallback to be compatible with current PcdPL061GpioBase value
when platform gpio driver isn't present.
* Remove the dependancy on PL061. Move the dependancy to platform
gpio driver instead.
v3:
* Remove GPIO_PIN_MASK_HIGH_8BIT() and GPIO_PIN_MASK_LOW_8BIT().
* Avoid to use MmioAnd8() on updating GPIO DATA register, since PL061
could access each bit by specified register offset.
* Add PLATFORM_GPIO_CONTROLLER structure in embedded gpio.
* Support multiple PL061 gpio controllers in one platform.
v2:
* Append the patch to fix gpio pin mask macro.
Haojian Zhuang (3):
ArmPlatformPkg: PL061: fix accessing GPIO DATA
EmbeddedPkg: enhance for multiple gpio controllers
ArmPlatformPkg: PL061: support multiple controller
ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 137 +++++++++++++++------
.../Drivers/PL061GpioDxe/PL061GpioDxe.inf | 1 +
ArmPlatformPkg/Include/Drivers/PL061Gpio.h | 51 ++++----
EmbeddedPkg/EmbeddedPkg.dec | 1 +
EmbeddedPkg/Include/Protocol/EmbeddedGpio.h | 17 +++
5 files changed, 143 insertions(+), 64 deletions(-)
--
2.1.4
This adds support for the C99 uintXX_t types when building for older versions
of the standard, like the other architectures already implement.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
---
v2: define int8_t as 'signed char' explicitly, since unqualified 'char' is
unsigned on ARM
inc/aarch64/efibind.h | 33 +++++++++++++++++++-
inc/arm/efibind.h | 31 ++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h
index 693fe5279031..ef7148d5312d 100644
--- a/inc/aarch64/efibind.h
+++ b/inc/aarch64/efibind.h
@@ -1,5 +1,36 @@
-
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long uint64_t;
+typedef long int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef signed char int8_t; // unqualified 'char' is unsigned on ARM
+
+#else
#include <stdint.h>
+#endif
//
// Basic EFI types of various widths
diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h
index cc4b5c598bf6..8c37f64c2dc8 100644
--- a/inc/arm/efibind.h
+++ b/inc/arm/efibind.h
@@ -1,5 +1,36 @@
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef signed char int8_t; // unqualified 'char' is unsigned on ARM
+
+#else
#include <stdint.h>
+#endif
/*
* This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32
--
2.5.0
This adds support for the C99 uintXX_t types when building for older versions
of the standard, like the other architectures already implement.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
---
inc/aarch64/efibind.h | 33 ++++++++++++++++++++++++++++++++-
inc/arm/efibind.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h
index 693fe5279031..04e3360cf653 100644
--- a/inc/aarch64/efibind.h
+++ b/inc/aarch64/efibind.h
@@ -1,5 +1,36 @@
-
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long uint64_t;
+typedef long int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef char int8_t;
+
+#else
#include <stdint.h>
+#endif
//
// Basic EFI types of various widths
diff --git a/inc/arm/efibind.h b/inc/arm/efibind.h
index cc4b5c598bf6..f273db9c9658 100644
--- a/inc/arm/efibind.h
+++ b/inc/arm/efibind.h
@@ -1,5 +1,36 @@
+/*
+ * Copright (C) 2014 - 2015 Linaro Ltd.
+ * Author: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice and this list of conditions, without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License as published by the Free Software Foundation;
+ * either version 2 of the License, or (at your option) any later version.
+ */
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+// ANSI C 1999/2000 stdint.h integer width declarations
+
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef char int8_t;
+
+#else
#include <stdint.h>
+#endif
/*
* This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32
--
2.5.0
I am starting on the task of refactoring ARM Platform support.
Initially in the ARM Ltd sense, but also in the general ARM-based SoC
case.
The existing platform code, mostly under ArmPlatformPkg is fragmented,
duplicated and hard to maintain. Adding a new platform often involves
copy/paste of a lot of code that the platform owner neither
understands nor really needs to care about.
The basic concept is to have as much common/generic code as possible
and have as little in the platform specific code. Thus making porting
to a new platform as simple as can be.
A new board using code that’s already in the tree should just be able
to provide a .dsc file with some defines in it and include the
common.dsc.inc file.
The common.dsc.inc file would then define everything, with conditional
statements including various drivers or features.
For example, juno.dsc would define that it is using the CFI NOR flash
driver and provide the defines for the flash config. The
common.dsc.inc file would only include the CFI NOR flash driver in the
build if it is specified in its parent .dsc file.
The other concept is to move the platform code from the EDK2 tree to
the OpenPlatformPkg tree.
In my experiments, I have included OpenPlatformPkg as a sub-tree of
the EDK2 git tree. This allows me to “git mv” files between the two
repos. In reality, we would have to “git add” to the OpenPlatformPkg
repo and “git rm” from EDK2 as separate patches.
---------------
Failed attempts
---------------
I had several plays with the code.
In one attempt, I moved all the code in ArmPlatformPkg that was used
by Juno and attempted to get this working in the new location.
Unfortunately, in my opinion, the build system is so obtuse that this
becomes a tangled web of build failures. I aborted this attempt very
quickly.
In another attempt, I thought I would start from scratch by creating a
new BSP. But I realised that my understanding of much of the
code/config was severely lacking. There are some components and
sections of the DSC and FDF files where I have absolutely no idea what
they are for. I guess many people are in this position and it’s
probably a reason why so many BSPs are boilerplate copied from
ArmPlatformPkg.
---------------
Getting started
---------------
I decided to start by splitting the Juno BSP up into common and
platform specific code. The first step is to create a new juno.dsc
file in OpenPlatformPkg.
Initially, this just #included ArmJuno.dsc from edk2.
Next, I copied ArmJuno.dsc over to
OpenPlatformPkg/Platforms/common/common.dsc.inc and included that in
the new juno.dsc.
Then, I migrated Juno specific stuff from common.dsc.inc to juno.dsc,
eg. “PLATFORM_NAME = ArmJuno”.
>From here on, I started walking through the common.dsc.inc file and
moving code across from ArmPlatformPkg to
OpenPlatformPkg/Platforms/common. Bit by bit, I moved, renamed and
fixed up components used by the Juno platform.
At this point, the “common” code is still very Juno specific.
Function names, symbols and various other pieces still reference Juno.
This needs to be fixed.
One part (of the many) that may cause controversy is that I have kept
to a “simple” file naming scheme. Instead of everything having the
words Arm, Juno, Platform and Pkg in multiple combinations, I’ve tried
to keep things simple. I also used all lower case filenames, because
we’re generally not DOS users and all these mixed case filenames drive
me insane. I expect this to go down badly with some, but hope I can
get away with it ;-)
-------------------------------
Once Juno is migrated to common
-------------------------------
After all the parts that Juno uses have been moved to OpenPlatformPkg,
I intend to add another platform. I’ll use FVP: it’s similar enough
to Juno that most of the common code will remain there, even if it is
still quite ARM platform specific, but it will allow me to demonstrate
two platforms using the common code.
What it won’t do yet is split out any functionality that is “Versatile
Express” in nature, but neither Juno nor FVP specific; i.e. any code
that is not really common to all platforms, but is common to ARM Ltd's
platforms.
After this, I was thinking that first I need to go around cleaning up
the code to remove all the Juno references. Then, adding another
platform, such as HiKey or D01/02 into the common framework might be a
brave next step to see how much we can keep common and how much needs
to be split back into Juno, FVP or Versatile Express specific areas.
-------------
My GIT branch
-------------
I’ve created a demo branch with my experimental changes here:
https://git.linaro.org/landing-teams/working/arm/edk2.git/shortlog/refs/hea…
This is only intended to demonstrate a concept, so don’t take too much
of it to heart. I haven’t gone all the way in migrating the code
either, I’ve just picked the essentials, followed by the NOR flash and
ACPI parts. I picked those because NOR is common and ACPI is Juno
specific.
--------------
So what next??
--------------
In order to push this code to OpenPlatformPkg, I think there are two
ways of doing it:
Big hit: go away, do all the work in isolation and submit a patch series.
Gradual migration: submit small patch series as they are ready and
remove the code from ArmPlatformPkg as we move along.
I’m a bit worried about doing it in one big hit. Looking at the
amount of free time I have to work on this and how long my experiments
have taken me, I worry that by the time the work is “done”, it will
need some serious fixing again to catch up to the upstream code
changes. I also think it leaves my changes less open to scrutiny by
others.
Unfortunately, a gradual migration would possibly take a longer
elapsed time to complete. I don’t think it would be realistic to
create the new code in OpenPlatformPkg without removing (some of?) the
code from ArmPlatformPkg as we go. If the migrated code is still in
ArmPlatformPkg, people will continue to use it and patch it, leaving
two diverging code bases that will need effort to sync. At the very
least, removing the ArmJuno.dsc from ArmPlatformPkg would help keep
things on track without removing the rest of the code in
ArmPlatformPkg.
At this point, I’m soliciting feedback on my approach and hoping to
get some sane critique on what can be done better/easier.
Regards,
Ryan.
All,
Please find the attached patch with EFI stub changes to make it work for FVP.
This patch contains two fixes
1. FVP model not booting to Linux Shell with -C css.cache_state_modelled=1 flag. (arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S)
2. Pre-load RAM Location support for dtb and initrd. (Format: dtb=RAM Address,Size, initrd= RAM Address,Size). (drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c)
This patch was based off of
git clone http://git.linaro.org/landing-teams/working/arm/kernel.git .
git checkout v4.3
If this is already taken care in EFI Stub in later kernel versions, please ignore it.
If not, I thought I would at-least start a discussion here about this topic, before actually getting it in.
Thanks,
Supreeth
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.