| 113 | } |
| 114 | |
| 115 | int fdt_next_property(const void *blob, uint32_t offset, |
| 116 | struct fdt_property *prop) |
| 117 | { |
| 118 | struct fdt_header *header = (struct fdt_header *)blob; |
| 119 | |
| 120 | // skip NOP tokens |
| 121 | offset += fdt_skip_nops(blob, offset); |
| 122 | |
| 123 | uint32_t *ptr = (uint32_t *)(((uint8_t *)blob) + offset); |
| 124 | |
| 125 | int index = 0; |
| 126 | if (be32toh(ptr[index++]) != FDT_TOKEN_PROPERTY) |
| 127 | return 0; |
| 128 | |
| 129 | uint32_t size = be32toh(ptr[index++]); |
| 130 | uint32_t name_offset = be32toh(ptr[index++]); |
| 131 | name_offset += be32toh(header->strings_offset); |
| 132 | |
| 133 | if (prop) { |
| 134 | prop->name = (char *)((uint8_t *)blob + name_offset); |
| 135 | prop->data = &ptr[index]; |
| 136 | prop->size = size; |
| 137 | } |
| 138 | |
| 139 | index += DIV_ROUND_UP(size, sizeof(uint32_t)); |
| 140 | |
| 141 | return index * sizeof(uint32_t); |
| 142 | } |
| 143 | |
| 144 | /* |
| 145 | * fdt_next_node_name reads a node name |
no test coverage detected