libpayload: Add Timer for sdm845
[coreboot.git] / src / superio / common / conf_mode.c
blobcbe1a9efb7a82d99cee3c6be3abec635a40f0a2d
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2013 Nico Huber <nico.h@gmx.de>
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.
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.
16 #include <arch/io.h>
17 #include <device/device.h>
18 #include <superio/conf_mode.h>
20 /* Common enter/exit implementations */
22 void pnp_enter_conf_mode_55(struct device *dev)
24 outb(0x55, dev->path.pnp.port);
27 void pnp_enter_conf_mode_6767(struct device *dev)
29 outb(0x67, dev->path.pnp.port);
30 outb(0x67, dev->path.pnp.port);
33 void pnp_enter_conf_mode_7777(struct device *dev)
35 outb(0x77, dev->path.pnp.port);
36 outb(0x77, dev->path.pnp.port);
39 void pnp_enter_conf_mode_8787(struct device *dev)
41 outb(0x87, dev->path.pnp.port);
42 outb(0x87, dev->path.pnp.port);
45 void pnp_enter_conf_mode_a0a0(struct device *dev)
47 outb(0xa0, dev->path.pnp.port);
48 outb(0xa0, dev->path.pnp.port);
51 void pnp_exit_conf_mode_aa(struct device *dev)
53 outb(0xaa, dev->path.pnp.port);
56 void pnp_enter_conf_mode_870155aa(struct device *dev)
58 outb(0x87, dev->path.pnp.port);
59 outb(0x01, dev->path.pnp.port);
60 outb(0x55, dev->path.pnp.port);
62 if (dev->path.pnp.port == 0x4e)
63 outb(0xaa, dev->path.pnp.port);
64 else
65 outb(0x55, dev->path.pnp.port);
68 void pnp_exit_conf_mode_0202(struct device *dev)
70 outb(0x02, dev->path.pnp.port);
71 outb(0x02, dev->path.pnp.port + 1);
75 const struct pnp_mode_ops pnp_conf_mode_55_aa = {
76 .enter_conf_mode = pnp_enter_conf_mode_55,
77 .exit_conf_mode = pnp_exit_conf_mode_aa,
80 const struct pnp_mode_ops pnp_conf_mode_6767_aa = {
81 .enter_conf_mode = pnp_enter_conf_mode_6767,
82 .exit_conf_mode = pnp_exit_conf_mode_aa,
85 const struct pnp_mode_ops pnp_conf_mode_7777_aa = {
86 .enter_conf_mode = pnp_enter_conf_mode_7777,
87 .exit_conf_mode = pnp_exit_conf_mode_aa,
90 const struct pnp_mode_ops pnp_conf_mode_8787_aa = {
91 .enter_conf_mode = pnp_enter_conf_mode_8787,
92 .exit_conf_mode = pnp_exit_conf_mode_aa,
95 const struct pnp_mode_ops pnp_conf_mode_a0a0_aa = {
96 .enter_conf_mode = pnp_enter_conf_mode_a0a0,
97 .exit_conf_mode = pnp_exit_conf_mode_aa,
100 const struct pnp_mode_ops pnp_conf_mode_870155_aa = {
101 .enter_conf_mode = pnp_enter_conf_mode_870155aa,
102 .exit_conf_mode = pnp_exit_conf_mode_0202,