blob: 1db04d831109283e51f5d4dec2c6256f53319ef3 [file] [log] [blame]
Martin Roth7b860ed2012-04-28 10:25:20 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2010 Advanced Micro Devices, Inc.
Mike Loptienc93a75a2014-06-06 15:16:29 -06005 * Copyright (C) 2014 Sage Electronic Engineering, LLC.
Martin Roth7b860ed2012-04-28 10:25:20 -06006 *
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 Roth7b860ed2012-04-28 10:25:20 -060015 */
Mike Loptienc93a75a2014-06-06 15:16:29 -060016
Mike Loptienc93a75a2014-06-06 15:16:29 -060017#include <device/pci.h>
Martin Roth7b860ed2012-04-28 10:25:20 -060018#include <arch/io.h>
19#include "cimx_util.h"
Martin Roth7b860ed2012-04-28 10:25:20 -060020
21static 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
27static u8 pmio_read_index(u16 port_base, u8 reg)
28{
29 outb(reg, port_base);
30 return inb(port_base + 1);
31}
32
33void pm_iowrite(u8 reg, u8 value)
34{
35 pmio_write_index(PM_INDEX, reg, value);
36}
37
38u8 pm_ioread(u8 reg)
39{
40 return pmio_read_index(PM_INDEX, reg);
41}
42
43void pm2_iowrite(u8 reg, u8 value)
44{
45 pmio_write_index(PM2_INDEX, reg, value);
46}
47
48u8 pm2_ioread(u8 reg)
49{
50 return pmio_read_index(PM2_INDEX, reg);
51}