6e05e9371146249753358cd02a38daa1e4622a97
[coreboot.git] / src / southbridge / broadcom / bcm5785 / bcm5785_reset.c
1 /*
2  * Copyright  2005 AMD
3  *  by yinghai.lu@amd.com
4  */
5
6 #include <arch/io.h>
7 #include <reset.h>
8
9 #define PCI_DEV(BUS, DEV, FN) ( \
10         (((BUS) & 0xFFF) << 20) | \
11         (((DEV) & 0x1F) << 15) | \
12         (((FN)  & 0x7) << 12))
13
14 typedef unsigned device_t;
15
16 static void pci_write_config32(device_t dev, unsigned where, unsigned value)
17 {
18         unsigned addr;
19         addr = (dev>>4) | where;
20         outl(0x80000000 | (addr & ~3), 0xCF8);
21         outl(value, 0xCFC);
22 }
23
24 static unsigned pci_read_config32(device_t dev, unsigned where)
25 {
26         unsigned addr;
27         addr = (dev>>4) | where;
28         outl(0x80000000 | (addr & ~3), 0xCF8);
29         return inl(0xCFC);
30 }
31
32 #include "../../../northbridge/amd/amdk8/reset_test.c"
33
34 void hard_reset(void)
35 {
36         set_bios_reset();
37         /* Try rebooting through port 0xcf9 */
38         /* Actually it is not a real hard_reset --- it only reset coherent link table, but not reset link freq and width */
39         outb((0 <<3)|(0<<2)|(1<<1), 0xcf9);
40         outb((0 <<3)|(1<<2)|(1<<1), 0xcf9);
41 }
42