diff options
Diffstat (limited to 'drivers/firmware/efi/libstub/fdt.c')
-rw-r--r-- | drivers/firmware/efi/libstub/fdt.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index b1c22cf18f7d..9ee9973b5c3e 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c | |||
@@ -16,6 +16,22 @@ | |||
16 | 16 | ||
17 | #include "efistub.h" | 17 | #include "efistub.h" |
18 | 18 | ||
19 | #define EFI_DT_ADDR_CELLS_DEFAULT 2 | ||
20 | #define EFI_DT_SIZE_CELLS_DEFAULT 2 | ||
21 | |||
22 | static void fdt_update_cell_size(efi_system_table_t *sys_table, void *fdt) | ||
23 | { | ||
24 | int offset; | ||
25 | |||
26 | offset = fdt_path_offset(fdt, "/"); | ||
27 | /* Set the #address-cells and #size-cells values for an empty tree */ | ||
28 | |||
29 | fdt_setprop_u32(fdt, offset, "#address-cells", | ||
30 | EFI_DT_ADDR_CELLS_DEFAULT); | ||
31 | |||
32 | fdt_setprop_u32(fdt, offset, "#size-cells", EFI_DT_SIZE_CELLS_DEFAULT); | ||
33 | } | ||
34 | |||
19 | efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | 35 | efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, |
20 | unsigned long orig_fdt_size, | 36 | unsigned long orig_fdt_size, |
21 | void *fdt, int new_fdt_size, char *cmdline_ptr, | 37 | void *fdt, int new_fdt_size, char *cmdline_ptr, |
@@ -45,10 +61,18 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
45 | } | 61 | } |
46 | } | 62 | } |
47 | 63 | ||
48 | if (orig_fdt) | 64 | if (orig_fdt) { |
49 | status = fdt_open_into(orig_fdt, fdt, new_fdt_size); | 65 | status = fdt_open_into(orig_fdt, fdt, new_fdt_size); |
50 | else | 66 | } else { |
51 | status = fdt_create_empty_tree(fdt, new_fdt_size); | 67 | status = fdt_create_empty_tree(fdt, new_fdt_size); |
68 | if (status == 0) { | ||
69 | /* | ||
70 | * Any failure from the following function is non | ||
71 | * critical | ||
72 | */ | ||
73 | fdt_update_cell_size(sys_table, fdt); | ||
74 | } | ||
75 | } | ||
52 | 76 | ||
53 | if (status != 0) | 77 | if (status != 0) |
54 | goto fdt_set_fail; | 78 | goto fdt_set_fail; |