blob: baded54ba6931b5f9be8e3f0ee7244839b8ec467 [file] [log] [blame]
efdesign98770b8772011-06-20 21:48:37 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
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; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20
21#include <arch/io.h> /*inb, outb*/
22#include "pmio.h"
23
24static void pmio_write_index(u16 port_base, u8 reg, u8 value)
25{
26 outb(reg, port_base);
27 outb(value, port_base + 1);
28}
29
30static u8 pmio_read_index(u16 port_base, u8 reg)
31{
32 outb(reg, port_base);
33 return inb(port_base + 1);
34}
35
36void pm_iowrite(u8 reg, u8 value)
37{
38 pmio_write_index(PM_INDEX, reg, value);
39}
40
41u8 pm_ioread(u8 reg)
42{
43 return pmio_read_index(PM_INDEX, reg);
44}
45
46void pm2_iowrite(u8 reg, u8 value)
47{
48 pmio_write_index(PM2_INDEX, reg, value);
49}
50
51u8 pm2_ioread(u8 reg)
52{
53 return pmio_read_index(PM2_INDEX, reg);
54}
55