Replace boot flow code with main tree drivers
The projects/ folder contained code which would override plat_*
functions to match the boot flow of a given target platform. At the
moment, this comes down to two different flows: Linux-like (FDT in first
kernel arg; QEMU, FVP, RPi) and Android-like (FDT compiled into
Hafnium). Get rid of the weak symbols and replace this with two
"drivers" and a `boot_flow` config in the board spec.
Bug: 117551352
Change-Id: I26176a4999a5c598eae9e542d635393ed5b0b840
diff --git a/BUILD.gn b/BUILD.gn
index 9b9128c..81914bf 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -53,6 +53,7 @@
aarch64_toolchains("aem_v8a_fvp") {
cpu = "cortex-a57"
origin_address = "0x80000000"
+ boot_flow = "//src/boot_flow:linux"
console = "//src/arch/aarch64/pl011"
gic_version = 3
gicd_base_address = "0x2f000000"
@@ -68,6 +69,7 @@
aarch64_toolchains("qemu_aarch64") {
cpu = "cortex-a57"
origin_address = "0x40001000"
+ boot_flow = "//src/boot_flow:linux"
console = "//src/arch/aarch64/pl011"
gic_version = 3
gicd_base_address = "0x08000000"
@@ -83,6 +85,7 @@
aarch64_toolchains("hikey") {
cpu = "cortex-a53"
origin_address = "0x35000000"
+ boot_flow = "//src/boot_flow:android"
console = "//src/arch/aarch64/pl011"
gic_version = 2
heap_pages = 60
diff --git a/aem_v8a_fvp/BUILD.gn b/aem_v8a_fvp/BUILD.gn
index 56d346d..140bf9e 100644
--- a/aem_v8a_fvp/BUILD.gn
+++ b/aem_v8a_fvp/BUILD.gn
@@ -13,7 +13,4 @@
# limitations under the License.
source_set("aem_v8a_fvp") {
- deps = [
- "//project/reference/linux_fdt",
- ]
}
diff --git a/hikey/BUILD.gn b/hikey/BUILD.gn
index 8c96c57..c9f8e10 100644
--- a/hikey/BUILD.gn
+++ b/hikey/BUILD.gn
@@ -16,7 +16,6 @@
sources = [
"fdt.S",
"initrd.S",
- "plat.c",
]
inputs = [
"fdt.dtb",
diff --git a/hikey/plat.c b/hikey/plat.c
deleted file mode 100644
index 5b6882a..0000000
--- a/hikey/plat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2018 The Hafnium Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "hf/cpu.h"
-
-uintreg_t plat_get_kernel_arg(void)
-{
- return 0;
-}
diff --git a/linux_fdt/BUILD.gn b/linux_fdt/BUILD.gn
deleted file mode 100644
index ac71ad4..0000000
--- a/linux_fdt/BUILD.gn
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2018 The Hafnium Authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-source_set("linux_fdt") {
- sources = [
- "plat.c",
- "plat_entry.S",
- ]
-}
diff --git a/linux_fdt/plat.c b/linux_fdt/plat.c
deleted file mode 100644
index 7956b5f..0000000
--- a/linux_fdt/plat.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2018 The Hafnium Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "hf/addr.h"
-#include "hf/dlog.h"
-#include "hf/fdt_handler.h"
-#include "hf/mpool.h"
-
-/* This is set by plat_entry.S. */
-uintpaddr_t plat_fdt_addr;
-
-paddr_t plat_get_fdt_addr(void)
-{
- return pa_init(plat_fdt_addr);
-}
-
-void plat_get_initrd_range(struct mm_stage1_locked stage1_locked,
- paddr_t *begin, paddr_t *end, struct mpool *ppool)
-{
- struct fdt_header *fdt;
- struct fdt_node n;
-
- /* Get the memory map from the FDT. */
- fdt = fdt_map(stage1_locked, plat_get_fdt_addr(), &n, ppool);
- if (!fdt) {
- return;
- }
-
- if (!fdt_find_child(&n, "")) {
- dlog("Unable to find FDT root node.\n");
- goto out_unmap_fdt;
- }
-
- fdt_find_initrd(&n, begin, end);
-
-out_unmap_fdt:
- if (!fdt_unmap(stage1_locked, fdt, ppool)) {
- dlog("Unable to unmap fdt.");
- }
-}
diff --git a/linux_fdt/plat_entry.S b/linux_fdt/plat_entry.S
deleted file mode 100644
index 95faec3..0000000
--- a/linux_fdt/plat_entry.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2018 The Hafnium Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.section .init.plat_entry, "ax"
-.global plat_entry
-plat_entry:
- /* Save the FDT to a global variable. */
- adrp x25, plat_fdt_addr
- add x25, x25, :lo12:plat_fdt_addr
- str x0, [x25]
-
- ret
diff --git a/qemu_aarch64/BUILD.gn b/qemu_aarch64/BUILD.gn
index c0796dd..a477c50 100644
--- a/qemu_aarch64/BUILD.gn
+++ b/qemu_aarch64/BUILD.gn
@@ -13,7 +13,4 @@
# limitations under the License.
source_set("qemu_aarch64") {
- deps = [
- "//project/reference/linux_fdt",
- ]
}