Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 1 | /* |
| 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. |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <stdint.h> |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 18 | #include <arch/io.h> |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 19 | #include <device/pci_def.h> |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 20 | #include <device/pci_ids.h> |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 21 | #include <console/console.h> |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 22 | #include "i82371eb.h" |
| 23 | |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 24 | void enable_pm(void) |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 25 | { |
| 26 | device_t dev; |
| 27 | u8 reg8; |
| 28 | u16 reg16; |
| 29 | |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 30 | /* Get the SMBus/PM device of the 82371AB/EB/MB. */ |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 31 | dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_INTEL, |
| 32 | PCI_DEVICE_ID_INTEL_82371AB_SMB_ACPI), 0); |
| 33 | |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 34 | /* Set the PM I/O base. */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 35 | pci_write_config32(dev, PMBA, DEFAULT_PMBASE | 1); |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 36 | |
| 37 | /* Enable access to the PM I/O space. */ |
| 38 | reg16 = pci_read_config16(dev, PCI_COMMAND); |
| 39 | reg16 |= PCI_COMMAND_IO; |
| 40 | pci_write_config16(dev, PCI_COMMAND, reg16); |
| 41 | |
| 42 | /* PM I/O Space Enable (PMIOSE). */ |
| 43 | reg8 = pci_read_config8(dev, PMREGMISC); |
| 44 | reg8 |= PMIOSE; |
| 45 | pci_write_config8(dev, PMREGMISC, reg8); |
| 46 | } |