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