6bf76d52b1109f6e3e34de92ee30f27bda99a224
[coreboot.git] / src / southbridge / intel / i82801dbm / i82801dbm_ide.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 "i82801dbm.h"
7
8
9 static void ide_init(struct device *dev)
10 {
11 #if ICH5_SATA_ADDRESS_MAP<=1
12         /* Enable ide devices so the linux ide driver will work */
13         uint16_t word;
14         uint8_t byte;
15         int enable_a=1, enable_b=1;
16
17
18         word = pci_read_config16(dev, 0x40);
19         word &= ~((1 << 15));
20         if (enable_a) {
21                 /* Enable first ide interface */
22                 word |= (1<<15);
23                 printk_debug("IDE0 ");
24         }
25         pci_write_config16(dev, 0x40, word);
26
27         word = pci_read_config16(dev, 0x42);
28         word &= ~((1 << 15));
29         if (enable_b) {
30                 /* Enable secondary ide interface */
31                 word |= (1<<15);
32                 printk_debug("IDE1 ");
33         }
34         pci_write_config16(dev, 0x42, word);
35 #endif
36
37 }
38
39 static struct device_operations ide_ops  = {
40         .read_resources   = pci_dev_read_resources,
41         .set_resources    = pci_dev_set_resources,
42         .enable_resources = pci_dev_enable_resources,
43         .init             = ide_init,
44         .scan_bus         = 0,
45         .enable           = i82801dbm_enable,
46 };
47
48 static struct pci_driver ide_driver __pci_driver = {
49         .ops    = &ide_ops,
50         .vendor = PCI_VENDOR_ID_INTEL,
51         .device = PCI_DEVICE_ID_INTEL_82801ER_1F1,
52 };
53