summaryrefslogtreecommitdiff
path: root/util/nvramtool/accessors/cmos-mem.c
blob: 619a68a2c6ee5d5b69c36a2af4c1955b96283d4c (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
#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,
};