1 /* Copyright 2003-2004 Tyan Computer*/
3 /* Author: Yinghai Lu yhlu@tyan.com
13 #include <console/console.h>
14 #include <device/device.h>
15 #include <device/pci.h>
16 #include <device/pci_ids.h>
17 #include <device/pci_ops.h>
20 static void si_sata_init(struct device *dev)
25 word = pci_read_config16(dev, 0x4);
26 word |= ((1 << 2) |(1<<4)); // Command: 3--> 17
27 pci_write_config16(dev, 0x4, word);
30 /* some driver change class code to 0x104, but not change deviceid without reason*/
31 /* restore it so we don't need to unplug AC power to restore it*/
33 word = pci_read_config16(dev, 0x0a);
35 /* enble change device id and class id*/
36 dword = pci_read_config32(dev,0x40);
38 pci_write_config32(dev, 0x40, dword);
41 pci_write_config16(dev, 0x0a, word);
43 /* disable change device id and class id*/
44 dword = pci_read_config32(dev,0x40);
46 pci_write_config32(dev, 0x40, dword);
48 printk(BIOS_DEBUG, "Class code restored.\n");
54 static struct device_operations si_sata_ops = {
55 .read_resources = pci_dev_read_resources,
56 .set_resources = pci_dev_set_resources,
57 .enable_resources = pci_dev_enable_resources,
62 static const struct pci_driver si_sata_driver __pci_driver = {