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);
36 static void pci_write_config32_index(device_t dev, u32 index_reg, u32 index, u32 data)
39 pci_write_config32(dev, index_reg, index);
41 pci_write_config32(dev, index_reg + 0x4, data);
46 static u32 pci_read_config32_index_wait(device_t dev, u32 index_reg, u32 index)
52 pci_write_config32(dev, index_reg, index);
54 dword = pci_read_config32(dev, index_reg);
55 } while (!(dword & (1<<31)));
56 dword = pci_read_config32(dev, index_reg+0x4);
61 static void pci_write_config32_index_wait(device_t dev, u32 index_reg, u32 index, u32 data)
66 pci_write_config32(dev, index_reg + 0x4, data);
68 pci_write_config32(dev, index_reg, index);
70 dword = pci_read_config32(dev, index_reg);
71 } while (!(dword & (1<<31)));