mb/google/nissa/var/rull: Add 6W and 15W DPTF parameters
[coreboot2.git] / src / southbridge / intel / i82801dx / ide.c
blobc439ffeb1ee644191c9f2daef3ab94a51b81df5b
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pci.h>
6 #include <device/pci_ids.h>
7 #include <device/pci_ops.h>
8 #include <stdint.h>
10 #include "chip.h"
11 #include "i82801dx.h"
13 typedef struct southbridge_intel_i82801dx_config config_t;
15 static void ide_init(struct device *dev)
17 /* Get the chip configuration */
18 config_t *config = dev->chip_info;
20 /* Enable IDE devices so the Linux IDE driver will work. */
21 uint16_t ideTimingConfig;
23 ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
24 ideTimingConfig &= ~IDE_DECODE_ENABLE;
25 if (!config || config->ide0_enable) {
26 /* Enable primary IDE interface. */
27 ideTimingConfig |= IDE_DECODE_ENABLE;
28 printk(BIOS_DEBUG, "IDE0: Primary IDE interface is enabled\n");
29 } else {
30 printk(BIOS_INFO, "IDE0: Primary IDE interface is disabled\n");
32 pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
34 ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
35 ideTimingConfig &= ~IDE_DECODE_ENABLE;
36 if (!config || config->ide1_enable) {
37 /* Enable secondary IDE interface. */
38 ideTimingConfig |= IDE_DECODE_ENABLE;
39 printk(BIOS_DEBUG, "IDE1: Secondary IDE interface is enabled\n");
40 } else {
41 printk(BIOS_INFO, "IDE1: Secondary IDE interface is disabled\n");
43 pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
46 static struct device_operations ide_ops = {
47 .read_resources = pci_dev_read_resources,
48 .set_resources = pci_dev_set_resources,
49 .enable_resources = pci_dev_enable_resources,
50 .init = ide_init,
51 .enable = i82801dx_enable,
54 /* 82801DB */
55 static const struct pci_driver i82801db_ide __pci_driver = {
56 .ops = &ide_ops,
57 .vendor = PCI_VID_INTEL,
58 .device = 0x24cb,
61 /* 82801DBM */
62 static const struct pci_driver i82801dbm_ide __pci_driver = {
63 .ops = &ide_ops,
64 .vendor = PCI_VID_INTEL,
65 .device = 0x24ca,