forked from flashrom/flashrom
-
Notifications
You must be signed in to change notification settings - Fork 1
/
internal_par.c
79 lines (69 loc) · 2.12 KB
/
internal_par.c
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* This file is part of the flashrom project.
*
* Copyright (C) 2009 Carl-Daniel Hailfinger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "programmer.h"
#include "hwaccess_physmap.h"
static void internal_chip_writeb(const struct flashctx *flash, uint8_t val,
chipaddr addr)
{
mmio_writeb(val, (void *) addr);
}
static void internal_chip_writew(const struct flashctx *flash, uint16_t val,
chipaddr addr)
{
mmio_writew(val, (void *) addr);
}
static void internal_chip_writel(const struct flashctx *flash, uint32_t val,
chipaddr addr)
{
mmio_writel(val, (void *) addr);
}
static uint8_t internal_chip_readb(const struct flashctx *flash,
const chipaddr addr)
{
return mmio_readb((void *) addr);
}
static uint16_t internal_chip_readw(const struct flashctx *flash,
const chipaddr addr)
{
return mmio_readw((void *) addr);
}
static uint32_t internal_chip_readl(const struct flashctx *flash,
const chipaddr addr)
{
return mmio_readl((void *) addr);
}
static void internal_chip_readn(const struct flashctx *flash, uint8_t *buf,
const chipaddr addr, size_t len)
{
mmio_readn((void *)addr, buf, len);
return;
}
static const struct par_master par_master_internal = {
.map_flash_region = physmap,
.unmap_flash_region = physunmap,
.chip_readb = internal_chip_readb,
.chip_readw = internal_chip_readw,
.chip_readl = internal_chip_readl,
.chip_readn = internal_chip_readn,
.chip_writeb = internal_chip_writeb,
.chip_writew = internal_chip_writew,
.chip_writel = internal_chip_writel,
};
void internal_par_init(enum chipbustype buses)
{
if (buses & BUS_NONSPI)
register_par_master(&par_master_internal, internal_buses_supported, NULL);
}