From patchwork Tue Mar 1 17:41:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 63321 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1962472lbc; Tue, 1 Mar 2016 09:46:00 -0800 (PST) X-Received: by 10.55.71.146 with SMTP id u140mr27341215qka.14.1456854360268; Tue, 01 Mar 2016 09:46: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 d126si31819919qkb.84.2016.03.01.09.46.00 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 01 Mar 2016 09:46: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]:51398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaoMx-0007Ir-Sf for patch@linaro.org; Tue, 01 Mar 2016 12:45:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaoK2-0005ry-10 for grub-devel@gnu.org; Tue, 01 Mar 2016 12:45:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaoIx-0007m9-Tk for grub-devel@gnu.org; Tue, 01 Mar 2016 12:42:57 -0500 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:33563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaoIx-0007m5-Jo for grub-devel@gnu.org; Tue, 01 Mar 2016 12:41:51 -0500 Received: by mail-wm0-x22a.google.com with SMTP id l68so46299816wml.0 for ; Tue, 01 Mar 2016 09:41:51 -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=qiKV42u/S2fmVWZ1Yo8E+YtGWK5Gm2TWD2NgO5KPAhY=; b=XT2bor0JwAxf8tFERnaZa2Uy6YR7PirE64/bh4HvIkVV0pytseh96fqW9frHo2aJhL 0b6vJDb6l6QKMmfFYQNMSzdpxabU618hLwxKnaOUlydfJpzgQSP1MO3le/tFIwcDsnk8 HUkMagBb6offDXTXelOU5PB376Li2+nKG3KCs= 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=qiKV42u/S2fmVWZ1Yo8E+YtGWK5Gm2TWD2NgO5KPAhY=; b=lXx6N296mlnFV1KwHHSUoEkLRFt0lIXl+J62wv40MHzGpFQRCIMeDD/RD8/Bi5Nwih 5v1RmzDn8HLbj3Ds7Aa1o/dOJHal76/MhCJI/WxLy8o4KMJrz/6dAiEPVxZFS1zId68S Wn3ObubneV/WAcIo5kq+s7YxvY/ta5RgrTEu5PKjBLONnKtKaq5Ff2SqOrN45iZhJj7l FAkZCll5iKJUpdc2XXwS3li5e0+B4fcUk7wQaXLyZaN2btKWpGiPAoscm7kBOLaVg6x7 w9gPrfxJ6w/bIqceqM+PLNQOQz54raVOl/ACwL/yt00GI/WqLhkNxo618jzh18hULNmP og9A== X-Gm-Message-State: AD7BkJJnMvEq2+0LETNcxWCqWxlAqmuI1xNIZPHT155xQhz8Ml5mIDpabHyM01G/OsvpD/PW X-Received: by 10.194.250.72 with SMTP id za8mr21387073wjc.4.1456854110951; Tue, 01 Mar 2016 09:41:50 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Mar 2016 09:41:50 -0800 (PST) From: Leif Lindholm To: grub-devel@gnu.org Subject: [RFC 3/3] acpi: use grub_efi_find_config_table to find tables Date: Tue, 1 Mar 2016 17:41:43 +0000 Message-Id: <1456854103-12095-4-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::22a 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 Use new helper function rather than manually iterating through UEFI system table. --- grub-core/kern/efi/acpi.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) -- 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/acpi.c b/grub-core/kern/efi/acpi.c index 74f8cd1..523d682 100644 --- a/grub-core/kern/efi/acpi.c +++ b/grub-core/kern/efi/acpi.c @@ -25,35 +25,15 @@ struct grub_acpi_rsdp_v10 * grub_machine_acpi_get_rsdpv1 (void) { - unsigned i; - static grub_efi_packed_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID; + static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID; - for (i = 0; i < grub_efi_system_table->num_table_entries; i++) - { - grub_efi_packed_guid_t *guid = - &grub_efi_system_table->configuration_table[i].vendor_guid; - - if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_packed_guid_t))) - return (struct grub_acpi_rsdp_v10 *) - grub_efi_system_table->configuration_table[i].vendor_table; - } - return 0; + return grub_efi_find_config_table (&acpi_guid); } struct grub_acpi_rsdp_v20 * grub_machine_acpi_get_rsdpv2 (void) { - unsigned i; - static grub_efi_packed_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID; - - for (i = 0; i < grub_efi_system_table->num_table_entries; i++) - { - grub_efi_packed_guid_t *guid = - &grub_efi_system_table->configuration_table[i].vendor_guid; + static grub_efi_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID; - if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_efi_packed_guid_t))) - return (struct grub_acpi_rsdp_v20 *) - grub_efi_system_table->configuration_table[i].vendor_table; - } - return 0; + return grub_efi_find_config_table (&acpi20_guid); }