From: Michal Simek <michal.simek@amd.com>
To: <u-boot@lists.denx.de>, <git@xilinx.com>
Subject: [PATCH v2 2/3] xilinx: board: Fix xilinx_eeprom_legacy_cleanup()
Date: Tue, 24 Jan 2023 16:19:27 +0100 [thread overview]
Message-ID: <2802cf1086b14c181356810006fe886f950a36f3.1674573561.git.michal.simek@amd.com> (raw)
In-Reply-To: <cover.1674573561.git.michal.simek@amd.com>
When ethernet mac address contains 0x20 or 0xff MAC address is changed and
bytes are converted to zeros. That's why fix decoding algorithm to ignore
fields where MAC address is stored and all non printable chars (including
space) are zeroed.
Signed-off-by: Michal Simek <michal.simek@amd.com>
---
(no changes since v1)
board/xilinx/common/board.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 6fc41e978669..8bcb54da88e7 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -101,9 +101,13 @@ static void xilinx_eeprom_legacy_cleanup(char *eeprom, int size)
for (i = 0; i < size; i++) {
byte = eeprom[i];
- /* Remove all ffs and spaces */
- if (byte == 0xff || byte == ' ')
+ /* Remove all non printable chars but ignore MAC address */
+ if ((i < offsetof(struct xilinx_legacy_format, eth_mac) ||
+ i >= offsetof(struct xilinx_legacy_format, unused1)) &&
+ (byte < '!' || byte > '~')) {
eeprom[i] = 0;
+ continue;
+ }
/* Convert strings to lower case */
if (byte >= 'A' && byte <= 'Z')
--
2.36.1
next prev parent reply other threads:[~2023-01-24 15:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 15:19 [PATCH v2 0/3] xilinx: board: Improve legacy format handling Michal Simek
2023-01-24 15:19 ` [PATCH v2 1/3] xilinx: board: Use ETH_ALEN macro for mac address size Michal Simek
2023-01-24 15:19 ` Michal Simek [this message]
2023-01-24 15:19 ` [PATCH v2 3/3] xilinx: board: Update logic in xilinx_read_eeprom_legacy Michal Simek
2023-01-27 14:50 ` [PATCH v2 0/3] xilinx: board: Improve legacy format handling Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2802cf1086b14c181356810006fe886f950a36f3.1674573561.git.michal.simek@amd.com \
--to=michal.simek@amd.com \
--cc=git@xilinx.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.