summaryrefslogtreecommitdiff
path: root/util/nvramtool/accessors/cmos-mem.c
blob: c124cdeee896b64d486c97513cbb85345c94fa07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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,
};