linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Salter <msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
	Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
	matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	Leif Lindholm
	<leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	roy.franz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	Mark Salter <msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH 1/6] efi: create memory map iteration helper
Date: Fri, 10 Jan 2014 17:29:05 -0500	[thread overview]
Message-ID: <1389392950-22457-2-git-send-email-msalter@redhat.com> (raw)
In-Reply-To: <1389392950-22457-1-git-send-email-msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

There are a lot of places in the kernel which iterate through an
EFI memory map. Most of these places use essentially the same
for-loop code. This patch adds a for_each_efi_memory_desc()
helper to clean up all of the existing duplicate code and avoid
more in the future.

Signed-off-by: Mark Salter <msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 include/linux/efi.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/efi.h b/include/linux/efi.h
index 11ce678..9dc5b05 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -618,6 +618,12 @@ extern int efi_set_rtc_mmss(const struct timespec *now);
 extern void efi_reserve_boot_services(void);
 extern struct efi_memory_map memmap;
 
+/* Iterate through an efi_memory_map */
+#define for_each_efi_memory_desc(m, md)					   \
+	for ((md) = (m)->map;						   \
+	     (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \
+	     (md) = (void *)(md) + (m)->desc_size)
+
 /**
  * efi_range_is_wc - check the WC bit on an address range
  * @start: starting kvirt address
-- 
1.8.3.1

  parent reply	other threads:[~2014-01-10 22:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-10 22:29 [PATCH 0/6] arm64: Add EFI stub and runtime services support Mark Salter
2014-01-10 22:29 ` [PATCH 2/6] arm64: Add function to create identity mappings Mark Salter
2014-01-22 17:39   ` Catalin Marinas
2014-01-10 22:29 ` [PATCH 4/6] arm64: add EFI stub Mark Salter
     [not found]   ` <1389392950-22457-5-git-send-email-msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-13 18:49     ` Arnd Bergmann
     [not found]       ` <201401131949.39358.arnd-r2nGTMty4D4@public.gmane.org>
2014-01-14 14:44         ` Mark Salter
2014-01-14 19:26           ` Roy Franz
2014-01-22 18:04   ` Catalin Marinas
     [not found] ` <1389392950-22457-1-git-send-email-msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-10 22:29   ` Mark Salter [this message]
     [not found]     ` <1389392950-22457-2-git-send-email-msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-13 15:17       ` [PATCH 1/6] efi: create memory map iteration helper Matt Fleming
     [not found]         ` <20140113151759.GG3256-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-01-13 17:53           ` Mark Salter
2014-01-10 22:29   ` [PATCH 3/6] efi: add helper function to get UEFI params from FDT Mark Salter
2014-01-10 22:29   ` [PATCH 5/6] doc: arm64: add description of EFI stub support Mark Salter
2014-01-10 22:29 ` [PATCH 6/6] arm64: add EFI runtime services Mark Salter
     [not found]   ` <1389392950-22457-7-git-send-email-msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-23 11:24     ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389392950-22457-2-git-send-email-msalter@redhat.com \
    --to=msalter-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=roy.franz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).