31 [&out, &count, max](
const char* node_name,
const char* compatible_data,
32 size_t compatible_len, uint64_t mmio_base,
33 size_t mmio_size, uint32_t irq) ->
bool {
34 if (count >= max)
return false;
35 if (compatible_data ==
nullptr || compatible_len == 0)
return true;
37 auto& node = out[count];
39 kstd::strncpy(node.name, node_name,
sizeof(node.name) - 1);
40 node.name[
sizeof(node.name) - 1] =
'\0';
44 node.mmio_base = mmio_base;
45 node.mmio_size = mmio_size;
48 size_t copy_len = compatible_len <
sizeof(node.compatible)
50 :
sizeof(node.compatible);
51 if (compatible_len >
sizeof(node.compatible)) {
52 klog::Warn(
"PlatformBus: compatible truncated {}\u2192{} for '{}'",
53 compatible_len,
sizeof(node.compatible), node_name);
55 kstd::memcpy(node.compatible, compatible_data, copy_len);
56 node.compatible_len = copy_len;
59 "PlatformBus: found '{}' compatible='{}' mmio={:#x} size={:#x} "
61 node_name, compatible_data, mmio_base, mmio_size, irq);
67 if (!result.has_value()) {
68 return std::unexpected(result.error());