summaryrefslogtreecommitdiff
path: root/src/superio/winbond/w83627hf
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2013-06-15 20:33:44 +0200
committerNico Huber <nico.huber@secunet.com>2013-07-03 16:13:11 +0200
commit1c81128dcd3a723f75d554b0a8d87101d7dd3663 (patch)
tree09a664dc1a18439e57480ef61adc6044a205c3e8 /src/superio/winbond/w83627hf
parentabe6847cd21b553dd66fcb0540de166f82ebaf00 (diff)
downloadcoreboot-1c81128dcd3a723f75d554b0a8d87101d7dd3663.tar.xz
pnp: Add some default functions to enter/exit config state
Implement some common default functions to enter and exit the configuration state. Also provide default pnp_mode_ops for common enter()/exit() function pairs. The following cocci ensures their use: @ mode_match @ identifier enter, exit, ops; @@ struct pnp_mode_ops ops = { .enter_conf_mode = enter, .exit_conf_mode = exit, }; @ enter_match_8787 @ identifier mode_match.enter, dev; @@ enter(...) { outb(0x87, dev->path.pnp.port); outb(0x87, dev->path.pnp.port); } @ depends on enter_match_8787 @ identifier mode_match.enter, mode_match.ops; @@ struct pnp_mode_ops ops = { - .enter_conf_mode = enter, + .enter_conf_mode = pnp_enter_conf_mode_8787, }; @ enter_match_55 @ identifier mode_match.enter, dev; @@ enter(...) { outb(0x55, dev->path.pnp.port); } @ depends on enter_match_55 @ identifier mode_match.enter, mode_match.ops; @@ struct pnp_mode_ops ops = { - .enter_conf_mode = enter, + .enter_conf_mode = pnp_enter_conf_mode_55, }; @ depends on enter_match_8787 || enter_match_55 @ identifier mode_match.enter; @@ -enter(...) {...} @ exit_match_aa @ identifier mode_match.exit, dev; @@ exit(...) { outb(0xaa, dev->path.pnp.port); } @ depends on exit_match_aa @ identifier mode_match.exit, mode_match.ops; @@ struct pnp_mode_ops ops = { - .exit_conf_mode = exit, + .exit_conf_mode = pnp_exit_conf_mode_aa, }; @ depends on exit_match_aa @ identifier mode_match.exit; @@ -exit(...) {...} @ depends on enter_match_8787 || enter_match_55 || exit_match_aa @ @@ #include <device/pnp.h> +#include <superio/conf_mode.h> @ mode_match_55_aa @ identifier ops; @@ struct pnp_mode_ops ops = { .enter_conf_mode = pnp_enter_conf_mode_55, .exit_conf_mode = pnp_exit_conf_mode_aa, }; @@ identifier mode_match_55_aa.ops; @@ -struct pnp_mode_ops ops = {...}; @@ identifier mode_match_55_aa.ops, devops; @@ struct device_operations devops = { - .ops_pnp_mode = &ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; @ mode_match_8787_aa @ identifier ops; @@ struct pnp_mode_ops ops = { .enter_conf_mode = pnp_enter_conf_mode_8787, .exit_conf_mode = pnp_exit_conf_mode_aa, }; @@ identifier mode_match_8787_aa.ops; @@ -struct pnp_mode_ops ops = {...}; @@ identifier mode_match_8787_aa.ops, devops; @@ struct device_operations devops = { - .ops_pnp_mode = &ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; Change-Id: I1480336b54523cc95210d99cf31c1a0b3a14b464 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: http://review.coreboot.org/3484 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'src/superio/winbond/w83627hf')
-rw-r--r--src/superio/winbond/w83627hf/superio.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/superio/winbond/w83627hf/superio.c b/src/superio/winbond/w83627hf/superio.c
index 4d68c35033..5a4e964dc3 100644
--- a/src/superio/winbond/w83627hf/superio.c
+++ b/src/superio/winbond/w83627hf/superio.c
@@ -24,6 +24,7 @@
#include <arch/io.h>
#include <device/device.h>
#include <device/pnp.h>
+#include <superio/conf_mode.h>
#include <console/console.h>
#include <string.h>
#include <uart8250.h>
@@ -33,17 +34,6 @@
#include "chip.h"
#include "w83627hf.h"
-static void pnp_enter_ext_func_mode(device_t dev)
-{
- outb(0x87, dev->path.pnp.port);
- outb(0x87, dev->path.pnp.port);
-}
-
-static void pnp_exit_ext_func_mode(device_t dev)
-{
- outb(0xaa, dev->path.pnp.port);
-}
-
static void pnp_write_index(u16 port, u8 reg, u8 value)
{
outb(reg, port);
@@ -148,18 +138,13 @@ static void w83627hf_pnp_enable_resources(device_t dev)
pnp_exit_conf_mode(dev);
}
-static const struct pnp_mode_ops pnp_conf_mode_ops = {
- .enter_conf_mode = pnp_enter_ext_func_mode,
- .exit_conf_mode = pnp_exit_ext_func_mode,
-};
-
static struct device_operations ops = {
.read_resources = pnp_read_resources,
.set_resources = pnp_set_resources,
.enable_resources = w83627hf_pnp_enable_resources,
.enable = pnp_alt_enable,
.init = w83627hf_init,
- .ops_pnp_mode = &pnp_conf_mode_ops,
+ .ops_pnp_mode = &pnp_conf_mode_8787_aa,
};
static struct pnp_info pnp_dev_info[] = {