Use QEMU platform code for FVP too, so we can run tests under FVP.

Change-Id: I176aeb65dbf8dbaa01185c3ee400a2a3c1b832d7
diff --git a/BUILD.gn b/BUILD.gn
index 431bf28..8ec38a5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -30,9 +30,13 @@
 
   deps = [
     "//src:unit_tests(:host_fake_clang)",
+    "//test/arch(:aem_v8a_fvp_clang)",
     "//test/arch(:qemu_aarch64_clang)",
+    "//test/linux(:aem_v8a_fvp_clang)",
     "//test/linux(:qemu_aarch64_clang)",
+    "//test/vmapi(:aem_v8a_fvp_clang)",
     "//test/vmapi(:qemu_aarch64_clang)",
+    "//test/vmapi/gicv3:gicv3_test(:aem_v8a_fvp_clang)",
     "//test/vmapi/gicv3:gicv3_test(:qemu_aarch64_clang)",
   ]
 }
diff --git a/aem_v8a_fvp/BUILD.gn b/aem_v8a_fvp/BUILD.gn
index 11f3fba..56d346d 100644
--- a/aem_v8a_fvp/BUILD.gn
+++ b/aem_v8a_fvp/BUILD.gn
@@ -12,10 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import("//build/toolchain/embedded.gni")
-
 source_set("aem_v8a_fvp") {
-  sources = [
-    "plat.c",
+  deps = [
+    "//project/reference/linux_fdt",
   ]
 }
diff --git a/aem_v8a_fvp/plat.c b/aem_v8a_fvp/plat.c
deleted file mode 100644
index a0cead4..0000000
--- a/aem_v8a_fvp/plat.c
+++ /dev/null
@@ -1,36 +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/mpool.h"
-
-paddr_t plat_get_fdt_addr(void)
-{
-	/* FDT is loaded at a known address. */
-	return pa_init(0x82000000);
-}
-
-void plat_get_initrd_range(paddr_t *begin, paddr_t *end, struct mpool *ppool)
-{
-	(void)ppool;
-
-	/*
-	 * initrd is loaded at a known address but...
-	 * TODO: the size is hardcoded
-	 */
-	*begin = pa_init(0x84000000);
-	*end = pa_add(*begin, 0x12EF200);
-}
diff --git a/linux_fdt/BUILD.gn b/linux_fdt/BUILD.gn
new file mode 100644
index 0000000..ac71ad4
--- /dev/null
+++ b/linux_fdt/BUILD.gn
@@ -0,0 +1,20 @@
+# 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/qemu_aarch64/plat.c b/linux_fdt/plat.c
similarity index 97%
rename from qemu_aarch64/plat.c
rename to linux_fdt/plat.c
index 9efd1c4..8f03174 100644
--- a/qemu_aarch64/plat.c
+++ b/linux_fdt/plat.c
@@ -17,6 +17,7 @@
 #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;
diff --git a/qemu_aarch64/plat_entry.S b/linux_fdt/plat_entry.S
similarity index 100%
rename from qemu_aarch64/plat_entry.S
rename to linux_fdt/plat_entry.S
diff --git a/qemu_aarch64/BUILD.gn b/qemu_aarch64/BUILD.gn
index 084a4ca..c0796dd 100644
--- a/qemu_aarch64/BUILD.gn
+++ b/qemu_aarch64/BUILD.gn
@@ -13,8 +13,7 @@
 # limitations under the License.
 
 source_set("qemu_aarch64") {
-  sources = [
-    "plat.c",
-    "plat_entry.S",
+  deps = [
+    "//project/reference/linux_fdt",
   ]
 }