printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / southbridge / intel / esb6300 / esb6300_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 "esb6300.h"
7
8 static void ide_init(struct device *dev)
9 {
10
11         /* Enable ide devices so the linux ide driver will work */
12         uint16_t word;
13
14         /* Enable IDE devices */
15         pci_write_config16(dev, 0x40, 0x0a307);
16         pci_write_config16(dev, 0x42, 0x0a307);
17         pci_write_config8(dev, 0x48, 0x05);
18         pci_write_config16(dev, 0x4a, 0x0101);
19         pci_write_config16(dev, 0x54, 0x5055);
20  
21 #if 0
22         word = pci_read_config16(dev, 0x40);
23         word |= (1 << 15);
24         pci_write_config16(dev, 0x40, word);
25         word = pci_read_config16(dev, 0x42);
26         word |= (1 << 15);
27         pci_write_config16(dev, 0x42, word);
28 #endif
29         printk(BIOS_DEBUG, "IDE Enabled\n");
30 }
31
32 static void esb6300_ide_set_subsystem(device_t dev, unsigned vendor, unsigned device)
33 {
34         /* This value is also visible in uchi[0-2] and smbus functions */
35         pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, 
36                 ((device & 0xffff) << 16) | (vendor & 0xffff));
37 }
38
39 static struct pci_operations lops_pci = {
40         .set_subsystem = esb6300_ide_set_subsystem,
41 };
42 static struct device_operations ide_ops  = {
43         .read_resources   = pci_dev_read_resources,
44         .set_resources    = pci_dev_set_resources,
45         .enable_resources = pci_dev_enable_resources,
46         .init             = ide_init,
47         .scan_bus         = 0,
48         .ops_pci          = &lops_pci,
49 };
50
51 static const struct pci_driver ide_driver __pci_driver = {
52         .ops    = &ide_ops,
53         .vendor = PCI_VENDOR_ID_INTEL,
54         .device = PCI_DEVICE_ID_INTEL_6300ESB_IDE,
55 };
56