| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * c 2001 PPC 64 Team, IBM Corp |
|---|
| 3 | 4 | * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or |
|---|
| 5 | | - * modify it under the terms of the GNU General Public License |
|---|
| 6 | | - * as published by the Free Software Foundation; either version |
|---|
| 7 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 8 | | - * |
|---|
| 9 | 5 | * /dev/nvram driver for PPC |
|---|
| 10 | | - * |
|---|
| 11 | 6 | */ |
|---|
| 12 | 7 | |
|---|
| 13 | 8 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 24 | 19 | static unsigned char nvram_buf[4]; |
|---|
| 25 | 20 | static DEFINE_SPINLOCK(nvram_lock); |
|---|
| 26 | 21 | |
|---|
| 27 | | -static unsigned char chrp_nvram_read(int addr) |
|---|
| 22 | +static unsigned char chrp_nvram_read_val(int addr) |
|---|
| 28 | 23 | { |
|---|
| 29 | 24 | unsigned int done; |
|---|
| 30 | 25 | unsigned long flags; |
|---|
| .. | .. |
|---|
| 46 | 41 | return ret; |
|---|
| 47 | 42 | } |
|---|
| 48 | 43 | |
|---|
| 49 | | -static void chrp_nvram_write(int addr, unsigned char val) |
|---|
| 44 | +static void chrp_nvram_write_val(int addr, unsigned char val) |
|---|
| 50 | 45 | { |
|---|
| 51 | 46 | unsigned int done; |
|---|
| 52 | 47 | unsigned long flags; |
|---|
| .. | .. |
|---|
| 62 | 57 | __pa(nvram_buf), 1) != 0) || 1 != done) |
|---|
| 63 | 58 | printk(KERN_DEBUG "rtas IO error storing 0x%02x at %d", val, addr); |
|---|
| 64 | 59 | spin_unlock_irqrestore(&nvram_lock, flags); |
|---|
| 60 | +} |
|---|
| 61 | + |
|---|
| 62 | +static ssize_t chrp_nvram_size(void) |
|---|
| 63 | +{ |
|---|
| 64 | + return nvram_size; |
|---|
| 65 | 65 | } |
|---|
| 66 | 66 | |
|---|
| 67 | 67 | void __init chrp_nvram_init(void) |
|---|
| .. | .. |
|---|
| 85 | 85 | printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size); |
|---|
| 86 | 86 | of_node_put(nvram); |
|---|
| 87 | 87 | |
|---|
| 88 | | - ppc_md.nvram_read_val = chrp_nvram_read; |
|---|
| 89 | | - ppc_md.nvram_write_val = chrp_nvram_write; |
|---|
| 88 | + ppc_md.nvram_read_val = chrp_nvram_read_val; |
|---|
| 89 | + ppc_md.nvram_write_val = chrp_nvram_write_val; |
|---|
| 90 | + ppc_md.nvram_size = chrp_nvram_size; |
|---|
| 90 | 91 | |
|---|
| 91 | 92 | return; |
|---|
| 92 | 93 | } |
|---|