[edk2-devel] [edk2-platforms] [PATCH v3 14/14] Move OpenSbiPlatformLib to RISC-V/PlatformPkg

Daniel Schaefer daniel.schaefer at hpe.com
Tue Oct 19 03:48:49 UTC 2021


It's a generic platform file. Only the device tree decides what happens.

Cc: Daniel Schaefer <daniel.schaefer at hpe.com>
Cc: Abner Chang <abner.chang at hpe.com>
Cc: Sunil V L <sunilvl at ventanamicro.com>
Reviewed-by: Abner Chang <abner.chang at hpe.com>

Signed-off-by: Daniel Schaefer <daniel.schaefer at hpe.com>
---
 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc                                                                  |  2 +-
 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard => RISC-V/PlatformPkg}/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf |  0
 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard => RISC-V/PlatformPkg}/Library/OpensbiPlatformLib/PlatformOverride.h     |  0
 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard => RISC-V/PlatformPkg}/Library/OpensbiPlatformLib/Platform.c             | 13 ++++++++++++-
 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard => RISC-V/PlatformPkg}/Library/OpensbiPlatformLib/SifiveFu540.c          |  0
 5 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
index 18a482aba611..5d2ccafacaf3 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
@@ -173,7 +173,7 @@
 #

 # OpenSBi Platform Library

 #

-  RiscVOpensbiPlatformLib|Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf

+  RiscVOpensbiPlatformLib|Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf

 

 [LibraryClasses.common.PEI_CORE]

   HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf

diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
similarity index 100%
rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf
diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/PlatformOverride.h b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/PlatformOverride.h
similarity index 100%
rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/PlatformOverride.h
rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/PlatformOverride.h
diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c
similarity index 88%
rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c
rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c
index ac76f073ab53..c4cf6782bd1f 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c
+++ b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c
@@ -201,13 +201,24 @@ const struct sbi_platform_operations platform_ops = {
   .timer_exit    = fdt_timer_exit,

 };

 

+#if FixedPcdGet32(PcdBootableHartNumber) == 4

+#define U540_BOOTABLE_HART_COUNT FixedPcdGet32(PcdBootableHartNumber)

+static u32 U540_hart_index2id[U540_BOOTABLE_HART_COUNT] = {1, 2, 3, 4};

+#endif

+

 struct sbi_platform platform = {

   .opensbi_version  = OPENSBI_VERSION,

   .platform_version  = SBI_PLATFORM_VERSION(0x0, 0x01),

   .name      = "Generic",

   .features    = SBI_PLATFORM_DEFAULT_FEATURES,

   .hart_count    = SBI_HARTMASK_MAX_BITS,

+// TODO: Workaround for U540. Not sure why we need this. OpenSBI doesn't need it.

+#if FixedPcdGet32(PcdBootableHartNumber) == 4

+  .hart_index2id    = U540_hart_index2id,

+#else

   .hart_index2id    = generic_hart_index2id,

-  .hart_stack_size  = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE,

+#endif

+  // TODO: Any reason why it shouldn't just be SBI_PLATFORM_DEFAULT_HART_STACK_SIZE?

+  .hart_stack_size  = FixedPcdGet32(PcdOpenSbiStackSize),

   .platform_ops_addr  = (unsigned long)&platform_ops

 };

diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/SifiveFu540.c b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/SifiveFu540.c
similarity index 100%
rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/SifiveFu540.c
rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/SifiveFu540.c
-- 
2.31.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82280): https://edk2.groups.io/g/devel/message/82280
Mute This Topic: https://groups.io/mt/86432332/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list