summaryrefslogtreecommitdiff
path: root/src/superio/smsc
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2013-06-10 22:57:12 +0200
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-06-17 21:38:37 +0200
commitf898f7ba4d10146b45241afe65fd54b3c049cc4f (patch)
treed0aa5c8874521f998f794c12fce9b5dfc80abeed /src/superio/smsc
parenta00f9830fb58d3f5061aab71be8553f3ff2e1f70 (diff)
downloadcoreboot-f898f7ba4d10146b45241afe65fd54b3c049cc4f.tar.xz
pnp: Provide alternative pnp_enable() implementation
The current default implementation of pnp_enable() only disables devices - if set so in the devicetree - but does not enable them. Enablement takes place in pnp_enable_resources(). Yet, many PnP chips implement their own version of pnp_enable() which also enables devices if set in the devicetree. It's arguable, if enabling those devices makes sense, before they get resources assigned. Maybe we can't write the resource registers if not, who knows? The least we can do is providing a common implementation for this behavior, and get rid of some code duplication. Used the following cocci: @@ expression e; @@ +pnp_alt_enable(e); -pnp_set_logical_device(e); ( -pnp_set_enable(e, !!e->enabled); | -(e->enabled) ? pnp_set_enable(e, 1) : pnp_set_enable(e, 0); | -if (e->enabled) { pnp_set_enable(e, 1); } -else { pnp_set_enable(e, 0); } ) Change-Id: I8d695e8fcd3cf8b847b1aa99326b51a554700bc4 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: http://review.coreboot.org/3480 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/superio/smsc')
-rw-r--r--src/superio/smsc/kbc1100/superio.c9
-rw-r--r--src/superio/smsc/lpc47b272/superio.c3
-rw-r--r--src/superio/smsc/lpc47b397/superio.c3
-rw-r--r--src/superio/smsc/lpc47m10x/superio.c3
-rw-r--r--src/superio/smsc/lpc47m15x/superio.c3
-rw-r--r--src/superio/smsc/mec1308/superio.c9
-rw-r--r--src/superio/smsc/sch4037/superio.c9
-rw-r--r--src/superio/smsc/sio1036/superio.c9
-rw-r--r--src/superio/smsc/smscsuperio/superio.c3
9 files changed, 9 insertions, 42 deletions
diff --git a/src/superio/smsc/kbc1100/superio.c b/src/superio/smsc/kbc1100/superio.c
index b3d3d495a7..a8dad5e3ad 100644
--- a/src/superio/smsc/kbc1100/superio.c
+++ b/src/superio/smsc/kbc1100/superio.c
@@ -80,14 +80,7 @@ static void kbc1100_pnp_enable_resources(device_t dev)
static void kbc1100_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
-
- if(dev->enabled) {
- pnp_set_enable(dev, 1);
- }
- else {
- pnp_set_enable(dev, 0);
- }
+ pnp_alt_enable(dev);
pnp_exit_conf_state(dev);
}
diff --git a/src/superio/smsc/lpc47b272/superio.c b/src/superio/smsc/lpc47b272/superio.c
index 79d07bb06e..8217769d71 100644
--- a/src/superio/smsc/lpc47b272/superio.c
+++ b/src/superio/smsc/lpc47b272/superio.c
@@ -103,8 +103,7 @@ static void lpc47b272_pnp_enable_resources(device_t dev)
static void lpc47b272_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
- pnp_set_enable(dev, !!dev->enabled);
+ pnp_alt_enable(dev);
pnp_exit_conf_state(dev);
}
diff --git a/src/superio/smsc/lpc47b397/superio.c b/src/superio/smsc/lpc47b397/superio.c
index fd13b035d9..cc78c36e38 100644
--- a/src/superio/smsc/lpc47b397/superio.c
+++ b/src/superio/smsc/lpc47b397/superio.c
@@ -105,8 +105,7 @@ static void lpc47b397_pnp_enable_resources(device_t dev)
static void lpc47b397_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
- pnp_set_enable(dev, !!dev->enabled);
+ pnp_alt_enable(dev);
pnp_exit_conf_state(dev);
}
diff --git a/src/superio/smsc/lpc47m10x/superio.c b/src/superio/smsc/lpc47m10x/superio.c
index 53356d254e..d133c47512 100644
--- a/src/superio/smsc/lpc47m10x/superio.c
+++ b/src/superio/smsc/lpc47m10x/superio.c
@@ -102,8 +102,7 @@ static void lpc47m10x_pnp_enable_resources(device_t dev)
static void lpc47m10x_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
- pnp_set_enable(dev, !!dev->enabled);
+ pnp_alt_enable(dev);
pnp_exit_conf_state(dev);
}
diff --git a/src/superio/smsc/lpc47m15x/superio.c b/src/superio/smsc/lpc47m15x/superio.c
index e70c6e1d67..253bfdc09e 100644
--- a/src/superio/smsc/lpc47m15x/superio.c
+++ b/src/superio/smsc/lpc47m15x/superio.c
@@ -85,8 +85,7 @@ static void lpc47m15x_pnp_enable_resources(device_t dev)
static void lpc47m15x_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
- pnp_set_enable(dev, !!dev->enabled);
+ pnp_alt_enable(dev);
pnp_exit_conf_state(dev);
}
diff --git a/src/superio/smsc/mec1308/superio.c b/src/superio/smsc/mec1308/superio.c
index b4a1adf453..0fe473ca6b 100644
--- a/src/superio/smsc/mec1308/superio.c
+++ b/src/superio/smsc/mec1308/superio.c
@@ -60,14 +60,7 @@ static void mec1308_pnp_enable_resources(device_t dev)
static void mec1308_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
-
- if(dev->enabled) {
- pnp_set_enable(dev, 1);
- }
- else {
- pnp_set_enable(dev, 0);
- }
+ pnp_alt_enable(dev);
pnp_exit_conf_state(dev);
}
diff --git a/src/superio/smsc/sch4037/superio.c b/src/superio/smsc/sch4037/superio.c
index 386eafd106..9a19033e41 100644
--- a/src/superio/smsc/sch4037/superio.c
+++ b/src/superio/smsc/sch4037/superio.c
@@ -81,14 +81,7 @@ static void sch4037_pnp_enable_resources(device_t dev)
static void sch4037_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
-
- if(dev->enabled) {
- pnp_set_enable(dev, 1);
- }
- else {
- pnp_set_enable(dev, 0);
- }
+ pnp_alt_enable(dev);
pnp_exit_conf_state(dev);
}
diff --git a/src/superio/smsc/sio1036/superio.c b/src/superio/smsc/sio1036/superio.c
index 46f3f46b9f..c25a674832 100644
--- a/src/superio/smsc/sio1036/superio.c
+++ b/src/superio/smsc/sio1036/superio.c
@@ -80,14 +80,7 @@ static void sio1036_pnp_enable_resources(device_t dev)
static void sio1036_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
-
- if(dev->enabled) {
- pnp_set_enable(dev, 1);
- }
- else {
- pnp_set_enable(dev, 0);
- }
+ pnp_alt_enable(dev);
pnp_exit_conf_state(dev);
}
diff --git a/src/superio/smsc/smscsuperio/superio.c b/src/superio/smsc/smscsuperio/superio.c
index d687bd1c16..cdd223b489 100644
--- a/src/superio/smsc/smscsuperio/superio.c
+++ b/src/superio/smsc/smscsuperio/superio.c
@@ -194,8 +194,7 @@ static void smsc_pnp_enable_resources(device_t dev)
static void smsc_pnp_enable(device_t dev)
{
smsc_pnp_enter_conf_state(dev);
- pnp_set_logical_device(dev);
- pnp_set_enable(dev, !!dev->enabled);
+ pnp_alt_enable(dev);
smsc_pnp_exit_conf_state(dev);
}