aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMartyn Welch <martyn.welch@gefanuc.com>2009-08-13 04:03:02 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-09-11 02:02:11 -0400
commitd331d8305cba713605854aab63a000fb892353a7 (patch)
tree5ee6cea2fe656d5772d79245e296c13b36f60456 /arch
parent1d6ed32226326a6e6cd67cd9ee4294bcbb0c9a15 (diff)
powerpc/nvram: Enable use Generic NVRAM driver for different size chips
Remove the reliance on a staticly defined NVRAM size, allowing platforms to support NVRAMs with sizes differing from the standard. A fall back value is provided for platforms not supporting this extension. Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/nvram.h3
-rw-r--r--arch/powerpc/kernel/setup_32.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
index efde5ac82f7b..6c587eddee59 100644
--- a/arch/powerpc/include/asm/nvram.h
+++ b/arch/powerpc/include/asm/nvram.h
@@ -107,6 +107,9 @@ extern void pmac_xpram_write(int xpaddr, u8 data);
107/* Synchronize NVRAM */ 107/* Synchronize NVRAM */
108extern void nvram_sync(void); 108extern void nvram_sync(void);
109 109
110/* Determine NVRAM size */
111extern ssize_t nvram_get_size(void);
112
110/* Normal access to NVRAM */ 113/* Normal access to NVRAM */
111extern unsigned char nvram_read_byte(int i); 114extern unsigned char nvram_read_byte(int i);
112extern void nvram_write_byte(unsigned char c, int i); 115extern void nvram_write_byte(unsigned char c, int i);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index e1e3059cf34b..53bcf3d792db 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -210,6 +210,14 @@ void nvram_write_byte(unsigned char val, int addr)
210} 210}
211EXPORT_SYMBOL(nvram_write_byte); 211EXPORT_SYMBOL(nvram_write_byte);
212 212
213ssize_t nvram_get_size(void)
214{
215 if (ppc_md.nvram_size)
216 return ppc_md.nvram_size();
217 return -1;
218}
219EXPORT_SYMBOL(nvram_get_size);
220
213void nvram_sync(void) 221void nvram_sync(void)
214{ 222{
215 if (ppc_md.nvram_sync) 223 if (ppc_md.nvram_sync)