blob: a2f055bca700b1d4b44dedac542f8e579241eee3 [file] [log] [blame]
Uwe Hermann0865b4d2010-09-19 21:12:05 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Uwe Hermann0865b4d2010-09-19 21:12:05 +000019 */
20
21#include <stdint.h>
Uwe Hermann115c5b92010-10-09 17:00:18 +000022#include <arch/io.h>
Uwe Hermann115c5b92010-10-09 17:00:18 +000023#include <device/pci_def.h>
Uwe Hermann0865b4d2010-09-19 21:12:05 +000024#include <device/pci_ids.h>
Uwe Hermann115c5b92010-10-09 17:00:18 +000025#include <console/console.h>
Uwe Hermann0865b4d2010-09-19 21:12:05 +000026#include "i82371eb.h"
27
Uwe Hermann115c5b92010-10-09 17:00:18 +000028void enable_pm(void)
Uwe Hermann0865b4d2010-09-19 21:12:05 +000029{
30 device_t dev;
31 u8 reg8;
32 u16 reg16;
33
Uwe Hermann115c5b92010-10-09 17:00:18 +000034 /* Get the SMBus/PM device of the 82371AB/EB/MB. */
Uwe Hermann0865b4d2010-09-19 21:12:05 +000035 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_INTEL,
36 PCI_DEVICE_ID_INTEL_82371AB_SMB_ACPI), 0);
37
Uwe Hermann0865b4d2010-09-19 21:12:05 +000038 /* Set the PM I/O base. */
Tobias Diedriche87c38e2010-11-27 09:40:16 +000039 pci_write_config32(dev, PMBA, DEFAULT_PMBASE | 1);
Uwe Hermann0865b4d2010-09-19 21:12:05 +000040
41 /* Enable access to the PM I/O space. */
42 reg16 = pci_read_config16(dev, PCI_COMMAND);
43 reg16 |= PCI_COMMAND_IO;
44 pci_write_config16(dev, PCI_COMMAND, reg16);
45
46 /* PM I/O Space Enable (PMIOSE). */
47 reg8 = pci_read_config8(dev, PMREGMISC);
48 reg8 |= PMIOSE;
49 pci_write_config8(dev, PMREGMISC, reg8);
50}