[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 08/17] hw/loongarch: Init efi_fdt table
From: |
Song Gao |
Subject: |
[PATCH v6 08/17] hw/loongarch: Init efi_fdt table |
Date: |
Fri, 8 Mar 2024 00:48:26 +0800 |
Signed-off-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20240301093839.663947-9-gaosong@loongson.cn>
---
hw/loongarch/boot.c | 11 +++++++++++
include/hw/loongarch/boot.h | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/hw/loongarch/boot.c b/hw/loongarch/boot.c
index 6126a37858..c6c6e6d194 100644
--- a/hw/loongarch/boot.c
+++ b/hw/loongarch/boot.c
@@ -112,6 +112,16 @@ static void init_efi_initrd_table(struct efi_system_table
*systab,
initrd_table->size = initrd_size;
}
+static void init_efi_fdt_table(struct efi_system_table *systab)
+{
+ efi_guid_t tbl_guid = DEVICE_TREE_GUID;
+
+ /* efi_configuration_table 3 */
+ guidcpy(&systab->tables[2].guid, &tbl_guid);
+ systab->tables[2].table = (void *)0x100000; /* fdt_base 1MiB */
+ systab->nr_tables = 3;
+}
+
static void init_systab(struct loongarch_boot_info *info, void *p, void *start)
{
void *bp_tables_start;
@@ -137,6 +147,7 @@ static void init_systab(struct loongarch_boot_info *info,
void *p, void *start)
sizeof(efi_memory_desc_t) * memmap_entries, 64);
init_efi_initrd_table(systab, p, start);
p += ROUND_UP(sizeof(struct efi_initrd), 64);
+ init_efi_fdt_table(systab);
systab->tables = (struct efi_configuration_table *)(bp_tables_start -
start);
}
diff --git a/include/hw/loongarch/boot.h b/include/hw/loongarch/boot.h
index ddcb279874..9de673a0fd 100644
--- a/include/hw/loongarch/boot.h
+++ b/include/hw/loongarch/boot.h
@@ -34,6 +34,10 @@ typedef struct {
EFI_GUID(0x5568e427, 0x68fc, 0x4f3d, 0xac, 0x74, \
0xca, 0x55, 0x52, 0x31, 0xcc, 0x68)
+#define DEVICE_TREE_GUID \
+ EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, \
+ 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0)
+
struct efi_config_table {
efi_guid_t guid;
uint64_t *ptr;
--
2.34.1
- Re: [PATCH v6 06/17] hw/loongarch: Init efi_boot_memmap table, (continued)
Re: [PATCH v6 03/17] hw/loongarch: Add slave cpu boot_code, chen huacai, 2024/03/13
[PATCH v6 08/17] hw/loongarch: Init efi_fdt table,
Song Gao <=
[PATCH v6 05/17] hw/loongarch: Init efi_system_table, Song Gao, 2024/03/07
[PATCH v6 09/17] hw/loongarch: Fix fdt memory node wrong 'reg', Song Gao, 2024/03/07
[PATCH v6 01/17] hw/loongarch: Move boot fucntions to boot.c, Song Gao, 2024/03/07
[PATCH v6 07/17] hw/loongarch: Init efi_initrd table, Song Gao, 2024/03/07