u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
To: "Michal Simek" <michal.simek@amd.com>,
	"Ovidiu Panait" <ovidiu.panait@windriver.com>,
	"Simon Glass" <sjg@chromium.org>,
	"Mario Six" <mario.six@gdsys.cc>,
	"Masahisa Kojima" <masahisa.kojima@linaro.org>,
	"Pali Rohár" <pali@kernel.org>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Ashok Reddy Soma" <ashok.reddy.soma@xilinx.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Huang Jianan" <jnhuang95@gmail.com>,
	"Chris Morgan" <macromorgan@hotmail.com>,
	"Roland Gaudig" <roland.gaudig@weidmueller.com>,
	"Patrick Delaunay" <patrick.delaunay@foss.st.com>,
	"Alexandru Gagniuc" <mr.nuke.me@gmail.com>
Cc: "Jamie Iles" <quic_jiles@quicinc.com>,
	"Graeme Gregory" <quic_ggregory@quicinc.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Jae Hyun Yoo" <quic_jaehyoo@quicinc.com>,
	u-boot@lists.denx.de
Subject: [PATCH v3 2/7] cmd: fru: move FRU handling support to common region
Date: Tue, 23 Aug 2022 14:52:55 -0700	[thread overview]
Message-ID: <20220823215300.1485789-3-quic_jaehyoo@quicinc.com> (raw)
In-Reply-To: <20220823215300.1485789-1-quic_jaehyoo@quicinc.com>

From: Graeme Gregory <quic_ggregory@quicinc.com>

The FRU handling was added as a Xilinx board dependent support but it
is also useful for other boards too, so this commit moves the FRU
handling support to the common region so that it can be enabled by
CONFIG_CMD_FRU.

Signed-off-by: Graeme Gregory <quic_ggregory@quicinc.com>
Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
---
Changes from v2:
 * None.

Changes from v1:
 * Split out the custom field and multi-record handling part as a
   seperate patch. (Michal)
 * Moved fru_ops.c to lib. (Heinrich)
 * Added what does FRU stand for. (Heinrich)

Changes from RFC:
 * Made FRU typecode string table as a generic and sharable table. (Michal)
 * Made OEM multirecord parsing call happen only on customizable type IDs.
   (Michal)
 * Added manufacturer custom board info fields parsing flow. (Michal)

 board/xilinx/Kconfig                   | 8 --------
 board/xilinx/common/Makefile           | 3 ---
 board/xilinx/common/board.c            | 3 +--
 cmd/Kconfig                            | 8 ++++++++
 cmd/Makefile                           | 1 +
 {board/xilinx/common => cmd}/fru.c     | 3 +--
 {board/xilinx/common => include}/fru.h | 0
 lib/Makefile                           | 1 +
 {board/xilinx/common => lib}/fru_ops.c | 3 +--
 9 files changed, 13 insertions(+), 17 deletions(-)
 rename {board/xilinx/common => cmd}/fru.c (99%)
 rename {board/xilinx/common => include}/fru.h (100%)
 rename {board/xilinx/common => lib}/fru_ops.c (99%)

diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig
index 17880661736d..110706b20fa3 100644
--- a/board/xilinx/Kconfig
+++ b/board/xilinx/Kconfig
@@ -74,11 +74,3 @@ config ZYNQ_GEM_I2C_MAC_OFFSET
 	  Set the MAC offset for i2C.
 
 endif
-
-config CMD_FRU
-	bool "FRU information for product"
-	help
-	  This option enables FRU commands to capture and display FRU
-	  information present in the device. The FRU Information is used
-	  to primarily to provide "inventory" information about the boards
-	  that the FRU Information Device is located on.
diff --git a/board/xilinx/common/Makefile b/board/xilinx/common/Makefile
index cdc3c9677432..e33baaae1159 100644
--- a/board/xilinx/common/Makefile
+++ b/board/xilinx/common/Makefile
@@ -8,6 +8,3 @@ obj-y	+= board.o
 ifndef CONFIG_ARCH_ZYNQ
 obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o
 endif
-ifndef CONFIG_SPL_BUILD
-obj-$(CONFIG_CMD_FRU) += fru.o fru_ops.o
-endif
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index e979f0176273..e58b11d7f757 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -8,6 +8,7 @@
 #include <efi.h>
 #include <efi_loader.h>
 #include <env.h>
+#include <fru.h>
 #include <log.h>
 #include <asm/global_data.h>
 #include <asm/sections.h>
@@ -25,8 +26,6 @@
 #include <linux/kernel.h>
 #include <uuid.h>
 
