xref: /kvm-unit-tests/lib/asm-generic/pci-host-bridge.h (revision 951e6299b30016bf04a343973296c4274e87f0e2)
1 #ifndef _ASM_GENERIC_PCI_HOST_BRIDGE_H_
2 #define _ASM_GENERIC_PCI_HOST_BRIDGE_H_
3 /*
4  * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com>
5  *
6  * This work is licensed under the terms of the GNU LGPL, version 2.
7  */
8 #include "libcflat.h"
9 
10 phys_addr_t pci_host_bridge_get_paddr(uint64_t addr);
11 
12 static inline
pci_translate_addr(pcidevaddr_t dev __unused,uint64_t addr)13 phys_addr_t pci_translate_addr(pcidevaddr_t dev __unused, uint64_t addr)
14 {
15 	/*
16 	 * Assume we only have single PCI host bridge in a system.
17 	 */
18 	return pci_host_bridge_get_paddr(addr);
19 }
20 
21 uint8_t pci_config_readb(pcidevaddr_t dev, uint8_t reg);
22 uint16_t pci_config_readw(pcidevaddr_t dev, uint8_t reg);
23 uint32_t pci_config_readl(pcidevaddr_t dev, uint8_t reg);
24 void pci_config_writeb(pcidevaddr_t dev, uint8_t reg, uint8_t val);
25 void pci_config_writew(pcidevaddr_t dev, uint8_t reg, uint16_t val);
26 void pci_config_writel(pcidevaddr_t dev, uint8_t reg, uint32_t val);
27 
28 #endif
29