blob: 92bd7a3691b62bb272bfc6267b9f290a9f1f2fc1 [file] [log] [blame]
Nico Huber1c811282013-06-15 20:33:44 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Nico Huber <nico.h@gmx.de>
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>
21#include <device/device.h>
22#include <superio/conf_mode.h>
23
24/* Common enter/exit implementations */
25
Edward O'Callaghan377fd752014-10-21 07:51:24 +110026void pnp_enter_conf_mode_55(struct device *dev)
Nico Huber1c811282013-06-15 20:33:44 +020027{
28 outb(0x55, dev->path.pnp.port);
29}
30
Edward O'Callaghanb14bf882014-11-01 09:14:58 +110031void pnp_enter_conf_mode_6767(struct device *dev)
32{
33 outb(0x67, dev->path.pnp.port);
34 outb(0x67, dev->path.pnp.port);
35}
36
37void pnp_enter_conf_mode_7777(struct device *dev)
38{
39 outb(0x77, dev->path.pnp.port);
40 outb(0x77, dev->path.pnp.port);
41}
42
Edward O'Callaghan377fd752014-10-21 07:51:24 +110043void pnp_enter_conf_mode_8787(struct device *dev)
Nico Huber1c811282013-06-15 20:33:44 +020044{
45 outb(0x87, dev->path.pnp.port);
46 outb(0x87, dev->path.pnp.port);
47}
48
Edward O'Callaghanb14bf882014-11-01 09:14:58 +110049void pnp_enter_conf_mode_a0a0(struct device *dev)
50{
51 outb(0xa0, dev->path.pnp.port);
52 outb(0xa0, dev->path.pnp.port);
53}
54
Edward O'Callaghan377fd752014-10-21 07:51:24 +110055void pnp_exit_conf_mode_aa(struct device *dev)
Nico Huber1c811282013-06-15 20:33:44 +020056{
57 outb(0xaa, dev->path.pnp.port);
58}
59
Edward O'Callaghan377fd752014-10-21 07:51:24 +110060void pnp_enter_conf_mode_870155aa(struct device *dev)
Edward O'Callaghanbf9f2432014-05-06 17:24:59 +100061{
62 outb(0x87, dev->path.pnp.port);
63 outb(0x01, dev->path.pnp.port);
64 outb(0x55, dev->path.pnp.port);
65
66 if (dev->path.pnp.port == 0x4e)
67 outb(0xaa, dev->path.pnp.port);
68 else
69 outb(0x55, dev->path.pnp.port);
70}
71
Edward O'Callaghan377fd752014-10-21 07:51:24 +110072void pnp_exit_conf_mode_0202(struct device *dev)
Edward O'Callaghanbf9f2432014-05-06 17:24:59 +100073{
74 outb(0x02, dev->path.pnp.port);
75 outb(0x02, dev->path.pnp.port + 1);
76}
77
78
Nico Huber1c811282013-06-15 20:33:44 +020079const struct pnp_mode_ops pnp_conf_mode_55_aa = {
80 .enter_conf_mode = pnp_enter_conf_mode_55,
81 .exit_conf_mode = pnp_exit_conf_mode_aa,
82};
83
Edward O'Callaghanb14bf882014-11-01 09:14:58 +110084const struct pnp_mode_ops pnp_conf_mode_6767_aa = {
85 .enter_conf_mode = pnp_enter_conf_mode_6767,
86 .exit_conf_mode = pnp_exit_conf_mode_aa,
87};
88
89const struct pnp_mode_ops pnp_conf_mode_7777_aa = {
90 .enter_conf_mode = pnp_enter_conf_mode_7777,
91 .exit_conf_mode = pnp_exit_conf_mode_aa,
92};
93
Nico Huber1c811282013-06-15 20:33:44 +020094const struct pnp_mode_ops pnp_conf_mode_8787_aa = {
95 .enter_conf_mode = pnp_enter_conf_mode_8787,
96 .exit_conf_mode = pnp_exit_conf_mode_aa,
97};
Edward O'Callaghanbf9f2432014-05-06 17:24:59 +100098
Edward O'Callaghanb14bf882014-11-01 09:14:58 +110099const struct pnp_mode_ops pnp_conf_mode_a0a0_aa = {
100 .enter_conf_mode = pnp_enter_conf_mode_a0a0,
101 .exit_conf_mode = pnp_exit_conf_mode_aa,
102};
103
Edward O'Callaghanbf9f2432014-05-06 17:24:59 +1000104const struct pnp_mode_ops pnp_conf_mode_870155_aa = {
105 .enter_conf_mode = pnp_enter_conf_mode_870155aa,
106 .exit_conf_mode = pnp_exit_conf_mode_0202,
107};