summaryrefslogtreecommitdiffstats
path: root/include/part.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-02-29 15:25:41 -0700
committerSimon Glass <sjg@chromium.org>2016-03-14 15:34:50 -0600
commitfb1b7be9538dab7ce69208045cc3b80c6eb57f3b (patch)
tree8f324421031fda92240b2c500e21a3f918b84c5b /include/part.h
parent5ec4f1a5f35dc71881f88c84176c568308133640 (diff)
downloadtalos-obmc-uboot-fb1b7be9538dab7ce69208045cc3b80c6eb57f3b.tar.gz
talos-obmc-uboot-fb1b7be9538dab7ce69208045cc3b80c6eb57f3b.zip
dm: blk: Add comments to a few functions
The block interface is not well documented in the code. Pick two important functions and add comments. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'include/part.h')
-rw-r--r--include/part.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/part.h b/include/part.h
index 25999984df..4e70d8dba2 100644
--- a/include/part.h
+++ b/include/part.h
@@ -53,12 +53,42 @@ typedef struct disk_partition {
/* Misc _get_dev functions */
#ifdef CONFIG_PARTITIONS
+/**
+ * get_dev() - get a pointer to a block device given its type and number
+ *
+ * Each interface allocates its own devices and typically struct blk_desc is
+ * contained with the interface's data structure. There is no global
+ * numbering for block devices, so the interface name must be provided.
+ *
+ * @ifname: Interface name (e.g. "ide", "scsi")
+ * @dev: Device number (0 for first device on that interface, 1 for
+ * second, etc.
+ * @return pointer to the block device, or NULL if not available, or an
+ * error occurred.
+ */
struct blk_desc *get_dev(const char *ifname, int dev);
struct blk_desc *ide_get_dev(int dev);
struct blk_desc *sata_get_dev(int dev);
struct blk_desc *scsi_get_dev(int dev);
struct blk_desc *usb_stor_get_dev(int dev);
struct blk_desc *mmc_get_dev(int dev);
+
+/**
+ * mmc_select_hwpart() - Select the MMC hardware partiion on an MMC device
+ *
+ * MMC devices can support partitioning at the hardware level. This is quite
+ * separate from the normal idea of software-based partitions. MMC hardware
+ * partitions must be explicitly selected. Once selected only the region of
+ * the device covered by that partition is accessible.
+ *
+ * The MMC standard provides for two boot partitions (numbered 1 and 2),
+ * rpmb (3), and up to 4 addition general-purpose partitions (4-7).
+ *
+ * @dev_num: Block device number (struct blk_desc->dev value)
+ * @hwpart: Hardware partition number to select. 0 means the raw device,
+ * 1 is the first partition, 2 is the second, etc.
+ * @return 0 if OK, other value for an error
+ */
int mmc_select_hwpart(int dev_num, int hwpart);
struct blk_desc *systemace_get_dev(int dev);
struct blk_desc *mg_disk_get_dev(int dev);
OpenPOWER on IntegriCloud