MCPcopy Create free account
hub / github.com/coreboot/coreboot / dump_nvram

Function dump_nvram

payloads/coreinfo/nvram_module.c:10–39  ·  view source on GitHub ↗

* Dump 256 bytes of NVRAM. */

Source from the content-addressed store, hash-verified

8 * Dump 256 bytes of NVRAM.
9 */
10static void dump_nvram(WINDOW *win, int row, int col)
11{
12 int i, x = 0, y = 0;
13
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);
18 }
19
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);
25
26 /* Dump NVRAM contents. */
27 for (i = 1; i < 257; i++) {
28 mvwprintw(win, row + y, col + x, "%02x ", nvram_read(i - 1));
29 x += 3;
30 if (i % 16 == 0) {
31 y++; /* Start a newline after 16 bytes. */
32 x = 0;
33 }
34 if (i % 128 == 0) {
35 y++; /* Add an empty line after 128 bytes. */
36 x = 0;
37 }
38 }
39}
40
41static int nvram_module_redraw(WINDOW *win)
42{

Callers 1

nvram_module_redrawFunction · 0.85

Calls 3

mvwaddchFunction · 0.85
nvram_readFunction · 0.85
mvwprintwFunction · 0.50

Tested by

no test coverage detected