Andrew Scull | 1883487 | 2018-10-12 11:48:09 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2018 Google LLC |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Andrew Scull | fbc938a | 2018-08-20 14:09:28 +0100 | [diff] [blame] | 17 | #pragma once |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 18 | |
| 19 | #include <stdbool.h> |
Wedson Almeida Filho | fed6902 | 2018-07-11 15:39:12 +0100 | [diff] [blame] | 20 | #include <stddef.h> |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 21 | #include <stdint.h> |
| 22 | |
| 23 | struct fdt_node { |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 24 | const struct fdt_header *hdr; |
| 25 | const char *begin; |
| 26 | const char *end; |
| 27 | const char *strs; |
| 28 | }; |
| 29 | |
Wedson Almeida Filho | fed6902 | 2018-07-11 15:39:12 +0100 | [diff] [blame] | 30 | size_t fdt_header_size(void); |
| 31 | size_t fdt_total_size(struct fdt_header *hdr); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 32 | void fdt_dump(struct fdt_header *hdr); |
Wedson Almeida Filho | fdf4afc | 2018-07-19 15:45:21 +0100 | [diff] [blame] | 33 | bool fdt_root_node(struct fdt_node *node, const struct fdt_header *hdr); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 34 | bool fdt_find_child(struct fdt_node *node, const char *child); |
Wedson Almeida Filho | 8700964 | 2018-07-02 10:20:07 +0100 | [diff] [blame] | 35 | bool fdt_first_child(struct fdt_node *node, const char **child_name); |
| 36 | bool fdt_next_sibling(struct fdt_node *node, const char **sibling_name); |
Wedson Almeida Filho | 987c0ff | 2018-06-20 16:34:38 +0100 | [diff] [blame] | 37 | bool fdt_read_property(const struct fdt_node *node, const char *name, |
| 38 | const char **buf, uint32_t *size); |
| 39 | |
Andrew Scull | 4f170f5 | 2018-07-19 12:58:20 +0100 | [diff] [blame] | 40 | void fdt_add_mem_reservation(struct fdt_header *hdr, uint64_t addr, |
| 41 | uint64_t len); |