1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2021 Linaro Limited
4 * Author: AKASHI Takahiro
10 #include <linux/list.h>
11 #include <linux/types.h>
17 /* Types of core tags that can be attached to devices */
29 DM_TAG_EFI = DM_TAG_ATTACH_COUNT,
37 * @sibling: List of dm-tag nodes
38 * @dev: Associated udevice
40 * @ptr: Pointer as a value
44 struct list_head sibling;
54 * dev_tag_set_ptr() - set a tag's value as a pointer
55 * @dev: Device to operate
57 * @ptr: Pointer to set
59 * Set the value, @ptr, as of @tag associated with the device, @dev
61 * Return: 0 on success, -ve on error
63 int dev_tag_set_ptr(struct udevice *dev, enum dm_tag_t tag, void *ptr);
66 * dev_tag_set_val() set a tag's value as an integer
67 * @dev: Device to operate
71 * Set the value, @val, as of @tag associated with the device, @dev
73 * Return: on success, -ve on error
75 int dev_tag_set_val(struct udevice *dev, enum dm_tag_t tag, ulong val);
78 * dev_tag_get_ptr() - get a tag's value as a pointer
79 * @dev: Device to operate
81 * @ptrp: Pointer to tag's value (pointer)
83 * Get a tag's value as a pointer
85 * Return: on success, -ve on error
87 int dev_tag_get_ptr(struct udevice *dev, enum dm_tag_t tag, void **ptrp);
90 * dev_tag_get_val() - get a tag's value as an integer
91 * @dev: Device to operate
93 * @valp: Pointer to tag's value (ulong)
95 * Get a tag's value as an integer
97 * Return: 0 on success, -ve on error
99 int dev_tag_get_val(struct udevice *dev, enum dm_tag_t tag, ulong *valp);
102 * dev_tag_del() - delete a tag
103 * @dev: Device to operate
106 * Delete a tag of @tag associated with the device, @dev
108 * Return: 0 on success, -ve on error
110 int dev_tag_del(struct udevice *dev, enum dm_tag_t tag);
113 * dev_tag_del_all() - delete all tags
114 * @dev: Device to operate
116 * Delete all the tags associated with the device, @dev
118 * Return: 0 on success, -ve on error
120 int dev_tag_del_all(struct udevice *dev);
123 * dev_tag_collect_stats() - Collect information on driver model performance
125 * This collects information on how driver model is performing. For now it only
126 * includes memory usage
128 * @stats: Place to put the collected information
130 void dev_tag_collect_stats(struct dm_stats *stats);
133 * tag_get_name() - Get the name of a tag
135 * @tag: Tag to look up, which must be valid
136 * Returns: Name of tag
138 const char *tag_get_name(enum dm_tag_t tag);
140 #endif /* _DM_TAG_H */