blob: 5cc46a7cbd150d74338e1b1a1e85260e0b5e9b49 [file] [log] [blame]
Patrick Georgibe61a172010-12-18 07:48:43 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20static inline __attribute__ ((always_inline))
21u8 pcie_read_config8(device_t dev, unsigned int where)
22{
23 unsigned long addr;
24 addr = DEFAULT_PCIEXBAR | dev | where;
25 return read8(addr);
26}
27
28static inline __attribute__ ((always_inline))
29u16 pcie_read_config16(device_t dev, unsigned int where)
30{
31 unsigned long addr;
32 addr = DEFAULT_PCIEXBAR | dev | where;
33 return read16(addr);
34}
35
36static inline __attribute__ ((always_inline))
37u32 pcie_read_config32(device_t dev, unsigned int where)
38{
39 unsigned long addr;
40 addr = DEFAULT_PCIEXBAR | dev | where;
41 return read32(addr);
42}
43
44static inline __attribute__ ((always_inline))
45void pcie_write_config8(device_t dev, unsigned int where, u8 value)
46{
47 unsigned long addr;
48 addr = DEFAULT_PCIEXBAR | dev | where;
49 write8(addr, value);
50}
51
52static inline __attribute__ ((always_inline))
53void pcie_write_config16(device_t dev, unsigned int where, u16 value)
54{
55 unsigned long addr;
56 addr = DEFAULT_PCIEXBAR | dev | where;
57 write16(addr, value);
58}
59
60static inline __attribute__ ((always_inline))
61void pcie_write_config32(device_t dev, unsigned int where, u32 value)
62{
63 unsigned long addr;
64 addr = DEFAULT_PCIEXBAR | dev | where;
65 write32(addr, value);
66}