-#include "fru.h"
-
 #if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
 struct efi_fw_image fw_images[] = {
 #if defined(XILINX_BOOT_IMAGE_GUID)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 211ebe9c8783..29b2e11e1247 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1063,6 +1063,14 @@ config CMD_FPGAD
 	  fpga_get_reg() function. This functions similarly to the 'md'
 	  command.
 
+config CMD_FRU
+	bool "FRU information for product"
+	help
+	  This option enables FRU (Field Replaceable Unit) commands to capture
+	  and display FRU information present in the device. The FRU Information
+	  is used to primarily to provide "inventory" information about the
+	  boards that the FRU Information Device is located on.
+
 config CMD_FUSE
 	bool "fuse - support for the fuse subssystem"
 	help
diff --git a/cmd/Makefile b/cmd/Makefile
index 6e87522b62e8..58e353611a5a 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -74,6 +74,7 @@ obj-$(CONFIG_CMD_SQUASHFS) += sqfs.o
 obj-$(CONFIG_CMD_FLASH) += flash.o
 obj-$(CONFIG_CMD_FPGA) += fpga.o
 obj-$(CONFIG_CMD_FPGAD) += fpgad.o
+obj-$(CONFIG_CMD_FRU) += fru.o
 obj-$(CONFIG_CMD_FS_GENERIC) += fs.o
 obj-$(CONFIG_CMD_FUSE) += fuse.o
 obj-$(CONFIG_CMD_GETTIME) += gettime.o
diff --git a/board/xilinx/common/fru.c b/cmd/fru.c
similarity index 99%
rename from board/xilinx/common/fru.c
rename to cmd/fru.c
index 0d72911df04d..2ec5012af5ac 100644
--- a/board/xilinx/common/fru.c
+++ b/cmd/fru.c
@@ -7,10 +7,9 @@
 #include <common.h>
 #include <command.h>
 #include <fdtdec.h>
+#include <fru.h>
 #include <malloc.h>
 
-#include "fru.h"
-
 static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc,
 			  char *const argv[])
 {
diff --git a/board/xilinx/common/fru.h b/include/fru.h
similarity index 100%
rename from board/xilinx/common/fru.h
rename to include/fru.h
diff --git a/lib/Makefile b/lib/Makefile
index e3deb1528794..ef8933ae3aee 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -39,6 +39,7 @@ obj-y += crc16-ccitt.o
 obj-$(CONFIG_ERRNO_STR) += errno_str.o
 obj-$(CONFIG_FIT) += fdtdec_common.o
 obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
+obj-$(CONFIG_CMD_FRU) += fru_ops.o
 obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
 obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
 obj-$(CONFIG_SMBIOS_PARSER) += smbios-parser.o
diff --git a/board/xilinx/common/fru_ops.c b/lib/fru_ops.c
similarity index 99%
rename from board/xilinx/common/fru_ops.c
rename to lib/fru_ops.c
index e005ecae21fa..c0360f219c37 100644
--- a/board/xilinx/common/fru_ops.c
+++ b/lib/fru_ops.c
@@ -7,14 +7,13 @@
 #include <common.h>
 #include <env.h>
 #include <fdtdec.h>
+#include <fru.h>
 #include <hexdump.h>
 #include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <linux/compat.h>
 
-#include "fru.h"
-
 struct fru_table fru_data __section(".data") = {
 	.brd.custom_fields = LIST_HEAD_INIT(fru_data.brd.custom_fields),
 	.multi_recs = LIST_HEAD_INIT(fru_data.multi_recs),
-- 
2.25.1


  parent reply	other threads:[~2022-08-23 21:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 21:52 [PATCH v3 0/7] cmd/fru: move FRU handling support to common region Jae Hyun Yoo
2022-08-23 21:52 ` [PATCH v3 1/7] xilinx: common: refactor FRU handling support Jae Hyun Yoo
2022-08-23 21:52 ` Jae Hyun Yoo [this message]
2022-08-23 21:52 ` [PATCH v3 3/7] cmd: fru: fix a sandbox segfault issue Jae Hyun Yoo
2022-08-23 21:52 ` [PATCH v3 4/7] cmd: fru: add product info area parsing support Jae Hyun Yoo
2022-08-25  1:25   ` Simon Glass
2022-08-25 14:33     ` Jae Hyun Yoo
2022-08-25 15:08       ` Simon Glass
2022-08-23 21:52 ` [PATCH v3 5/7] doc: fru: add documentation for the fru command and APIs Jae Hyun Yoo
2022-08-23 21:52 ` [PATCH v3 6/7] test: py: fru: add a test for the fru command Jae Hyun Yoo
2022-08-25  1:25   ` Simon Glass
2022-08-25 14:35     ` Jae Hyun Yoo
2022-08-23 21:53 ` [PATCH v3 7/7] test: cmd: fru: add unit " Jae Hyun Yoo
2022-08-25  1:25   ` Simon Glass
2022-08-25 14:34     ` Jae Hyun Yoo

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=20220823215300.1485789-3-quic_jaehyoo@quicinc.com \
    --to=quic_jaehyoo@quicinc.com \
    --cc=ashok.reddy.soma@xilinx.com \
    --cc=clg@kaod.org \
    --cc=jnhuang95@gmail.com \
    --cc=macromorgan@hotmail.com \
    --cc=mario.six@gdsys.cc \
    --cc=masahisa.kojima@linaro.org \
    --cc=michal.simek@amd.com \
    --cc=mr.nuke.me@gmail.com \
    --cc=ovidiu.panait@windriver.com \
    --cc=pali@kernel.org \
    --cc=patrick.delaunay@foss.st.com \
    --cc=quic_ggregory@quicinc.com \
    --cc=quic_jiles@quicinc.com \
    --cc=roland.gaudig@weidmueller.com \
    --cc=sjg@chromium.org \
    --cc=thuth@redhat.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).