blob: 8ac3898941636909f88938d5386fb62571c9df47 [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
17#include <console/console.h>
18#include <device/pci.h>
Martin Roth7b860ed2012-04-28 10:25:20 -060019#include <arch/io.h>
20#include "cimx_util.h"
Martin Roth7b860ed2012-04-28 10:25:20 -060021
22static void pmio_write_index(u16 port_base, u8 reg, u8 value)
23{
24 outb(reg, port_base);
25 outb(value, port_base + 1);
26}
27
28static u8 pmio_read_index(u16 port_base, u8 reg)
29{
30 outb(reg, port_base);
31 return inb(port_base + 1);
32}
33
34void pm_iowrite(u8 reg, u8 value)
35{
36 pmio_write_index(PM_INDEX, reg, value);
37}
38
39u8 pm_ioread(u8 reg)
40{
41 return pmio_read_index(PM_INDEX, reg);
42}
43
44void pm2_iowrite(u8 reg, u8 value)
45{
46 pmio_write_index(PM2_INDEX, reg, value);
47}
48
49u8 pm2_ioread(u8 reg)
50{
51 return pmio_read_index(PM2_INDEX, reg);
52}