16a185cad9bbedd0d7f81cc030944af2a354131b
[coreboot.git] / src / southbridge / nvidia / ck804 / ck804_reset.c
1 /*
2  * Copyright 2004 Tyan Computer
3  *  by yhlu@tyan.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         outb((0 << 3) | (0 << 2) | (1 << 1), 0xcf9);
38         outb((0 << 3) | (1 << 2) | (1 << 1), 0xcf9);
39 }