2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
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
21 #ifndef AMDFAM10_PCI_C
22 #define AMDFAM10_PCI_C
23 /* bit [10,8] are dev func, bit[1,0] are dev index */
26 static u32 pci_read_config32_index(device_t dev, u32 index_reg, u32 index)
30 pci_write_config32(dev, index_reg, index);
31 dword = pci_read_config32(dev, index_reg+0x4);
35 static void pci_write_config32_index(device_t dev, u32 index_reg, u32 index, u32 data)
38 pci_write_config32(dev, index_reg, index);
40 pci_write_config32(dev, index_reg + 0x4, data);
44 static u32 pci_read_config32_index_wait(device_t dev, u32 index_reg, u32 index)
50 pci_write_config32(dev, index_reg, index);
52 dword = pci_read_config32(dev, index_reg);
53 } while (!(dword & (1<<31)));
54 dword = pci_read_config32(dev, index_reg+0x4);
58 static void pci_write_config32_index_wait(device_t dev, u32 index_reg, u32 index, u32 data)
63 pci_write_config32(dev, index_reg + 0x4, data);
65 pci_write_config32(dev, index_reg, index);
67 dword = pci_read_config32(dev, index_reg);
68 } while (!(dword & (1<<31)));