1 /* SPDX-License-Identifier: GPL-2.0-only */
5 #if CONFIG(MODULE_NVRAM)
8 * Dump 256 bytes of NVRAM.
10 static void dump_nvram(WINDOW
*win
, int row
, int col
)
14 /* Print vertical and horizontal index numbers. */
15 for (i
= 0; i
< 16; i
++) {
16 mvwprintw(win
, ((i
< 8) ? 4 : 5) + i
, 1, "%2.2X ", i
* 0x10);
17 mvwprintw(win
, 2, 4 + (i
* 3), "%2.2X ", i
);
20 /* Print vertical and horizontal line. */
21 for (i
= 0; i
< 18; i
++)
22 mvwaddch(win
, 3 + i
, 3, ACS_VLINE
);
23 for (i
= 0; i
< 48; i
++)
24 mvwaddch(win
, 3, 3 + i
, (i
== 0) ? ACS_ULCORNER
: ACS_HLINE
);
26 /* Dump NVRAM contents. */
27 for (i
= 1; i
< 257; i
++) {
28 mvwprintw(win
, row
+ y
, col
+ x
, "%02x ", nvram_read(i
- 1));
31 y
++; /* Start a newline after 16 bytes. */
35 y
++; /* Add an empty line after 128 bytes. */
41 static int nvram_module_redraw(WINDOW
*win
)
43 print_module_title(win
, "NVRAM Dump");
44 dump_nvram(win
, 4, 4);
48 static int nvram_module_init(void)
53 struct coreinfo_module nvram_module
= {
55 .init
= nvram_module_init
,
56 .redraw
= nvram_module_redraw
,
61 struct coreinfo_module nvram_module
= {