{ UCLASS_PVBLOCK, "pvblock" },
};
-static enum if_type if_typename_to_iftype(const char *if_typename)
+static enum uclass_id if_typename_to_iftype(const char *if_typename)
{
int i;
return UCLASS_INVALID;
}
-static enum uclass_id if_type_to_uclass_id(enum if_type if_type)
+static enum uclass_id if_type_to_uclass_id(enum uclass_id if_type)
{
/*
* This strange adjustment is used because we use UCLASS_MASS_STORAGE
return if_type;
}
-const char *blk_get_if_type_name(enum if_type if_type)
+const char *blk_get_if_type_name(enum uclass_id if_type)
{
int i;
return "(none)";
}
-struct blk_desc *blk_get_devnum_by_type(enum if_type if_type, int devnum)
+struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum)
{
struct blk_desc *desc;
struct udevice *dev;
struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum)
{
enum uclass_id uclass_id;
- enum if_type type;
+ enum uclass_id type;
struct udevice *dev;
struct uclass *uc;
int ret;
* with a higher device number, -ENOENT if there is no such device but there
* is one with a higher number, or other -ve on other error.
*/
-static int get_desc(enum if_type if_type, int devnum, struct blk_desc **descp)
+static int get_desc(enum uclass_id if_type, int devnum, struct blk_desc **descp)
{
bool found_more = false;
struct udevice *dev;
return found_more ? -ENOENT : -ENODEV;
}
-int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart)
+int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart)
{
struct udevice *dev;
int ret;
return blk_select_hwpart(dev, hwpart);
}
-int blk_list_part(enum if_type if_type)
+int blk_list_part(enum uclass_id if_type)
{
struct blk_desc *desc;
int devnum, ok;
return 0;
}
-int blk_print_part_devnum(enum if_type if_type, int devnum)
+int blk_print_part_devnum(enum uclass_id if_type, int devnum)
{
struct blk_desc *desc;
int ret;
return 0;
}
-void blk_list_devices(enum if_type if_type)
+void blk_list_devices(enum uclass_id if_type)
{
struct blk_desc *desc;
int ret;
}
}
-int blk_print_device_num(enum if_type if_type, int devnum)
+int blk_print_device_num(enum uclass_id if_type, int devnum)
{
struct blk_desc *desc;
int ret;
return 0;
}
-int blk_show_device(enum if_type if_type, int devnum)
+int blk_show_device(enum uclass_id if_type, int devnum)
{
struct blk_desc *desc;
int ret;
return 0;
}
-ulong blk_read_devnum(enum if_type if_type, int devnum, lbaint_t start,
+ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
lbaint_t blkcnt, void *buffer)
{
struct blk_desc *desc;
return n;
}
-ulong blk_write_devnum(enum if_type if_type, int devnum, lbaint_t start,
+ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
lbaint_t blkcnt, const void *buffer)
{
struct blk_desc *desc;
return uclass_get_name(device_get_uclass_id(parent));
};
-int blk_find_max_devnum(enum if_type if_type)
+int blk_find_max_devnum(enum uclass_id if_type)
{
struct udevice *dev;
int max_devnum = -ENODEV;
return max_devnum;
}
-int blk_next_free_devnum(enum if_type if_type)
+int blk_next_free_devnum(enum uclass_id if_type)
{
int ret;
return count;
}
-static int blk_claim_devnum(enum if_type if_type, int devnum)
+static int blk_claim_devnum(enum uclass_id if_type, int devnum)
{
struct udevice *dev;
struct uclass *uc;
return NULL;
}
-const char *blk_get_if_type_name(enum if_type if_type)
+const char *blk_get_if_type_name(enum uclass_id if_type)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
return drv->get_dev(devnum, descp);
}
-int blk_list_part(enum if_type if_type)
+int blk_list_part(enum uclass_id if_type)
{
struct blk_driver *drv;
struct blk_desc *desc;
return 0;
}
-int blk_print_part_devnum(enum if_type if_type, int devnum)
+int blk_print_part_devnum(enum uclass_id if_type, int devnum)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
struct blk_desc *desc;
return 0;
}
-void blk_list_devices(enum if_type if_type)
+void blk_list_devices(enum uclass_id if_type)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
struct blk_desc *desc;
}
}
-int blk_print_device_num(enum if_type if_type, int devnum)
+int blk_print_device_num(enum uclass_id if_type, int devnum)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
struct blk_desc *desc;
return 0;
}
-int blk_show_device(enum if_type if_type, int devnum)
+int blk_show_device(enum uclass_id if_type, int devnum)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
struct blk_desc *desc;
return 0;
}
-struct blk_desc *blk_get_devnum_by_type(enum if_type if_type, int devnum)
+struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
struct blk_desc *desc;
return desc;
}
-ulong blk_read_devnum(enum if_type if_type, int devnum, lbaint_t start,
+ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
lbaint_t blkcnt, void *buffer)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
return n;
}
-ulong blk_write_devnum(enum if_type if_type, int devnum, lbaint_t start,
+ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
lbaint_t blkcnt, const void *buffer)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
return desc->block_write(desc, start, blkcnt, buffer);
}
-int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart)
+int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart)
{
struct blk_driver *drv = blk_driver_lookup_type(if_type);
struct blk_desc *desc;
return CONFIG_IS_ENABLED(BLK) || IS_ENABLED(CONFIG_SPL_LEGACY_BLOCK);
}
-/* Interface types: */
-#define if_type uclass_id
-
#define BLK_VEN_SIZE 40
#define BLK_PRD_SIZE 20
#define BLK_REV_SIZE 8
* TODO: With driver model we should be able to use the parent
* device's uclass instead.
*/
- enum if_type if_type; /* type of the interface */
+ enum uclass_id if_type; /* type of the interface */
int devnum; /* device number */
unsigned char part_type; /* partition type */
unsigned char target; /* target SCSI ID */
* This function does not activate the device. The device will be returned
* whether or not it is activated.
*
- * @if_type: Interface type (enum if_type_t)
+ * @if_type: Interface type (enum uclass_id_t)
* @devnum: Device number (specific to each interface type)
* @devp: the device, if found
* Return: 0 if found, -ENODEV if no device found, or other -ve error value
/**
* blk_get_device() - Find and probe a block device ready for use
*
- * @if_type: Interface type (enum if_type_t)
+ * @if_type: Interface type (enum uclass_id_t)
* @devnum: Device number (specific to each interface type)
* @devp: the device, if found
* Return: 0 if found, -ENODEV if no device found, or other -ve error value
* @parent: Parent of the new device
* @drv_name: Driver name to use for the block device
* @name: Name for the device
- * @if_type: Interface type (enum if_type_t)
+ * @if_type: Interface type (enum uclass_id_t)
* @devnum: Device number, specific to the interface type, or -1 to
* allocate the next available number
* @blksz: Block size of the device in bytes (typically 512)
* @parent: Parent of the new device
* @drv_name: Driver name to use for the block device
* @name: Name for the device (parent name is prepended)
- * @if_type: Interface type (enum if_type_t)
+ * @if_type: Interface type (enum uclass_id_t)
* @devnum: Device number, specific to the interface type, or -1 to
* allocate the next available number
* @blksz: Block size of the device in bytes (typically 512)
* Return: maximum device number found, or -ENODEV if none, or other -ve on
* error
*/
-int blk_find_max_devnum(enum if_type if_type);
+int blk_find_max_devnum(enum uclass_id if_type);
/**
* blk_next_free_devnum() - get the next device number for an interface type
* @if_type: Interface type to scan
* Return: next device number safe to use, or -ve on error
*/
-int blk_next_free_devnum(enum if_type if_type);
+int blk_next_free_devnum(enum uclass_id if_type);
/**
* blk_select_hwpart() - select a hardware partition
*/
struct blk_driver {
const char *if_typename;
- enum if_type if_type;
+ enum uclass_id if_type;
int max_devs;
struct blk_desc *desc;
/**
* @devnum: Device number
* Return: point to block device descriptor, or NULL if not found
*/
-struct blk_desc *blk_get_devnum_by_type(enum if_type if_type, int devnum);
+struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum);
/**
* blk_get_devnum_by_type() - Get a block device by type name, and number
* @if_type: Block device type
* Return: 0 if OK, -ENODEV if there is none of that type
*/
-int blk_list_part(enum if_type if_type);
+int blk_list_part(enum uclass_id if_type);
/**
* blk_list_devices() - list the block devices of a given type
*
* @if_type: Block device type
*/
-void blk_list_devices(enum if_type if_type);
+void blk_list_devices(enum uclass_id if_type);
/**
* blk_show_device() - show information about a given block device
* @devnum: Device number
* Return: 0 if OK, -ENODEV for invalid device number
*/
-int blk_show_device(enum if_type if_type, int devnum);
+int blk_show_device(enum uclass_id if_type, int devnum);
/**
* blk_print_device_num() - show information about a given block device
* Return: 0 if OK, -ENODEV for invalid device number, -ENOENT if the block
* device is not connected
*/
-int blk_print_device_num(enum if_type if_type, int devnum);
+int blk_print_device_num(enum uclass_id if_type, int devnum);
/**
* blk_print_part_devnum() - print the partition information for a device
* Return: 0 if OK, -ENOENT if the block device is not connected, -ENOSYS if
* the interface type is not supported, other -ve on other error
*/
-int blk_print_part_devnum(enum if_type if_type, int devnum);
+int blk_print_part_devnum(enum uclass_id if_type, int devnum);
/**
* blk_read_devnum() - read blocks from a device
* @buffer: Address to write data to
* Return: number of blocks read, or -ve error number on error
*/
-ulong blk_read_devnum(enum if_type if_type, int devnum, lbaint_t start,
+ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
lbaint_t blkcnt, void *buffer);
/**
* @buffer: Address to read data from
* Return: number of blocks written, or -ve error number on error
*/
-ulong blk_write_devnum(enum if_type if_type, int devnum, lbaint_t start,
+ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
lbaint_t blkcnt, const void *buffer);
/**
* @hwpart: Partition number to select
* Return: 0 if OK, -ve on error
*/
-int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart);
+int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart);
/**
* blk_get_if_type_name() - Get the name of an interface type
* @if_type: Interface type to check
* Return: name of interface, or NULL if none
*/
-const char *blk_get_if_type_name(enum if_type if_type);
+const char *blk_get_if_type_name(enum uclass_id if_type);
/**
* blk_common_cmd() - handle common commands with block devices
* @cur_devnump: Current device number for this interface type
* Return: 0 if OK, CMD_RET_ERROR on error
*/
-int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
+int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
int *cur_devnump);
enum blk_flag_t {