Patrick Georgi | 02363b5 | 2020-05-05 20:48:50 +0200 | [diff] [blame] | 1 | /* This file is part of the coreboot project. */ |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 2 | /* |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #include <stdint.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 16 | #include <device/pci_ops.h> |
Kyösti Mälkki | 8a41f4b | 2019-02-08 18:14:34 +0200 | [diff] [blame] | 17 | #include <device/pci.h> |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 18 | #include <device/pci_def.h> |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 19 | #include <device/pci_ids.h> |
| 20 | #include "i82371eb.h" |
| 21 | |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 22 | void enable_pm(void) |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 23 | { |
Antonello Dettori | f068a73 | 2016-09-03 10:45:33 +0200 | [diff] [blame] | 24 | pci_devfn_t dev; |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 25 | u8 reg8; |
| 26 | u16 reg16; |
| 27 | |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 28 | /* Get the SMBus/PM device of the 82371AB/EB/MB. */ |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 29 | dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_INTEL, |
| 30 | PCI_DEVICE_ID_INTEL_82371AB_SMB_ACPI), 0); |
| 31 | |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 32 | /* Set the PM I/O base. */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 33 | pci_write_config32(dev, PMBA, DEFAULT_PMBASE | 1); |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 34 | |
| 35 | /* Enable access to the PM I/O space. */ |
| 36 | reg16 = pci_read_config16(dev, PCI_COMMAND); |
| 37 | reg16 |= PCI_COMMAND_IO; |
| 38 | pci_write_config16(dev, PCI_COMMAND, reg16); |
| 39 | |
| 40 | /* PM I/O Space Enable (PMIOSE). */ |
| 41 | reg8 = pci_read_config8(dev, PMREGMISC); |
| 42 | reg8 |= PMIOSE; |
| 43 | pci_write_config8(dev, PMREGMISC, reg8); |
| 44 | } |