summaryrefslogtreecommitdiff
path: root/include/dtb_patch.h
blob: 7fbe2255f2ae2530736cf52b701f9179264db5df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __TB_DTB_PATCH_H
#define __TB_DTB_PATCH_H

#include <stdint.h>

/*
 * minimal dtb patcher, no libfdt. walks the flattened devicetree
 * structure per the devicetree specification (devicetree.dtsi format:
 * FDT_BEGIN_NODE, name, property, FDT_END_NODE) and rewrites the cpu
 * nodes for spin table bringup.
 *
 * what it does:
 *   /cpus/cpu@N: enable-method = "spin-table"
 *                cpu-release-addr = gate address of core N
 *   /psci: status = "disabled" (so the kernel falls back to the
 *                    spin table instead of trying hvc)
 *
 * properties are rewritten in place where the space fits, the
 * enable-method string shrinks, cpu-release-addr reuses the space
 * of an old value. new properties are appended to the last cpu node
 * by growing the struct block and moving the strings block.
 */

int tb_dtb_patch_spin_table(uintptr_t dtb, uintptr_t *gates, int ngates);

#endif /* __TB_DTB_PATCH_H */