Thomas Heijligen | 74b4aa0 | 2021-12-14 17:52:30 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | void *physmap(const char *descr, uintptr_t phys_addr, size_t len); |
| 21 | void *rphysmap(const char *descr, uintptr_t phys_addr, size_t len); |
| 22 | void *physmap_ro(const char *descr, uintptr_t phys_addr, size_t len); |
| 23 | void *physmap_ro_unaligned(const char *descr, uintptr_t phys_addr, size_t len); |
| 24 | void physunmap(void *virt_addr, size_t len); |
| 25 | void physunmap_unaligned(void *virt_addr, size_t len); |
| 26 | |
Thomas Heijligen | 3f4d35d | 2022-01-17 15:11:43 +0100 | [diff] [blame] | 27 | void mmio_writeb(uint8_t val, void *addr); |
| 28 | void mmio_writew(uint16_t val, void *addr); |
| 29 | void mmio_writel(uint32_t val, void *addr); |
| 30 | uint8_t mmio_readb(const void *addr); |
| 31 | uint16_t mmio_readw(const void *addr); |
| 32 | uint32_t mmio_readl(const void *addr); |
| 33 | void mmio_readn(const void *addr, uint8_t *buf, size_t len); |
| 34 | void mmio_le_writeb(uint8_t val, void *addr); |
| 35 | void mmio_le_writew(uint16_t val, void *addr); |
| 36 | void mmio_le_writel(uint32_t val, void *addr); |
| 37 | uint8_t mmio_le_readb(const void *addr); |
| 38 | uint16_t mmio_le_readw(const void *addr); |
| 39 | uint32_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 |
| 46 | void rmmio_writeb(uint8_t val, void *addr); |
| 47 | void rmmio_writew(uint16_t val, void *addr); |
| 48 | void rmmio_writel(uint32_t val, void *addr); |
| 49 | void rmmio_le_writeb(uint8_t val, void *addr); |
| 50 | void rmmio_le_writew(uint16_t val, void *addr); |
| 51 | void 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 |
| 55 | void rmmio_valb(void *addr); |
| 56 | void rmmio_valw(void *addr); |
| 57 | void rmmio_vall(void *addr); |
| 58 | |
Thomas Heijligen | 74b4aa0 | 2021-12-14 17:52:30 +0100 | [diff] [blame] | 59 | #endif /* __HWACCESS_PHYSMAP_H__ */ |