Martin Roth | 7b860ed | 2012-04-28 10:25:20 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2010 Advanced Micro Devices, Inc. |
Mike Loptien | c93a75a | 2014-06-06 15:16:29 -0600 | [diff] [blame] | 5 | * Copyright (C) 2014 Sage Electronic Engineering, LLC. |
Martin Roth | 7b860ed | 2012-04-28 10:25:20 -0600 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 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. |
Martin Roth | 7b860ed | 2012-04-28 10:25:20 -0600 | [diff] [blame] | 15 | */ |
Mike Loptien | c93a75a | 2014-06-06 15:16:29 -0600 | [diff] [blame] | 16 | |
Mike Loptien | c93a75a | 2014-06-06 15:16:29 -0600 | [diff] [blame] | 17 | #include <device/pci.h> |
Martin Roth | 7b860ed | 2012-04-28 10:25:20 -0600 | [diff] [blame] | 18 | #include <arch/io.h> |
| 19 | #include "cimx_util.h" |
Martin Roth | 7b860ed | 2012-04-28 10:25:20 -0600 | [diff] [blame] | 20 | |
| 21 | static void pmio_write_index(u16 port_base, u8 reg, u8 value) |
| 22 | { |
| 23 | outb(reg, port_base); |
| 24 | outb(value, port_base + 1); |
| 25 | } |
| 26 | |
| 27 | static u8 pmio_read_index(u16 port_base, u8 reg) |
| 28 | { |
| 29 | outb(reg, port_base); |
| 30 | return inb(port_base + 1); |
| 31 | } |
| 32 | |
| 33 | void pm_iowrite(u8 reg, u8 value) |
| 34 | { |
| 35 | pmio_write_index(PM_INDEX, reg, value); |
| 36 | } |
| 37 | |
| 38 | u8 pm_ioread(u8 reg) |
| 39 | { |
| 40 | return pmio_read_index(PM_INDEX, reg); |
| 41 | } |
| 42 | |
| 43 | void pm2_iowrite(u8 reg, u8 value) |
| 44 | { |
| 45 | pmio_write_index(PM2_INDEX, reg, value); |
| 46 | } |
| 47 | |
| 48 | u8 pm2_ioread(u8 reg) |
| 49 | { |
| 50 | return pmio_read_index(PM2_INDEX, reg); |
| 51 | } |