2ce0939ac5659ce354ce2f12ecfd8b46ed8b7991
[coreboot.git] / src / mainboard / motorola / sandpoint / nvram.h
1 /*
2  * This file is part of the LinuxBIOS project.
3  *
4  * Copyright (C) 2000 AG Electronics Ltd.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 /* Definitions for nvram devices - these are flash or eeprom devices used to
21    store information across power cycles and resets. Though they are byte
22    addressable, writes must be committed to allow flash devices to write
23    complete sectors. */
24
25 #ifndef _NVRAM_H
26 #define _NVRAM_H
27
28 typedef struct nvram_device
29 {
30     unsigned (*size)(struct nvram_device *data);
31     int (*read_block)(struct nvram_device *dev, unsigned offset,
32             unsigned char *data, unsigned length);
33     int (*write_byte)(struct nvram_device *dev, unsigned offset, unsigned char byte);
34     void (*commit)(struct nvram_device *data);
35     void *data;
36 } nvram_device;
37
38 int nvram_init (nvram_device *dev);
39 void nvram_clear(void);
40
41 extern nvram_device pcrtc_nvram;
42 extern void nvram_putenv(const char *name, const char *value);
43 extern  int nvram_getenv(const char *name, char *buffer, unsigned size);
44
45 typedef const struct nvram_constant 
46 {
47     const char *name;
48     const char *value;
49 } nvram_constant;
50     
51 extern nvram_constant hardcoded_environment[];
52
53 #endif