blob: c330eaf60af6f3f9549a04fa669f8962ed9663f9 [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);
Nico Huberd81637c2023-01-29 19:45:44 +000034void mmio_readn_aligned(const void *addr, uint8_t *dst, size_t len, size_t align);
Thomas Heijligen3f4d35d2022-01-17 15:11:43 +010035void mmio_le_writeb(uint8_t val, void *addr);
36void mmio_le_writew(uint16_t val, void *addr);
37void mmio_le_writel(uint32_t val, void *addr);
38uint8_t mmio_le_readb(const void *addr);
39uint16_t mmio_le_readw(const void *addr);
40uint32_t mmio_le_readl(const void *addr);
41#define pci_mmio_writeb mmio_le_writeb
42#define pci_mmio_writew mmio_le_writew
43#define pci_mmio_writel mmio_le_writel
44#define pci_mmio_readb mmio_le_readb
45#define pci_mmio_readw mmio_le_readw
46#define pci_mmio_readl mmio_le_readl
47void rmmio_writeb(uint8_t val, void *addr);
48void rmmio_writew(uint16_t val, void *addr);
49void rmmio_writel(uint32_t val, void *addr);
50void rmmio_le_writeb(uint8_t val, void *addr);
51void rmmio_le_writew(uint16_t val, void *addr);
52void rmmio_le_writel(uint32_t val, void *addr);
53#define pci_rmmio_writeb rmmio_le_writeb
54#define pci_rmmio_writew rmmio_le_writew
55#define pci_rmmio_writel rmmio_le_writel
56void rmmio_valb(void *addr);
57void rmmio_valw(void *addr);
58void rmmio_vall(void *addr);
59
Nico Huberd81637c2023-01-29 19:45:44 +000060#endif /* __HWACCESS_PHYSMAP_H__ */