2 * This file is part of the coreboot project.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <console/console.h>
20 #include <device/device.h>
21 #include <device/pci.h>
22 #include <device/pci_ids.h>
23 #include <device/pci_ops.h>
26 static void ide_init(struct device *dev)
28 /* Enable IDE devices and timmings */
31 pci_write_config16(dev, 0x40, 0x8000);
33 pci_write_config16(dev, 0x40, 0xa307);
34 pci_write_config16(dev, 0x42, 0xa307);
35 pci_write_config8(dev, 0x48, 0x05);
36 pci_write_config16(dev, 0x4a, 0x0101);
37 pci_write_config16(dev, 0x54, 0x5055);
41 byte = pci_read_config8(dev, 0x09);
43 pci_write_config8(dev, 0x09, byte);
45 /* force irq into compat mode
46 pci_write_config32(dev, 0x10, 0x0);
47 pci_write_config32(dev, 0x14, 0x0);
48 pci_write_config32(dev, 0x18, 0x0);
49 pci_write_config32(dev, 0x1c, 0x0);
52 pci_write_config8(dev, 0x3d, 00);
54 pci_write_config8(dev, 0x3c, 0xff);
58 printk_debug("IDE Enabled\n");
61 static struct device_operations ide_ops = {
62 .read_resources = pci_dev_read_resources,
63 .set_resources = pci_dev_set_resources,
64 .enable_resources = pci_dev_enable_resources,
70 static const struct pci_driver ide_driver __pci_driver = {
72 .vendor = PCI_VENDOR_ID_INTEL,
73 .device = PCI_DEVICE_ID_INTEL_82801DB_IDE,