From patchwork Tue Mar 1 17:41:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 63322 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1962904lbc; Tue, 1 Mar 2016 09:47:00 -0800 (PST) X-Received: by 10.55.74.9 with SMTP id x9mr28257634qka.81.1456854420903; Tue, 01 Mar 2016 09:47:00 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a141si4269002qkb.16.2016.03.01.09.47.00 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 01 Mar 2016 09:47:00 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([::1]:51417 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaoNw-0000Q5-GD for patch@linaro.org; Tue, 01 Mar 2016 12:47:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaoLj-000681-Vk for grub-devel@gnu.org; Tue, 01 Mar 2016 12:46:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaoIw-0007lk-6z for grub-devel@gnu.org; Tue, 01 Mar 2016 12:44:43 -0500 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:33545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaoIv-0007lZ-UM for grub-devel@gnu.org; Tue, 01 Mar 2016 12:41:50 -0500 Received: by mail-wm0-x22f.google.com with SMTP id l68so46298664wml.0 for ; Tue, 01 Mar 2016 09:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WIlhd5S5XglLUE4hq/JwnxSZjodWW67nvThWuLRhoTY=; b=XoG9Ptw9bHItctOQMYDwHSvaESiYnjDscPB46x0mvcbivzNsyMvSUEZiXPlblfHi6W niHQsyRcQbuk8iOPMPvqTk0IxRii+yw6uOrwN9tMobgtj6lHEAMx8Xp37ql+RzXcdzL6 5WsYw4egHamDgkP/bWJyQn2ZRQSYOLBUA/PIc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WIlhd5S5XglLUE4hq/JwnxSZjodWW67nvThWuLRhoTY=; b=m2JyANad3RUJ2mmL1RbgqX+PtrCRGNwOI+aEtKb6YeVsVzIukAEwBXKjP7BhQm254K yFTVXL6VnNm0NBl/gvSrcTIWNQ7W5q7FI5PvrfBMwm9YqMqoAyLV5SwdZXef8v0G8Wb3 NyT+lCtK4GzqL9GxT/JP295RlTitdFhqjPRC/PrI66/9mfrYo3Ysam9hlu/UKNUaIQU/ HZ5G10hn4dd9YttBsPPfmNP2JTlppOGCEU253Vb3NHRhKeZE3q6c1M07h8uFgC+vDgR3 XAWRTpcTKXxhnnm3d1HSKvc0GE9fCsjqbHqK/aPGH0JyzR6fiJdqR4D8r8afNmqm+TGN R8UA== X-Gm-Message-State: AD7BkJIl7IIEV3lTnc1ot/cW3AnfeNRcdNo4q6jLbstBotLDrs3kNmB07Jo4vmYXK/4yC7Rr X-Received: by 10.194.83.42 with SMTP id n10mr22116516wjy.20.1456854109227; Tue, 01 Mar 2016 09:41:49 -0800 (PST) Received: from mohikan.mushroom.smurfnet.nu (cpc92308-cmbg19-2-0-cust814.5-4.cable.virginm.net. [82.24.251.47]) by smtp.gmail.com with ESMTPSA id fv6sm31974541wjc.12.2016.03.01.09.41.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Mar 2016 09:41:48 -0800 (PST) From: Leif Lindholm To: grub-devel@gnu.org Subject: [RFC 1/3] efi: add configuration table search function Date: Tue, 1 Mar 2016 17:41:41 +0000 Message-Id: <1456854103-12095-2-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456854103-12095-1-git-send-email-leif.lindholm@linaro.org> References: <1456854103-12095-1-git-send-email-leif.lindholm@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22f Cc: Alexander Graf X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: grub-devel-bounces+patch=linaro.org@gnu.org Several places in the code iterates through the configuration tables presented by the system table. Add new function grub_efi_find_config_table to use for this instead. --- grub-core/kern/efi/efi.c | 18 ++++++++++++++++++ include/grub/efi/efi.h | 3 +++ 2 files changed, 21 insertions(+) -- 2.1.4 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c index caf9bcc..41686ee 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -911,3 +911,21 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1, return 0; } + +/* Return pointer to vendor table identified by guid. */ +void * +grub_efi_find_config_table (const grub_efi_guid_t *guid) +{ + grub_efi_uintn_t i; + + for (i = 0; i < grub_efi_system_table->num_table_entries; i++) + { + grub_efi_configuration_table_t *table = + &grub_efi_system_table->configuration_table[i]; + + if (! grub_memcmp (&table->vendor_guid, guid, + sizeof (grub_efi_packed_guid_t))) + return (void *) table->vendor_table; + } + return NULL; +} diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h index 0e6fd86..65c7f95 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -77,6 +77,9 @@ int EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, const grub_efi_device_path_t *dp2); +void * +EXPORT_FUNC (grub_efi_find_config_table) (const grub_efi_guid_t *guid); + extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, char **device, char **path);