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 ide_init(struct device *dev)
10 struct southbridge_amd_amd8111_config *conf;
11 /* Enable ide devices so the linux ide driver will work */
14 conf = dev->chip_info;
16 word = pci_read_config16(dev, 0x40);
17 /* Ensure prefetch is disabled */
18 word &= ~((1 << 15) | (1 << 13));
19 if (conf->ide1_enable) {
20 /* Enable secondary ide interface */
22 printk(BIOS_DEBUG, "IDE1 ");
24 if (conf->ide0_enable) {
25 /* Enable primary ide interface */
27 printk(BIOS_DEBUG, "IDE0 ");
33 pci_write_config16(dev, 0x40, word);
36 byte = 0x20 ; // Latency: 64-->32
37 pci_write_config8(dev, 0xd, byte);
40 pci_write_config16(dev, 0x42, word);
43 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
45 pci_write_config32(dev, 0x70,
46 ((device & 0xffff) << 16) | (vendor & 0xffff));
48 static struct pci_operations lops_pci = {
49 .set_subsystem = lpci_set_subsystem,
51 static struct device_operations ide_ops = {
52 .read_resources = pci_dev_read_resources,
53 .set_resources = pci_dev_set_resources,
54 .enable_resources = pci_dev_enable_resources,
57 .enable = amd8111_enable,
61 static const struct pci_driver ide_driver __pci_driver = {
63 .vendor = PCI_VENDOR_ID_AMD,
64 .device = PCI_DEVICE_ID_AMD_8111_IDE,