blob: a0a7e74d8e2cfbf2ff36ca5ae6e40b6a450b791f [file] [log] [blame]
Thomas Heijligen74b4aa02021-12-14 17:52:30 +01001/*
2 * This file is part of the flashrom project.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef __HWACCESS_PHYSMAP_H__
15#define __HWACCESS_PHYSMAP_H__
16
17#include <stddef.h>
18#include <stdint.h>
19
20void *physmap(const char *descr, uintptr_t phys_addr, size_t len);
21void *rphysmap(const char *descr, uintptr_t phys_addr, size_t len);
22void *physmap_ro(const char *descr, uintptr_t phys_addr, size_t len);
23void *physmap_ro_unaligned(const char *descr, uintptr_t phys_addr, size_t len);
24void physunmap(void *virt_addr, size_t len);
25void physunmap_unaligned(void *virt_addr, size_t len);
26
Thomas Heijligen3f4d35d2022-01-17 15:11:43 +010027void mmio_writeb(uint8_t val, void *addr);
28void mmio_writew(uint16_t val, void *addr);
29void mmio_writel(uint32_t val, void *addr);
30uint8_t mmio_readb(const void *addr);
31uint16_t mmio_readw(const void *addr);
32uint32_t mmio_readl(const void *addr);
33void mmio_readn(const void *addr, uint8_t *buf, size_t len);
34void mmio_le_writeb(uint8_t val, void *addr);
35void mmio_le_writew(uint16_t val, void *addr);
36void mmio_le_writel(uint32_t val, void *addr);
37uint8_t mmio_le_readb(const void *addr);
38uint16_t mmio_le_readw(const void *addr);
39uint32_t mmio_le_readl(const void *addr);
40#define pci_mmio_writeb mmio_le_writeb
41#define pci_mmio_writew mmio_le_writew
42#define pci_mmio_writel mmio_le_writel
43#define pci_mmio_readb mmio_le_readb
44#define pci_mmio_readw mmio_le_readw
45#define pci_mmio_readl mmio_le_readl
46void rmmio_writeb(uint8_t val, void *addr);
47void rmmio_writew(uint16_t val, void *addr);
48void rmmio_writel(uint32_t val, void *addr);
49void rmmio_le_writeb(uint8_t val, void *addr);
50void rmmio_le_writew(uint16_t val, void *addr);
51void rmmio_le_writel(uint32_t val, void *addr);
52#define pci_rmmio_writeb rmmio_le_writeb
53#define pci_rmmio_writew rmmio_le_writew
54#define pci_rmmio_writel rmmio_le_writel
55void rmmio_valb(void *addr);
56void rmmio_valw(void *addr);
57void rmmio_vall(void *addr);
58
Thomas Heijligen74b4aa02021-12-14 17:52:30 +010059#endif /* __HWACCESS_PHYSMAP_H__ */