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>
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");
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");
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
,
51 .enable
= i82801dx_enable
,
55 static const struct pci_driver i82801db_ide __pci_driver
= {
57 .vendor
= PCI_VID_INTEL
,
62 static const struct pci_driver i82801dbm_ide __pci_driver
= {
64 .vendor
= PCI_VID_INTEL
,