90a41680f60fb37a46c4a3296237db73c4cec5c2
[coreboot.git] / src / southbridge / broadcom / bcm5785 / bcm5785_ide.c
1 /*
2  * Copyright  2005 AMD
3  *  by yinghai.lu@amd.com
4  */
5
6 #include <console/console.h>
7 #include <device/device.h>
8 #include <device/pci.h>
9 #include <device/pci_ids.h>
10 #include <device/pci_ops.h>
11 #include "bcm5785.h"
12
13 static void bcm5785_ide_read_resources(device_t dev)
14 {
15         /* Get the normal pci resources of this device */
16         pci_dev_read_resources(dev);
17
18         /* BAR */
19         pci_get_resource(dev, 0x64);
20
21         compact_resources(dev);
22 }
23
24 static void ide_init(struct device *dev)
25 {
26 }
27
28 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
29 {
30         pci_write_config32(dev, 0x40,
31                 ((device & 0xffff) << 16) | (vendor & 0xffff));
32 }
33
34 static struct pci_operations lops_pci = {
35         .set_subsystem = lpci_set_subsystem,
36 };
37
38 static struct device_operations ide_ops  = {
39         .read_resources   = bcm5785_ide_read_resources,
40         .set_resources    = pci_dev_set_resources,
41         .enable_resources = pci_dev_enable_resources,
42         .init             = ide_init,
43         .scan_bus         = 0,
44 //      .enable           = bcm5785_enable,
45         .ops_pci          = &lops_pci,
46 };
47
48 static const struct pci_driver ide_driver __pci_driver = {
49         .ops    = &ide_ops,
50         .vendor = PCI_VENDOR_ID_SERVERWORKS,
51         .device = PCI_DEVICE_ID_SERVERWORKS_BCM5785_IDE,
52 };
53