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>
7 static void ide_init(struct device *dev)
10 /* Enable ide devices so the linux ide driver will work */
12 int enable_a=1, enable_b=1;
15 printk_debug("ide_init\n");
17 word = pci_read_config16(dev, 0x40);
18 /* Ensure prefetch is disabled */
19 word &= ~((1 << 15) | (1 << 13));
21 /* Enable secondary ide interface */
23 printk_debug("IDE1 ");
26 /* Enable primary ide interface */
28 printk_debug("IDE0 ");
34 pci_write_config16(dev, 0x40, word);
37 pci_write_config16(dev, 0x42, word);
39 /* The AMD768 has a bug where the BM DMA address must be
40 * 256 byte aligned while it is only 16 bytes long.
41 * Hard code this to a valid address below 0x1000
42 * where automatic port address assignment starts.
43 * FIXME: I assume the 8111 does the same thing. We should
44 * clarify. stepan@suse.de
46 pci_write_config32(dev, 0x20, 0xf01);
48 pci_write_config32(dev, 0x48, 0x205e5e5e);
50 pci_write_config16(dev, 0x4c, word);
53 static struct device_operations ide_ops = {
54 .read_resources = pci_dev_read_resources,
55 .set_resources = pci_dev_set_resources,
56 .enable_resources = pci_dev_enable_resources,
61 static struct pci_driver ide_driver __pci_driver = {
63 .vendor = PCI_VENDOR_ID_AMD,
64 .device = PCI_DEVICE_ID_AMD_8111_IDE,