Received: from list by lists.gnu.org with archive (Exim 4.71) id 1c6kxK-0006VC-H6 for mharc-grub-devel@gnu.org; Tue, 15 Nov 2016 16:07:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6kxH-0006Ux-KI for grub-devel@gnu.org; Tue, 15 Nov 2016 16:07:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6kxC-0003ps-KL for grub-devel@gnu.org; Tue, 15 Nov 2016 16:07:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:51895) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c6kxC-0003p0-DL for grub-devel@gnu.org; Tue, 15 Nov 2016 16:07:42 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 732FAAC34; Tue, 15 Nov 2016 21:07:40 +0000 (UTC) Subject: Re: [PATCH 1/2] arm64: Move firmware fdt search into global function To: Daniel Kiper , arvidjaar@gmail.com, grub-devel@gnu.org References: <1456701744-202295-1-git-send-email-agraf@suse.de> <77c2cdca-3a1c-f5be-c60e-00a8051d047d@gmail.com> <20161115210022.GG16470@router-fw-old.local.net-space.pl> Cc: leif.lindholm@linaro.org From: Alexander Graf Message-ID: <40ae70b1-9aeb-1f5c-2cd3-8fef929d9103@suse.de> Date: Tue, 15 Nov 2016 22:07:39 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161115210022.GG16470@router-fw-old.local.net-space.pl> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2016 21:07:49 -0000 On 15/11/2016 22:00, Daniel Kiper wrote: > On Sat, Nov 12, 2016 at 12:03:33PM +0300, Andrei Borzenkov wrote: >> 29.02.2016 02:22, Alexander Graf ??????????: >>> Searching for a device tree that EFI passes to us via configuration tables >>> is nothing architecture specific. Move it into generic code. >>> >>> Signed-off-by: Alexander Graf >>> --- >>> grub-core/kern/efi/init.c | 22 ++++++++++++++++++++++ >>> grub-core/loader/arm64/fdt.c | 24 +----------------------- >>> include/grub/efi/efi.h | 2 ++ >>> 3 files changed, 25 insertions(+), 23 deletions(-) >>> >>> diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c >>> index e9c85de..fb90ecd 100644 >>> --- a/grub-core/kern/efi/init.c >>> +++ b/grub-core/kern/efi/init.c >>> @@ -72,6 +72,28 @@ grub_machine_get_bootlocation (char **device, char **path) >>> } >>> } >>> >>> +void * >>> +grub_efi_get_firmware_fdt (void) >>> +{ >>> + grub_efi_configuration_table_t *tables; >>> + grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID; >>> + void *firmware_fdt = NULL; >>> + unsigned int i; >>> + >>> + /* Look for FDT in UEFI config tables. */ >>> + tables = grub_efi_system_table->configuration_table; >>> + >>> + for (i = 0; i < grub_efi_system_table->num_table_entries; i++) >>> + if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0) >>> + { >>> + firmware_fdt = tables[i].vendor_table; >>> + grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt); >>> + break; >>> + } >>> + >>> + return firmware_fdt; >>> +} >>> + >> >> Is it relevant for x86? I cannot even find anything related to FDT or >> "device tree" in UEFI spec, it falls under vendor extensions. What other >> use it has except in Linux loader? >> >> I really fail to see why it should be moved into core until at least one >> more non-trivial caller is present. > > Hmmm... It looks that I was too fast. TBH, I can agree to some extend. > Should we revert this patch or just #ifdef relevant code? Revert seems > better for me. Uh, the point of the function was to share code between 32bit and 64bit arm platforms which are completely separate archs. There's also effort underway to run with device tree on x86: https://plus.google.com/+ChristopherFriedt/posts/SfDifuC1xsR Alex