1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include <types.h>
20#include <lib.h>
21#include <console.h>
22#include <device/pci.h>
23#include <msr.h>
24#include <legacy.h>
25#include <device/pci_ids.h>
26#include <statictree.h>
27#include <config.h>
28
29static void agp3bridge_init(struct device * dev)
30{
31 u8 byte;
32
33
34
35 byte = pci_read_config32(dev, PCI_COMMAND);
36 byte |= 0x07;
37 pci_write_config8(dev, PCI_COMMAND, byte);
38
39 return;
40}
41
42struct device_operations amd8151_agp3bridge = {
43 .id = {.type = DEVICE_ID_PCI,
44 {.pci = {.vendor = PCI_VENDOR_ID_AMD,
45 .device = PCI_DEVICE_ID_AMD_8151_AGP}}},
46 .constructor = default_device_constructor,
47 .phase3_scan = pci_scan_bridge,
48 .phase4_read_resources = pci_bus_read_resources,
49 .phase4_set_resources = pci_set_resources,
50 .phase5_enable_resources = pci_bus_enable_resources,
51 .phase6_init = agp3bridge_init,
52};
53
54static void agp3dev_enable(struct device * dev)
55{
56 u32 value;
57
58
59 value = pci_read_config32(dev, 0xa8);
60 value |= (3<<8)|2;
61 pci_write_config32(dev, 0xa8, value);
62
63
64 value = pci_read_config32(dev, PCI_COMMAND);
65 value |= 6;
66 pci_write_config32(dev, PCI_COMMAND, value);
67#if 0
68
69
70#endif
71}
72
73static struct pci_operations pci_ops_pci_dev = {
74 .set_subsystem = pci_dev_set_subsystem,
75};
76
77struct device_operations amd8151_agp3dev = {
78 .id = {.type = DEVICE_ID_PCI,
79 {.pci = {.vendor = PCI_VENDOR_ID_AMD,
80 .device = PCI_DEVICE_ID_AMD_8151_SYSCTRL}}},
81 .constructor = default_device_constructor,
82 .phase3_enable = agp3dev_enable,
83 .phase4_read_resources = pci_dev_read_resources,
84 .phase4_set_resources = pci_set_resources,
85 .phase5_enable_resources = pci_dev_enable_resources,
86 .phase6_init = NULL,
87 .ops_pci = &pci_dev_ops_pci,
88};
89