diff options
Diffstat (limited to 'src/superio')
27 files changed, 102 insertions, 451 deletions
diff --git a/src/superio/Makefile.inc b/src/superio/Makefile.inc index ff4d48f811..e34fa89cb2 100644 --- a/src/superio/Makefile.inc +++ b/src/superio/Makefile.inc @@ -28,3 +28,4 @@ subdirs-y += smsc subdirs-y += via subdirs-y += winbond +ramstage-$(CONFIG_ARCH_X86) += common/conf_mode.c diff --git a/src/superio/common/conf_mode.c b/src/superio/common/conf_mode.c new file mode 100644 index 0000000000..40583ffc49 --- /dev/null +++ b/src/superio/common/conf_mode.c @@ -0,0 +1,50 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2013 Nico Huber <nico.h@gmx.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <arch/io.h> +#include <device/device.h> +#include <superio/conf_mode.h> + +/* Common enter/exit implementations */ + +void pnp_enter_conf_mode_55(device_t dev) +{ + outb(0x55, dev->path.pnp.port); +} + +void pnp_enter_conf_mode_8787(device_t dev) +{ + outb(0x87, dev->path.pnp.port); + outb(0x87, dev->path.pnp.port); +} + +void pnp_exit_conf_mode_aa(device_t dev) +{ + outb(0xaa, dev->path.pnp.port); +} + +const struct pnp_mode_ops pnp_conf_mode_55_aa = { + .enter_conf_mode = pnp_enter_conf_mode_55, + .exit_conf_mode = pnp_exit_conf_mode_aa, +}; + +const struct pnp_mode_ops pnp_conf_mode_8787_aa = { + .enter_conf_mode = pnp_enter_conf_mode_8787, + .exit_conf_mode = pnp_exit_conf_mode_aa, +}; diff --git a/src/superio/fintek/f71805f/superio.c b/src/superio/fintek/f71805f/superio.c index 50c3355ce9..4a31606895 100644 --- a/src/superio/fintek/f71805f/superio.c +++ b/src/superio/fintek/f71805f/superio.c @@ -21,22 +21,12 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <stdlib.h> #include <uart8250.h> #include "f71805f.h" -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void f71805f_init(device_t dev) { if (!dev->enabled) @@ -45,18 +35,13 @@ static void f71805f_init(device_t dev) /* TODO: Might potentially need code for HWM or FDC etc. */ } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = f71805f_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/fintek/f71859/superio.c b/src/superio/fintek/f71859/superio.c index 1e5b6ecd4d..2736c0b988 100644 --- a/src/superio/fintek/f71859/superio.c +++ b/src/superio/fintek/f71859/superio.c @@ -22,22 +22,12 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <stdlib.h> #include <uart8250.h> #include "f71859.h" -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void f71859_init(device_t dev) { if (!dev->enabled) @@ -46,18 +36,13 @@ static void f71859_init(device_t dev) /* TODO: Might potentially need code for HWM or FDC etc. */ } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = f71859_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/fintek/f71863fg/superio.c b/src/superio/fintek/f71863fg/superio.c index 84a7ec1397..4159e6ddc6 100644 --- a/src/superio/fintek/f71863fg/superio.c +++ b/src/superio/fintek/f71863fg/superio.c @@ -21,23 +21,13 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <stdlib.h> #include <uart8250.h> #include "chip.h" #include "f71863fg.h" -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void f71863fg_init(device_t dev) { struct superio_fintek_f71863fg_config *conf = dev->chip_info; @@ -55,18 +45,13 @@ static void f71863fg_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = f71863fg_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/fintek/f71872/superio.c b/src/superio/fintek/f71872/superio.c index 8db22a9f28..55a11b1b99 100644 --- a/src/superio/fintek/f71872/superio.c +++ b/src/superio/fintek/f71872/superio.c @@ -21,22 +21,12 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <stdlib.h> #include "chip.h" #include "f71872.h" -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void f71872_init(device_t dev) { struct superio_fintek_f71872_config *conf = dev->chip_info; @@ -52,18 +42,13 @@ static void f71872_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = f71872_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/fintek/f71889/superio.c b/src/superio/fintek/f71889/superio.c index 8de8ae82e3..450f9385c2 100644 --- a/src/superio/fintek/f71889/superio.c +++ b/src/superio/fintek/f71889/superio.c @@ -21,23 +21,13 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <stdlib.h> #include <uart8250.h> #include "chip.h" #include "f71889.h" -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void f71889_init(device_t dev) { struct superio_fintek_f71889_config *conf = dev->chip_info; @@ -53,18 +43,13 @@ static void f71889_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = f71889_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/fintek/f81865f/superio.c b/src/superio/fintek/f81865f/superio.c index 050602c96a..85ac7ba1a2 100644 --- a/src/superio/fintek/f81865f/superio.c +++ b/src/superio/fintek/f81865f/superio.c @@ -21,22 +21,12 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <stdlib.h> #include "chip.h" #include "f81865f.h" -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void f81865f_init(device_t dev) { struct superio_fintek_f81865f_config *conf = dev->chip_info; @@ -52,18 +42,13 @@ static void f81865f_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = f81865f_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/nuvoton/nct5104d/superio.c b/src/superio/nuvoton/nct5104d/superio.c index c8b696dab0..5eb8991b39 100755 --- a/src/superio/nuvoton/nct5104d/superio.c +++ b/src/superio/nuvoton/nct5104d/superio.c @@ -20,36 +20,21 @@ #include <arch/io.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <stdlib.h> #include "nct5104d.h" -static void pnp_enter_exteded_mode(device_t dev) -{ - outb(0x87,dev->path.pnp.port); - outb(0x87,dev->path.pnp.port); -} - -static void pnp_exit_extended_mode(device_t dev) -{ - outb(0xaa,dev->path.pnp.port); -} - static void nct5104d_init(device_t dev) { } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_exteded_mode, - .exit_conf_mode = pnp_exit_extended_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 = nct5104d_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/smsc/kbc1100/superio.c b/src/superio/smsc/kbc1100/superio.c index a6d0ef0b64..c56694ca24 100644 --- a/src/superio/smsc/kbc1100/superio.c +++ b/src/superio/smsc/kbc1100/superio.c @@ -22,6 +22,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <device/smbus.h> #include <string.h> @@ -35,26 +36,18 @@ static void enable_dev(device_t dev); static void kbc1100_init(device_t dev); -static void pnp_enter_conf_state(device_t dev); -static void pnp_exit_conf_state(device_t dev); - struct chip_operations superio_smsc_kbc1100_ops = { CHIP_NAME("SMSC KBC1100 Super I/O") .enable_dev = enable_dev }; -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = kbc1100_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; static struct pnp_info pnp_dev_info[] = { @@ -86,13 +79,3 @@ static void kbc1100_init(device_t dev) break; } } - -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} diff --git a/src/superio/smsc/lpc47b272/superio.c b/src/superio/smsc/lpc47b272/superio.c index d06f09457e..8901ec4460 100644 --- a/src/superio/smsc/lpc47b272/superio.c +++ b/src/superio/smsc/lpc47b272/superio.c @@ -26,6 +26,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <device/smbus.h> #include <string.h> @@ -38,9 +39,6 @@ /* Forward declarations */ static void enable_dev(device_t dev); static void lpc47b272_init(device_t dev); - -static void pnp_enter_conf_state(device_t dev); -static void pnp_exit_conf_state(device_t dev); // static void dump_pnp_device(device_t dev); struct chip_operations superio_smsc_lpc47b272_ops = { @@ -48,18 +46,13 @@ struct chip_operations superio_smsc_lpc47b272_ops = { .enable_dev = enable_dev }; -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = lpc47b272_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; static struct pnp_info pnp_dev_info[] = { @@ -105,16 +98,6 @@ static void lpc47b272_init(device_t dev) } } -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - #if 0 /** * Print the values of all of the LPC47B272's configuration registers. diff --git a/src/superio/smsc/lpc47b397/superio.c b/src/superio/smsc/lpc47b397/superio.c index 850b7bbbf4..ff6e4051ad 100644 --- a/src/superio/smsc/lpc47b397/superio.c +++ b/src/superio/smsc/lpc47b397/superio.c @@ -23,6 +23,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <device/smbus.h> #include <string.h> @@ -32,16 +33,6 @@ #include "chip.h" #include "lpc47b397.h" -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void pnp_write_index(u16 port, u8 reg, u8 value) { outb(reg, port); @@ -94,18 +85,13 @@ static void lpc47b397_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_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - static struct device_operations ops = { .read_resources = pnp_read_resources, .set_resources = pnp_set_resources, .enable_resources = lpc47b397_pnp_enable_resources, .enable = pnp_alt_enable, .init = lpc47b397_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; #define HWM_INDEX 0 @@ -165,7 +151,7 @@ static struct device_operations ops_hwm = { .init = lpc47b397_init, .scan_bus = scan_static_bus, .ops_smbus_bus = &lops_smbus_bus, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/smsc/lpc47m10x/superio.c b/src/superio/smsc/lpc47m10x/superio.c index 925defa526..c1f3c2c1bb 100644 --- a/src/superio/smsc/lpc47m10x/superio.c +++ b/src/superio/smsc/lpc47m10x/superio.c @@ -25,6 +25,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <device/smbus.h> #include <string.h> @@ -37,9 +38,6 @@ /* Forward declarations */ static void enable_dev(device_t dev); static void lpc47m10x_init(device_t dev); - -static void pnp_enter_conf_state(device_t dev); -static void pnp_exit_conf_state(device_t dev); // static void dump_pnp_device(device_t dev); struct chip_operations superio_smsc_lpc47m10x_ops = { @@ -47,18 +45,13 @@ struct chip_operations superio_smsc_lpc47m10x_ops = { .enable_dev = enable_dev }; -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = lpc47m10x_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; static struct pnp_info pnp_dev_info[] = { @@ -104,16 +97,6 @@ static void lpc47m10x_init(device_t dev) } } -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - #if 0 /** * Print the values of all of the LPC47M10X2's configuration registers. diff --git a/src/superio/smsc/lpc47m15x/superio.c b/src/superio/smsc/lpc47m15x/superio.c index a3b8fc5e73..7e400fc500 100644 --- a/src/superio/smsc/lpc47m15x/superio.c +++ b/src/superio/smsc/lpc47m15x/superio.c @@ -22,6 +22,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <device/smbus.h> #include <string.h> @@ -35,26 +36,18 @@ static void enable_dev(device_t dev); static void lpc47m15x_init(device_t dev); -static void pnp_enter_conf_state(device_t dev); -static void pnp_exit_conf_state(device_t dev); - struct chip_operations superio_smsc_lpc47m15x_ops = { CHIP_NAME("SMSC LPC47M15x/192/997 Super I/O") .enable_dev = enable_dev }; -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = lpc47m15x_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; static struct pnp_info pnp_dev_info[] = { @@ -84,13 +77,3 @@ static void lpc47m15x_init(device_t dev) break; } } - -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} diff --git a/src/superio/smsc/mec1308/superio.c b/src/superio/smsc/mec1308/superio.c index 0385b26b90..448800ebec 100644 --- a/src/superio/smsc/mec1308/superio.c +++ b/src/superio/smsc/mec1308/superio.c @@ -22,6 +22,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <device/smbus.h> #include <string.h> @@ -33,16 +34,6 @@ #include <arch/acpi.h> #endif -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void mec1308_init(device_t dev) { struct superio_smsc_mec1308_config *conf = dev->chip_info; @@ -61,18 +52,13 @@ static void mec1308_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = mec1308_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/smsc/sch4037/superio.c b/src/superio/smsc/sch4037/superio.c index 254b8386ba..96d35fe3ed 100644 --- a/src/superio/smsc/sch4037/superio.c +++ b/src/superio/smsc/sch4037/superio.c @@ -22,6 +22,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <device/smbus.h> #include <string.h> @@ -35,26 +36,18 @@ static void enable_dev(device_t dev); static void sch4037_init(device_t dev); -static void pnp_enter_conf_state(device_t dev); -static void pnp_exit_conf_state(device_t dev); - struct chip_operations superio_smsc_sch4037_ops = { CHIP_NAME("SMSC SCH4037 Super I/O") .enable_dev = enable_dev, }; -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = sch4037_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; static struct pnp_info pnp_dev_info[] = { @@ -85,13 +78,3 @@ static void sch4037_init(device_t dev) break; } } - -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} diff --git a/src/superio/smsc/sio1036/superio.c b/src/superio/smsc/sio1036/superio.c index 2ce2af2787..ff7b5d1252 100644 --- a/src/superio/smsc/sio1036/superio.c +++ b/src/superio/smsc/sio1036/superio.c @@ -22,6 +22,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <device/smbus.h> #include <string.h> @@ -35,26 +36,18 @@ static void enable_dev(device_t dev); static void sio1036_init(device_t dev); -static void pnp_enter_conf_state(device_t dev); -static void pnp_exit_conf_state(device_t dev); - struct chip_operations superio_smsc_sio1036_ops = { CHIP_NAME("SMSC SIO1036 Super I/O") .enable_dev = enable_dev }; -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = pnp_enter_conf_state, - .exit_conf_mode = pnp_exit_conf_state, -}; - 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 = sio1036_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; static struct pnp_info pnp_dev_info[] = { @@ -84,13 +77,3 @@ static void sio1036_init(device_t dev) } } -static void pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -static void pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - diff --git a/src/superio/smsc/smscsuperio/superio.c b/src/superio/smsc/smscsuperio/superio.c index d45a9671c1..42a9c09a00 100644 --- a/src/superio/smsc/smscsuperio/superio.c +++ b/src/superio/smsc/smscsuperio/superio.c @@ -37,6 +37,7 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <console/console.h> #include <uart8250.h> #include <pc80/keyboard.h> @@ -144,32 +145,6 @@ static const struct logical_devices { }; /** - * Enter the configuration state by writing 0x55 to the config port. - * - * The Super I/O configuration registers can only be modified when the chip - * is in the configuration state. Thus, to program the registers you have - * to a) enter config mode, b) program the registers, c) exit config mode. - * - * @param dev The device to use. - */ -static void smsc_pnp_enter_conf_state(device_t dev) -{ - outb(0x55, dev->path.pnp.port); -} - -/** - * Exit the configuration state by writing 0xaa to the config port. - * - * This puts the chip into the 'run' state again. - * - * @param dev The device to use. - */ -static void smsc_pnp_exit_conf_state(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - -/** * Initialize those logical devices which need a special init. * * @param dev The device to use. @@ -199,11 +174,6 @@ static void smsc_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = smsc_pnp_enter_conf_state, - .exit_conf_mode = smsc_pnp_exit_conf_state, -}; - /** Standard device operations. */ static struct device_operations ops = { .read_resources = pnp_read_resources, @@ -211,7 +181,7 @@ static struct device_operations ops = { .enable_resources = pnp_enable_resources, .enable = pnp_alt_enable, .init = smsc_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_55_aa, }; /** diff --git a/src/superio/via/vt1211/vt1211.c b/src/superio/via/vt1211/vt1211.c index 8e09e4a50e..68fd999eb4 100644 --- a/src/superio/via/vt1211/vt1211.c +++ b/src/superio/via/vt1211/vt1211.c @@ -23,6 +23,7 @@ #include <console/console.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <uart8250.h> #include <stdlib.h> #include "vt1211.h" @@ -44,17 +45,6 @@ static u8 hwm_io_regs[] = { 0x5c,0x00, 0x5f,0x33, 0x40,0x01, }; -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 vt1211_set_iobase(device_t dev, u8 index, u16 iobase) { switch (dev->path.pnp.device) { @@ -172,18 +162,13 @@ static void vt1211_pnp_set_resources(struct device *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, -}; - struct device_operations ops = { .read_resources = pnp_read_resources, .set_resources = vt1211_pnp_set_resources, .enable_resources = vt1211_pnp_enable_resources, .enable = pnp_alt_enable, .init = vt1211_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; /* TODO: Check if 0x07f8 is correct for FDC/PP/SP1/SP2, the rest is correct. */ diff --git a/src/superio/winbond/w83627dhg/superio.c b/src/superio/winbond/w83627dhg/superio.c index 537d83490f..a9314196ee 100644 --- a/src/superio/winbond/w83627dhg/superio.c +++ b/src/superio/winbond/w83627dhg/superio.c @@ -20,23 +20,13 @@ #include <arch/io.h> #include <device/device.h> #include <device/pnp.h> +#include <superio/conf_mode.h> #include <uart8250.h> #include <pc80/keyboard.h> #include <stdlib.h> #include "chip.h" #include "w83627dhg.h" -void pnp_enter_ext_func_mode(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -void pnp_exit_ext_func_mode(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void w83627dhg_enable_UR2(device_t dev) { u8 reg8; @@ -65,18 +55,13 @@ static void w83627dhg_init(device_t 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 = w83627dhg_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/winbond/w83627ehg/superio.c b/src/superio/winbond/w83627ehg/superio.c index 631105b2f8..6f2c9deef3 100644 --- a/src/superio/winbond/w83627ehg/superio.c +++ b/src/superio/winbond/w83627ehg/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 "w83627ehg.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); @@ -141,18 +131,13 @@ static void w83627ehg_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 = w83627ehg_pnp_enable_resources, .enable = pnp_alt_enable, .init = w83627ehg_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { 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[] = { diff --git a/src/superio/winbond/w83627thg/superio.c b/src/superio/winbond/w83627thg/superio.c index f1c56032c5..257cd0ad76 100644 --- a/src/superio/winbond/w83627thg/superio.c +++ b/src/superio/winbond/w83627thg/superio.c @@ -23,6 +23,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> @@ -30,17 +31,6 @@ #include "chip.h" #include "w83627thg.h" -static void w83627thg_enter_ext_func_mode(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void w83627thg_exit_ext_func_mode(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void w83627thg_init(device_t dev) { struct superio_winbond_w83627thg_config *conf = dev->chip_info; @@ -55,18 +45,13 @@ static void w83627thg_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = w83627thg_enter_ext_func_mode, - .exit_conf_mode = w83627thg_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_enable, .init = w83627thg_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/winbond/w83627uhg/superio.c b/src/superio/winbond/w83627uhg/superio.c index d2cbdc945c..3f1ca38d30 100644 --- a/src/superio/winbond/w83627uhg/superio.c +++ b/src/superio/winbond/w83627uhg/superio.c @@ -21,6 +21,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 <stdint.h> @@ -30,17 +31,6 @@ #include "chip.h" #include "w83627uhg.h" -static void w83627uhg_enter_ext_func_mode(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void w83627uhg_exit_ext_func_mode(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - /* * Set the UART clock source. * @@ -101,18 +91,13 @@ static void w83627uhg_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = w83627uhg_enter_ext_func_mode, - .exit_conf_mode = w83627uhg_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_enable, .init = w83627uhg_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/winbond/w83697hf/superio.c b/src/superio/winbond/w83697hf/superio.c index 9431b34d23..79ebcc9408 100644 --- a/src/superio/winbond/w83697hf/superio.c +++ b/src/superio/winbond/w83697hf/superio.c @@ -21,6 +21,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 <lib.h> @@ -30,17 +31,6 @@ #include "chip.h" #include "w83697hf.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 hwmon_set_fan_divisor(unsigned int base, int num, unsigned int divisor) { unsigned char enc, buf; @@ -81,18 +71,13 @@ static void w83697hf_init(device_t 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 = w83697hf_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/winbond/w83977f/superio.c b/src/superio/winbond/w83977f/superio.c index 8368839d26..6756830dbd 100644 --- a/src/superio/winbond/w83977f/superio.c +++ b/src/superio/winbond/w83977f/superio.c @@ -21,6 +21,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> @@ -29,17 +30,6 @@ #include "chip.h" #include "w83977f.h" -static void w83977f_enter_ext_func_mode(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void w83977f_exit_ext_func_mode(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void w83977f_init(device_t dev) { struct superio_winbond_w83977f_config *conf = dev->chip_info; @@ -54,18 +44,13 @@ static void w83977f_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = w83977f_enter_ext_func_mode, - .exit_conf_mode = w83977f_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_enable, .init = w83977f_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { diff --git a/src/superio/winbond/w83977tf/superio.c b/src/superio/winbond/w83977tf/superio.c index ff55f5d2f6..0200d26b04 100644 --- a/src/superio/winbond/w83977tf/superio.c +++ b/src/superio/winbond/w83977tf/superio.c @@ -23,6 +23,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> @@ -31,17 +32,6 @@ #include "chip.h" #include "w83977tf.h" -static void w83977tf_enter_ext_func_mode(device_t dev) -{ - outb(0x87, dev->path.pnp.port); - outb(0x87, dev->path.pnp.port); -} - -static void w83977tf_exit_ext_func_mode(device_t dev) -{ - outb(0xaa, dev->path.pnp.port); -} - static void w83977tf_init(device_t dev) { struct superio_winbond_w83977tf_config *conf = dev->chip_info; @@ -56,18 +46,13 @@ static void w83977tf_init(device_t dev) } } -static const struct pnp_mode_ops pnp_conf_mode_ops = { - .enter_conf_mode = w83977tf_enter_ext_func_mode, - .exit_conf_mode = w83977tf_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_enable, .init = w83977tf_init, - .ops_pnp_mode = &pnp_conf_mode_ops, + .ops_pnp_mode = &pnp_conf_mode_8787_aa, }; static struct pnp_info pnp_dev_info[] = { |