diff options
author | Leah Rowe <leah@libreboot.org> | 2025-01-27 04:03:34 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-01-27 04:03:34 +0000 |
commit | 5ddf7f251d6eec465be7d659cb357576406b69ae (patch) | |
tree | dd00d77cb5d24a0b4ad1f037626100b23eb4fdc9 | |
parent | 8850acc7da6a37859258c14b72dad267b3714c20 (diff) |
util/nvmutil: make 128 (nvm area) a define
for code clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | util/nvmutil/nvmutil.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 8350504b..0ae964e2 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -26,6 +26,7 @@ uint8_t hextonum(char chs), rhex(void); #define MAC_ADDRESS argv[3] #define PARTN argv[3] #define NVM_CHECKSUM 0xBABA +#define NVM_SIZE 128 /* Area containing NVM words */ #define SIZE_8KB 0x2000 #define SIZE_16KB 0x4000 @@ -201,7 +202,7 @@ readGbe(void) if ((cmd == cmd_swap) || (cmd == cmd_copy)) nf = partsize; /* read/write the entire block */ else - nf = 128; /* only read/write the nvm part of the block */ + nf = NVM_SIZE; /* only read/write the nvm part of the block */ if ((cmd == cmd_copy) || (cmd == cmd_setchecksum) || (cmd == cmd_brick)) do_read[part ^ 1] = 0; /* only read the user-specified part */ @@ -437,6 +438,6 @@ swap(int partnum) /* swaps bytes in words, not pointers. */ size_t w, x; uint8_t *n = (uint8_t *) gbe[partnum]; - for (w = nf * ((uint8_t *) &e)[0], x = 1; w < 128; w += 2, x += 2) + for (w = nf * ((uint8_t *) &e)[0], x = 1; w < NVM_SIZE; w += 2, x += 2) n[w] ^= n[x], n[x] ^= n[w], n[w] ^= n[x]; } |