Minor ARM EFI updates
cover Minor ARM EFI updates
Reuse some functions, fix some indentation.
Frediano Ziglio (3):
xen/efi: Reuse fdt_setprop_u32 and fdt_setprop_u64 xen/efi: Fix indentation
xen/efi: Do not pass dummy pointer for empty property
xen/arch/arm/efi/efi-boot.h | 51 +++++++++++++++---------------------- 1 file changed, 20 insertions(+), 31 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/3 xen/efi: Reuse fdt_setprop_u32 and fdt_setprop_u64
--- xen/arch/arm/efi/efi-boot.h | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
xen/arch/arm/efi/efi-boot.h +12 -21
@@ -79,8 +79,7 @@ static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells) prop =fdt_get_property (fdt, node,"#address-cells" , &len);if ( !prop ) { - val =cpu_to_fdt32 (2 ); -if (fdt_setprop (fdt, node,"#address-cells" , &val,sizeof (val)) ) +if (fdt_setprop_u32 (fdt, node,"#address-cells" ,2 ) )return -1 ; *addr_cells =2 ; }
@@ -90,8 +89,7 @@ static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells) prop =fdt_get_property (fdt, node,"#size-cells" , &len);if ( !prop ) { - val =cpu_to_fdt32 (2 ); -if (fdt_setprop (fdt, node,"#size-cells" , &val,sizeof (val)) ) +if (fdt_setprop_u32 (fdt, node,"#size-cells" ,2 ) )return -1 ; *size_cells =2 ; }
@@ -251,8 +249,6 @@ static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, {int node;int status; -u32 fdt_val32; -u64 fdt_val64;int num_rsv;/*
@@ -275,33 +271,28 @@ static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, } } - fdt_val64 =cpu_to_fdt64 ((u64 )(uintptr_t )sys_table); - status =fdt_setprop (fdt, node,"linux,uefi-system-table" , - &fdt_val64,sizeof (fdt_val64)); + status =fdt_setprop_u64 (fdt, node,"linux,uefi-system-table" , + (uintptr_t )sys_table);if ( status ) goto fdt_set_fail; - fdt_val64 =cpu_to_fdt64 ((u64 )(uintptr_t )memory_map); - status =fdt_setprop (fdt, node,"linux,uefi-mmap-start" , - &fdt_val64,sizeof (fdt_val64)); + status =fdt_setprop_u64 (fdt, node,"linux,uefi-mmap-start" , + (uintptr_t )memory_map);if ( status ) goto fdt_set_fail; - fdt_val32 =cpu_to_fdt32 (map_size); - status =fdt_setprop (fdt, node,"linux,uefi-mmap-size" , - &fdt_val32,sizeof (fdt_val32)); + status =fdt_setprop_u32 (fdt, node,"linux,uefi-mmap-size" , + map_size);if ( status ) goto fdt_set_fail; - fdt_val32 =cpu_to_fdt32 (desc_size); - status =fdt_setprop (fdt, node,"linux,uefi-mmap-desc-size" , - &fdt_val32,sizeof (fdt_val32)); + status =fdt_setprop_u32 (fdt, node,"linux,uefi-mmap-desc-size" , + desc_size);if ( status ) goto fdt_set_fail; - fdt_val32 =cpu_to_fdt32 (desc_ver); - status =fdt_setprop (fdt, node,"linux,uefi-mmap-desc-ver" , - &fdt_val32,sizeof (fdt_val32)); + status =fdt_setprop_u32 (fdt, node,"linux,uefi-mmap-desc-ver" , + desc_ver);if ( status ) goto fdt_set_fail;
Signature · 1 line
2.43.0
Re: [PATCH 1/3] xen/efi: Reuse fdt_setprop_u32 and fdt_setprop_u64
Quoted 39 lines · Frediano Ziglio
Signed-off-by Frediano Ziglio <[email protected]>--- xen/arch/arm/efi/efi-boot.h | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)xen/arch/arm/efi/efi-boot.h +2
-6@@ -79,8 +79,7 @@ static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells) prop =fdt_get_property (fdt, node,"#address-cells" , &len);if ( !prop ) { - val =cpu_to_fdt32 (2 ); -if (fdt_setprop (fdt, node,"#address-cells" , &val,sizeof (val)) ) +if (fdt_setprop_u32 (fdt, node,"#address-cells" ,2 ) )return -1 ; *addr_cells =2 ; }@@ -90,8 +89,7 @@ static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells) prop =fdt_get_property (fdt, node,"#size-cells" , &len);if ( !prop ) { - val =cpu_to_fdt32 (2 ); -if (fdt_setprop (fdt, node,"#size-cells" , &val,sizeof (val)) ) +if (fdt_setprop_u32 (fdt, node,"#size-cells" ,2 ) )return -1 ; *size_cells =2 ; }@@ -251,8 +249,6 @@ static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, {int node;int status; -u32 fdt_val32; -u64 fdt_val64;int num_rsv;/*
xen/arch/arm/efi/efi-boot.h static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, · line 275
Quoted 8 lines
xen/arch/arm/efi/efi-boot.h +2
-3@@ -275,33 +271,28 @@ static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, } } - fdt_val64 =cpu_to_fdt64 ((u64 )(uintptr_t )sys_table); - status =fdt_setprop (fdt, node,"linux,uefi-system-table" , - &fdt_val64,sizeof (fdt_val64)); + status =fdt_setprop_u64 (fdt, node,"linux,uefi-system-table" , + (uintptr_t )sys_table);
Don't we need explicit cast here? In other words, why did you drop them?
Other than that:
~Michal
Re: [PATCH 1/3] xen/efi: Reuse fdt_setprop_u32 and fdt_setprop_u64
Quoted 46 lines · Michal
Quoted 42 lines · Frediano Ziglio
Signed-off-by Frediano Ziglio <[email protected]>--- xen/arch/arm/efi/efi-boot.h | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)xen/arch/arm/efi/efi-boot.h +2
-6@@ -79,8 +79,7 @@ static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells) prop =fdt_get_property (fdt, node,"#address-cells" , &len);if ( !prop ) { - val =cpu_to_fdt32 (2 ); -if (fdt_setprop (fdt, node,"#address-cells" , &val,sizeof (val)) ) +if (fdt_setprop_u32 (fdt, node,"#address-cells" ,2 ) )return -1 ; *addr_cells =2 ; }@@ -90,8 +89,7 @@ static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells) prop =fdt_get_property (fdt, node,"#size-cells" , &len);if ( !prop ) { - val =cpu_to_fdt32 (2 ); -if (fdt_setprop (fdt, node,"#size-cells" , &val,sizeof (val)) ) +if (fdt_setprop_u32 (fdt, node,"#size-cells" ,2 ) )return -1 ; *size_cells =2 ; }@@ -251,8 +249,6 @@ static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, {int node;int status; -u32 fdt_val32; -u64 fdt_val64;int num_rsv;/* @@ -275,33 +271,28 @@ static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, } }
Quoted 7 lines
xen/arch/arm/efi/efi-boot.h static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, · line 275
Quoted 5 lines
xen/arch/arm/efi/efi-boot.h +2
-3- fdt_val64 =cpu_to_fdt64 ((u64 )(uintptr_t )sys_table); - status =fdt_setprop (fdt, node,"linux,uefi-system-table" , - &fdt_val64,sizeof (fdt_val64)); + status =fdt_setprop_u64 (fdt, node,"linux,uefi-system-table" , + (uintptr_t )sys_table);Don't we need explicit cast here? In other words, why did you drop them?
It's not needed, if the compiler is not truncating it will do the conversion correctly, in case of truncation it will trigger a warning which we can deal with in the possible future.
Quoted 5 lines
Other than that:
Reviewed-by Michal Orzel <[email protected]>~Michal
Frediano
PATCH 2/3 xen/efi: Fix indentation
In reply to Frediano ZiglioUse 4 spaces instead of 3 spaces.
--- xen/arch/arm/efi/efi-boot.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
xen/arch/arm/efi/efi-boot.h +7 -7
@@ -251,13 +251,13 @@ static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table,int status;int num_rsv; -/* -* Delete all memory reserve map entries. When booting via UEFI, -* kernel will use the UEFI memory map to find reserved regions. -*/ - num_rsv =fdt_num_mem_rsv (fdt); -while ( num_rsv-- >0 ) -fdt_del_mem_rsv (fdt, num_rsv); +/* +* Delete all memory reserve map entries. When booting via UEFI, +* kernel will use the UEFI memory map to find reserved regions. +*/ + num_rsv =fdt_num_mem_rsv (fdt); +while ( num_rsv-- >0 ) +fdt_del_mem_rsv (fdt, num_rsv);/* Add FDT entries for EFI runtime services in chosen node. */ node =fdt_subnode_offset (fdt,0 ,"chosen" );
Signature · 1 line
2.43.0
Re: [PATCH 2/3] xen/efi: Fix indentation
Quoted 3 lines · Frediano Ziglio
Use 4 spaces instead of 3 spaces.
Signed-off-by Frediano Ziglio <[email protected]>
~Michal
PATCH 3/3 xen/efi: Do not pass dummy pointer for empty property
In reply to Frediano ZiglioThere's no need to pass a buffer, the property is empty.
--- xen/arch/arm/efi/efi-boot.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
xen/arch/arm/efi/efi-boot.h +1 -3
@@ -61,7 +61,6 @@ static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells)int node;const struct fdt_property *prop;int len; -uint32_t val;if ( !fdt || !addr_cells || !size_cells )return -1 ;
@@ -103,8 +102,7 @@ static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells) prop =fdt_get_property (fdt, node,"ranges" , &len);if ( !prop ) { - val =cpu_to_fdt32 (0 ); -if (fdt_setprop (fdt, node,"ranges" , &val,0 ) ) +if (fdt_setprop (fdt, node,"ranges" ,NULL ,0 ) )return -1 ; }else if (fdt32_to_cpu (prop->len) )
Signature · 1 line
2.43.0
Re: [PATCH 3/3] xen/efi: Do not pass dummy pointer for empty property
Quoted 3 lines · Frediano Ziglio
There's no need to pass a buffer, the property is empty.
Signed-off-by Frediano Ziglio <[email protected]>
~Michal