Dave Frodin (dave.frodin@se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8255
-gerrit
commit 3ef9dd0e758e7769b3b3868d5a69d271f343dcbe Author: Dave Frodin dave.frodin@se-eng.com Date: Mon Jan 19 13:33:12 2015 -0700
superio/fintek: Add required changes so F81216H can be used
The amd/lamar mainboard is the first mainboard to use the f81216h. These changes are needed to fix up commit 27a63d77 so the Super I/O builds and functions correctly. - Wrong #include name - Removed global variable in romstage - Missing "case" in switch() - Changed function parameters to pass the unlock key
Change-Id: I1b2058a915b776664fba14e4341e8a410b50330f Signed-off-by: Dave Frodin dave.frodin@se-eng.com --- src/superio/fintek/f81216h/early_serial.c | 32 +++++++++++++------------------ src/superio/fintek/f81216h/f81216h.h | 12 +++++------- src/superio/fintek/f81216h/superio.c | 21 +++++++++----------- 3 files changed, 27 insertions(+), 38 deletions(-)
diff --git a/src/superio/fintek/f81216h/early_serial.c b/src/superio/fintek/f81216h/early_serial.c index 6b667df..1e4161a 100644 --- a/src/superio/fintek/f81216h/early_serial.c +++ b/src/superio/fintek/f81216h/early_serial.c @@ -21,12 +21,11 @@ #include <arch/io.h> #include <device/pnp.h> #include <stdint.h> -#include "fintek.h" +#include "f81216h.h"
-static u8 f81216h_entry_key; #define FINTEK_EXIT_KEY 0xAA
-static void pnp_enter_conf_state(pnp_devfn_t dev) +static void pnp_enter_conf_state(pnp_devfn_t dev, u8 f81216h_entry_key) { u16 port = dev >> 8; outb(f81216h_entry_key, port); @@ -40,26 +39,21 @@ static void pnp_exit_conf_state(pnp_devfn_t dev) }
/* Bring up early serial debugging output before the RAM is initialized. */ -void f81216h_enable_serial(pnp_devfn_t dev, u16 iobase, enum mode_key k) +void f81216h_enable_serial(pnp_devfn_t dev, u16 iobase, u8 unlock_key) { - switch(k) { - MODE_6767: - f81216h_entry_key = 0x67; - break; - MODE_7777: - f81216h_entry_key = 0x77; - break; - MODE_8787: - f81216h_entry_key = 0x87; - break; - MODE_A0A0: - f81216h_entry_key = 0xa0; + u8 key; + switch(unlock_key) { + case MODE_6767: + case MODE_7777: + case MODE_8787: + case MODE_A0A0: + key = unlock_key; break; default: - f81216h_entry_key = 0x77; /* (safe to be hw default) */ + key = MODE_7777; /* try the hw default */ + break; } - - pnp_enter_conf_state(dev); + pnp_enter_conf_state(dev, key); pnp_set_logical_device(dev); pnp_set_enable(dev, 0); pnp_set_iobase(dev, PNP_IDX_IO0, iobase); diff --git a/src/superio/fintek/f81216h/f81216h.h b/src/superio/fintek/f81216h/f81216h.h index 37e7753..c8be12c 100644 --- a/src/superio/fintek/f81216h/f81216h.h +++ b/src/superio/fintek/f81216h/f81216h.h @@ -34,13 +34,11 @@ * the default key. * See page 17 of data sheet for details. */ -enum { - MODE_6767, - MODE_7777, - MODE_8787, - MODE_A0A0, -} mode_key; +#define MODE_6767 0x67 +#define MODE_7777 0x77 +#define MODE_8787 0x87 +#define MODE_A0A0 0xA0
-void f81216h_enable_serial(pnp_devfn_t dev, u16 iobase, enum mode_key k); +void f81216h_enable_serial(pnp_devfn_t dev, u16 iobase, u8 unlock_key);
#endif /* SUPERIO_FINTEK_F81216H_H */ diff --git a/src/superio/fintek/f81216h/superio.c b/src/superio/fintek/f81216h/superio.c index eed165a..89204c4 100644 --- a/src/superio/fintek/f81216h/superio.c +++ b/src/superio/fintek/f81216h/superio.c @@ -45,20 +45,17 @@ static void pnp_enter_ext_func_mode(struct device *dev) * See page 17 of data sheet. */ switch(conf->conf_key_mode) { - case 0: - key = 0x77; /* (default) */ - break; - case 1: - key = 0xa0; - break; - case 2: - key = 0x87; - break; - case 3: - key = 0x67; + case MODE_6767: + case MODE_7777: + case MODE_8787: + case MODE_A0A0: + key = conf->conf_key_mode; break; default: - key = 0x77; /* safe to be hw default */ + printk(BIOS_WARNING, "Warning: Undefined F81216 unlock key assignment!\n"); + printk(BIOS_WARNING, "Setting conf_key_mode to default\n"); + key = MODE_7777; /* try the hw default */ + break; }
outb(key, dev->path.pnp.port);