diff mbox series

[v5,07/12] smbios: Require the caller to align the SMBIOS table

Message ID 20231231152555.464874-8-sjg@chromium.org
State Accepted
Commit 31f950a963a382d48193ecd79698f795b7603846
Delegated to: Simon Glass
Headers show
Series smbios: Deal with tables beyond 4GB | expand

Commit Message

Simon Glass Dec. 31, 2023, 3:25 p.m. UTC
All callers handle this alignment, so drop the unnecessary code. This
simplifies things a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---

Changes in v5:
- Update comment to mention x86 alignment

 include/smbios.h | 9 +++++----
 lib/smbios.c     | 2 --
 2 files changed, 5 insertions(+), 6 deletions(-)

Comments

Simon Glass Jan. 8, 2024, 12:16 a.m. UTC | #1
All callers handle this alignment, so drop the unnecessary code. This
simplifies things a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---

Changes in v5:
- Update comment to mention x86 alignment

 include/smbios.h | 9 +++++----
 lib/smbios.c     | 2 --
 2 files changed, 5 insertions(+), 6 deletions(-)

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/include/smbios.h b/include/smbios.h
index 77be58887a2..49de32fec2d 100644
--- a/include/smbios.h
+++ b/include/smbios.h
@@ -258,12 +258,13 @@  static inline void fill_smbios_header(void *table, int type,
  *
  * This writes SMBIOS table at a given address.
  *
- * @addr:	start address to write SMBIOS table. If this is not
- *		16-byte-aligned then it will be aligned before the table is
- *		written.
+ * @addr:	start address to write SMBIOS table, 16-byte-alignment
+ * recommended. Note that while the SMBIOS tables themself have no alignment
+ * requirement, some systems may requires alignment. For example x86 systems
+ * which put tables at f0000 require 16-byte alignment
+ *
  * Return:	end address of SMBIOS table (and start address for next entry)
  *		or NULL in case of an error
- *
  */
 ulong write_smbios_table(ulong addr);
 
diff --git a/lib/smbios.c b/lib/smbios.c
index 7f79d969c92..cfd451e4088 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -563,8 +563,6 @@  ulong write_smbios_table(ulong addr)
 		ctx.dev = NULL;
 	}
 
-	/* 16 byte align the table address */
-	addr = ALIGN(addr, 16);
 	start_addr = addr;
 
 	/*