From: "Sourav Sen" <souravs@india.hp.com>
To: Matt_Domsch@dell.com, matthew.e.tolentino@intel.com,
linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [2.6.6 PATCH] Exposing EFI memory map
Date: Thu, 06 May 2004 08:53:23 +0000 [thread overview]
Message-ID: <003801c43347$812a1590$39624c0f@india.hp.com> (raw)
Hi,
The following simple patch creates a read-only file
"memmap" under <mount point>/firmware/efi/ in sysfs
and exposes the efi memory map thru it.
Thanks
Sourav
The patch is w.r.t 2.6.6-rc3
----------------------------
=====================================--- a/drivers/firmware/efivars.c 2004-05-05 13:55:40.000000000 +0530
+++ b/drivers/firmware/efivars.c 2004-05-06 11:43:40.000000000 +0530
@@ -580,10 +580,42 @@ systab_read(struct subsystem *entry, cha
return str - buf;
}
+/*
+ * Expose the efi memory map as kernel keeps it. Note, it may be a little
+ * different from what gets actually passed in at loader handoff time as a
+ * call to efi_memmap_walk modifies that.
+ */
+
+static ssize_t
+efi_memmap_read(struct subsystem *entry, char * buf)
+{
+ void * efi_map_start, *efi_map_end, *p;
+ efi_memory_desc_t *md;
+ u64 efi_desc_size;
+ char * str = buf;
+
+ if (!entry || !buf)
+ return -EINVAL;
+
+ efi_map_start = __va(ia64_boot_param->efi_memmap);
+ efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
+ efi_desc_size = ia64_boot_param->efi_memdesc_size;
+
+ for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
+ md = (efi_memory_desc_t *)p;
+ str += sprintf(str, "%2u %-#18lx %#016lx %#016lx\n",
\
+ md->type, md->attribute, md->phys_addr, \
+ md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT));
+ }
+ return (str - buf);
+}
+
static EFI_ATTR(systab, 0400, systab_read, NULL);
+static EFI_ATTR(memmap, 0400, efi_memmap_read, NULL);
static struct subsys_attribute *efi_subsys_attrs[] = {
&efi_attr_systab,
+ &efi_attr_memmap, /* Here comes one */
NULL, /* maybe more in the future? */
};
next reply other threads:[~2004-05-06 8:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-06 8:53 Sourav Sen [this message]
2004-05-06 9:30 ` [2.6.6 PATCH] Exposing EFI memory map Sourav Sen
2004-05-06 10:44 ` Christoph Hellwig
2004-05-06 11:59 ` Matthew Wilcox
2004-05-06 12:18 ` Arjan van de Ven
2004-05-06 13:27 ` Matthew Wilcox
2004-05-06 14:00 ` Dave Hansen
2004-05-06 14:09 ` Arjan van de Ven
2004-05-06 14:09 ` Christoph Hellwig
2004-05-06 12:46 ` Matt Domsch
2004-05-06 13:23 ` Luck, Tony
2004-05-06 13:32 ` Sourav Sen
2004-05-06 15:08 ` Bjorn Helgaas
2004-05-06 16:14 ` Tolentino, Matthew E
2004-05-06 16:37 ` Sourav Sen
2004-05-06 16:49 ` Dave Hansen
2004-05-06 16:40 ` Greg KH
2004-05-06 18:47 ` Tolentino, Matthew E
2004-05-06 18:57 ` Dave Hansen
2004-05-06 20:54 ` Tolentino, Matthew E
2004-05-06 21:44 ` [Lhms-devel] " Dave Hansen
2004-05-07 9:57 ` Sourav Sen
2004-05-07 21:49 ` Greg KH
2004-05-11 14:56 ` Sourav Sen
2004-05-11 15:42 ` Dave Hansen
2004-05-12 10:36 ` Sourav Sen
2004-05-12 16:15 ` Dave Hansen
2004-05-13 14:22 ` Sourav Sen
2004-05-13 15:32 ` Dave Hansen
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='003801c43347$812a1590$39624c0f@india.hp.com' \
--to=souravs@india.hp.com \
--cc=Matt_Domsch@dell.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.e.tolentino@intel.com \
/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