Skip to contentSkip to conversation

disk: update to use SPL_PARTITIONS for SPL

PATCH New Kever Yang 2 participants 6 messages Aug 15, 2019 – Dec 3, 2019

Subsystems (2)
lore
Share & tools
lore

Kever Yang

author
#0 lore raw

PATCH v4 1/2 disk: update to use SPL_PARTITIONS for SPL

The SPL disk driver can not depends on SPL_FRAMEWORK & PARTITIONS, which will enable the disk driver when we actually not need it. Use a separate Kconfig to control the partition driver in SPL and fix the issue caused by:

Fixes 91ff686562 ("blk: Rework guard around part_init call")

---

Changes in v4:
- format the commit message to ~75 columns.

Changes in v3:
- update code in blk-uclass.c

Changes in v2:
- add this patch

 common/spl/Kconfig         |  2 +-
 disk/Kconfig               | 20 ++++++++++++--------
 disk/Makefile              |  2 +-
 drivers/block/blk-uclass.c |  2 +-
 scripts/Makefile.spl       |  2 +-
 5 files changed, 16 insertions(+), 12 deletions(-)
common/spl/Kconfig +1 -1
index 5978fb2934..094680e54d 100644
@@ -544,7 +544,7 @@ config SPL_LIBCOMMON_SUPPORT
 
 config SPL_LIBDISK_SUPPORT
 	bool "Support disk partitions"
