]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
cros fix
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 23 Feb 2016 10:26:35 +0000 (11:26 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Tue, 23 Feb 2016 10:26:35 +0000 (11:26 +0100)
grub-core/term/arm/cros.c
grub-core/term/arm/cros_ec.c
include/grub/arm/cros_ec.h

index 7eb239907d87fcd8b80b2267821448562beac307..04c0ac345a4b4fd8b033e204a5a3d3217c50e2b9 100644 (file)
 #include <grub/term.h>
 #include <grub/time.h>
 #include <grub/fdtbus.h>
-#include <grub/cros_ec.h>
+#include <grub/arm/cros_ec.h>
 
 struct grub_ps2_state ps2_state;
 
-struct cros_ec_keyscan old_scan;
+struct grub_cros_ec_keyscan old_scan;
 
-static grub_uint8_t map_code[CROS_EC_KEYSCAN_COLS][CROS_EC_KEYSCAN_ROWS];
+static grub_uint8_t map_code[GRUB_CROS_EC_KEYSCAN_COLS][GRUB_CROS_EC_KEYSCAN_ROWS];
 
 static grub_uint8_t e0_translate[16] =
   {
@@ -47,13 +47,13 @@ static grub_uint8_t e0_translate[16] =
 static int
 grub_cros_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused)))
 {
-  struct cros_ec_keyscan scan;
+  struct grub_cros_ec_keyscan scan;
   int i, j;
-  if (cros_ec_scan_keyboard(&scan) < 0)
+  if (grub_cros_ec_scan_keyboard(&scan) < 0)
          return GRUB_TERM_NO_KEY;
-  for (i = 0; i < CROS_EC_KEYSCAN_COLS; i++)
+  for (i = 0; i < GRUB_CROS_EC_KEYSCAN_COLS; i++)
     if (scan.data[i] ^ old_scan.data[i])
-      for (j = 0; j < CROS_EC_KEYSCAN_ROWS; j++)
+      for (j = 0; j < GRUB_CROS_EC_KEYSCAN_ROWS; j++)
        if ((scan.data[i] ^ old_scan.data[i]) & (1 << j))
          {
            grub_uint8_t code = map_code[i][j];
@@ -93,7 +93,8 @@ cros_attach(const struct grub_fdtbus_dev *dev __attribute__ ((unused)))
   if (keymap)
     {
       for (i = 0; i + 3 < keymap_size; i += 4)
-       if (keymap[i+1] < CROS_EC_KEYSCAN_COLS && keymap[i] < CROS_EC_KEYSCAN_ROWS && keymap[i+2] == 0 && keymap[i+3] < 0x80)
+       if (keymap[i+1] < GRUB_CROS_EC_KEYSCAN_COLS && keymap[i] < GRUB_CROS_EC_KEYSCAN_ROWS
+           && keymap[i+2] == 0 && keymap[i+3] < 0x80)
          map_code[keymap[i+1]][keymap[i]] = keymap[i+3];
     }
 
index ce58e6c56e7c12560993d58304b6dc58ae134056..49d7b401a86f49b6de36fc368629fc0b82ac1598 100644 (file)
@@ -21,7 +21,7 @@
 #include <grub/mm.h>
 #include <grub/time.h>
 #include <grub/misc.h>
-#include <grub/cros_ec.h>
+#include <grub/arm/cros_ec.h>
 
 static grub_uint64_t
 grub_get_time_us (void)
@@ -93,7 +93,7 @@ spi_stop (void)
 #define mdelay grub_millisleep
 #define memcpy grub_memcpy
 
-static const uint64_t FramingTimeoutMs = 300 * 1000;
+static const uint64_t FramingTimeoutUs = 300 * 1000;
 
 static const uint8_t EcFramingByte = 0xec;
 
@@ -249,7 +249,8 @@ static int ec_command(int cmd, int cmd_version,
        }
 
        // If the caller wants the response, copy it out for them.
-       din_len = MIN(din_len, length);
+       if (length < din_len)
+               din_len = length;
        if (din) {
                memcpy(din, (uint8_t *)busbuf + CROS_EC_SPI_IN_HDR_SIZE,
                       din_len);
index 7c8a940e8073d0048b08efbe2ad8cc69f5ea9082..3859fad75e29c2b6fede26669e9c48c1d8e38f94 100644 (file)
@@ -7,7 +7,7 @@
 #define GRUB_CROS_EC_KEYSCAN_ROWS 8
 
 struct grub_cros_ec_keyscan {
-       grub_uint8_t data[CROS_EC_KEYSCAN_COLS];
+       grub_uint8_t data[GRUB_CROS_EC_KEYSCAN_COLS];
 };
 
 int