From patchwork Tue Aug 1 12:47:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13336686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 946F9C04FDF for ; Tue, 1 Aug 2023 12:48:47 +0000 (UTC) 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 X-Outflank-Mailman: Message body and most headers restored to incoming version 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-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 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_PARAM(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_HANDLE_PARAM(void) compat) 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; - XLAT_remove_from_physmap(nat.xrfp, &cmp); + XLAT_remove_from_physmap(nat.xrfp, &cmp.rmfp); 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 @@ 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]; 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( static void __init cutoff_node(nodeid_t i, paddr_t start, paddr_t end) { - struct node *nd = &nodes[i]; + struct node *nd = &numa_nodes[i]; if ( nd->start < start ) { @@ -157,7 +157,7 @@ bool __init numa_update_node_memblks(nodeid_t node, unsigned int arch_nid, paddr_t end = start + size; paddr_t nd_start = start; paddr_t nd_end = end; - struct node *nd = &nodes[node]; + struct node *nd = &numa_nodes[node]; /* * For the node that already has some memory blocks, we will @@ -292,17 +292,17 @@ static bool __init nodes_cover_memory(void) do { found = 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].start ) { - if ( start >= nodes[j].start ) + if ( start >= numa_nodes[j].start ) { - start = nodes[j].end; + start = numa_nodes[j].end; found = true; } - if ( end <= nodes[j].end ) + if ( end <= numa_nodes[j].end ) { - end = nodes[j].start; + end = numa_nodes[j].start; found = 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 == nodes[i].start ) + if ( numa_nodes[i].end == numa_nodes[i].start ) printk(KERN_INFO "NUMA: node %u has no memory\n", i); - setup_node_bootmem(i, nodes[i].start, nodes[i].end); + setup_node_bootmem(i, numa_nodes[i].start, numa_nodes[i].end); } for ( i = 0; i < nr_cpu_ids; i++ ) From patchwork Tue Aug 1 12:47:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13336684 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49E3BC001DF for ; Tue, 1 Aug 2023 12:48:45 +0000 (UTC) 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 X-Outflank-Mailman: Message body and most headers restored to incoming version 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-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 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 = readl(&dbgp->ehci_debug->control); - - if ( ctrl & DBGP_ENABLED ) + if ( readl(&dbgp->ehci_debug->control) & DBGP_ENABLED ) { cmd |= 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); 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[] = { - {"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, struct ns16550 *uart) switch ( get_token(token, ¶m_value) ) { - case baud: + case baud_rate: uart->baud = simple_strtoul(param_value, NULL, 0); break; From patchwork Tue Aug 1 12:47:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13336687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8346BC04A94 for ; Tue, 1 Aug 2023 12:48:47 +0000 (UTC) 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 X-Outflank-Mailman: Message body and most headers restored to incoming version 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-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 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, 0xe0}} static struct file __initdata dtbfile; -static void __initdata *fdt; +static void __initdata *fdt_efi; static void __initdata *memmap; 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_SYSTEM_TABLE *SystemTable, if ( EFI_ERROR(status) ) blexit(L"EFI memory map processing failed"); - status = fdt_add_uefi_nodes(SystemTable, fdt, map, map_size, desc_size, + status = fdt_add_uefi_nodes(SystemTable, fdt_efi, map, map_size, desc_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) 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)); } 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_LOADED_IMAGE *image, efi_bs->FreePool(name.w); } } - fdt = fdt_increase_size(&dtbfile, cfg.size + EFI_PAGE_SIZE); - if ( !fdt ) + fdt_efi = fdt_increase_size(&dtbfile, cfg.size + EFI_PAGE_SIZE); + if ( !fdt_efi ) blexit(L"Unable to create new FDT"); } @@ -465,7 +465,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, int chosen; /* locate chosen node, which is where we add Xen module info. */ - chosen = fdt_subnode_offset(fdt, 0, "chosen"); + chosen = fdt_subnode_offset(fdt_efi, 0, "chosen"); if ( chosen < 0 ) blexit(L"Unable to find chosen node"); @@ -498,7 +498,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, else { /* Get xen,xen-bootargs in /chosen if it is specified */ - const char *dt_bootargs_prop = fdt_getprop(fdt, chosen, + const char *dt_bootargs_prop = fdt_getprop(fdt_efi, chosen, "xen,xen-bootargs", NULL); if ( dt_bootargs_prop ) { @@ -526,7 +526,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, blexit(L"FDT string overflow"); } - 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."); efi_bs->FreePool(buf); @@ -542,7 +542,7 @@ static void __init efi_arch_handle_module(const struct file *file, if ( file == &dtbfile ) return; - chosen = setup_chosen_node(fdt, &addr_len, &size_len); + chosen = setup_chosen_node(fdt_efi, &addr_len, &size_len); if ( chosen < 0 ) blexit(L"Unable to setup chosen node"); @@ -551,13 +551,13 @@ static void __init efi_arch_handle_module(const struct file *file, static const char __initconst ramdisk_compat[] = "multiboot,ramdisk\0" "multiboot,module"; - node = fdt_add_subnode(fdt, chosen, "ramdisk"); + node = 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 struct file *file, static const char __initconst xsm_compat[] = "xen,xsm-policy\0" "multiboot,module"; - node = fdt_add_subnode(fdt, chosen, "xsm"); + node = 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 struct file *file, static const char __initconst kernel_compat[] = "multiboot,kernel\0" "multiboot,module"; - node = fdt_add_subnode(fdt, chosen, "kernel"); + node = 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", options) < 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_IMAGE *loaded_image, module_info *file; /* Check if the node is a multiboot,module otherwise return */ - module_compat = fdt_node_check_compatible(fdt, module_node_offset, + module_compat = fdt_node_check_compatible(fdt_efi, module_node_offset, "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_IMAGE *loaded_image, return 0; /* Read xen,uefi-binary property to get the file name. */ - uefi_name_prop = fdt_getprop(fdt, module_node_offset, "xen,uefi-binary", + uefi_name_prop = fdt_getprop(fdt_efi, module_node_offset, "xen,uefi-binary", &uefi_name_len); 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); /* 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; } - if ( fdt_set_reg(fdt, module_node_offset, reg_addr_cells, reg_size_cells, + 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_IMAGE *loaded_image, 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") == 0) ) { /* @@ -784,14 +784,14 @@ static int __init handle_module_node(const EFI_LOADED_IMAGE *loaded_image, kernel.size = 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") == 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") == 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 = 0; /* Get #address-cells and #size-cells from domain node */ - prop = fdt_get_property(fdt, domain_node, "#address-cells", &len); + prop = 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 addr_cells = fdt32_to_cpu(*((uint32_t *)prop->data)); - prop = fdt_get_property(fdt, domain_node, "#size-cells", &len); + prop = 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 = fdt32_to_cpu(*((uint32_t *)prop->data)); /* Check for nodes compatible with multiboot,module inside this node */ - for ( module_node = fdt_first_subnode(fdt, domain_node); + for ( module_node = fdt_first_subnode(fdt_efi, domain_node); module_node > 0; - module_node = fdt_next_subnode(fdt, module_node) ) + module_node = fdt_next_subnode(fdt_efi, module_node) ) { int ret = handle_module_node(loaded_image, dir_handle, module_node, addr_cells, size_cells, true); @@ -862,7 +862,7 @@ static int __init efi_check_dt_boot(const EFI_LOADED_IMAGE *loaded_image) EFI_FILE_HANDLE dir_handle = NULL; /* Check for the chosen node in the current DTB */ - chosen = setup_chosen_node(fdt, &addr_len, &size_len); + chosen = 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) } /* Check for nodes compatible with xen,domain under the chosen node */ - for ( node = fdt_first_subnode(fdt, chosen); + for ( node = fdt_first_subnode(fdt_efi, chosen); node > 0; - node = fdt_next_subnode(fdt, node) ) + node = fdt_next_subnode(fdt_efi, node) ) { int ret; - 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 = handle_dom0less_domain_node(loaded_image, &dir_handle, node); @@ -951,29 +951,29 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) * node to decide whether to skip the UEFI Xen configuration file or not. */ - fdt = lookup_fdt_config_table(SystemTable); - dtbfile.ptr = fdt; + fdt_efi = lookup_fdt_config_table(SystemTable); + dtbfile.ptr = fdt_efi; dtbfile.need_to_free = false; /* Config table memory can't be freed. */ - 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 = fdt_subnode_offset(fdt, 0, "chosen"); + int node = fdt_subnode_offset(fdt_efi, 0, "chosen"); const void *cfg_load_prop; int cfg_load_len; if ( node > 0 ) { /* Check if xen,uefi-cfg-load property exists */ - cfg_load_prop = fdt_getprop(fdt, node, "xen,uefi-cfg-load", + cfg_load_prop = fdt_getprop(fdt_efi, node, "xen,uefi-cfg-load", &cfg_load_len); if ( !cfg_load_prop ) load_cfg_file = false; } } - 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 = fdt_increase_size(&dtbfile, EFI_PAGE_SIZE); + fdt_efi = fdt_increase_size(&dtbfile, EFI_PAGE_SIZE); return false; }