Add more missing GPL-headers, fix inconsistencies in others.
[coreboot.git] / src / southbridge / broadcom / bcm5785 / bcm5785_reset.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2005 AMD
5  * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19  */
20
21 #include <arch/io.h>
22 #include <reset.h>
23
24 #define PCI_DEV(BUS, DEV, FN) ( \
25         (((BUS) & 0xFFF) << 20) | \
26         (((DEV) & 0x1F) << 15) | \
27         (((FN)  & 0x7) << 12))
28
29 typedef unsigned device_t;
30
31 static void pci_write_config32(device_t dev, unsigned where, unsigned value)
32 {
33         unsigned addr;
34         addr = (dev>>4) | where;
35         outl(0x80000000 | (addr & ~3), 0xCF8);
36         outl(value, 0xCFC);
37 }
38
39 static unsigned pci_read_config32(device_t dev, unsigned where)
40 {
41         unsigned addr;
42         addr = (dev>>4) | where;
43         outl(0x80000000 | (addr & ~3), 0xCF8);
44         return inl(0xCFC);
45 }
46
47 #include "../../../northbridge/amd/amdk8/reset_test.c"
48
49 void hard_reset(void)
50 {
51         set_bios_reset();
52         /* Try rebooting through port 0xcf9 */
53         /* Actually it is not a real hard_reset --- it only reset coherent link table, but not reset link freq and width */
54         outb((0 <<3)|(0<<2)|(1<<1), 0xcf9);
55         outb((0 <<3)|(1<<2)|(1<<1), 0xcf9);
56 }