Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider a GetPropName DtIo call #75

Open
andreiw opened this issue Feb 13, 2024 · 0 comments
Open

Consider a GetPropName DtIo call #75

andreiw opened this issue Feb 13, 2024 · 0 comments

Comments

@andreiw
Copy link
Contributor

andreiw commented Feb 13, 2024

...with a signature like the following. This has no use in a driver, but it would be super-useful for the DtProp tool, to be able to explore a Devicetree in a UEFI system.

typedef
EFI_STATUS
(EFIAPI *EFI_DT_IO_PROTOCOL_GET_PROP_NAME)(
  IN  EFI_DT_IO_PROTOCOL *This,
  IN  UINTN              Index,
  OUT CONST CHAR8        **String
  );

Implementation-wise, this could do something like. Of course it would be terribly inefficient... but this shouldn't matter for a debug aid.

do {
	tag = fdt_next_tag(fdt, offset, &nextoffset);
	if (tag == FDT_END) {
		return;
	}

	if (tag == FDT_PROP) {
		prop = _fdt_offset_ptr(fdt, offset);
		n = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));

		for  (i = 0; i < depth; i++) {
			printk(" ");
		}
		printk("%s: 0x%x@0x%x\n", n,
		       fdt32_to_cpu(prop->len),
		       prop->data);
	}

	offset = nextoffset;
} while ((tag != FDT_BEGIN_NODE) && (tag != FDT_END_NODE));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant