Move MMCONF resource into the domain for fam10 for the resource allocator.
[coreboot.git] / src / southbridge / intel / esb6300 / esb6300_sata.c
1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/pci.h>
4 #include <device/pci_ids.h>
5 #include <device/pci_ops.h>
6 #include "esb6300.h"
7
8 static void sata_init(struct device *dev)
9 {
10         /* Enable sata devices so the linux sata driver will work */
11
12         /* Enable SATA devices */
13
14         printk(BIOS_DEBUG, "SATA init\n");
15         /* SATA configuration */
16         pci_write_config8(dev, 0x04, 0x07);
17         pci_write_config8(dev, 0x09, 0x8f);
18
19         /* Set timmings */
20         pci_write_config16(dev, 0x40, 0x0a307);
21         pci_write_config16(dev, 0x42, 0x0a307);
22
23         /* Sync DMA */
24         pci_write_config16(dev, 0x48, 0x000f);
25         pci_write_config16(dev, 0x4a, 0x1111);
26
27         /* 66 mhz */
28         pci_write_config16(dev, 0x54, 0xf00f);
29
30         /* Combine ide - sata configuration */
31         pci_write_config8(dev, 0x90, 0x0);
32
33         /* port 0 & 1 enable */
34         pci_write_config8(dev, 0x92, 0x33);
35
36         /* initialize SATA  */
37         pci_write_config16(dev, 0xa0, 0x0018);
38         pci_write_config32(dev, 0xa4, 0x00000264);
39         pci_write_config16(dev, 0xa0, 0x0040);
40         pci_write_config32(dev, 0xa4, 0x00220043);
41
42         printk(BIOS_DEBUG, "SATA Enabled\n");
43 }
44
45 static void esb6300_sata_set_subsystem(device_t dev, unsigned vendor, unsigned device)
46 {
47         /* This value is also visible in usb1, usb2 and smbus functions */
48         pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
49                 ((device & 0xffff) << 16) | (vendor & 0xffff));
50 }
51
52 static struct pci_operations lops_pci = {
53         .set_subsystem = esb6300_sata_set_subsystem,
54 };
55 static struct device_operations sata_ops  = {
56         .read_resources   = pci_dev_read_resources,
57         .set_resources    = pci_dev_set_resources,
58         .enable_resources = pci_dev_enable_resources,
59         .init             = sata_init,
60         .scan_bus         = 0,
61         .ops_pci          = &lops_pci,
62 };
63
64 static const struct pci_driver sata_driver __pci_driver = {
65         .ops    = &sata_ops,
66         .vendor = PCI_VENDOR_ID_INTEL,
67         .device = PCI_DEVICE_ID_INTEL_6300ESB_SATA,
68 };
69
70 static const struct pci_driver sata_driver_nr __pci_driver = {
71         .ops    = &sata_ops,
72         .vendor = PCI_VENDOR_ID_INTEL,
73         .device = PCI_DEVICE_ID_INTEL_6300ESB_SATA_RAID,
74 };
75