Blame view
cmd/blkcache.c
1.9 KB
83d290c56 SPDX: Convert all... |
1 |
// SPDX-License-Identifier: GPL-2.0+ |
e40cf34a2 drivers: block: a... |
2 3 4 5 |
/* * Copyright (C) Nelson Integration, LLC 2016 * Author: Eric Nelson<eric@nelint.com> * |
e40cf34a2 drivers: block: a... |
6 7 8 9 10 11 12 13 14 15 16 |
*/ #include <config.h> #include <common.h> #include <malloc.h> #include <part.h> static int blkc_show(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct block_cache_stats stats; blkcache_stats(&stats); |
7e8721467 cmd: blkcache: re... |
17 18 19 20 21 22 23 24 25 26 |
printf("hits: %u " "misses: %u " "entries: %u " "max blocks/entry: %u " "max cache entries: %u ", |
e40cf34a2 drivers: block: a... |
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
stats.hits, stats.misses, stats.entries, stats.max_blocks_per_entry, stats.max_entries); return 0; } static int blkc_configure(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned blocks_per_entry, max_entries; if (argc != 3) return CMD_RET_USAGE; blocks_per_entry = simple_strtoul(argv[1], 0, 0); max_entries = simple_strtoul(argv[2], 0, 0); blkcache_configure(blocks_per_entry, max_entries); printf("changed to max of %u entries of %u blocks each ", max_entries, blocks_per_entry); return 0; } static cmd_tbl_t cmd_blkc_sub[] = { U_BOOT_CMD_MKENT(show, 0, 0, blkc_show, "", ""), U_BOOT_CMD_MKENT(configure, 3, 0, blkc_configure, "", ""), }; static __maybe_unused void blkc_reloc(void) { static int relocated; if (!relocated) { fixup_cmdtable(cmd_blkc_sub, ARRAY_SIZE(cmd_blkc_sub)); relocated = 1; }; } static int do_blkcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { cmd_tbl_t *c; #ifdef CONFIG_NEEDS_MANUAL_RELOC blkc_reloc(); #endif if (argc < 2) return CMD_RET_USAGE; /* Strip off leading argument */ argc--; argv++; c = find_cmd_tbl(argv[0], &cmd_blkc_sub[0], ARRAY_SIZE(cmd_blkc_sub)); |
195c94a24 cmd: blkcache: si... |
79 |
if (!c) |
e40cf34a2 drivers: block: a... |
80 |
return CMD_RET_USAGE; |
195c94a24 cmd: blkcache: si... |
81 |
return c->cmd(cmdtp, flag, argc, argv); |
e40cf34a2 drivers: block: a... |
82 83 84 85 86 87 88 89 90 91 |
} U_BOOT_CMD( blkcache, 4, 0, do_blkcache, "block cache diagnostics and control", "show - show and reset statistics " "blkcache configure blocks entries " ); |