[coreboot-gerrit] New patch to review for coreboot: f23c58c superio/ite: Use common dispatch for pnp entry/exit functions

Edward O'Callaghan (eocallaghan@alterapraxis.com) gerrit at coreboot.org
Sat Nov 1 07:33:01 CET 2014


Edward O'Callaghan (eocallaghan at alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7310

-gerrit

commit f23c58c06af6fe06facb01857e060c87859a6401
Author: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Date:   Sat Nov 1 12:11:58 2014 +1100

    superio/ite: Use common dispatch for pnp entry/exit functions
    
    We already have these implemented under superio/common, use
    those instead of this copy-paste syndrom.
    
    Change-Id: I7c7737e0b3c284d8b14b36c70681ab2269bb1d4b
    Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
---
 src/superio/ite/it8712f/superio.c | 22 +---------------------
 src/superio/ite/it8716f/superio.c | 22 +---------------------
 src/superio/ite/it8772f/superio.c | 22 +---------------------
 3 files changed, 3 insertions(+), 63 deletions(-)

diff --git a/src/superio/ite/it8712f/superio.c b/src/superio/ite/it8712f/superio.c
index 9dd9f85..7a881fa 100644
--- a/src/superio/ite/it8712f/superio.c
+++ b/src/superio/ite/it8712f/superio.c
@@ -26,21 +26,6 @@
 #include <stdlib.h>
 #include "it8712f.h"
 
-static void pnp_enter_ext_func_mode(struct device *dev)
-{
-	u16 port = dev->path.pnp.port;
-
-	outb(0x87, port);
-	outb(0x01, port);
-	outb(0x55, port);
-	outb((port == 0x4e) ? 0xaa : 0x55, port);
-}
-
-static void pnp_exit_ext_func_mode(struct device *dev)
-{
-	pnp_write_config(dev, 0x02, 0x02);
-}
-
 static void it8712f_init(struct device *dev)
 {
 
@@ -69,18 +54,13 @@ static void it8712f_init(struct device *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 = pnp_enable_resources,
 	.enable           = pnp_alt_enable,
 	.init             = it8712f_init,
-	.ops_pnp_mode     = &pnp_conf_mode_ops,
+	.ops_pnp_mode     = &pnp_conf_mode_870155_aa,
 };
 
 static struct pnp_info pnp_dev_info[] = {
diff --git a/src/superio/ite/it8716f/superio.c b/src/superio/ite/it8716f/superio.c
index 874061f..25ddd24 100644
--- a/src/superio/ite/it8716f/superio.c
+++ b/src/superio/ite/it8716f/superio.c
@@ -29,21 +29,6 @@
 #include <stdlib.h>
 #include "it8716f.h"
 
-static void pnp_enter_ext_func_mode(struct device *dev)
-{
-	u16 port = dev->path.pnp.port;
-
-	outb(0x87, port);
-	outb(0x01, port);
-	outb(0x55, port);
-	outb((port == 0x4e) ? 0xaa : 0x55, port);
-}
-
-static void pnp_exit_ext_func_mode(struct device *dev)
-{
-	pnp_write_config(dev, 0x02, 0x02);
-}
-
 #if !CONFIG_SUPERIO_ITE_IT8716F_OVERRIDE_FANCTL
 static void pnp_write_index(u16 port_base, u8 reg, u8 value)
 {
@@ -93,18 +78,13 @@ static void it8716f_init(struct device *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 = pnp_enable_resources,
 	.enable           = pnp_alt_enable,
 	.init             = it8716f_init,
-	.ops_pnp_mode     = &pnp_conf_mode_ops,
+	.ops_pnp_mode     = &pnp_conf_mode_870155_aa,
 };
 
 static struct pnp_info pnp_dev_info[] = {
diff --git a/src/superio/ite/it8772f/superio.c b/src/superio/ite/it8772f/superio.c
index 143cc30..6a1d3fa 100644
--- a/src/superio/ite/it8772f/superio.c
+++ b/src/superio/ite/it8772f/superio.c
@@ -26,21 +26,6 @@
 #include "chip.h" /* FIXME */
 #include "it8772f.h"
 
-static void pnp_enter_ext_func_mode(struct device *dev)
-{
-	u16 port = dev->path.pnp.port;
-
-	outb(0x87, port);
-	outb(0x01, port);
-	outb(0x55, port);
-	outb((port == 0x4e) ? 0xaa : 0x55, port);
-}
-
-static void pnp_exit_ext_func_mode(struct device *dev)
-{
-	pnp_write_config(dev, 0x02, 0x02);
-}
-
 static inline u8 it8772f_envc_read(struct resource *res, u8 addr)
 {
 	outb(addr, res->base + 5);
@@ -187,18 +172,13 @@ static void it8772f_init(struct device *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 = pnp_enable_resources,
 	.enable           = pnp_alt_enable,
 	.init             = it8772f_init,
-	.ops_pnp_mode     = &pnp_conf_mode_ops,
+	.ops_pnp_mode     = &pnp_conf_mode_870155_aa,
 };
 
 static struct pnp_info pnp_dev_info[] = {



More information about the coreboot-gerrit mailing list