-	select PARTITIONS
+	select SPL_PARTITIONS
 	help
 	  Enable support for disk partitions within SPL. 'Disk' is something
 	  of a misnomer as it includes non-spinning media such as flash (as
disk/Kconfig +12 -8
index 28fb81c2ee..43e76cb49d 100644
@@ -4,9 +4,7 @@ menu "Partition Types"
 config PARTITIONS
 	bool "Enable Partition Labels (disklabels) support"
 	default y
-	select SPL_SPRINTF if SPL
 	select TPL_SPRINTF if TPL
-	select SPL_STRTO if SPL
 	select TPL_STRTO if TPL
 	help
 	  Partition Labels (disklabels) Supported:
@@ -23,6 +21,12 @@ config PARTITIONS
 	  you must configure support for at least one non-MTD partition type
 	  as well.
 
+config SPL_PARTITIONS
+	select SPL_SPRINTF
+	select SPL_STRTO
+	bool "Enable Partition Labels (disklabels) support for SPL"
+	depends on SPL
+
 config MAC_PARTITION
 	bool "Enable Apple's MacOS partition table"
 	depends on PARTITIONS
@@ -32,7 +36,7 @@ config MAC_PARTITION
 
 config SPL_MAC_PARTITION
 	bool "Enable Apple's MacOS partition table for SPL"
-	depends on SPL && PARTITIONS
+	depends on SPL_PARTITIONS
 	default y if MAC_PARTITION
 
 config DOS_PARTITION
@@ -45,7 +49,7 @@ config DOS_PARTITION
 
 config SPL_DOS_PARTITION
 	bool "Enable MS Dos partition table for SPL"
-	depends on SPL && PARTITIONS
+	depends on SPL_PARTITIONS
 	default y if DOS_PARTITION
 
 config ISO_PARTITION
@@ -56,7 +60,7 @@ config ISO_PARTITION
 
 config SPL_ISO_PARTITION
 	bool "Enable ISO partition table for SPL"
-	depends on SPL && PARTITIONS
+	depends on SPL_PARTITIONS
 
 config AMIGA_PARTITION
 	bool "Enable AMIGA partition table"
@@ -67,7 +71,7 @@ config AMIGA_PARTITION
 
 config SPL_AMIGA_PARTITION
 	bool "Enable AMIGA partition table for SPL"
-	depends on SPL && PARTITIONS
+	depends on SPL_PARTITIONS
 	default y if AMIGA_PARTITION
 
 config EFI_PARTITION
@@ -111,7 +115,7 @@ config EFI_PARTITION_ENTRIES_OFF
 
 config SPL_EFI_PARTITION
 	bool "Enable EFI GPT partition table for SPL"
-	depends on  SPL && PARTITIONS
+	depends on  SPL_PARTITIONS
 	default y if EFI_PARTITION
 
 config PARTITION_UUIDS
@@ -125,7 +129,7 @@ config PARTITION_UUIDS
 
 config SPL_PARTITION_UUIDS
 	bool "Enable support of UUID for partition in SPL"
-	depends on SPL && PARTITIONS
+	depends on SPL_PARTITIONS
 	default y if SPL_EFI_PARTITION
 
 config PARTITION_TYPE_GUID
disk/Makefile +1 -1
index ccd0335959..92fcc2b4ac 100644
@@ -5,7 +5,7 @@
 
 #ccflags-y += -DET_DEBUG -DDEBUG
 
-obj-$(CONFIG_PARTITIONS) 	+= part.o
+obj-$(CONFIG_$(SPL_)PARTITIONS)      += part.o
 obj-$(CONFIG_$(SPL_)MAC_PARTITION)   += part_mac.o
 obj-$(CONFIG_$(SPL_)DOS_PARTITION)   += part_dos.o
 obj-$(CONFIG_$(SPL_)ISO_PARTITION)   += part_iso.o
drivers/block/blk-uclass.c +1 -1
index c23b6682a6..425ec3259f 100644
@@ -649,7 +649,7 @@ int blk_unbind_all(int if_type)
 
 static int blk_post_probe(struct udevice *dev)
 {
-#if defined(CONFIG_PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
+#if CONFIG_IS_ENABLED(PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
 	struct blk_desc *desc = dev_get_uclass_platdata(dev);
 
 	part_init(desc);
scripts/Makefile.spl +1 -1
index 7af6b120b6..3535978634 100644
@@ -82,7 +82,7 @@ else
 libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ env/
 libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 ifdef CONFIG_SPL_FRAMEWORK
-libs-$(CONFIG_PARTITIONS) += disk/
+libs-$(CONFIG_SPL_PARTITIONS) += disk/
 endif
 endif
 
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v4 1/2 disk: update to use SPL_PARTITIONS for SPL

Hi Tom, Simon
ping...
Is it OK to merge this patch?

Thanks
- Kever

Quoted 164 lines · Kever Yang <[email protected]> 于2019年8月15日周四 下午4:32写道:

The SPL disk driver can not depends on SPL_FRAMEWORK & PARTITIONS, which will enable the disk driver when we actually not need it. Use a separate Kconfig to control the partition driver in SPL and fix the issue caused by:

Fixes 91ff686562 ("blk: Rework guard around part_init call")

---

Changes in v4:
- format the commit message to ~75 columns.

Changes in v3:
- update code in blk-uclass.c

Changes in v2:
- add this patch

 common/spl/Kconfig         |  2 +-
 disk/Kconfig               | 20 ++++++++++++--------
 disk/Makefile              |  2 +-
 drivers/block/blk-uclass.c |  2 +-
 scripts/Makefile.spl       |  2 +-
 5 files changed, 16 insertions(+), 12 deletions(-)
common/spl/Kconfig +1 -1
index 5978fb2934..094680e54d 100644
@@ -544,7 +544,7 @@ config SPL_LIBCOMMON_SUPPORT
 
 config SPL_LIBDISK_SUPPORT
        bool "Support disk partitions"
-       select PARTITIONS
+       select SPL_PARTITIONS
        help
          Enable support for disk partitions within SPL. 'Disk' is

something
of a misnomer as it includes non-spinning media such as flash (as

disk/Kconfig +0 -2
index 28fb81c2ee..43e76cb49d 100644
@@ -4,9 +4,7 @@ menu "Partition Types"
 config PARTITIONS
        bool "Enable Partition Labels (disklabels) support"
        default y
-       select SPL_SPRINTF if SPL
        select TPL_SPRINTF if TPL
-       select SPL_STRTO if SPL
        select TPL_STRTO if TPL
        help
          Partition Labels (disklabels) Supported:
@@ -23,6 +21,12 @@ config PARTITIONS
          you must configure support for at least one non-MTD partition

type
as well.

disk/Kconfig +12 -6
+config SPL_PARTITIONS
+       select SPL_SPRINTF
+       select SPL_STRTO
+       bool "Enable Partition Labels (disklabels) support for SPL"
+       depends on SPL
+
 config MAC_PARTITION
        bool "Enable Apple's MacOS partition table"
        depends on PARTITIONS
@@ -32,7 +36,7 @@ config MAC_PARTITION
 
 config SPL_MAC_PARTITION
        bool "Enable Apple's MacOS partition table for SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
        default y if MAC_PARTITION
 
 config DOS_PARTITION
@@ -45,7 +49,7 @@ config DOS_PARTITION
 
 config SPL_DOS_PARTITION
        bool "Enable MS Dos partition table for SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
        default y if DOS_PARTITION
 
 config ISO_PARTITION
@@ -56,7 +60,7 @@ config ISO_PARTITION
 
 config SPL_ISO_PARTITION
        bool "Enable ISO partition table for SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
 
 config AMIGA_PARTITION
        bool "Enable AMIGA partition table"
@@ -67,7 +71,7 @@ config AMIGA_PARTITION
 
 config SPL_AMIGA_PARTITION
        bool "Enable AMIGA partition table for SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
        default y if AMIGA_PARTITION
 
 config EFI_PARTITION
@@ -111,7 +115,7 @@ config EFI_PARTITION_ENTRIES_OFF
 
 config SPL_EFI_PARTITION
        bool "Enable EFI GPT partition table for SPL"
-       depends on  SPL && PARTITIONS
+       depends on  SPL_PARTITIONS
        default y if EFI_PARTITION
 
 config PARTITION_UUIDS
@@ -125,7 +129,7 @@ config PARTITION_UUIDS
 
 config SPL_PARTITION_UUIDS
        bool "Enable support of UUID for partition in SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
        default y if SPL_EFI_PARTITION
 
 config PARTITION_TYPE_GUID
disk/Makefile +1 -1
index ccd0335959..92fcc2b4ac 100644
@@ -5,7 +5,7 @@
 
 #ccflags-y += -DET_DEBUG -DDEBUG
 
-obj-$(CONFIG_PARTITIONS)       += part.o
+obj-$(CONFIG_$(SPL_)PARTITIONS)      += part.o
 obj-$(CONFIG_$(SPL_)MAC_PARTITION)   += part_mac.o
 obj-$(CONFIG_$(SPL_)DOS_PARTITION)   += part_dos.o
 obj-$(CONFIG_$(SPL_)ISO_PARTITION)   += part_iso.o
drivers/block/blk-uclass.c +1 -1
index c23b6682a6..425ec3259f 100644
@@ -649,7 +649,7 @@ int blk_unbind_all(int if_type)
 
 static int blk_post_probe(struct udevice *dev)
 {
-#if defined(CONFIG_PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
+#if CONFIG_IS_ENABLED(PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
        struct blk_desc *desc = dev_get_uclass_platdata(dev);
 
        part_init(desc);
scripts/Makefile.spl +1 -2
index 7af6b120b6..3535978634 100644
@@ -82,7 +82,7 @@ else
 libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ env/
 libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 ifdef CONFIG_SPL_FRAMEWORK
-libs-$(CONFIG_PARTITIONS) += disk/
+libs-$(CONFIG_SPL_PARTITIONS) += disk/
 endif
 endif
 
--

2.17.1

#2 lore raw

PATCH v4 1/2 disk: update to use SPL_PARTITIONS for SPL

Quoted 155 lines · Kever Yang

Hi Tom, Simon
ping...
Is it OK to merge this patch?

Thanks
- Kever

Quoted 146 lines · Kever Yang <[email protected]> 于2019年8月15日周四 下午4:32写道:

The SPL disk driver can not depends on SPL_FRAMEWORK & PARTITIONS, which will enable the disk driver when we actually not need it. Use a separate Kconfig to control the partition driver in SPL and fix the issue caused by:

Fixes 91ff686562 ("blk: Rework guard around part_init call")

---

Changes in v4:
- format the commit message to ~75 columns.

Changes in v3:
- update code in blk-uclass.c

Changes in v2:
- add this patch

 common/spl/Kconfig         |  2 +-
 disk/Kconfig               | 20 ++++++++++++--------
 disk/Makefile              |  2 +-
 drivers/block/blk-uclass.c |  2 +-
 scripts/Makefile.spl       |  2 +-
 5 files changed, 16 insertions(+), 12 deletions(-)
common/spl/Kconfig +1 -1
index 5978fb2934..094680e54d 100644
@@ -544,7 +544,7 @@ config SPL_LIBCOMMON_SUPPORT
 
 config SPL_LIBDISK_SUPPORT
        bool "Support disk partitions"
-       select PARTITIONS
+       select SPL_PARTITIONS
        help
          Enable support for disk partitions within SPL. 'Disk' is

something
of a misnomer as it includes non-spinning media such as flash (as

disk/Kconfig +0 -2
index 28fb81c2ee..43e76cb49d 100644
@@ -4,9 +4,7 @@ menu "Partition Types"
 config PARTITIONS
        bool "Enable Partition Labels (disklabels) support"
        default y
-       select SPL_SPRINTF if SPL
        select TPL_SPRINTF if TPL
-       select SPL_STRTO if SPL
        select TPL_STRTO if TPL
        help
          Partition Labels (disklabels) Supported:
@@ -23,6 +21,12 @@ config PARTITIONS
          you must configure support for at least one non-MTD partition

type
as well.

disk/Kconfig +12 -6
+config SPL_PARTITIONS
+       select SPL_SPRINTF
+       select SPL_STRTO
+       bool "Enable Partition Labels (disklabels) support for SPL"
+       depends on SPL
+
 config MAC_PARTITION
        bool "Enable Apple's MacOS partition table"
        depends on PARTITIONS
@@ -32,7 +36,7 @@ config MAC_PARTITION
 
 config SPL_MAC_PARTITION
        bool "Enable Apple's MacOS partition table for SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
        default y if MAC_PARTITION
 
 config DOS_PARTITION
@@ -45,7 +49,7 @@ config DOS_PARTITION
 
 config SPL_DOS_PARTITION
        bool "Enable MS Dos partition table for SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
        default y if DOS_PARTITION
 
 config ISO_PARTITION
@@ -56,7 +60,7 @@ config ISO_PARTITION
 
 config SPL_ISO_PARTITION
        bool "Enable ISO partition table for SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
 
 config AMIGA_PARTITION
        bool "Enable AMIGA partition table"
@@ -67,7 +71,7 @@ config AMIGA_PARTITION
 
 config SPL_AMIGA_PARTITION
        bool "Enable AMIGA partition table for SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
        default y if AMIGA_PARTITION
 
 config EFI_PARTITION
@@ -111,7 +115,7 @@ config EFI_PARTITION_ENTRIES_OFF
 
 config SPL_EFI_PARTITION
        bool "Enable EFI GPT partition table for SPL"
-       depends on  SPL && PARTITIONS
+       depends on  SPL_PARTITIONS
        default y if EFI_PARTITION
 
 config PARTITION_UUIDS
@@ -125,7 +129,7 @@ config PARTITION_UUIDS
 
 config SPL_PARTITION_UUIDS
        bool "Enable support of UUID for partition in SPL"
-       depends on SPL && PARTITIONS
+       depends on SPL_PARTITIONS
        default y if SPL_EFI_PARTITION
 
 config PARTITION_TYPE_GUID
disk/Makefile +1 -1
index ccd0335959..92fcc2b4ac 100644
@@ -5,7 +5,7 @@
 
 #ccflags-y += -DET_DEBUG -DDEBUG
 
-obj-$(CONFIG_PARTITIONS)       += part.o
+obj-$(CONFIG_$(SPL_)PARTITIONS)      += part.o
 obj-$(CONFIG_$(SPL_)MAC_PARTITION)   += part_mac.o
 obj-$(CONFIG_$(SPL_)DOS_PARTITION)   += part_dos.o
 obj-$(CONFIG_$(SPL_)ISO_PARTITION)   += part_iso.o
drivers/block/blk-uclass.c +1 -1
index c23b6682a6..425ec3259f 100644
@@ -649,7 +649,7 @@ int blk_unbind_all(int if_type)
 
 static int blk_post_probe(struct udevice *dev)
 {
-#if defined(CONFIG_PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
+#if CONFIG_IS_ENABLED(PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
        struct blk_desc *desc = dev_get_uclass_platdata(dev);
 
Quoted 13 lines

scripts/Makefile.spl else · line 87

Quoted 13 lines
drivers/block/blk-uclass.c +0 -0
        part_init(desc);
scripts/Makefile.spl +1 -1
index 7af6b120b6..3535978634 100644
@@ -82,7 +82,7 @@ else
 libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ env/
 libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 ifdef CONFIG_SPL_FRAMEWORK
-libs-$(CONFIG_PARTITIONS) += disk/
+libs-$(CONFIG_SPL_PARTITIONS) += disk/
 endif
 endif

This and 2/2 need to be checked (possibly again) for unexpected size growth.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191202/fd363b5b/attachment.sig>
author
#3 lore raw

PATCH v4 1/2 disk: update to use SPL_PARTITIONS for SPL

Hi Tom,

Quoted 2 lines · Tom Rini

This and 2/2 need to be checked (possibly again) for unexpected size growth.

This patches should only affect those boards with SPL_LIBDISK_SUPPORT enabled,
If this MACRO is enabled, the board wants to use partition, and all the related source code are needed,
there should be no difference for this kind of boards.
If the size is overflow with this patch, that means the board does not have a complete partition driver
support,  eg. none of partition like SPL_EFI_PARTITION is selected, we should remove
SPL_LIBDISK_SUPPORT for this kind of boards.

How can I check boards has size overflow? these two patch can pass the travis test.

Thanks,
- Kever

author
#4 lore raw

PATCH v4 2/2 part: always enable part_get_info_ptr() for driver

In reply to Kever Yang

The partition driver has its Kconfig option, and the part_get_info_prt() interface are mendatory interface for partition drivers, always enable the macro to make partition driver works correctly.

---

Changes in v4:
- formate commit message to ~75 columns

Changes in v3: None
Changes in v2:
- add patch to use SPL_PARTITIONS so that we don't add disk driver for boards who don't need it.

 include/part.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
include/part.h +2 -9
index ebca546db5..7d00fae56f 100644
@@ -241,22 +241,15 @@ static inline int blk_get_device_part_str(const char *ifname,
 #endif
 
 /*
- * We don't support printing partition information in SPL and only support
- * getting partition information in a few cases.
+ * We don't support printing partition information in SPL
  */
 #ifdef CONFIG_SPL_BUILD
 # define part_print_ptr(x)	NULL
-# if defined(CONFIG_SPL_FS_EXT4) || defined(CONFIG_SPL_FS_FAT) || \
-	defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION)
-#  define part_get_info_ptr(x)	x
-# else
-#  define part_get_info_ptr(x)	NULL
-# endif
 #else
 #define part_print_ptr(x)	x
-#define part_get_info_ptr(x)	x
 #endif
 
+#define part_get_info_ptr(x)	x
 
 struct part_driver {
 	const char *name;
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH v4 2/2 part: always enable part_get_info_ptr() for driver

Hi Tom, Simon,

Is there anything I need to update for this patch?

Thanks,
- Kever

Quoted 52 lines · Kever Yang <[email protected]> 于2019年8月15日周四 下午4:32写道:

The partition driver has its Kconfig option, and the part_get_info_prt() interface are mendatory interface for partition drivers, always enable the macro to make partition driver works correctly.

---

Changes in v4:
- formate commit message to ~75 columns

Changes in v3: None
Changes in v2:
- add patch to use SPL_PARTITIONS so that we don't add disk driver for boards who don't need it.

 include/part.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
include/part.h +2 -9
index ebca546db5..7d00fae56f 100644
@@ -241,22 +241,15 @@ static inline int blk_get_device_part_str(const char
 *ifname,
 #endif
 
 /*
- * We don't support printing partition information in SPL and only support
- * getting partition information in a few cases.
+ * We don't support printing partition information in SPL
  */
 #ifdef CONFIG_SPL_BUILD
 # define part_print_ptr(x)     NULL
-# if defined(CONFIG_SPL_FS_EXT4) || defined(CONFIG_SPL_FS_FAT) || \
-       defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION)
-#  define part_get_info_ptr(x) x
-# else
-#  define part_get_info_ptr(x) NULL
-# endif
 #else
 #define part_print_ptr(x)      x
-#define part_get_info_ptr(x)   x
 #endif
 
+#define part_get_info_ptr(x)   x
 
 struct part_driver {
        const char *name;

--
2.17.1