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>
8 static void sata_init(struct device *dev)
10 /* Enable sata devices so the linux sata driver will work */
12 /* Enable SATA devices */
14 printk(BIOS_DEBUG, "SATA init\n");
15 /* SATA configuration */
16 pci_write_config8(dev, 0x04, 0x07);
17 pci_write_config8(dev, 0x09, 0x8f);
20 pci_write_config16(dev, 0x40, 0x0a307);
21 pci_write_config16(dev, 0x42, 0x0a307);
24 pci_write_config16(dev, 0x48, 0x000f);
25 pci_write_config16(dev, 0x4a, 0x1111);
28 pci_write_config16(dev, 0x54, 0xf00f);
30 /* Combine ide - sata configuration */
31 pci_write_config8(dev, 0x90, 0x0);
33 /* port 0 & 1 enable */
34 pci_write_config8(dev, 0x92, 0x33);
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);
42 printk(BIOS_DEBUG, "SATA Enabled\n");
45 static void esb6300_sata_set_subsystem(device_t dev, unsigned vendor, unsigned device)
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));
52 static struct pci_operations lops_pci = {
53 .set_subsystem = esb6300_sata_set_subsystem,
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,
64 static const struct pci_driver sata_driver __pci_driver = {
66 .vendor = PCI_VENDOR_ID_INTEL,
67 .device = PCI_DEVICE_ID_INTEL_6300ESB_SATA,
70 static const struct pci_driver sata_driver_nr __pci_driver = {
72 .vendor = PCI_VENDOR_ID_INTEL,
73 .device = PCI_DEVICE_ID_INTEL_6300ESB_SATA_RAID,