lkml.org 
[lkml]   [2004]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[2.6.6 PATCH] Exposing EFI memory map
    Date
    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? */
    };

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-03-22 14:02    [W:4.253 / U:0.332 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site