]> Git Repo - J-u-boot.git/blobdiff - cmd/efi.c
command: Remove the cmd_tbl_t typedef
[J-u-boot.git] / cmd / efi.c
index 6c1eb88424be054c56d26b90da72f3e637acc2c0..c7640c862e9313773a94cd614c27c618c4de9356 100644 (file)
--- a/cmd/efi.c
+++ b/cmd/efi.c
@@ -9,6 +9,7 @@
 #include <efi.h>
 #include <errno.h>
 #include <malloc.h>
+#include <sort.h>
 
 static const char *const type_name[] = {
        "reserved",
@@ -28,18 +29,21 @@ static const char *const type_name[] = {
 };
 
 static struct attr_info {
-       int shift;
+       u64 val;
        const char *name;
 } mem_attr[] = {
-       { EFI_MEMORY_UC_SHIFT, "uncached" },
-       { EFI_MEMORY_WC_SHIFT, "write-coalescing" },
-       { EFI_MEMORY_WT_SHIFT, "write-through" },
-       { EFI_MEMORY_WB_SHIFT, "write-back" },
-       { EFI_MEMORY_UCE_SHIFT, "uncached & exported" },
-       { EFI_MEMORY_WP_SHIFT, "write-protect" },
-       { EFI_MEMORY_RP_SHIFT, "read-protect" },
-       { EFI_MEMORY_XP_SHIFT, "execute-protect" },
-       { EFI_MEMORY_RUNTIME_SHIFT, "needs runtime mapping" }
+       { EFI_MEMORY_UC, "uncached" },
+       { EFI_MEMORY_WC, "write-coalescing" },
+       { EFI_MEMORY_WT, "write-through" },
+       { EFI_MEMORY_WB, "write-back" },
+       { EFI_MEMORY_UCE, "uncached & exported" },
+       { EFI_MEMORY_WP, "write-protect" },
+       { EFI_MEMORY_RP, "read-protect" },
+       { EFI_MEMORY_XP, "execute-protect" },
+       { EFI_MEMORY_NV, "non-volatile" },
+       { EFI_MEMORY_MORE_RELIABLE, "higher reliability" },
+       { EFI_MEMORY_RO, "read-only" },
+       { EFI_MEMORY_RUNTIME, "needs runtime mapping" }
 };
 
 /* Maximum different attribute values we can track */
@@ -170,10 +174,10 @@ static void efi_print_mem_table(struct efi_entry_memmap *map,
                bool first;
                int j;
 
-               printf("%c%llx: ", attr & EFI_MEMORY_RUNTIME ? 'r' : ' ',
+               printf("%c%llx: ", (attr & EFI_MEMORY_RUNTIME) ? 'r' : ' ',
                       attr & ~EFI_MEMORY_RUNTIME);
                for (j = 0, first = true; j < ARRAY_SIZE(mem_attr); j++) {
-                       if (attr & (1ULL << mem_attr[j].shift)) {
+                       if (attr & mem_attr[j].val) {
                                if (first)
                                        first = false;
                                else
@@ -187,7 +191,8 @@ static void efi_print_mem_table(struct efi_entry_memmap *map,
                printf("*Some areas are merged (use 'all' to see)\n");
 }
 
-static int do_efi_mem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_efi_mem(struct cmd_tbl *cmdtp, int flag, int argc,
+                     char *const argv[])
 {
        struct efi_mem_desc *desc;
        struct efi_entry_memmap *map;
@@ -227,13 +232,13 @@ done:
        return ret ? CMD_RET_FAILURE : 0;
 }
 
-static cmd_tbl_t efi_commands[] = {
+static struct cmd_tbl efi_commands[] = {
        U_BOOT_CMD_MKENT(mem, 1, 1, do_efi_mem, "", ""),
 };
 
-static int do_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_efi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-       cmd_tbl_t *efi_cmd;
+       struct cmd_tbl *efi_cmd;
        int ret;
 
        if (argc < 2)
This page took 0.024583 seconds and 4 git commands to generate.