blob: a8f1d3d4ae8d1d18e00441d780d9c4481bdeebe5 [file] [log] [blame]
zbaoea71e812012-08-02 18:36:36 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 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#include <arch/io.h> /*inb, outb*/
21#include "pmio.h"
22
23static void pmio_write_index(u16 port_base, u8 reg, u8 value)
24{
25 outb(reg, port_base);
26 outb(value, port_base + 1);
27}
28
29static u8 pmio_read_index(u16 port_base, u8 reg)
30{
31 outb(reg, port_base);
32 return inb(port_base + 1);
33}
34
35void pm_iowrite(u8 reg, u8 value)
36{
37 pmio_write_index(PM_INDEX, reg, value);
38}
39
40u8 pm_ioread(u8 reg)
41{
42 return pmio_read_index(PM_INDEX, reg);
43}
44
45void pm2_iowrite(u8 reg, u8 value)
46{
47 pmio_write_index(PM2_INDEX, reg, value);
48}
49
50u8 pm2_ioread(u8 reg)
51{
52 return pmio_read_index(PM2_INDEX, reg);
53}