aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/nvram_64.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-08-02 10:01:58 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-11-30 15:34:05 +1100
commitcf5cbf9f8085eb45316d6e3c888a77cc50696701 (patch)
tree992a3ae5d78703bb67b660508fac204dd02243ce /arch/powerpc/kernel/nvram_64.c
parentpowerpc/nvram: Improve partition removal (diff)
downloadlinux-dev-cf5cbf9f8085eb45316d6e3c888a77cc50696701.tar.xz
linux-dev-cf5cbf9f8085eb45316d6e3c888a77cc50696701.zip
powerpc/nvram: Add nvram_find_partition()
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/nvram_64.c')
-rw-r--r--arch/powerpc/kernel/nvram_64.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 6dd2700852f0..01e6844be8d7 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -429,6 +429,28 @@ static int nvram_get_partition_size(loff_t data_index)
}
+/**
+ * nvram_find_partition - Find an nvram partition by signature and name
+ * @name: Name of the partition or NULL for any name
+ * @sig: Signature to test against
+ * @out_size: if non-NULL, returns the size of the data part of the partition
+ */
+loff_t nvram_find_partition(const char *name, int sig, int *out_size)
+{
+ struct nvram_partition *p;
+
+ list_for_each_entry(p, &nvram_part->partition, partition) {
+ if (p->header.signature == sig &&
+ (!name || !strncmp(p->header.name, name, 12))) {
+ if (out_size)
+ *out_size = (p->header.length - 1) *
+ NVRAM_BLOCK_LEN;
+ return p->index + NVRAM_HEADER_LEN;
+ }
+ }
+ return 0;
+}
+
/* nvram_setup_partition
*
* This will setup the partition we need for buffering the