diff options
author | Patrick Georgi <patrick.georgi@secunet.com> | 2011-01-28 07:54:11 +0000 |
---|---|---|
committer | Patrick Georgi <patrick.georgi@coresystems.de> | 2011-01-28 07:54:11 +0000 |
commit | 1e916e076640c133dd32d69804325db02f1707be (patch) | |
tree | 6541c5d18707202ab755ac3de7d8e7ef0e9d1dce /util/nvramtool/accessors/cmos-mem.c | |
parent | 49a74437aab0c253243e62aca20966cf22f864e6 (diff) |
Move CMOS handling into separate files in accessors
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6313 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/nvramtool/accessors/cmos-mem.c')
-rw-r--r-- | util/nvramtool/accessors/cmos-mem.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/util/nvramtool/accessors/cmos-mem.c b/util/nvramtool/accessors/cmos-mem.c new file mode 100644 index 0000000000..c124cdeee8 --- /dev/null +++ b/util/nvramtool/accessors/cmos-mem.c @@ -0,0 +1,37 @@ +#include <assert.h> +#include "cmos_lowlevel.h" + +static void mem_hal_init(void* data); +static unsigned char mem_hal_read(unsigned addr); +static void mem_hal_write(unsigned addr, unsigned char value); +static void mem_set_iopl(int level); + +static unsigned char* mem_hal_data = (unsigned char*)-1; +static void mem_hal_init(void *data) +{ + mem_hal_data = data; +} + +static unsigned char mem_hal_read(unsigned index) +{ + assert(mem_hal_data != (unsigned char*)-1); + return mem_hal_data[index]; +} + +static void mem_hal_write(unsigned index, unsigned char value) +{ + assert(mem_hal_data != (unsigned char*)-1); + mem_hal_data[index] = value; +} + +static void mem_set_iopl(__attribute__ ((unused)) int level) +{ +} + +cmos_access_t memory_hal = { + .init = mem_hal_init, + .read = mem_hal_read, + .write = mem_hal_write, + .set_iopl = mem_set_iopl, +}; + |