blob: 3cf56f258ec1c7a8da237114f426b2247f4ea4f8 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Uwe Hermann0865b4d2010-09-19 21:12:05 +00002
3#include <stdint.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02004#include <device/pci_ops.h>
Kyösti Mälkki8a41f4b2019-02-08 18:14:34 +02005#include <device/pci.h>
Uwe Hermann0865b4d2010-09-19 21:12:05 +00006#include <device/pci_ids.h>
7#include "i82371eb.h"
8
Uwe Hermann115c5b92010-10-09 17:00:18 +00009void enable_pm(void)
Uwe Hermann0865b4d2010-09-19 21:12:05 +000010{
Uwe Hermann0865b4d2010-09-19 21:12:05 +000011 u8 reg8;
12 u16 reg16;
13
Uwe Hermann115c5b92010-10-09 17:00:18 +000014 /* Get the SMBus/PM device of the 82371AB/EB/MB. */
Felix Singer43b7f412022-03-07 04:34:52 +010015 const pci_devfn_t dev = pci_locate_device(PCI_ID(PCI_VID_INTEL,
16 PCI_DID_INTEL_82371AB_SMB_ACPI), 0);
Uwe Hermann0865b4d2010-09-19 21:12:05 +000017
Uwe Hermann0865b4d2010-09-19 21:12:05 +000018 /* Set the PM I/O base. */
Tobias Diedriche87c38e2010-11-27 09:40:16 +000019 pci_write_config32(dev, PMBA, DEFAULT_PMBASE | 1);
Uwe Hermann0865b4d2010-09-19 21:12:05 +000020
21 /* Enable access to the PM I/O space. */
22 reg16 = pci_read_config16(dev, PCI_COMMAND);
23 reg16 |= PCI_COMMAND_IO;
24 pci_write_config16(dev, PCI_COMMAND, reg16);
25
26 /* PM I/O Space Enable (PMIOSE). */
27 reg8 = pci_read_config8(dev, PMREGMISC);
28 reg8 |= PMIOSE;
29 pci_write_config8(dev, PMREGMISC, reg8);
30}