On 3/27/23 06:00, Simon Glass wrote:
Hi Heinrich,

On Mon, 27 Mar 2023 at 06:27, Heinrich Schuchardt
<heinrich.schucha...@canonical.com> wrote:

Currently the device paths don't match the dm tree.
We should create a device path node per dm tree node.

Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
---
  include/dm/uclass.h | 5 +++++
  1 file changed, 5 insertions(+)

This affects very few uclasses but adds a field to all of them. I
think an event might be best for this. We can add an event spy in each
of the affected uclasses.

EVENT_SPY does not allow to return information to the emitter of the event.

event_notfify() does not allow to select a single recipient.

In struct uclass_driver there are many other fields that are rarely used:

        int (*post_bind)(struct udevice *dev);
        int (*pre_unbind)(struct udevice *dev);
        int (*pre_probe)(struct udevice *dev);
        int (*post_probe)(struct udevice *dev);
        int (*pre_remove)(struct udevice *dev);
        int (*child_post_bind)(struct udevice *dev);
        int (*child_pre_probe)(struct udevice *dev);
        int (*child_post_probe)(struct udevice *dev);

If we wanted to save memory in linker generated lists we would convert structures with pointers to variable size arrays e.g.

struct ops * =
{
{ POST_BIND, post_bind },
{ CHILD_POST_BIND, child_post_bind},
{ END, NULL },
}

Best regards

Heinrich




diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index ee15c92063..e11637ce4d 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -11,6 +11,7 @@

  #include <dm/ofnode.h>
  #include <dm/uclass-id.h>
+#include <efi.h>
  #include <linker_lists.h>
  #include <linux/list.h>

@@ -68,6 +69,7 @@ struct udevice;
   * @child_post_probe: Called after a child in this uclass is probed
   * @init: Called to set up the uclass
   * @destroy: Called to destroy the uclass
+ * @get_dp_node: Get EFI device path node
   * @priv_auto: If non-zero this is the size of the private data
   * to be allocated in the uclass's ->priv pointer. If zero, then the uclass
   * driver is responsible for allocating any data required.
@@ -99,6 +101,9 @@ struct uclass_driver {
         int (*child_post_probe)(struct udevice *dev);
         int (*init)(struct uclass *class);
         int (*destroy)(struct uclass *class);
+#if CONFIG_IS_ENABLED(EFI_LOADER)
+       struct efi_device_path *(*get_dp_node)(struct udevice *dev);
+#endif
         int priv_auto;
         int per_device_auto;
         int per_device_plat_auto;
--
2.39.2

Reply via email to