Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 4 | #include <device/pci_ops.h> |
Kyösti Mälkki | 8a41f4b | 2019-02-08 18:14:34 +0200 | [diff] [blame] | 5 | #include <device/pci.h> |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 6 | #include <device/pci_def.h> |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 7 | #include <device/pci_ids.h> |
| 8 | #include "i82371eb.h" |
| 9 | |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 10 | void enable_pm(void) |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 11 | { |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 12 | u8 reg8; |
| 13 | u16 reg16; |
| 14 | |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 15 | /* Get the SMBus/PM device of the 82371AB/EB/MB. */ |
Elyes Haouas | 5996eea | 2022-02-15 22:07:22 +0100 | [diff] [blame^] | 16 | const pci_devfn_t dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_INTEL, |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 17 | PCI_DEVICE_ID_INTEL_82371AB_SMB_ACPI), 0); |
| 18 | |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 19 | /* Set the PM I/O base. */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 20 | pci_write_config32(dev, PMBA, DEFAULT_PMBASE | 1); |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 21 | |
| 22 | /* Enable access to the PM I/O space. */ |
| 23 | reg16 = pci_read_config16(dev, PCI_COMMAND); |
| 24 | reg16 |= PCI_COMMAND_IO; |
| 25 | pci_write_config16(dev, PCI_COMMAND, reg16); |
| 26 | |
| 27 | /* PM I/O Space Enable (PMIOSE). */ |
| 28 | reg8 = pci_read_config8(dev, PMREGMISC); |
| 29 | reg8 |= PMIOSE; |
| 30 | pci_write_config8(dev, PMREGMISC, reg8); |
| 31 | } |