From nobody Sun May 12 17:50:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1690894134413559.7597065426255; Tue, 1 Aug 2023 05:48:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.574138.899333 (Exim 4.92) (envelope-from ) id 1qQonf-0002Ws-Te; Tue, 01 Aug 2023 12:48:31 +0000 Received: by outflank-mailman (output) from mailman id 574138.899333; Tue, 01 Aug 2023 12:48:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQonf-0002UK-OV; Tue, 01 Aug 2023 12:48:31 +0000 Received: by outflank-mailman (input) for mailman id 574138; Tue, 01 Aug 2023 12:48:30 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQone-0002MY-EP for xen-devel@lists.xenproject.org; Tue, 01 Aug 2023 12:48:30 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b614396e-3069-11ee-8613-37d641c3527e; Tue, 01 Aug 2023 14:48:28 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 256D34EE0741; Tue, 1 Aug 2023 14:48:27 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b614396e-3069-11ee-8613-37d641c3527e From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Nicola Vetrini , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH v2 1/3] xen/common: address MISRA C:2012 Rule 5.3 Date: Tue, 1 Aug 2023 14:47:42 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690894135753100003 Content-Type: text/plain; charset="utf-8" The following strategies are adopted to deal with violations of MISRA C:2012 Rule 5.3: "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope". - s/nodes/numa_nodes/ for the file-scope variable in 'common/numa.c'; - move the variable 'struct compat_remove_from_physmap cmp' inside the outer union variable 'cmp' to avoid shadowing it. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- Changes in v2: - Split the patch in common/ and drivers/. - Moved the local cmp into the union as a member. - Renamed the file-scope variable instead of parameters/local variables. --- xen/common/compat/memory.c | 7 +++---- xen/common/numa.c | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c index 8ca63ceda6..d000a5d93d 100644 --- a/xen/common/compat/memory.c +++ b/xen/common/compat/memory.c @@ -81,6 +81,7 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_P= ARAM(void) compat) struct compat_memory_exchange xchg; struct compat_add_to_physmap atp; struct compat_add_to_physmap_batch atpb; + struct compat_remove_from_physmap rmfp; struct compat_vnuma_topology_info vnuma; struct compat_mem_access_op mao; struct compat_mem_acquire_resource mar; @@ -321,12 +322,10 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HAND= LE_PARAM(void) compat) =20 case XENMEM_remove_from_physmap: { - struct compat_remove_from_physmap cmp; - - if ( copy_from_guest(&cmp, compat, 1) ) + if ( copy_from_guest(&cmp.rmfp, compat, 1) ) return -EFAULT; =20 - XLAT_remove_from_physmap(nat.xrfp, &cmp); + XLAT_remove_from_physmap(nat.xrfp, &cmp.rmfp); =20 break; } diff --git a/xen/common/numa.c b/xen/common/numa.c index fc1f7f665b..f454c4d894 100644 --- a/xen/common/numa.c +++ b/xen/common/numa.c @@ -15,7 +15,7 @@ =20 static nodemask_t __initdata processor_nodes_parsed; static nodemask_t __initdata memory_nodes_parsed; -static struct node __initdata nodes[MAX_NUMNODES]; +static struct node __initdata numa_nodes[MAX_NUMNODES]; =20 static unsigned int __ro_after_init num_node_memblks; static struct node __ro_after_init node_memblk_range[NR_NODE_MEMBLKS]; @@ -117,7 +117,7 @@ static enum conflicts __init conflicting_memblks( =20 static void __init cutoff_node(nodeid_t i, paddr_t start, paddr_t end) { - struct node *nd =3D &nodes[i]; + struct node *nd =3D &numa_nodes[i]; =20 if ( nd->start < start ) { @@ -157,7 +157,7 @@ bool __init numa_update_node_memblks(nodeid_t node, uns= igned int arch_nid, paddr_t end =3D start + size; paddr_t nd_start =3D start; paddr_t nd_end =3D end; - struct node *nd =3D &nodes[node]; + struct node *nd =3D &numa_nodes[node]; =20 /* * For the node that already has some memory blocks, we will @@ -292,17 +292,17 @@ static bool __init nodes_cover_memory(void) do { found =3D false; for_each_node_mask ( j, memory_nodes_parsed ) - if ( start < nodes[j].end && end > nodes[j].start ) + if ( start < numa_nodes[j].end && end > numa_nodes[j].star= t ) { - if ( start >=3D nodes[j].start ) + if ( start >=3D numa_nodes[j].start ) { - start =3D nodes[j].end; + start =3D numa_nodes[j].end; found =3D true; } =20 - if ( end <=3D nodes[j].end ) + if ( end <=3D numa_nodes[j].end ) { - end =3D nodes[j].start; + end =3D numa_nodes[j].start; found =3D true; } } @@ -356,10 +356,10 @@ static bool __init numa_process_nodes(paddr_t start, = paddr_t end) /* Finally register nodes */ for_each_node_mask ( i, all_nodes_parsed ) { - if ( nodes[i].end =3D=3D nodes[i].start ) + if ( numa_nodes[i].end =3D=3D numa_nodes[i].start ) printk(KERN_INFO "NUMA: node %u has no memory\n", i); =20 - setup_node_bootmem(i, nodes[i].start, nodes[i].end); + setup_node_bootmem(i, numa_nodes[i].start, numa_nodes[i].end); } =20 for ( i =3D 0; i < nr_cpu_ids; i++ ) --=20 2.34.1 From nobody Sun May 12 17:50:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1690894134193824.6135630982006; Tue, 1 Aug 2023 05:48:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.574136.899322 (Exim 4.92) (envelope-from ) id 1qQonf-0002N0-Bg; Tue, 01 Aug 2023 12:48:31 +0000 Received: by outflank-mailman (output) from mailman id 574136.899322; Tue, 01 Aug 2023 12:48:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQonf-0002Mt-8q; Tue, 01 Aug 2023 12:48:31 +0000 Received: by outflank-mailman (input) for mailman id 574136; Tue, 01 Aug 2023 12:48:29 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQond-0002MS-I7 for xen-devel@lists.xenproject.org; Tue, 01 Aug 2023 12:48:29 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b6a4c424-3069-11ee-b25a-6b7b168915f2; Tue, 01 Aug 2023 14:48:29 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 0CFED4EE0742; Tue, 1 Aug 2023 14:48:27 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b6a4c424-3069-11ee-b25a-6b7b168915f2 From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Nicola Vetrini , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH v2 2/3] drivers/char: address MISRA C:2012 Rule 5.3 Date: Tue, 1 Aug 2023 14:47:43 +0200 Message-Id: <69fad93eeafdceae5de1f2483015f05d1798b6be.1690893696.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690894135704100001 Content-Type: text/plain; charset="utf-8" The following strategies are adopted to deal with violations of MISRA C:2012 Rule 5.3: "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope". Local variable 'ctrl' shadows a variable defined in an outer scope. Since the innermost variable is used only once after being set, it is safe to remove it entirely. The enum constant 'baud' is shadowed by local a local variable at line 1476, and renaming the enum constant avoid such conflicts. Signed-off-by: Nicola Vetrini Reviewed-by: Jan Beulich --- Changes in v2: - Renamed the enum constant instead of the local variable 'baud'. - Removed the inner variable entirely, as it serves no purpose. --- xen/drivers/char/ehci-dbgp.c | 4 +--- xen/drivers/char/ns16550.c | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/xen/drivers/char/ehci-dbgp.c b/xen/drivers/char/ehci-dbgp.c index 4d8d765122..72be4d9cc9 100644 --- a/xen/drivers/char/ehci-dbgp.c +++ b/xen/drivers/char/ehci-dbgp.c @@ -424,9 +424,7 @@ static void dbgp_issue_command(struct ehci_dbgp *dbgp, = u32 ctrl, * checks to see if ACPI or some other initialization also * reset the EHCI debug port. */ - u32 ctrl =3D readl(&dbgp->ehci_debug->control); - - if ( ctrl & DBGP_ENABLED ) + if ( readl(&dbgp->ehci_debug->control) & DBGP_ENABLED ) { cmd |=3D CMD_RUN; writel(cmd, &dbgp->ehci_regs->command); diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 212a9c49ae..b75e7f8fa0 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1388,7 +1388,7 @@ string_param("com1", opt_com1); string_param("com2", opt_com2); =20 enum serial_param_type { - baud, + baud_rate, clock_hz, data_bits, io_base, @@ -1416,7 +1416,7 @@ struct serial_param_var { * com_console_options for serial port com1 and com2. */ static const struct serial_param_var __initconst sp_vars[] =3D { - {"baud", baud}, + {"baud", baud_rate}, {"clock-hz", clock_hz}, {"data-bits", data_bits}, {"io-base", io_base}, @@ -1596,7 +1596,7 @@ static bool __init parse_namevalue_pairs(char *str, s= truct ns16550 *uart) =20 switch ( get_token(token, ¶m_value) ) { - case baud: + case baud_rate: uart->baud =3D simple_strtoul(param_value, NULL, 0); break; =20 --=20 2.34.1 From nobody Sun May 12 17:50:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1690894138447417.48573853096764; Tue, 1 Aug 2023 05:48:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.574139.899342 (Exim 4.92) (envelope-from ) id 1qQong-0002hV-DB; Tue, 01 Aug 2023 12:48:32 +0000 Received: by outflank-mailman (output) from mailman id 574139.899342; Tue, 01 Aug 2023 12:48:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQong-0002eB-5B; Tue, 01 Aug 2023 12:48:32 +0000 Received: by outflank-mailman (input) for mailman id 574139; Tue, 01 Aug 2023 12:48:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQone-0002MS-Th for xen-devel@lists.xenproject.org; Tue, 01 Aug 2023 12:48:31 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b72c0eff-3069-11ee-b25a-6b7b168915f2; Tue, 01 Aug 2023 14:48:30 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id 0193A4EE0743; Tue, 1 Aug 2023 14:48:28 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b72c0eff-3069-11ee-b25a-6b7b168915f2 From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Nicola Vetrini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , "Daniel P. Smith" Subject: [XEN PATCH v2 3/3] arm/efi: address MISRA C:2012 Rule 5.3 Date: Tue, 1 Aug 2023 14:47:44 +0200 Message-Id: <688eea3584d537b6f41bb32f227f8be74ffd2783.1690893696.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1690894140181100001 Content-Type: text/plain; charset="utf-8" Rule 5.3 has the following headline: "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope" The file-scope variable 'fdt' is shadowed by function parameters, and thus violates the rule, hence it's renamed to 'fdt_efi' No functional changes. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- Changes in v2: - Renamed the file-scope variable instead of removing function parameters. --- xen/arch/arm/efi/efi-boot.h | 84 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 6126a71400..f24df2abb9 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -49,7 +49,7 @@ static void PrintMessage(const CHAR16 *s); {0xb1b621d5U, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0= xe0}} =20 static struct file __initdata dtbfile; -static void __initdata *fdt; +static void __initdata *fdt_efi; static void __initdata *memmap; =20 static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_= cells) @@ -383,7 +383,7 @@ static void __init efi_arch_process_memory_map(EFI_SYST= EM_TABLE *SystemTable, if ( EFI_ERROR(status) ) blexit(L"EFI memory map processing failed"); =20 - status =3D fdt_add_uefi_nodes(SystemTable, fdt, map, map_size, desc_si= ze, + status =3D fdt_add_uefi_nodes(SystemTable, fdt_efi, map, map_size, des= c_size, desc_ver); if ( EFI_ERROR(status) ) PrintErrMesg(L"Updating FDT failed", status); @@ -395,7 +395,7 @@ static void __init efi_arch_pre_exit_boot(void) =20 static void __init noreturn efi_arch_post_exit_boot(void) { - efi_xen_start(fdt, fdt_totalsize(fdt)); + efi_xen_start(fdt_efi, fdt_totalsize(fdt_efi)); } =20 static void __init efi_arch_cfg_file_early(const EFI_LOADED_IMAGE *image, @@ -420,8 +420,8 @@ static void __init efi_arch_cfg_file_early(const EFI_LO= ADED_IMAGE *image, efi_bs->FreePool(name.w); } } - fdt =3D fdt_increase_size(&dtbfile, cfg.size + EFI_PAGE_SIZE); - if ( !fdt ) + fdt_efi =3D fdt_increase_size(&dtbfile, cfg.size + EFI_PAGE_SIZE); + if ( !fdt_efi ) blexit(L"Unable to create new FDT"); } =20 @@ -465,7 +465,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *imag= e_name, int chosen; =20 /* locate chosen node, which is where we add Xen module info. */ - chosen =3D fdt_subnode_offset(fdt, 0, "chosen"); + chosen =3D fdt_subnode_offset(fdt_efi, 0, "chosen"); if ( chosen < 0 ) blexit(L"Unable to find chosen node"); =20 @@ -498,7 +498,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *imag= e_name, else { /* Get xen,xen-bootargs in /chosen if it is specified */ - const char *dt_bootargs_prop =3D fdt_getprop(fdt, chosen, + const char *dt_bootargs_prop =3D fdt_getprop(fdt_efi, chosen, "xen,xen-bootargs", NUL= L); if ( dt_bootargs_prop ) { @@ -526,7 +526,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *imag= e_name, blexit(L"FDT string overflow"); } =20 - if ( fdt_setprop_string(fdt, chosen, "xen,xen-bootargs", buf) < 0 ) + if ( fdt_setprop_string(fdt_efi, chosen, "xen,xen-bootargs", buf) < 0 ) blexit(L"Unable to set xen,xen-bootargs property."); =20 efi_bs->FreePool(buf); @@ -542,7 +542,7 @@ static void __init efi_arch_handle_module(const struct = file *file, =20 if ( file =3D=3D &dtbfile ) return; - chosen =3D setup_chosen_node(fdt, &addr_len, &size_len); + chosen =3D setup_chosen_node(fdt_efi, &addr_len, &size_len); if ( chosen < 0 ) blexit(L"Unable to setup chosen node"); =20 @@ -551,13 +551,13 @@ static void __init efi_arch_handle_module(const struc= t file *file, static const char __initconst ramdisk_compat[] =3D "multiboot,ramd= isk\0" "multiboot,module= "; =20 - node =3D fdt_add_subnode(fdt, chosen, "ramdisk"); + node =3D fdt_add_subnode(fdt_efi, chosen, "ramdisk"); if ( node < 0 ) blexit(L"Unable to add ramdisk FDT node."); - if ( fdt_setprop(fdt, node, "compatible", ramdisk_compat, + if ( fdt_setprop(fdt_efi, node, "compatible", ramdisk_compat, sizeof(ramdisk_compat)) < 0 ) blexit(L"Unable to set compatible property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, ramdisk.addr, + if ( fdt_set_reg(fdt_efi, node, addr_len, size_len, ramdisk.addr, ramdisk.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -566,13 +566,13 @@ static void __init efi_arch_handle_module(const struc= t file *file, static const char __initconst xsm_compat[] =3D "xen,xsm-policy\0" "multiboot,module"; =20 - node =3D fdt_add_subnode(fdt, chosen, "xsm"); + node =3D fdt_add_subnode(fdt_efi, chosen, "xsm"); if ( node < 0 ) blexit(L"Unable to add xsm FDT node."); - if ( fdt_setprop(fdt, node, "compatible", xsm_compat, + if ( fdt_setprop(fdt_efi, node, "compatible", xsm_compat, sizeof(xsm_compat)) < 0 ) blexit(L"Unable to set compatible property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, xsm.addr, + if ( fdt_set_reg(fdt_efi, node, addr_len, size_len, xsm.addr, xsm.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -581,15 +581,15 @@ static void __init efi_arch_handle_module(const struc= t file *file, static const char __initconst kernel_compat[] =3D "multiboot,kerne= l\0" "multiboot,module"; =20 - node =3D fdt_add_subnode(fdt, chosen, "kernel"); + node =3D fdt_add_subnode(fdt_efi, chosen, "kernel"); if ( node < 0 ) blexit(L"Unable to add dom0 FDT node."); - if ( fdt_setprop(fdt, node, "compatible", kernel_compat, + if ( fdt_setprop(fdt_efi, node, "compatible", kernel_compat, sizeof(kernel_compat)) < 0 ) blexit(L"Unable to set compatible property."); - if ( options && fdt_setprop_string(fdt, node, "bootargs", options)= < 0 ) + if ( options && fdt_setprop_string(fdt_efi, node, "bootargs", opti= ons) < 0 ) blexit(L"Unable to set bootargs property."); - if ( fdt_set_reg(fdt, node, addr_len, size_len, kernel.addr, + if ( fdt_set_reg(fdt_efi, node, addr_len, size_len, kernel.addr, kernel.size) < 0 ) blexit(L"Unable to set reg property."); } @@ -719,7 +719,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, module_info *file; =20 /* Check if the node is a multiboot,module otherwise return */ - module_compat =3D fdt_node_check_compatible(fdt, module_node_offset, + module_compat =3D fdt_node_check_compatible(fdt_efi, module_node_offse= t, "multiboot,module"); if ( module_compat < 0 ) /* Error while checking the compatible string */ @@ -730,7 +730,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, return 0; =20 /* Read xen,uefi-binary property to get the file name. */ - uefi_name_prop =3D fdt_getprop(fdt, module_node_offset, "xen,uefi-bina= ry", + uefi_name_prop =3D fdt_getprop(fdt_efi, module_node_offset, "xen,uefi-= binary", &uefi_name_len); =20 if ( !uefi_name_prop ) @@ -751,13 +751,13 @@ static int __init handle_module_node(const EFI_LOADED= _IMAGE *loaded_image, snprintf(mod_string, sizeof(mod_string), "module@%"PRIx64, file->addr); =20 /* Rename the module to be module@{address} */ - if ( fdt_set_name(fdt, module_node_offset, mod_string) < 0 ) + if ( fdt_set_name(fdt_efi, module_node_offset, mod_string) < 0 ) { PrintMessage(L"Unable to modify module node name."); return ERROR_RENAME_MODULE_NAME; } =20 - if ( fdt_set_reg(fdt, module_node_offset, reg_addr_cells, reg_size_cel= ls, + if ( fdt_set_reg(fdt_efi, module_node_offset, reg_addr_cells, reg_size= _cells, file->addr, file->size) < 0 ) { PrintMessage(L"Unable to set module reg property."); @@ -766,7 +766,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, =20 if ( !is_domu_module ) { - if ( (fdt_node_check_compatible(fdt, module_node_offset, + if ( (fdt_node_check_compatible(fdt_efi, module_node_offset, "multiboot,kernel") =3D=3D 0) ) { /* @@ -784,14 +784,14 @@ static int __init handle_module_node(const EFI_LOADED= _IMAGE *loaded_image, kernel.size =3D file->size; } else if ( ramdisk.addr && - (fdt_node_check_compatible(fdt, module_node_offset, + (fdt_node_check_compatible(fdt_efi, module_node_offset, "multiboot,ramdisk") =3D=3D 0= ) ) { PrintMessage(L"Dom0 ramdisk already found in cfg file."); return ERROR_DOM0_RAMDISK_FOUND; } else if ( xsm.addr && - (fdt_node_check_compatible(fdt, module_node_offset, + (fdt_node_check_compatible(fdt_efi, module_node_offset, "xen,xsm-policy") =3D=3D 0) ) { PrintMessage(L"XSM policy already found in cfg file."); @@ -816,7 +816,7 @@ static int __init handle_dom0less_domain_node(const EFI= _LOADED_IMAGE *loaded_ima unsigned int mb_modules_found =3D 0; =20 /* Get #address-cells and #size-cells from domain node */ - prop =3D fdt_get_property(fdt, domain_node, "#address-cells", &len); + prop =3D fdt_get_property(fdt_efi, domain_node, "#address-cells", &len= ); if ( !prop ) { PrintMessage(L"#address-cells not found in domain node."); @@ -825,7 +825,7 @@ static int __init handle_dom0less_domain_node(const EFI= _LOADED_IMAGE *loaded_ima =20 addr_cells =3D fdt32_to_cpu(*((uint32_t *)prop->data)); =20 - prop =3D fdt_get_property(fdt, domain_node, "#size-cells", &len); + prop =3D fdt_get_property(fdt_efi, domain_node, "#size-cells", &len); if ( !prop ) { PrintMessage(L"#size-cells not found in domain node."); @@ -835,9 +835,9 @@ static int __init handle_dom0less_domain_node(const EFI= _LOADED_IMAGE *loaded_ima size_cells =3D fdt32_to_cpu(*((uint32_t *)prop->data)); =20 /* Check for nodes compatible with multiboot,module inside this node */ - for ( module_node =3D fdt_first_subnode(fdt, domain_node); + for ( module_node =3D fdt_first_subnode(fdt_efi, domain_node); module_node > 0; - module_node =3D fdt_next_subnode(fdt, module_node) ) + module_node =3D fdt_next_subnode(fdt_efi, module_node) ) { int ret =3D handle_module_node(loaded_image, dir_handle, module_no= de, addr_cells, size_cells, true); @@ -862,7 +862,7 @@ static int __init efi_check_dt_boot(const EFI_LOADED_IM= AGE *loaded_image) EFI_FILE_HANDLE dir_handle =3D NULL; =20 /* Check for the chosen node in the current DTB */ - chosen =3D setup_chosen_node(fdt, &addr_len, &size_len); + chosen =3D setup_chosen_node(fdt_efi, &addr_len, &size_len); if ( chosen < 0 ) { PrintMessage(L"Unable to setup chosen node"); @@ -870,13 +870,13 @@ static int __init efi_check_dt_boot(const EFI_LOADED_= IMAGE *loaded_image) } =20 /* Check for nodes compatible with xen,domain under the chosen node */ - for ( node =3D fdt_first_subnode(fdt, chosen); + for ( node =3D fdt_first_subnode(fdt_efi, chosen); node > 0; - node =3D fdt_next_subnode(fdt, node) ) + node =3D fdt_next_subnode(fdt_efi, node) ) { int ret; =20 - if ( !fdt_node_check_compatible(fdt, node, "xen,domain") ) + if ( !fdt_node_check_compatible(fdt_efi, node, "xen,domain") ) { /* Found a node with compatible xen,domain; handle this node. = */ ret =3D handle_dom0less_domain_node(loaded_image, &dir_handle,= node); @@ -951,29 +951,29 @@ static bool __init efi_arch_use_config_file(EFI_SYSTE= M_TABLE *SystemTable) * node to decide whether to skip the UEFI Xen configuration file or n= ot. */ =20 - fdt =3D lookup_fdt_config_table(SystemTable); - dtbfile.ptr =3D fdt; + fdt_efi =3D lookup_fdt_config_table(SystemTable); + dtbfile.ptr =3D fdt_efi; dtbfile.need_to_free =3D false; /* Config table memory can't be freed.= */ =20 - if ( fdt && - (fdt_node_offset_by_compatible(fdt, 0, "multiboot,module") > 0) ) + if ( fdt_efi && + (fdt_node_offset_by_compatible(fdt_efi, 0, "multiboot,module") > = 0) ) { /* Locate chosen node */ - int node =3D fdt_subnode_offset(fdt, 0, "chosen"); + int node =3D fdt_subnode_offset(fdt_efi, 0, "chosen"); const void *cfg_load_prop; int cfg_load_len; =20 if ( node > 0 ) { /* Check if xen,uefi-cfg-load property exists */ - cfg_load_prop =3D fdt_getprop(fdt, node, "xen,uefi-cfg-load", + cfg_load_prop =3D fdt_getprop(fdt_efi, node, "xen,uefi-cfg-loa= d", &cfg_load_len); if ( !cfg_load_prop ) load_cfg_file =3D false; } } =20 - if ( !fdt || load_cfg_file ) + if ( !fdt_efi || load_cfg_file ) { /* * We either have no FDT, or one without modules, so we must have a @@ -983,7 +983,7 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_= TABLE *SystemTable) } PrintStr(L"Using modules provided by bootloader in FDT\r\n"); /* We have modules already defined in fdt, just add space. */ - fdt =3D fdt_increase_size(&dtbfile, EFI_PAGE_SIZE); + fdt_efi =3D fdt_increase_size(&dtbfile, EFI_PAGE_SIZE); =20 return false; } --=20 2.34.1