2 * This file is part of the coreboot project.
4 * Copyright (C) 2006 AMD
5 * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
6 * Copyright (C) 2007 Silicon Integrated Systems Corp. (SiS)
7 * Written by Morgan Tsai <my_tsai@sis.com> for SiS.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 void sis966_early_pcie_setup(unsigned busnx, unsigned devnx, unsigned anactrl_io_base, unsigned pci_e_x)
31 dev = PCI_DEV(busnx, devnx+1, 1);
32 dword = pci_read_config32(dev, 0xe4);
33 dword |= 0x3f0; // disable it at first
34 pci_write_config32(dev, 0xe4, dword);
37 tgio_ctrl = inl(anactrl_io_base + 0xcc);
40 outl(tgio_ctrl, anactrl_io_base + 0xcc);
41 pll_ctrl = inl(anactrl_io_base + 0x30);
43 outl(pll_ctrl, anactrl_io_base + 0x30);
45 pll_ctrl = inl(anactrl_io_base + 0x30);
46 } while (!(pll_ctrl & 1));
48 tgio_ctrl = inl(anactrl_io_base + 0xcc);
49 tgio_ctrl &= ~((7<<4)|(1<<8));
50 tgio_ctrl |= (pci_e_x<<4)|(1<<8);
51 outl(tgio_ctrl, anactrl_io_base + 0xcc);
56 dword = pci_read_config32(dev, 0xe4);
57 dword &= ~(0x3f0); // enable
58 pci_write_config32(dev, 0xe4, dword);