2 * This file is part of the coreboot project.
4 * Copyright (C) 2005 Tyan Computer
5 * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <console/console.h>
23 #include <device/device.h>
24 #include <device/pci.h>
25 #include <device/pci_ids.h>
28 /* TODO: Set dynamically, if the user only wants one SATA channel or none
31 static void sata_init(struct device *dev)
33 /* SATA configuration */
34 pci_write_config8(dev, 0x04, 0x07);
35 pci_write_config8(dev, 0x09, 0x8f);
38 pci_write_config16(dev, 0x40, 0x0a307);
39 pci_write_config16(dev, 0x42, 0x0a307);
42 pci_write_config16(dev, 0x48, 0x000f);
43 pci_write_config16(dev, 0x4a, 0x1111);
46 pci_write_config16(dev, 0x54, 0xf00f);
48 /* Combine IDE - SATA configuration */
49 pci_write_config8(dev, 0x90, 0x0);
51 /* Port 0 & 1 enable */
52 pci_write_config8(dev, 0x92, 0x33);
54 /* Initialize SATA. */
55 pci_write_config16(dev, 0xa0, 0x0018);
56 pci_write_config32(dev, 0xa4, 0x00000264);
57 pci_write_config16(dev, 0xa0, 0x0040);
58 pci_write_config32(dev, 0xa4, 0x00220043);
61 static struct device_operations sata_ops = {
62 .read_resources = pci_dev_read_resources,
63 .set_resources = pci_dev_set_resources,
64 .enable_resources = pci_dev_enable_resources,
67 .enable = i82801bx_enable,
71 static const struct pci_driver i82801eb_sata_driver __pci_driver = {
73 .vendor = PCI_VENDOR_ID_INTEL,
78 static const struct pci_driver i82801er_sata_driver __pci_driver = {
80 .vendor = PCI_VENDOR_ID_INTEL,