Edward O'Callaghan (eocallaghan@alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7615
-gerrit
commit 2fed19508c33055465b02ede60bfad1645109866 Author: Edward O'Callaghan eocallaghan@alterapraxis.com Date: Sun Nov 30 16:24:11 2014 +1100
ec/compal/ene932: Fix TODO by sharing kbc func's with kbc driver
Change-Id: I711d697f3d254d0f447eb3d46bc0f36e16332688 Signed-off-by: Edward O'Callaghan eocallaghan@alterapraxis.com --- src/drivers/pc80/Makefile.inc | 1 + src/drivers/pc80/keyboard.c | 10 +++++--- src/ec/compal/ene932/Makefile.inc | 1 - src/ec/compal/ene932/ec.c | 49 --------------------------------------- src/ec/compal/ene932/ec.h | 4 ---- src/include/pc80/keyboard.h | 5 ++++ src/lib/Makefile.inc | 1 + 7 files changed, 14 insertions(+), 57 deletions(-)
diff --git a/src/drivers/pc80/Makefile.inc b/src/drivers/pc80/Makefile.inc index fe6d11f..975ce12 100644 --- a/src/drivers/pc80/Makefile.inc +++ b/src/drivers/pc80/Makefile.inc @@ -18,3 +18,4 @@ cmos.default-file = $(CONFIG_CMOS_DEFAULT_FILE):nvramtool cmos.default-type = 0xaa
smm-y += mc146818rtc.c +smm-y += keyboard.c diff --git a/src/drivers/pc80/keyboard.c b/src/drivers/pc80/keyboard.c index 06eae46..7aaa73b 100644 --- a/src/drivers/pc80/keyboard.c +++ b/src/drivers/pc80/keyboard.c @@ -65,7 +65,7 @@ /* Wait 400ms for keyboard controller answers */ #define KBC_TIMEOUT_IN_MS 400
-static int kbc_input_buffer_empty(void) +int kbc_input_buffer_empty(void) { u32 timeout; for (timeout = KBC_TIMEOUT_IN_MS; @@ -78,7 +78,7 @@ static int kbc_input_buffer_empty(void) return !!timeout; }
-static int kbc_output_buffer_full(void) +int kbc_output_buffer_full(void) { u32 timeout; for (timeout = KBC_TIMEOUT_IN_MS; @@ -91,7 +91,7 @@ static int kbc_output_buffer_full(void) return !!timeout; }
-static int kbc_cleanup_buffers(void) +int kbc_cleanup_buffers(void) { u32 timeout; for (timeout = KBC_TIMEOUT_IN_MS; @@ -110,6 +110,8 @@ static int kbc_cleanup_buffers(void) return !!timeout; }
+#if !defined(__SMM__) + static enum cb_err kbc_self_test(void) { u8 self_test; @@ -328,3 +330,5 @@ void set_kbc_ps2_mode(void)
kbc_cleanup_buffers(); } + +#endif /* !defined(__SMM__) */ diff --git a/src/ec/compal/ene932/Makefile.inc b/src/ec/compal/ene932/Makefile.inc index fb898be..0accda3 100644 --- a/src/ec/compal/ene932/Makefile.inc +++ b/src/ec/compal/ene932/Makefile.inc @@ -1,3 +1,2 @@ ramstage-y += ec.c smm-y += ec.c -smm-y += ../../../lib/delay.c diff --git a/src/ec/compal/ene932/ec.c b/src/ec/compal/ene932/ec.c index 91c979e..f68da81 100644 --- a/src/ec/compal/ene932/ec.c +++ b/src/ec/compal/ene932/ec.c @@ -31,55 +31,6 @@ #include "ec.h" #include "chip.h"
-/* kbc helper functions from drivers/pc80/keyboard.c. TODO: share functions. */ -static int kbc_input_buffer_empty(void) -{ - u32 timeout; - for(timeout = KBC_TIMEOUT_IN_MS; timeout && (inb(KBD_STATUS) & KBD_IBF); - timeout--) { - mdelay(1); - } - - if (!timeout) { - printk(BIOS_WARNING, - "Unexpected Keyboard controller input buffer full\n"); - } - return !!timeout; -} - - -static int kbc_output_buffer_full(void) -{ - u32 timeout; - for(timeout = KBC_TIMEOUT_IN_MS; timeout && ((inb(KBD_STATUS) - & KBD_OBF) == 0); timeout--) { - mdelay(1); - } - - if (!timeout) { - printk(BIOS_INFO, "Keyboard controller output buffer result timeout\n"); - } - return !!timeout; -} - -int kbc_cleanup_buffers(void) -{ - u32 timeout; - for(timeout = KBC_TIMEOUT_IN_MS; timeout && (inb(KBD_STATUS) - & (KBD_OBF | KBD_IBF)); timeout--) { - mdelay(1); - inb(KBD_DATA); - } - - if (!timeout) { - printk(BIOS_ERR, "Couldn't cleanup the keyboard controller buffers\n"); - printk(BIOS_ERR, "Status (0x%x): 0x%x, Buffer (0x%x): 0x%x\n", - KBD_STATUS, inb(KBD_STATUS), KBD_DATA, inb(KBD_DATA)); - } - - return !!timeout; -} -
/* The ENE 60/64 EC registers are the same command/status IB/OB KBC pair. * Check status from 64 port before each command. diff --git a/src/ec/compal/ene932/ec.h b/src/ec/compal/ene932/ec.h index a1f4544..7ccc579 100644 --- a/src/ec/compal/ene932/ec.h +++ b/src/ec/compal/ene932/ec.h @@ -47,12 +47,8 @@ #define KBD_OBF (1 << 0) // 1: output buffer full (data ready for host)
-/* Wait 400ms for keyboard controller answers */ -#define KBC_TIMEOUT_IN_MS 400 - u8 ec_kbc_read_ob(void); void ec_kbc_write_cmd(u8 cmd); void ec_kbc_write_ib(u8 data); -int kbc_cleanup_buffers(void);
#endif /* _EC_COMPAL_ENE932_EC_H */ diff --git a/src/include/pc80/keyboard.h b/src/include/pc80/keyboard.h index 16cb959..8ec69e8 100644 --- a/src/include/pc80/keyboard.h +++ b/src/include/pc80/keyboard.h @@ -4,4 +4,9 @@ void pc_keyboard_init(void); void set_kbc_ps2_mode(void);
+/* Use in some Embedded Controller drivers */ +int kbc_input_buffer_empty(void); +int kbc_output_buffer_full(void); +int kbc_cleanup_buffers(void); + #endif /* PC80_KEYBOARD_H */ diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 55e0d6d..9cf7ed2 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -88,6 +88,7 @@ ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
romstage-$(CONFIG_CACHE_RELOCATED_RAMSTAGE_OUTSIDE_CBMEM) += ramstage_cache.c
+smm-y += delay.c smm-y += cbfs.c cbfs_core.c memcmp.c smm-$(CONFIG_COMPILER_GCC) += gcc.c