Convert CONFIG_SYS_INTERLAKEN et al to Kconfig
[platform/kernel/u-boot.git] / include / part.h
index 53cfbdd..807370d 100644 (file)
@@ -10,6 +10,7 @@
 #include <ide.h>
 #include <uuid.h>
 #include <linker_lists.h>
+#include <linux/errno.h>
 #include <linux/list.h>
 
 struct block_drvr {
@@ -86,7 +87,7 @@ struct disk_part {
 };
 
 /* Misc _get_dev functions */
-#ifdef CONFIG_PARTITIONS
+#if CONFIG_IS_ENABLED(PARTITIONS)
 /**
  * blk_get_dev() - get a pointer to a block device given its type and number
  *
@@ -103,7 +104,6 @@ struct disk_part {
 struct blk_desc *blk_get_dev(const char *ifname, int dev);
 
 struct blk_desc *mg_disk_get_dev(int dev);
-int host_get_dev_err(int dev, struct blk_desc **blk_devp);
 
 /* disk/part.c */
 int part_get_info(struct blk_desc *dev_desc, int part,
@@ -275,6 +275,22 @@ static inline int blk_get_device_part_str(const char *ifname,
                                          struct disk_partition *info,
                                          int allow_whole_dev)
 { *dev_desc = NULL; return -1; }
+
+static inline int part_get_info_by_name_type(struct blk_desc *dev_desc,
+                                            const char *name,
+                                            struct disk_partition *info,
+                                            int part_type)
+{
+       return -ENOENT;
+}
+
+static inline int part_get_info_by_name(struct blk_desc *dev_desc,
+                                       const char *name,
+                                       struct disk_partition *info)
+{
+       return -ENOENT;
+}
+
 static inline int
 part_get_info_by_dev_and_name_or_num(const char *dev_iface,
                                     const char *dev_part_str,
@@ -287,6 +303,53 @@ part_get_info_by_dev_and_name_or_num(const char *dev_iface,
 }
 #endif
 
+struct udevice;
+/**
+ * part_create_block_devices - Create block devices for disk partitions
+ *
+ * Create UCLASS_PARTITION udevices for each of disk partitions in @parent
+ *
+ * @blk_dev:   Whole disk device
+ */
+int part_create_block_devices(struct udevice *blk_dev);
+
+/**
+ * disk_blk_read() - read blocks from a disk partition
+ *
+ * @dev:       Device to read from (UCLASS_PARTITION)
+ * @start:     Start block number to read in the partition (0=first)
+ * @blkcnt:    Number of blocks to read
+ * @buffer:    Destination buffer for data read
+ * Returns: number of blocks read, or -ve error number (see the
+ * IS_ERR_VALUE() macro
+ */
+ulong disk_blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
+                   void *buffer);
+
+/**
+ * disk_blk_write() - write to a disk partition
+ *
+ * @dev:       Device to write to (UCLASS_PARTITION)
+ * @start:     Start block number to write in the partition (0=first)
+ * @blkcnt:    Number of blocks to write
+ * @buffer:    Source buffer for data to write
+ * Returns: number of blocks written, or -ve error number (see the
+ * IS_ERR_VALUE() macro
+ */
+ulong disk_blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
+                    const void *buffer);
+
+/**
+ * disk_blk_erase() - erase a section of a disk partition
+ *
+ * @dev:       Device to (partially) erase (UCLASS_PARTITION)
+ * @start:     Start block number to erase in the partition (0=first)
+ * @blkcnt:    Number of blocks to erase
+ * Returns: number of blocks erased, or -ve error number (see the
+ * IS_ERR_VALUE() macro
+ */
+ulong disk_blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
+
 /*
  * We don't support printing partition information in SPL and only support
  * getting partition information in a few cases.
@@ -434,6 +497,16 @@ int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head,
                       gpt_entry **gpt_pte);
 
 /**
+ * gpt_repair_headers() - Function to repair the GPT's header
+ *                        and partition table entries (PTE)
+ *
+ * @param dev_desc - block device descriptor
+ *
+ * Return: - '0' on success, otherwise error
+ */
+int gpt_repair_headers(struct blk_desc *dev_desc);
+
+/**
  * gpt_verify_partitions() - Function to check if partitions' name, start and
  *                           size correspond to '$partitions' env variable
  *
@@ -496,7 +569,7 @@ int layout_mbr_partitions(struct disk_partition *p, int count,
 
 #endif
 
-#ifdef CONFIG_PARTITIONS
+#if CONFIG_IS_ENABLED(PARTITIONS)
 /**
  * part_driver_get_count() - get partition driver count
  *