2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
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.
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.
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
20 #include "sandybridge.h"
22 static inline __attribute__ ((always_inline))
23 u8 pcie_read_config8(device_t dev, unsigned int where)
26 addr = DEFAULT_PCIEXBAR | dev | where;
30 static inline __attribute__ ((always_inline))
31 u16 pcie_read_config16(device_t dev, unsigned int where)
34 addr = DEFAULT_PCIEXBAR | dev | where;
38 static inline __attribute__ ((always_inline))
39 u32 pcie_read_config32(device_t dev, unsigned int where)
42 addr = DEFAULT_PCIEXBAR | dev | where;
46 static inline __attribute__ ((always_inline))
47 void pcie_write_config8(device_t dev, unsigned int where, u8 value)
50 addr = DEFAULT_PCIEXBAR | dev | where;
54 static inline __attribute__ ((always_inline))
55 void pcie_write_config16(device_t dev, unsigned int where, u16 value)
58 addr = DEFAULT_PCIEXBAR | dev | where;
62 static inline __attribute__ ((always_inline))
63 void pcie_write_config32(device_t dev, unsigned int where, u32 value)
66 addr = DEFAULT_PCIEXBAR | dev | where;
70 static inline __attribute__ ((always_inline))
71 void pcie_or_config8(device_t dev, unsigned int where, u8 ormask)
73 u8 value = pcie_read_config8(dev, where);
74 pcie_write_config8(dev, where, value | ormask);
77 static inline __attribute__ ((always_inline))
78 void pcie_or_config16(device_t dev, unsigned int where, u16 ormask)
80 u16 value = pcie_read_config16(dev, where);
81 pcie_write_config16(dev, where, value | ormask);
84 static inline __attribute__ ((always_inline))
85 void pcie_or_config32(device_t dev, unsigned int where, u32 ormask)
87 u32 value = pcie_read_config32(dev, where);
88 pcie_write_config32(dev, where, value | ormask);